diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-06-02 20:57:05 -0300 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-06-02 20:57:05 -0300 |
commit | 76b5b59ca0cba6e4241b52aaedc77dc92dea5080 (patch) | |
tree | cd152ae376296ef39f2f25abbf5bd70e394b9414 /scripts | |
parent | changed the atoms returned by the packages method and added a nodeps argument... (diff) | |
download | g-octave-76b5b59ca0cba6e4241b52aaedc77dc92dea5080.tar.gz g-octave-76b5b59ca0cba6e4241b52aaedc77dc92dea5080.tar.bz2 g-octave-76b5b59ca0cba6e4241b52aaedc77dc92dea5080.zip |
Initial import of scripts/tinderbox.py
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/tinderbox.py | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/scripts/tinderbox.py b/scripts/tinderbox.py new file mode 100755 index 0000000..3bddf67 --- /dev/null +++ b/scripts/tinderbox.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" + tinderbox.py + ~~~~~~~~~~~~ + + a simple script that tries to build all the packages in the package + database and report possible build errors. + + :copyright: (c) 2010 by Rafael Goncalves Martins + :license: GPL-2, see LICENSE for more details. +""" + +import sys +import os + +# This block ensures that ^C interrupts are handled quietly. +# Code snippet from Portage +try: + import signal + + def exithandler(signum,frame): + signal.signal(signal.SIGINT, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + sys.exit(1) + + signal.signal(signal.SIGINT, exithandler) + signal.signal(signal.SIGTERM, exithandler) + +except KeyboardInterrupt: + sys.exit(1) + +current_dir = os.path.dirname(os.path.realpath(__file__)) +if os.path.exists(os.path.join(current_dir, '..', 'g_octave')): + sys.path.insert(0, os.path.join(current_dir, '..')) + +import subprocess + +from g_octave import config, description_tree, ebuild, fetch, overlay + +def build_package(pkgatom): + proc = subprocess.call([ + 'emerge', + '--nodeps', + '--nospinner', + '--verbose', + '--oneshot', + pkgatom + ]) + if proc != os.EX_OK: + bug_report(pkgatom) + return False + return True + + +def remove_packages(pkglist): + proc = subprocess.call([ + 'emerge', + '--unmerge', + pkglist + ]) + return proc == os.EX_OK + + +def bug_report(pkgatom): + pass + + +def main(argv): + fetch.check_db_cache() + conf = config.Config() + + # creating the overlay + overlay.create_overlay() + + desc_tree = description_tree.DescriptionTree() + + # creating the ebuilds for all the packages + for pkgatom in desc_tree.packages(): + e = ebuild.Ebuild(pkgatom) + try: + e.create(nodeps=True) + except: + pass + + installed_packages = [] + + try: + for pkgatom in desc_tree.packages(): + if build_package('=g-octave/'+pkgatom): + installed_packages.append('=g-octave/'+pkgatom) + except: + pass + finally: + remove_packages(installed_packages) + + +if __name__ == '__main__': + sys.exit(main(sys.argv)) |