diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-26 20:47:28 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-26 20:47:28 (GMT) |
commit | f67616f4a1b6d6f06c47f288538d8fb1d72c1801 (patch) | |
tree | 9d74b41d844e49484f20985271b4ccf2111132f6 | |
parent | 4c215580bfe2198f2d071098b040964be2501460 (diff) |
Cleanup and extend build commands
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | Makefile.commands | 9 | ||||
-rwxr-xr-x | commands/build | 2 | ||||
-rwxr-xr-x | commands/helpers/build | 14 | ||||
-rwxr-xr-x | commands/pull | 18 | ||||
-rw-r--r-- | config/modules/system-3.4.json | 6 | ||||
-rw-r--r-- | devbot/build.py | 93 |
7 files changed, 103 insertions, 41 deletions
@@ -4,7 +4,7 @@ HELPERS_DIR=$(COMMANDS_DIR)/helpers .PHONY: all -all: build +all: check-system pull build include Makefile.config include Makefile.commands diff --git a/Makefile.commands b/Makefile.commands index 3b34341..04f228c 100644 --- a/Makefile.commands +++ b/Makefile.commands @@ -6,6 +6,9 @@ auto-install: check-system: @$(COMMANDS_DIR)/check-system $(ARGS) +pull: + @$(COMMANDS_DIR)/pull + build: @$(COMMANDS_DIR)/build @@ -23,3 +26,9 @@ bug-report: clean: helpers-clean @$(COMMANDS_DIR)/clean + +build-%: + @$(COMMANDS_DIR)/build $* + +pull-%: + @$(COMMANDS_DIR)/pull $* diff --git a/commands/build b/commands/build index 6c06133..71c69be 100755 --- a/commands/build +++ b/commands/build @@ -10,6 +10,6 @@ logfile=$logsdir/build-$timestamp.log mkdir -p $logsdir -PYTHONPATH=$commandsdir $helpersdir/build | tee -a $logfile +PYTHONPATH=$commandsdir $helpersdir/build $@ | tee -a $logfile exit ${PIPESTATUS[0]} diff --git a/commands/helpers/build b/commands/helpers/build index 1904955..a8405c8 100755 --- a/commands/helpers/build +++ b/commands/helpers/build @@ -1,10 +1,18 @@ #!/usr/bin/python -u +import argparse + import common from devbot import build -from devbot import system + +parser = argparse.ArgumentParser() +parser.add_argument("module", nargs="?", help="name of the module to build") +args = parser.parse_args() common.setup() -system.check() -build.build() + +if args.module: + build.build_one(args.module) +else: + build.build() diff --git a/commands/pull b/commands/pull new file mode 100755 index 0000000..0900295 --- /dev/null +++ b/commands/pull @@ -0,0 +1,18 @@ +#!/usr/bin/python -u + +import argparse + +import common + +from devbot import build + +parser = argparse.ArgumentParser() +parser.add_argument("module", nargs="?", help="name of the module to pull") +args = parser.parse_args() + +common.setup() + +if args.module: + build.pull_one(args.module) +else: + build.pull() diff --git a/config/modules/system-3.4.json b/config/modules/system-3.4.json index 719e1df..d92541b 100644 --- a/config/modules/system-3.4.json +++ b/config/modules/system-3.4.json @@ -44,7 +44,7 @@ "branch": "1.0.2", "name": "gstreamer", "options": [ - "--disable-gtk-doc-html" + "--disable-gtk-doc" ], "out-of-source": false, "repo": "git://anongit.freedesktop.org/gstreamer/gstreamer" @@ -53,7 +53,7 @@ "branch": "1.0.2", "name": "gst-plugins-base", "options": [ - "--disable-gtk-doc-html" + "--disable-gtk-doc" ], "out-of-source": false, "repo": "git://anongit.freedesktop.org/gstreamer/gst-plugins-base" @@ -62,7 +62,7 @@ "branch": "1.0.2", "name": "gst-plugins-good", "options": [ - "--disable-gtk-doc-html" + "--disable-gtk-doc" ], "out-of-source": false, "repo": "git://anongit.freedesktop.org/gstreamer/gst-plugins-good" diff --git a/devbot/build.py b/devbot/build.py index 6705274..09580a2 100644 --- a/devbot/build.py +++ b/devbot/build.py @@ -17,7 +17,7 @@ def unlink_libtool_files(): os.path.walk(config.lib_dir, func, None) -def pull_source(module): +def pull_git_module(module): module_dir = module.get_source_dir() if os.path.exists(module_dir): @@ -27,27 +27,37 @@ def pull_source(module): command.run(["git", "remote", "update", "origin"], retry=10) else: os.chdir(config.get_source_dir()) - command.run(["git", "clone", "--progress", - module.repo, module.name], + command.run(["git", "clone", "--progress", module.repo, module.name], retry=10) os.chdir(module_dir) command.run(["git", "checkout", module.branch]) +def pull_module(module): + print "\n=== Pulling %s ===\n" % module.name + + try: + pull_git_module(module) + except subprocess.CalledProcessError: + sys.exit(1) + def build_make(module): command.run(["make"]) def build_autotools(module): - autogen = os.path.join(module.get_source_dir(), "autogen.sh") + makefile_path = os.path.join(module.get_build_dir(), "Makefile") - jobs = multiprocessing.cpu_count() * 2 + if not os.path.exists(makefile_path): + autogen = os.path.join(module.get_source_dir(), "autogen.sh") + + args = [autogen, + "--prefix", config.prefix_dir, + "--libdir", config.lib_dir] + args.extend(module.options) - args = [autogen, - "--prefix", config.prefix_dir, - "--libdir", config.lib_dir] - args.extend(module.options) + command.run(args) - command.run(args) + jobs = multiprocessing.cpu_count() * 2 command.run(["make", "-j", "%d" % jobs]) command.run(["make", "install"]) @@ -58,6 +68,8 @@ def build_activity(module): command.run(["./setup.py", "install", "--prefix", config.prefix_dir]) def build_module(module): + print "\n=== Building %s ===\n" % module.name + module_source_dir = module.get_source_dir() if module.out_of_source: @@ -70,14 +82,16 @@ def build_module(module): else: os.chdir(module_source_dir) - if os.path.exists(os.path.join(module_source_dir, "setup.py")): - build_activity(module) - elif os.path.exists(os.path.join(module_source_dir, "autogen.sh")): - build_autotools(module) - elif os.path.exists(os.path.join(module_source_dir, "Makefile")): - build_make(module) - else: - print "Unknown build system" + try: + if os.path.exists(os.path.join(module_source_dir, "setup.py")): + build_activity(module) + elif os.path.exists(os.path.join(module_source_dir, "autogen.sh")): + build_autotools(module) + elif os.path.exists(os.path.join(module_source_dir, "Makefile")): + build_make(module) + else: + raise RuntimeError("Unknown build system") + except subprocess.CalledProcessError: sys.exit(1) state.touch_built_commit_id(module) @@ -92,27 +106,40 @@ def rmtree(dir): print "Deleting %s" % dir shutil.rmtree(dir, ignore_errors=True) -def build(): +def build_one(module_name): environ.setup() - modules = config.load_modules() + for module in config.load_modules(): + if module.name == module_name: + build_module(module) - for i, module in enumerate(modules): - print "\n=== Building %s ===\n" % module.name +def pull_one(module_name): + environ.setup() + + for module in config.load_modules(): + if module.name == module_name: + pull_module(module) - try: - pull_source(module) +def pull(): + environ.setup() - old_commit_id = state.get_built_commit_id(module) - new_commit_id = module.get_commit_id() + for module in config.load_modules(): + pull_module(module) - if old_commit_id is None or old_commit_id != new_commit_id: - clear_built_modules(modules, i) - build_module(module) - else: - print "\n* Already built, skipping *" - except subprocess.CalledProcessError: - sys.exit(1) +def build(): + environ.setup() + + modules = config.load_modules() + + for i, module in enumerate(modules): + old_commit_id = state.get_built_commit_id(module) + new_commit_id = module.get_commit_id() + + if old_commit_id is None or old_commit_id != new_commit_id: + clear_built_modules(modules, i) + build_module(module) + else: + print "\n* Already built, skipping *" def clean(): rmtree(config.install_dir) |