From 07f237ba496428453896cdfaf9973c1a0590e10f Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Fri, 16 Nov 2012 14:24:40 +0000 Subject: Cleanup makefiles --- diff --git a/Makefile b/Makefile index 7b796d5..4704657 100644 --- a/Makefile +++ b/Makefile @@ -1,44 +1,29 @@ COMMANDS = $(CURDIR)/commands -all: build - -XRANDR_LIBS = $(shell pkg-config --libs xrandr x11) -X11_LIBS = $(shell pkg-config --libs x11) - -commands/helpers/list-outputs: commands/helpers/list-outputs.c - gcc -o commands/helpers/list-outputs \ - commands/helpers/list-outputs.c $(XRANDR_LIBS) +include Makefile.helpers -commands/helpers/find-free-display: commands/helpers/find-free-display.c - gcc -o commands/helpers/find-free-display \ - commands/helpers/find-free-display.c $(X11_LIBS) - -x11-utils: commands/helpers/list-outputs commands/helpers/find-free-display +all: build check-system: - $(COMMANDS)/check-system $(ARGS) + @$(COMMANDS)/check-system $(ARGS) build: check-system - $(COMMANDS)/build + @$(COMMANDS)/build -run: x11-utils - $(COMMANDS)/run +run: helpers + @$(COMMANDS)/run -run-command: x11-utils - $(COMMANDS)/run-command +run-command: helpers + @$(COMMANDS)/run-command -test: x11-utils - $(COMMANDS)/test +test: helpers + @$(COMMANDS)/test -shell: x11-utils - @PS1="[sugar-build \W]$$ " \ - $(COMMANDS)/shell +shell: helpers + @$(COMMANDS)/shell bug-report: - $(COMMANDS)/bug-report + @$(COMMANDS)/bug-report -clean: - $(COMMANDS)/clean - rm -f logs/*.log logs/all-logs.tar.bz2 - rm -f scripts/list-outputs - rm -f scripts/find-free-display +clean: clean-helpers + @$(COMMANDS)/clean diff --git a/Makefile.helpers b/Makefile.helpers new file mode 100644 index 0000000..7bd2ad4 --- /dev/null +++ b/Makefile.helpers @@ -0,0 +1,17 @@ +HELPERS = $(COMMANDS)/helpers + +XRANDR_LIBS = $(shell pkg-config --libs xrandr x11) +X11_LIBS = $(shell pkg-config --libs x11) + +$(HELPERS)/list-outputs: $(HELPERS)/list-outputs.c + gcc -o $(HELPERS)/list-outputs \ + $(HELPERS)/list-outputs.c $(XRANDR_LIBS) + +$(HELPERS)/find-free-display: $(HELPERS)/find-free-display.c + gcc -o $(HELPERS)/find-free-display \ + $(HELPERS)/find-free-display.c $(X11_LIBS) + +helpers: $(HELPERS)/list-outputs $(HELPERS)/find-free-display + +clean-helpers: + rm -f $(HELPERS)/list-outputs $(HELPERS)/find-free-display diff --git a/commands/clean b/commands/clean index fc29466..5fdee2f 100755 --- a/commands/clean +++ b/commands/clean @@ -1,8 +1,29 @@ #!/usr/bin/python +import glob +import os + import common from devbot import build +from devbot import config common.setup() build.clean() + +os.chdir(config.logs_dir) + +print "Deleting logs" + +try: + os.unlink("all-logs.tar.bz2") +except OSError: + # Migth not exist + pass + +for filename in glob.glob("*.log"): + try: + os.unlink(filename) + except OSError: + # Files migth not exist + pass diff --git a/commands/common.py b/commands/common.py index 563783f..4197912 100644 --- a/commands/common.py +++ b/commands/common.py @@ -14,3 +14,4 @@ def setup(): config.set_source_dir(os.path.join(base_path, "source")) config.set_build_dir(os.path.join(base_path, "build")) config.set_commands_dir(os.path.join(base_path, "commands")) + config.set_logs_dir(os.path.join(base_path, "logs")) diff --git a/devbot/config.py b/devbot/config.py index 248eab7..bfcc966 100644 --- a/devbot/config.py +++ b/devbot/config.py @@ -4,6 +4,7 @@ import os from devbot import distro config_dir = None +logs_dir = None commands_dir = None install_dir = None source_dir = None @@ -24,6 +25,10 @@ def set_config_dir(dir): global config_dir config_dir = dir +def set_logs_dir(dir): + global logs_dir + logs_dir = dir + def set_install_dir(dir): global install_dir global devbot_dir diff --git a/devbot/environ.py b/devbot/environ.py index d4c143c..8761303 100644 --- a/devbot/environ.py +++ b/devbot/environ.py @@ -49,6 +49,7 @@ def _setup_variables(): os.environ["GTK_DATA_PREFIX"] = config.install_dir os.environ["GTK_PATH"] = os.path.join(config.lib_dir, "gtk-2.0") + os.environ["PS1"] = "[sugar-build \W]$ " def _setup_gconf(): gconf_dir = os.path.join(config.etc_dir, "gconf") -- cgit v0.9.1