diff options
Diffstat (limited to 'scripts')
240 files changed, 28980 insertions, 24207 deletions
diff --git a/scripts/bitbake-prserv-tool b/scripts/bitbake-prserv-tool index 96a34702c9..fa31b52584 100755 --- a/scripts/bitbake-prserv-tool +++ b/scripts/bitbake-prserv-tool @@ -5,8 +5,8 @@ help () base=`basename $0` echo -e "Usage: $base command" echo "Avaliable commands:" - echo -e "\texport <file>: export and lock down the AUTOPR values from the PR service into a file for release." - echo -e "\timport <file>: import the AUTOPR values from the exported file into the PR service." + echo -e "\texport <file.conf>: export and lock down the AUTOPR values from the PR service into a file for release." + echo -e "\timport <file.conf>: import the AUTOPR values from the exported file into the PR service." } clean_cache() @@ -86,6 +86,15 @@ do_migrate_localcount () [ $# -eq 0 ] && help && exit 1 +case $2 in +*.conf|*.inc) + ;; +*) + echo ERROR: $2 must end with .conf or .inc! + exit 1 + ;; +esac + case $1 in export) do_export $2 diff --git a/scripts/bitbake-whatchanged b/scripts/bitbake-whatchanged index 90ad2f850c..0207777e63 100755 --- a/scripts/bitbake-whatchanged +++ b/scripts/bitbake-whatchanged @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- @@ -17,7 +17,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -from __future__ import print_function import os import sys import getopt @@ -25,19 +24,21 @@ import shutil import re import warnings import subprocess -from optparse import OptionParser +import argparse -# Figure out where is the bitbake/lib/bb since we need bb.siggen and bb.process -p = subprocess.Popen("bash -c 'echo $(dirname $(which bitbake-diffsigs | grep -v \'^alias\'))/../lib'", - shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) +scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] -err = p.stderr.read() -if err: - print("ERROR: Failed to locate bitbake-diffsigs:", file=sys.stderr) - print(err, file=sys.stderr) - sys.exit(1) +import scriptpath -sys.path.insert(0, p.stdout.read().rstrip('\n')) +# Figure out where is the bitbake/lib/bb since we need bb.siggen and bb.process +bitbakepath = scriptpath.add_bitbake_lib_path() +if not bitbakepath: + sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n") + sys.exit(1) +scriptpath.add_oe_lib_path() +import argparse_oe import bb.siggen import bb.process @@ -118,7 +119,7 @@ def print_added(d_new = None, d_old = None): Print the newly added tasks """ added = {} - for k in d_new.keys(): + for k in list(d_new.keys()): if k not in d_old: # Add the new one to added dict, and remove it from # d_new, so the remaining ones are the changed ones @@ -153,7 +154,7 @@ def print_vrchanged(d_new = None, d_old = None, vr = None): """ pvchanged = {} counter = 0 - for k in d_new.keys(): + for k in list(d_new.keys()): if d_new.get(k).get(vr) != d_old.get(k).get(vr): counter += 1 pn, task = split_pntask(k) @@ -190,7 +191,7 @@ def print_depchanged(d_new = None, d_old = None, verbose = False): if sigdata_re.match(full_path_old) and sigdata_re.match(full_path_new): output = bb.siggen.compare_sigfiles(full_path_old, full_path_new) if output: - print("\n=== The verbose changes of %s.do_%s:" % (pn, task)) + print("\n=== The verbose changes of %s.%s:" % (pn, task)) print('\n'.join(output)) else: # Format the output, the format is: @@ -219,9 +220,7 @@ def main(): 3) Use bb.siggen.compare_sigfiles to diff the old and new stamps """ - parser = OptionParser( - version = "1.0", - usage = """%prog [options] [package ...] + parser = argparse_oe.ArgumentParser(usage = """%(prog)s [options] [package ...] print what will be done between the current and last builds, for example: $ bitbake core-image-sato @@ -236,17 +235,9 @@ Note: The "nostamp" task is not included. """ ) - parser.add_option("-v", "--verbose", help = "print the verbose changes", - action = "store_true", dest = "verbose") - - options, args = parser.parse_args(sys.argv) - - verbose = options.verbose - - if len(args) != 2: - parser.error("Incorrect number of arguments") - else: - recipe = args[1] + parser.add_argument("recipe", help="recipe to check") + parser.add_argument("-v", "--verbose", help = "print the verbose changes", action = "store_true") + args = parser.parse_args() # Get the STAMPS_DIR print("Figuring out the STAMPS_DIR ...") @@ -256,7 +247,7 @@ Note: except: raise if not stampsdir: - print("ERROR: No STAMPS_DIR found for '%s'" % recipe, file=sys.stderr) + print("ERROR: No STAMPS_DIR found for '%s'" % args.recipe, file=sys.stderr) return 2 stampsdir = stampsdir.rstrip("\n") if not os.path.isdir(stampsdir): @@ -272,7 +263,7 @@ Note: try: # Generate the new stamps dir print("Generating the new stamps ... (need several minutes)") - cmdline = "STAMPS_DIR=%s bitbake -S %s" % (new_stampsdir, recipe) + cmdline = "STAMPS_DIR=%s bitbake -S none %s" % (new_stampsdir, args.recipe) # FIXME # The "bitbake -S" may fail, not fatal error, the stamps will still # be generated, this might be a bug of "bitbake -S". @@ -287,7 +278,7 @@ Note: # Remove the same one from both stamps. cnt_unchanged = 0 - for k in new_dict.keys(): + for k in list(new_dict.keys()): if k in old_dict: cnt_unchanged += 1 del(new_dict[k]) @@ -310,17 +301,17 @@ Note: # PV (including PE) and PR changed # Let the bb.siggen handle them if verbose cnt_rv = {} - if not verbose: + if not args.verbose: for i in ('pv', 'pr'): cnt_rv[i] = print_vrchanged(new_recon, old_recon, i) # Dependencies changed (use bitbake-diffsigs) - cnt_dep = print_depchanged(new_recon, old_recon, verbose) + cnt_dep = print_depchanged(new_recon, old_recon, args.verbose) total_changed = cnt_added + (cnt_rv.get('pv') or 0) + (cnt_rv.get('pr') or 0) + cnt_dep print("\n=== Summary: (%s changed, %s unchanged)" % (total_changed, cnt_unchanged)) - if verbose: + if args.verbose: print("Newly added: %s\nDependencies changed: %s\n" % \ (cnt_added, cnt_dep)) else: diff --git a/scripts/buildhistory-collect-srcrevs b/scripts/buildhistory-collect-srcrevs index 58a2708032..d375b045d8 100755 --- a/scripts/buildhistory-collect-srcrevs +++ b/scripts/buildhistory-collect-srcrevs @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Collects the recorded SRCREV values from buildhistory and reports on them # @@ -18,7 +18,9 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import os, sys +import collections +import os +import sys import optparse import logging @@ -65,16 +67,13 @@ def main(): else: forcevariable = '' - lastdir = '' + all_srcrevs = collections.defaultdict(list) for root, dirs, files in os.walk(options.buildhistory_dir): if '.git' in dirs: dirs.remove('.git') for fn in files: if fn == 'latest_srcrev': curdir = os.path.basename(os.path.dirname(root)) - if lastdir != curdir: - print('# %s' % curdir) - lastdir = curdir fullpath = os.path.join(root, fn) pn = os.path.basename(root) srcrev = None @@ -98,11 +97,20 @@ def main(): name = splitval[0].split('_')[1].strip() srcrevs[name] = value if srcrev and (options.reportall or srcrev != orig_srcrev): - print('SRCREV_pn-%s%s = "%s"' % (pn, forcevariable, srcrev)) + all_srcrevs[curdir].append((pn, None, srcrev)) for name, value in srcrevs.items(): orig = orig_srcrevs.get(name, orig_srcrev) if options.reportall or value != orig: - print('SRCREV_%s_pn-%s%s = "%s"' % (name, pn, forcevariable, value)) + all_srcrevs[curdir].append((pn, name, value)) + + for curdir, srcrevs in sorted(all_srcrevs.items()): + if srcrevs: + print('# %s' % curdir) + for pn, name, srcrev in srcrevs: + if name: + print('SRCREV_%s_pn-%s%s = "%s"' % (name, pn, forcevariable, srcrev)) + else: + print('SRCREV_pn-%s%s = "%s"' % (pn, forcevariable, srcrev)) if __name__ == "__main__": diff --git a/scripts/buildhistory-diff b/scripts/buildhistory-diff index b82240d763..dd9745e80c 100755 --- a/scripts/buildhistory-diff +++ b/scripts/buildhistory-diff @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Report significant differences in the buildhistory repository since a specific revision # @@ -14,7 +14,7 @@ from distutils.version import LooseVersion try: import git except ImportError: - print("Please install GitPython (python-git) 0.3.1 or later in order to use this script") + print("Please install GitPython (python3-git) 0.3.4 or later in order to use this script") sys.exit(1) def main(): @@ -27,6 +27,18 @@ def main(): parser.add_option("-p", "--buildhistory-dir", help = "Specify path to buildhistory directory (defaults to buildhistory/ under cwd)", action="store", dest="buildhistory_dir", default='buildhistory/') + parser.add_option("-v", "--report-version", + help = "Report changes in PKGE/PKGV/PKGR even when the values are still the default (PE/PV/PR)", + action="store_true", dest="report_ver", default=False) + parser.add_option("-a", "--report-all", + help = "Report all changes, not just the default significant ones", + action="store_true", dest="report_all", default=False) + parser.add_option("-s", "--signatures", + help = "Report list of signatures differing instead of output", + action="store_true", dest="sigs", default=False) + parser.add_option("-S", "--signatures-with-diff", + help = "Report on actual signature differences instead of output (requires signature data to have been generated, either by running the actual tasks or using bitbake -S)", + action="store_true", dest="sigsdiff", default=False) options, args = parser.parse_args(sys.argv) @@ -40,28 +52,29 @@ def main(): sys.exit(1) if not os.path.exists(options.buildhistory_dir): + if options.buildhistory_dir == 'buildhistory/': + cwd = os.getcwd() + if os.path.basename(cwd) == 'buildhistory': + options.buildhistory_dir = cwd + if not os.path.exists(options.buildhistory_dir): sys.stderr.write('Buildhistory directory "%s" does not exist\n\n' % options.buildhistory_dir) parser.print_help() sys.exit(1) + scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) + lib_path = scripts_path + '/lib' + sys.path = sys.path + [lib_path] + + import scriptpath + # Set path to OE lib dir so we can import the buildhistory_analysis module - basepath = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])) + '/..') - newpath = basepath + '/meta/lib' + scriptpath.add_oe_lib_path() # Set path to bitbake lib dir so the buildhistory_analysis module can load bb.utils - if os.path.exists(basepath + '/bitbake/lib/bb'): - bitbakepath = basepath + '/bitbake' - else: - # look for bitbake/bin dir in PATH - bitbakepath = None - for pth in os.environ['PATH'].split(':'): - if os.path.exists(os.path.join(pth, '../lib/bb')): - bitbakepath = os.path.abspath(os.path.join(pth, '..')) - break - if not bitbakepath: - sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n") - sys.exit(1) - - sys.path[0:0] = [newpath, bitbakepath + '/lib'] + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n") + sys.exit(1) + import oe.buildhistory_analysis fromrev = 'build-minus-1' @@ -79,7 +92,7 @@ def main(): import gitdb try: - changes = oe.buildhistory_analysis.process_changes(options.buildhistory_dir, fromrev, torev) + changes = oe.buildhistory_analysis.process_changes(options.buildhistory_dir, fromrev, torev, options.report_all, options.report_ver, options.sigs, options.sigsdiff) except gitdb.exc.BadObject as e: if len(args) == 1: sys.stderr.write("Unable to find previous build revision in buildhistory repository\n\n") diff --git a/scripts/buildstats-diff b/scripts/buildstats-diff new file mode 100755 index 0000000000..adeba44988 --- /dev/null +++ b/scripts/buildstats-diff @@ -0,0 +1,536 @@ +#!/usr/bin/python3 +# +# Script for comparing buildstats from two different builds +# +# Copyright (c) 2016, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +import argparse +import glob +import json +import logging +import math +import os +import re +import sys +from collections import namedtuple +from operator import attrgetter + +# Setup logging +logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") +log = logging.getLogger() + + +class ScriptError(Exception): + """Exception for internal error handling of this script""" + pass + + +taskdiff_fields = ('pkg', 'pkg_op', 'task', 'task_op', 'value1', 'value2', + 'absdiff', 'reldiff') +TaskDiff = namedtuple('TaskDiff', ' '.join(taskdiff_fields)) + + +class BSTask(dict): + def __init__(self, *args, **kwargs): + self['start_time'] = None + self['elapsed_time'] = None + self['status'] = None + self['iostat'] = {} + self['rusage'] = {} + self['child_rusage'] = {} + super(BSTask, self).__init__(*args, **kwargs) + + @property + def cputime(self): + """Sum of user and system time taken by the task""" + return self['rusage']['ru_stime'] + self['rusage']['ru_utime'] + \ + self['child_rusage']['ru_stime'] + self['child_rusage']['ru_utime'] + + @property + def walltime(self): + """Elapsed wall clock time""" + return self['elapsed_time'] + + @property + def read_bytes(self): + """Bytes read from the block layer""" + return self['iostat']['read_bytes'] + + @property + def write_bytes(self): + """Bytes written to the block layer""" + return self['iostat']['write_bytes'] + + @property + def read_ops(self): + """Number of read operations on the block layer""" + return self['rusage']['ru_inblock'] + self['child_rusage']['ru_inblock'] + + @property + def write_ops(self): + """Number of write operations on the block layer""" + return self['rusage']['ru_oublock'] + self['child_rusage']['ru_oublock'] + + +def read_buildstats_file(buildstat_file): + """Convert buildstat text file into dict/json""" + bs_task = BSTask() + log.debug("Reading task buildstats from %s", buildstat_file) + with open(buildstat_file) as fobj: + for line in fobj.readlines(): + key, val = line.split(':', 1) + val = val.strip() + if key == 'Started': + start_time = float(val) + bs_task['start_time'] = start_time + elif key == 'Ended': + end_time = float(val) + elif key.startswith('IO '): + split = key.split() + bs_task['iostat'][split[1]] = int(val) + elif key.find('rusage') >= 0: + split = key.split() + ru_key = split[-1] + if ru_key in ('ru_stime', 'ru_utime'): + val = float(val) + else: + val = int(val) + ru_type = 'rusage' if split[0] == 'rusage' else \ + 'child_rusage' + bs_task[ru_type][ru_key] = val + elif key == 'Status': + bs_task['status'] = val + bs_task['elapsed_time'] = end_time - start_time + return bs_task + + +def read_buildstats_dir(bs_dir): + """Read buildstats directory""" + def split_nevr(nevr): + """Split name and version information from recipe "nevr" string""" + n_e_v, revision = nevr.rsplit('-', 1) + match = re.match(r'^(?P<name>\S+)-((?P<epoch>[0-9]{1,5})_)?(?P<version>[0-9]\S*)$', + n_e_v) + if not match: + # If we're not able to parse a version starting with a number, just + # take the part after last dash + match = re.match(r'^(?P<name>\S+)-((?P<epoch>[0-9]{1,5})_)?(?P<version>[^-]+)$', + n_e_v) + name = match.group('name') + version = match.group('version') + epoch = match.group('epoch') + return name, epoch, version, revision + + if not os.path.isfile(os.path.join(bs_dir, 'build_stats')): + raise ScriptError("{} does not look like a buildstats directory".format(bs_dir)) + + log.debug("Reading buildstats directory %s", bs_dir) + + buildstats = {} + subdirs = os.listdir(bs_dir) + for dirname in subdirs: + recipe_dir = os.path.join(bs_dir, dirname) + if not os.path.isdir(recipe_dir): + continue + name, epoch, version, revision = split_nevr(dirname) + recipe_bs = {'nevr': dirname, + 'name': name, + 'epoch': epoch, + 'version': version, + 'revision': revision, + 'tasks': {}} + for task in os.listdir(recipe_dir): + recipe_bs['tasks'][task] = [read_buildstats_file( + os.path.join(recipe_dir, task))] + if name in buildstats: + raise ScriptError("Cannot handle multiple versions of the same " + "package ({})".format(name)) + buildstats[name] = recipe_bs + + return buildstats + + +def bs_append(dst, src): + """Append data from another buildstats""" + if set(dst.keys()) != set(src.keys()): + raise ScriptError("Refusing to join buildstats, set of packages is " + "different") + for pkg, data in dst.items(): + if data['nevr'] != src[pkg]['nevr']: + raise ScriptError("Refusing to join buildstats, package version " + "differs: {} vs. {}".format(data['nevr'], src[pkg]['nevr'])) + if set(data['tasks'].keys()) != set(src[pkg]['tasks'].keys()): + raise ScriptError("Refusing to join buildstats, set of tasks " + "in {} differ".format(pkg)) + for taskname, taskdata in data['tasks'].items(): + taskdata.extend(src[pkg]['tasks'][taskname]) + + +def read_buildstats_json(path): + """Read buildstats from JSON file""" + buildstats = {} + with open(path) as fobj: + bs_json = json.load(fobj) + for recipe_bs in bs_json: + if recipe_bs['name'] in buildstats: + raise ScriptError("Cannot handle multiple versions of the same " + "package ({})".format(recipe_bs['name'])) + + if recipe_bs['epoch'] is None: + recipe_bs['nevr'] = "{}-{}-{}".format(recipe_bs['name'], recipe_bs['version'], recipe_bs['revision']) + else: + recipe_bs['nevr'] = "{}-{}_{}-{}".format(recipe_bs['name'], recipe_bs['epoch'], recipe_bs['version'], recipe_bs['revision']) + + for task, data in recipe_bs['tasks'].copy().items(): + recipe_bs['tasks'][task] = [BSTask(data)] + + buildstats[recipe_bs['name']] = recipe_bs + + return buildstats + + +def read_buildstats(path, multi): + """Read buildstats""" + if not os.path.exists(path): + raise ScriptError("No such file or directory: {}".format(path)) + + if os.path.isfile(path): + return read_buildstats_json(path) + + if os.path.isfile(os.path.join(path, 'build_stats')): + return read_buildstats_dir(path) + + # Handle a non-buildstat directory + subpaths = sorted(glob.glob(path + '/*')) + if len(subpaths) > 1: + if multi: + log.info("Averaging over {} buildstats from {}".format( + len(subpaths), path)) + else: + raise ScriptError("Multiple buildstats found in '{}'. Please give " + "a single buildstat directory of use the --multi " + "option".format(path)) + bs = None + for subpath in subpaths: + if os.path.isfile(subpath): + tmpbs = read_buildstats_json(subpath) + else: + tmpbs = read_buildstats_dir(subpath) + if not bs: + bs = tmpbs + else: + log.debug("Joining buildstats") + bs_append(bs, tmpbs) + + if not bs: + raise ScriptError("No buildstats found under {}".format(path)) + return bs + + +def print_ver_diff(bs1, bs2): + """Print package version differences""" + pkgs1 = set(bs1.keys()) + pkgs2 = set(bs2.keys()) + new_pkgs = pkgs2 - pkgs1 + deleted_pkgs = pkgs1 - pkgs2 + + echanged = [] + vchanged = [] + rchanged = [] + unchanged = [] + common_pkgs = pkgs2.intersection(pkgs1) + if common_pkgs: + for pkg in common_pkgs: + if bs1[pkg]['epoch'] != bs2[pkg]['epoch']: + echanged.append(pkg) + elif bs1[pkg]['version'] != bs2[pkg]['version']: + vchanged.append(pkg) + elif bs1[pkg]['revision'] != bs2[pkg]['revision']: + rchanged.append(pkg) + else: + unchanged.append(pkg) + + maxlen = max([len(pkg) for pkg in pkgs1.union(pkgs2)]) + fmt_str = " {:{maxlen}} ({})" +# if unchanged: +# print("\nUNCHANGED PACKAGES:") +# print("-------------------") +# maxlen = max([len(pkg) for pkg in unchanged]) +# for pkg in sorted(unchanged): +# print(fmt_str.format(pkg, bs2[pkg]['nevr'], maxlen=maxlen)) + + if new_pkgs: + print("\nNEW PACKAGES:") + print("-------------") + for pkg in sorted(new_pkgs): + print(fmt_str.format(pkg, bs2[pkg]['nevr'], maxlen=maxlen)) + + if deleted_pkgs: + print("\nDELETED PACKAGES:") + print("-----------------") + for pkg in sorted(deleted_pkgs): + print(fmt_str.format(pkg, bs1[pkg]['nevr'], maxlen=maxlen)) + + fmt_str = " {0:{maxlen}} {1:<20} ({2})" + if rchanged: + print("\nREVISION CHANGED:") + print("-----------------") + for pkg in sorted(rchanged): + field1 = "{} -> {}".format(pkg, bs1[pkg]['revision'], bs2[pkg]['revision']) + field2 = "{} -> {}".format(bs1[pkg]['nevr'], bs2[pkg]['nevr']) + print(fmt_str.format(pkg, field1, field2, maxlen=maxlen)) + + if vchanged: + print("\nVERSION CHANGED:") + print("----------------") + for pkg in sorted(vchanged): + field1 = "{} -> {}".format(bs1[pkg]['version'], bs2[pkg]['version']) + field2 = "{} -> {}".format(bs1[pkg]['nevr'], bs2[pkg]['nevr']) + print(fmt_str.format(pkg, field1, field2, maxlen=maxlen)) + + if echanged: + print("\nEPOCH CHANGED:") + print("--------------") + for pkg in sorted(echanged): + field1 = "{} -> {}".format(bs1[pkg]['epoch'], bs2[pkg]['epoch']) + field2 = "{} -> {}".format(bs1[pkg]['nevr'], bs2[pkg]['nevr']) + print(fmt_str.format(pkg, field1, field2, maxlen=maxlen)) + + +def print_task_diff(bs1, bs2, val_type, min_val=0, min_absdiff=0, sort_by=('absdiff',)): + """Diff task execution times""" + def val_to_str(val, human_readable=False): + """Convert raw value to printable string""" + def hms_time(secs): + """Get time in human-readable HH:MM:SS format""" + h = int(secs / 3600) + m = int((secs % 3600) / 60) + s = secs % 60 + if h == 0: + return "{:02d}:{:04.1f}".format(m, s) + else: + return "{:d}:{:02d}:{:04.1f}".format(h, m, s) + + if 'time' in val_type: + if human_readable: + return hms_time(val) + else: + return "{:.1f}s".format(val) + elif 'bytes' in val_type and human_readable: + prefix = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi'] + dec = int(math.log(val, 2) / 10) + prec = 1 if dec > 0 else 0 + return "{:.{prec}f}{}B".format(val / (2 ** (10 * dec)), + prefix[dec], prec=prec) + elif 'ops' in val_type and human_readable: + prefix = ['', 'k', 'M', 'G', 'T', 'P'] + dec = int(math.log(val, 1000)) + prec = 1 if dec > 0 else 0 + return "{:.{prec}f}{}ops".format(val / (1000 ** dec), + prefix[dec], prec=prec) + return str(int(val)) + + def sum_vals(buildstats): + """Get cumulative sum of all tasks""" + total = 0.0 + for recipe_data in buildstats.values(): + for bs_task in recipe_data['tasks'].values(): + total += sum([getattr(b, val_type) for b in bs_task]) / len(bs_task) + return total + + tasks_diff = [] + + if min_val: + print("Ignoring tasks less than {} ({})".format( + val_to_str(min_val, True), val_to_str(min_val))) + if min_absdiff: + print("Ignoring differences less than {} ({})".format( + val_to_str(min_absdiff, True), val_to_str(min_absdiff))) + + # Prepare the data + pkgs = set(bs1.keys()).union(set(bs2.keys())) + for pkg in pkgs: + tasks1 = bs1[pkg]['tasks'] if pkg in bs1 else {} + tasks2 = bs2[pkg]['tasks'] if pkg in bs2 else {} + if not tasks1: + pkg_op = '+ ' + elif not tasks2: + pkg_op = '- ' + else: + pkg_op = ' ' + + for task in set(tasks1.keys()).union(set(tasks2.keys())): + task_op = ' ' + if task in tasks1: + # Average over all values + val1 = [getattr(b, val_type) for b in bs1[pkg]['tasks'][task]] + val1 = sum(val1) / len(val1) + else: + task_op = '+ ' + val1 = 0 + if task in tasks2: + # Average over all values + val2 = [getattr(b, val_type) for b in bs2[pkg]['tasks'][task]] + val2 = sum(val2) / len(val2) + else: + val2 = 0 + task_op = '- ' + + if val1 == 0: + reldiff = float('inf') + else: + reldiff = 100 * (val2 - val1) / val1 + + if max(val1, val2) < min_val: + log.debug("Filtering out %s:%s (%s)", pkg, task, + val_to_str(max(val1, val2))) + continue + if abs(val2 - val1) < min_absdiff: + log.debug("Filtering out %s:%s (difference of %s)", pkg, task, + val_to_str(val2-val1)) + continue + tasks_diff.append(TaskDiff(pkg, pkg_op, task, task_op, val1, val2, + val2-val1, reldiff)) + + # Sort our list + for field in reversed(sort_by): + if field.startswith('-'): + field = field[1:] + reverse = True + else: + reverse = False + tasks_diff = sorted(tasks_diff, key=attrgetter(field), reverse=reverse) + + linedata = [(' ', 'PKG', ' ', 'TASK', 'ABSDIFF', 'RELDIFF', + val_type.upper() + '1', val_type.upper() + '2')] + field_lens = dict([('len_{}'.format(i), len(f)) for i, f in enumerate(linedata[0])]) + + # Prepare fields in string format and measure field lengths + for diff in tasks_diff: + task_prefix = diff.task_op if diff.pkg_op == ' ' else ' ' + linedata.append((diff.pkg_op, diff.pkg, task_prefix, diff.task, + val_to_str(diff.absdiff), + '{:+.1f}%'.format(diff.reldiff), + val_to_str(diff.value1), + val_to_str(diff.value2))) + for i, field in enumerate(linedata[-1]): + key = 'len_{}'.format(i) + if len(field) > field_lens[key]: + field_lens[key] = len(field) + + # Print data + print() + for fields in linedata: + print("{:{len_0}}{:{len_1}} {:{len_2}}{:{len_3}} {:>{len_4}} {:>{len_5}} {:>{len_6}} -> {:{len_7}}".format( + *fields, **field_lens)) + + # Print summary of the diffs + total1 = sum_vals(bs1) + total2 = sum_vals(bs2) + print("\nCumulative {}:".format(val_type)) + print (" {} {:+.1f}% {} ({}) -> {} ({})".format( + val_to_str(total2 - total1), 100 * (total2-total1) / total1, + val_to_str(total1, True), val_to_str(total1), + val_to_str(total2, True), val_to_str(total2))) + + +def parse_args(argv): + """Parse cmdline arguments""" + description=""" +Script for comparing buildstats of two separate builds.""" + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + description=description) + + min_val_defaults = {'cputime': 3.0, + 'read_bytes': 524288, + 'write_bytes': 524288, + 'read_ops': 500, + 'write_ops': 500, + 'walltime': 5} + min_absdiff_defaults = {'cputime': 1.0, + 'read_bytes': 131072, + 'write_bytes': 131072, + 'read_ops': 50, + 'write_ops': 50, + 'walltime': 2} + + parser.add_argument('--debug', '-d', action='store_true', + help="Verbose logging") + parser.add_argument('--ver-diff', action='store_true', + help="Show package version differences and exit") + parser.add_argument('--diff-attr', default='cputime', + choices=min_val_defaults.keys(), + help="Buildstat attribute which to compare") + parser.add_argument('--min-val', default=min_val_defaults, type=float, + help="Filter out tasks less than MIN_VAL. " + "Default depends on --diff-attr.") + parser.add_argument('--min-absdiff', default=min_absdiff_defaults, type=float, + help="Filter out tasks whose difference is less than " + "MIN_ABSDIFF, Default depends on --diff-attr.") + parser.add_argument('--sort-by', default='absdiff', + help="Comma-separated list of field sort order. " + "Prepend the field name with '-' for reversed sort. " + "Available fields are: {}".format(', '.join(taskdiff_fields))) + parser.add_argument('--multi', action='store_true', + help="Read all buildstats from the given paths and " + "average over them") + parser.add_argument('buildstats1', metavar='BUILDSTATS1', help="'Left' buildstat") + parser.add_argument('buildstats2', metavar='BUILDSTATS2', help="'Right' buildstat") + + args = parser.parse_args(argv) + + # We do not nedd/want to read all buildstats if we just want to look at the + # package versions + if args.ver_diff: + args.multi = False + + # Handle defaults for the filter arguments + if args.min_val is min_val_defaults: + args.min_val = min_val_defaults[args.diff_attr] + if args.min_absdiff is min_absdiff_defaults: + args.min_absdiff = min_absdiff_defaults[args.diff_attr] + + return args + + +def main(argv=None): + """Script entry point""" + args = parse_args(argv) + if args.debug: + log.setLevel(logging.DEBUG) + + # Validate sort fields + sort_by = [] + for field in args.sort_by.split(','): + if field.lstrip('-') not in taskdiff_fields: + log.error("Invalid sort field '%s' (must be one of: %s)" % + (field, ', '.join(taskdiff_fields))) + sys.exit(1) + sort_by.append(field) + + try: + bs1 = read_buildstats(args.buildstats1, args.multi) + bs2 = read_buildstats(args.buildstats2, args.multi) + + if args.ver_diff: + print_ver_diff(bs1, bs2) + else: + print_task_diff(bs1, bs2, args.diff_attr, args.min_val, + args.min_absdiff, sort_by) + except ScriptError as err: + log.error(str(err)) + return 1 + return 0 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/cleanup-workdir b/scripts/cleanup-workdir deleted file mode 100755 index 8e6bc4388d..0000000000 --- a/scripts/cleanup-workdir +++ /dev/null @@ -1,194 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2012 Wind River Systems, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -import os -import sys -import optparse -import re -import subprocess -import shutil - -pkg_cur_dirs = {} -obsolete_dirs = [] -parser = None - -def err_quit(msg): - print msg - parser.print_usage() - sys.exit(1) - -def parse_version(verstr): - elems = verstr.split(':') - epoch = elems[0] - if len(epoch) == 0: - return elems[1] - else: - return epoch + '_' + elems[1] - -def run_command(cmd): - pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) - output = pipe.communicate()[0] - if pipe.returncode != 0: - print "Execute command '%s' failed." % cmd - sys.exit(1) - return output - -def get_cur_arch_dirs(workdir, arch_dirs): - pattern = workdir + '/(.*?)/' - - # select thest 5 packages to get the dirs of current arch - pkgs = ['hicolor-icon-theme', 'base-files', 'acl-native', 'binutils-crosssdk', 'nativesdk-autoconf'] - - for pkg in pkgs: - cmd = "bitbake -e " + pkg + " | grep ^IMAGE_ROOTFS=" - output = run_command(cmd) - output = output.split('"')[1] - m = re.match(pattern, output) - arch_dirs.append(m.group(1)) - -def main(): - global parser - parser = optparse.OptionParser( - usage = """%prog - -%prog removes the obsolete packages' build directories in WORKDIR. -This script must be ran under BUILDDIR after source file \"oe-init-build-env\". - -Any file or directory under WORKDIR which is not created by Yocto -will be deleted. Be CAUTIOUS.""") - - options, args = parser.parse_args(sys.argv) - - builddir = run_command('echo $BUILDDIR').strip() - if len(builddir) == 0: - err_quit("Please source file \"oe-init-build-env\" first.\n") - - if os.getcwd() != builddir: - err_quit("Please run %s under: %s\n" % (os.path.basename(args[0]), builddir)) - - print 'Updating bitbake caches...' - cmd = "bitbake -s" - output = run_command(cmd) - - output = output.split('\n') - index = 0 - while len(output[index]) > 0: - index += 1 - alllines = output[index+1:] - - for line in alllines: - # empty again means end of the versions output - if len(line) == 0: - break - line = line.strip() - line = re.sub('\s+', ' ', line) - elems = line.split(' ') - if len(elems) == 2: - version = parse_version(elems[1]) - else: - version = parse_version(elems[2]) - pkg_cur_dirs[elems[0]] = version - - cmd = "bitbake -e" - output = run_command(cmd) - - tmpdir = None - image_rootfs = None - output = output.split('\n') - for line in output: - if tmpdir and image_rootfs: - break - - if not tmpdir: - m = re.match('TMPDIR="(.*)"', line) - if m: - tmpdir = m.group(1) - - if not image_rootfs: - m = re.match('IMAGE_ROOTFS="(.*)"', line) - if m: - image_rootfs = m.group(1) - - # won't fail just in case - if not tmpdir or not image_rootfs: - print "Can't get TMPDIR or IMAGE_ROOTFS." - return 1 - - pattern = tmpdir + '/(.*?)/(.*?)/' - m = re.match(pattern, image_rootfs) - if not m: - print "Can't get WORKDIR." - return 1 - - workdir = os.path.join(tmpdir, m.group(1)) - - # we only deal the dirs of current arch, total numbers of dirs are 6 - cur_arch_dirs = [m.group(2)] - get_cur_arch_dirs(workdir, cur_arch_dirs) - - for workroot, dirs, files in os.walk(workdir): - # For the files, they should NOT exist in WORKDIR. Romve them. - for f in files: - obsolete_dirs.append(os.path.join(workroot, f)) - - for d in dirs: - if d not in cur_arch_dirs: - continue - - for pkgroot, pkgdirs, filenames in os.walk(os.path.join(workroot, d)): - for f in filenames: - obsolete_dirs.append(os.path.join(pkgroot, f)) - - for pkgdir in sorted(pkgdirs): - if pkgdir not in pkg_cur_dirs: - obsolete_dirs.append(os.path.join(pkgroot, pkgdir)) - else: - for verroot, verdirs, verfiles in os.walk(os.path.join(pkgroot, pkgdir)): - for f in verfiles: - obsolete_dirs.append(os.path.join(pkgroot, f)) - for v in sorted(verdirs): - if v not in pkg_cur_dirs[pkgdir]: - obsolete_dirs.append(os.path.join(pkgroot, pkgdir, v)) - break - - # just process the top dir of every package under tmp/work/*/, - # then jump out of the above os.walk() - break - - # it is convenient to use os.walk() to get dirs and files at same time - # both of them have been dealed in the loop, so jump out - break - - for d in obsolete_dirs: - print "Deleting %s" % d - shutil.rmtree(d, True) - - if len(obsolete_dirs): - print '\nTotal %d items.' % len(obsolete_dirs) - else: - print '\nNo obsolete directory found under %s.' % workdir - - return 0 - -if __name__ == '__main__': - try: - ret = main() - except Exception: - ret = 2 - import traceback - traceback.print_exc(3) - sys.exit(ret) diff --git a/scripts/combo-layer b/scripts/combo-layer index ae97471d6d..d04d88b070 100755 --- a/scripts/combo-layer +++ b/scripts/combo-layer @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- # @@ -20,12 +20,20 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import fnmatch import os, sys import optparse import logging import subprocess -import ConfigParser +import tempfile +import configparser import re +import copy +import pipes +import shutil +from collections import OrderedDict +from string import Template +from functools import reduce __version__ = "0.2.1" @@ -67,17 +75,34 @@ class Configuration(object): if value.startswith("@"): self.repos[repo][name] = eval(value.strip("@")) else: + # Apply special type transformations for some properties. + # Type matches the RawConfigParser.get*() methods. + types = {'signoff': 'boolean', 'update': 'boolean', 'history': 'boolean'} + if name in types: + value = getattr(parser, 'get' + types[name])(section, name) self.repos[repo][name] = value + def readglobalsection(parser, section): + for (name, value) in parser.items(section): + if name == "commit_msg": + self.commit_msg_template = value + logger.debug("Loading config file %s" % self.conffile) - self.parser = ConfigParser.ConfigParser() + self.parser = configparser.ConfigParser() with open(self.conffile) as f: self.parser.readfp(f) + # initialize default values + self.commit_msg_template = "Automatic commit to update last_revision" + self.repos = {} for repo in self.parser.sections(): - self.repos[repo] = {} - readsection(self.parser, repo, repo) + if repo == "combo-layer-settings": + # special handling for global settings + readglobalsection(self.parser, repo) + else: + self.repos[repo] = {} + readsection(self.parser, repo, repo) # Load local configuration, if available self.localconffile = None @@ -92,7 +117,7 @@ class Configuration(object): self.localconffile = lcfile logger.debug("Loading local config file %s" % self.localconffile) - self.localparser = ConfigParser.ConfigParser() + self.localparser = configparser.ConfigParser() with open(self.localconffile) as f: self.localparser.readfp(f) @@ -108,7 +133,9 @@ class Configuration(object): readsection(self.localparser, section, repo) def update(self, repo, option, value, initmode=False): - if self.localparser: + # If the main config has the option already, that is what we + # are expected to modify. + if self.localparser and not self.parser.has_option(repo, option): parser = self.localparser section = "%s|%s" % (repo, self.combobranch) conffile = self.localconffile @@ -121,6 +148,7 @@ class Configuration(object): parser.set(section, option, value) with open(conffile, "w") as f: parser.write(f) + self.repos[repo][option] = value def sanity_check(self, initmode=False): required_options=["src_uri", "local_repo_dir", "dest_dir", "last_revision"] @@ -133,6 +161,12 @@ class Configuration(object): if option not in self.repos[name]: msg = "%s\nOption %s is not defined for component %s" %(msg, option, name) missing_options.append(option) + # Sanitize dest_dir so that we do not have to deal with edge cases + # (unset, empty string, double slashes) in the rest of the code. + # It not being set will still be flagged as error because it is + # listed as required option above; that could be changed now. + dest_dir = os.path.normpath(self.repos[name].get("dest_dir", ".")) + self.repos[name]["dest_dir"] = "." if not dest_dir else dest_dir if msg != "": logger.error("configuration file %s has the following error: %s" % (self.conffile,msg)) if self.localconffile and 'last_revision' in missing_options: @@ -144,24 +178,28 @@ class Configuration(object): logger.error("ERROR: patchutils package is missing, please install it (e.g. # apt-get install patchutils)") sys.exit(1) -def runcmd(cmd,destdir=None,printerr=True): +def runcmd(cmd,destdir=None,printerr=True,out=None,env=None): """ execute command, raise CalledProcessError if fail return output if succeed """ logger.debug("run cmd '%s' in %s" % (cmd, os.getcwd() if destdir is None else destdir)) - out = os.tmpfile() + if not out: + out = tempfile.TemporaryFile() + err = out + else: + err = tempfile.TemporaryFile() try: - subprocess.check_call(cmd, stdout=out, stderr=out, cwd=destdir, shell=True) - except subprocess.CalledProcessError,e: - out.seek(0) + subprocess.check_call(cmd, stdout=out, stderr=err, cwd=destdir, shell=isinstance(cmd, str), env=env or os.environ) + except subprocess.CalledProcessError as e: + err.seek(0) if printerr: - logger.error("%s" % out.read()) + logger.error("%s" % err.read()) raise e - out.seek(0) - output = out.read() - logger.debug("output: %s" % output ) + err.seek(0) + output = err.read().decode('utf-8') + logger.debug("output: %s" % output.replace(chr(0), '\\0')) return output def action_init(conf, args): @@ -176,6 +214,11 @@ def action_init(conf, args): subprocess.check_call("git clone %s %s" % (conf.repos[name]['src_uri'], ldir), shell=True) if not os.path.exists(".git"): runcmd("git init") + if conf.history: + # Need a common ref for all trees. + runcmd('git commit -m "initial empty commit" --allow-empty') + startrev = runcmd('git rev-parse master').strip() + for name in conf.repos: repo = conf.repos[name] ldir = repo['local_repo_dir'] @@ -191,18 +234,227 @@ def action_init(conf, args): lastrev = None initialrev = branch logger.info("Copying data from %s..." % name) + # Sanity check initialrev and turn it into hash (required for copying history, + # because resolving a name ref only works in the component repo). + rev = runcmd('git rev-parse %s' % initialrev, ldir).strip() + if rev != initialrev: + try: + refs = runcmd('git show-ref -s %s' % initialrev, ldir).split('\n') + if len(set(refs)) > 1: + # Happens for example when configured to track + # "master" and there is a refs/heads/master. The + # traditional behavior from "git archive" (preserved + # here) it to choose the first one. This might not be + # intended, so at least warn about it. + logger.warn("%s: initial revision '%s' not unique, picking result of rev-parse = %s" % + (name, initialrev, refs[0])) + initialrev = rev + except: + # show-ref fails for hashes. Skip the sanity warning in that case. + pass + initialrev = rev dest_dir = repo['dest_dir'] - if dest_dir and dest_dir != ".": + if dest_dir != ".": extract_dir = os.path.join(os.getcwd(), dest_dir) - os.makedirs(extract_dir) + if not os.path.exists(extract_dir): + os.makedirs(extract_dir) else: extract_dir = os.getcwd() file_filter = repo.get('file_filter', "") - runcmd("git archive %s | tar -x -C %s %s" % (initialrev, extract_dir, file_filter), ldir) + exclude_patterns = repo.get('file_exclude', '').split() + def copy_selected_files(initialrev, extract_dir, file_filter, exclude_patterns, ldir, + subdir=""): + # When working inside a filtered branch which had the + # files already moved, we need to prepend the + # subdirectory to all filters, otherwise they would + # not match. + if subdir == '.': + subdir = '' + elif subdir: + subdir = os.path.normpath(subdir) + file_filter = ' '.join([subdir + '/' + x for x in file_filter.split()]) + exclude_patterns = [subdir + '/' + x for x in exclude_patterns] + # To handle both cases, we cd into the target + # directory and optionally tell tar to strip the path + # prefix when the files were already moved. + subdir_components = len(subdir.split(os.path.sep)) if subdir else 0 + strip=('--strip-components=%d' % subdir_components) if subdir else '' + # TODO: file_filter wild cards do not work (and haven't worked before either), because + # a) GNU tar requires a --wildcards parameter before turning on wild card matching. + # b) The semantic is not as intendend (src/*.c also matches src/foo/bar.c, + # in contrast to the other use of file_filter as parameter of "git archive" + # where it only matches .c files directly in src). + files = runcmd("git archive %s %s | tar -x -v %s -C %s %s" % + (initialrev, subdir, + strip, extract_dir, file_filter), + ldir) + if exclude_patterns: + # Implement file removal by letting tar create the + # file and then deleting it in the file system + # again. Uses the list of files created by tar (easier + # than walking the tree). + for file in files.split('\n'): + if file.endswith(os.path.sep): + continue + for pattern in exclude_patterns: + if fnmatch.fnmatch(file, pattern): + os.unlink(os.path.join(*([extract_dir] + ['..'] * subdir_components + [file]))) + break + + if not conf.history: + copy_selected_files(initialrev, extract_dir, file_filter, exclude_patterns, ldir) + else: + # First fetch remote history into local repository. + # We need a ref for that, so ensure that there is one. + refname = "combo-layer-init-%s" % name + runcmd("git branch -f %s %s" % (refname, initialrev), ldir) + runcmd("git fetch %s %s" % (ldir, refname)) + runcmd("git branch -D %s" % refname, ldir) + # Make that the head revision. + runcmd("git checkout -b %s %s" % (name, initialrev)) + # Optional: cut the history by replacing the given + # start point(s) with commits providing the same + # content (aka tree), but with commit information that + # makes it clear that this is an artifically created + # commit and nothing the original authors had anything + # to do with. + since_rev = repo.get('since_revision', '') + if since_rev: + committer = runcmd('git var GIT_AUTHOR_IDENT').strip() + # Same time stamp, no name. + author = re.sub('.* (\d+ [+-]\d+)', r'unknown <unknown> \1', committer) + logger.info('author %s' % author) + for rev in since_rev.split(): + # Resolve in component repo... + rev = runcmd('git log --oneline --no-abbrev-commit -n1 %s' % rev, ldir).split()[0] + # ... and then get the tree in current + # one. The commit should be in both repos with + # the same tree, but better check here. + tree = runcmd('git show -s --pretty=format:%%T %s' % rev).strip() + with tempfile.NamedTemporaryFile(mode='wt') as editor: + editor.write('''cat >$1 <<EOF +tree %s +author %s +committer %s + +%s: squashed import of component + +This commit copies the entire set of files as found in +%s %s + +For more information about previous commits, see the +upstream repository. + +Commit created by combo-layer. +EOF +''' % (tree, author, committer, name, name, since_rev)) + editor.flush() + os.environ['GIT_EDITOR'] = 'sh %s' % editor.name + runcmd('git replace --edit %s' % rev) + + # Optional: rewrite history to change commit messages or to move files. + if 'hook' in repo or dest_dir != ".": + filter_branch = ['git', 'filter-branch', '--force'] + with tempfile.NamedTemporaryFile(mode='wt') as hookwrapper: + if 'hook' in repo: + # Create a shell script wrapper around the original hook that + # can be used by git filter-branch. Hook may or may not have + # an absolute path. + hook = repo['hook'] + hook = os.path.join(os.path.dirname(conf.conffile), '..', hook) + # The wrappers turns the commit message + # from stdin into a fake patch header. + # This is good enough for changing Subject + # and commit msg body with normal + # combo-layer hooks. + hookwrapper.write('''set -e +tmpname=$(mktemp) +trap "rm $tmpname" EXIT +echo -n 'Subject: [PATCH] ' >>$tmpname +cat >>$tmpname +if ! [ $(tail -c 1 $tmpname | od -A n -t x1) == '0a' ]; then + echo >>$tmpname +fi +echo '---' >>$tmpname +%s $tmpname $GIT_COMMIT %s +tail -c +18 $tmpname | head -c -4 +''' % (hook, name)) + hookwrapper.flush() + filter_branch.extend(['--msg-filter', 'bash %s' % hookwrapper.name]) + if dest_dir != ".": + parent = os.path.dirname(dest_dir) + if not parent: + parent = '.' + # May run outside of the current directory, so do not assume that .git exists. + filter_branch.extend(['--tree-filter', 'mkdir -p .git/tmptree && find . -mindepth 1 -maxdepth 1 ! -name .git -print0 | xargs -0 -I SOURCE mv SOURCE .git/tmptree && mkdir -p %s && mv .git/tmptree %s' % (parent, dest_dir)]) + filter_branch.append('HEAD') + runcmd(filter_branch) + runcmd('git update-ref -d refs/original/refs/heads/%s' % name) + repo['rewritten_revision'] = runcmd('git rev-parse HEAD').strip() + repo['stripped_revision'] = repo['rewritten_revision'] + # Optional filter files: remove everything and re-populate using the normal filtering code. + # Override any potential .gitignore. + if file_filter or exclude_patterns: + runcmd('git rm -rf .') + if not os.path.exists(extract_dir): + os.makedirs(extract_dir) + copy_selected_files('HEAD', extract_dir, file_filter, exclude_patterns, '.', + subdir=dest_dir) + runcmd('git add --all --force .') + if runcmd('git status --porcelain'): + # Something to commit. + runcmd(['git', 'commit', '-m', + '''%s: select file subset + +Files from the component repository were chosen based on +the following filters: +file_filter = %s +file_exclude = %s''' % (name, file_filter or '<empty>', repo.get('file_exclude', '<empty>'))]) + repo['stripped_revision'] = runcmd('git rev-parse HEAD').strip() + if not lastrev: - lastrev = runcmd("git rev-parse %s" % initialrev, ldir).strip() + lastrev = runcmd('git rev-parse %s' % initialrev, ldir).strip() conf.update(name, "last_revision", lastrev, initmode=True) - runcmd("git add .") + + if not conf.history: + runcmd("git add .") + else: + # Create Octopus merge commit according to http://stackoverflow.com/questions/10874149/git-octopus-merge-with-unrelated-repositoies + runcmd('git checkout master') + merge = ['git', 'merge', '--no-commit'] + for name in conf.repos: + repo = conf.repos[name] + # Use branch created earlier. + merge.append(name) + # Root all commits which have no parent in the common + # ancestor in the new repository. + for start in runcmd('git log --pretty=format:%%H --max-parents=0 %s --' % name).split('\n'): + runcmd('git replace --graft %s %s' % (start, startrev)) + try: + runcmd(merge) + except Exception as error: + logger.info('''Merging component repository history failed, perhaps because of merge conflicts. +It may be possible to commit anyway after resolving these conflicts. + +%s''' % error) + # Create MERGE_HEAD and MERGE_MSG. "git merge" itself + # does not create MERGE_HEAD in case of a (harmless) failure, + # and we want certain auto-generated information in the + # commit message for future reference and/or automation. + with open('.git/MERGE_HEAD', 'w') as head: + with open('.git/MERGE_MSG', 'w') as msg: + msg.write('repo: initial import of components\n\n') + # head.write('%s\n' % startrev) + for name in conf.repos: + repo = conf.repos[name] + # <upstream ref> <rewritten ref> <rewritten + files removed> + msg.write('combo-layer-%s: %s %s %s\n' % (name, + repo['last_revision'], + repo['rewritten_revision'], + repo['stripped_revision'])) + rev = runcmd('git rev-parse %s' % name).strip() + head.write('%s\n' % rev) + if conf.localconffile: localadded = True try: @@ -232,32 +484,32 @@ def check_repo_clean(repodir): sys.exit(1) def check_patch(patchfile): - f = open(patchfile) + f = open(patchfile, 'rb') ln = f.readline() of = None in_patch = False beyond_msg = False - pre_buf = '' + pre_buf = b'' while ln: if not beyond_msg: - if ln == '---\n': + if ln == b'---\n': if not of: break in_patch = False beyond_msg = True - elif ln.startswith('--- '): + elif ln.startswith(b'--- '): # We have a diff in the commit message in_patch = True if not of: print('WARNING: %s contains a diff in its commit message, indenting to avoid failure during apply' % patchfile) - of = open(patchfile + '.tmp', 'w') + of = open(patchfile + '.tmp', 'wb') of.write(pre_buf) - pre_buf = '' - elif in_patch and not ln[0] in '+-@ \n\r': + pre_buf = b'' + elif in_patch and not ln[0] in b'+-@ \n\r': in_patch = False if of: if in_patch: - of.write(' ' + ln) + of.write(b' ' + ln) else: of.write(ln) else: @@ -269,6 +521,10 @@ def check_patch(patchfile): os.rename(patchfile + '.tmp', patchfile) def drop_to_shell(workdir=None): + if not sys.stdin.isatty(): + print("Not a TTY so can't drop to shell for resolution, exiting.") + return False + shell = os.environ.get('SHELL', 'bash') print('Dropping to shell "%s"\n' \ 'When you are finished, run the following to continue:\n' \ @@ -276,7 +532,7 @@ def drop_to_shell(workdir=None): ' exit 1 -- abort\n' % shell); ret = subprocess.call([shell], cwd=workdir) if ret != 0: - print "Aborting" + print("Aborting") return False else: return True @@ -304,21 +560,20 @@ def check_rev_branch(component, repodir, rev, branch): return False return True -def get_repos(conf, args): +def get_repos(conf, repo_names): repos = [] - if len(args) > 1: - for arg in args[1:]: - if arg.startswith('-'): - break - else: - repos.append(arg) - for repo in repos: - if not repo in conf.repos: - logger.error("Specified component '%s' not found in configuration" % repo) - sys.exit(0) + for name in repo_names: + if name.startswith('-'): + break + else: + repos.append(name) + for repo in repos: + if not repo in conf.repos: + logger.error("Specified component '%s' not found in configuration" % repo) + sys.exit(1) if not repos: - repos = conf.repos + repos = [ repo for repo in conf.repos if conf.repos[repo].get("update", True) ] return repos @@ -326,7 +581,7 @@ def action_pull(conf, args): """ update the component repos only """ - repos = get_repos(conf, args) + repos = get_repos(conf, args[1:]) # make sure all repos are clean for name in repos: @@ -336,33 +591,85 @@ def action_pull(conf, args): repo = conf.repos[name] ldir = repo['local_repo_dir'] branch = repo.get('branch', "master") - runcmd("git checkout %s" % branch, ldir) - logger.info("git pull for component repo %s in %s ..." % (name, ldir)) - output=runcmd("git pull", ldir) - logger.info(output) + logger.info("update branch %s of component repo %s in %s ..." % (branch, name, ldir)) + if not conf.hard_reset: + # Try to pull only the configured branch. Beware that this may fail + # when the branch is currently unknown (for example, after reconfiguring + # combo-layer). In that case we need to fetch everything and try the check out + # and pull again. + try: + runcmd("git checkout %s" % branch, ldir, printerr=False) + except subprocess.CalledProcessError: + output=runcmd("git fetch", ldir) + logger.info(output) + runcmd("git checkout %s" % branch, ldir) + runcmd("git pull --ff-only", ldir) + else: + output=runcmd("git pull --ff-only", ldir) + logger.info(output) + else: + output=runcmd("git fetch", ldir) + logger.info(output) + runcmd("git checkout %s" % branch, ldir) + runcmd("git reset --hard FETCH_HEAD", ldir) def action_update(conf, args): """ update the component repos - generate the patch list - apply the generated patches + either: + generate the patch list + apply the generated patches + or: + re-creates the entire component history and merges them + into the current branch with a merge commit """ - repos = get_repos(conf, args) + components = [arg.split(':')[0] for arg in args[1:]] + revisions = {} + for arg in args[1:]: + if ':' in arg: + a = arg.split(':', 1) + revisions[a[0]] = a[1] + repos = get_repos(conf, components) # make sure combo repo is clean check_repo_clean(os.getcwd()) - import uuid - patch_dir = "patch-%s" % uuid.uuid4() - os.mkdir(patch_dir) + # Check whether we keep the component histories. Must be + # set either via --history command line parameter or consistently + # in combo-layer.conf. Mixing modes is (currently, and probably + # permanently because it would be complicated) not supported. + if conf.history: + history = True + else: + history = None + for name in repos: + repo = conf.repos[name] + repo_history = repo.get('history', False) + if history is None: + history = repo_history + elif history != repo_history: + logger.error("'history' property is set inconsistently") + sys.exit(1) # Step 1: update the component repos if conf.nopull: logger.info("Skipping pull (-n)") else: - action_pull(conf, args) + action_pull(conf, ['arg0'] + components) + + if history: + update_with_history(conf, components, revisions, repos) + else: + update_with_patches(conf, components, revisions, repos) + +def update_with_patches(conf, components, revisions, repos): + import uuid + patch_dir = "patch-%s" % uuid.uuid4() + if not os.path.exists(patch_dir): + os.mkdir(patch_dir) for name in repos: + revision = revisions.get(name, None) repo = conf.repos[name] ldir = repo['local_repo_dir'] dest_dir = repo['dest_dir'] @@ -371,21 +678,31 @@ def action_update(conf, args): # Step 2: generate the patch list and store to patch dir logger.info("Generating patches from %s..." % name) + top_revision = revision or branch + if not check_rev_branch(name, ldir, top_revision, branch): + sys.exit(1) if dest_dir != ".": prefix = "--src-prefix=a/%s/ --dst-prefix=b/%s/" % (dest_dir, dest_dir) else: prefix = "" if repo['last_revision'] == "": logger.info("Warning: last_revision of component %s is not set, starting from the first commit" % name) - patch_cmd_range = "--root %s" % branch - rev_cmd_range = branch + patch_cmd_range = "--root %s" % top_revision + rev_cmd_range = top_revision else: if not check_rev_branch(name, ldir, repo['last_revision'], branch): sys.exit(1) - patch_cmd_range = "%s..%s" % (repo['last_revision'], branch) + patch_cmd_range = "%s..%s" % (repo['last_revision'], top_revision) rev_cmd_range = patch_cmd_range - file_filter = repo.get('file_filter',"") + file_filter = repo.get('file_filter',".") + + # Filter out unwanted files + exclude = repo.get('file_exclude', '') + if exclude: + for path in exclude.split(): + p = "%s/%s" % (dest_dir, path) if dest_dir != '.' else path + file_filter += " ':!%s'" % p patch_cmd = "git format-patch -N %s --output-directory %s %s -- %s" % \ (prefix,repo_patch_dir, patch_cmd_range, file_filter) @@ -393,7 +710,7 @@ def action_update(conf, args): logger.debug("generated patch set:\n%s" % output) patchlist = output.splitlines() - rev_cmd = 'git rev-list --no-merges ' + rev_cmd_range + rev_cmd = "git rev-list --no-merges %s -- %s" % (rev_cmd_range, file_filter) revlist = runcmd(rev_cmd, ldir).splitlines() # Step 3: Call repo specific hook to adjust patch @@ -420,13 +737,28 @@ def action_update(conf, args): print('You may now edit the patch and patch list in %s\n' \ 'For example, you can remove unwanted patch entries from patchlist-*, so that they will be not applied later' % patch_dir); if not drop_to_shell(patch_dir): - sys.exit(0) + sys.exit(1) # Step 6: apply the generated and revised patch apply_patchlist(conf, repos) runcmd("rm -rf %s" % patch_dir) # Step 7: commit the updated config file if it's being tracked + commit_conf_file(conf, components) + +def conf_commit_msg(conf, components): + # create the "components" string + component_str = "all components" + if len(components) > 0: + # otherwise tell which components were actually changed + component_str = ", ".join(components) + + # expand the template with known values + template = Template(conf.commit_msg_template) + msg = template.substitute(components = component_str) + return msg + +def commit_conf_file(conf, components, commit=True): relpath = os.path.relpath(conf.conffile) try: output = runcmd("git status --porcelain %s" % relpath, printerr=False) @@ -434,9 +766,15 @@ def action_update(conf, args): # Outside the repository output = None if output: - logger.info("Committing updated configuration file") if output.lstrip().startswith("M"): - runcmd('git commit -m "Automatic commit to update last_revision" %s' % relpath) + logger.info("Committing updated configuration file") + if commit: + msg = conf_commit_msg(conf, components) + runcmd('git commit -m'.split() + [msg, relpath]) + else: + runcmd('git add %s' % relpath) + return True + return False def apply_patchlist(conf, repos): """ @@ -458,6 +796,10 @@ def apply_patchlist(conf, repos): if line: patchlist.append(line) + ldir = conf.repos[name]['local_repo_dir'] + branch = conf.repos[name].get('branch', "master") + branchrev = runcmd("git rev-parse %s" % branch, ldir).strip() + if patchlist: logger.info("Applying patches from %s..." % name) linecount = len(patchlist) @@ -469,7 +811,7 @@ def apply_patchlist(conf, repos): if os.path.getsize(patchfile) == 0: logger.info("(skipping %d/%d %s - no changes)" % (i, linecount, patchdisp)) else: - cmd = "git am --keep-cr -s -p1 %s" % patchfile + cmd = "git am --keep-cr %s-p1 %s" % ('-s ' if repo.get('signoff', True) else '', patchfile) logger.info("Applying %d/%d: %s" % (i, linecount, patchdisp)) try: runcmd(cmd) @@ -482,14 +824,31 @@ def apply_patchlist(conf, repos): if not drop_to_shell(): if prevrev != repo['last_revision']: conf.update(name, "last_revision", prevrev) - sys.exit(0) + sys.exit(1) prevrev = lastrev i += 1 + # Once all patches are applied, we should update + # last_revision to the branch head instead of the last + # applied patch. The two are not necessarily the same when + # the last commit is a merge commit or when the patches at + # the branch head were intentionally excluded. + # + # If we do not do that for a merge commit, the next + # combo-layer run will only exclude patches reachable from + # one of the merged branches and try to re-apply patches + # from other branches even though they were already + # copied. + # + # If patches were intentionally excluded, the next run will + # present them again instead of skipping over them. This + # may or may not be intended, so the code here is conservative + # and only addresses the "head is merge commit" case. + if lastrev != branchrev and \ + len(runcmd("git show --pretty=format:%%P --no-patch %s" % branch, ldir).split()) > 1: + lastrev = branchrev else: logger.info("No patches to apply from %s" % name) - ldir = conf.repos[name]['local_repo_dir'] - branch = conf.repos[name].get('branch', "master") - lastrev = runcmd("git rev-parse %s" % branch, ldir).strip() + lastrev = branchrev if lastrev != repo['last_revision']: conf.update(name, "last_revision", lastrev) @@ -533,6 +892,418 @@ def action_splitpatch(conf, args): else: logger.info(patch_filename) +def update_with_history(conf, components, revisions, repos): + '''Update all components with full history. + + Works by importing all commits reachable from a component's + current head revision. If those commits are rooted in an already + imported commit, their content gets mixed with the content of the + combined repo of that commit (new or modified files overwritten, + removed files removed). + + The last commit is an artificial merge commit that merges all the + updated components into the combined repository. + + The HEAD ref only gets updated at the very end. All intermediate work + happens in a worktree which will get garbage collected by git eventually + after a failure. + ''' + # Remember current HEAD and what we need to add to it. + head = runcmd("git rev-parse HEAD").strip() + additional_heads = {} + + # Track the mapping between original commit and commit in the + # combined repo. We do not have to distinguish between components, + # because commit hashes are different anyway. Often we can + # skip find_revs() entirely (for example, when all new commits + # are derived from the last imported revision). + # + # Using "head" (typically the merge commit) instead of the actual + # commit for the component leads to a nicer history in the combined + # repo. + old2new_revs = {} + for name in repos: + repo = conf.repos[name] + revision = repo['last_revision'] + if revision: + old2new_revs[revision] = head + + def add_p(parents): + '''Insert -p before each entry.''' + parameters = [] + for p in parents: + parameters.append('-p') + parameters.append(p) + return parameters + + # Do all intermediate work with a separate work dir and index, + # chosen via env variables (can't use "git worktree", it is too + # new). This is useful (no changes to current work tree unless the + # update succeeds) and required (otherwise we end up temporarily + # removing the combo-layer hooks that we currently use when + # importing a new component). + # + # Not cleaned up after a failure at the moment. + wdir = os.path.join(os.getcwd(), ".git", "combo-layer") + windex = wdir + ".index" + if os.path.isdir(wdir): + shutil.rmtree(wdir) + os.mkdir(wdir) + wenv = copy.deepcopy(os.environ) + wenv["GIT_WORK_TREE"] = wdir + wenv["GIT_INDEX_FILE"] = windex + # This one turned out to be needed in practice. + wenv["GIT_OBJECT_DIRECTORY"] = os.path.join(os.getcwd(), ".git", "objects") + wargs = {"destdir": wdir, "env": wenv} + + for name in repos: + revision = revisions.get(name, None) + repo = conf.repos[name] + ldir = repo['local_repo_dir'] + dest_dir = repo['dest_dir'] + branch = repo.get('branch', "master") + hook = repo.get('hook', None) + largs = {"destdir": ldir, "env": None} + file_include = repo.get('file_filter', '').split() + file_include.sort() # make sure that short entries like '.' come first. + file_exclude = repo.get('file_exclude', '').split() + + def include_file(file): + if not file_include: + # No explicit filter set, include file. + return True + for filter in file_include: + if filter == '.': + # Another special case: include current directory and thus all files. + return True + if os.path.commonprefix((filter, file)) == filter: + # Included in directory or direct file match. + return True + # Check for wildcard match *with* allowing * to match /, i.e. + # src/*.c does match src/foobar/*.c. That's not how it is done elsewhere + # when passing the filtering to "git archive", but it is unclear what + # the intended semantic is (the comment on file_exclude that "append a * wildcard + # at the end" to match the full content of a directories implies that + # slashes are indeed not special), so here we simply do what's easy to + # implement in Python. + logger.debug('fnmatch(%s, %s)' % (file, filter)) + if fnmatch.fnmatchcase(file, filter): + return True + return False + + def exclude_file(file): + for filter in file_exclude: + if fnmatch.fnmatchcase(file, filter): + return True + return False + + def file_filter(files): + '''Clean up file list so that only included files remain.''' + index = 0 + while index < len(files): + file = files[index] + if not include_file(file) or exclude_file(file): + del files[index] + else: + index += 1 + + + # Generate the revision list. + logger.info("Analyzing commits from %s..." % name) + top_revision = revision or branch + if not check_rev_branch(name, ldir, top_revision, branch): + sys.exit(1) + + last_revision = repo['last_revision'] + rev_list_args = "--full-history --sparse --topo-order --reverse" + if not last_revision: + logger.info("Warning: last_revision of component %s is not set, starting from the first commit" % name) + rev_list_args = rev_list_args + ' ' + top_revision + else: + if not check_rev_branch(name, ldir, last_revision, branch): + sys.exit(1) + rev_list_args = "%s %s..%s" % (rev_list_args, last_revision, top_revision) + + # By definition, the current HEAD contains the latest imported + # commit of each component. We use that as initial mapping even + # though the commits do not match exactly because + # a) it always works (in contrast to find_revs, which relies on special + # commit messages) + # b) it is faster than find_revs, which will only be called on demand + # and can be skipped entirely in most cases + # c) last but not least, the combined history looks nicer when all + # new commits are rooted in the same merge commit + old2new_revs[last_revision] = head + + # We care about all commits (--full-history and --sparse) and + # we want reconstruct the topology and thus do not care + # about ordering by time (--topo-order). We ask for the ones + # we need to import first to be listed first (--reverse). + revs = runcmd("git rev-list %s" % rev_list_args, **largs).split() + logger.debug("To be imported: %s" % revs) + # Now 'revs' contains all revisions reachable from the top revision. + # All revisions derived from the 'last_revision' definitely are new, + # whereas the others may or may not have been imported before. For + # a linear history in the component, that second set will be empty. + # To distinguish between them, we also get the shorter list + # of revisions starting at the ancestor. + if last_revision: + ancestor_revs = runcmd("git rev-list --ancestry-path %s" % rev_list_args, **largs).split() + else: + ancestor_revs = [] + logger.debug("Ancestors: %s" % ancestor_revs) + + # Now import each revision. + logger.info("Importing commits from %s..." % name) + def import_rev(rev): + global scanned_revs + + # If it is part of the new commits, we definitely need + # to import it. Otherwise we need to check, we might have + # imported it before. If it was imported and we merely + # fail to find it because commit messages did not track + # the mapping, then we end up importing it again. So + # combined repos using "updating with history" really should + # enable the "From ... rev:" commit header modifications. + if rev not in ancestor_revs and rev not in old2new_revs and not scanned_revs: + logger.debug("Revision %s triggers log analysis." % rev) + find_revs(old2new_revs, head) + scanned_revs = True + new_rev = old2new_revs.get(rev, None) + if new_rev: + return new_rev + + # If the commit is not in the original list of revisions + # to be imported, then it must be a parent of one of those + # commits and it was skipped during earlier imports or not + # found. Importing such merge commits leads to very ugly + # history (long cascade of merge commits which all point + # to to older commits) when switching from "update via + # patches" to "update with history". + # + # We can avoid importing merge commits if all non-merge commits + # reachable from it were already imported. In that case we + # can root the new commits in the current head revision. + def is_imported(prev): + parents = runcmd("git show --no-patch --pretty=format:%P " + prev, **largs).split() + if len(parents) > 1: + for p in parents: + if not is_imported(p): + logger.debug("Must import %s because %s is not imported." % (rev, p)) + return False + return True + elif prev in old2new_revs: + return True + else: + logger.debug("Must import %s because %s is not imported." % (rev, prev)) + return False + if rev not in revs and is_imported(rev): + old2new_revs[rev] = head + return head + + # Need to import rev. Collect some information about it. + logger.debug("Importing %s" % rev) + (parents, author_name, author_email, author_timestamp, body) = \ + runcmd("git show --no-patch --pretty=format:%P%x00%an%x00%ae%x00%at%x00%B " + rev, **largs).split(chr(0)) + parents = parents.split() + if parents: + # Arbitrarily pick the first parent as base. It may or may not have + # been imported before. For example, if the parent is a merge commit + # and previously the combined repository used patching as update + # method, then the actual merge commit parent never was imported. + # To cover this, We recursively import parents. + parent = parents[0] + new_parent = import_rev(parent) + # Clean index and working tree. TODO: can we combine this and the + # next into one command with less file IO? + # "git reset --hard" does not work, it changes HEAD of the parent + # repo, which we wanted to avoid. Probably need to keep + # track of the rev that corresponds to the index and use apply_commit(). + runcmd("git rm -q --ignore-unmatch -rf .", **wargs) + # Update index and working tree to match the parent. + runcmd("git checkout -q -f %s ." % new_parent, **wargs) + else: + parent = None + # Clean index and working tree. + runcmd("git rm -q --ignore-unmatch -rf .", **wargs) + + # Modify index and working tree such that it mirrors the commit. + apply_commit(parent, rev, largs, wargs, dest_dir, file_filter=file_filter) + + # Now commit. + new_tree = runcmd("git write-tree", **wargs).strip() + env = copy.deepcopy(wenv) + env['GIT_AUTHOR_NAME'] = author_name + env['GIT_AUTHOR_EMAIL'] = author_email + env['GIT_AUTHOR_DATE'] = author_timestamp + if hook: + # Need to turn the verbatim commit message into something resembling a patch header + # for the hook. + with tempfile.NamedTemporaryFile(mode='wt', delete=False) as patch: + patch.write('Subject: [PATCH] ') + patch.write(body) + patch.write('\n---\n') + patch.close() + runcmd([hook, patch.name, rev, name]) + with open(patch.name) as f: + body = f.read()[len('Subject: [PATCH] '):][:-len('\n---\n')] + + # We can skip non-merge commits that did not change any files. Those are typically + # the result of file filtering, although they could also have been introduced + # intentionally upstream, in which case we drop some information here. + if len(parents) == 1: + parent_rev = import_rev(parents[0]) + old_tree = runcmd("git show -s --pretty=format:%T " + parent_rev, **wargs).strip() + commit = old_tree != new_tree + if not commit: + new_rev = parent_rev + else: + commit = True + if commit: + new_rev = runcmd("git commit-tree".split() + add_p([import_rev(p) for p in parents]) + + ["-m", body, new_tree], + env=env).strip() + old2new_revs[rev] = new_rev + + return new_rev + + if revs: + for rev in revs: + import_rev(rev) + # Remember how to update our current head. New components get added, + # updated components get the delta between current head and the updated component + # applied. + additional_heads[old2new_revs[revs[-1]]] = head if repo['last_revision'] else None + repo['last_revision'] = revs[-1] + + # Now construct the final merge commit. We create the tree by + # starting with the head and applying the changes from each + # components imported head revision. + if additional_heads: + runcmd("git reset --hard", **wargs) + for rev, base in additional_heads.items(): + apply_commit(base, rev, wargs, wargs, None) + + # Commit with all component branches as parents as well as the previous head. + logger.info("Writing final merge commit...") + msg = conf_commit_msg(conf, components) + new_tree = runcmd("git write-tree", **wargs).strip() + new_rev = runcmd("git commit-tree".split() + + add_p([head] + list(additional_heads.keys())) + + ["-m", msg, new_tree], + **wargs).strip() + # And done! This is the first time we change the HEAD in the actual work tree. + runcmd("git reset --hard %s" % new_rev) + + # Update and stage the (potentially modified) + # combo-layer.conf, but do not commit separately. + for name in repos: + repo = conf.repos[name] + rev = repo['last_revision'] + conf.update(name, "last_revision", rev) + if commit_conf_file(conf, components, False): + # Must augment the previous commit. + runcmd("git commit --amend -C HEAD") + + +scanned_revs = False +def find_revs(old2new, head): + '''Construct mapping from original commit hash to commit hash in + combined repo by looking at the commit messages. Depends on the + "From ... rev: ..." convention.''' + logger.info("Analyzing log messages to find previously imported commits...") + num_known = len(old2new) + log = runcmd("git log --grep='From .* rev: [a-fA-F0-9][a-fA-F0-9]*' --pretty=format:%H%x00%B%x00 " + head).split(chr(0)) + regex = re.compile(r'From .* rev: ([a-fA-F0-9]+)') + for new_rev, body in zip(*[iter(log)]* 2): + # Use the last one, in the unlikely case there are more than one. + rev = regex.findall(body)[-1] + if rev not in old2new: + old2new[rev] = new_rev.strip() + logger.info("Found %d additional commits, leading to: %s" % (len(old2new) - num_known, old2new)) + + +def apply_commit(parent, rev, largs, wargs, dest_dir, file_filter=None): + '''Compare revision against parent, remove files deleted in the + commit, re-write new or modified ones. Moves them into dest_dir. + Optionally filters files. + ''' + if not dest_dir: + dest_dir = "." + # -r recurses into sub-directories, given is the full overview of + # what changed. We do not care about copy/edits or renames, so we + # can disable those with --no-renames (but we still parse them, + # because it was not clear from git documentation whether C and M + # lines can still occur). + logger.debug("Applying changes between %s and %s in %s" % (parent, rev, largs["destdir"])) + delete = [] + update = [] + if parent: + # Apply delta. + changes = runcmd("git diff-tree --no-commit-id --no-renames --name-status -r --raw -z %s %s" % (parent, rev), **largs).split(chr(0)) + for status, name in zip(*[iter(changes)]*2): + if status[0] in "ACMRT": + update.append(name) + elif status[0] in "D": + delete.append(name) + else: + logger.error("Unknown status %s of file %s in revision %s" % (status, name, rev)) + sys.exit(1) + else: + # Copy all files. + update.extend(runcmd("git ls-tree -r --name-only -z %s" % rev, **largs).split(chr(0))) + + # Include/exclude files as define in the component config. + # Both updated and deleted file lists get filtered, because it might happen + # that a file gets excluded, pulled from a different component, and then the + # excluded file gets deleted. In that case we must keep the copy. + if file_filter: + file_filter(update) + file_filter(delete) + + # We export into a tar archive here and extract with tar because it is simple (no + # need to implement file and symlink writing ourselves) and gives us some degree + # of parallel IO. The downside is that we have to pass the list of files via + # command line parameters - hopefully there will never be too many at once. + if update: + target = os.path.join(wargs["destdir"], dest_dir) + if not os.path.isdir(target): + os.makedirs(target) + quoted_target = pipes.quote(target) + # os.sysconf('SC_ARG_MAX') is lying: running a command with + # string length 629343 already failed with "Argument list too + # long" although SC_ARG_MAX = 2097152. "man execve" explains + # the limitations, but those are pretty complicated. So here + # we just hard-code a fixed value which is more likely to work. + max_cmdsize = 64 * 1024 + while update: + quoted_args = [] + unquoted_args = [] + cmdsize = 100 + len(quoted_target) + while update: + quoted_next = pipes.quote(update[0]) + size_next = len(quoted_next) + len(dest_dir) + 1 + logger.debug('cmdline length %d + %d < %d?' % (cmdsize, size_next, os.sysconf('SC_ARG_MAX'))) + if cmdsize + size_next < max_cmdsize: + quoted_args.append(quoted_next) + unquoted_args.append(update.pop(0)) + cmdsize += size_next + else: + logger.debug('Breaking the cmdline at length %d' % cmdsize) + break + logger.debug('Final cmdline length %d / %d' % (cmdsize, os.sysconf('SC_ARG_MAX'))) + cmd = "git archive %s %s | tar -C %s -xf -" % (rev, ' '.join(quoted_args), quoted_target) + logger.debug('First cmdline length %d' % len(cmd)) + runcmd(cmd, **largs) + cmd = "git add -f".split() + [os.path.join(dest_dir, x) for x in unquoted_args] + logger.debug('Second cmdline length %d' % reduce(lambda x, y: x + len(y), cmd, 0)) + runcmd(cmd, **wargs) + if delete: + for path in delete: + if dest_dir: + path = os.path.join(dest_dir, path) + runcmd("git rm -f --ignore-unmatch".split() + [os.path.join(dest_dir, x) for x in delete], **wargs) + def action_error(conf, args): logger.info("invalid action %s" % args[0]) @@ -568,6 +1339,13 @@ Action: parser.add_option("-n", "--no-pull", help = "skip pulling component repos during update", action = "store_true", dest = "nopull", default = False) + parser.add_option("--hard-reset", + help = "instead of pull do fetch and hard-reset in component repos", + action = "store_true", dest = "hard_reset", default = False) + + parser.add_option("-H", "--history", help = "import full history of components during init", + action = "store_true", default = False) + options, args = parser.parse_args(sys.argv) # Dispatch to action handler @@ -594,5 +1372,5 @@ if __name__ == "__main__": except Exception: ret = 1 import traceback - traceback.print_exc(5) + traceback.print_exc() sys.exit(ret) diff --git a/scripts/combo-layer-hook-default.sh b/scripts/combo-layer-hook-default.sh index 8b148aca07..1e3a3b9bc8 100755 --- a/scripts/combo-layer-hook-default.sh +++ b/scripts/combo-layer-hook-default.sh @@ -9,5 +9,12 @@ patchfile=$1 rev=$2 reponame=$3 -sed -i -e "s#^Subject: \[PATCH\] \(.*\)#Subject: \[PATCH\] $reponame: \1#" $patchfile -sed -i -e "0,/^Signed-off-by:/s#\(^Signed-off-by:.*\)#\($reponame rev: $rev\)\n\n\1#" $patchfile +sed -i -e "0,/^Subject:/s#^Subject: \[PATCH\] \($reponame: \)*\(.*\)#Subject: \[PATCH\] $reponame: \2#" $patchfile +if grep -q '^Signed-off-by:' $patchfile; then + # Insert before Signed-off-by. + sed -i -e "0,/^Signed-off-by:/s#\(^Signed-off-by:.*\)#\(From $reponame rev: $rev\)\n\n\1#" $patchfile +else + # Insert before final --- separator, with extra blank lines removed. + perl -e "\$_ = join('', <>); s/^(.*\S[ \t]*)(\n|\n\s*\n)---\n/\$1\n\nFrom $reponame rev: $rev\n---\n/s; print;" $patchfile >$patchfile.tmp + mv $patchfile.tmp $patchfile +fi diff --git a/scripts/combo-layer.conf.example b/scripts/combo-layer.conf.example index 010a692350..90e2b58723 100644 --- a/scripts/combo-layer.conf.example +++ b/scripts/combo-layer.conf.example @@ -1,7 +1,17 @@ # combo-layer example configuration file +# Default values for all sections. +[DEFAULT] + +# Add 'Signed-off-by' to all commits that get imported automatically. +signoff = True + # component name [bitbake] + +# Override signedoff default above (not very useful, but possible). +signoff = False + # mandatory options # git upstream uri src_uri = git://git.openembedded.org/bitbake @@ -32,6 +42,20 @@ last_revision = # file_filter = src/*.c : only include the src *.c file # file_filter = src/main.c src/Makefile.am : only include these two files +# file_exclude: filter out these file(s) +# file_exclude = [path] [path] ... +# +# Each entry must match a file name. In contrast do file_filter, matching +# a directory has no effect. To achieve that, use append a * wildcard +# at the end. +# +# Wildcards are applied to the complete path and also match slashes. +# +# example: +# file_exclude = src/foobar/* : exclude everything under src/foobar +# file_exclude = src/main.c : filter out main.c after including it with file_filter = src/*.c +# file_exclude = *~ : exclude backup files + # hook: if provided, the tool will call the hook to process the generated # patch from upstream, and then apply the modified patch to the combo # repo. @@ -39,11 +63,24 @@ last_revision = # example: # hook = combo-layer-hook-default.sh +# since_revision: +# since_revision = release-1-2 +# since_revision = 12345 abcdf +# +# If provided, truncate imported history during "combo-layer --history +# init" at the specified revision(s). More than one can be specified +# to cut off multiple component branches. +# +# The specified commits themselves do not get imported. Instead, an +# artificial commit with "unknown" author is created with a content +# that matches the original commit. + [oe-core] src_uri = git://git.openembedded.org/openembedded-core local_repo_dir = /home/kyu3/src/test/oecore dest_dir = . last_revision = +since_revision = some-tag-or-commit-on-master-branch # It is also possible to embed python code in the config values. Similar # to bitbake it considers every value starting with @ to be a python diff --git a/scripts/contrib/bb-perf/bb-matrix-plot.sh b/scripts/contrib/bb-perf/bb-matrix-plot.sh index 87e8cb1abd..136a25570d 100755 --- a/scripts/contrib/bb-perf/bb-matrix-plot.sh +++ b/scripts/contrib/bb-perf/bb-matrix-plot.sh @@ -115,7 +115,7 @@ set xlabel "$XLABEL" set ylabel "$YLABEL" set style line 100 lt 5 lw 1.5 $PM3D_FRAGMENT -set dgrid3d $PM_CNT,$BB_CNT +set dgrid3d $PM_CNT,$BB_CNT splines set ticslevel 0.2 set term png size $SIZE diff --git a/scripts/contrib/bb-perf/bb-matrix.sh b/scripts/contrib/bb-perf/bb-matrix.sh index 37721fe268..106456584d 100755 --- a/scripts/contrib/bb-perf/bb-matrix.sh +++ b/scripts/contrib/bb-perf/bb-matrix.sh @@ -63,6 +63,10 @@ for BB in $BB_RANGE; do date echo "BB=$BB PM=$PM Logging to $BB_LOG" + echo -n " Preparing the work directory... " + rm -rf pseudodone tmp sstate-cache tmp-eglibc &> /dev/null + echo "done" + # Export the variables under test and run the bitbake command # Strip any leading zeroes before passing to bitbake export BB_NUMBER_THREADS=$(echo $BB | sed 's/^0*//') @@ -70,12 +74,6 @@ for BB in $BB_RANGE; do /usr/bin/time -f "$BB $PM $TIME_STR" -a -o $RUNTIME_LOG $BB_CMD &> $BB_LOG echo " $(tail -n1 $RUNTIME_LOG)" - echo -n " Cleaning up..." - mv tmp/buildstats $RUNDIR/$BB-$PM-buildstats - rm -f pseudodone &> /dev/null - rm -rf tmp &> /dev/null - rm -rf sstate-cache &> /dev/null - rm -rf tmp-eglibc &> /dev/null - echo "done" + cp -a tmp/buildstats $RUNDIR/$BB-$PM-buildstats done done diff --git a/scripts/contrib/bb-perf/buildstats-plot.sh b/scripts/contrib/bb-perf/buildstats-plot.sh new file mode 100755 index 0000000000..7e8ae0410e --- /dev/null +++ b/scripts/contrib/bb-perf/buildstats-plot.sh @@ -0,0 +1,157 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2011, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# DESCRIPTION +# +# Produces script data to be consumed by gnuplot. There are two possible plots +# depending if either the -S parameter is present or not: +# +# * without -S: Produces a histogram listing top N recipes/tasks versus +# stats. The first stat defined in the -s parameter is the one taken +# into account for ranking +# * -S: Produces a histogram listing tasks versus stats. In this case, +# the value of each stat is the sum for that particular stat in all recipes found. +# Stats values are in descending order defined by the first stat defined on -s +# +# EXAMPLES +# +# 1. Top recipes' tasks taking into account utime +# +# $ buildstats-plot.sh -s utime | gnuplot -p +# +# 2. Tasks versus utime:stime +# +# $ buildstats-plot.sh -s utime:stime -S | gnuplot -p +# +# 3. Tasks versus IO write_bytes:IO read_bytes +# +# $ buildstats-plot.sh -s 'IO write_bytes:IO read_bytes' -S | gnuplot -p +# +# AUTHORS +# Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> +# + +set -o nounset +set -o errexit + +BS_DIR="tmp/buildstats" +N=10 +STATS="utime" +SUM="" +OUTDATA_FILE="$PWD/buildstats-plot.out" + +function usage { + CMD=$(basename $0) + cat <<EOM +Usage: $CMD [-b buildstats_dir] [-t do_task] + -b buildstats The path where the folder resides + (default: "$BS_DIR") + -n N Top N recipes to display. Ignored if -S is present + (default: "$N") + -s stats The stats to be matched. If more that one stat, units + should be the same because data is plot as histogram. + (see buildstats.sh -h for all options) or any other defined + (build)stat separated by colons, i.e. stime:utime + (default: "$STATS") + -S Sum values for a particular stat for found recipes + -o Output data file. + (default: "$OUTDATA_FILE") + -h Display this help message +EOM +} + +# Parse and validate arguments +while getopts "b:n:s:o:Sh" OPT; do + case $OPT in + b) + BS_DIR="$OPTARG" + ;; + n) + N="$OPTARG" + ;; + s) + STATS="$OPTARG" + ;; + S) + SUM="y" + ;; + o) + OUTDATA_FILE="$OPTARG" + ;; + h) + usage + exit 0 + ;; + *) + usage + exit 1 + ;; + esac +done + +# Get number of stats +IFS=':'; statsarray=(${STATS}); unset IFS +nstats=${#statsarray[@]} + +# Get script folder, use to run buildstats.sh +CD=$(dirname $0) + +# Parse buildstats recipes to produce a single table +OUTBUILDSTATS="$PWD/buildstats.log" +$CD/buildstats.sh -H -s "$STATS" -H > $OUTBUILDSTATS + +# Get headers +HEADERS=$(cat $OUTBUILDSTATS | sed -n -e '1s/ /-/g' -e '1s/:/ /gp') + +echo -e "set boxwidth 0.9 relative" +echo -e "set style data histograms" +echo -e "set style fill solid 1.0 border lt -1" +echo -e "set xtics rotate by 45 right" + +# Get output data +if [ -z "$SUM" ]; then + cat $OUTBUILDSTATS | sed -e '1d' | sort -k3 -n -r | head -$N > $OUTDATA_FILE + # include task at recipe column + sed -i -e "1i\ +${HEADERS}" $OUTDATA_FILE + echo -e "set title \"Top task/recipes\"" + echo -e "plot for [COL=3:`expr 3 + ${nstats} - 1`] '${OUTDATA_FILE}' using COL:xtic(stringcolumn(1).' '.stringcolumn(2)) title columnheader(COL)" +else + + # Construct datatamash sum argument (sum 3 sum 4 ...) + declare -a sumargs + j=0 + for i in `seq $nstats`; do + sumargs[j]=sum; j=$(( $j + 1 )) + sumargs[j]=`expr 3 + $i - 1`; j=$(( $j + 1 )) + done + + # Do the processing with datamash + cat $OUTBUILDSTATS | sed -e '1d' | datamash -t ' ' -g1 ${sumargs[*]} | sort -k2 -n -r > $OUTDATA_FILE + + # Include headers into resulted file, so we can include gnuplot xtics + HEADERS=$(echo $HEADERS | sed -e 's/recipe//1') + sed -i -e "1i\ +${HEADERS}" $OUTDATA_FILE + + # Plot + echo -e "set title \"Sum stats values per task for all recipes\"" + echo -e "plot for [COL=2:`expr 2 + ${nstats} - 1`] '${OUTDATA_FILE}' using COL:xtic(1) title columnheader(COL)" +fi + diff --git a/scripts/contrib/bb-perf/buildstats.sh b/scripts/contrib/bb-perf/buildstats.sh new file mode 100755 index 0000000000..8d7e2488f0 --- /dev/null +++ b/scripts/contrib/bb-perf/buildstats.sh @@ -0,0 +1,155 @@ +#!/bin/bash +# +# Copyright (c) 2011, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# DESCRIPTION +# Given 'buildstats' data (generate by bitbake when setting +# USER_CLASSES ?= "buildstats" on local.conf), task names and a stats values +# (these are the ones preset on the buildstats files), outputs +# '<task> <recipe> <value_1> <value_2> ... <value_n>'. The units are the ones +# defined at buildstats, which in turn takes data from /proc/[pid] files +# +# Some useful pipelines +# +# 1. Tasks with largest stime (Amount of time that this process has been scheduled +# in kernel mode) values +# $ buildstats.sh -b <buildstats> -s stime | sort -k3 -n -r | head +# +# 2. Min, max, sum utime (Amount of time that this process has been scheduled +# in user mode) per task (in needs GNU datamash) +# $ buildstats.sh -b <buildstats> -s utime | datamash -t' ' -g1 min 3 max 3 sum 3 | sort -k4 -n -r +# +# AUTHORS +# Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> +# + +# Stats, by type +TIME="utime:stime:cutime:cstime" +IO="IO wchar:IO write_bytes:IO syscr:IO read_bytes:IO rchar:IO syscw:IO cancelled_write_bytes" +RUSAGE="rusage ru_utime:rusage ru_stime:rusage ru_maxrss:rusage ru_minflt:rusage ru_majflt:\ +rusage ru_inblock:rusage ru_oublock:rusage ru_nvcsw:rusage ru_nivcsw" + +CHILD_RUSAGE="Child rusage ru_utime:Child rusage ru_stime:Child rusage ru_maxrss:Child rusage ru_minflt:\ +Child rusage ru_majflt:Child rusage ru_inblock:Child rusage ru_oublock:Child rusage ru_nvcsw:\ +Child rusage ru_nivcsw" + +BS_DIR="tmp/buildstats" +TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack" +STATS="$TIME" +HEADER="" # No header by default + +function usage { +CMD=$(basename $0) +cat <<EOM +Usage: $CMD [-b buildstats_dir] [-t do_task] + -b buildstats The path where the folder resides + (default: "$BS_DIR") + -t tasks The tasks to be computed + (default: "$TASKS") + -s stats The stats to be matched. Options: TIME, IO, RUSAGE, CHILD_RUSAGE + or any other defined buildstat separated by colons, i.e. stime:utime + (default: "$STATS") + Default stat sets: + TIME=$TIME + IO=$IO + RUSAGE=$RUSAGE + CHILD_RUSAGE=$CHILD_RUSAGE + -h Display this help message +EOM +} + +# Parse and validate arguments +while getopts "b:t:s:Hh" OPT; do + case $OPT in + b) + BS_DIR="$OPTARG" + ;; + t) + TASKS="$OPTARG" + ;; + s) + STATS="$OPTARG" + ;; + H) + HEADER="y" + ;; + h) + usage + exit 0 + ;; + *) + usage + exit 1 + ;; + esac +done + +# Ensure the buildstats folder exists +if [ ! -d "$BS_DIR" ]; then + echo "ERROR: $BS_DIR does not exist" + usage + exit 1 +fi + +stats="" +IFS=":" +for stat in ${STATS}; do + case $stat in + TIME) + stats="${stats}:${TIME}" + ;; + IO) + stats="${stats}:${IO}" + ;; + RUSAGE) + stats="${stats}:${RUSAGE}" + ;; + CHILD_RUSAGE) + stats="${stats}:${CHILD_RUSAGE}" + ;; + *) + stats="${STATS}" + esac +done + +# remove possible colon at the beginning +stats="$(echo "$stats" | sed -e 's/^://1')" + +# Provide a header if required by the user +[ -n "$HEADER" ] && { echo "task:recipe:$stats"; } + +for task in ${TASKS}; do + task="do_${task}" + for file in $(find ${BS_DIR} -type f -name ${task} | awk 'BEGIN{ ORS=""; OFS=":" } { print $0,"" }'); do + recipe="$(basename $(dirname $file))" + times="" + for stat in ${stats}; do + [ -z "$stat" ] && { echo "empty stats"; } + time=$(sed -n -e "s/^\($stat\): \\(.*\\)/\\2/p" $file) + # in case the stat is not present, set the value as NA + [ -z "$time" ] && { time="NA"; } + # Append it to times + if [ -z "$times" ]; then + times="${time}" + else + times="${times} ${time}" + fi + done + echo "${task} ${recipe} ${times}" + done +done diff --git a/scripts/contrib/bbvars.py b/scripts/contrib/bbvars.py index 0896d64445..d8d0594776 100755 --- a/scripts/contrib/bbvars.py +++ b/scripts/contrib/bbvars.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ import os.path import re def usage(): - print 'Usage: %s -d FILENAME [-d FILENAME]* -m METADIR [-m MATADIR]*' % os.path.basename(sys.argv[0]) - print ' -d FILENAME documentation file to search' - print ' -h, --help display this help and exit' - print ' -m METADIR meta directory to search for recipes' - print ' -t FILENAME documentation config file (for doc tags)' - print ' -T Only display variables with doc tags (requires -t)' + print('Usage: %s -d FILENAME [-d FILENAME]* -m METADIR [-m MATADIR]*' % os.path.basename(sys.argv[0])) + print(' -d FILENAME documentation file to search') + print(' -h, --help display this help and exit') + print(' -m METADIR meta directory to search for recipes') + print(' -t FILENAME documentation config file (for doc tags)') + print(' -T Only display variables with doc tags (requires -t)') def recipe_bbvars(recipe): ''' Return a unique set of every bbvar encountered in the recipe ''' @@ -37,9 +37,9 @@ def recipe_bbvars(recipe): vset = set() try: r = open(recipe) - except IOError as (errno, strerror): - print 'WARNING: Failed to open recipe ', recipe - print strerror + except IOError as err: + print('WARNING: Failed to open recipe ', recipe) + print(err.args[1]) for line in r: # Strip any comments from the line @@ -59,8 +59,8 @@ def collect_bbvars(metadir): for root,dirs,files in os.walk(metadir): for name in files: if name.find(".bb") >= 0: - for key in recipe_bbvars(os.path.join(root,name)).iterkeys(): - if bbvars.has_key(key): + for key in recipe_bbvars(os.path.join(root,name)).keys(): + if key in bbvars: bbvars[key] = bbvars[key] + 1 else: bbvars[key] = 1 @@ -71,9 +71,9 @@ def bbvar_is_documented(var, docfiles): for doc in docfiles: try: f = open(doc) - except IOError as (errno, strerror): - print 'WARNING: Failed to open doc ', doc - print strerror + except IOError as err: + print('WARNING: Failed to open doc ', doc) + print(err.args[1]) for line in f: if prog.match(line): return True @@ -87,8 +87,8 @@ def bbvar_doctag(var, docconf): try: f = open(docconf) - except IOError as (errno, strerror): - return strerror + except IOError as err: + return err.args[1] for line in f: m = prog.search(line) @@ -109,8 +109,8 @@ def main(): # Collect and validate input try: opts, args = getopt.getopt(sys.argv[1:], "d:hm:t:T", ["help"]) - except getopt.GetoptError, err: - print '%s' % str(err) + except getopt.GetoptError as err: + print('%s' % str(err)) usage() sys.exit(2) @@ -122,13 +122,13 @@ def main(): if os.path.isfile(a): docfiles.append(a) else: - print 'ERROR: documentation file %s is not a regular file' % (a) + print('ERROR: documentation file %s is not a regular file' % a) sys.exit(3) elif o == '-m': if os.path.isdir(a): metadirs.append(a) else: - print 'ERROR: meta directory %s is not a directory' % (a) + print('ERROR: meta directory %s is not a directory' % a) sys.exit(4) elif o == "-t": if os.path.isfile(a): @@ -139,31 +139,31 @@ def main(): assert False, "unhandled option" if len(docfiles) == 0: - print 'ERROR: no docfile specified' + print('ERROR: no docfile specified') usage() sys.exit(5) if len(metadirs) == 0: - print 'ERROR: no metadir specified' + print('ERROR: no metadir specified') usage() sys.exit(6) if onlydoctags and docconf == "": - print 'ERROR: no docconf specified' + print('ERROR: no docconf specified') usage() sys.exit(7) # Collect all the variable names from the recipes in the metadirs for m in metadirs: - for key,cnt in collect_bbvars(m).iteritems(): - if bbvars.has_key(key): + for key,cnt in collect_bbvars(m).items(): + if key in bbvars: bbvars[key] = bbvars[key] + cnt else: bbvars[key] = cnt # Check each var for documentation varlen = 0 - for v in bbvars.iterkeys(): + for v in bbvars.keys(): if len(v) > varlen: varlen = len(v) if not bbvar_is_documented(v, docfiles): @@ -172,14 +172,14 @@ def main(): varlen = varlen + 1 # Report all undocumented variables - print 'Found %d undocumented bb variables (out of %d):' % (len(undocumented), len(bbvars)) + print('Found %d undocumented bb variables (out of %d):' % (len(undocumented), len(bbvars))) header = '%s%s%s' % (str("VARIABLE").ljust(varlen), str("COUNT").ljust(6), str("DOCTAG").ljust(7)) - print header - print str("").ljust(len(header), '=') + print(header) + print(str("").ljust(len(header), '=')) for v in undocumented: doctag = bbvar_doctag(v, docconf) if not onlydoctags or not doctag == "": - print '%s%s%s' % (v.ljust(varlen), str(bbvars[v]).ljust(6), doctag) + print('%s%s%s' % (v.ljust(varlen), str(bbvars[v]).ljust(6), doctag)) if __name__ == "__main__": diff --git a/scripts/contrib/build-perf-test-wrapper.sh b/scripts/contrib/build-perf-test-wrapper.sh new file mode 100755 index 0000000000..3da32532be --- /dev/null +++ b/scripts/contrib/build-perf-test-wrapper.sh @@ -0,0 +1,219 @@ +#!/bin/bash +# +# Build performance test script wrapper +# +# Copyright (c) 2016, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# +# This script is a simple wrapper around the actual build performance tester +# script. This script initializes the build environment, runs +# oe-build-perf-test and archives the results. + +script=`basename $0` +script_dir=$(realpath $(dirname $0)) +archive_dir=~/perf-results/archives + +usage () { +cat << EOF +Usage: $script [-h] [-c COMMITISH] [-C GIT_REPO] + +Optional arguments: + -h show this help and exit. + -a ARCHIVE_DIR archive results tarball here, give an empty string to + disable tarball archiving (default: $archive_dir) + -c COMMITISH test (checkout) this commit, <branch>:<commit> can be + specified to test specific commit of certain branch + -C GIT_REPO commit results into Git + -E EMAIL_ADDR send email report + -P GIT_REMOTE push results to a remote Git repository + -w WORK_DIR work dir for this script + (default: GIT_TOP_DIR/build-perf-test) + -x create xml report (instead of json) +EOF +} + +get_os_release_var () { + ( source /etc/os-release; eval echo '$'$1 ) +} + + +# Parse command line arguments +commitish="" +oe_build_perf_test_extra_opts=() +oe_git_archive_extra_opts=() +while getopts "ha:c:C:E:P:w:x" opt; do + case $opt in + h) usage + exit 0 + ;; + a) archive_dir=`realpath -s "$OPTARG"` + ;; + c) commitish=$OPTARG + ;; + C) results_repo=`realpath -s "$OPTARG"` + ;; + E) email_to="$OPTARG" + ;; + P) oe_git_archive_extra_opts+=("--push" "$OPTARG") + ;; + w) base_dir=`realpath -s "$OPTARG"` + ;; + x) oe_build_perf_test_extra_opts+=("--xml") + ;; + *) usage + exit 1 + ;; + esac +done + +# Check positional args +shift "$((OPTIND - 1))" +if [ $# -ne 0 ]; then + echo "ERROR: No positional args are accepted." + usage + exit 1 +fi + +# Open a file descriptor for flock and acquire lock +LOCK_FILE="/tmp/oe-build-perf-test-wrapper.lock" +if ! exec 3> "$LOCK_FILE"; then + echo "ERROR: Unable to open lock file" + exit 1 +fi +if ! flock -n 3; then + echo "ERROR: Another instance of this script is running" + exit 1 +fi + +echo "Running on `uname -n`" +if ! git_topdir=$(git rev-parse --show-toplevel); then + echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`" + exit 1 +fi + +cd "$git_topdir" + +if [ -n "$commitish" ]; then + echo "Running git fetch" + git fetch &> /dev/null + git checkout HEAD^0 &> /dev/null + + # Handle <branch>:<commit> format + if echo "$commitish" | grep -q ":"; then + commit=`echo "$commitish" | cut -d":" -f2` + branch=`echo "$commitish" | cut -d":" -f1` + else + commit="$commitish" + branch="$commitish" + fi + + echo "Checking out $commitish" + git branch -D $branch &> /dev/null + if ! git checkout -f $branch &> /dev/null; then + echo "ERROR: Git checkout failed" + exit 1 + fi + + # Check that the specified branch really contains the commit + commit_hash=`git rev-parse --revs-only $commit --` + if [ -z "$commit_hash" -o "`git merge-base $branch $commit`" != "$commit_hash" ]; then + echo "ERROR: branch $branch does not contain commit $commit" + exit 1 + fi + git reset --hard $commit > /dev/null +fi + +# Setup build environment +if [ -z "$base_dir" ]; then + base_dir="$git_topdir/build-perf-test" +fi +echo "Using working dir $base_dir" + +timestamp=`date "+%Y%m%d%H%M%S"` +git_rev=$(git rev-parse --short HEAD) || exit 1 +build_dir="$base_dir/build-$git_rev-$timestamp" +results_dir="$base_dir/results-$git_rev-$timestamp" +globalres_log="$base_dir/globalres.log" +machine="qemux86" + +mkdir -p "$base_dir" +source ./oe-init-build-env $build_dir >/dev/null || exit 1 + +# Additional config +auto_conf="$build_dir/conf/auto.conf" +echo "MACHINE = \"$machine\"" > "$auto_conf" +echo 'BB_NUMBER_THREADS = "8"' >> "$auto_conf" +echo 'PARALLEL_MAKE = "-j 8"' >> "$auto_conf" +echo "DL_DIR = \"$base_dir/downloads\"" >> "$auto_conf" +# Disabling network sanity check slightly reduces the variance of timing results +echo 'CONNECTIVITY_CHECK_URIS = ""' >> "$auto_conf" +# Possibility to define extra settings +if [ -f "$base_dir/auto.conf.extra" ]; then + cat "$base_dir/auto.conf.extra" >> "$auto_conf" +fi + +# Run actual test script +oe-build-perf-test --out-dir "$results_dir" \ + --globalres-file "$globalres_log" \ + "${oe_build_perf_test_extra_opts[@]}" \ + --lock-file "$base_dir/oe-build-perf.lock" + +case $? in + 1) echo "ERROR: oe-build-perf-test script failed!" + exit 1 + ;; + 2) echo "NOTE: some tests failed!" + ;; +esac + +# Commit results to git +if [ -n "$results_repo" ]; then + echo -e "\nArchiving results in $results_repo" + oe-git-archive \ + --git-dir "$results_repo" \ + --branch-name "{hostname}/{branch}/{machine}" \ + --tag-name "{hostname}/{branch}/{machine}/{commit_count}-g{commit}/{tag_number}" \ + --exclude "buildstats.json" \ + --notes "buildstats/{branch_name}" "$results_dir/buildstats.json" \ + "${oe_git_archive_extra_opts[@]}" \ + "$results_dir" + + # Send email report + if [ -n "$email_to" ]; then + echo -e "\nEmailing test report" + os_name=`get_os_release_var PRETTY_NAME` + oe-build-perf-report -r "$results_repo" > report.txt + oe-build-perf-report -r "$results_repo" --html > report.html + "$script_dir"/oe-build-perf-report-email.py --to "$email_to" --subject "Build Perf Test Report for $os_name" --text report.txt --html report.html "${OE_BUILD_PERF_REPORT_EMAIL_EXTRA_ARGS[@]}" + fi +fi + + +echo -ne "\n\n-----------------\n" +echo "Global results file:" +echo -ne "\n" + +cat "$globalres_log" + +if [ -n "$archive_dir" ]; then + echo -ne "\n\n-----------------\n" + echo "Archiving results in $archive_dir" + mkdir -p "$archive_dir" + results_basename=`basename "$results_dir"` + results_dirname=`dirname "$results_dir"` + tar -czf "$archive_dir/`uname -n`-${results_basename}.tar.gz" -C "$results_dirname" "$results_basename" +fi + +rm -rf "$build_dir" +rm -rf "$results_dir" + +echo "DONE" diff --git a/scripts/contrib/build-perf-test.sh b/scripts/contrib/build-perf-test.sh index ce0fb9afd8..7d99228c73 100755 --- a/scripts/contrib/build-perf-test.sh +++ b/scripts/contrib/build-perf-test.sh @@ -128,7 +128,7 @@ rev=$(git rev-parse --short HEAD) || exit 1 OUTDIR="$clonedir/build-perf-test/results-$rev-`date "+%Y%m%d%H%M%S"`" BUILDDIR="$OUTDIR/build" resultsfile="$OUTDIR/results.log" -bboutput="$OUTDIR/bitbake.log" +cmdoutput="$OUTDIR/commands.log" myoutput="$OUTDIR/output.log" globalres="$clonedir/build-perf-test/globalres.log" @@ -170,6 +170,7 @@ fi # Disabling the network sanity check helps a bit (because of my crappy network connection and/or proxy) echo "CONNECTIVITY_CHECK_URIS =\"\"" >> conf/local.conf + # # Functions # @@ -179,14 +180,13 @@ time_count=0 declare -a SIZES size_count=0 -bbtime () { - local arg="$@" - log " Timing: bitbake ${arg}" +time_cmd () { + log " Timing: $*" if [ $verbose -eq 0 ]; then - /usr/bin/time -v -o $resultsfile bitbake ${arg} >> $bboutput + /usr/bin/time -v -o $resultsfile "$@" >> $cmdoutput else - /usr/bin/time -v -o $resultsfile bitbake ${arg} + /usr/bin/time -v -o $resultsfile "$@" fi ret=$? if [ $ret -eq 0 ]; then @@ -205,12 +205,16 @@ bbtime () { log "More stats can be found in ${resultsfile}.${i}" } +bbtime () { + time_cmd bitbake "$@" +} + #we don't time bitbake here bbnotime () { local arg="$@" log " Running: bitbake ${arg}" if [ $verbose -eq 0 ]; then - bitbake ${arg} >> $bboutput + bitbake ${arg} >> $cmdoutput else bitbake ${arg} fi @@ -284,7 +288,7 @@ test1_p1 () { do_rmsstate do_sync bbtime $IMAGE - s=`du -sh tmp | sed 's/tmp//'` + s=`du -s tmp | sed 's/tmp//' | sed 's/[ \t]*$//'` SIZES[(( size_count++ ))]="$s" log "SIZE of tmp dir is: $s" log "Buildstats are saved in $OUTDIR/buildstats-test1" @@ -307,7 +311,7 @@ test1_p3 () { do_sync bbtime $IMAGE sed -i 's/INHERIT += \"rm_work\"//' conf/local.conf - s=`du -sh tmp | sed 's/tmp//'` + s=`du -s tmp | sed 's/tmp//' | sed 's/[ \t]*$//'` SIZES[(( size_count++ ))]="$s" log "SIZE of tmp dir is: $s" log "Buildstats are saved in $OUTDIR/buildstats-test13" @@ -334,7 +338,7 @@ test2 () { # # Start with # i) "rm -rf tmp/cache; time bitbake -p" -# ii) "rm -rf tmp/cache/default-eglibc/; time bitbake -p" +# ii) "rm -rf tmp/cache/default-glibc/; time bitbake -p" # iii) "time bitbake -p" @@ -343,12 +347,39 @@ test3 () { log " Removing tmp/cache && cache" rm -rf tmp/cache cache bbtime -p - log " Removing tmp/cache/default-eglibc/" - rm -rf tmp/cache/default-eglibc/ + log " Removing tmp/cache/default-glibc/" + rm -rf tmp/cache/default-glibc/ bbtime -p bbtime -p } +# +# Test 4 - eSDK +# Measure: eSDK size and installation time +test4 () { + log "Running Test 4: eSDK size and installation time" + bbnotime $IMAGE -c do_populate_sdk_ext + + esdk_installer=(tmp/deploy/sdk/*-toolchain-ext-*.sh) + + if [ ${#esdk_installer[*]} -eq 1 ]; then + s=$((`stat -c %s "$esdk_installer"` / 1024)) + SIZES[(( size_count++ ))]="$s" + log "Download SIZE of eSDK is: $s kB" + + do_sync + time_cmd "$esdk_installer" -y -d "tmp/esdk-deploy" + + s=$((`du -sb "tmp/esdk-deploy" | cut -f1` / 1024)) + SIZES[(( size_count++ ))]="$s" + log "Install SIZE of eSDK is: $s kB" + else + log "ERROR: other than one sdk found (${esdk_installer[*]}), reporting size and time as 0." + SIZES[(( size_count++ ))]="0" + TIMES[(( time_count++ ))]="0" + fi + +} # RUN! @@ -358,6 +389,7 @@ test1_p2 test1_p3 test2 test3 +test4 # if we got til here write to global results write_results diff --git a/scripts/contrib/ddimage b/scripts/contrib/ddimage index 93ebeafc31..ab929957a5 100755 --- a/scripts/contrib/ddimage +++ b/scripts/contrib/ddimage @@ -1,7 +1,8 @@ #!/bin/sh -#BLACKLIST_DEVICES="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde" -BLACKLIST_DEVICES="/dev/sda" +# Default to avoiding the first two disks on typical Linux and Mac OS installs +# Better safe than sorry :-) +BLACKLIST_DEVICES="/dev/sda /dev/sdb /dev/disk1 /dev/disk2" # 1MB blocksize BLOCKSIZE=1048576 @@ -14,9 +15,15 @@ image_details() { IMG=$1 echo "Image details" echo "=============" - echo " image: $(stat --printf '%N\n' $IMG)" - echo " size: $(stat -L --printf '%s bytes\n' $IMG)" - echo " modified: $(stat -L --printf '%y\n' $IMG)" + echo " image: $(basename $IMG)" + # stat format is different on Mac OS and Linux + if [ "$(uname)" = "Darwin" ]; then + echo " size: $(stat -L -f '%z bytes' $IMG)" + echo " modified: $(stat -L -f '%Sm' $IMG)" + else + echo " size: $(stat -L -c '%s bytes' $IMG)" + echo " modified: $(stat -L -c '%y' $IMG)" + fi echo " type: $(file -L -b $IMG)" echo "" } @@ -27,6 +34,14 @@ device_details() { echo "Device details" echo "==============" + + # Collect disk info using diskutil on Mac OS + if [ "$(uname)" = "Darwin" ]; then + diskutil info $DEVICE | egrep "(Device Node|Media Name|Total Size)" + return + fi + + # Default / Linux information collection echo " device: $DEVICE" if [ -f "/sys/class/block/$DEV/device/vendor" ]; then echo " vendor: $(cat /sys/class/block/$DEV/device/vendor)" @@ -85,5 +100,9 @@ if [ "$RESPONSE" != "y" ]; then fi echo "Writing image..." -dd if="$IMAGE" of="$DEVICE" bs="$BLOCKSIZE" +if which pv >/dev/null 2>&1; then + pv "$IMAGE" | dd of="$DEVICE" bs="$BLOCKSIZE" +else + dd if="$IMAGE" of="$DEVICE" bs="$BLOCKSIZE" +fi sync diff --git a/scripts/contrib/devtool-stress.py b/scripts/contrib/devtool-stress.py new file mode 100755 index 0000000000..d555c51a65 --- /dev/null +++ b/scripts/contrib/devtool-stress.py @@ -0,0 +1,256 @@ +#!/usr/bin/env python3 + +# devtool stress tester +# +# Written by: Paul Eggleton <paul.eggleton@linux.intel.com> +# +# Copyright 2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +import sys +import os +import os.path +import subprocess +import re +import argparse +import logging +import tempfile +import shutil +import signal +import fnmatch + +scripts_lib_path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'lib')) +sys.path.insert(0, scripts_lib_path) +import scriptutils +import argparse_oe +logger = scriptutils.logger_create('devtool-stress') + +def select_recipes(args): + import bb.tinfoil + tinfoil = bb.tinfoil.Tinfoil() + tinfoil.prepare(False) + + pkg_pn = tinfoil.cooker.recipecaches[''].pkg_pn + (latest_versions, preferred_versions) = bb.providers.findProviders(tinfoil.config_data, tinfoil.cooker.recipecaches[''], pkg_pn) + + skip_classes = args.skip_classes.split(',') + + recipelist = [] + for pn in sorted(pkg_pn): + pref = preferred_versions[pn] + inherits = [os.path.splitext(os.path.basename(f))[0] for f in tinfoil.cooker.recipecaches[''].inherits[pref[1]]] + for cls in skip_classes: + if cls in inherits: + break + else: + recipelist.append(pn) + + tinfoil.shutdown() + + resume_from = args.resume_from + if resume_from: + if not resume_from in recipelist: + print('%s is not a testable recipe' % resume_from) + return 1 + if args.only: + only = args.only.split(',') + for onlyitem in only: + for pn in recipelist: + if fnmatch.fnmatch(pn, onlyitem): + break + else: + print('%s does not match any testable recipe' % onlyitem) + return 1 + else: + only = None + if args.skip: + skip = args.skip.split(',') + else: + skip = [] + + recipes = [] + for pn in recipelist: + if resume_from: + if pn == resume_from: + resume_from = None + else: + continue + + if args.only: + for item in only: + if fnmatch.fnmatch(pn, item): + break + else: + continue + + skipit = False + for item in skip: + if fnmatch.fnmatch(pn, item): + skipit = True + if skipit: + continue + + recipes.append(pn) + + return recipes + + +def stress_extract(args): + import bb.process + + recipes = select_recipes(args) + + failures = 0 + tmpdir = tempfile.mkdtemp() + os.setpgrp() + try: + for pn in recipes: + sys.stdout.write('Testing %s ' % (pn + ' ').ljust(40, '.')) + sys.stdout.flush() + failed = False + skipped = None + + srctree = os.path.join(tmpdir, pn) + try: + bb.process.run('devtool extract %s %s' % (pn, srctree)) + except bb.process.ExecutionError as exc: + if exc.exitcode == 4: + skipped = 'incompatible' + else: + failed = True + with open('stress_%s_extract.log' % pn, 'w') as f: + f.write(str(exc)) + + if os.path.exists(srctree): + shutil.rmtree(srctree) + + if failed: + print('failed') + failures += 1 + elif skipped: + print('skipped (%s)' % skipped) + else: + print('ok') + except KeyboardInterrupt: + # We want any child processes killed. This is crude, but effective. + os.killpg(0, signal.SIGTERM) + + if failures: + return 1 + else: + return 0 + + +def stress_modify(args): + import bb.process + + recipes = select_recipes(args) + + failures = 0 + tmpdir = tempfile.mkdtemp() + os.setpgrp() + try: + for pn in recipes: + sys.stdout.write('Testing %s ' % (pn + ' ').ljust(40, '.')) + sys.stdout.flush() + failed = False + reset = True + skipped = None + + srctree = os.path.join(tmpdir, pn) + try: + bb.process.run('devtool modify -x %s %s' % (pn, srctree)) + except bb.process.ExecutionError as exc: + if exc.exitcode == 4: + skipped = 'incompatible' + else: + with open('stress_%s_modify.log' % pn, 'w') as f: + f.write(str(exc)) + failed = 'modify' + reset = False + + if not skipped: + if not failed: + try: + bb.process.run('bitbake -c install %s' % pn) + except bb.process.CmdError as exc: + with open('stress_%s_install.log' % pn, 'w') as f: + f.write(str(exc)) + failed = 'build' + if reset: + try: + bb.process.run('devtool reset %s' % pn) + except bb.process.CmdError as exc: + print('devtool reset failed: %s' % str(exc)) + break + + if os.path.exists(srctree): + shutil.rmtree(srctree) + + if failed: + print('failed (%s)' % failed) + failures += 1 + elif skipped: + print('skipped (%s)' % skipped) + else: + print('ok') + except KeyboardInterrupt: + # We want any child processes killed. This is crude, but effective. + os.killpg(0, signal.SIGTERM) + + if failures: + return 1 + else: + return 0 + + +def main(): + parser = argparse_oe.ArgumentParser(description="devtool stress tester", + epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') + parser.add_argument('-r', '--resume-from', help='Resume from specified recipe', metavar='PN') + parser.add_argument('-o', '--only', help='Only test specified recipes (comma-separated without spaces, wildcards allowed)', metavar='PNLIST') + parser.add_argument('-s', '--skip', help='Skip specified recipes (comma-separated without spaces, wildcards allowed)', metavar='PNLIST', default='gcc-source-*,kernel-devsrc,package-index,perf,meta-world-pkgdata,glibc-locale,glibc-mtrace,glibc-scripts,os-release') + parser.add_argument('-c', '--skip-classes', help='Skip recipes inheriting specified classes (comma-separated) - default %(default)s', metavar='CLASSLIST', default='native,nativesdk,cross,cross-canadian,image,populate_sdk,meta,packagegroup') + subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') + subparsers.required = True + + parser_modify = subparsers.add_parser('modify', + help='Run "devtool modify" followed by a build with bitbake on matching recipes', + description='Runs "devtool modify" followed by a build with bitbake on matching recipes') + parser_modify.set_defaults(func=stress_modify) + + parser_extract = subparsers.add_parser('extract', + help='Run "devtool extract" on matching recipes', + description='Runs "devtool extract" on matching recipes') + parser_extract.set_defaults(func=stress_extract) + + args = parser.parse_args() + + if args.debug: + logger.setLevel(logging.DEBUG) + + import scriptpath + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + return 1 + logger.debug('Found bitbake path: %s' % bitbakepath) + + ret = args.func(args) + +if __name__ == "__main__": + main() diff --git a/scripts/contrib/dialog-power-control b/scripts/contrib/dialog-power-control new file mode 100755 index 0000000000..7550ea53be --- /dev/null +++ b/scripts/contrib/dialog-power-control @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Simple script to show a manual power prompt for when you want to use +# automated hardware testing with testimage.bbclass but you don't have a +# web-enabled power strip or similar to do the power on/off/cycle. +# +# You can enable it by enabling testimage (see the Yocto Project +# Development manual "Performing Automated Runtime Testing" section) +# and setting the following in your local.conf: +# +# TEST_POWERCONTROL_CMD = "${COREBASE}/scripts/contrib/dialog-power-control" +# + +PROMPT="" +while true; do + case $1 in + on) + PROMPT="Please turn device power on";; + off) + PROMPT="Please turn device power off";; + cycle) + PROMPT="Please click Done, then turn the device power off then on";; + "") + break;; + esac + shift +done + +if [ "$PROMPT" = "" ] ; then + echo "ERROR: no power action specified on command line" + exit 2 +fi + +if [ "`which kdialog 2>/dev/null`" != "" ] ; then + DIALOGUTIL="kdialog" +elif [ "`which zenity 2>/dev/null`" != "" ] ; then + DIALOGUTIL="zenity" +else + echo "ERROR: couldn't find program to display a message, install kdialog or zenity" + exit 3 +fi + +if [ "$DIALOGUTIL" = "kdialog" ] ; then + kdialog --yesno "$PROMPT" --title "TestImage Power Control" --yes-label "Done" --no-label "Cancel test" +elif [ "$DIALOGUTIL" = "zenity" ] ; then + zenity --question --text="$PROMPT" --title="TestImage Power Control" --ok-label="Done" --cancel-label="Cancel test" +fi + +if [ "$?" != "0" ] ; then + echo "User cancelled test at power prompt" + exit 1 +fi + diff --git a/scripts/contrib/graph-tool b/scripts/contrib/graph-tool new file mode 100755 index 0000000000..1df5b8c345 --- /dev/null +++ b/scripts/contrib/graph-tool @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 + +# Simple graph query utility +# useful for getting answers from .dot files produced by bitbake -g +# +# Written by: Paul Eggleton <paul.eggleton@linux.intel.com> +# +# Copyright 2013 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +import sys + +def get_path_networkx(dotfile, fromnode, tonode): + try: + import networkx + except ImportError: + print('ERROR: Please install the networkx python module') + sys.exit(1) + + graph = networkx.DiGraph(networkx.nx_pydot.read_dot(dotfile)) + def node_missing(node): + import difflib + close_matches = difflib.get_close_matches(node, graph.nodes(), cutoff=0.7) + if close_matches: + print('ERROR: no node "%s" in graph. Close matches:\n %s' % (node, '\n '.join(close_matches))) + sys.exit(1) + + if not fromnode in graph: + node_missing(fromnode) + if not tonode in graph: + node_missing(tonode) + return networkx.all_simple_paths(graph, source=fromnode, target=tonode) + + +def find_paths(args, usage): + if len(args) < 3: + usage() + sys.exit(1) + + fromnode = args[1] + tonode = args[2] + + path = None + for path in get_path_networkx(args[0], fromnode, tonode): + print(" -> ".join(map(str, path))) + if not path: + print("ERROR: no path from %s to %s in graph" % (fromnode, tonode)) + sys.exit(1) + +def main(): + import optparse + parser = optparse.OptionParser( + usage = '''%prog [options] <command> <arguments> + +Available commands: + find-paths <dotfile> <from> <to> + Find all of the paths between two nodes in a dot graph''') + + #parser.add_option("-d", "--debug", + # help = "Report all SRCREV values, not just ones where AUTOREV has been used", + # action="store_true", dest="debug", default=False) + + options, args = parser.parse_args(sys.argv) + args = args[1:] + + if len(args) < 1: + parser.print_help() + sys.exit(1) + + if args[0] == "find-paths": + find_paths(args[1:], parser.print_help) + else: + parser.print_help() + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/scripts/contrib/list-packageconfig-flags.py b/scripts/contrib/list-packageconfig-flags.py index 149922dc53..7ce718624a 100755 --- a/scripts/contrib/list-packageconfig-flags.py +++ b/scripts/contrib/list-packageconfig-flags.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,47 +14,37 @@ # along with this program; if not, write to the Free Software Foundation. # # Copyright (C) 2013 Wind River Systems, Inc. +# Copyright (C) 2014 Intel Corporation # -# - list available pkgs which have PACKAGECONFIG flags -# - list available PACKAGECONFIG flags and all affected pkgs -# - list all pkgs and PACKAGECONFIG information +# - list available recipes which have PACKAGECONFIG flags +# - list available PACKAGECONFIG flags and all affected recipes +# - list all recipes and PACKAGECONFIG information import sys -import getopt +import optparse import os -# For importing the following modules -sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), '../../bitbake/lib')) -import bb.cache -import bb.cooker -import bb.providers -import bb.tinfoil -usage_body = ''' list available pkgs which have PACKAGECONFIG flags +scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) +lib_path = os.path.abspath(scripts_path + '/../lib') +sys.path = sys.path + [lib_path] -OPTION: - -h, --help display this help and exit - -f, --flag list available PACKAGECONFIG flags and all affected pkgs - -a, --all list all pkgs and PACKAGECONFIG information - -p, --prefer list pkgs with preferred version +import scriptpath -EXAMPLE: -list-packageconfig-flags.py poky/meta poky/meta-yocto -list-packageconfig-flags.py -f poky/meta poky/meta-yocto -list-packageconfig-flags.py -a poky/meta poky/meta-yocto -list-packageconfig-flags.py -p poky/meta poky/meta-yocto -list-packageconfig-flags.py -f -p poky/meta poky/meta-yocto -list-packageconfig-flags.py -a -p poky/meta poky/meta-yocto -''' +# For importing the following modules +bitbakepath = scriptpath.add_bitbake_lib_path() +if not bitbakepath: + sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n") + sys.exit(1) -def usage(): - print 'Usage: %s [-f|-a] [-p]' % os.path.basename(sys.argv[0]) - print usage_body +import bb.cooker +import bb.providers +import bb.tinfoil def get_fnlist(bbhandler, pkg_pn, preferred): ''' Get all recipe file names ''' if preferred: - (latest_versions, preferred_versions) = bb.providers.findProviders(bbhandler.config_data, bbhandler.cooker.recipecache, pkg_pn) + (latest_versions, preferred_versions) = bb.providers.findProviders(bbhandler.config_data, bbhandler.cooker.recipecaches[''], pkg_pn) fn_list = [] for pn in sorted(pkg_pn): @@ -67,12 +57,14 @@ def get_fnlist(bbhandler, pkg_pn, preferred): def get_recipesdata(bbhandler, preferred): ''' Get data of all available recipes which have PACKAGECONFIG flags ''' - pkg_pn = bbhandler.cooker.recipecache.pkg_pn + pkg_pn = bbhandler.cooker.recipecaches[''].pkg_pn data_dict = {} for fn in get_fnlist(bbhandler, pkg_pn, preferred): - data = bb.cache.Cache.loadDataFull(fn, bbhandler.cooker.collection.get_file_appends(fn), bbhandler.config_data) - if data.getVarFlags("PACKAGECONFIG"): + data = bbhandler.parse_recipe_file(fn) + flags = data.getVarFlags("PACKAGECONFIG") + flags.pop('doc', None) + if flags: data_dict[fn] = data return data_dict @@ -83,7 +75,8 @@ def collect_pkgs(data_dict): pkg_dict = {} for fn in data_dict: pkgconfigflags = data_dict[fn].getVarFlags("PACKAGECONFIG") - pkgname = data_dict[fn].getVar("P", True) + pkgconfigflags.pop('doc', None) + pkgname = data_dict[fn].getVar("P") pkg_dict[pkgname] = sorted(pkgconfigflags.keys()) return pkg_dict @@ -92,11 +85,8 @@ def collect_flags(pkg_dict): ''' Collect available PACKAGECONFIG flags and all affected pkgs ''' # flag_dict = {'flag': ['pkg1', 'pkg2',...]} flag_dict = {} - for pkgname, flaglist in pkg_dict.iteritems(): + for pkgname, flaglist in pkg_dict.items(): for flag in flaglist: - if flag == "defaultval": - continue - if flag in flag_dict: flag_dict[flag].append(pkgname) else: @@ -106,15 +96,15 @@ def collect_flags(pkg_dict): def display_pkgs(pkg_dict): ''' Display available pkgs which have PACKAGECONFIG flags ''' - pkgname_len = len("PACKAGE NAME") + 1 + pkgname_len = len("RECIPE NAME") + 1 for pkgname in pkg_dict: if pkgname_len < len(pkgname): pkgname_len = len(pkgname) pkgname_len += 1 - header = '%-*s%s' % (pkgname_len, str("PACKAGE NAME"), str("PACKAGECONFIG FLAGS")) - print header - print str("").ljust(len(header), '=') + header = '%-*s%s' % (pkgname_len, str("RECIPE NAME"), str("PACKAGECONFIG FLAGS")) + print(header) + print(str("").ljust(len(header), '=')) for pkgname in sorted(pkg_dict): print('%-*s%s' % (pkgname_len, pkgname, ' '.join(pkg_dict[pkgname]))) @@ -123,69 +113,66 @@ def display_flags(flag_dict): ''' Display available PACKAGECONFIG flags and all affected pkgs ''' flag_len = len("PACKAGECONFIG FLAG") + 5 - header = '%-*s%s' % (flag_len, str("PACKAGECONFIG FLAG"), str("PACKAGE NAMES")) - print header - print str("").ljust(len(header), '=') + header = '%-*s%s' % (flag_len, str("PACKAGECONFIG FLAG"), str("RECIPE NAMES")) + print(header) + print(str("").ljust(len(header), '=')) for flag in sorted(flag_dict): print('%-*s%s' % (flag_len, flag, ' '.join(sorted(flag_dict[flag])))) def display_all(data_dict): ''' Display all pkgs and PACKAGECONFIG information ''' - print str("").ljust(50, '=') + print(str("").ljust(50, '=')) for fn in data_dict: - print('%s' % data_dict[fn].getVar("P", True)) - print fn - packageconfig = data_dict[fn].getVar("PACKAGECONFIG", True) or '' + print('%s' % data_dict[fn].getVar("P")) + print(fn) + packageconfig = data_dict[fn].getVar("PACKAGECONFIG") or '' if packageconfig.strip() == '': packageconfig = 'None' print('PACKAGECONFIG %s' % packageconfig) - for flag,flag_val in data_dict[fn].getVarFlags("PACKAGECONFIG").iteritems(): - if flag == "defaultval": + for flag,flag_val in data_dict[fn].getVarFlags("PACKAGECONFIG").items(): + if flag == "doc": continue print('PACKAGECONFIG[%s] %s' % (flag, flag_val)) - print '' + print('') def main(): - listtype = 'pkgs' - preferred = False pkg_dict = {} flag_dict = {} # Collect and validate input - try: - opts, args = getopt.getopt(sys.argv[1:], "hfap", ["help", "flag", "all", "prefer"]) - except getopt.GetoptError, err: - print >> sys.stderr,'%s' % str(err) - usage() - sys.exit(2) - for opt, value in opts: - if opt in ('-h', '--help'): - usage() - sys.exit(0) - elif opt in ('-f', '--flag'): - listtype = 'flags' - elif opt in ('-a', '--all'): - listtype = 'all' - elif opt in ('-p', '--prefer'): - preferred = True - else: - assert False, "unhandled option" - - bbhandler = bb.tinfoil.Tinfoil() - bbhandler.prepare() - data_dict = get_recipesdata(bbhandler, preferred) - - if listtype == 'flags': - pkg_dict = collect_pkgs(data_dict) - flag_dict = collect_flags(pkg_dict) - display_flags(flag_dict) - elif listtype == 'pkgs': - pkg_dict = collect_pkgs(data_dict) - display_pkgs(pkg_dict) - elif listtype == 'all': - display_all(data_dict) + parser = optparse.OptionParser( + description = "Lists recipes and PACKAGECONFIG flags. Without -a or -f, recipes and their available PACKAGECONFIG flags are listed.", + usage = """ + %prog [options]""") + + parser.add_option("-f", "--flags", + help = "list available PACKAGECONFIG flags and affected recipes", + action="store_const", dest="listtype", const="flags", default="recipes") + parser.add_option("-a", "--all", + help = "list all recipes and PACKAGECONFIG information", + action="store_const", dest="listtype", const="all") + parser.add_option("-p", "--preferred-only", + help = "where multiple recipe versions are available, list only the preferred version", + action="store_true", dest="preferred", default=False) + + options, args = parser.parse_args(sys.argv) + + with bb.tinfoil.Tinfoil() as bbhandler: + bbhandler.prepare() + print("Gathering recipe data...") + data_dict = get_recipesdata(bbhandler, options.preferred) + + if options.listtype == 'flags': + pkg_dict = collect_pkgs(data_dict) + flag_dict = collect_flags(pkg_dict) + display_flags(flag_dict) + elif options.listtype == 'recipes': + pkg_dict = collect_pkgs(data_dict) + display_pkgs(pkg_dict) + elif options.listtype == 'all': + display_all(data_dict) if __name__ == "__main__": main() diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh index af06b4bd5b..800733f0af 100755 --- a/scripts/contrib/mkefidisk.sh +++ b/scripts/contrib/mkefidisk.sh @@ -20,6 +20,15 @@ LANG=C +echo +echo "WARNING: This script is deprecated and will be removed soon." +echo "Please consider using wic EFI images instead." +echo + +# Set to 1 to enable additional output +DEBUG=0 +OUT="/dev/null" + # # Defaults # @@ -28,8 +37,60 @@ BOOT_SIZE=20 # 5% for swap SWAP_RATIO=5 +# Cleanup after die() +cleanup() { + debug "Syncing and unmounting devices" + # Unmount anything we mounted + unmount $ROOTFS_MNT || error "Failed to unmount $ROOTFS_MNT" + unmount $BOOTFS_MNT || error "Failed to unmount $BOOTFS_MNT" + unmount $HDDIMG_ROOTFS_MNT || error "Failed to unmount $HDDIMG_ROOTFS_MNT" + unmount $HDDIMG_MNT || error "Failed to unmount $HDDIMG_MNT" + + # Remove the TMPDIR + debug "Removing temporary files" + if [ -d "$TMPDIR" ]; then + rm -rf $TMPDIR || error "Failed to remove $TMPDIR" + fi +} + +trap 'die "Signal Received, Aborting..."' HUP INT TERM + +# Logging routines +WARNINGS=0 +ERRORS=0 +CLEAR="$(tput sgr0)" +INFO="$(tput bold)" +RED="$(tput setaf 1)$(tput bold)" +GREEN="$(tput setaf 2)$(tput bold)" +YELLOW="$(tput setaf 3)$(tput bold)" +info() { + echo "${INFO}$1${CLEAR}" +} +error() { + ERRORS=$((ERRORS+1)) + echo "${RED}$1${CLEAR}" +} +warn() { + WARNINGS=$((WARNINGS+1)) + echo "${YELLOW}$1${CLEAR}" +} +success() { + echo "${GREEN}$1${CLEAR}" +} +die() { + error "$1" + cleanup + exit 1 +} +debug() { + if [ $DEBUG -eq 1 ]; then + echo "$1" + fi +} + usage() { - echo "Usage: $(basename $0) DEVICE HDDIMG TARGET_DEVICE" + echo "Usage: $(basename $0) [-v] DEVICE HDDIMG TARGET_DEVICE" + echo " -v: Verbose debug" echo " DEVICE: The device to write the image to, e.g. /dev/sdh" echo " HDDIMG: The hddimg file to generate the efi disk from" echo " TARGET_DEVICE: The device the target will boot from, e.g. /dev/mmcblk0" @@ -37,8 +98,7 @@ usage() { image_details() { IMG=$1 - echo "Image details" - echo "=============" + info "Image details" echo " image: $(stat --printf '%N\n' $IMG)" echo " size: $(stat -L --printf '%s bytes\n' $IMG)" echo " modified: $(stat -L --printf '%y\n' $IMG)" @@ -50,8 +110,7 @@ device_details() { DEV=$1 BLOCK_SIZE=512 - echo "Device details" - echo "==============" + info "Device details" echo " device: $DEVICE" if [ -f "/sys/class/block/$DEV/device/vendor" ]; then echo " vendor: $(cat /sys/class/block/$DEV/device/vendor)" @@ -74,55 +133,132 @@ device_details() { unmount_device() { grep -q $DEVICE /proc/mounts if [ $? -eq 0 ]; then - echo -n "$DEVICE listed in /proc/mounts, attempting to unmount..." + warn "$DEVICE listed in /proc/mounts, attempting to unmount" umount $DEVICE* 2>/dev/null - grep -q $DEVICE /proc/mounts - if [ $? -eq 0 ]; then - echo "FAILED" - exit 1 - fi - echo "OK" + return $? fi + return 0 } +unmount() { + if [ "$1" = "" ] ; then + return 0 + fi + grep -q $1 /proc/mounts + if [ $? -eq 0 ]; then + debug "Unmounting $1" + umount $1 + return $? + fi + return 0 +} # # Parse and validate arguments # -if [ $# -ne 3 ]; then - usage - exit 1 +if [ $# -lt 3 ] || [ $# -gt 4 ]; then + if [ $# -eq 1 ]; then + AVAILABLE_DISK=`lsblk | grep "disk" | cut -f 1 -d " "` + X=0 + for disk in `echo $AVAILABLE_DISK`; do + mounted=`lsblk /dev/$disk | awk {'print $7'} | sed "s/MOUNTPOINT//"` + if [ -z "$mounted" ]; then + UNMOUNTED_AVAILABLES="$UNMOUNTED_AVAILABLES /dev/$disk" + info "$X - /dev/$disk" + X=`expr $X + 1` + fi + done + if [ $X -eq 0 ]; then + die "No unmounted device found." + fi + read -p "Choose unmounted device number: " DISK_NUMBER + X=0 + for line in `echo $UNMOUNTED_AVAILABLES`; do + if [ $DISK_NUMBER -eq $X ]; then + DISK_TO_BE_FLASHED=$line + break + else + X=`expr $X + 1` + fi + done + if [ -z "$DISK_TO_BE_FLASHED" ]; then + die "Option \"$DISK_NUMBER\" is invalid. Choose a valid option" + else + if [ -z `echo $DISK_TO_BE_FLASHED | grep "mmc"` ]; then + TARGET_TO_BE_BOOT="/dev/sda" + else + TARGET_TO_BE_BOOT="/dev/mmcblk0" + fi + fi + echo "" + echo "Choose a name of the device that will be boot from" + echo -n "Recommended name is: " + info "$TARGET_TO_BE_BOOT" + read -p "Is target device okay? [y/N]: " RESPONSE + if [ "$RESPONSE" != "y" ]; then + read -p "Choose target device name: " TARGET_TO_BE_BOOT + fi + echo "" + if [ -z "$TARGET_TO_BE_BOOT" ]; then + die "Error: choose a valid target name" + fi + else + usage + exit 1 + fi +fi + +if [ "$1" = "-v" ]; then + DEBUG=1 + OUT="1" + shift +fi + +if [ -z "$AVAILABLE_DISK" ]; then + DEVICE=$1 + HDDIMG=$2 + TARGET_DEVICE=$3 +else + DEVICE=$DISK_TO_BE_FLASHED + HDDIMG=$1 + TARGET_DEVICE=$TARGET_TO_BE_BOOT fi -DEVICE=$1 -HDDIMG=$2 -TARGET_DEVICE=$3 +LINK=$(readlink $DEVICE) +if [ $? -eq 0 ]; then + DEVICE="$LINK" +fi if [ ! -w "$DEVICE" ]; then - echo "ERROR: Device $DEVICE does not exist or is not writable" usage - exit 1 + if [ ! -e "${DEVICE}" ] ; then + die "Device $DEVICE cannot be found" + else + die "Device $DEVICE is not writable (need to run under sudo?)" + fi fi if [ ! -e "$HDDIMG" ]; then - echo "ERROR: HDDIMG $HDDIMG does not exist" usage - exit 1 + die "HDDIMG $HDDIMG does not exist" fi +# +# Ensure the hddimg is not mounted +# +unmount "$HDDIMG" || die "Failed to unmount $HDDIMG" # # Check if any $DEVICE partitions are mounted # -unmount_device - +unmount_device || die "Failed to unmount $DEVICE" # # Confirm device with user # image_details $HDDIMG device_details $(basename $DEVICE) -echo -n "Prepare EFI image on $DEVICE [y/N]? " +echo -n "${INFO}Prepare EFI image on $DEVICE [y/N]?${CLEAR} " read RESPONSE if [ "$RESPONSE" != "y" ]; then echo "Image creation aborted" @@ -131,9 +267,28 @@ fi # +# Prepare the temporary working space +# +TMPDIR=$(mktemp -d mkefidisk-XXX) || die "Failed to create temporary mounting directory." +HDDIMG_MNT=$TMPDIR/hddimg +HDDIMG_ROOTFS_MNT=$TMPDIR/hddimg_rootfs +ROOTFS_MNT=$TMPDIR/rootfs +BOOTFS_MNT=$TMPDIR/bootfs +mkdir $HDDIMG_MNT || die "Failed to create $HDDIMG_MNT" +mkdir $HDDIMG_ROOTFS_MNT || die "Failed to create $HDDIMG_ROOTFS_MNT" +mkdir $ROOTFS_MNT || die "Failed to create $ROOTFS_MNT" +mkdir $BOOTFS_MNT || die "Failed to create $BOOTFS_MNT" + + +# # Partition $DEVICE # -DEVICE_SIZE=$(parted $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//") +DEVICE_SIZE=$(parted -s $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//") +# If the device size is not reported there may not be a valid label +if [ "$DEVICE_SIZE" = "" ] ; then + parted -s $DEVICE mklabel msdos || die "Failed to create MSDOS partition table" + DEVICE_SIZE=$(parted -s $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//") +fi SWAP_SIZE=$((DEVICE_SIZE*SWAP_RATIO/100)) ROOTFS_SIZE=$((DEVICE_SIZE-BOOT_SIZE-SWAP_SIZE)) ROOTFS_START=$((BOOT_SIZE)) @@ -142,7 +297,7 @@ SWAP_START=$((ROOTFS_END)) # MMC devices use a partition prefix character 'p' PART_PREFIX="" -if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ]; then +if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ] || [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then PART_PREFIX="p" fi BOOTFS=$DEVICE${PART_PREFIX}1 @@ -156,82 +311,130 @@ fi TARGET_ROOTFS=$TARGET_DEVICE${TARGET_PART_PREFIX}2 TARGET_SWAP=$TARGET_DEVICE${TARGET_PART_PREFIX}3 -echo "*****************" -echo "Boot partition size: $BOOT_SIZE MB ($BOOTFS)" -echo "ROOTFS partition size: $ROOTFS_SIZE MB ($ROOTFS)" -echo "Swap partition size: $SWAP_SIZE MB ($SWAP)" -echo "*****************" - -echo "Deleting partition table on $DEVICE ..." -dd if=/dev/zero of=$DEVICE bs=512 count=2 +echo "" +info "Boot partition size: $BOOT_SIZE MB ($BOOTFS)" +info "ROOTFS partition size: $ROOTFS_SIZE MB ($ROOTFS)" +info "Swap partition size: $SWAP_SIZE MB ($SWAP)" +echo "" # Use MSDOS by default as GPT cannot be reliably distributed in disk image form # as it requires the backup table to be on the last block of the device, which # of course varies from device to device. -echo "Creating new partition table (MSDOS) on $DEVICE ..." -parted $DEVICE mklabel msdos -echo "Creating boot partition on $BOOTFS" -parted $DEVICE mkpart primary 0% $BOOT_SIZE +info "Partitioning installation media ($DEVICE)" + +debug "Deleting partition table on $DEVICE" +dd if=/dev/zero of=$DEVICE bs=512 count=2 >$OUT 2>&1 || die "Failed to zero beginning of $DEVICE" -echo "Enabling boot flag on $BOOTFS" -parted $DEVICE set 1 boot on +debug "Creating new partition table (MSDOS) on $DEVICE" +parted -s $DEVICE mklabel msdos >$OUT 2>&1 || die "Failed to create MSDOS partition table" -echo "Creating ROOTFS partition on $ROOTFS" -parted $DEVICE mkpart primary $ROOTFS_START $ROOTFS_END +debug "Creating boot partition on $BOOTFS" +parted -s $DEVICE mkpart primary 0% $BOOT_SIZE >$OUT 2>&1 || die "Failed to create BOOT partition" -echo "Creating swap partition on $SWAP" -parted $DEVICE mkpart primary $SWAP_START 100% +debug "Enabling boot flag on $BOOTFS" +parted -s $DEVICE set 1 boot on >$OUT 2>&1 || die "Failed to enable boot flag" -parted $DEVICE print +debug "Creating ROOTFS partition on $ROOTFS" +parted -s $DEVICE mkpart primary $ROOTFS_START $ROOTFS_END >$OUT 2>&1 || die "Failed to create ROOTFS partition" + +debug "Creating swap partition on $SWAP" +parted -s $DEVICE mkpart primary $SWAP_START 100% >$OUT 2>&1 || die "Failed to create SWAP partition" + +if [ $DEBUG -eq 1 ]; then + parted -s $DEVICE print +fi # # Check if any $DEVICE partitions are mounted after partitioning # -unmount_device +unmount_device || die "Failed to unmount $DEVICE partitions" # # Format $DEVICE partitions # -echo "" -echo "Formatting $BOOTFS as vfat..." -mkfs.vfat $BOOTFS -n "efi" +info "Formatting partitions" +debug "Formatting $BOOTFS as vfat" +if [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then + mkfs.vfat -I $BOOTFS -n "EFI" >$OUT 2>&1 || die "Failed to format $BOOTFS" +else + mkfs.vfat $BOOTFS -n "EFI" >$OUT 2>&1 || die "Failed to format $BOOTFS" +fi -echo "Formatting $ROOTFS as ext3..." -mkfs.ext3 $ROOTFS -L "root" +debug "Formatting $ROOTFS as ext3" +mkfs.ext3 -F $ROOTFS -L "ROOT" >$OUT 2>&1 || die "Failed to format $ROOTFS" -echo "Formatting swap partition...($SWAP)" -mkswap $SWAP +debug "Formatting swap partition ($SWAP)" +mkswap $SWAP >$OUT 2>&1 || die "Failed to prepare swap" # # Installing to $DEVICE # -echo "" -echo "Mounting images and device in preparation for installation..." -TMPDIR=$(mktemp -d mkefidisk-XXX) -if [ $? -ne 0 ]; then - echo "ERROR: Failed to create temporary mounting directory." - exit 1 +debug "Mounting images and device in preparation for installation" +mount -o ro,loop $HDDIMG $HDDIMG_MNT >$OUT 2>&1 || error "Failed to mount $HDDIMG" +mount -o ro,loop $HDDIMG_MNT/rootfs.img $HDDIMG_ROOTFS_MNT >$OUT 2>&1 || error "Failed to mount rootfs.img" +mount $ROOTFS $ROOTFS_MNT >$OUT 2>&1 || error "Failed to mount $ROOTFS on $ROOTFS_MNT" +mount $BOOTFS $BOOTFS_MNT >$OUT 2>&1 || error "Failed to mount $BOOTFS on $BOOTFS_MNT" + +info "Preparing boot partition" +EFIDIR="$BOOTFS_MNT/EFI/BOOT" +cp $HDDIMG_MNT/vmlinuz $BOOTFS_MNT >$OUT 2>&1 || error "Failed to copy vmlinuz" +# Copy the efi loader and configs (booti*.efi and grub.cfg if it exists) +cp -r $HDDIMG_MNT/EFI $BOOTFS_MNT >$OUT 2>&1 || error "Failed to copy EFI dir" +# Silently ignore a missing systemd-boot loader dir (we might just be a GRUB image) +cp -r $HDDIMG_MNT/loader $BOOTFS_MNT >$OUT 2>&1 + +# Update the boot loaders configurations for an installed image +# Remove any existing root= kernel parameters and: +# o Add a root= parameter with the target rootfs +# o Specify ro so fsck can be run during boot +# o Specify rootwait in case the target media is an asyncronous block device +# such as MMC or USB disks +# o Specify "quiet" to minimize boot time when using slow serial consoles + +# Look for a GRUB installation +GRUB_CFG="$EFIDIR/grub.cfg" +if [ -e "$GRUB_CFG" ]; then + info "Configuring GRUB" + # Delete the install entry + sed -i "/menuentry 'install'/,/^}/d" $GRUB_CFG + # Delete the initrd lines + sed -i "/initrd /d" $GRUB_CFG + # Delete any LABEL= strings + sed -i "s/ LABEL=[^ ]*/ /" $GRUB_CFG + + sed -i "s@ root=[^ ]*@ @" $GRUB_CFG + sed -i "s@vmlinuz @vmlinuz root=$TARGET_ROOTFS ro rootwait console=ttyS0 console=tty0 @" $GRUB_CFG +fi + +# Look for a systemd-boot installation +SYSTEMD_BOOT_ENTRIES="$BOOTFS_MNT/loader/entries" +SYSTEMD_BOOT_CFG="$SYSTEMD_BOOT_ENTRIES/boot.conf" +if [ -d "$SYSTEMD_BOOT_ENTRIES" ]; then + info "Configuring SystemD-boot" + # remove the install target if it exists + rm $SYSTEMD_BOOT_ENTRIES/install.conf >$OUT 2>&1 + + if [ ! -e "$SYSTEMD_BOOT_CFG" ]; then + echo "ERROR: $SYSTEMD_BOOT_CFG not found" + fi + + sed -i "/initrd /d" $SYSTEMD_BOOT_CFG + sed -i "s@ root=[^ ]*@ @" $SYSTEMD_BOOT_CFG + sed -i "s@options *LABEL=boot @options LABEL=Boot root=$TARGET_ROOTFS ro rootwait console=ttyS0 console=tty0 @" $SYSTEMD_BOOT_CFG +fi + +# Ensure we have at least one EFI bootloader configured +if [ ! -e $GRUB_CFG ] && [ ! -e $SYSTEMD_BOOT_CFG ]; then + die "No EFI bootloader configuration found" fi -HDDIMG_MNT=$TMPDIR/hddimg -HDDIMG_ROOTFS_MNT=$TMPDIR/hddimg_rootfs -ROOTFS_MNT=$TMPDIR/rootfs -BOOTFS_MNT=$TMPDIR/bootfs -mkdir $HDDIMG_MNT -mkdir $HDDIMG_ROOTFS_MNT -mkdir $ROOTFS_MNT -mkdir $BOOTFS_MNT -mount -o loop $HDDIMG $HDDIMG_MNT -mount -o loop $HDDIMG_MNT/rootfs.img $HDDIMG_ROOTFS_MNT -mount $ROOTFS $ROOTFS_MNT -mount $BOOTFS $BOOTFS_MNT -echo "Copying ROOTFS files..." -cp -a $HDDIMG_ROOTFS_MNT/* $ROOTFS_MNT +info "Copying ROOTFS files (this may take a while)" +cp -a $HDDIMG_ROOTFS_MNT/* $ROOTFS_MNT >$OUT 2>&1 || die "Root FS copy failed" echo "$TARGET_SWAP swap swap defaults 0 0" >> $ROOTFS_MNT/etc/fstab @@ -240,37 +443,22 @@ if [ -d $ROOTFS_MNT/etc/udev/ ] ; then echo "$TARGET_DEVICE" >> $ROOTFS_MNT/etc/udev/mount.blacklist fi -umount $ROOTFS_MNT -umount $HDDIMG_ROOTFS_MNT +# Add startup.nsh script for automated boot +echo "fs0:\EFI\BOOT\bootx64.efi" > $BOOTFS_MNT/startup.nsh -echo "Preparing boot partition..." -EFIDIR="$BOOTFS_MNT/EFI/BOOT" -mkdir -p $EFIDIR -GRUBCFG="$EFIDIR/grub.cfg" - -cp $HDDIMG_MNT/vmlinuz $BOOTFS_MNT -# Copy the efi loader and config (booti*.efi and grub.cfg) -cp $HDDIMG_MNT/EFI/BOOT/* $EFIDIR - -# Update grub config for the installed image -# Delete the install entry -sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG -# Delete the initrd lines -sed -i "/initrd /d" $GRUBCFG -# Delete any LABEL= strings -sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG -# Remove any existing root= kernel parameters and: -# o Add a root= parameter with the target rootfs -# o Specify ro so fsck can be run during boot -# o Specify rootwait in case the target media is an asyncronous block device -# such as MMC or USB disks -# o Specify "quiet" to minimize boot time when using slow serial consoles -sed -i "s@ root=[^ ]*@ @" $GRUBCFG -sed -i "s@vmlinuz @vmlinuz root=$TARGET_ROOTFS ro rootwait quiet @" $GRUBCFG -umount $BOOTFS_MNT -umount $HDDIMG_MNT -rm -rf $TMPDIR -sync +# Call cleanup to unmount devices and images and remove the TMPDIR +cleanup -echo "Installation complete." +echo "" +if [ $WARNINGS -ne 0 ] && [ $ERRORS -eq 0 ]; then + echo "${YELLOW}Installation completed with warnings${CLEAR}" + echo "${YELLOW}Warnings: $WARNINGS${CLEAR}" +elif [ $ERRORS -ne 0 ]; then + echo "${RED}Installation encountered errors${CLEAR}" + echo "${RED}Errors: $ERRORS${CLEAR}" + echo "${YELLOW}Warnings: $WARNINGS${CLEAR}" +else + success "Installation completed successfully" +fi +echo "" diff --git a/scripts/contrib/oe-build-perf-report-email.py b/scripts/contrib/oe-build-perf-report-email.py new file mode 100755 index 0000000000..261ca514e5 --- /dev/null +++ b/scripts/contrib/oe-build-perf-report-email.py @@ -0,0 +1,269 @@ +#!/usr/bin/python3 +# +# Send build performance test report emails +# +# Copyright (c) 2017, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +import argparse +import base64 +import logging +import os +import pwd +import re +import shutil +import smtplib +import socket +import subprocess +import sys +import tempfile +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText + + +# Setup logging +logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") +log = logging.getLogger('oe-build-perf-report') + + +# Find js scaper script +SCRAPE_JS = os.path.join(os.path.dirname(__file__), '..', 'lib', 'build_perf', + 'scrape-html-report.js') +if not os.path.isfile(SCRAPE_JS): + log.error("Unableto find oe-build-perf-report-scrape.js") + sys.exit(1) + + +class ReportError(Exception): + """Local errors""" + pass + + +def check_utils(): + """Check that all needed utils are installed in the system""" + missing = [] + for cmd in ('phantomjs', 'optipng'): + if not shutil.which(cmd): + missing.append(cmd) + if missing: + log.error("The following tools are missing: %s", ' '.join(missing)) + sys.exit(1) + + +def parse_args(argv): + """Parse command line arguments""" + description = """Email build perf test report""" + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + description=description) + + parser.add_argument('--debug', '-d', action='store_true', + help="Verbose logging") + parser.add_argument('--quiet', '-q', action='store_true', + help="Only print errors") + parser.add_argument('--to', action='append', + help="Recipients of the email") + parser.add_argument('--subject', default="Yocto build perf test report", + help="Email subject") + parser.add_argument('--outdir', '-o', + help="Store files in OUTDIR. Can be used to preserve " + "the email parts") + parser.add_argument('--text', + help="Plain text message") + parser.add_argument('--html', + help="HTML peport generated by oe-build-perf-report") + parser.add_argument('--phantomjs-args', action='append', + help="Extra command line arguments passed to PhantomJS") + + args = parser.parse_args(argv) + + if not args.html and not args.text: + parser.error("Please specify --html and/or --text") + + return args + + +def decode_png(infile, outfile): + """Parse/decode/optimize png data from a html element""" + with open(infile) as f: + raw_data = f.read() + + # Grab raw base64 data + b64_data = re.sub('^.*href="data:image/png;base64,', '', raw_data, 1) + b64_data = re.sub('">.+$', '', b64_data, 1) + + # Replace file with proper decoded png + with open(outfile, 'wb') as f: + f.write(base64.b64decode(b64_data)) + + subprocess.check_output(['optipng', outfile], stderr=subprocess.STDOUT) + + +def encode_png(pngfile): + """Encode png into a <img> html element""" + with open(pngfile, 'rb') as f: + data = f.read() + + b64_data = base64.b64encode(data) + return '<img src="data:image/png;base64,' + b64_data.decode('utf-8') + '">\n' + + +def mangle_html_report(infile, outfile, pngs): + """Mangle html file into a email compatible format""" + paste = True + png_dir = os.path.dirname(outfile) + with open(infile) as f_in: + with open(outfile, 'w') as f_out: + for line in f_in.readlines(): + stripped = line.strip() + # Strip out scripts + if stripped == '<!--START-OF-SCRIPTS-->': + paste = False + elif stripped == '<!--END-OF-SCRIPTS-->': + paste = True + elif paste: + if re.match('^.+href="data:image/png;base64', stripped): + # Strip out encoded pngs (as they're huge in size) + continue + elif 'www.gstatic.com' in stripped: + # HACK: drop references to external static pages + continue + + # Replace charts with <img> elements + match = re.match('<div id="(?P<id>\w+)"', stripped) + if match and match.group('id') in pngs: + #f_out.write('<img src="{}">\n'.format(match.group('id') + '.png')) + png_file = os.path.join(png_dir, match.group('id') + '.png') + f_out.write(encode_png(png_file)) + else: + f_out.write(line) + + +def scrape_html_report(report, outdir, phantomjs_extra_args=None): + """Scrape html report into a format sendable by email""" + tmpdir = tempfile.mkdtemp(dir='.') + log.debug("Using tmpdir %s for phantomjs output", tmpdir) + + if not os.path.isdir(outdir): + os.mkdir(outdir) + if os.path.splitext(report)[1] not in ('.html', '.htm'): + raise ReportError("Invalid file extension for report, needs to be " + "'.html' or '.htm'") + + try: + log.info("Scraping HTML report with PhangomJS") + extra_args = phantomjs_extra_args if phantomjs_extra_args else [] + subprocess.check_output(['phantomjs', '--debug=true'] + extra_args + + [SCRAPE_JS, report, tmpdir], + stderr=subprocess.STDOUT) + + pngs = [] + attachments = [] + for fname in os.listdir(tmpdir): + base, ext = os.path.splitext(fname) + if ext == '.png': + log.debug("Decoding %s", fname) + decode_png(os.path.join(tmpdir, fname), + os.path.join(outdir, fname)) + pngs.append(base) + attachments.append(fname) + elif ext in ('.html', '.htm'): + report_file = fname + else: + log.warning("Unknown file extension: '%s'", ext) + #shutil.move(os.path.join(tmpdir, fname), outdir) + + log.debug("Mangling html report file %s", report_file) + mangle_html_report(os.path.join(tmpdir, report_file), + os.path.join(outdir, report_file), pngs) + return report_file, attachments + finally: + shutil.rmtree(tmpdir) + +def send_email(text_fn, html_fn, subject, recipients): + """Send email""" + # Generate email message + text_msg = html_msg = None + if text_fn: + with open(text_fn) as f: + text_msg = MIMEText("Yocto build performance test report.\n" + + f.read(), 'plain') + if html_fn: + with open(html_fn) as f: + html_msg = MIMEText(f.read(), 'html') + + if text_msg and html_msg: + msg = MIMEMultipart('alternative') + msg.attach(text_msg) + msg.attach(html_msg) + elif text_msg: + msg = text_msg + elif html_msg: + msg = html_msg + else: + raise ReportError("Neither plain text nor html body specified") + + pw_data = pwd.getpwuid(os.getuid()) + full_name = pw_data.pw_gecos.split(',')[0] + email = os.environ.get('EMAIL', + '{}@{}'.format(pw_data.pw_name, socket.getfqdn())) + msg['From'] = "{} <{}>".format(full_name, email) + msg['To'] = ', '.join(recipients) + msg['Subject'] = subject + + # Send email + with smtplib.SMTP('localhost') as smtp: + smtp.send_message(msg) + + +def main(argv=None): + """Script entry point""" + args = parse_args(argv) + if args.quiet: + log.setLevel(logging.ERROR) + if args.debug: + log.setLevel(logging.DEBUG) + + check_utils() + + if args.outdir: + outdir = args.outdir + if not os.path.exists(outdir): + os.mkdir(outdir) + else: + outdir = tempfile.mkdtemp(dir='.') + + try: + log.debug("Storing email parts in %s", outdir) + html_report = None + if args.html: + scrape_html_report(args.html, outdir, args.phantomjs_args) + html_report = os.path.join(outdir, os.path.basename(args.html)) + + if args.to: + log.info("Sending email to %s", ', '.join(args.to)) + send_email(args.text, html_report, args.subject, args.to) + except subprocess.CalledProcessError as err: + log.error("%s, with output:\n%s", str(err), err.output.decode()) + return 1 + except ReportError as err: + log.error(err) + return 1 + finally: + if not args.outdir: + log.debug("Wiping %s", outdir) + shutil.rmtree(outdir) + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/contrib/python/generate-manifest-2.7.py b/scripts/contrib/python/generate-manifest-2.7.py index b884432ede..8c3655d395 100755 --- a/scripts/contrib/python/generate-manifest-2.7.py +++ b/scripts/contrib/python/generate-manifest-2.7.py @@ -9,10 +9,14 @@ # * Updated to no longer generate special -dbg package, instead use the # single system -dbg # * Update version with ".1" to indicate this change +# +# February 26, 2017 -- Ming Liu <peter.x.liu@external.atlascopco.com> +# * Updated to support generating manifest for native python import os import sys import time +import argparse VERSION = "2.7.2" @@ -21,16 +25,16 @@ __version__ = "20110222.2" class MakefileMaker: - def __init__( self, outfile ): + def __init__( self, outfile, isNative ): """initialize""" self.packages = {} self.targetPrefix = "${libdir}/python%s/" % VERSION[:3] + self.isNative = isNative self.output = outfile self.out( """ # WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file. -# Generator: '%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de> -# Visit the Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy -""" % ( sys.argv[0], __version__ ) ) +# Generator: '%s%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de> +""" % ( sys.argv[0], ' --native' if isNative else '', __version__ ) ) # # helper functions @@ -66,6 +70,20 @@ class MakefileMaker: global VERSION # + # generate rprovides line for native + # + + if self.isNative: + rprovideLine = 'RPROVIDES+="' + for name in sorted(self.packages): + rprovideLine += "%s-native " % name.replace( '${PN}', 'python' ) + rprovideLine += '"' + + self.out( rprovideLine ) + self.out( "" ) + return + + # # generate provides line # @@ -97,13 +115,13 @@ class MakefileMaker: # generate package variables # - for name, data in sorted(self.packages.iteritems()): + for name, data in sorted(self.packages.items()): desc, deps, files = data # # write out the description, revision and dependencies # - self.out( 'DESCRIPTION_%s="%s"' % ( name, desc ) ) + self.out( 'SUMMARY_%s="%s"' % ( name, desc ) ) self.out( 'RDEPENDS_%s="%s"' % ( name, deps ) ) line = 'FILES_%s="' % name @@ -127,10 +145,10 @@ class MakefileMaker: self.out( line ) self.out( "" ) - self.out( 'DESCRIPTION_${PN}-modules="All Python modules"' ) + self.out( 'SUMMARY_${PN}-modules="All Python modules"' ) line = 'RDEPENDS_${PN}-modules="' - for name, data in sorted(self.packages.iteritems()): + for name, data in sorted(self.packages.items()): if name not in ['${PN}-dev', '${PN}-distutils-staticdev']: line += "%s " % name @@ -147,35 +165,39 @@ class MakefileMaker: self.doEpilog() if __name__ == "__main__": + parser = argparse.ArgumentParser( description='generate python manifest' ) + parser.add_argument( '-n', '--native', help='generate manifest for native python', action='store_true' ) + parser.add_argument( 'outfile', metavar='OUTPUT_FILE', nargs='?', default='', help='Output file (defaults to stdout)' ) + args = parser.parse_args() - if len( sys.argv ) > 1: + if args.outfile: try: - os.unlink(sys.argv[1]) + os.unlink( args.outfile ) except Exception: sys.exc_clear() - outfile = file( sys.argv[1], "w" ) + outfile = open( args.outfile, "w" ) else: outfile = sys.stdout - m = MakefileMaker( outfile ) + m = MakefileMaker( outfile, args.native ) # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies! # Parameters: revision, name, description, dependencies, filenames # - m.addPackage( "${PN}-core", "Python Interpreter and core modules (needed!)", "${PN}-lang ${PN}-re", - "__future__.* _abcoll.* abc.* copy.* copy_reg.* ConfigParser.* " + + m.addPackage( "${PN}-core", "Python interpreter and core modules", "${PN}-lang ${PN}-re", + "__future__.* _abcoll.* abc.* ast.* copy.* copy_reg.* ConfigParser.* " + "genericpath.* getopt.* linecache.* new.* " + "os.* posixpath.* struct.* " + "warnings.* site.* stat.* " + "UserDict.* UserList.* UserString.* " + "lib-dynload/binascii.so lib-dynload/_struct.so lib-dynload/time.so " + - "lib-dynload/xreadlines.so types.* platform.* ${bindir}/python* " + - "_weakrefset.* sysconfig.* config/Makefile " + + "lib-dynload/xreadlines.so types.* platform.* ${bindir}/python* " + + "_weakrefset.* sysconfig.* _sysconfigdata.* " + "${includedir}/python${PYTHON_MAJMIN}/pyconfig*.h " + "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py ") - m.addPackage( "${PN}-dev", "Python Development Package", "${PN}-core", + m.addPackage( "${PN}-dev", "Python development package", "${PN}-core", "${includedir} " + "${libdir}/lib*${SOLIBSDEV} " + "${libdir}/*.la " + @@ -185,15 +207,16 @@ if __name__ == "__main__": "${base_libdir}/*.a " + "${base_libdir}/*.o " + "${datadir}/aclocal " + - "${datadir}/pkgconfig " ) + "${datadir}/pkgconfig " + + "config/Makefile ") - m.addPackage( "${PN}-2to3", "Python Automated Python 2 to 3 code translation", "${PN}-core", + m.addPackage( "${PN}-2to3", "Python automated Python 2 to 3 code translator", "${PN}-core", "${bindir}/2to3 lib2to3" ) # package m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter", "${bindir}/idle idlelib" ) # package - m.addPackage( "${PN}-pydoc", "Python Interactive Help Support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re", + m.addPackage( "${PN}-pydoc", "Python interactive help support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re", "${bindir}/pydoc pydoc.* pydoc_data" ) m.addPackage( "${PN}-smtpd", "Python Simple Mail Transport Daemon", "${PN}-core ${PN}-netserver ${PN}-email ${PN}-mime", @@ -202,187 +225,196 @@ if __name__ == "__main__": m.addPackage( "${PN}-audio", "Python Audio Handling", "${PN}-core", "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.so lib-dynload/audioop.so audiodev.* sunaudio.* sunau.* toaiff.*" ) - m.addPackage( "${PN}-bsddb", "Python Berkeley Database Bindings", "${PN}-core", + m.addPackage( "${PN}-bsddb", "Python bindings for the Berkeley Database", "${PN}-core", "bsddb lib-dynload/_bsddb.so" ) # package - m.addPackage( "${PN}-codecs", "Python Codecs, Encodings & i18n Support", "${PN}-core ${PN}-lang", + m.addPackage( "${PN}-codecs", "Python codecs, encodings & i18n support", "${PN}-core ${PN}-lang", "codecs.* encodings gettext.* locale.* lib-dynload/_locale.so lib-dynload/_codecs* lib-dynload/_multibytecodec.so lib-dynload/unicodedata.so stringprep.* xdrlib.*" ) - m.addPackage( "${PN}-compile", "Python Bytecode Compilation Support", "${PN}-core", + m.addPackage( "${PN}-compile", "Python bytecode compilation support", "${PN}-core", "py_compile.* compileall.*" ) - m.addPackage( "${PN}-compiler", "Python Compiler Support", "${PN}-core", + m.addPackage( "${PN}-compiler", "Python compiler support", "${PN}-core", "compiler" ) # package - m.addPackage( "${PN}-compression", "Python High Level Compression Support", "${PN}-core ${PN}-zlib", + m.addPackage( "${PN}-compression", "Python high-level compression support", "${PN}-core ${PN}-zlib", "gzip.* zipfile.* tarfile.* lib-dynload/bz2.so" ) - m.addPackage( "${PN}-crypt", "Python Basic Cryptographic and Hashing Support", "${PN}-core", + m.addPackage( "${PN}-crypt", "Python basic cryptographic and hashing support", "${PN}-core", "hashlib.* md5.* sha.* lib-dynload/crypt.so lib-dynload/_hashlib.so lib-dynload/_sha256.so lib-dynload/_sha512.so" ) - m.addPackage( "${PN}-textutils", "Python Option Parsing, Text Wrapping and Comma-Separated-Value Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold", + m.addPackage( "${PN}-textutils", "Python option parsing, text wrapping and CSV support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold", "lib-dynload/_csv.so csv.* optparse.* textwrap.*" ) - m.addPackage( "${PN}-curses", "Python Curses Support", "${PN}-core", + m.addPackage( "${PN}-curses", "Python curses support", "${PN}-core", "curses lib-dynload/_curses.so lib-dynload/_curses_panel.so" ) # directory + low level module - m.addPackage( "${PN}-ctypes", "Python C Types Support", "${PN}-core", + m.addPackage( "${PN}-ctypes", "Python C types support", "${PN}-core", "ctypes lib-dynload/_ctypes.so lib-dynload/_ctypes_test.so" ) # directory + low level module - m.addPackage( "${PN}-datetime", "Python Calendar and Time support", "${PN}-core ${PN}-codecs", + m.addPackage( "${PN}-datetime", "Python calendar and time support", "${PN}-core ${PN}-codecs", "_strptime.* calendar.* lib-dynload/datetime.so" ) - m.addPackage( "${PN}-db", "Python File-Based Database Support", "${PN}-core", + m.addPackage( "${PN}-db", "Python file-based database support", "${PN}-core", "anydbm.* dumbdbm.* whichdb.* " ) - m.addPackage( "${PN}-debugger", "Python Debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint", + m.addPackage( "${PN}-debugger", "Python debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint", "bdb.* pdb.*" ) - m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects.", "${PN}-lang ${PN}-re", + m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects", "${PN}-lang ${PN}-re", "difflib.*" ) - m.addPackage( "${PN}-distutils-staticdev", "Python Distribution Utilities (Static Libraries)", "${PN}-distutils", + m.addPackage( "${PN}-distutils-staticdev", "Python distribution utilities (static libraries)", "${PN}-distutils", "config/lib*.a" ) # package - m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core", + m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core ${PN}-email", "config distutils" ) # package - m.addPackage( "${PN}-doctest", "Python framework for running examples in docstrings.", "${PN}-core ${PN}-lang ${PN}-io ${PN}-re ${PN}-unittest ${PN}-debugger ${PN}-difflib", + m.addPackage( "${PN}-doctest", "Python framework for running examples in docstrings", "${PN}-core ${PN}-lang ${PN}-io ${PN}-re ${PN}-unittest ${PN}-debugger ${PN}-difflib", "doctest.*" ) - # FIXME consider adding to some higher level package - m.addPackage( "${PN}-elementtree", "Python elementree", "${PN}-core", - "lib-dynload/_elementtree.so" ) - - m.addPackage( "${PN}-email", "Python Email Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient", + m.addPackage( "${PN}-email", "Python email support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient", "imaplib.* email" ) # package - m.addPackage( "${PN}-fcntl", "Python's fcntl Interface", "${PN}-core", + m.addPackage( "${PN}-fcntl", "Python's fcntl interface", "${PN}-core", "lib-dynload/fcntl.so" ) - m.addPackage( "${PN}-hotshot", "Python Hotshot Profiler", "${PN}-core", + m.addPackage( "${PN}-hotshot", "Python hotshot performance profiler", "${PN}-core", "hotshot lib-dynload/_hotshot.so" ) - m.addPackage( "${PN}-html", "Python HTML Processing", "${PN}-core", + m.addPackage( "${PN}-html", "Python HTML processing support", "${PN}-core", "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* HTMLParser.* " ) - m.addPackage( "${PN}-gdbm", "Python GNU Database Support", "${PN}-core", + m.addPackage( "${PN}-importlib", "Python import implementation library", "${PN}-core", + "importlib" ) + + m.addPackage( "${PN}-gdbm", "Python GNU database support", "${PN}-core", "lib-dynload/gdbm.so" ) - m.addPackage( "${PN}-image", "Python Graphical Image Handling", "${PN}-core", + m.addPackage( "${PN}-image", "Python graphical image handling", "${PN}-core", "colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" ) - m.addPackage( "${PN}-io", "Python Low-Level I/O", "${PN}-core ${PN}-math ${PN}-textutils", + m.addPackage( "${PN}-io", "Python low-level I/O", "${PN}-core ${PN}-math ${PN}-textutils ${PN}-netclient ${PN}-contextlib", "lib-dynload/_socket.so lib-dynload/_io.so lib-dynload/_ssl.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so " + "pipes.* socket.* ssl.* tempfile.* StringIO.* io.* _pyio.*" ) - m.addPackage( "${PN}-json", "Python JSON Support", "${PN}-core ${PN}-math ${PN}-re", + m.addPackage( "${PN}-json", "Python JSON support", "${PN}-core ${PN}-math ${PN}-re ${PN}-codecs", "json lib-dynload/_json.so" ) # package - m.addPackage( "${PN}-lang", "Python Low-Level Language Support", "${PN}-core", + m.addPackage( "${PN}-lang", "Python low-level language support", "${PN}-core", "lib-dynload/_bisect.so lib-dynload/_collections.so lib-dynload/_heapq.so lib-dynload/_weakref.so lib-dynload/_functools.so " + "lib-dynload/array.so lib-dynload/itertools.so lib-dynload/operator.so lib-dynload/parser.so " + "atexit.* bisect.* code.* codeop.* collections.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* symbol.* repr.* token.* " + "tokenize.* traceback.* weakref.*" ) - m.addPackage( "${PN}-logging", "Python Logging Support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold", + m.addPackage( "${PN}-logging", "Python logging support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold", "logging" ) # package - m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime", + m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime", "mailbox.*" ) - m.addPackage( "${PN}-math", "Python Math Support", "${PN}-core ${PN}-crypt", + m.addPackage( "${PN}-math", "Python math support", "${PN}-core ${PN}-crypt", "lib-dynload/cmath.so lib-dynload/math.so lib-dynload/_random.so random.* sets.*" ) - m.addPackage( "${PN}-mime", "Python MIME Handling APIs", "${PN}-core ${PN}-io", + m.addPackage( "${PN}-mime", "Python MIME handling APIs", "${PN}-core ${PN}-io", "mimetools.* uu.* quopri.* rfc822.* MimeWriter.*" ) - m.addPackage( "${PN}-mmap", "Python Memory-Mapped-File Support", "${PN}-core ${PN}-io", + m.addPackage( "${PN}-mmap", "Python memory-mapped file support", "${PN}-core ${PN}-io", "lib-dynload/mmap.so " ) - m.addPackage( "${PN}-multiprocessing", "Python Multiprocessing Support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-threading", + m.addPackage( "${PN}-multiprocessing", "Python multiprocessing support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-threading ${PN}-ctypes ${PN}-mmap", "lib-dynload/_multiprocessing.so multiprocessing" ) # package - m.addPackage( "${PN}-netclient", "Python Internet Protocol Clients", "${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime", + m.addPackage( "${PN}-netclient", "Python Internet Protocol clients", "${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime", "*Cookie*.* " + "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.* uuid.* rfc822.* mimetools.*" ) - m.addPackage( "${PN}-netserver", "Python Internet Protocol Servers", "${PN}-core ${PN}-netclient", + m.addPackage( "${PN}-netserver", "Python Internet Protocol servers", "${PN}-core ${PN}-netclient ${PN}-shell ${PN}-threading", "cgi.* *HTTPServer.* SocketServer.*" ) - m.addPackage( "${PN}-numbers", "Python Number APIs", "${PN}-core ${PN}-lang ${PN}-re", - "decimal.* numbers.*" ) + m.addPackage( "${PN}-numbers", "Python number APIs", "${PN}-core ${PN}-lang ${PN}-re", + "decimal.* fractions.* numbers.*" ) - m.addPackage( "${PN}-pickle", "Python Persistence Support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re", + m.addPackage( "${PN}-pickle", "Python serialisation/persistence support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re", "pickle.* shelve.* lib-dynload/cPickle.so pickletools.*" ) - m.addPackage( "${PN}-pkgutil", "Python Package Extension Utility Support", "${PN}-core", + m.addPackage( "${PN}-pkgutil", "Python package extension utility support", "${PN}-core", "pkgutil.*") - m.addPackage( "${PN}-pprint", "Python Pretty-Print Support", "${PN}-core ${PN}-io", + m.addPackage( "${PN}-plistlib", "Generate and parse Mac OS X .plist files", "${PN}-core ${PN}-datetime ${PN}-io", + "plistlib.*") + + m.addPackage( "${PN}-pprint", "Python pretty-print support", "${PN}-core ${PN}-io", "pprint.*" ) - m.addPackage( "${PN}-profile", "Python Basic Profiling Support", "${PN}-core ${PN}-textutils", + m.addPackage( "${PN}-profile", "Python basic performance profiling support", "${PN}-core ${PN}-textutils", "profile.* pstats.* cProfile.* lib-dynload/_lsprof.so" ) m.addPackage( "${PN}-re", "Python Regular Expression APIs", "${PN}-core", "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin - m.addPackage( "${PN}-readline", "Python Readline Support", "${PN}-core", + m.addPackage( "${PN}-readline", "Python readline support", "${PN}-core", "lib-dynload/readline.so rlcompleter.*" ) - m.addPackage( "${PN}-resource", "Python Resource Control Interface", "${PN}-core", + m.addPackage( "${PN}-resource", "Python resource control interface", "${PN}-core", "lib-dynload/resource.so" ) - m.addPackage( "${PN}-shell", "Python Shell-Like Functionality", "${PN}-core ${PN}-re", + m.addPackage( "${PN}-shell", "Python shell-like functionality", "${PN}-core ${PN}-re", "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shlex.* shutil.*" ) m.addPackage( "${PN}-robotparser", "Python robots.txt parser", "${PN}-core ${PN}-netclient", "robotparser.*") - m.addPackage( "${PN}-subprocess", "Python Subprocess Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle", + m.addPackage( "${PN}-subprocess", "Python subprocess support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle", "subprocess.*" ) - m.addPackage( "${PN}-sqlite3", "Python Sqlite3 Database Support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading ${PN}-zlib", + m.addPackage( "${PN}-sqlite3", "Python Sqlite3 database support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading ${PN}-zlib", "lib-dynload/_sqlite3.so sqlite3/dbapi2.* sqlite3/__init__.* sqlite3/dump.*" ) - m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 Database Support Tests", "${PN}-core ${PN}-sqlite3", + m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 database support tests", "${PN}-core ${PN}-sqlite3", "sqlite3/test" ) - m.addPackage( "${PN}-stringold", "Python String APIs [deprecated]", "${PN}-core ${PN}-re", + m.addPackage( "${PN}-stringold", "Python string APIs [deprecated]", "${PN}-core ${PN}-re", "lib-dynload/strop.so string.* stringold.*" ) - m.addPackage( "${PN}-syslog", "Python Syslog Interface", "${PN}-core", + m.addPackage( "${PN}-syslog", "Python syslog interface", "${PN}-core", "lib-dynload/syslog.so" ) - m.addPackage( "${PN}-terminal", "Python Terminal Controlling Support", "${PN}-core ${PN}-io", + m.addPackage( "${PN}-terminal", "Python terminal controlling support", "${PN}-core ${PN}-io", "pty.* tty.*" ) - m.addPackage( "${PN}-tests", "Python Tests", "${PN}-core", + m.addPackage( "${PN}-tests", "Python tests", "${PN}-core ${PN}-modules", "test" ) # package - m.addPackage( "${PN}-threading", "Python Threading & Synchronization Support", "${PN}-core ${PN}-lang", + m.addPackage( "${PN}-threading", "Python threading & synchronization support", "${PN}-core ${PN}-lang", "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" ) - m.addPackage( "${PN}-tkinter", "Python Tcl/Tk Bindings", "${PN}-core", + m.addPackage( "${PN}-tkinter", "Python Tcl/Tk bindings", "${PN}-core", "lib-dynload/_tkinter.so lib-tk" ) # package - m.addPackage( "${PN}-unittest", "Python Unit Testing Framework", "${PN}-core ${PN}-stringold ${PN}-lang", + m.addPackage( "${PN}-unittest", "Python unit testing framework", "${PN}-core ${PN}-stringold ${PN}-lang ${PN}-io ${PN}-difflib ${PN}-pprint ${PN}-shell", "unittest/" ) - m.addPackage( "${PN}-unixadmin", "Python Unix Administration Support", "${PN}-core", + m.addPackage( "${PN}-unixadmin", "Python Unix administration support", "${PN}-core", "lib-dynload/nis.so lib-dynload/grp.so lib-dynload/pwd.so getpass.*" ) - m.addPackage( "${PN}-xml", "Python basic XML support.", "${PN}-core ${PN}-elementtree ${PN}-re", - "lib-dynload/pyexpat.so xml xmllib.*" ) # package + m.addPackage( "${PN}-xml", "Python basic XML support", "${PN}-core ${PN}-re", + "lib-dynload/_elementtree.so lib-dynload/pyexpat.so xml xmllib.*" ) # package - m.addPackage( "${PN}-xmlrpc", "Python XMLRPC Support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang", + m.addPackage( "${PN}-xmlrpc", "Python XML-RPC support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang", "xmlrpclib.* SimpleXMLRPCServer.* DocXMLRPCServer.*" ) - m.addPackage( "${PN}-zlib", "Python zlib Support.", "${PN}-core", + m.addPackage( "${PN}-zlib", "Python zlib compression support", "${PN}-core", "lib-dynload/zlib.so" ) - m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime", + m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime", "mailbox.*" ) + m.addPackage( "${PN}-argparse", "Python command line argument parser", "${PN}-core ${PN}-codecs ${PN}-textutils", + "argparse.*" ) + + m.addPackage( "${PN}-contextlib", "Python utilities for with-statement" + + "contexts.", "${PN}-core", + "${libdir}/python${PYTHON_MAJMIN}/contextlib.*" ) + m.make() diff --git a/scripts/contrib/python/generate-manifest-3.5.py b/scripts/contrib/python/generate-manifest-3.5.py new file mode 100755 index 0000000000..075860c418 --- /dev/null +++ b/scripts/contrib/python/generate-manifest-3.5.py @@ -0,0 +1,432 @@ +#!/usr/bin/env python + +# generate Python Manifest for the OpenEmbedded build system +# (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de> +# (C) 2007 Jeremy Laine +# licensed under MIT, see COPYING.MIT +# +# June 22, 2011 -- Mark Hatle <mark.hatle@windriver.com> +# * Updated to no longer generate special -dbg package, instead use the +# single system -dbg +# * Update version with ".1" to indicate this change +# +# 2014 Khem Raj <raj.khem@gmail.com> +# Added python3 support +# +# February 26, 2017 -- Ming Liu <peter.x.liu@external.atlascopco.com> +# * Updated to support generating manifest for native python3 + +import os +import sys +import time +import argparse + +VERSION = "3.5.0" + +__author__ = "Michael 'Mickey' Lauer <mlauer@vanille-media.de>" +__version__ = "20140131" + +class MakefileMaker: + + def __init__( self, outfile, isNative ): + """initialize""" + self.packages = {} + self.targetPrefix = "${libdir}/python%s/" % VERSION[:3] + self.isNative = isNative + self.output = outfile + self.out( """ +# WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file. +# Generator: '%s%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de> +""" % ( sys.argv[0], ' --native' if isNative else '', __version__ ) ) + + # + # helper functions + # + + def out( self, data ): + """print a line to the output file""" + self.output.write( "%s\n" % data ) + + def setPrefix( self, targetPrefix ): + """set a file prefix for addPackage files""" + self.targetPrefix = targetPrefix + + def doProlog( self ): + self.out( """ """ ) + self.out( "" ) + + def addPackage( self, name, description, dependencies, filenames ): + """add a package to the Makefile""" + if type( filenames ) == type( "" ): + filenames = filenames.split() + fullFilenames = [] + for filename in filenames: + if filename[0] != "$": + fullFilenames.append( "%s%s" % ( self.targetPrefix, filename ) ) + fullFilenames.append( "%s%s" % ( self.targetPrefix, + self.pycachePath( filename ) ) ) + else: + fullFilenames.append( filename ) + self.packages[name] = description, dependencies, fullFilenames + + def pycachePath( self, filename ): + dirname = os.path.dirname( filename ) + basename = os.path.basename( filename ) + if '.' in basename: + return os.path.join( dirname, '__pycache__', basename ) + else: + return os.path.join( dirname, basename, '__pycache__' ) + + def doBody( self ): + """generate body of Makefile""" + + global VERSION + + # + # generate rprovides line for native + # + + if self.isNative: + rprovideLine = 'RPROVIDES+="' + for name in sorted(self.packages): + rprovideLine += "%s-native " % name.replace( '${PN}', 'python3' ) + rprovideLine += '"' + + self.out( rprovideLine ) + self.out( "" ) + return + + # + # generate provides line + # + + provideLine = 'PROVIDES+="' + for name in sorted(self.packages): + provideLine += "%s " % name + provideLine += '"' + + self.out( provideLine ) + self.out( "" ) + + # + # generate package line + # + + packageLine = 'PACKAGES="${PN}-dbg ' + for name in sorted(self.packages): + if name.startswith("${PN}-distutils"): + if name == "${PN}-distutils": + packageLine += "%s-staticdev %s " % (name, name) + elif name != '${PN}-dbg': + packageLine += "%s " % name + packageLine += '${PN}-modules"' + + self.out( packageLine ) + self.out( "" ) + + # + # generate package variables + # + + for name, data in sorted(self.packages.items()): + desc, deps, files = data + + # + # write out the description, revision and dependencies + # + self.out( 'SUMMARY_%s="%s"' % ( name, desc ) ) + self.out( 'RDEPENDS_%s="%s"' % ( name, deps ) ) + + line = 'FILES_%s="' % name + + # + # check which directories to make in the temporary directory + # + + dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead. + for target in files: + dirset[os.path.dirname( target )] = True + + # + # generate which files to copy for the target (-dfR because whole directories are also allowed) + # + + for target in files: + line += "%s " % target + + line += '"' + self.out( line ) + self.out( "" ) + + self.out( 'SUMMARY_${PN}-modules="All Python modules"' ) + line = 'RDEPENDS_${PN}-modules="' + + for name, data in sorted(self.packages.items()): + if name not in ['${PN}-dev', '${PN}-distutils-staticdev']: + line += "%s " % name + + self.out( "%s \"" % line ) + self.out( 'ALLOW_EMPTY_${PN}-modules = "1"' ) + + def doEpilog( self ): + self.out( """""" ) + self.out( "" ) + + def make( self ): + self.doProlog() + self.doBody() + self.doEpilog() + +if __name__ == "__main__": + parser = argparse.ArgumentParser( description='generate python3 manifest' ) + parser.add_argument( '-n', '--native', help='generate manifest for native python3', action='store_true' ) + parser.add_argument( 'outfile', metavar='OUTPUT_FILE', nargs='?', default='', help='Output file (defaults to stdout)' ) + args = parser.parse_args() + + if args.outfile: + try: + os.unlink( args.outfile ) + except Exception: + sys.exc_clear() + outfile = open( args.outfile, "w" ) + else: + outfile = sys.stdout + + m = MakefileMaker( outfile, args.native ) + + # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies! + # Parameters: revision, name, description, dependencies, filenames + # + + m.addPackage( "${PN}-core", "Python interpreter and core modules", "${PN}-lang ${PN}-re ${PN}-reprlib ${PN}-codecs ${PN}-io ${PN}-math", + "__future__.* _abcoll.* abc.* ast.* copy.* copyreg.* configparser.* " + + "genericpath.* getopt.* linecache.* new.* " + + "os.* posixpath.* struct.* " + + "warnings.* site.* stat.* " + + "UserDict.* UserList.* UserString.* " + + "lib-dynload/binascii.*.so lib-dynload/_struct.*.so lib-dynload/time.*.so " + + "lib-dynload/xreadlines.*.so types.* platform.* ${bindir}/python* " + + "_weakrefset.* sysconfig.* _sysconfigdata.* " + + "${includedir}/python${PYTHON_BINABI}/pyconfig*.h " + + "${libdir}/python${PYTHON_MAJMIN}/collections " + + "${libdir}/python${PYTHON_MAJMIN}/_collections_abc.* " + + "${libdir}/python${PYTHON_MAJMIN}/_sitebuiltins.* " + + "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py ") + + m.addPackage( "${PN}-dev", "Python development package", "${PN}-core", + "${includedir} " + + "${libdir}/lib*${SOLIBSDEV} " + + "${libdir}/*.la " + + "${libdir}/*.a " + + "${libdir}/*.o " + + "${libdir}/pkgconfig " + + "${base_libdir}/*.a " + + "${base_libdir}/*.o " + + "${datadir}/aclocal " + + "${datadir}/pkgconfig " + + "config/Makefile ") + + m.addPackage( "${PN}-2to3", "Python automated Python 2 to 3 code translator", "${PN}-core", + "lib2to3" ) # package + + m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter", + "${bindir}/idle idlelib" ) # package + + m.addPackage( "${PN}-pydoc", "Python interactive help support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re", + "${bindir}/pydoc pydoc.* pydoc_data" ) + + m.addPackage( "${PN}-smtpd", "Python Simple Mail Transport Daemon", "${PN}-core ${PN}-netserver ${PN}-email ${PN}-mime", + "${bindir}/smtpd.* smtpd.*" ) + + m.addPackage( "${PN}-audio", "Python Audio Handling", "${PN}-core", + "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.*.so lib-dynload/audioop.*.so audiodev.* sunaudio.* sunau.* toaiff.*" ) + + m.addPackage( "${PN}-argparse", "Python command line argument parser", "${PN}-core ${PN}-codecs ${PN}-textutils", + "argparse.*" ) + + m.addPackage( "${PN}-asyncio", "Python Asynchronous I/O, event loop, coroutines and tasks", "${PN}-core", + "asyncio" ) + + m.addPackage( "${PN}-codecs", "Python codecs, encodings & i18n support", "${PN}-core ${PN}-lang", + "codecs.* encodings gettext.* locale.* lib-dynload/_locale.*.so lib-dynload/_codecs* lib-dynload/_multibytecodec.*.so lib-dynload/unicodedata.*.so stringprep.* xdrlib.*" ) + + m.addPackage( "${PN}-compile", "Python bytecode compilation support", "${PN}-core", + "py_compile.* compileall.*" ) + + m.addPackage( "${PN}-compression", "Python high-level compression support", "${PN}-core ${PN}-codecs ${PN}-importlib ${PN}-threading ${PN}-shell", + "gzip.* zipfile.* tarfile.* lib-dynload/bz2.*.so lib-dynload/zlib.*.so" ) + + m.addPackage( "${PN}-crypt", "Python basic cryptographic and hashing support", "${PN}-core", + "hashlib.* md5.* sha.* lib-dynload/crypt.*.so lib-dynload/_hashlib.*.so lib-dynload/_sha256.*.so lib-dynload/_sha512.*.so" ) + + m.addPackage( "${PN}-textutils", "Python option parsing, text wrapping and CSV support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold", + "lib-dynload/_csv.*.so csv.* optparse.* textwrap.*" ) + + m.addPackage( "${PN}-curses", "Python curses support", "${PN}-core", + "curses lib-dynload/_curses.*.so lib-dynload/_curses_panel.*.so" ) # directory + low level module + + m.addPackage( "${PN}-ctypes", "Python C types support", "${PN}-core ${PN}-subprocess", + "ctypes lib-dynload/_ctypes.*.so lib-dynload/_ctypes_test.*.so" ) # directory + low level module + + m.addPackage( "${PN}-datetime", "Python calendar and time support", "${PN}-core ${PN}-codecs", + "_strptime.* calendar.* datetime.* lib-dynload/_datetime.*.so" ) + + m.addPackage( "${PN}-db", "Python file-based database support", "${PN}-core", + "anydbm.* dumbdbm.* whichdb.* dbm lib-dynload/_dbm.*.so" ) + + m.addPackage( "${PN}-debugger", "Python debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint ${PN}-importlib ${PN}-pkgutil", + "bdb.* pdb.*" ) + + m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects", "${PN}-lang ${PN}-re", + "difflib.*" ) + + m.addPackage( "${PN}-distutils-staticdev", "Python distribution utilities (static libraries)", "${PN}-distutils", + "config/lib*.a" ) # package + + m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core ${PN}-email", + "config distutils" ) # package + + m.addPackage( "${PN}-doctest", "Python framework for running examples in docstrings", "${PN}-core ${PN}-lang ${PN}-io ${PN}-re ${PN}-unittest ${PN}-debugger ${PN}-difflib", + "doctest.*" ) + + m.addPackage( "${PN}-email", "Python email support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient", + "imaplib.* email" ) # package + + m.addPackage( "${PN}-enum", "Python support for enumerations", "${PN}-core", + "enum.*" ) + + m.addPackage( "${PN}-fcntl", "Python's fcntl interface", "${PN}-core", + "lib-dynload/fcntl.*.so" ) + + m.addPackage( "${PN}-html", "Python HTML processing support", "${PN}-core", + "formatter.* htmlentitydefs.* html htmllib.* markupbase.* sgmllib.* HTMLParser.* " ) + + m.addPackage( "${PN}-importlib", "Python import implementation library", "${PN}-core ${PN}-lang", + "importlib imp.*" ) + + m.addPackage( "${PN}-gdbm", "Python GNU database support", "${PN}-core", + "lib-dynload/_gdbm.*.so" ) + + m.addPackage( "${PN}-image", "Python graphical image handling", "${PN}-core", + "colorsys.* imghdr.* lib-dynload/imageop.*.so lib-dynload/rgbimg.*.so" ) + + m.addPackage( "${PN}-io", "Python low-level I/O", "${PN}-core ${PN}-math", + "lib-dynload/_socket.*.so lib-dynload/_io.*.so lib-dynload/_ssl.*.so lib-dynload/select.*.so lib-dynload/termios.*.so lib-dynload/cStringIO.*.so " + + "ipaddress.* pipes.* socket.* ssl.* tempfile.* StringIO.* io.* _pyio.*" ) + + m.addPackage( "${PN}-json", "Python JSON support", "${PN}-core ${PN}-math ${PN}-re", + "json lib-dynload/_json.*.so" ) # package + + m.addPackage( "${PN}-lang", "Python low-level language support", "${PN}-core ${PN}-importlib", + "lib-dynload/_bisect.*.so lib-dynload/_collections.*.so lib-dynload/_heapq.*.so lib-dynload/_weakref.*.so lib-dynload/_functools.*.so " + + "lib-dynload/array.*.so lib-dynload/itertools.*.so lib-dynload/operator.*.so lib-dynload/parser.*.so " + + "atexit.* bisect.* code.* codeop.* collections.* _collections_abc.* contextlib.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* operator.* symbol.* repr.* token.* " + + "tokenize.* traceback.* weakref.*" ) + + m.addPackage( "${PN}-logging", "Python logging support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold", + "logging" ) # package + + m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime", + "mailbox.*" ) + + m.addPackage( "${PN}-math", "Python math support", "${PN}-core ${PN}-crypt", + "lib-dynload/cmath.*.so lib-dynload/math.*.so lib-dynload/_random.*.so random.* sets.*" ) + + m.addPackage( "${PN}-mime", "Python MIME handling APIs", "${PN}-core ${PN}-io", + "mimetools.* uu.* quopri.* rfc822.* MimeWriter.*" ) + + m.addPackage( "${PN}-mmap", "Python memory-mapped file support", "${PN}-core ${PN}-io", + "lib-dynload/mmap.*.so " ) + + m.addPackage( "${PN}-multiprocessing", "Python multiprocessing support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-threading ${PN}-ctypes ${PN}-mmap", + "lib-dynload/_multiprocessing.*.so multiprocessing" ) # package + + m.addPackage( "${PN}-netclient", "Python Internet Protocol clients", "${PN}-argparse ${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime ${PN}-html", + "*Cookie*.* " + + "base64.* cookielib.* ftplib.* gopherlib.* hmac.* http* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib uuid.* rfc822.* mimetools.*" ) + + m.addPackage( "${PN}-netserver", "Python Internet Protocol servers", "${PN}-core ${PN}-netclient ${PN}-shell ${PN}-threading", + "cgi.* socketserver.* *HTTPServer.* SocketServer.*" ) + + m.addPackage( "${PN}-numbers", "Python number APIs", "${PN}-core ${PN}-lang ${PN}-re", + "decimal.* fractions.* numbers.*" ) + + m.addPackage( "${PN}-pickle", "Python serialisation/persistence support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re", + "_compat_pickle.* pickle.* shelve.* lib-dynload/cPickle.*.so pickletools.*" ) + + m.addPackage( "${PN}-pkgutil", "Python package extension utility support", "${PN}-core", + "pkgutil.*") + + m.addPackage( "${PN}-pprint", "Python pretty-print support", "${PN}-core ${PN}-io", + "pprint.*" ) + + m.addPackage( "${PN}-profile", "Python basic performance profiling support", "${PN}-core ${PN}-textutils", + "profile.* pstats.* cProfile.* lib-dynload/_lsprof.*.so" ) + + m.addPackage( "${PN}-re", "Python Regular Expression APIs", "${PN}-core", + "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin + + m.addPackage( "${PN}-readline", "Python readline support", "${PN}-core", + "lib-dynload/readline.*.so rlcompleter.*" ) + + m.addPackage( "${PN}-reprlib", "Python alternate repr() implementation", "${PN}-core", + "reprlib.py" ) + + m.addPackage( "${PN}-resource", "Python resource control interface", "${PN}-core", + "lib-dynload/resource.*.so" ) + + m.addPackage( "${PN}-selectors", "Python High-level I/O multiplexing", "${PN}-core", + "selectors.*" ) + + m.addPackage( "${PN}-shell", "Python shell-like functionality", "${PN}-core ${PN}-re ${PN}-compression", + "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shlex.* shutil.*" ) + + m.addPackage( "${PN}-signal", "Python set handlers for asynchronous events support", "${PN}-core ${PN}-enum", + "signal.*" ) + + m.addPackage( "${PN}-subprocess", "Python subprocess support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle ${PN}-threading ${PN}-signal ${PN}-selectors", + "subprocess.* lib-dynload/_posixsubprocess.*.so" ) + + m.addPackage( "${PN}-sqlite3", "Python Sqlite3 database support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading", + "lib-dynload/_sqlite3.*.so sqlite3/dbapi2.* sqlite3/__init__.* sqlite3/dump.*" ) + + m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 database support tests", "${PN}-core ${PN}-sqlite3", + "sqlite3/test" ) + + m.addPackage( "${PN}-stringold", "Python string APIs [deprecated]", "${PN}-core ${PN}-re", + "lib-dynload/strop.*.so string.* stringold.*" ) + + m.addPackage( "${PN}-syslog", "Python syslog interface", "${PN}-core", + "lib-dynload/syslog.*.so" ) + + m.addPackage( "${PN}-terminal", "Python terminal controlling support", "${PN}-core ${PN}-io", + "pty.* tty.*" ) + + m.addPackage( "${PN}-tests", "Python tests", "${PN}-core", + "test" ) # package + + m.addPackage( "${PN}-threading", "Python threading & synchronization support", "${PN}-core ${PN}-lang", + "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* queue.*" ) + + m.addPackage( "${PN}-tkinter", "Python Tcl/Tk bindings", "${PN}-core", + "lib-dynload/_tkinter.*.so lib-tk tkinter" ) # package + + m.addPackage( "${PN}-typing", "Python typing support", "${PN}-core", + "typing.*" ) + + m.addPackage( "${PN}-unittest", "Python unit testing framework", "${PN}-core ${PN}-stringold ${PN}-lang ${PN}-io ${PN}-difflib ${PN}-pprint ${PN}-shell", + "unittest/" ) + + m.addPackage( "${PN}-unixadmin", "Python Unix administration support", "${PN}-core", + "lib-dynload/nis.*.so lib-dynload/grp.*.so lib-dynload/pwd.*.so getpass.*" ) + + m.addPackage( "${PN}-xml", "Python basic XML support", "${PN}-core ${PN}-re", + "lib-dynload/_elementtree.*.so lib-dynload/pyexpat.*.so xml xmllib.*" ) # package + + m.addPackage( "${PN}-xmlrpc", "Python XML-RPC support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang ${PN}-pydoc", + "xmlrpclib.* SimpleXMLRPCServer.* DocXMLRPCServer.* xmlrpc" ) + + m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime", + "mailbox.*" ) + + m.make() diff --git a/scripts/contrib/serdevtry b/scripts/contrib/serdevtry new file mode 100755 index 0000000000..74bd7b7161 --- /dev/null +++ b/scripts/contrib/serdevtry @@ -0,0 +1,60 @@ +#!/bin/sh + +# Copyright (C) 2014 Intel Corporation +# +# Released under the MIT license (see COPYING.MIT) + +if [ "$1" = "" -o "$1" = "--help" ] ; then + echo "Usage: $0 <serial terminal command>" + echo + echo "Simple script to handle maintaining a terminal for serial devices that" + echo "disappear when a device is powered down or reset, such as the USB" + echo "serial console on the original BeagleBone (white version)." + echo + echo "e.g. $0 picocom -b 115200 /dev/ttyUSB0" + echo + exit +fi + +args="$@" +DEVICE="" +while [ "$1" != "" ]; do + case "$1" in + /dev/*) + DEVICE=$1 + break;; + esac + shift +done + +if [ "$DEVICE" != "" ] ; then + while true; do + if [ ! -e $DEVICE ] ; then + echo "serdevtry: waiting for $DEVICE to exist..." + while [ ! -e $DEVICE ]; do + sleep 0.1 + done + fi + if [ ! -w $DEVICE ] ; then + # Sometimes (presumably because of a race with udev) we get to + # the device before its permissions have been set up + RETRYNUM=0 + while [ ! -w $DEVICE ]; do + if [ "$RETRYNUM" = "2" ] ; then + echo "Device $DEVICE exists but is not writable!" + exit 1 + fi + RETRYNUM=$((RETRYNUM+1)) + sleep 0.1 + done + fi + $args + if [ -e $DEVICE ] ; then + break + fi + done +else + echo "Unable to determine device node from command: $args" + exit 1 +fi + diff --git a/scripts/contrib/uncovered b/scripts/contrib/uncovered new file mode 100755 index 0000000000..a8399ad170 --- /dev/null +++ b/scripts/contrib/uncovered @@ -0,0 +1,39 @@ +#!/bin/bash -eur +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Find python modules uncovered by oe-seltest +# +# Copyright (c) 2016, Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Author: Ed Bartosh <ed.bartosh@linux.intel.com> +# + +if [ ! "$#" -eq 1 -o -t 0 ] ; then + echo 'Usage: coverage report | ./scripts/contrib/uncovered <dir>' 1>&2 + exit 1 +fi + +path=$(readlink -ev $1) + +if [ ! -d "$path" ] ; then + echo "directory $1 doesn't exist" 1>&2 + exit 1 +fi + +diff -u <(grep "$path" | grep -v '0%$' | cut -f1 -d: | sort) \ + <(find $path | xargs file | grep 'Python script' | cut -f1 -d:| sort) | \ + grep "^+$path" | cut -c2- diff --git a/scripts/contrib/verify-homepage.py b/scripts/contrib/verify-homepage.py new file mode 100755 index 0000000000..76f1749cfa --- /dev/null +++ b/scripts/contrib/verify-homepage.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +# This script can be used to verify HOMEPAGE values for all recipes in +# the current configuration. +# The result is influenced by network environment, since the timeout of connect url is 5 seconds as default. + +import sys +import os +import subprocess +import urllib.request + + +# Allow importing scripts/lib modules +scripts_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/..') +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptpath +import scriptutils + +# Allow importing bitbake modules +bitbakepath = scriptpath.add_bitbake_lib_path() + +import bb.tinfoil + +logger = scriptutils.logger_create('verify_homepage') + +def wgetHomepage(pn, homepage): + result = subprocess.call('wget ' + '-q -T 5 -t 1 --spider ' + homepage, shell = True) + if result: + logger.warn("%s: failed to verify HOMEPAGE: %s " % (pn, homepage)) + return 1 + else: + return 0 + +def verifyHomepage(bbhandler): + pkg_pn = bbhandler.cooker.recipecaches[''].pkg_pn + pnlist = sorted(pkg_pn) + count = 0 + checked = [] + for pn in pnlist: + for fn in pkg_pn[pn]: + # There's no point checking multiple BBCLASSEXTENDed variants of the same recipe + realfn, _, _ = bb.cache.virtualfn2realfn(fn) + if realfn in checked: + continue + data = bbhandler.parse_recipe_file(realfn) + homepage = data.getVar("HOMEPAGE") + if homepage: + try: + urllib.request.urlopen(homepage, timeout=5) + except Exception: + count = count + wgetHomepage(os.path.basename(realfn), homepage) + checked.append(realfn) + return count + +if __name__=='__main__': + with bb.tinfoil.Tinfoil() as bbhandler: + bbhandler.prepare() + logger.info("Start verifying HOMEPAGE:") + failcount = verifyHomepage(bbhandler) + logger.info("Finished verifying HOMEPAGE.") + logger.info("Summary: %s failed" % failcount) diff --git a/scripts/cp-noerror b/scripts/cp-noerror index 474f7aa80a..35eb211be3 100755 --- a/scripts/cp-noerror +++ b/scripts/cp-noerror @@ -1,7 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Allow copying of $1 to $2 but if files in $1 disappear during the copy operation, # don't error. +# Also don't error if $1 disappears. # import sys @@ -32,20 +33,20 @@ def copytree(src, dst, symlinks=False, ignore=None): shutil.copy2(srcname, dstname) # catch the Error from the recursive copytree so that we can # continue with other files - except shutil.Error, err: + except shutil.Error as err: errors.extend(err.args[0]) - except EnvironmentError, why: + except EnvironmentError as why: errors.append((srcname, dstname, str(why))) try: shutil.copystat(src, dst) - except OSError, why: + except OSError as why: errors.extend((src, dst, str(why))) if errors: - raise shutil.Error, errors + raise shutil.Error(errors) try: copytree(sys.argv[1], sys.argv[2]) except shutil.Error: pass - - +except OSError: + pass diff --git a/scripts/create-pull-request b/scripts/create-pull-request index 503248bbf0..e82858bc98 100755 --- a/scripts/create-pull-request +++ b/scripts/create-pull-request @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Copyright (c) 2010-2013, Intel Corporation. # All Rights Reserved @@ -34,35 +34,48 @@ RFC=0 usage() { CMD=$(basename $0) cat <<EOM -Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] -u remote [-b branch] +Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] [-d relative_dir] -u remote [-b branch] -b branch Branch name in the specified remote (default: current branch) + -l local branch Local branch name (default: HEAD) -c Create an RFC (Request for Comment) patch series -h Display this help message + -a Automatically push local branch (-l) to remote branch (-b), + or set CPR_CONTRIB_AUTO_PUSH in env -i commit_id Ending commit (default: HEAD) -m msg_body_file The file containing a blurb to be inserted into the summary email -o output_dir Specify the output directory for the messages (default: pull-PID) -p prefix Use [prefix N/M] instead of [PATCH N/M] as the subject prefix -r relative_to Starting commit (default: master) -s subject The subject to be inserted into the summary email - -u remote The git remote where the branch is located + -u remote The git remote where the branch is located, or set CPR_CONTRIB_REMOTE in env + -d relative_dir Generate patches relative to directory Examples: $CMD -u contrib -b nitin/basic $CMD -u contrib -r distro/master -i nitin/distro -b nitin/distro + $CMD -u contrib -r distro/master -i nitin/distro -b nitin/distro -l distro $CMD -u contrib -r master -i misc -b nitin/misc -o pull-misc $CMD -u contrib -p "RFC PATCH" -b nitin/experimental + $CMD -u contrib -i misc -b nitin/misc -d ./bitbake EOM } +REMOTE="$CPR_CONTRIB_REMOTE" # Parse and validate arguments -while getopts "b:chi:m:o:p:r:s:u:" OPT; do +while getopts "b:acd:hi:m:o:p:r:s:u:l:" OPT; do case $OPT in b) BRANCH="$OPTARG" ;; + l) + L_BRANCH="$OPTARG" + ;; c) RFC=1 ;; + d) + RELDIR="$OPTARG" + ;; h) usage exit 0 @@ -91,44 +104,53 @@ while getopts "b:chi:m:o:p:r:s:u:" OPT; do ;; u) REMOTE="$OPTARG" - REMOTE_URL=$(git config remote.$REMOTE.url) - if [ $? -ne 0 ]; then - echo "ERROR: git config failed to find a url for '$REMOTE'" - echo - echo "To add a remote url for $REMOTE, use:" - echo " git config remote.$REMOTE.url <url>" - exit 1 - fi - - # Rewrite private URLs to public URLs - # Determine the repository name for use in the WEB_URL later - case "$REMOTE_URL" in - *@*) - USER_RE="[A-Za-z0-9_.@][A-Za-z0-9_.@-]*\$\?" - PROTO_RE="[a-z][a-z+]*://" - GIT_RE="\(^\($PROTO_RE\)\?$USER_RE@\)\([^:/]*\)[:/]\(.*\)" - REMOTE_URL=${REMOTE_URL%.git} - REMOTE_REPO=$(echo $REMOTE_URL | sed "s#$GIT_RE#\4#") - REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#git://\3/\4#") - ;; - *) - echo "WARNING: Unrecognized remote URL: $REMOTE_URL" - echo " The pull and browse URLs will likely be incorrect" - ;; - esac + ;; + a) + CPR_CONTRIB_AUTO_PUSH="1" ;; esac done +if [ -z "$REMOTE" ]; then + echo "ERROR: Missing parameter -u or CPR_CONTRIB_REMOTE in env, no git remote!" + usage + exit 1 +fi + +REMOTE_URL=$(git config remote.$REMOTE.url) +if [ $? -ne 0 ]; then + echo "ERROR: git config failed to find a url for '$REMOTE'" + echo + echo "To add a remote url for $REMOTE, use:" + echo " git config remote.$REMOTE.url <url>" + exit 1 +fi + +# Rewrite private URLs to public URLs +# Determine the repository name for use in the WEB_URL later +case "$REMOTE_URL" in +*@*) + USER_RE="[A-Za-z0-9_.@][A-Za-z0-9_.@-]*\$\?" + PROTO_RE="[a-z][a-z+]*://" + GIT_RE="\(^\($PROTO_RE\)\?$USER_RE@\)\([^:/]*\)[:/]\(.*\)" + REMOTE_URL=${REMOTE_URL%.git} + REMOTE_REPO=$(echo $REMOTE_URL | sed "s#$GIT_RE#\4#") + REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#git://\3/\4#") + ;; +*) + echo "WARNING: Unrecognized remote URL: $REMOTE_URL" + echo " The pull and browse URLs will likely be incorrect" + ;; +esac + if [ -z "$BRANCH" ]; then BRANCH=$(git branch | grep -e "^\* " | cut -d' ' -f2) echo "NOTE: Assuming remote branch '$BRANCH', use -b to override." fi -if [ -z "$REMOTE_URL" ]; then - echo "ERROR: Missing parameter -u, no git remote!" - usage - exit 1 +if [ -z "$L_BRANCH" ]; then + L_BRANCH=HEAD + echo "NOTE: Assuming local branch HEAD, use -l to override." fi if [ $RFC -eq 1 ]; then @@ -146,7 +168,7 @@ case "$REMOTE_URL" in WEB_URL="http://git.pokylinux.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH" ;; *git.openembedded.org*) - WEB_URL="http://cgit.openembedded.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH" + WEB_URL="http://cgit.openembedded.org/$REMOTE_REPO/log/?h=$BRANCH" ;; *github.com*) WEB_URL="https://github.com/$REMOTE_REPO/tree/$BRANCH" @@ -156,6 +178,11 @@ esac # Perform a sanity test on the web URL. Issue a warning if it is not # accessible, but do not abort as users may want to run offline. if [ -n "$WEB_URL" ]; then + if [ "$CPR_CONTRIB_AUTO_PUSH" = "1" ]; then + echo "Pushing '$BRANCH' on '$REMOTE' as requested..." + git push $REMOTE $L_BRANCH:$BRANCH + echo "" + fi wget --no-check-certificate -q $WEB_URL -O /dev/null if [ $? -ne 0 ]; then echo "WARNING: Branch '$BRANCH' was not found on the contrib git tree." @@ -170,17 +197,39 @@ if [ -e $ODIR ]; then fi mkdir $ODIR +if [ -n "$RELDIR" ]; then + ODIR=$(realpath $ODIR) + pdir=$(pwd) + cd $RELDIR + extraopts="--relative" +fi # Generate the patches and cover letter -git format-patch -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null +git format-patch $extraopts -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null + +if [ -z "$(ls -A $ODIR 2> /dev/null)" ]; then + echo "ERROR: $ODIR is empty, no cover letter and patches was generated!" + echo " This is most likely due to that \$RRELATIVE_TO..\$COMMIT_ID" + echo " ($RELATIVE_TO..$COMMIT_ID) don't contain any differences." + rmdir $ODIR + exit 1 +fi +[ -n "$RELDIR" ] && cd $pdir # Customize the cover letter CL="$ODIR/0000-cover-letter.patch" PM="$ODIR/pull-msg" -git request-pull $RELATIVE_TO $REMOTE_URL $COMMIT_ID >> "$PM" +GIT_VERSION=$(`git --version` | tr -d '[:alpha:][:space:].' | sed 's/\(...\).*/\1/') +NEWER_GIT_VERSION=210 +if [ $GIT_VERSION -lt $NEWER_GIT_VERSION ]; then + git request-pull $RELATIVE_TO $REMOTE_URL $COMMIT_ID >> "$PM" +else + git request-pull $RELATIVE_TO $REMOTE_URL $L_BRANCH:$BRANCH >> "$PM" +fi if [ $? -ne 0 ]; then echo "ERROR: git request-pull reported an error" + rm -rf $ODIR exit 1 fi @@ -213,7 +262,13 @@ if [ -n "$BODY" ]; then sed -i "/BLURB HERE/ d" "$CL" fi -# If the user specified a subject, replace the SUBJECT token with it. +# Set subject automatically if there is only one patch +patch_cnt=`git log --pretty=oneline ${RELATIVE_TO}..${L_BRANCH} | wc -l` +if [ -z "$SUBJECT" -a $patch_cnt -eq 1 ]; then + SUBJECT="`git log --format=%s ${RELATIVE_TO}..${L_BRANCH}`" +fi + +# Replace the SUBJECT token with it. if [ -n "$SUBJECT" ]; then sed -i -e "s/\*\*\* SUBJECT HERE \*\*\*/$SUBJECT/" "$CL" fi diff --git a/scripts/create-recipe b/scripts/create-recipe deleted file mode 100755 index 5613e92cb9..0000000000 --- a/scripts/create-recipe +++ /dev/null @@ -1,2072 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright (C) 2012 Wind River Systems, Inc. -# -# Copyright (C) 2010 Intel Corporation -# -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# As a special exception, you may create a larger work that contains -# part or all of the autospectacle output and distribute that work -# under terms of your choice. -# Alternatively, if you modify or redistribute autospectacle itself, -# you may (at your option) remove this special exception. -# -# This special exception was modeled after the bison exception -# (as done by the Free Software Foundation in version 2.2 of Bison) -# - - -use File::Temp qw(tempdir); -use File::Path qw(mkpath rmtree); -use File::Spec (); -use File::Basename qw(basename dirname); - - -my $name = ""; -my $predef_version = "TO BE FILLED IN"; -my $version = $predef_version; -my $pversion = $predef_version; -my $description = ""; -my $summary = ""; -my $url = ""; -my $homepage = ""; -my @depends; -my @rdepends; -my @rawpythondeps; -my $configure = ""; -my $localename = ""; -my @sources; -my @mainfiles; -my @patches; - -my $md5sum = ""; -my $sh256sum = ""; -my @inherits; - -my $printed_subpackages = 0; -my $fulldir = ""; - -my $builder = ""; - - -my $oscmode = 0; -my $python = 0; - -my @banned_pkgconfig; -my %failed_commands; -my %failed_libs; -my %failed_headers; - - - -###################################################################### -# -# License management -# -# We store the sha1sum of common COPYING files in an associative array -# %licenses. -# -# For all matching sha1's in the tarball, we then push the result -# in the @license array (which we'll dedupe at the time of printing). -# - -my %licenses; -my @license; -my %lic_files; - -sub setup_licenses -{ - $licenses{"06877624ea5c77efe3b7e39b0f909eda6e25a4ec"} = "GPLv2"; - $licenses{"075d599585584bb0e4b526f5c40cb6b17e0da35a"} = "GPLv2"; - $licenses{"10782dd732f42f49918c839e8a5e2894c508b079"} = "GPLv2"; - $licenses{"2d29c273fda30310211bbf6a24127d589be09b6c"} = "GPLv2"; - $licenses{"4df5d4b947cf4e63e675729dd3f168ba844483c7"} = "LGPLv2.1"; - $licenses{"503df7650052cf38efde55e85f0fe363e59b9739"} = "GPLv2"; - $licenses{"5405311284eab5ab51113f87c9bfac435c695bb9"} = "GPLv2"; - $licenses{"5fb362ef1680e635fe5fb212b55eef4db9ead48f"} = "LGPLv2"; - $licenses{"68c94ffc34f8ad2d7bfae3f5a6b996409211c1b1"} = "GPLv2"; - $licenses{"66c77efd1cf9c70d4f982ea59487b2eeb6338e26"} = "LGPLv2.1"; - $licenses{"74a8a6531a42e124df07ab5599aad63870fa0bd4"} = "GPLv2"; - $licenses{"8088b44375ef05202c0fca4e9e82d47591563609"} = "LGPLv2.1"; - $licenses{"8624bcdae55baeef00cd11d5dfcfa60f68710a02"} = "GPLv3"; - $licenses{"8e57ffebd0ed4417edc22e3f404ea3664d7fed27"} = "MIT"; - $licenses{"99b5245b4714b9b89e7584bfc88da64e2d315b81"} = "BSD"; - $licenses{"aba8d76d0af67d57da3c3c321caa59f3d242386b"} = "MPLv1.1"; - $licenses{"bf50bac24e7ec325dbb09c6b6c4dcc88a7d79e8f"} = "LGPLv2"; - $licenses{"caeb68c46fa36651acf592771d09de7937926bb3"} = "LGPLv2.1"; - $licenses{"dfac199a7539a404407098a2541b9482279f690d"} = "GPLv2"; - $licenses{"e60c2e780886f95df9c9ee36992b8edabec00bcc"} = "LGPLv2.1"; - $licenses{"c931aad3017d975b7f20666cde0953234a9efde3"} = "GPLv2"; -} - -sub guess_license_from_file { - my ($copying) = @_; - - if (!-e $copying) { - return; - } - - my $sha1output = `sha1sum $copying`; - $sha1output =~ /^([a-zA-Z0-9]*) /; - my $sha1 = $1; - - chomp($sha1); - - # - # if sha1 matches.. push there result - # - if (defined($licenses{$sha1})) { - my $lic = $licenses{$sha1}; - push(@license, $lic); - - my $md5output = `md5sum $copying`; - $md5output =~ /^([a-zA-Z0-9]*) /; - my $md5 = $1; - chomp($md5); - $lic_files{$copying} = $md5 - } - - # - # if file is found, and licence of python - # package is already aquired, add file. - # - if ($python == 1 && @license != 0) { - my $md5output = `md5sum $copying`; - $md5output =~ /^([a-zA-Z0-9]*) /; - my $md5 = $1; - chomp($md5); - $lic_files{$copying} = $md5 - } - - # - # We also must make sure that the COPYING/etc files - # end up in the main package as %doc.. - # - $copying =~ s/$fulldir//g; - $copying =~ s/^\///g; - $copying = "\"\%doc " . $copying ."\""; - - push(@mainfiles, $copying); -} - -sub print_license -{ - my $count = @license; - if ($count == 0) { - print OUTFILE "License: TO BE FILLED IN\n"; - return; - } - - # remove dupes - undef %saw; - @saw{@license} = (); - @out = sort keys %saw; - - print OUTFILE "License : "; - foreach (@out) { - print OUTFILE "$_ "; - } - print OUTFILE "\n"; -} - -# end of license section -# -####################################################################### - -###################################################################### -# -# Package group management -# -# We set up an associative array of regexp patterns, where the content -# of the array is the name of the group. -# -# These are "strings of regexps", which means one needs to escape -# everything, and if you want the actual regexp to have a \, -# it needs to be a \\ in this string. - -my %group_patterns; -my @groups; -my $group = "TO_BE/FILLED_IN"; - -sub setup_group_rules -{ - $group_patterns{"^\\/usr\\/lib\\/.*so"} = "System/Libraries"; - $group_patterns{"^\\/lib\\/.*so"} = "System/Libraries"; - $group_patterns{"^\\/bin\\/.*"} = "Applications/System"; - $group_patterns{"^\\/sbin\\/.*"} = "Applications/System"; - $group_patterns{"^\\/usr\\/sbin\\/.*"} = "Applications/System"; -} - -sub guess_group_from_file -{ - my ($filename) = @_; - while (($key,$value) = each %group_patterns) { - if ($filename =~ /$key/) { - push(@groups, $value); - } - } - -} - -# end of group section -# -###################################################################### - - -###################################################################### -# -# Files and package section -# -# This section creates the %files section, but also decides which -# subpackages (devel and/or doc) we need to have. -# -# We start out with the @allfiles array, which will contain all the -# files installed by the %build phase of the package. The task is -# to sort these into @mainfiles, @develfiles and @docfiles. -# In addition, an attempt is made to compress the files list by -# replacing full filenames with "*" patterns. -# -# For this we use a set of regexps from the @files_match array, -# which are then used as index to three associative arrays: -# %files_target : numerical index for which package the regexp -# would place the file at hand. -# 0 - main package -# 1 - devel package -# 2 - doc package -# 99 - don't package this at all -# -# %files_from: regexp to match the file against for filename-wildcarding -# %files_to : pattern to append to the ()'d part of %files_from to end up -# with the filename-wildcard. - -my @allfiles; -my @develfiles; -my @docfiles; - - -my @files_match; -my %files_target; -my %files_from; -my %files_to; - -my $totaldocs = 0; - - -sub add_files_rule -{ - my ($match, $target, $from, $to) =@_; - push(@files_match, $match); - $files_target{"$match"} = $target; - - if (length($from) > 0) { - $files_from{"$match"} = $from; - } - - if (length($to) > 0) { - $files_to{"$match"} = $to; - } -} - -sub setup_files_rules -{ - -# -# Files for the Main package -# - - add_files_rule("^\\/usr\\/lib\\/[a-z0-9A-Z\\_\\-\\.]+\\.so\\.", 0, - "(\\/usr\\/lib\\/.*\\.so\\.).*", "\*"); - - - add_files_rule("^\\/usr\\/share\\/omf\\/", 0, - "(\\/usr\\/share\\/omf\\/.*?\\/).*", "\*"); - -# -# Files for the Devel subpackage -# - add_files_rule("^\\/usr\\/share\\/gir-1\\.0\\/[a-z0-9A-Z\\_\\-\\.]+\\.gir\$", 1, - "(\\/usr\\/share\\/gir-1\\.0\/).*", "\*\.gir"); - add_files_rule("^\\/usr\\/lib\\/girepository-1\\.0\\/[a-z0-9A-Z\\_\\-\\.]+\\.typelib\$", 1, - "(\\/usr\\/lib\\/girepository-1\\.0\/).*", "\*\.typelib"); - add_files_rule("^\\/usr\\/include\\/[a-z0-9A-Z\\_\\-\\.]+\\.h\$", 1, - "(\\/usr\\/include\/).*", "\*\.h"); - add_files_rule("^\\/usr\\/include\\/[a-z0-9A-Z\\_\\-\\.]+\\/.*?\\.h\$", 1, - "(\\/usr\\/include\\/[a-z0-9A-Z\\_\\-\\.]+\\/.*?)[a-z0-9A-Z\\_\\-\\.]+\\.h", "\*\.h"); - add_files_rule("^\\/usr\\/lib\\/[a-z0-9A-Z\\_\\-\\.]+\\.so\$", 1, - "(\\/usr\\/lib\\/).*\\.so\$", "\*.so"); - add_files_rule("^\\/usr\\/lib\\/pkgconfig\\/[a-z0-9A-Z\\_\\-\\.\+]+\\.pc\$", 1, - "(\\/usr\\/lib\\/pkgconfig\\/).*\\.pc\$", "\*.pc"); - add_files_rule("^\\/usr\\/share\\/aclocal", 1, "", ""); - add_files_rule("^\\/usr\\/lib\\/qt4\\/mkspecs/", 1, "", ""); - - - - -# -# Files for the documentation subpackage -# - add_files_rule("^\\/usr\\/share\\/gtk\-doc\\/html\\/[a-z0-9A-Z\\_\\-\\.]+\\/.\*", 2, - "(\\/usr\\/share\\/gtk\-doc\\/html\\/[a-z0-9A-Z\\_\\-\\.]+\\/).\*", "\*"); - add_files_rule("^\\/usr\\/share\\/doc\\/[a-zA-Z0-9\-]*", 2, - "(\\/usr\\/share\\/doc\\/[a-zA-Z0-9\-]+\\/).*", "\*"); - add_files_rule("^\\/usr\\/share\\/man\\/man[0-9]\\/[a-zA-Z0-9\-]*", 2, - "(\\/usr\\/share\\/man\\/man[0-9]\\/[a-zA-Z0-9\-]+\\/).*", "\*"); - add_files_rule("^\\/usr\\/share\\/gnome\\/help\\/", 2, - "(\\/usr\\/share\\/gnome\\/help\\/.*?\\/.*?\\/).*", "\*"); - - -# -# Files to just not package at all (picked up by other things) -# - add_files_rule("^\\/usr\\/share\\/locale", 99, "", ""); - # compiled python things will get auto cleaned by rpm -# add_files_rule("\.pyo\$", 99, "", ""); -# add_files_rule("\.pyc\$", 99, "", ""); - -} - -sub apply_files_rules -{ - my $filenumber = @allfiles; - - if ($filenumber == 0) { - return; - } - - while (@allfiles > 0) { - my $filename = $allfiles[0]; - my $destname = $filename; - my $handled = 0; - -# -# while we're here, try to guess what group our package is -# - guess_group_from_file($filename); - - foreach (@files_match) { - my $match = $_; - - if ($filename =~ /$match/) { -# -# First try to see if we can turn the full filename into a -# wildcard based filename -# - if (defined($files_from{$match}) && defined($files_to{$match})) { - $from = $files_from{$match}; - $to = $files_to{$match}; - $destname =~ s/$from/$1$to/; -# print "changing $filename to $destname\n"; - } - -# devel package - if ($files_target{$match} == 1) { - $handled = 1; - push(@develfiles, $destname); - } -# doc rules.. also prepend %doc - if ($files_target{$match} == 2) { - $handled = 1; - $destname = "\"%doc " . $destname . "\""; - push(@docfiles, $destname); - $totaldocs = $totaldocs + 1; - } -# don't package - if ($files_target{$match} == 99) { - $handled = 1; - if ($filename =~ /\/usr\/share\/locale\/.*?\/LC_MESSAGES\/(.*)\.mo/) { - $localename = $1; - } - } - } - } - - -# -# if the destination name contains our package version, -# use %version instead for future maintenance -# - $destname =~ s/$version/\%\{version\}/g; - if ($handled == 0) { - push(@mainfiles, $destname); - } - shift(@allfiles); - } - -# -# Now.. if we have less than 5 documentation files, just stick them in the main package -# - - $filenumber = @docfiles; - - if ($filenumber <= 5) { - while (@docfiles > 0) { - my $filename = $docfiles[0]; - - push(@mainfiles, $filename); - shift(@docfiles); - } - } - -} - -sub print_files -{ - my $count = @mainfiles; - if ($count == 0) { - return; - } - - # remove dupes - undef %saw; - @saw{@mainfiles} = (); - @out = sort keys %saw; - - print OUTFILE "Files:\n"; - foreach (@out) { - print OUTFILE " - $_\n"; - } -} - -sub print_devel -{ - my $count = @develfiles; - if ($count == 0) { - return; - } - print OUTFILE "SubPackages:\n"; - $printed_subpackages = 1; - print OUTFILE " - Name: devel\n"; - print OUTFILE " Summary: Development components for the $name package\n"; - print OUTFILE " Group: Development/Libraries\n"; - print OUTFILE " Description:\n"; - print OUTFILE " - Development files for the $name package\n"; - - # remove dupes - undef %saw; - @saw{@develfiles} = (); - @out = sort keys %saw; - - print OUTFILE " Files:\n"; - foreach (@out) { - print OUTFILE " - $_\n"; - } -} - -sub print_doc -{ - my $count = @docfiles; - if ($count == 0) { - return; - } - if ($printed_subpackages == 0) { - print OUTFILE "SubPackages:\n"; - $printed_subpackages = 1; - } - print OUTFILE " - Name: docs\n"; - print OUTFILE " Summary: Documentation components for the $name package\n"; - print OUTFILE " Group: Documentation\n"; - - # remove dupes - undef %saw; - @saw{@docfiles} = (); - @out = sort keys %saw; - - print OUTFILE " Files:\n"; - foreach (@out) { - print OUTFILE " - $_\n"; - } -} - - -# end of %files section -# -###################################################################### - - -###################################################################### -# -# What we can learn from configure.ac/configure -# -# - pkgconfig requirements -# - regular build requirements -# - package name / version - - -sub setup_pkgconfig_ban -{ - push(@banned_pkgconfig, "^dnl\$"); - push(@banned_pkgconfig, "^hal\$"); # we don't have nor want HAL - push(@banned_pkgconfig, "tslib-0.0"); # we don't want tslib-0.0 (legacy touchscreen interface) - push(@banned_pkgconfig, "intel-gen4asm"); - push(@banned_pkgconfig, "^xp\$"); # xprint - deprecated and not in meego - push(@banned_pkgconfig, "^directfb\$"); # we use X, not directfb - push(@banned_pkgconfig, "^gtkmm-2.4\$"); # we use X, not directfb - push(@banned_pkgconfig, "^evil\$"); - push(@banned_pkgconfig, "^directfb"); - push(@banned_pkgconfig, "^sdl "); - - -} - -sub setup_failed_commands -{ - $failed_commands{"doxygen"} = "doxygen"; - $failed_commands{"scrollkeeper-config"} = "rarian-compat"; - $failed_commands{"dot"} = "graphviz"; - $failed_commands{"flex"} = "flex"; - $failed_commands{"lex"} = "flex"; - $failed_commands{"freetype-config"} = "freetype-devel"; - $failed_commands{"makeinfo"} = "texinfo"; - $failed_commands{"desktop-file-install"} = "desktop-file-utils"; - $failed_commands{"deflateBound in -lz"} = "zlib-devel"; - $failed_commands{"gconftool-2"} = "GConf-dbus"; - $failed_commands{"jpeglib.h"} = "libjpeg-devel"; - $failed_commands{"expat.h"} = "expat-devel"; - $failed_commands{"bison"} = "bison"; - $failed_commands{"msgfmt"} = "gettext"; - $failed_commands{"curl-config"} = "libcurl-devel"; - $failed_commands{"doxygen"} = "doxygen"; - $failed_commands{"X"} = "pkgconfig(x11)"; - - $failed_commands{"gawk"} = "gawk"; - $failed_commands{"xbkcomp"} = "xkbcomp"; - $failed_commands{"Vorbis"} = "libvorbis-devel"; - # checking Expat 1.95.x... no - $failed_commands{"Expat 1.95.x"} = "expat-devel"; - $failed_commands{"xml2-config path"} = "libxml2-devel"; - - $failed_libs{"-lz"} = "zlib-devel"; - $failed_libs{"-lncursesw"} = "ncurses-devel"; - $failed_libs{"-ltiff"} = "libtiff-devel"; - $failed_libs{"-lasound"} = "alsa-lib-devel"; - $failed_libs{"Curses"} = "ncurses-devel"; - - $failed_headers{"X11/extensions/randr.h"} = "xrandr"; - $failed_headers{"X11/Xlib.h"} = "x11"; - $failed_headers{"X11/extensions/XShm.h"} = "xext"; - $failed_headers{"X11/extensions/shape.h"} = "xext"; - $failed_headers{"ncurses.h"} = "ncursesw"; - $failed_headers{"curses.h"} = "ncursesw"; - $failed_headers{"pci/pci.h"} = "libpci"; - $failed_headers{"xf86.h"} = "xorg-server"; - $failed_headers{"sqlite.h"} = "sqlite3"; - - $failed_headers{"X11/extensions/XIproto.h"} = "xi"; - $failed_headers{"QElapsedTimer"} = ""; -} - - - -my @package_configs; -my @buildreqs; -my $uses_configure = 0; - - -sub push_pkgconfig_buildreq -{ - my ($pr) = @_; - - $pr =~ s/\s+//g; - - # remove collateral ] ) etc damage in the string - $pr =~ s/\"//g; - $pr =~ s/\)//g; - $pr =~ s/\]//g; - $pr =~ s/\[//g; - - - # first, undo the space packing - - $pr =~ s/\>\=/ \>\= /g; - $pr =~ s/\<\=/ \<\= /g; - - $pr =~ s/\<1.1.1/ /g; - - # don't show configure variables, we can't deal with them - if ($pr =~ /^\$/) { - return; - } - if ($pr =~ /AC_SUBST/) { - return; - } - - - - - # process banned pkgconfig options for things that we don't - # have or don't want. - - - # remore versions that are macros or strings, not numbers - $pr =~ s/\s\>\= \$.*//g; - - $pr =~ s/\s\>\= [a-zA-Z]+.*//g; - - # don't show configure variables, we can't deal with them - if ($pr =~ /\$/) { - return; - } - - foreach (@banned_pkgconfig) { - my $ban = $_; - if ($pr =~ /$ban/) { - return; - } - } - - push(@package_configs, $pr); -} - -# -# detect cases where we require both a generic pkgconfig, and a version specific -# case -# -sub uniquify_pkgconfig -{ - # first remove real dupes - undef %saw; - @saw{@package_configs} = (); - @out = sort keys %saw; - - my $count = 0; - - while ($count < @out) { - - my $entry = $out[$count]; - - foreach(@out) { - my $compare = $_; - if ($entry eq $compare) { - next; - } - - $compare =~ s/ \>\=.*//g; - if ($entry eq $compare) { - $out[$count] = ""; - } - } - $count = $count + 1; - } - @package_configs = @out; -} - - -sub process_configure_ac -{ - my ($filename) = @_; - my $line = ""; - my $depth = 0; - my $keepgoing = 1; - my $buffer = ""; - - if (!-e $filename) { - return; - } - - $uses_configure = 1; - - - - open(CONFIGURE, "$filename") || die "Couldn't open $filename\n"; - seek(CONFIGURE, 0,0) or die "seek : $!"; - while ($keepgoing && !eof(CONFIGURE)) { - $buffer = getc(CONFIGURE); - - if ($buffer eq "(") { - $depth = $depth + 1; - } - if ($buffer eq ")" && $depth > 0) { - $depth = $depth - 1; - } - - if (!($buffer eq "\n")) { - $line = $line . $buffer; - } - - if (!($buffer eq "\n") || $depth > 0) { - redo unless eof(CONFIGURE); - } - - if ($line =~ /PKG_CHECK_MODULES\((.*)\)/) { - my $match = $1; - $match =~ s/\s+/ /g; - $match =~ s/, /,/g; - my @pkgs = split(/,/, $match); - my $pkg; - if (defined($pkgs[1])) { - $pkg = $pkgs[1]; - } else { - next; - } - if ($pkg =~ /\[(.*)\]/) { - $pkg = $1; - } - - $pkg =~ s/\s+/ /g; - # deal with versioned pkgconfig's by removing the spaces around >= 's - $pkg =~ s/\>\=\s/\>\=/g; - $pkg =~ s/\s\>\=/\>\=/g; - $pkg =~ s/\=\s/\=/g; - $pkg =~ s/\s\=/\=/g; - $pkg =~ s/\<\=\s/\<\=/g; - $pkg =~ s/\<\s/\</g; - $pkg =~ s/\s\<\=/\<\=/g; - $pkg =~ s/\s\</\</g; - - @words = split(/ /, $pkg); - foreach(@words) { - push_pkgconfig_buildreq($_); - } - } - - if ($line =~ /PKG_CHECK_EXISTS\((.*)\)/) { - my $match = $1; - $match =~ s/\s+/ /g; - $match =~ s/, /,/g; - my @pkgs = split(/,/, $match); - my $pkg = $pkgs[0]; - if ($pkg =~ /\[(.*)\]/) { - $pkg = $1; - } - - $pkg =~ s/\s+/ /g; - # deal with versioned pkgconfig's by removing the spaces around >= 's - $pkg =~ s/\>\=\s/\>\=/g; - $pkg =~ s/\s\>\=/\>\=/g; - $pkg =~ s/\<\=\s/\<\=/g; - $pkg =~ s/\<\s/\</g; - $pkg =~ s/\s\<\=/\<\=/g; - $pkg =~ s/\s\</\</g; - $pkg =~ s/\=\s/\=/g; - $pkg =~ s/\s\=/\=/g; - - @words = split(/ /, $pkg); - foreach(@words) { - push_pkgconfig_buildreq($_); - } - } - - if ($line =~ /XDT_CHECK_PACKAGE\(.*?,.*?\[(.*?)\].*\)/) { - my $pkg = $1; - - $pkg =~ s/\s+/ /g; - # deal with versioned pkgconfig's by removing the spaces around >= 's - $pkg =~ s/\>\=\s/\>\=/g; - $pkg =~ s/\s\>\=/\>\=/g; - $pkg =~ s/\=\s/\=/g; - $pkg =~ s/\s\=/\=/g; - - @words = split(/ /, $pkg); - foreach(@words) { - push_pkgconfig_buildreq($_); - } - } - - if ($line =~ /XDT_CHECK_OPTIONAL_PACKAGE\(.*?,.*?\[(.*?)\].*\)/) { - my $pkg = $1; - - $pkg =~ s/\s+/ /g; - # deal with versioned pkgconfig's by removing the spaces around >= 's - $pkg =~ s/\>\=\s/\>\=/g; - $pkg =~ s/\s\>\=/\>\=/g; - $pkg =~ s/\=\s/\=/g; - $pkg =~ s/\s\=/\=/g; - - @words = split(/ /, $pkg); - foreach(@words) { - push_pkgconfig_buildreq($_); - } - } - - if ($line =~ /AC_CHECK_LIB\(\[expat\]/) { - push(@buildreqs, "expat-devel"); - } - if ($line =~ /AC_CHECK_FUNC\(\[tgetent\]/) { - push(@buildreqs, "ncurses-devel"); - } - if ($line =~ /_PROG_INTLTOOL/) { - push(@buildreqs, "intltool"); - } - if ($line =~ /GETTEXT_PACKAGE/) { - push(@buildreqs, "gettext"); - } - if ($line =~ /GTK_DOC_CHECK/) { - push_pkgconfig_buildreq("gtk-doc"); - } - if ($line =~ /GNOME_DOC_INIT/) { - push(@buildreqs, "gnome-doc-utils"); - } - if ($line =~ /AM_GLIB_GNU_GETTEXT/) { - push(@buildreqs, "gettext"); - } - - if ($line =~ /AC_INIT\((.*)\)/) { - my $match = $1; - $match =~ s/\s+/ /g; - @acinit = split(/,/, $match); -# $name = $acinit[0]; - - if ($name =~ /\[(.*)\]/) { -# $name = $1; - } - - if (defined($acinit[3])) { -# $name = $acinit[3]; - if ($name =~ /\[(.*)\]/) { -# $name = $1; - } - } - if (defined($acinit[1]) and $version eq $predef_version) { - my $ver = $acinit[1]; - $ver =~ s/\[//g; - $ver =~ s/\]//g; - if ($ver =~ /\$/){} else { - $version = $ver; - $version =~ s/\s+//g; - } - } - } - if ($line =~ /AM_INIT_AUTOMAKE\((.*)\)/) { - my $match = $1; - $match =~ s/\s+/ /g; - @acinit = split(/,/, $match); -# $name = $acinit[0]; - - if ($name =~ /\[(.*)\]/) { -# $name = $1; - } - - if (defined($acinit[3])) { -# $name = $acinit[3]; - if ($name =~ /\[(.*)\]/) { -# $name = $1; - } - } - if (defined($acinit[1]) and $version eq $predef_version) { - my $ver = $acinit[1]; - $ver =~ s/\[//g; - $ver =~ s/\]//g; - if ($ver =~ /\$/){} else { - $version = $ver; - $version =~ s/\s+//g; - } - } - } - - $line = ""; - } - close(CONFIGURE); -} - -sub process_qmake_pro -{ - my ($filename) = @_; - my $line = ""; - my $depth = 0; - my $keepgoing = 1; - my $buffer = ""; - my $prev_char = ""; - - if (!-e $filename) { - return; - } - - - open(CONFIGURE, "$filename") || die "Couldn't open $filename\n"; - seek(CONFIGURE, 0,0) or die "seek : $!"; - while ($keepgoing && !eof(CONFIGURE)) { - $buffer = getc(CONFIGURE); - - if ($buffer eq "(") { - $depth = $depth + 1; - } - if ($buffer eq ")" && $depth > 0) { - $depth = $depth - 1; - } - - if (!($buffer eq "\n")) { - $line = $line . $buffer; - } - - if (!($buffer eq "\n") || ($prev_char eq "\\") ) { - $prev_char = $buffer; - redo unless eof(CONFIGURE); - } - $prev_char = " "; - - if ($line =~ /PKGCONFIG.*?\=(.*)/) { - my $l = $1; - my @pkgs; - - $l =~ s/\\//g; - $l =~ s/\s/ /g; - @pkgs = split(/ /, $l); - foreach (@pkgs) { - if (length($_)>1) { - push_pkgconfig_buildreq($_); - } - } - } - - $line = ""; - } - close(CONFIGURE); -} - -# -# We also check configure if it exists, it's nice for some things -# because various configure.ac macros have been expanded for us already. -# -sub process_configure -{ - my ($filename) = @_; - my $line = ""; - my $depth = 0; - my $keepgoing = 1; - - if (!-e $filename) { - return; - } - - $uses_configure = 1; - - open(CONFIGURE, "$filename") || die "Couldn't open $filename\n"; - seek(CONFIGURE, 0,0) or die "seek : $!"; - while ($keepgoing && !eof(CONFIGURE)) { - $buffer = getc(CONFIGURE); - - if ($buffer eq "(") { - $depth = $depth + 1; - } - if ($buffer eq ")" && $depth > 0) { - $depth = $depth - 1; - } - - if (!($buffer eq "\n")) { - $line = $line . $buffer; - } - - if (!($buffer eq "\n") || $depth > 0) { - redo unless eof(CONFIGURE); - } - - - - if ($line =~ /^PACKAGE_NAME=\'(.*?)\'/) { - $name = $1; - } - if ($line =~ /^PACKAGE_TARNAME=\'(.*?)\'/) { - $name = $1; - } - if ($line =~ /^PACKAGE_VERSION=\'(.*?)\'/) { - $version = $1; - $version =~ s/\s+//g; - } - if ($line =~ /^PACKAGE_URL=\'(.*?)\'/) { - if (length($1) > 2) { - $url = $1; - } - } - - - $line = ""; - } - close(CONFIGURE); -} - -sub print_pkgconfig -{ - my $count = @package_configs; - if ($count == 0) { - return; - } - - uniquify_pkgconfig(); - - print OUTFILE "PkgConfigBR:\n"; - foreach (@out) { - $line = $_; - $line =~ s/^\s+//g; - if (length($line) > 1) { - print OUTFILE " - $line\n"; - } - } -} - -sub print_buildreq -{ - my $count = @buildreqs; - if ($count == 0) { - return; - } - - # remove dupes - undef %saw; - @saw{@buildreqs} = (); - @out = sort keys %saw; - - print OUTFILE "PkgBR:\n"; - foreach (@out) { - print OUTFILE " - $_\n"; - } -} - - -# end of configure section -# -###################################################################### - - -###################################################################### -# -# Guessing the Description and Summary for a package -# -# We'll look at various sources of information for this: -# - spec files in the package -# - debain files in the package -# - DOAP files in the package -# - pkgconfig files in the package -# - the README file in the package -# - freshmeat.net online -# - -sub guess_description_from_spec { - my ($specfile) = @_; - - my $state = 0; - my $cummul = ""; - - open(SPEC, $specfile); - while (<SPEC>) { - my $line = $_; - if ($state == 1 && $line =~ /^\%/) { - $state = 2; - } - if ($state == 1) { - $cummul = $cummul . $line; - } - if ($state==0 && $line =~ /\%description/) { - $state = 1; - } - - if ($line =~ /Summary:\s*(.*)/ && length($summary) < 2) { - $summary = $1; - } - if ($line =~ /URL:\s*(.*)/ && length($url) < 2) { - $url = $1; - } - } - close(SPEC); - if (length($cummul) > 4) { - $description = $cummul; - } -} - -# -# DOAP is a project to create an XML/RDF vocabulary to describe software projects, and in particular open source. -# so if someone ships a .doap file... we can learn from it. -# -sub guess_description_from_doap { - my ($doapfile) = @_; - - open(DOAP, $doapfile); - while (<DOAP>) { - my $line = $_; - # <shortdesc xml:lang="en">Virtual filesystem implementation for gio</shortdesc> - if ($line =~ /\<shortdesc .*?\>(.*)\<\/shortdesc\>/) { - $summary = $1; - } - if ($line =~ /\<homepage .*?resource=\"(.*)\"\s*\/>/) { - $url = $1; - } - } - close(DOAP); -} - -# -# Debian control files have some interesting fields we can glean information -# from as well. -# -sub guess_description_from_debian_control { - my ($file) = @_; - - my $state = 0; - my $cummul = ""; - - $file = $file . "/debian/control"; - - open(FILE, $file) || return; - while (<FILE>) { - my $line = $_; - if ($state == 1 && length($line) < 2) { - $state = 2; - } - if ($state == 1) { - $cummul = $cummul . $line; - } - if ($state==0 && $line =~ /\Description: (.*)/) { - $state = 1; - $cummul = $1; - } - - } - close(FILE); - if (length($cummul) > 4) { - $description = $cummul; - } -} - -# -# the pkgconfig files have often a one line description -# of the software... good for Summary -# -sub guess_description_from_pkgconfig { - my ($file) = @_; - - open(FILE, $file); - while (<FILE>) { - my $line = $_; - - if ($line =~ /Description:\s*(.*)/ && length($summary) < 2) { - $summary = $1; - } - } - close(FILE); -} - -# -# Freshmeat can provide us with a good one paragraph description -# of the software.. -# -sub guess_description_from_freshmeat { - my ($tarname) = @_; - my $cummul = ""; - my $state = 0; - open(HTML, "curl -s http://freshmeat.net/projects/$tarname |"); - while (<HTML>) { - my $line = $_; - - if ($state == 1) { - $cummul = $cummul . $line; - } - if ($state == 0 && $line =~ /\<div class\=\"project-detail\"\>/) { - $state = 1; - } - if ($state == 1 && $line =~/\<\/p\>/) { - $state = 2; - } - } - close(HTML); - $cummul =~ s/\<p\>//g; - $cummul =~ s/\r//g; - $cummul =~ s/\<\/p\>//g; - $cummul =~ s/^\s*//g; - if (length($cummul)>10) { - $description = $cummul; - } -} -# -# If all else fails, just take the first paragraph of the -# readme file -# -sub guess_description_from_readme { - my ($file) = @_; - - my $state = 0; - my $cummul = ""; - - open(FILE, $file); - while (<FILE>) { - my $line = $_; - if ($state == 1 && $line =~ /^\n/ && length($cummul) > 80) { - $state = 2; - } - if ($state == 0 && length($line)>1) { - $state = 1; - } - if ($state == 1) { - $cummul = $cummul . $line; - } - if ($line =~ /(http\:\/\/.*$name.*\.org)/) { - my $u = $1; - if ($u =~ /bug/ || length($url) > 1) { - } else { - $url = $u; - } - } - } - close(FILE); - if (length($cummul) > 4 && length($description)<3) { - $description = $cummul; - } -} - -# -# Glue all the guesses together -# -sub guess_description { - my ($directory) = @_; - - - @files = <$directory/README*>; - foreach (@files) { - guess_description_from_readme($_); - } - - if (length($name)>2) { - guess_description_from_freshmeat($name); - } - - @files = <$directory/*.spec*>; - foreach (@files) { - guess_description_from_spec($_); - } - - guess_description_from_debian_control($directory); - - $name =~ s/ //g; - @files = <$directory/$name.pc*>; - foreach (@files) { - guess_description_from_pkgconfig($_); - } - @files = <$directory/*.pc.*>; - foreach (@files) { - guess_description_from_pkgconfig($_); - } - @files = <$directory/*.pc>; - foreach (@files) { - guess_description_from_pkgconfig($_); - } - @files = <$directory/*.doap>; - foreach (@files) { - guess_description_from_doap($_); - } - - if (length($summary) < 2) { - $summary = $description; - $summary =~ s/\n/ /g; - $summary =~ s/\s+/ /g; - if ($summary =~ /(.*?)\./) { - $summary = $1; - } - } - -} - -# end of Description / Summary section -# -###################################################################### - - - -# -# Build the package, and wait for rpm to complain about unpackaged -# files.... which we then use as basis for our %files section -# -sub guess_files_from_rpmbuild { - my $infiles = 0; - open(OUTPUTF, "rpmbuild --nodeps --define \"\%_sourcedir $orgdir \" -ba $name.spec 2>&1 |"); - while (<OUTPUTF>) { - my $line2 = $_; - - if ($infiles == 1 && $line2 =~ /RPM build errors/) { - $infiles = 2; - } - if ($infiles == 1 && $line2 =~ /^Building/) { - $infiles = 2; - } - - if ($infiles == 1) { - $line2 =~ s/\s*//g; - push(@allfiles, $line2); - } - if ($line2 =~ / Installed \(but unpackaged\) file\(s\) found\:/) { - $infiles = 1; - } - } - close(OUTPUTF); - if (@allfiles == 0) { - print "Build failed ... stopping here.\n"; - exit(0); - } - -} - -sub guess_files_from_oscbuild { - my $infiles = 0; - my $restart = 0; - my $mustrestart = 0; - my $rcount = 0; - my $done_python = 0; - - system("osc addremove &> /dev/null"); - system("osc ci -m \"Initial import by autospectacle\" &> /dev/null"); - -retry: - if ($restart > 0) { - write_yaml(); - print "Restarting the build\n"; - } - $restart = 0; - $infiles = 0; - $mustrestart = 0; - open(OUTPUTF, "osc build --no-verify $name.spec 2>&1 |"); - while (<OUTPUTF>) { - my $line2 = $_; - -# print "line is $line2\n"; - if ($infiles == 1 && $line2 =~ /RPM build errors/) { - $infiles = 2; - } - if ($infiles == 1 && $line2 =~ /^Building/) { - $infiles = 2; - } - if ($infiles == 1) { - $line2 =~ s/\s*//g; - push(@allfiles, $line2); - } - if ($line2 =~ /No package \'(.*)\' found/) { - push_pkgconfig_buildreq("$1"); - $restart = $restart + 1; - print " Adding pkgconfig($1) requirement\n"; - } - if ($line2 =~ /Package requirements \((.*?)\) were not met/) { - $pkg = $1; - # deal with versioned pkgconfig's by removing the spaces around >= 's - $pkg =~ s/\>\=\s/\>\=/g; - $pkg =~ s/\s\>\=/\>\=/g; - $pkg =~ s/\=\s/\=/g; - $pkg =~ s/\s\=/\=/g; - my @req = split(/ /,$pkg); - foreach (@req) { - push_pkgconfig_buildreq("$_"); - - $restart = $restart + 1; - print " Adding pkgconfig($_) requirement\n"; - } - } - if ($line2 =~ /which: no qmake/) { - $restart += 1; - push_pkgconfig_buildreq("Qt"); - print " Adding Qt requirement\n"; - } - if ($line2 =~ /Cannot find development files for any supported version of libnl/) { - $restart += 1; - push_pkgconfig_buildreq("libnl-1"); - print " Adding libnl requirement\n"; - } - if ($line2 =~ /<http:\/\/www.cmake.org>/) { - $restart += 1; - push(@buildreqs, "cmake"); - print " Adding cmake requirement\n"; - } - if ($line2 =~ /checking for (.*?)\.\.\. not_found/ || $line2 =~ /checking for (.*?)\.\.\. no/ || $line2 =~ /checking (.*?)\.\.\. no/) { - $pkg = $1; - while (($key,$value) = each %failed_commands) { - if ($pkg eq $key) { - push(@buildreqs, $value); - print " Adding $value requirement\n"; - $restart += $restart + 1; - $mustrestart = 1; - } - } - - } - - if ($line2 =~ /checking for [a-zA-Z0-9\_]+ in (.*?)\.\.\. no/) { - $pkg = $1; - while (($key,$value) = each %failed_libs) { - if ($pkg eq $key) { - push(@buildreqs, $value); - print " Adding $value requirement\n"; - $restart += $restart + 1; - $mustrestart = 1; - } - } - - } - - if ($line2 =~ /-- Could NOT find ([a-zA-Z0-9]+)/) { - $pkg = $1; - while (($key,$value) = each %failed_libs) { - if ($pkg eq $key) { - push(@buildreqs, $value); - print " Adding $value requirement\n"; - $restart += $restart + 1; - $mustrestart = 1; - } - } - - } - - if ($line2 =~ /fatal error\: (.*)\: No such file or directory/) { - $pkg = $1; - while (($key,$value) = each %failed_headers) { - if ($pkg eq $key) { - push_pkgconfig_buildreq($value); - print " Adding $value requirement\n"; - $restart += $restart + 1; - } - } - - } - if ($line2 =~ /checking for UDEV\.\.\. no/) { - print " Adding pkgconfig(udev) requirement\n"; - push_pkgconfig_buildreq("udev"); - } - if ($line2 =~ /checking for Apache .* module support/) { - print " Adding pkgconfig(httpd-devel) requirement\n"; - push(@buildreqs, "httpd-devel"); - if ($rcount < 3) { - $restart = $restart + 1; - } - } - if ($line2 =~ /([a-zA-Z0-9\-\_]*)\: command not found/i) { - my $cmd = $1; - my $found = 0; - - while (($key,$value) = each %failed_commands) { - if ($cmd eq $key) { - push(@buildreqs, $value); - print " Adding $value requirement\n"; - $restart += $restart + 1; - $mustrestart = 1; - $found = 1; - } - } - - if ($found < 1) { - print " Command $cmd not found!\n"; - } - } - if ($line2 =~ /checking for.*in -ljpeg... no/) { - push(@buildreqs, "libjpeg-devel"); - print " Adding libjpeg-devel requirement\n"; - $restart = $restart + 1; - } - if ($line2 =~ /fatal error\: zlib\.h\: No such file or directory/) { - push(@buildreqs, "zlib-devel"); - print " Adding zlib-devel requirement\n"; - $restart = $restart + 1; - } - if ($line2 =~ /error\: xml2-config not found/) { - push_pkgconfig_buildreq("libxml-2.0"); - print " Adding libxml2-devel requirement\n"; - $restart = $restart + 1; - } - if ($line2 =~ /checking \"location of ncurses\.h file\"/) { - push(@buildreqs, "ncurses-devel"); - print " Adding ncurses-devel requirement\n"; - $restart = $restart + 1; - } - if (($line2 =~ / \/usr\/include\/python2\.6$/ || $line2 =~ / to compile python extensions/) && $done_python == 0) { - push(@buildreqs, "python-devel"); - print " Adding python-devel requirement\n"; - $restart = $restart + 1; - $done_python = 1; - } - if ($line2 =~ /error: must install xorg-macros 1.6/) { - push_pkgconfig_buildreq("xorg-macros"); - print " Adding xorg-macros requirement\n"; - $restart = $restart + 1; - } - if ($line2 =~ /installing .*?.gmo as [a-zA-Z0-9\-\.\/\_]+?\/([a-zA-Z0-9\-\_\.]+)\.mo$/) { - my $loc = $1; - if ($loc eq $localename) {} else { - print " Changing localename from $localename to $loc\n"; - $localename = $loc; - $restart = $restart + 1; - } - } - - if ($infiles == 0 && $line2 =~ / Installed \(but unpackaged\) file\(s\) found\:/) { - $infiles = 1; - } - } - close(OUTPUTF); - if (@allfiles == 0 || $mustrestart > 0) { - if ($restart >= 1) - { - $rcount = $rcount + 1; - if ($rcount < 10) { - goto retry; - } - } - print "Build failed ... stopping here.\n"; - exit(0); - } - -} - -sub process_rpmlint { - my $infiles = 0; - - - if ($oscmode == 0) { - return; - } - - print "Verifying package ....\n"; - - system("osc addremove &> /dev/null"); - system("osc ci -m \"Final import by autospectacle\" &> /dev/null"); - - open(OUTPUTF, "osc build --no-verify $name.spec 2>&1 |"); - while (<OUTPUTF>) { - my $line2 = $_; - -# print "line is $line2\n"; - if ($infiles == 1 && $line2 =~ /RPM build errors/) { - $infiles = 2; - } - if ($infiles == 1 && $line2 =~ /^Building/) { - $infiles = 2; - } - if ($infiles == 1) { - $line2 =~ s/\s*//g; - push(@allfiles, $line2); - } - if ($infiles == 0 && $line2 =~ / Installed \(but unpackaged\) file\(s\) found\:/) { - $infiles = 1; - } - } - close(OUTPUTF); - -} - -sub guess_name_from_url { - my ($bigurl) = @_; - - @spliturl = split(/\//, $bigurl); - while (@spliturl > 1) { - shift(@spliturl); - } - my $tarfile = $spliturl[0]; - - # Ensure correct name resolution from .zip&tgz archives - $tarfile =~ s/\.zip/\.tar/; - $tarfile =~ s/\.tgz/\.tar/; - $tarfile =~ s/\_/\-/g; - if ($tarfile =~ /(.*?)\-([0-9\.\-\~]+.*?)\.tar/) { - $name = $1; - $version = $2; - $version =~ s/\-/\_/g; - } -} - -############################################################################ -# -# Output functions -# - -sub print_name_and_description -{ - my @lines; - - print OUTFILE "Name : $name\n"; - print OUTFILE "Version : $version\n"; - print OUTFILE "Release : 1\n"; - - # remove dupes - undef %saw; - @saw{@groups} = (); - @out = sort keys %saw; - - if (@out == 1) { - foreach (@out) { - print OUTFILE "Group : $_\n"; - } - } else { - print OUTFILE "Group : $group\n"; - } - # - # Work around spectacle bug - $summary =~ s/\:\s/ /g; - $summary =~ s/^([a-z])/\u$1/ig; - $summary =~ s/\@//g; - $summary = substr($summary, 0, 79); - - $summary =~ s/\.^//g; - if (length($summary) < 1) { - $summary = "TO BE FILLED IN"; - } - # - print OUTFILE "Summary : $summary\n"; - print OUTFILE "Description: |\n"; - - $description =~ s/"/\"/g; - $description =~ s/\@//g; - @lines = split(/\n/, $description); - foreach (@lines) { - print OUTFILE " $_\n"; - } - if (length($url)>1) { - print OUTFILE "URL : $url\n"; - } - - # remove dupes - undef %saw; - @saw{@sources} = (); - @out = sort keys %saw; - - print OUTFILE "Sources : \n"; - foreach (@out) { - $source = $_; - $source =~ s/$version/\%\{version\}/g; - - print OUTFILE " - $source\n"; - } - - if (@patches > 0) { - print OUTFILE "Patches: \n"; - foreach (@patches) { - my $patch = $_; - print OUTFILE " - $patch\n"; - } - } - - print OUTFILE "\n"; - if (length($configure)>2) { - print OUTFILE "Configure : $configure\n"; - } - if (length($localename) > 2) { - print OUTFILE "LocaleName : $localename\n"; - } - if (length($builder) > 2) { - print OUTFILE "Builder : $builder\n"; - } -} - -sub write_makefile -{ - open(MAKEFILE, ">Makefile"); - - print MAKEFILE "PKG_NAME := $name\n"; - print MAKEFILE "SPECFILE = \$(addsuffix .spec, \$(PKG_NAME))\n"; - print MAKEFILE "YAMLFILE = \$(addsuffix .yaml, \$(PKG_NAME))\n"; - print MAKEFILE "\n"; - print MAKEFILE "include /usr/share/packaging-tools/Makefile.common\n"; - - close(MAKEFILE); -} - -sub write_changelog -{ - open(CHANGELOG, ">$name.changes"); - $date = ` date +"%a %b %d %Y"`; - chomp($date); - print CHANGELOG "* $date - Autospectacle <autospectacle\@meego.com> - $version\n"; - print CHANGELOG "- Initial automated packaging\n"; - close(CHANGELOG); -} - -sub write_yaml -{ - open(OUTFILE, ">$name.yaml"); - print_name_and_description(); - print_license(); - print_pkgconfig(); - print_buildreq(); - print_files(); - print_devel(); - print_doc(); - close(OUTFILE); - - write_makefile(); - write_changelog(); - - system("rm $name.spec 2>/dev/null"); - system("specify &> /dev/null"); - if ($oscmode > 0) { - system("osc addremove"); - system("osc ci -m \"Import by autospectacle\" &> /dev/null"); - } - -} - -sub write_bbfile -{ - my $curdir = `pwd`; - chomp($curdir); - - if ($python == 1) { - $name =~ s/python-//; - $name = lc("python-" . $name); - } - - if (-e "$curdir/${name}_$version.bb") { - print "Wont overwrite file:"; - print "$curdir/${name}_$version.bb, exiting\n"; - return; - } - open(BBFILE, ">${name}_$version.bb"); - - print BBFILE "SUMMARY = \"$summary\"\n"; - print BBFILE "DESCRIPTION = \"$description\"\n"; - print BBFILE "HOMEPAGE = \"$homepage\"\n"; - - if ($python == 1) { - print BBFILE "SRCNAME = \"$summary\"\n"; - } - - print BBFILE "LICENSE = \"@license\"\n"; - print BBFILE "LIC_FILES_CHKSUM = \""; - foreach (keys %lic_files) { - print BBFILE "file://" . basename($_) . ";md5=$lic_files{$_} \\\n"; - } - print BBFILE "\"\n\n"; - - if (@license <= 0) { - print "Can NOT get license from package source files.\n"; - print "Please update the LICENSE and LIC_FILES_CHKSUM manually.\n"; - } - - if (@buildreqs > 0) { - my %saw; - my @out = grep(!$saw{$_}++,@buildreqs); - print BBFILE "DEPENDS = \"@out\"\n\n"; - }; - - if (@rdepends > 0) { - print BBFILE "RDEPENDS_\$\{PN\} += \""; - foreach (@rdepends) { - print BBFILE "$_ \\\n\t"; - } - print BBFILE "\"\n"; - } - - print BBFILE 'PR = "r0"' . "\n"; - if ($python == 1) { - print BBFILE "PV = \"$pversion\"\n\n"; - } - - print BBFILE "SRC_URI = \""; - foreach (@sources) { - print BBFILE "$_ \\\n"; - } - print BBFILE "\"\n\n"; - print BBFILE "SRC_URI[md5sum] = \"$md5sum\"\n"; - print BBFILE "SRC_URI[sha256sum] = \"$sha256sum\"\n\n"; - if ($python == 1) { - print BBFILE "S = \"\${WORKDIR}/\${SRCNAME}-\${PV}\"\n"; - } - - if (@inherits) { - print BBFILE "inherit "; - foreach (@inherits) { - print BBFILE "$_ "; - } - print BBFILE "\n"; - } - - close(BBFILE); - print "Create bb file: $curdir/${name}_$version.bb\n"; -} - -sub calculate_sums -{ - @_ = basename $dir; - my $md5output = `md5sum @_`; - $md5output =~ /^([a-zA-Z0-9]*) /; - $md5sum = $1; - chomp($md5sum); - my $sha256output = `sha256sum @_`; - $sha256output =~ /^([a-zA-Z0-9]*) /; - $sha256sum = $1; - chomp($sha256sum); -} - - -############################################################################ -# -# Main program -# - -if ( @ARGV < 1 ) { - print "Usage: $0 [-r] <url-of-source-tarballs>\n"; - exit(1); -} - -# Recusive parsing of python dependencies using -# easy_install -my $recurse_python = 0; -if ($ARGV[0] eq "-r") { - $recurse_python = 1; - shift @ARGV; -} - -if (@ARGV > 1) { - my $i = 1; - while ($i < @ARGV) { - my $patch = $ARGV[$i]; - print "Adding patch $patch\n"; - push(@patches, $patch); - $i++; - } -} - -setup_licenses(); -setup_files_rules(); -setup_group_rules(); -setup_pkgconfig_ban(); -setup_failed_commands(); - -if (-e ".osc/_packages") { - $oscmode = 1; -} - -my $tmpdir = tempdir(); - -$dir = $ARGV[0]; -guess_name_from_url($dir); -push(@sources, $dir); - -#system("cd $tmpdir; curl -s -O $dir"); -$orgdir = `pwd`; -chomp($orgdir); -my $outputdir = $name; -if (! $name) { - $outputdir = basename $dir; -} -mkpath($outputdir); -chdir($outputdir); -print "Downloading package: $dir\n"; -system("wget --quiet $dir") == 0 or die "Download $dir failed."; - -calculate_sums($outputdir); - -print "Unpacking to : $tmpdir\n"; - -my @tgzfiles = <$orgdir/$outputdir/*.tgz>; -foreach (@tgzfiles) { - my $tgz = basename $_; - my $tar = $tgz; - $tar =~ s/tgz/tar\.gz/g; - $dir =~ s/tgz/tar\.gz/g; - system("mv $orgdir/$outputdir/$tgz $orgdir/$outputdir/$tar"); - guess_name_from_url($dir); -} - -# -# I really really hate the fact that meego deleted the -a option from tar. -# this is a step backwards in time that is just silly. -# - -my @sourcetars = <$orgdir/$outputdir/*\.tar\.bz2 $orgdir/$outputdir/*\.tar\.gz $orgdir/$outputdir/*\.zip>; -if ( length @sourcetars == 0) { - print "Can NOT find source tarball. Exiting...\n"; - exit (1); -} -if (defined($sourcetars[0]) and $sourcetars[0] =~ ".*\.tar\.bz2") { - system("cd $tmpdir; tar -jxf $sourcetars[0] &>/dev/null"); -} elsif (defined($sourcetars[0]) and $sourcetars[0] =~ ".*\.tar\.gz") { - system("cd $tmpdir; tar -zxf $sourcetars[0] &>/dev/null"); -} elsif (defined($sourcetars[0]) and $sourcetars[0] =~ ".*\.zip") { - system("cd $tmpdir; unzip $sourcetars[0] &>/dev/null"); -} - -print "Parsing content ....\n"; -my @dirs = <$tmpdir/*>; -foreach (@dirs) { - $dir = $_; -} - -$fulldir = $dir; - -if ( -e "$dir/setup.py" ) { - $python = 1; - $tmp_stools = `grep -r setuptools $dir/setup.py`; - if (length($tmp_stools) > 2) { - push(@inherits, "setuptools"); - } else { - push(@inherits, "distutils"); - } - - $templic = `cd $dir; python setup.py --license;`; - $templic =~ s/[\r\n]+//g; - push(@license, $templic); - $summary = `cd $dir; python setup.py --name`; - $summary =~ s/[\r\n]+//g; - $description = `cd $dir; python setup.py --description`; - $description =~ s/[\r\n]+//g; - $homepage = `cd $dir; python setup.py --url`; - $homepage =~ s/[\r\n]+//g; - $pversion = `cd $dir; python setup.py -V`; - $pversion =~ s/[\r\n]+//g; -# $findoutput = `cd $dir; python setup.py --requires`; -# if (length($findoutput) < 3) { - $findoutput = `find $dir/*.egg-info/ -name "requires.txt" 2>/dev/null`; -# } - @findlist = split(/\n/, $findoutput); - foreach (@findlist) { - push(@rawpythondeps, `sed -e '/^\$/d' "$_" | sed '/^\\[/d'`); - chomp(@rawpythondeps); - push(@rdepends, `sed -e 's/python-//g' "$_" | sed '/^\\[/d'`); - chomp(@rdepends); - if ($recurse_python == 1) { - foreach (@rawpythondeps) { - my $ptempdir = tempdir(); - $purl = `easy_install -aeb $ptempdir "$_" 2>/dev/null`; - $purl =~ s/#.*//g; - @purllist = $purl =~ m/Downloading (.*:\/\/.*\n)/g; - chomp(@purllist); - - # Remove empty lines - @purllist = grep(/\S/, @purllist); - - # Recursively create recipes for dependencies - if (@purllist != 0) { - if (fork) { - # Parent, do nothing - } else { - # child, execute - print "Recursively creating recipe for: $purllist[0]\n"; - exec("cd .. ; create-recipe -r $purllist[0]"); - } - } - } - wait; - } - - foreach $item (@rdepends) { - @pyclean = split(/(\=|\<|\>).*/, $item); - if (defined($pyclean[0])) { - $item = lc("python-" . $pyclean[0]); - } - } - } -} - -if ( -e "$dir/autogen.sh" ) { - $configure = "autogen"; - $uses_configure = 1; - push(@inherits, "autotools"); -} -if ( -e "$dir/BUILD-CMAKE" ) { - $configure = "cmake"; - push(@buildreqs, "cmake"); - $uses_configure = 1; - push(@inherits, "cmake"); -} - -if ( -e "$dir/configure" ) { - $configure = ""; -} - -my @files = <$dir/configure\.*>; - -my $findoutput = `find $dir -name "configure.ac" 2>/dev/null`; -my @findlist = split(/\n/, $findoutput); -foreach (@findlist) { - push(@files, $_); -} -foreach (@files) { - process_configure_ac("$_"); -} - -$findoutput = `find $dir -name "*.pro" 2>/dev/null`; -@findlist = split(/\n/, $findoutput); -foreach (@findlist) { - process_qmake_pro("$_"); -} - -if (-e "$dir/$name.pro") { - $builder = "qmake"; - push_pkgconfig_buildreq("Qt"); - push(@inherits, "qmake2"); -} - -# -# This is a good place to generate configure.in -# -if (length($configure) > 2) { - if ($configure eq "autogen") { - system("cd $dir ; ./autogen.sh &> /dev/null"); - } -} - - -@files = <$dir/configure>; -foreach (@files) { - process_configure("$_"); -} - -if ($uses_configure == 0) { - $configure = "none"; -} - -@files = <$dir/docs/license.txt>; -foreach (@files) { - guess_license_from_file("$_"); -} - -@files = <$dir/COPY*>; -foreach (@files) { - guess_license_from_file("$_"); -} - -@files = <$dir/LICENSE*>; -foreach (@files) { - guess_license_from_file("$_"); -} - - -@files = <$dir/GPL*>; -foreach (@files) { - guess_license_from_file("$_"); -} - - -if ($python != 1) { - guess_description($dir); -} - -# -# Output of bbfile file -# -write_bbfile(); -chdir($orgdir); -exit 0; - -# -# Output of the yaml file -# - - -if ($oscmode == 1) { - print "Creating OBS project $name ...\n"; - system("osc mkpac $name &> /dev/null"); - system("mkdir $name &> /dev/null"); - chdir($name); - system("mv ../$name*\.tar\.* ."); -} - -write_yaml(); -print "Building package ....\n"; - -if ($oscmode == 0) { - guess_files_from_rpmbuild(); -} else { - guess_files_from_oscbuild(); -} - -apply_files_rules(); - -$printed_subpackages = 0; -write_yaml(); - -process_rpmlint(); - -print "Spectacle creation complete.\n"; diff --git a/scripts/crosstap b/scripts/crosstap index 58317cf91c..39739bba3a 100755 --- a/scripts/crosstap +++ b/scripts/crosstap @@ -104,13 +104,19 @@ STAGING_BINDIR_TOOLCHAIN=$(echo "$BITBAKE_VARS" | grep ^STAGING_BINDIR_TOOLCHAIN | cut -d '=' -f2 | cut -d '"' -f2) STAGING_BINDIR_TOOLPREFIX=$(echo "$BITBAKE_VARS" | grep ^TARGET_PREFIX \ | cut -d '=' -f2 | cut -d '"' -f2) -SYSTEMTAP_HOST_INSTALLDIR=$(echo "$BITBAKE_VARS" | grep ^STAGING_DIR_NATIVE \ - | cut -d '=' -f2 | cut -d '"' -f2) TARGET_ARCH=$(echo "$BITBAKE_VARS" | grep ^TRANSLATED_TARGET_ARCH \ | cut -d '=' -f2 | cut -d '"' -f2) TARGET_KERNEL_BUILDDIR=$(echo "$BITBAKE_VARS" | grep ^B= \ | cut -d '=' -f2 | cut -d '"' -f2) +# Build and populate the recipe-sysroot-native with systemtap-native +pushd $PWD +cd $BUILDDIR +BITBAKE_VARS=`bitbake -e systemtap-native` +popd +SYSTEMTAP_HOST_INSTALLDIR=$(echo "$BITBAKE_VARS" | grep ^STAGING_DIR_NATIVE \ + | cut -d '=' -f2 | cut -d '"' -f2) + systemtap_target_arch "$TARGET_ARCH" if [ ! -d $TARGET_KERNEL_BUILDDIR ] || @@ -125,6 +131,7 @@ if [ ! -f $SYSTEMTAP_HOST_INSTALLDIR/usr/bin/stap ]; then echo -e "\nError: Native (host) systemtap not found." echo -e "Did you accidentally build a local non-sdk image? (or forget to" echo -e "add 'tools-profile' to EXTRA_IMAGE_FEATURES in your local.conf)?" + echo -e "You can also: bitbake -c addto_recipe_sysroot systemtap-native" setup_usage exit 1 fi diff --git a/scripts/devtool b/scripts/devtool new file mode 100755 index 0000000000..c9ad9ddb95 --- /dev/null +++ b/scripts/devtool @@ -0,0 +1,356 @@ +#!/usr/bin/env python3 + +# OpenEmbedded Development tool +# +# Copyright (C) 2014-2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import os +import argparse +import glob +import re +import configparser +import subprocess +import logging + +basepath = '' +workspace = {} +config = None +context = None + + +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +from devtool import DevtoolError, setup_tinfoil +import scriptutils +import argparse_oe +logger = scriptutils.logger_create('devtool') + +plugins = [] + + +class ConfigHandler(object): + config_file = '' + config_obj = None + init_path = '' + workspace_path = '' + + def __init__(self, filename): + self.config_file = filename + self.config_obj = configparser.SafeConfigParser() + + def get(self, section, option, default=None): + try: + ret = self.config_obj.get(section, option) + except (configparser.NoOptionError, configparser.NoSectionError): + if default != None: + ret = default + else: + raise + return ret + + def read(self): + if os.path.exists(self.config_file): + self.config_obj.read(self.config_file) + + if self.config_obj.has_option('General', 'init_path'): + pth = self.get('General', 'init_path') + self.init_path = os.path.join(basepath, pth) + if not os.path.exists(self.init_path): + logger.error('init_path %s specified in config file cannot be found' % pth) + return False + else: + self.config_obj.add_section('General') + + self.workspace_path = self.get('General', 'workspace_path', os.path.join(basepath, 'workspace')) + return True + + + def write(self): + logger.debug('writing to config file %s' % self.config_file) + self.config_obj.set('General', 'workspace_path', self.workspace_path) + with open(self.config_file, 'w') as f: + self.config_obj.write(f) + + def set(self, section, option, value): + if not self.config_obj.has_section(section): + self.config_obj.add_section(section) + self.config_obj.set(section, option, value) + +class Context: + def __init__(self, **kwargs): + self.__dict__.update(kwargs) + + +def read_workspace(): + global workspace + workspace = {} + if not os.path.exists(os.path.join(config.workspace_path, 'conf', 'layer.conf')): + if context.fixed_setup: + logger.error("workspace layer not set up") + sys.exit(1) + else: + logger.info('Creating workspace layer in %s' % config.workspace_path) + _create_workspace(config.workspace_path, config, basepath) + if not context.fixed_setup: + _enable_workspace_layer(config.workspace_path, config, basepath) + + logger.debug('Reading workspace in %s' % config.workspace_path) + externalsrc_re = re.compile(r'^EXTERNALSRC(_pn-([^ =]+))? *= *"([^"]*)"$') + for fn in glob.glob(os.path.join(config.workspace_path, 'appends', '*.bbappend')): + with open(fn, 'r') as f: + for line in f: + res = externalsrc_re.match(line.rstrip()) + if res: + pn = res.group(2) or os.path.splitext(os.path.basename(fn))[0].split('_')[0] + # Find the recipe file within the workspace, if any + bbfile = os.path.basename(fn).replace('.bbappend', '.bb').replace('%', '*') + recipefile = glob.glob(os.path.join(config.workspace_path, + 'recipes', + pn, + bbfile)) + if recipefile: + recipefile = recipefile[0] + workspace[pn] = {'srctree': res.group(3), + 'bbappend': fn, + 'recipefile': recipefile} + logger.debug('Found recipe %s' % workspace[pn]) + +def create_unlockedsigs(): + """ This function will make unlocked-sigs.inc match the recipes in the + workspace. This runs on every run of devtool, but it lets us ensure + the unlocked items are in sync with the workspace. """ + + confdir = os.path.join(basepath, 'conf') + unlockedsigs = os.path.join(confdir, 'unlocked-sigs.inc') + bb.utils.mkdirhier(confdir) + with open(os.path.join(confdir, 'unlocked-sigs.inc'), 'w') as f: + f.write("# DO NOT MODIFY! YOUR CHANGES WILL BE LOST.\n" + + "# This layer was created by the OpenEmbedded devtool" + + " utility in order to\n" + + "# contain recipes that are unlocked.\n") + + f.write('SIGGEN_UNLOCKED_RECIPES += "\\\n') + for pn in workspace: + f.write(' ' + pn) + f.write('"') + +def create_workspace(args, config, basepath, workspace): + if args.layerpath: + workspacedir = os.path.abspath(args.layerpath) + else: + workspacedir = os.path.abspath(os.path.join(basepath, 'workspace')) + _create_workspace(workspacedir, config, basepath) + if not args.create_only: + _enable_workspace_layer(workspacedir, config, basepath) + +def _create_workspace(workspacedir, config, basepath): + import bb + + confdir = os.path.join(workspacedir, 'conf') + if os.path.exists(os.path.join(confdir, 'layer.conf')): + logger.info('Specified workspace already set up, leaving as-is') + else: + # Add a config file + bb.utils.mkdirhier(confdir) + with open(os.path.join(confdir, 'layer.conf'), 'w') as f: + f.write('# ### workspace layer auto-generated by devtool ###\n') + f.write('BBPATH =. "$' + '{LAYERDIR}:"\n') + f.write('BBFILES += "$' + '{LAYERDIR}/recipes/*/*.bb \\\n') + f.write(' $' + '{LAYERDIR}/appends/*.bbappend"\n') + f.write('BBFILE_COLLECTIONS += "workspacelayer"\n') + f.write('BBFILE_PATTERN_workspacelayer = "^$' + '{LAYERDIR}/"\n') + f.write('BBFILE_PATTERN_IGNORE_EMPTY_workspacelayer = "1"\n') + f.write('BBFILE_PRIORITY_workspacelayer = "99"\n') + # Add a README file + with open(os.path.join(workspacedir, 'README'), 'w') as f: + f.write('This layer was created by the OpenEmbedded devtool utility in order to\n') + f.write('contain recipes and bbappends that are currently being worked on. The idea\n') + f.write('is that the contents is temporary - once you have finished working on a\n') + f.write('recipe you use the appropriate method to move the files you have been\n') + f.write('working on to a proper layer. In most instances you should use the\n') + f.write('devtool utility to manage files within it rather than modifying files\n') + f.write('directly (although recipes added with "devtool add" will often need\n') + f.write('direct modification.)\n') + f.write('\nIf you no longer need to use devtool or the workspace layer\'s contents\n') + f.write('you can remove the path to this workspace layer from your conf/bblayers.conf\n') + f.write('file (and then delete the layer, if you wish).\n') + f.write('\nNote that by default, if devtool fetches and unpacks source code, it\n') + f.write('will place it in a subdirectory of a "sources" subdirectory of the\n') + f.write('layer. If you prefer it to be elsewhere you can specify the source\n') + f.write('tree path on the command line.\n') + +def _enable_workspace_layer(workspacedir, config, basepath): + """Ensure the workspace layer is in bblayers.conf""" + import bb + bblayers_conf = os.path.join(basepath, 'conf', 'bblayers.conf') + if not os.path.exists(bblayers_conf): + logger.error('Unable to find bblayers.conf') + return + _, added = bb.utils.edit_bblayers_conf(bblayers_conf, workspacedir, config.workspace_path) + if added: + logger.info('Enabling workspace layer in bblayers.conf') + if config.workspace_path != workspacedir: + # Update our config to point to the new location + config.workspace_path = workspacedir + config.write() + + +def main(): + global basepath + global config + global context + + if sys.getfilesystemencoding() != "utf-8": + sys.exit("Please use a locale setting which supports utf-8.\nPython can't change the filesystem locale after loading so we need a utf-8 when python starts or things won't work.") + + context = Context(fixed_setup=False) + + # Default basepath + basepath = os.path.dirname(os.path.abspath(__file__)) + + parser = argparse_oe.ArgumentParser(description="OpenEmbedded development tool", + add_help=False, + epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + parser.add_argument('--basepath', help='Base directory of SDK / build directory') + parser.add_argument('--bbpath', help='Explicitly specify the BBPATH, rather than getting it from the metadata') + parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') + parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') + parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') + + global_args, unparsed_args = parser.parse_known_args() + + # Help is added here rather than via add_help=True, as we don't want it to + # be handled by parse_known_args() + parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, + help='show this help message and exit') + + if global_args.debug: + logger.setLevel(logging.DEBUG) + elif global_args.quiet: + logger.setLevel(logging.ERROR) + + if global_args.basepath: + # Override + basepath = global_args.basepath + if os.path.exists(os.path.join(basepath, '.devtoolbase')): + context.fixed_setup = True + else: + pth = basepath + while pth != '' and pth != os.sep: + if os.path.exists(os.path.join(pth, '.devtoolbase')): + context.fixed_setup = True + basepath = pth + break + pth = os.path.dirname(pth) + + if not context.fixed_setup: + basepath = os.environ.get('BUILDDIR') + if not basepath: + logger.error("This script can only be run after initialising the build environment (e.g. by using oe-init-build-env)") + sys.exit(1) + + logger.debug('Using basepath %s' % basepath) + + config = ConfigHandler(os.path.join(basepath, 'conf', 'devtool.conf')) + if not config.read(): + return -1 + context.config = config + + bitbake_subdir = config.get('General', 'bitbake_subdir', '') + if bitbake_subdir: + # Normally set for use within the SDK + logger.debug('Using bitbake subdir %s' % bitbake_subdir) + sys.path.insert(0, os.path.join(basepath, bitbake_subdir, 'lib')) + core_meta_subdir = config.get('General', 'core_meta_subdir') + sys.path.insert(0, os.path.join(basepath, core_meta_subdir, 'lib')) + else: + # Standard location + import scriptpath + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + sys.exit(1) + logger.debug('Using standard bitbake path %s' % bitbakepath) + scriptpath.add_oe_lib_path() + + scriptutils.logger_setup_color(logger, global_args.color) + + if global_args.bbpath is None: + try: + tinfoil = setup_tinfoil(config_only=True, basepath=basepath) + try: + global_args.bbpath = tinfoil.config_data.getVar('BBPATH') + finally: + tinfoil.shutdown() + except bb.BBHandledException: + return 2 + + # Search BBPATH first to allow layers to override plugins in scripts_path + for path in global_args.bbpath.split(':') + [scripts_path]: + pluginpath = os.path.join(path, 'lib', 'devtool') + scriptutils.load_plugins(logger, plugins, pluginpath) + + subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>') + subparsers.required = True + + subparsers.add_subparser_group('sdk', 'SDK maintenance', -2) + subparsers.add_subparser_group('advanced', 'Advanced', -1) + subparsers.add_subparser_group('starting', 'Beginning work on a recipe', 100) + subparsers.add_subparser_group('info', 'Getting information') + subparsers.add_subparser_group('working', 'Working on a recipe in the workspace') + subparsers.add_subparser_group('testbuild', 'Testing changes on target') + + if not context.fixed_setup: + parser_create_workspace = subparsers.add_parser('create-workspace', + help='Set up workspace in an alternative location', + description='Sets up a new workspace. NOTE: other devtool subcommands will create a workspace automatically as needed, so you only need to use %(prog)s if you want to specify where the workspace should be located.', + group='advanced') + parser_create_workspace.add_argument('layerpath', nargs='?', help='Path in which the workspace layer should be created') + parser_create_workspace.add_argument('--create-only', action="store_true", help='Only create the workspace layer, do not alter configuration') + parser_create_workspace.set_defaults(func=create_workspace, no_workspace=True) + + for plugin in plugins: + if hasattr(plugin, 'register_commands'): + plugin.register_commands(subparsers, context) + + args = parser.parse_args(unparsed_args, namespace=global_args) + + if not getattr(args, 'no_workspace', False): + read_workspace() + create_unlockedsigs() + + try: + ret = args.func(args, config, basepath, workspace) + except DevtoolError as err: + if str(err): + logger.error(str(err)) + ret = err.exitcode + except argparse_oe.ArgumentUsageError as ae: + parser.error_subcommand(ae.message, ae.subcommand) + + return ret + + +if __name__ == "__main__": + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc() + sys.exit(ret) diff --git a/scripts/gen-lockedsig-cache b/scripts/gen-lockedsig-cache new file mode 100755 index 0000000000..6765891d19 --- /dev/null +++ b/scripts/gen-lockedsig-cache @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 + +import os +import sys +import glob +import shutil +import errno + +def mkdir(d): + try: + os.makedirs(d) + except OSError as e: + if e.errno != errno.EEXIST: + raise e + +if len(sys.argv) < 5: + print("Incorrect number of arguments specified") + print("syntax: gen-lockedsig-cache <locked-sigs.inc> <input-cachedir> <output-cachedir> <nativelsbstring> [filterfile]") + sys.exit(1) + +filterlist = [] +if len(sys.argv) > 5: + print('Reading filter file %s' % sys.argv[5]) + with open(sys.argv[5]) as f: + for l in f.readlines(): + if ":" in l: + filterlist.append(l.rstrip()) + +print('Reading %s' % sys.argv[1]) +sigs = [] +with open(sys.argv[1]) as f: + for l in f.readlines(): + if ":" in l: + task, sig = l.split()[0].rsplit(':', 1) + if filterlist and not task in filterlist: + print('Filtering out %s' % task) + else: + sigs.append(sig) + +print('Gathering file list') +files = set() +for s in sigs: + p = sys.argv[2] + "/" + s[:2] + "/*" + s + "*" + files |= set(glob.glob(p)) + p = sys.argv[2] + "/%s/" % sys.argv[4] + s[:2] + "/*" + s + "*" + files |= set(glob.glob(p)) + +print('Processing files') +for f in files: + sys.stdout.write('Processing %s... ' % f) + _, ext = os.path.splitext(f) + if not ext in ['.tgz', '.siginfo', '.sig']: + # Most likely a temp file, skip it + print('skipping') + continue + dst = os.path.join(sys.argv[3], os.path.relpath(f, sys.argv[2])) + destdir = os.path.dirname(dst) + mkdir(destdir) + + src = os.path.realpath(f) + if os.path.exists(dst): + os.remove(dst) + if (os.stat(src).st_dev == os.stat(destdir).st_dev): + print('linking') + try: + os.link(src, dst) + except OSError as e: + print('hard linking failed, copying') + shutil.copyfile(src, dst) + else: + print('copying') + shutil.copyfile(src, dst) + +print('Done!') diff --git a/scripts/help2man b/scripts/help2man deleted file mode 100755 index 2bb8d868bd..0000000000 --- a/scripts/help2man +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exit 1 diff --git a/scripts/hob b/scripts/hob deleted file mode 100755 index 8d33ab1782..0000000000 --- a/scripts/hob +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -export BB_ENV_EXTRAWHITE="DISABLE_SANITY_CHECKS $BB_ENV_EXTRAWHITE" -DISABLE_SANITY_CHECKS=1 bitbake -u hob $@ - -ret=$? -exit $ret diff --git a/scripts/jhbuild/jhbuild2oe.py b/scripts/jhbuild/jhbuild2oe.py deleted file mode 100755 index 9b31cafb69..0000000000 --- a/scripts/jhbuild/jhbuild2oe.py +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env python -# Available modulesets: -# -# bootstrap.modules -# freedesktop.modules -# gcj.modules -# gnome-2.10.modules -# gnome-2.12.modules -# gnome-2.14.modules -# gnome-2.16.modules -# gnutls.modules -# gtk28.modules -# gtk.modules -# xorg-7.0.modules -# xorg.modules - -moduleset = 'xorg.modules' - - - -import cElementTree as ElementTree -# import lxml.etree as ElementTree -import re, os, bb, bb.data - -class Handlers(object): - """ - Class to act as a store for handlers of jhbuild xml elements, and as a - dispatcher of parsed Elements to those handlers. - - These handlers exist to take an xml element from the jhbuild files and - either produce bitbake metadata in self.packages, or produce data which - will be used by other element handlers to do so. - - Handlers(filename) -> new object to parse and process jhbuild file of - name 'filename'. - """ - - cvsrootpat = re.compile(r''' - \s* # Skip leading whitespace - :(?P<scheme>[^:]+): # scheme (i.e. pserver, ext) - ((?P<user>\S+?)@)? # username - (?P<host>\S+?): # non-greedy match of the remote host - (?P<path>\S+) # remote path - ''', re.VERBOSE) - - - def __init__(self, msfile): - self.msfile = msfile - self.msbasename = os.path.basename(msfile) - self.msdirname = os.path.dirname(msfile) - - self.handled = {} - - self.cvsroots = {} - self.repositories = {} - self.packages = [] - - def handle(self, element, parent): - import sys - """ - XML Element dispatch function. Can be called both from outside the - Handlers object to initiate handling, and from within individual XML - element handlers to ensure that dependent elements have been handled. - - Does not handle a given XML Element more than once, as it retains - information about the handling state of the Elements it encounters. - """ - - try: - state = self.handled[element] - except KeyError: - pass - except: - return - - try: - self.__class__.__dict__[element.tag](self, element, parent) - self.handled[element] = True - except KeyError: - self.handled[element] = False - sys.__stderr__.write('Unhandled element: %s\n' % element.tag) - except Exception: - sys.__stderr__.write('Error handling %s: %s:\n %s\n' % (element.tag, sys.exc_type, sys.exc_value)) - self.handled[element] = False - - print('handle(%s, %s) -> %s' % (element, parent, self.handled[element])) - return self.handled[element] - - def cvsroot(self, element, parent): - # Rip apart the cvsroot style location to build a cvs:// url for - # bitbake's usage in the cvsmodule handler. - # root=":pserver:anoncvs@cvs.freedesktop.org:/cvs/fontconfig" - print("cvsroot(%s, %s)" % (element, parent)) - - root = element.attrib.get('root') - rootmatch = re.match(Handlers.cvsrootpat, root) - name = element.attrib.get('name') - user = rootmatch.group('user') or '' - if user != '': - pw = element.attrib.get('password') or '' - if pw != '': - pw = ':' + pw + '@' - else: - user = user + '@' - print('user: %s' % user) - print('pw: %s' % pw) - - host = rootmatch.group('host') - print('host: %s' % host) - path = rootmatch.group('path') or '/' - print('path: %s' % path) - - root = "cvs://%s%s%s%s" % (user, pw, host, path) - print('root: %s' % root) - self.cvsroots[name] = root - - def cvsmodule(self, element, parent): - rootlist = [root for root in list(parent) if root.attrib.get('name') == element.attrib.get('cvsroot')] - if len(rootlist) < 1: - raise Exception("Error: cvsmodule '%s' requires cvsroot '%s'." % (element.attrib.get('module'), element.attrib.get('cvsroot'))) - - cvsroot = rootlist[0] - - - def include(self, element, parent): - href = element.attrib.get('href') - fullhref = os.path.join(self.msdirname, href) - tree = ElementTree.ElementTree(file=fullhref) - elem = tree.getroot() - - # Append the children of the newly included root element to the parent - # element, and manually handle() them, as the currently running - # iteration isn't going to hit them. - for child in elem: - self.handle(child, elem) - parent.append(elem) - - def repository(self, element, parent): - # TODO: - # Convert the URL in the href attribute, if necessary, to the format - # which bitbake expects to see in SRC_URI. - name = element.attrib.get('name') - self.repositories[name] = element.attrib.get('href') - - - def moduleset(self, element, parent): - for child in element: - self.handle(child, element) - - def packagename(self, name): - # mangle name into an appropriate bitbake package name - return name.replace('/', '-') - - def metamodule(self, element, parent): - # grab the deps - deps = None - for child in element: - if child.tag == 'dependencies': - deps = [self.packagename(dep.attrib.get('package')) for dep in child if dep.tag == "dep"] - - # create the package - d = bb.data.init() - pn = self.packagename(element.attrib.get('id')) - d.setVar('PN', pn) - bb.data.setVar('DEPENDS', ' '.join(deps), d) - d.setVar('_handler', 'metamodule') - self.packages.append(d) - - def autotools(self, element, parent): - deps = None - branch = None - for child in element: - if child.tag == 'dependencies': - deps = [self.packagename(dep.attrib.get('package')) for dep in child if dep.tag == "dep"] - elif child.tag == 'branch': - branch = child - - # create the package - d = bb.data.init() - id = element.attrib.get('id') - if id is None: - raise Exception('Error: autotools element has no id attribute.') - pn = self.packagename(id) - d.setVar('PN', pn) - if deps is not None: - bb.data.setVar('DEPENDS', ' '.join(deps), d) - - if branch is not None: - # <branch repo="git.freedesktop.org" module="xorg/xserver"/> - repo = os.path.join(self.repositories[branch.attrib.get('repo')], branch.attrib.get('module')) - d.setVar('SRC_URI', repo) - - checkoutdir = branch.attrib.get('checkoutdir') - if checkoutdir is not None: - bb.data.setVar('S', os.path.join('${WORKDIR}', checkoutdir), d) - - # build class - d.setVar('INHERITS', 'autotools') - d.setVarFlag('INHERITS', 'operator', '+=') - d.setVar('_handler', 'autotools') - self.packages.append(d) - -class Emitter(object): - """ - Class which contains a single method for the emission of a bitbake - package from the bitbake data produced by a Handlers object. - """ - - def __init__(self, filefunc = None, basedir = None): - def _defaultfilefunc(package): - # return a relative path to the bitbake .bb which will be written - return package.getVar('PN', 1) + '.bb' - - self.filefunc = filefunc or _defaultfilefunc - self.basedir = basedir or os.path.abspath(os.curdir) - - def write(self, package, template = None): - # 1) Assemble new file contents in ram, either new from bitbake - # metadata, or a combination of the template and that metadata. - # 2) Open the path returned by the filefunc + the basedir for writing. - # 3) Write the new bitbake data file. - fdata = '' - if template: - f = file(template, 'r') - fdata = f.read() - f.close() - - for key in bb.data.keys(package): - fdata = fdata.replace('@@'+key+'@@', package.getVar(key)) - else: - for key in bb.data.keys(package): - if key == '_handler': - continue - elif key == 'INHERITS': - fdata += 'inherit %s\n' % package.getVar('INHERITS') - else: - oper = package.getVarFlag(key, 'operator') or '=' - fdata += '%s %s "%s"\n' % (key, oper, package.getVar(key)) - - if not os.path.exists(os.path.join(self.basedir, os.path.dirname(self.filefunc(package)))): - os.makedirs(os.path.join(self.basedir, os.path.dirname(self.filefunc(package)))) - - out = file(os.path.join(self.basedir, self.filefunc(package)), 'w') - out.write(fdata) - out.close() - -def _test(): - msfile = os.path.join(os.path.abspath(os.curdir), 'modulesets', moduleset) - tree = ElementTree.ElementTree(file=msfile) - elem = tree.getroot() - - handlers = Handlers(msfile) - handlers.handle(elem, None) - - def filefunc(package): - # return a relative path to the bitbake .bb which will be written - src_uri = package.getVar('SRC_URI', 1) - filename = package.getVar('PN', 1) + '.bb' - if not src_uri: - return filename - else: - substr = src_uri[src_uri.find('xorg/'):] - subdirlist = substr.split('/')[:2] - subdir = '-'.join(subdirlist) - return os.path.join(subdir, filename) - - emitter = Emitter(filefunc) - for package in handlers.packages: - template = emitter.filefunc(package) + '.in' - if os.path.exists(template): - print("%s exists, emitting based on template" % template) - emitter.write(package, template) - else: - print("%s does not exist, emitting non-templated" % template) - emitter.write(package) - -if __name__ == "__main__": - _test() diff --git a/scripts/jhbuild/modulesets/bootstrap.modules b/scripts/jhbuild/modulesets/bootstrap.modules deleted file mode 100644 index 9096b14662..0000000000 --- a/scripts/jhbuild/modulesets/bootstrap.modules +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*--> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - <repository type="tarball" name="ftp.gnu.org" - href="http://ftp.gnu.org/gnu/"/> - <repository type="tarball" name="pkgconfig" - href="http://pkgconfig.freedesktop.org/releases/"/> - <repository type="tarball" name="python" - href="http://www.python.org/ftp/python/"/> - - <autotools id="gettext" autogen-sh="configure"> - <branch repo="ftp.gnu.org" - module="gettext/gettext-0.14.5.tar.gz" version="0.14.5" - size="7105715" md5sum="e2f6581626a22a0de66dce1d81d00de3" /> - </autotools> - - <autotools id="autoconf" autogen-sh="configure"> - <branch repo="ftp.gnu.org" - module="autoconf/autoconf-2.59.tar.bz2" version="2.59" - size="925073" md5sum="1ee40f7a676b3cfdc0e3f7cd81551b5f" /> - </autotools> - - <autotools id="libtool" autogen-sh="configure"> - <branch repo="ftp.gnu.org" - module="libtool/libtool-1.5.22.tar.gz" version="1.5.22" - size="2921483" md5sum="8e0ac9797b62ba4dcc8a2fb7936412b0"> - <patch file="libtool-1.5.18-multilib.patch" strip="1" /> - </branch> - </autotools> - - <autotools id="automake-1.4" autogen-sh="configure"> - <branch repo="ftp.gnu.org" - module="automake/automake-1.4-p6.tar.gz" version="1.4-p6" - size="375060" md5sum="24872b81b95d78d05834c39af2cfcf05" /> - </autotools> - <autotools id="automake-1.7" autogen-sh="configure"> - <branch repo="ftp.gnu.org" - module="automake/automake-1.7.9.tar.bz2" version="1.7.9" - size="577705" md5sum="571fd0b0598eb2a27dcf68adcfddfacb" /> - </autotools> - <autotools id="automake-1.8" autogen-sh="configure"> - <branch repo="ftp.gnu.org" - module="automake/automake-1.8.5.tar.bz2" version="1.8.5" - size="663182" md5sum="0114aa6d7dc32112834b68105fb8d7e2" /> - </autotools> - <autotools id="automake-1.9" autogen-sh="configure"> - <branch repo="ftp.gnu.org" - module="automake/automake-1.9.6.tar.bz2" version="1.9.6" - size="765505" md5sum="c11b8100bb311492d8220378fd8bf9e0" /> - </autotools> - - <autotools id="pkg-config" autogen-sh="configure"> - <branch repo="pkgconfig" - module="pkg-config-0.20.tar.gz" version="0.20" - size="969993" md5sum="fb42402593e4198bc252ab248dd4158b" /> - </autotools> - - <autotools id="python" autogenargs="--enable-shared" autogen-sh="configure"> - <branch repo="python" - module="2.4.3/Python-2.4.3.tar.bz2" version="2.4.3" - size="8005915" md5sum="141c683447d5e76be1d2bd4829574f02" /> - </autotools> - - <repository type="tarball" name="pyrex" - href="http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/"/> - <distutils id="pyrex"> - <branch repo="pyrex" - module="Pyrex-0.9.4.1.tar.gz" version="0.9.4.1" - size="181507" md5sum="425f0543c634bc7a86fe4fce02e0e882" /> - </distutils> - - <metamodule id="meta-bootstrap"> - <dependencies> - <dep package="gettext" /> - <dep package="autoconf" /> - <dep package="libtool" /> - <dep package="automake-1.4" /> - <dep package="automake-1.7" /> - <dep package="automake-1.8" /> - <dep package="automake-1.9" /> - <dep package="pkg-config" /> - <dep package="python" /> - <dep package="pyrex" /> - </dependencies> - </metamodule> - -</moduleset> diff --git a/scripts/jhbuild/modulesets/freedesktop.modules b/scripts/jhbuild/modulesets/freedesktop.modules deleted file mode 100644 index 698853e377..0000000000 --- a/scripts/jhbuild/modulesets/freedesktop.modules +++ /dev/null @@ -1,281 +0,0 @@ -<?xml version="1.0"?><!--*- mode: nxml -*--> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - <repository type="cvs" name="cairo.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/cairo" - password=""/> - <repository type="cvs" name="dbus.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/dbus" - password=""/> - <repository type="cvs" name="fontconfig.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/fontconfig" - password=""/> - <repository type="cvs" name="hal.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/hal" - password=""/> - <repository type="cvs" name="icon-theme.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/icon-theme" - password=""/> - <repository type="cvs" name="startup-notification.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/startup-notification" - password=""/> - <repository type="cvs" name="tango.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/tango" - password=""/> - <repository type="cvs" name="xorg.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/xorg" - password=""/> - <repository type="cvs" name="poppler.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/poppler" - password=""/> - <repository type="cvs" name="system-tools-backends.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/system-tools-backends" - password=""/> - <repository type="cvs" name="gnome.org" - cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome" - password=""/> - - <repository type="svn" name="avahi.0pointer.de" - href="svn://svn.0pointer.de/avahi/"/> - <repository type="svn" name="libdaemon.0pointer.de" - href="svn://svn.0pointer.de/libdaemon/"/> - - <repository type="git" name="git.freedesktop.org" - href="git://anongit.freedesktop.org/git/"/> - - <repository type="tarball" name="cpan" href="http://search.cpan.org/CPAN/" /> - - - <autotools id="cairo"> - <branch repo="git.freedesktop.org" module="cairo"/> - <dependencies> - <dep package="fontconfig"/> - <dep package="libXrender"/> - <dep package="gtk-doc"/> - </dependencies> - <after> - <dep package="glitz"/> - </after> - </autotools> - - <tarball id="cairo-1-0" version="1.0.4"> - <source href="http://cairographics.org/releases/cairo-1.0.4.tar.gz" - size="1475777" md5sum="9002b0e69b3f94831a22d3f2a7735ce2"/> - <dependencies> - <dep package="fontconfig"/> - <dep package="libXrender"/> - </dependencies> - <after> - <dep package="glitz"/> - </after> - </tarball> - - <autotools id="glitz"> - <branch repo="cairo.freedesktop.org"/> - </autotools> - - <autotools id="pycairo-1-0"> - <branch repo="cairo.freedesktop.org" module="pycairo" - revision="RELEASE_1_0_2" checkoutdir="pycairo-1-0"/> - <dependencies> - <dep package="cairo-1-0"/> - </dependencies> - </autotools> - - <autotools id="pycairo"> - <branch repo="cairo.freedesktop.org"/> - <dependencies> - <dep package="cairo"/> - </dependencies> - </autotools> - - <autotools id="cairomm"> - <branch repo="cairo.freedesktop.org"/> - <dependencies> - <dep package="cairo"/> - </dependencies> - </autotools> - - <autotools id="dbus" supports-non-srcdir-builds="no"> - <branch repo="dbus.freedesktop.org"/> - <dependencies> - <dep package="glib"/> - </dependencies> - <after> - <dep package="gtk+"/> - </after> - </autotools> - - <autotools id="dbus-0.23" supports-non-srcdir-builds="no"> - <branch repo="dbus.freedesktop.org" module="dbus" - revision="dbus-0-23" checkoutdir="dbus-0.23"/> - <dependencies> - <dep package="glib"/> - </dependencies> - <after> - <dep package="gtk+"/> - </after> - </autotools> - - <!-- Not maintained - try dbusmm instead --> - <autotools id="dbus-cpp"> - <branch repo="dbus.freedesktop.org"/> - <dependencies> - <dep package="dbus"/> - </dependencies> - </autotools> - - <autotools id="dbusmm"> - <branch repo="dbus.freedesktop.org"/> - <dependencies> - <dep package="dbus"/> - </dependencies> - </autotools> - - <autotools id="dbus-glib"> - <branch repo="git.freedesktop.org" module="dbus/dbus-glib"/> - <dependencies> - <dep package="libxml2"/> - <dep package="dbus"/> - <dep package="glib"/> - </dependencies> - </autotools> - - <distutils id="dbus-python"> - <branch repo="git.freedesktop.org" module="dbus/dbus-python"/> - <dependencies> - <dep package="dbus"/> - <dep package="dbus-glib"/> - </dependencies> - </distutils> - - <autotools id="PolicyKit"> - <branch repo="hal.freedesktop.org"/> - <dependencies> - <dep package="dbus-glib"/> - </dependencies> - </autotools> - - <autotools id="hal"> - <branch repo="hal.freedesktop.org"/> - <dependencies> - <dep package="dbus"/> - <dep package="PolicyKit"/> - </dependencies> - </autotools> - - <autotools id="hal-0-4"> - <branch repo="hal.freedesktop.org" module="hal" - revision="hal-0_4-stable-branch" checkoutdir="hal-0.4"/> - <dependencies> - <dep package="dbus-0.23"/> - </dependencies> - </autotools> - - <autotools id="fontconfig"> - <branch repo="fontconfig.freedesktop.org" revision="fc-2_4_branch"/> - </autotools> - - <autotools id="icon-slicer"> - <branch repo="icon-theme.freedesktop.org"/> - </autotools> - <autotools id="icon-naming-utils"> - <branch repo="icon-theme.freedesktop.org"/> - </autotools> - <tarball id="hicolor-icon-theme" version="0.9" - supports-non-srcdir-builds="no"> - <source href="http://icon-theme.freedesktop.org/releases/hicolor-icon-theme-0.9.tar.gz" - size="32574" md5sum="1d0821cb80d394eac30bd8cec5b0b60c"/> - </tarball> - - <autotools id="tango-icon-theme"> - <branch repo="tango.freedesktop.org"/> - <dependencies> - <dep package="icon-naming-utils"/> - </dependencies> - </autotools> - <autotools id="tango-icon-theme-extras"> - <branch repo="tango.freedesktop.org"/> - <dependencies> - <dep package="tango-icon-theme"/> - </dependencies> - </autotools> - - <autotools id="startup-notification"> - <branch repo="startup-notification.freedesktop.org"/> - </autotools> - - <autotools id="RenderProto"> - <branch repo="git.freedesktop.org" - module="xorg/proto/renderproto" checkoutdir="RenderProto" /> - </autotools> - <autotools id="libXrender" supports-non-srcdir-builds="no"> - <branch repo="git.freedesktop.org" - module="xorg/lib/libXrender" checkoutdir="libXrender" /> - <dependencies> - <dep package="RenderProto"/> - </dependencies> - </autotools> - <autotools id="libXft" supports-non-srcdir-builds="no"> - <branch repo="git.freedesktop.org" - module="xorg/lib/libXft" checkoutdir="libXft" /> - <dependencies> - <dep package="fontconfig"/> - <dep package="libXrender"/> - </dependencies> - </autotools> - - <autotools id="poppler"> - <branch repo="poppler.freedesktop.org"/> - <dependencies> - <dep package="cairo"/> - </dependencies> - </autotools> - - <autotools id="poppler-0-4"> - <branch repo="poppler.freedesktop.org" module="poppler" - revision="POPPLER_0_4_X" checkoutdir="poppler-0-4"/> - <dependencies> - <dep package="cairo-1-0"/> - </dependencies> - </autotools> - - <perl id="perl-net-dbus"> - <branch repo="cpan" - module="authors/id/D/DA/DANBERR/Net-DBus-0.33.2.tar.gz" version="0.33.2" - size="83279" md5sum="7e722c48c4bca7740cf28512287571b7"/> - <dependencies> - <dep package="dbus"/> - </dependencies> - </perl> - - <autotools id="system-tools-backends"> - <branch repo="system-tools-backends.freedesktop.org" - revision="BEFORE_DBUS_MERGE"/> - <suggests> - <dep package="perl-net-dbus"/> - </suggests> - </autotools> - - <autotools id="system-tools-backends-1.4"> - <branch repo="system-tools-backends.freedesktop.org" - module="system-tools-backends" revision="stb-1-4" - checkoutdir="system-tools-backends-1.4"/> - </autotools> - - <autotools id="libdaemon"> - <branch repo="libdaemon.0pointer.de" module="trunk" checkoutdir="libdaemon"/> - </autotools> - - <!-- explicit disabling of qt3 and qt4 can be removed once avahi - correctly detects what is available. --> - <autotools id="avahi" autogenargs="--disable-qt3 --disable-qt4 --disable-mono --disable-monodoc --disable-manpages --enable-compat-howl --enable-compat-libdns_sd"> - <branch repo="avahi.0pointer.de" module="trunk" checkoutdir="avahi"/> - <dependencies> - <dep package="libdaemon"/> - <dep package="dbus-python"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - -</moduleset> diff --git a/scripts/jhbuild/modulesets/gcj.modules b/scripts/jhbuild/modulesets/gcj.modules deleted file mode 100644 index 01b35c6b62..0000000000 --- a/scripts/jhbuild/modulesets/gcj.modules +++ /dev/null @@ -1,135 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*--> -<!DOCTYPE moduleset SYSTEM "moduleset.dtd"> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - - <cvsroot name="gcc.gnu.org" - root=":pserver:anoncvs@gcc.gnu.org:/cvs/gcc" - password="" /> - <cvsroot name="rhug.sources.redhat.com" - root=":pserver:anoncvs@sources.redhat.com:/cvs/rhug" - password="" /> - <cvsroot name="gdb.sources.redhat.com" - root=":pserver:anoncvs@sources.redhat.com:/cvs/src" - password="anoncvs" /> - <cvsroot name="gnome.org" - root=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome" - password="" /> - <cvsroot name="classpath.savannah.gnu.org" - root=":ext:anoncvs@savannah.gnu.org:/cvsroot/classpath" - password="" /> - <cvsroot name="cairo.freedesktop.org" - root=":pserver:anoncvs@cvs.freedesktop.org:/cvs/cairo" - password="" /> - - <include href="gnome-2.12.modules" /> - - <gdbmodule id="gdb" cvsroot="gdb.sources.redhat.com" /> - - <gcjmodule id="gcj" cvsroot="gcc.gnu.org"> - <dependencies> - <dep package="cairo" /> - <dep package="gtk+" /> - </dependencies> - </gcjmodule> - - <cvsmodule id="java-gcj-compat" cvsroot="rhug.sources.redhat.com"> - <dependencies> - <dep package="ecj-for-jhbuild" /> - <dep package="gjdoc" /> - </dependencies> - </cvsmodule> - - <cvsmodule id="ecj-for-jhbuild" cvsroot="rhug.sources.redhat.com" - supports-non-srcdir-builds="no"> - <dependencies> - <dep package="gcj" /> - </dependencies> - </cvsmodule> - - <cvsmodule id="gjdoc" cvsroot="classpath.savannah.gnu.org" > - <dependencies> - <dep package="gcj" /> - </dependencies> - </cvsmodule> - - <cvsmodule id="jg-common" cvsroot="gnome.org"> - <suggests> - <dep package="gcj" /> - </suggests> - <dependencies> - <dep package="glib" /> - </dependencies> - </cvsmodule> - - <cvsmodule id="cairo-java" cvsroot="cairo.freedesktop.org"> - <suggests> - <dep package="gcj" /> - </suggests> - <dependencies> - <dep package="jg-common" /> - <dep package="cairo" /> - </dependencies> - </cvsmodule> - - <cvsmodule id="libgtk-java" cvsroot="gnome.org"> - <suggests> - <dep package="gcj" /> - </suggests> - <dependencies> - <dep package="jg-common" /> - <dep package="cairo-java" /> - </dependencies> - </cvsmodule> - - <cvsmodule id="libgnomevfs-java" cvsroot="gnome.org"> - <suggests> - <dep package="gcj" /> - </suggests> - <dependencies> - <dep package="libgtk-java" /> - </dependencies> - </cvsmodule> - - <cvsmodule id="libgnome-java" cvsroot="gnome.org"> - <suggests> - <dep package="gcj" /> - </suggests> - <dependencies> - <dep package="libgnome" /> - <dep package="libgnomeui" /> - <dep package="libgnomecanvas" /> - <dep package="libgtk-java" /> - </dependencies> - </cvsmodule> - - <cvsmodule id="libglade-java" cvsroot="gnome.org"> - <suggests> - <dep package="gcj" /> - </suggests> - <dependencies> - <dep package="libgtk-java" /> - <dep package="libgnome-java" /> - </dependencies> - </cvsmodule> - - <cvsmodule id="libgconf-java" cvsroot="gnome.org"> - <suggests> - <dep package="gcj" /> - </suggests> - <dependencies> - <dep package="libgtk-java" /> - <dep package="libgnome-java" /> - </dependencies> - </cvsmodule> - - <metamodule id="java-gnome"> - <dependencies> - <dep package="libgtk-java" /> - <dep package="libgnome-java" /> - <dep package="libglade-java" /> - <dep package="libgconf-java" /> - </dependencies> - </metamodule> - -</moduleset> diff --git a/scripts/jhbuild/modulesets/gnome-2.10.modules b/scripts/jhbuild/modulesets/gnome-2.10.modules deleted file mode 100644 index 4d2043203a..0000000000 --- a/scripts/jhbuild/modulesets/gnome-2.10.modules +++ /dev/null @@ -1,1621 +0,0 @@ -<?xml version="1.0"?><!--*- mode: nxml -*--> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - - <repository type="cvs" name="gnome.org" default="yes" - cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome" - password=""/> - <repository type="cvs" name="cairo.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/cairo" - password=""/> - <repository type="cvs" name="mozilla.org" - cvsroot=":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" - password="anonymous"/> - <repository type="cvs" name="gstreamer.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer" - password=""/> - <repository type="cvs" name="menu.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/menus" - password=""/> - <repository type="cvs" name="mime.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/mime" - password=""/> - <repository type="cvs" name="xklavier.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/xklavier" - password=""/> - - <repository type="cvs" name="elysium-project.sf.net" - cvsroot=":pserver:anonymous@elysium-project.cvs.sourceforge.net:/cvsroot/elysium-project" - password=""/> - <repository type="cvs" name="gaim.sf.net" - cvsroot=":pserver:anonymous@gaim.cvs.sourceforge.net:/cvsroot/gaim" - password=""/> - <repository type="cvs" name="clearlooks.sf.net" - cvsroot=":pserver:anonymous@clearlooks.cvs.sourceforge.net:/cvsroot/clearlooks" - password=""/> - - <repository type="arch" name="rhythmbox" - archive="rhythmbox-devel@gnome.org--2004" - href="http://web.rhythmbox.org/arch/2004"/> - - <tarball id="scrollkeeper" version="0.3.14" supports-non-srcdir-builds="no"> - <source href="http://unc.dl.sourceforge.net/sourceforge/scrollkeeper/scrollkeeper-0.3.14.tar.gz" - size="679513" md5sum="161eb3f29e30e7b24f84eb93ac696155"/> - <dependencies> - <dep package="libxml2"/> - <dep package="libxslt"/> - <dep package="intltool"/> - </dependencies> - <patches> - <patch file="scrollkeeper_clean_xml_validation_context.patch" strip="1"/> - <patch file="scrollkeeper_language_fix.patch" strip="1"/> - <patch file="scrollkeeper_rw_offset_fix.patch" strip="1"/> - </patches> - </tarball> - - <include href="freedesktop.modules"/> - <include href="gnutls.modules"/> - - <autotools id="cairo-gtk-engine"> - <branch repo="cairo.freedesktop.org"/> - <dependencies> - <dep package="gtk+"/> - <dep package="cairo"/> - </dependencies> - </autotools> - - <autotools id="shared-mime-info" supports-non-srcdir-builds="no"> - <branch repo="mime.freedesktop.org"/> - <dependencies> - <dep package="intltool"/> - </dependencies> - </autotools> - - <autotools id="desktop-file-utils"> - <branch repo="menu.freedesktop.org"/> - <dependencies> - <dep package="glib"/> - <dep package="intltool"/> - </dependencies> - </autotools> - - <autotools id="libxklavier" supports-non-srcdir-builds="no"> - <branch repo="xklavier.freedesktop.org"/> - </autotools> - - <autotools id="intltool"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gnome-common"> - <branch revision="gnome-2-12"/> - </autotools> - <autotools id="libxml2"> - <branch module="gnome-xml" checkoutdir="libxml2"/> - </autotools> - <autotools id="libxslt"> - <branch/> - <dependencies> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gtk-doc"> - <branch/> - <dependencies> - <dep package="libxslt"/> - </dependencies> - </autotools> - <autotools id="glib"> - <branch revision="glib-2-6"/> - <dependencies> - <dep package="gtk-doc"/> - </dependencies> - </autotools> - <autotools id="pango"> - <branch revision="pango-1-8"/> - <dependencies> - <dep package="glib"/> - <dep package="libXft"/> - </dependencies> - </autotools> - <autotools id="atk"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gtk+"> - <branch revision="gtk-2-6"/> - <dependencies> - <dep package="pango"/> - <dep package="atk"/> - <dep package="shared-mime-info"/> - </dependencies> - </autotools> - <autotools id="gail"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="atk"/> - <dep package="libgnomecanvas"/> - </dependencies> - </autotools> - <autotools id="gtkhtml2"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="gail"/> - </dependencies> - </autotools> - <autotools id="libIDL"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="ORBit2"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libIDL"/> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gconf"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="ORBit2"/> - <dep package="libxml2"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libbonobo"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="ORBit2"/> - <dep package="intltool"/> - <dep package="gnome-common"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gnome-mime-data"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gnome-icon-theme"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="hicolor-icon-theme"/> - </dependencies> - </autotools> - <tarball id="howl" version="1.0.0"> - <source href="http://www.porchdogsoft.com/download/howl-1.0.0.tar.gz" - size="542782" md5sum="c389d3ffba0e69a179de2ec650f1fdcc"/> - <patches> - <patch file="howl-1.0.0-buildfix.patch" strip="1"/> - </patches> - </tarball> - <autotools id="gnome-vfs"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gconf"/> - <dep package="desktop-file-utils"/> - <dep package="shared-mime-info"/> - <dep package="gnome-mime-data"/> - <dep package="howl"/> - <dep package="hal-0.4"/> - </dependencies> - </autotools> - <autotools id="gnome-keyring"> - <branch/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libart_lgpl"> - <branch/> - </autotools> - <autotools id="libgnome"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libxml2"/> - <dep package="libxslt"/> - <dep package="libbonobo"/> - <dep package="gnome-vfs"/> - <dep package="gconf"/> - <dep package="esound"/> - </dependencies> - </autotools> - <autotools id="libgnomecanvas"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - <dep package="libglade"/> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="libbonoboui"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnome"/> - <dep package="libbonobo"/> - <dep package="libgnomecanvas"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libgnomeui"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="gnome-icon-theme"/> - <dep package="gnome-keyring"/> - </dependencies> - </autotools> - <autotools id="libglade"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="pygtk" supports-non-srcdir-builds="no"> - <branch revision="pygtk-2-6"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="pyorbit"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - </dependencies> - </autotools> - <autotools id="gnome-python"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="pyorbit"/> - <dep package="libgnomecanvas"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-python-extras"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gnome-panel"/> - <dep package="gtkhtml2"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="gtksourceview"/> - <dep package="libwnck"/> - </dependencies> - </autotools> - <autotools id="bug-buddy"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-menus"/> - </dependencies> - </autotools> - <autotools id="libwnck"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gtk+"/> - <dep package="startup-notification"/> - </dependencies> - </autotools> - <autotools id="gnome-desktop" autogenargs="--with-gnome-distributor=JHBuild"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="startup-notification"/> - <dep package="gnome-themes"/> - <dep package="scrollkeeper"/> - </dependencies> - </autotools> - <autotools id="gnome-menus"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="gnome-panel"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-desktop"/> - <dep package="libwnck"/> - <dep package="evolution-data-server"/> - <dep package="gnome-menus"/> - </dependencies> - </autotools> - <autotools id="gnome-session"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="esound"/> - </dependencies> - </autotools> - <autotools id="gnome-applets"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gnome-panel"/> - <dep package="libgtop"/> - <dep package="gail"/> - <dep package="libxklavier"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - <dep package="gucharmap"/> - <dep package="system-tools-backends"/> - </dependencies> - </autotools> - <autotools id="gnome-games"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="librsvg"/> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gob"/> - </dependencies> - </autotools> - <autotools id="libcroco" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="pango"/> - </dependencies> - </autotools> - <autotools id="librsvg" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libxml2"/> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - <dep package="gnome-common"/> - <dep package="libgsf"/> - <dep package="libcroco"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="eel"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - <dep package="gail"/> - <dep package="gnome-menus"/> - </dependencies> - </autotools> - <autotools id="nautilus"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="esound"/> - <dep package="eel"/> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - <dep package="gnome-desktop"/> - </dependencies> - </autotools> - <autotools id="nautilus-cd-burner"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="nautilus-media" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="nautilus"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - </dependencies> - </autotools> - <autotools id="nautilus-vcs"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="metacity"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="intltool"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libgtop"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-system-monitor"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="libgtop"/> - </dependencies> - </autotools> - <autotools id="gnome-control-center" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="esound"/> - <dep package="gnome-desktop"/> - <dep package="metacity"/> - <dep package="nautilus"/> - <dep package="libxklavier"/> - <dep package="gnome-menus"/> - </dependencies> - </autotools> - <autotools id="yelp"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gtkhtml2"/> - <dep package="gnome-vfs"/> - <dep package="gnome-doc-utils"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="devhelp"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="gnome-utils"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="gconf-editor" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <tarball id="audiofile" version="0.2.6" supports-non-srcdir-builds="no"> - <source href="http://www.68k.org/~michael/audiofile/audiofile-0.2.6.tar.gz" - size="374688" md5sum="9c1049876cd51c0f1b12c2886cce4d42"/> - </tarball> - <autotools id="esound"> - <branch/> - <dependencies> - <dep package="audiofile"/> - </dependencies> - </autotools> - <autotools id="gnome-media"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="esound"/> - <dep package="gail"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - <dep package="nautilus-cd-burner"/> - </dependencies> - </autotools> - <autotools id="gdm2"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="librsvg"/> - </dependencies> - </autotools> - <autotools id="vte"> - <branch/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="gnome-terminal"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="vte"/> - <dep package="startup-notification"/> - </dependencies> - </autotools> - <autotools id="gtk-engines"> - <branch revision="gtk-engines-2-6"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libgnomeprint"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="intltool"/> - <dep package="libart_lgpl"/> - <dep package="glib"/> - <dep package="gnome-common"/> - <dep package="pango"/> - <dep package="libgnomecups"/> - </dependencies> - </autotools> - <autotools id="libgnomeprintui"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeprint"/> - <dep package="gtk+"/> - <dep package="libgnomecanvas"/> - <dep package="gnome-icon-theme"/> - </dependencies> - </autotools> - <autotools id="gedit"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="eel"/> - <dep package="libgnomeprintui"/> - <dep package="gtksourceview"/> - </dependencies> - </autotools> - <autotools id="gedit-plugins"> - <branch/> - <dependencies> - <dep package="gedit"/> - <dep package="libgnomeui"/> - <dep package="eel"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="memprof"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="eog"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="eel"/> - <dep package="libgnomeui"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="gal"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="libgsf"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gnome-vfs"/> - <dep package="libbonobo"/> - </dependencies> - </autotools> - <autotools id="goffice"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libgsf"/> - <dep package="libxml2"/> - <dep package="pango"/> - <dep package="libglade"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="libart_lgpl"/> - </dependencies> - </autotools> - <autotools id="gnumeric"> - <branch/> - <dependencies> - <dep package="goffice"/> - <dep package="libgsf"/> - <dep package="libgda"/> - <dep package="pygtk"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gimp" autogenargs="--disable-print"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - </dependencies> - </autotools> - <autotools id="glade"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="glade2c"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="sawfish"> - <branch revision="gnome-2"/> - <dependencies> - <dep package="rep-gtk"/> - </dependencies> - </autotools> - <autotools id="rep-gtk"> - <branch/> - <dependencies> - <dep package="librep"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="librep"> - <branch/> - </autotools> - <autotools id="rhythmbox"> - <branch repo="rhythmbox" module="rhythmbox--main--0.9" checkoutdir="rhythmbox"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gst-plugins"/> - </dependencies> - </autotools> - <autotools id="gstreamer" autogenargs="-- --disable-plugin-builddir --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" revision="BRANCH-GSTREAMER-0_8"/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gst-plugins" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" revision="BRANCH-GSTREAMER-0_8"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gnome-vfs"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="planner"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - <dep package="libgsf"/> - </dependencies> - </autotools> - <autotools id="file-roller"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="balsa"> - <branch revision="BALSA_2"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="pan"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnet"/> - </dependencies> - </autotools> - <autotools id="gcalctool" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="ggv" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="ekiga"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gucharmap" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gtksourceview"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeprint"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="glimmer"> - <branch/> - <dependencies> - <dep package="gtksourceview"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="gdl"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="librsvg"/> - </dependencies> - </autotools> - <autotools id="gnome-build"> - <branch/> - <dependencies> - <dep package="gdl"/> - <dep package="gnome-vfs"/> - <dep package="gtkhtml2"/> - </dependencies> - </autotools> - <autotools id="gdl"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="scaffold"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="vte"/> - <dep package="gdl"/> - </dependencies> - </autotools> - <autotools id="libsigc++2"> - <branch/> - </autotools> - <autotools id="glibmm"> - <branch revision="glibmm-2-6"/> - <dependencies> - <dep package="glib"/> - <dep package="libsigc++2"/> - </dependencies> - </autotools> - <autotools id="gtkmm"> - <branch revision="gtkmm-2-6"/> - <dependencies> - <dep package="glibmm"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="orbitcpp"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomemm"> - <branch/> - <dependencies> - <dep package="libgnome"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libglademm"> - <branch/> - <dependencies> - <dep package="libglade"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libbonobomm"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gtkmm"/> - <dep package="orbitcpp"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libbonobouimm"> - <branch/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="gnomemm/libbonobomm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomecanvasmm"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomecanvas"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gconfmm"> - <branch/> - <dependencies> - <dep package="gconf"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeuimm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgnomeui"/> - <dep package="gnomemm/libgnomemm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/libgnomecanvasmm"/> - <dep package="gnomemm/libglademm"/> - <dep package="gnomemm/gnome-vfsmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gnome-vfsmm"> - <branch/> - <dependencies> - <dep package="glibmm"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libpanelappletmm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeprintmm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeprintuimm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="gnomemm/libgnomeprintmm"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgdamm"> - <branch revision="libgda-1-2"/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgda"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gtkmm_hello"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="regexxer"> - <branch/> - <dependencies> - <dep package="intltool"/> - <dep package="gtkmm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/libglademm"/> - </dependencies> - </autotools> - <autotools id="gnet" autogenargs="--enable-glib2"> - <branch revision="GNET_1_1"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnomeicu"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="at-spi"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gail"/> - </dependencies> - </autotools> - <autotools id="libgail-gnome"> - <branch/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="at-poke"> - <branch/> - <dependencies> - <dep package="libgail-gnome"/> - </dependencies> - </autotools> - <autotools id="gnome-mag"> - <branch/> - <dependencies> - <dep package="at-spi"/> - </dependencies> - </autotools> - <autotools id="gok"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="esound"/> - <dep package="scrollkeeper"/> - </dependencies> - </autotools> - <autotools id="gnome-speech"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - </dependencies> - </autotools> - <autotools id="gnopernicus"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gconf"/> - <dep package="libgnomeui"/> - <dep package="gnome-speech"/> - <dep package="gnome-mag"/> - </dependencies> - </autotools> - <autotools id="dasher" autogenargs="--with-a11y --with-gnome"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="gnome-speech"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <metamodule id="meta-gnome-devel-platform"> - <dependencies> - <dep package="libgnome"/> - <dep package="libbonobo"/> - <dep package="libbonoboui"/> - <dep package="libgnomeui"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-core"> - <dependencies> - <dep package="gnome-desktop"/> - <dep package="gnome-panel"/> - <dep package="gnome-session"/> - <dep package="gnome-terminal"/> - <dep package="gnome-applets"/> - </dependencies> - </metamodule> - <metamodule id="meta-nautilus"> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-desktop"> - <dependencies> - <dep package="meta-gnome-core"/> - <dep package="gnome-control-center"/> - <dep package="meta-nautilus"/> - <dep package="yelp"/> - <dep package="bug-buddy"/> - <dep package="gedit"/> - <dep package="gtk-engines"/> - <dep package="eog"/> - <dep package="ggv"/> - <dep package="metacity"/> - <dep package="gconf-editor"/> - <dep package="gnome-utils"/> - <dep package="gnome-system-monitor"/> - <dep package="gstreamer"/> - <dep package="gnome-media"/> - <dep package="gnome-netstatus"/> - <dep package="gcalctool"/> - <dep package="gpdf"/> - <dep package="gucharmap"/> - <dep package="nautilus-cd-burner"/> - <dep package="zenity"/> - <dep package="libgail-gnome"/> - <dep package="gnopernicus"/> - <dep package="gok"/> - <dep package="epiphany"/> - <dep package="gnome-games"/> - <dep package="gnome-user-docs"/> - <dep package="file-roller"/> - <dep package="gnome-system-tools"/> - <dep package="gnome-nettool"/> - <dep package="vino"/> - <dep package="gnome-volume-manager"/> - <dep package="totem"/> - <dep package="gnome-menus"/> - <dep package="gnome-backgrounds"/> - <dep package="sound-juicer"/> - <dep package="totem"/> - <dep package="evolution"/> - <dep package="evolution-webcal"/> - <dep package="ekiga"/> - - </dependencies> - </metamodule> - <metamodule id="meta-gnome-devel-tools"> - <dependencies> - <dep package="glade"/> - <dep package="memprof"/> - <dep package="gconf-editor"/> - <dep package="devhelp"/> - <dep package="nautilus-vcs"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-python"> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-c++"> - <dependencies> - <dep package="gtkmm"/> - <dep package="gnomemm/libgnomeuimm"/> - <dep package="gnomemm/gnome-vfsmm"/> - <dep package="gnomemm/libpanelappletmm"/> - <dep package="gnomemm/libbonobouimm"/> - <dep package="gnomemm/libgnomeprintuimm"/> - <dep package="libxml++"/> - <dep package="gnomemm/libgdamm"/> - <dep package="bakery"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-accessibility"> - <dependencies> - <dep package="libgail-gnome"/> - <dep package="at-poke"/> - <dep package="dasher"/> - <dep package="gnome-mag"/> - <dep package="gok"/> - <dep package="gnome-speech"/> - <dep package="gnopernicus"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-proposed"> - <dependencies> - </dependencies> - </metamodule> - <autotools id="sodipodi"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnomeprintui"/> - <dep package="libart_lgpl"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gnome-themes"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gtk-engines"/> - </dependencies> - </autotools> - <autotools id="clearlooks"> - <branch repo="clearlooks.sf.net"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnome"/> - </dependencies> - </autotools> - <autotools id="gob"> - <branch/> - </autotools> - <autotools id="libgnetwork"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gconf"/> - <dep package="intltool"/> - </dependencies> - </autotools> - <autotools id="libgircclient"> - <branch/> - <dependencies> - <dep package="libgnetwork"/> - </dependencies> - </autotools> - <autotools id="gnomechat"> - <branch/> - <dependencies> - <dep package="libgnetwork"/> - <dep package="libgircclient"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <mozillamodule id="mozilla" autogenargs="--enable-default-toolkit=gtk2 --disable-mailnews --disable-ldap --disable-debug --enable-optimize --disable-tests --enable-crypto --enable-xft --with-system-zlib --disable-freetype2" cvsroot="mozilla.org" revision="MOZILLA_1_7_BRANCH"> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </mozillamodule> - <autotools id="epiphany"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="mozilla"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="epiphany-extensions"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="epiphany"/> - </dependencies> - </autotools> - <autotools id="pyphany"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="epiphany-extensions"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="galeon"> - <branch/> - <dependencies> - <dep package="mozilla"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="libsoup"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="glib"/> - <dep package="gnutls"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gtkhtml"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="gail"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="libsoup"/> - <dep package="gal"/> - </dependencies> - </autotools> - <autotools id="evolution-data-server" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libbonobo"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - <dep package="libsoup"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="gnome-vfs"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="evolution"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="gtkhtml"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - </dependencies> - </autotools> - <autotools id="evolution-webcal"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="libsoup"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <tarball id="xchat" version="2.4.1"> - <source href="http://xchat.org/files/source/2.4/xchat-2.4.1.tar.bz2" - size="1214388" md5sum="aeb2337cc36dd4a9ac0cd6e909f67227"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - </dependencies> - </tarball> - <tarball id="camorama" version="0.17"> - <source href="http://camorama.fixedgear.org/downloads/camorama-0.17.tar.bz2" - size="312233" md5sum="2b2784af53a1ba8fa4419aa806967b35"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </tarball> - <autotools id="gtk-engines-cleanice"> - <branch repo="elysium-project.sf.net"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="gaim"> - <branch repo="gaim.sf.net"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="zenity"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="libgnomecanvas"/> - </dependencies> - </autotools> - <autotools id="gpdf"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gnome-netstatus"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="gnome-doc-utils"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libxslt"/> - </dependencies> - </autotools> - <autotools id="totem" autogenargs="--enable-gstreamer"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="gnome-desktop"/> - <dep package="nautilus-cd-burner"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - </dependencies> - </autotools> - <autotools id="gnome-themes-extras"> - <branch/> - <dependencies> - <dep package="gnome-themes"/> - </dependencies> - </autotools> - <autotools id="libgda"> - <branch module="libgda" revision="release-1-2-branch"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="libgnomedb" autogenargs="--enable-gnome=yes"> - <branch/> - <dependencies> - <dep package="libgda"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - </dependencies> - </autotools> - <autotools id="mergeant"> - <branch/> - <dependencies> - <dep package="libgnomedb"/> - </dependencies> - </autotools> - <autotools id="gtranslator"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-spell"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="libgnomecups"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-cups-manager"> - <branch/> - <dependencies> - <dep package="libgnomecups"/> - <dep package="libgnomeui"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libxml++"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="glibmm"/> - </dependencies> - </autotools> - <autotools id="bakery"> - <branch/> - <dependencies> - <dep package="libxml++"/> - <dep package="gtkmm"/> - <dep package="gnomemm/libglademm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/gnome-vfsmm"/> - </dependencies> - </autotools> - <autotools id="gnome-hello"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-system-tools"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="system-tools-backends"/> - </dependencies> - </autotools> - <autotools id="gnome-user-docs"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - </dependencies> - </autotools> - <autotools id="loudmouth"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gossip"> - <branch revision="gossip-0-8"/> - <dependencies> - <dep package="loudmouth"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="conglomerate"> - <branch/> - <dependencies> - <dep package="libxslt"/> - <dep package="gconf"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="sound-juicer"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-media"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - <dep package="nautilus-cd-burner"/> - </dependencies> - </autotools> - <autotools id="gnome-network"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <tarball id="guile" version="1.6.7"> - <source href="ftp://ftp.gnu.org/gnu/guile/guile-1.6.7.tar.gz" - size="3039294" md5sum="c2ff2a2231f0cbb2e838dd8701a587c5"/> - </tarball> - <tarball id="autogen" version="5.6.5"> - <source href="http://internap.dl.sourceforge.net/sourceforge/autogen/autogen-5.6.5.tar.gz" - size="1144260" md5sum="54a6cb0be7e6b526af9aba4a73013885"/> - <dependencies> - <dep package="guile"/> - </dependencies> - </tarball> - <autotools id="anjuta"> - <branch/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - <dep package="vte"/> - <dep package="gnome-build"/> - <dep package="autogen"/> - </dependencies> - </autotools> - <autotools id="OpenApplet"> - <branch/> - <dependencies> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="gtetrinet"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="glom"> - <branch/> - <dependencies> - <dep package="gnomemm/libgdamm"/> - <dep package="bakery"/> - <dep package="libgnome"/> - </dependencies> - </autotools> - <autotools id="vino"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libglade"/> - <dep package="gconf"/> - <dep package="gnutls"/> - </dependencies> - </autotools> - <autotools id="gnome-keyring-manager"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-keyring"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <autotools id="gnome-volume-manager"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libglade"/> - <dep package="hal-0.4"/> - </dependencies> - </autotools> - <metamodule id="meta-storage"> - <dependencies> - <dep package="storage/storage-store"/> - <dep package="storage/vfs"/> - <dep package="storage/applet"/> - </dependencies> - </metamodule> - <autotools id="storage/storage-store"> - <branch/> - <dependencies> - <dep package="dbus-0.23"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage"> - <branch/> - <dependencies> - <dep package="gnome-vfs"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage-translators"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - </dependencies> - </autotools> - <autotools id="storage/vfs"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - <dep package="storage/libstorage-translators"/> - </dependencies> - </autotools> - <autotools id="storage/pet"> - <branch/> - </autotools> - <autotools id="storage/libmrs"> - <branch/> - <dependencies> - <dep package="storage/pet"/> - </dependencies> - </autotools> - <autotools id="storage/libmrs-converter"> - <branch/> - <dependencies> - <dep package="storage/libmrs"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage-nl"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - <dep package="storage/libmrs"/> - <dep package="storage/libmrs-converter"/> - </dependencies> - </autotools> - <autotools id="storage/applet"> - <branch/> - <dependencies> - <dep package="gnome-python"/> - <dep package="storage/libstorage-nl"/> - </dependencies> - </autotools> - <autotools id="gnome-nettool"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="monkey-bubble"> - <branch/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-schedule"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="yelp"/> - </dependencies> - </autotools> - <autotools id="gnome-backgrounds"> - <branch/> - </autotools> - <autotools id="evince"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - <dep package="poppler"/> - </dependencies> - </autotools> - <autotools id="nautilus-python" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="nautilus"/> - <dep package="pygtk"/> - <dep package="gnome-python"/> - </dependencies> - </autotools> - <autotools id="gst-python" autogenargs="--" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" revision="BRANCH-GSTREAMER-0_8"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - </dependencies> - </autotools> -</moduleset> diff --git a/scripts/jhbuild/modulesets/gnome-2.12.modules b/scripts/jhbuild/modulesets/gnome-2.12.modules deleted file mode 100644 index ffbd89756f..0000000000 --- a/scripts/jhbuild/modulesets/gnome-2.12.modules +++ /dev/null @@ -1,1747 +0,0 @@ -<?xml version="1.0"?><!--*- mode: nxml -*--> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - <repository type="cvs" name="gnome.org" default="yes" - cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome" - password=""/> - <repository type="cvs" name="cairo.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/cairo" - password=""/> - <repository type="cvs" name="mozilla.org" - cvsroot=":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" - password="anonymous"/> - <repository type="cvs" name="gstreamer.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer" - password=""/> - <repository type="cvs" name="menu.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/menus" - password=""/> - <repository type="cvs" name="mime.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/mime" - password=""/> - <repository type="cvs" name="xklavier.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/xklavier" - password=""/> - - <repository type="cvs" name="elysium-project.sf.net" - cvsroot=":pserver:anonymous@elysium-project.cvs.sourceforge.net:/cvsroot/elysium-project" - password=""/> - <repository type="cvs" name="gaim.sf.net" - cvsroot=":pserver:anonymous@gaim.cvs.sourceforge.net:/cvsroot/gaim" - password=""/> - <repository type="cvs" name="inkscape.sf.net" - cvsroot=":pserver:anonymous@inkscape.cvs.sourceforge.net:/cvsroot/inkscape" - password=""/> - <repository type="svn" name="svn.galago-project.org" - href="http://svn.galago-project.org/"/> - <repository type="svn" name="svn.debian.org" - href="svn://svn.debian.org/"/> - - <tarball id="scrollkeeper" version="0.3.14" supports-non-srcdir-builds="no"> - <source href="http://unc.dl.sourceforge.net/sourceforge/scrollkeeper/scrollkeeper-0.3.14.tar.gz" - size="679513" md5sum="161eb3f29e30e7b24f84eb93ac696155"/> - <dependencies> - <dep package="libxml2"/> - <dep package="libxslt"/> - <dep package="intltool"/> - </dependencies> - <patches> - <patch file="scrollkeeper_clean_xml_validation_context.patch" strip="1"/> - <patch file="scrollkeeper_language_fix.patch" strip="1"/> - <patch file="scrollkeeper_rw_offset_fix.patch" strip="1"/> - </patches> - </tarball> - - <autotools id="iso-codes"> - <branch repo="svn.debian.org" module="pkg-isocodes/trunk/iso-codes" checkoutdir="iso-codes"/> - </autotools> - - <include href="freedesktop.modules"/> - <include href="gnutls.modules"/> - - <autotools id="cairo-gtk-engine"> - <branch repo="cairo.freedesktop.org"/> - <dependencies> - <dep package="gtk+"/> - <dep package="cairo-1-0"/> - </dependencies> - </autotools> - - <autotools id="shared-mime-info" supports-non-srcdir-builds="no"> - <branch repo="mime.freedesktop.org"/> - <dependencies> - <dep package="intltool"/> - </dependencies> - </autotools> - - <autotools id="desktop-file-utils"> - <branch repo="menu.freedesktop.org"/> - <dependencies> - <dep package="glib"/> - <dep package="intltool"/> - </dependencies> - </autotools> - - <autotools id="libxklavier" supports-non-srcdir-builds="no"> - <branch repo="xklavier.freedesktop.org"/> - </autotools> - <autotools id="libbtctl"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-bluetooth"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="glib"/> - <dep package="libbtctl"/> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <autotools id="phonemgr"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="glib"/> - <dep package="libbtctl"/> - <dep package="gnome-bluetooth"/> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="libgnome"/> - <dep package="gconf"/> - </dependencies> - </autotools> - - <autotools id="intltool"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gnome-common"> - <branch revision="gnome-2-12"/> - </autotools> - <autotools id="libxml2"> - <branch module="gnome-xml" checkoutdir="libxml2"/> - </autotools> - <autotools id="libxslt"> - <branch/> - <dependencies> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gtk-doc"> - <branch/> - <dependencies> - <dep package="libxslt"/> - <dep package="scrollkeeper"/> - </dependencies> - </autotools> - <autotools id="glib"> - <branch revision="glib-2-8"/> - <dependencies> - <dep package="gtk-doc"/> - </dependencies> - </autotools> - <autotools id="pango"> - <branch revision="pango-1-10"/> - <dependencies> - <dep package="glib"/> - <dep package="cairo-1-0"/> - <dep package="libXft"/> - </dependencies> - </autotools> - <autotools id="atk"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gtk+"> - <branch revision="gtk-2-8"/> - <dependencies> - <dep package="cairo-1-0"/> - <dep package="pango"/> - <dep package="atk"/> - <dep package="shared-mime-info"/> - </dependencies> - </autotools> - <autotools id="gail"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="atk"/> - <dep package="libgnomecanvas"/> - </dependencies> - </autotools> - <autotools id="gtkhtml2"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="gail"/> - </dependencies> - </autotools> - <autotools id="libIDL"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="ORBit2"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libIDL"/> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gconf"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="ORBit2"/> - <dep package="libxml2"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libbonobo"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="ORBit2"/> - <dep package="intltool"/> - <dep package="gnome-common"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gnome-mime-data"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gnome-icon-theme"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="hicolor-icon-theme"/> - </dependencies> - </autotools> - <tarball id="howl" version="1.0.0"> - <source href="http://www.porchdogsoft.com/download/howl-1.0.0.tar.gz" - size="542782" md5sum="c389d3ffba0e69a179de2ec650f1fdcc"/> - <patches> - <patch file="howl-1.0.0-buildfix.patch" strip="1"/> - </patches> - </tarball> - <autotools id="gnome-vfs"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gconf"/> - <dep package="desktop-file-utils"/> - <dep package="shared-mime-info"/> - <dep package="gnome-mime-data"/> - <dep package="howl"/> - <dep package="hal"/> - </dependencies> - </autotools> - <autotools id="gnome-keyring"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libart_lgpl"> - <branch/> - </autotools> - <autotools id="libgnome"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libxml2"/> - <dep package="libxslt"/> - <dep package="libbonobo"/> - <dep package="gnome-vfs"/> - <dep package="gconf"/> - <dep package="esound"/> - </dependencies> - </autotools> - <autotools id="libgnomecanvas"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - <dep package="libglade"/> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="libbonoboui"> - <branch revision="gnome-2-10"/> - <dependencies> - <dep package="libgnome"/> - <dep package="libbonobo"/> - <dep package="libgnomecanvas"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libgnomeui"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="gnome-icon-theme"/> - <dep package="gnome-keyring"/> - </dependencies> - </autotools> - <autotools id="libglade"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="pygtk"> - <branch revision="pygtk-2-8"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libglade"/> - </dependencies> - <after> - <dep package="pycairo-1-0"/> - </after> - </autotools> - <autotools id="pyorbit"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - </dependencies> - </autotools> - <autotools id="gnome-python"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="pyorbit"/> - <dep package="libgnomecanvas"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-python-extras"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gnome-panel"/> - <dep package="gtkhtml2"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="gtksourceview"/> - <dep package="libwnck"/> - <!-- Needs libgda 1.2, not HEAD <dep package="libgda" /> --> - <dep package="nautilus-cd-burner"/> - <dep package="libgtop"/> - <dep package="totem"/> - <dep package="gdl"/> - <dep package="gnome-media"/> - </dependencies> - </autotools> - <autotools id="bug-buddy"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-menus"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="libwnck"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gtk+"/> - <dep package="startup-notification"/> - </dependencies> - </autotools> - <autotools id="gnome-desktop" autogenargs="--with-gnome-distributor=JHBuild"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="startup-notification"/> - <dep package="gnome-themes"/> - <dep package="scrollkeeper"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-menus"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="intltool"/> - <dep package="gnome-common"/> - <dep package="glib"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="gnome-panel"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-desktop"/> - <dep package="libwnck"/> - <dep package="evolution-data-server"/> - <dep package="gnome-menus"/> - <dep package="gnome-vfs"/> - <dep package="libglade"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-session"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="esound"/> - </dependencies> - </autotools> - <autotools id="gnome-applets"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gnome-panel"/> - <dep package="libgtop"/> - <dep package="gail"/> - <dep package="libxklavier"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - <dep package="gucharmap"/> - <dep package="system-tools-backends"/> - </dependencies> - </autotools> - <autotools id="gnome-games"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="librsvg"/> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gob"/> - </dependencies> - </autotools> - <autotools id="libcroco" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="pango"/> - </dependencies> - </autotools> - <autotools id="librsvg" autogenargs="--enable-more-warnings=no" - supports-non-srcdir-builds="no"> - <branch revision="gnome-2-12-branch"/> - <dependencies> - <dep package="libxml2"/> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - <dep package="gnome-common"/> - <dep package="libgsf"/> - <dep package="libcroco"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="eel"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - <dep package="gail"/> - <dep package="gnome-desktop"/> - <dep package="gnome-menus"/> - </dependencies> - </autotools> - <autotools id="nautilus"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="esound"/> - <dep package="eel"/> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - <dep package="gnome-desktop"/> - </dependencies> - </autotools> - <autotools id="nautilus-cd-burner"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="nautilus-open-terminal"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="nautilus-media" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="nautilus"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - </dependencies> - </autotools> - <autotools id="nautilus-vcs"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="metacity"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="intltool"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libgtop"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-system-monitor"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="libgtop"/> - </dependencies> - </autotools> - <autotools id="gnome-control-center" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="esound"/> - <dep package="gnome-desktop"/> - <dep package="metacity"/> - <dep package="nautilus"/> - <dep package="libxklavier"/> - <dep package="gnome-menus"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="yelp"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="gnome-doc-utils"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="devhelp"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="gnome-utils"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="gconf-editor" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <tarball id="audiofile" version="0.2.6" supports-non-srcdir-builds="no"> - <source href="http://www.68k.org/~michael/audiofile/audiofile-0.2.6.tar.gz" - size="374688" md5sum="9c1049876cd51c0f1b12c2886cce4d42"/> - </tarball> - <autotools id="esound"> - <branch/> - <dependencies> - <dep package="audiofile"/> - </dependencies> - </autotools> - <autotools id="gnome-media"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="esound"/> - <dep package="gail"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - <dep package="nautilus-cd-burner"/> - </dependencies> - </autotools> - <autotools id="gdm2"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="librsvg"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="vte"> - <branch/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="gnome-terminal"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="vte"/> - <dep package="startup-notification"/> - </dependencies> - </autotools> - <autotools id="gtk-engines"> - <branch revision="gtk-engines-2-6"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libgnomeprint"> - <branch/> - <dependencies> - <dep package="intltool"/> - <dep package="libart_lgpl"/> - <dep package="glib"/> - <dep package="gnome-common"/> - <dep package="pango"/> - <dep package="libgnomecups"/> - </dependencies> - </autotools> - <autotools id="libgnomeprintui"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeprint"/> - <dep package="gtk+"/> - <dep package="libgnomecanvas"/> - <dep package="gnome-icon-theme"/> - </dependencies> - </autotools> - <autotools id="gedit"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="eel"/> - <dep package="libgnomeprintui"/> - <dep package="gtksourceview"/> - </dependencies> - </autotools> - <autotools id="gedit-plugins"> - <branch/> - <dependencies> - <dep package="gedit"/> - <dep package="libgnomeui"/> - <dep package="eel"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="memprof"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="eog"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="libgsf"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gnome-vfs"/> - <dep package="libbonobo"/> - </dependencies> - </autotools> - <autotools id="goffice"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libgsf"/> - <dep package="libxml2"/> - <dep package="pango"/> - <dep package="libglade"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="libart_lgpl"/> - </dependencies> - </autotools> - <autotools id="gnumeric"> - <branch/> - <dependencies> - <dep package="goffice"/> - <dep package="libgsf"/> - <!-- Needs libgda 1.2, not HEAD <dep package="libgda" /> --> - <dep package="pygtk"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gimp" autogenargs="--disable-print"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - </dependencies> - </autotools> - <autotools id="glade"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="glade2c"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="sawfish"> - <branch revision="gnome-2"/> - <dependencies> - <dep package="rep-gtk"/> - </dependencies> - </autotools> - <autotools id="rep-gtk"> - <branch/> - <dependencies> - <dep package="librep"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="librep"> - <branch/> - </autotools> - <autotools id="rhythmbox"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gst-plugins"/> - <dep package="nautilus-cd-burner"/> - <dep package="totem"/> - </dependencies> - </autotools> - <autotools id="gstreamer" autogenargs="-- --disable-plugin-builddir --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" revision="BRANCH-GSTREAMER-0_8"/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gst-plugins" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" revision="BRANCH-GSTREAMER-0_8"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gnome-vfs"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="planner"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - <dep package="libgsf"/> - </dependencies> - </autotools> - <autotools id="file-roller"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="gnome-doc-utils"/> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="balsa"> - <branch revision="BALSA_2"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="pan"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnet"/> - </dependencies> - </autotools> - <autotools id="gcalctool" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="ggv" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="ekiga"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gucharmap" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gtksourceview" autogenargs="--enable-compile-warnings=maximum"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeprint"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="glimmer"> - <branch/> - <dependencies> - <dep package="gtksourceview"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="gdl"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="librsvg"/> - </dependencies> - </autotools> - <autotools id="gnome-build"> - <branch/> - <dependencies> - <dep package="gdl"/> - <dep package="gnome-vfs"/> - <dep package="gtkhtml2"/> - </dependencies> - </autotools> - <autotools id="scaffold"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="vte"/> - <dep package="gdl"/> - </dependencies> - </autotools> - <autotools id="libsigc++2"> - <branch revision="libsigc-2-0"/> - </autotools> - <autotools id="glibmm"> - <branch revision="glibmm-2-8"/> - <dependencies> - <dep package="glib"/> - <dep package="libsigc++2"/> - </dependencies> - </autotools> - <autotools id="gtkmm"> - <branch revision="gtkmm-2-8"/> - <dependencies> - <dep package="glibmm"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="orbitcpp"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomemm"> - <branch/> - <dependencies> - <dep package="libgnome"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libglademm"> - <branch/> - <dependencies> - <dep package="libglade"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libbonobomm"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gtkmm"/> - <dep package="orbitcpp"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libbonobouimm"> - <branch/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="gnomemm/libbonobomm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomecanvasmm"> - <branch/> - <dependencies> - <dep package="libgnomecanvas"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gconfmm"> - <branch/> - <dependencies> - <dep package="gconf"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeuimm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgnomeui"/> - <dep package="gnomemm/libgnomemm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/libgnomecanvasmm"/> - <dep package="gnomemm/libglademm"/> - <dep package="gnomemm/gnome-vfsmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gnome-vfsmm"> - <branch/> - <dependencies> - <dep package="glibmm"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libpanelappletmm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeprintmm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeprintuimm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="gnomemm/libgnomeprintmm"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgdamm"> - <branch revision="libgda-1-2"/> - <dependencies> - <dep package="gtkmm"/> - <!-- needs libgda 1.2, not HEAD <dep package="libgda" /> --> - </dependencies> - </autotools> - <autotools id="gnomemm/gtkmm_hello"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="regexxer"> - <branch/> - <dependencies> - <dep package="intltool"/> - <dep package="gtkmm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/libglademm"/> - </dependencies> - </autotools> - <autotools id="gnet" autogenargs="--enable-glib2"> - <branch revision="GNET_1_1"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnomeicu"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="at-spi"> - <branch revision="AT_SPI_1_6_6"/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gail"/> - </dependencies> - </autotools> - <autotools id="libgail-gnome"> - <branch/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="at-poke"> - <branch/> - <dependencies> - <dep package="libgail-gnome"/> - </dependencies> - </autotools> - <autotools id="gnome-mag"> - <branch/> - <dependencies> - <dep package="at-spi"/> - </dependencies> - </autotools> - <autotools id="gok"> - <branch/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="esound"/> - <dep package="scrollkeeper"/> - </dependencies> - </autotools> - <autotools id="gnome-speech"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - </dependencies> - </autotools> - <autotools id="gnopernicus"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gconf"/> - <dep package="libgnomeui"/> - <dep package="gnome-speech"/> - <dep package="gnome-mag"/> - </dependencies> - </autotools> - <autotools id="dasher" autogenargs="--with-a11y --with-gnome"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="gnome-speech"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="gnome-screensaver"> - <branch/> - <dependencies> - <dep package="gconf"/> - <dep package="gtk+"/> - <dep package="dbus"/> - </dependencies> - </autotools> - <autotools id="gnome-power-manager"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="hal"/> - <dep package="libwnck"/> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="intltool"/> - <dep package="libglade"/> - <dep package="libnotify"/> - </dependencies> - </autotools> - <autotools id="gthumb"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="libglade"/> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="fast-user-switch-applet"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="libglade"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="libnotify"> - <branch repo="svn.galago-project.org" module="trunk/libnotify"/> - <dependencies> - <dep package="gtk+"/> - <dep package="dbus"/> - </dependencies> - </autotools> - - <metamodule id="meta-gnome-devel-platform"> - <dependencies> - <dep package="libgnome"/> - <dep package="libbonobo"/> - <dep package="libbonoboui"/> - <dep package="libgnomeui"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-core"> - <dependencies> - <dep package="gnome-desktop"/> - <dep package="gnome-panel"/> - <dep package="gnome-session"/> - <dep package="gnome-terminal"/> - <dep package="gnome-applets"/> - </dependencies> - </metamodule> - <metamodule id="meta-nautilus"> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-desktop"> - <dependencies> - <dep package="meta-gnome-core"/> - <dep package="gnome-control-center"/> - <dep package="meta-nautilus"/> - <dep package="yelp"/> - <dep package="bug-buddy"/> - <dep package="gedit"/> - <dep package="gtk-engines"/> - <dep package="eog"/> - <dep package="metacity"/> - <dep package="gconf-editor"/> - <dep package="gnome-utils"/> - <dep package="gnome-system-monitor"/> - <dep package="gstreamer"/> - <dep package="gnome-media"/> - <dep package="gnome-netstatus"/> - <dep package="gcalctool"/> - <dep package="gucharmap"/> - <dep package="nautilus-cd-burner"/> - <dep package="zenity"/> - <dep package="libgail-gnome"/> - <dep package="gnopernicus"/> - <dep package="gok"/> - <dep package="epiphany"/> - <dep package="gnome-games"/> - <dep package="gnome-user-docs"/> - <dep package="file-roller"/> - <dep package="gnome-system-tools"/> - <dep package="gnome-nettool"/> - <dep package="vino"/> - <dep package="gnome-volume-manager"/> - <dep package="totem"/> - <dep package="gnome-menus"/> - <dep package="gnome-backgrounds"/> - <dep package="sound-juicer"/> - <dep package="evolution"/> - <dep package="evolution-webcal"/> - <dep package="evolution-exchange"/> - <dep package="ekiga"/> - <dep package="evince"/> - <dep package="dasher"/> - <dep package="gnome-keyring-manager"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-devel-tools"> - <dependencies> - <dep package="glade"/> - <dep package="memprof"/> - <dep package="gconf-editor"/> - <dep package="devhelp"/> - <dep package="nautilus-vcs"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-python"> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - </dependencies> - <after> - <dep package="gnome-python-extras"/> - </after> - </metamodule> - <metamodule id="meta-gnome-c++"> - <dependencies> - <dep package="gtkmm"/> - <dep package="gnomemm/libgnomeuimm"/> - <dep package="gnomemm/gnome-vfsmm"/> - <dep package="gnomemm/libpanelappletmm"/> - <dep package="gnomemm/libbonobouimm"/> - <dep package="gnomemm/libgnomeprintuimm"/> - <dep package="libxml++"/> - <dep package="gnomemm/libgdamm"/> - <dep package="bakery"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-accessibility"> - <dependencies> - <dep package="libgail-gnome"/> - <dep package="at-poke"/> - <dep package="dasher"/> - <dep package="gnome-mag"/> - <dep package="gok"/> - <dep package="gnome-speech"/> - <dep package="gnopernicus"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-proposed"> - <dependencies> - </dependencies> - </metamodule> - <autotools id="sodipodi"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnomeprintui"/> - <dep package="libart_lgpl"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gnome-themes"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gtk-engines"/> - </dependencies> - </autotools> - <autotools id="gob"> - <branch/> - </autotools> - <autotools id="libgnetwork"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gconf"/> - <dep package="intltool"/> - </dependencies> - </autotools> - <autotools id="libgircclient"> - <branch/> - <dependencies> - <dep package="libgnetwork"/> - </dependencies> - </autotools> - <autotools id="gnomechat"> - <branch/> - <dependencies> - <dep package="libgnetwork"/> - <dep package="libgircclient"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <mozillamodule id="mozilla" autogenargs="--enable-default-toolkit=gtk2 --disable-mailnews --disable-ldap --disable-debug --enable-optimize --disable-tests --enable-crypto --enable-xft --with-system-zlib --disable-freetype2 --enable-application=browser" cvsroot="mozilla.org" revision="MOZILLA_1_7_BRANCH"> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </mozillamodule> - <autotools id="epiphany"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="iso-codes"/> - <dep package="libgnomeui"/> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gnome-doc-utils"/> - <dep package="libgnomeprintui"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="epiphany-extensions"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="epiphany"/> - </dependencies> - </autotools> - <autotools id="galeon"> - <branch/> - <dependencies> - <dep package="mozilla"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="libsoup"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="glib"/> - <dep package="gnutls"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gtkhtml"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="gail"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="libsoup"/> - </dependencies> - </autotools> - <autotools id="evolution-data-server" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libbonobo"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - <dep package="libsoup"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="gnome-vfs"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="evolution"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="gtkhtml"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - </dependencies> - </autotools> - <autotools id="evolution-webcal"> - <branch/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="libsoup"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="evolution-exchange"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="evolution"/> - <dep package="libsoup"/> - </dependencies> - </autotools> - <tarball id="xchat" version="2.4.5"> - <source href="http://xchat.org/files/source/2.4/xchat-2.4.5.tar.bz2" - size="1324626" md5sum="9107a92693e6c62ff2008030e698b92b"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - </dependencies> - </tarball> - <tarball id="camorama" version="0.17"> - <source href="http://camorama.fixedgear.org/downloads/camorama-0.17.tar.bz2" - size="312233" md5sum="2b2784af53a1ba8fa4419aa806967b35"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </tarball> - <autotools id="gtk-engines-cleanice"> - <branch repo="elysium-project.sf.net"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="gaim"> - <branch repo="gaim.sf.net"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="zenity"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="libgnomecanvas"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gpdf"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gnome-netstatus"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-doc-utils"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libxslt"/> - <dep package="intltool"/> - <dep package="glib"/> - </dependencies> - </autotools> - <tarball id="libmusicbrainz" version="2.1.1"> - <source href="ftp://ftp.musicbrainz.org/pub/musicbrainz/libmusicbrainz-2.1.1.tar.gz" - size="528162" md5sum="4f753d93a85cf413e00f1394b8cbd269"/> - </tarball> - <autotools id="totem" autogenargs="--enable-gstreamer"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gnome-desktop"/> - <dep package="nautilus-cd-burner"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - <dep package="libmusicbrainz"/> - <dep package="iso-codes"/> - </dependencies> - </autotools> - <autotools id="gnome-themes-extras"> - <branch/> - <dependencies> - <dep package="gnome-themes"/> - </dependencies> - </autotools> - <autotools id="libgda"> - <branch module="libgda"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="libgnomedb" autogenargs="--enable-gnome=yes"> - <branch/> - <dependencies> - <dep package="libgda"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - </dependencies> - </autotools> - <autotools id="mergeant"> - <branch/> - <dependencies> - <dep package="libgnomedb"/> - </dependencies> - </autotools> - <autotools id="gtranslator"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-spell"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="libgnomecups"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-cups-manager"> - <branch/> - <dependencies> - <dep package="libgnomecups"/> - <dep package="libgnomeui"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libxml++"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libxml2"/> - <dep package="glibmm"/> - </dependencies> - </autotools> - <autotools id="bakery"> - <branch/> - <dependencies> - <dep package="libxml++"/> - <dep package="gtkmm"/> - <dep package="gnomemm/libglademm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/gnome-vfsmm"/> - </dependencies> - </autotools> - <autotools id="gnome-hello"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-system-tools"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="nautilus"/> - <dep package="system-tools-backends"/> - </dependencies> - </autotools> - <autotools id="gnome-user-docs"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - </dependencies> - </autotools> - <autotools id="loudmouth"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gossip"> - <branch revision="gossip-0-8"/> - <dependencies> - <dep package="loudmouth"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="conglomerate"> - <branch/> - <dependencies> - <dep package="libxslt"/> - <dep package="gconf"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="sound-juicer"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="gnome-doc-utils"/> - <dep package="libgnomeui"/> - <dep package="gnome-media"/> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - <dep package="nautilus-cd-burner"/> - </dependencies> - </autotools> - <autotools id="gnome-network"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <tarball id="guile" version="1.6.7"> - <source href="ftp://ftp.gnu.org/gnu/guile/guile-1.6.7.tar.gz" - size="3039294" md5sum="c2ff2a2231f0cbb2e838dd8701a587c5"/> - </tarball> - <tarball id="autogen" version="5.6.5"> - <source href="http://internap.dl.sourceforge.net/sourceforge/autogen/autogen-5.6.5.tar.gz" - size="1144260" md5sum="54a6cb0be7e6b526af9aba4a73013885"/> - <dependencies> - <dep package="guile"/> - </dependencies> - </tarball> - <autotools id="anjuta"> - <branch/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - <dep package="vte"/> - <dep package="gnome-build"/> - <dep package="autogen"/> - </dependencies> - </autotools> - <autotools id="OpenApplet"> - <branch/> - <dependencies> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="gtetrinet"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="glom"> - <branch/> - <dependencies> - <dep package="gnomemm/libgdamm"/> - <dep package="bakery"/> - <dep package="gnomemm/libgnomecanvasmm"/> - <dep package="libgnome"/> - <dep package="iso-codes"/> - <dep package="pygtk"/> - <dep package="gnome-python-extras"/> - </dependencies> - </autotools> - <autotools id="vino"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libglade"/> - <dep package="gconf"/> - <dep package="gnutls"/> - </dependencies> - </autotools> - <autotools id="gnome-keyring-manager" autogenargs="--disable-more-warnings"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-keyring"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <autotools id="gnome-volume-manager"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libglade"/> - <dep package="hal"/> - </dependencies> - </autotools> - <metamodule id="meta-storage"> - <dependencies> - <dep package="storage/storage-store"/> - <dep package="storage/vfs"/> - <dep package="storage/applet"/> - </dependencies> - </metamodule> - <autotools id="storage/storage-store"> - <branch/> - <dependencies> - <dep package="dbus"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage"> - <branch/> - <dependencies> - <dep package="gnome-vfs"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage-translators"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - </dependencies> - </autotools> - <autotools id="storage/vfs"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - <dep package="storage/libstorage-translators"/> - </dependencies> - </autotools> - <autotools id="storage/pet"> - <branch/> - </autotools> - <autotools id="storage/libmrs"> - <branch/> - <dependencies> - <dep package="storage/pet"/> - </dependencies> - </autotools> - <autotools id="storage/libmrs-converter"> - <branch/> - <dependencies> - <dep package="storage/libmrs"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage-nl"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - <dep package="storage/libmrs"/> - <dep package="storage/libmrs-converter"/> - </dependencies> - </autotools> - <autotools id="storage/applet"> - <branch/> - <dependencies> - <dep package="gnome-python"/> - <dep package="storage/libstorage-nl"/> - </dependencies> - </autotools> - <autotools id="gnome-nettool"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="monkey-bubble"> - <branch/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-schedule"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="yelp"/> - </dependencies> - </autotools> - <autotools id="gnome-backgrounds"> - <branch/> - </autotools> - <autotools id="evince"> - <branch revision="gnome-2-12"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - <dep package="poppler-0-4"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="nautilus-python" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="nautilus"/> - <dep package="pygtk"/> - <dep package="gnome-python"/> - </dependencies> - </autotools> - <autotools id="gst-python" autogenargs="--" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" revision="BRANCH-GSTREAMER-0_8"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins"/> - </dependencies> - </autotools> - <autotools id="inkscape"> - <branch repo="inkscape.sf.net"/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libxslt"/> - </dependencies> - </autotools> -</moduleset> diff --git a/scripts/jhbuild/modulesets/gnome-2.14.modules b/scripts/jhbuild/modulesets/gnome-2.14.modules deleted file mode 100644 index 7d3b8fc9fb..0000000000 --- a/scripts/jhbuild/modulesets/gnome-2.14.modules +++ /dev/null @@ -1,2013 +0,0 @@ -<?xml version="1.0"?><!--*- mode: nxml -*--> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - <repository type="cvs" name="gnome.org" default="yes" - cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome" - password=""/> - <repository type="cvs" name="cairo.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/cairo" - password=""/> - <repository type="cvs" name="mozilla.org" - cvsroot=":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" - password="anonymous"/> - <repository type="cvs" name="liboil.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/liboil" - password=""/> - <repository type="cvs" name="gstreamer.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer" - password=""/> - <repository type="cvs" name="menu.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/menus" - password=""/> - <repository type="cvs" name="mime.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/mime" - password=""/> - <repository type="cvs" name="xklavier.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/xklavier" - password=""/> - - <repository type="cvs" name="elysium-project.sf.net" - cvsroot=":pserver:anonymous@elysium-project.cvs.sourceforge.net:/cvsroot/elysium-project" - password=""/> - <repository type="cvs" name="gaim.sf.net" - cvsroot=":pserver:anonymous@gaim.cvs.sourceforge.net:/cvsroot/gaim" - password=""/> - <repository type="cvs" name="inkscape.sf.net" - cvsroot=":pserver:anonymous@inkscape.cvs.sourceforge.net:/cvsroot/inkscape" - password=""/> - <repository type="svn" name="svn.galago-project.org" - href="http://svn.galago-project.org/"/> - <repository type="svn" name="osiris.chipx86.com" - href="http://osiris.chipx86.com/svn/osiris-misc/"/> - <repository type="svn" name="svn.debian.org" - href="svn://svn.debian.org/"/> - <repository type="cvs" name="openh323.sf.net" - cvsroot=":pserver:anonymous@openh323.cvs.sourceforge.net:/cvsroot/openh323" - password="" /> - - <tarball id="scrollkeeper" version="0.3.14" supports-non-srcdir-builds="no"> - <source href="http://easynews.dl.sourceforge.net/sourceforge/scrollkeeper/scrollkeeper-0.3.14.tar.gz" - size="679513" md5sum="161eb3f29e30e7b24f84eb93ac696155"/> - <dependencies> - <dep package="libxml2"/> - <dep package="libxslt"/> - <dep package="intltool"/> - </dependencies> - <patches> - <patch file="scrollkeeper_clean_xml_validation_context.patch" strip="1"/> - <patch file="scrollkeeper_language_fix.patch" strip="1"/> - <patch file="scrollkeeper_rw_offset_fix.patch" strip="1"/> - </patches> - </tarball> - - <autotools id="iso-codes"> - <branch repo="svn.debian.org" module="pkg-isocodes/trunk/iso-codes" checkoutdir="iso-codes"/> - </autotools> - - <include href="freedesktop.modules"/> - <include href="gnutls.modules"/> - - <autotools id="cairo-gtk-engine"> - <branch repo="cairo.freedesktop.org"/> - <dependencies> - <dep package="gtk+"/> - <dep package="cairo-1-0"/> - </dependencies> - </autotools> - - <autotools id="shared-mime-info" supports-non-srcdir-builds="no"> - <branch repo="mime.freedesktop.org"/> - <dependencies> - <dep package="intltool"/> - <dep package="libxml2"/> - <dep package="glib"/> - </dependencies> - </autotools> - - <autotools id="desktop-file-utils"> - <branch repo="menu.freedesktop.org"/> - <dependencies> - <dep package="glib"/> - <dep package="intltool"/> - </dependencies> - </autotools> - - <autotools id="libxklavier" supports-non-srcdir-builds="no"> - <branch repo="xklavier.freedesktop.org" revision="v_2_x"/> - <dependencies> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="libbtctl"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-bluetooth"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="glib"/> - <dep package="libbtctl"/> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <autotools id="phonemgr"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="glib"/> - <dep package="libbtctl"/> - <dep package="gnome-bluetooth"/> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="libgnome"/> - <dep package="gconf"/> - </dependencies> - </autotools> - - <autotools id="intltool"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gnome-common"> - <branch/> - </autotools> - <autotools id="libxml2"> - <branch module="gnome-xml" checkoutdir="libxml2"/> - </autotools> - <autotools id="libxslt"> - <branch/> - <dependencies> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gtk-doc"> - <branch/> - <dependencies> - <dep package="libxslt"/> - <dep package="scrollkeeper"/> - </dependencies> - </autotools> - <autotools id="gamin"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="glib"> - <branch revision="glib-2-10"/> - <dependencies> - <dep package="gtk-doc"/> - </dependencies> - </autotools> - <autotools id="pango"> - <branch revision="pango-1-12"/> - <dependencies> - <dep package="glib"/> - <dep package="cairo-1-0"/> - <dep package="libXft"/> - </dependencies> - </autotools> - <autotools id="atk"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gtk+"> - <branch revision="gtk-2-8"/> - <dependencies> - <dep package="cairo-1-0"/> - <dep package="pango"/> - <dep package="atk"/> - <dep package="shared-mime-info"/> - </dependencies> - </autotools> - <autotools id="gail"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="atk"/> - <dep package="libgnomecanvas"/> - </dependencies> - </autotools> - <autotools id="gtkhtml2"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="gail"/> - </dependencies> - </autotools> - <autotools id="libIDL"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="ORBit2"> - <branch/> - <dependencies> - <dep package="libIDL"/> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gconf"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - <dep package="libxml2"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libbonobo"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="ORBit2"/> - <dep package="intltool"/> - <dep package="gnome-common"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gnome-mime-data"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-icon-theme"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="hicolor-icon-theme"/> - </dependencies> - </autotools> - <tarball id="howl" version="1.0.0"> - <source href="http://www.porchdogsoft.com/download/howl-1.0.0.tar.gz" - size="542782" md5sum="c389d3ffba0e69a179de2ec650f1fdcc"/> - <patches> - <patch file="howl-1.0.0-buildfix.patch" strip="1"/> - </patches> - </tarball> - <autotools id="gnome-vfs"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gconf"/> - <dep package="desktop-file-utils"/> - <dep package="shared-mime-info"/> - <dep package="gnome-mime-data"/> - <dep package="howl"/> - <dep package="hal"/> - <dep package="gamin"/> - </dependencies> - </autotools> - <autotools id="gnome-keyring"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libart_lgpl"> - <branch/> - </autotools> - <autotools id="libgnome"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libxml2"/> - <dep package="libxslt"/> - <dep package="libbonobo"/> - <dep package="gnome-vfs"/> - <dep package="gconf"/> - <dep package="esound"/> - </dependencies> - </autotools> - <autotools id="libgnomecanvas"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - <dep package="libglade"/> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="libbonoboui"> - <branch/> - <dependencies> - <dep package="libgnome"/> - <dep package="libbonobo"/> - <dep package="libgnomecanvas"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libgnomeui"> - <branch revision="libgnomeui-2-14"/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="gnome-icon-theme"/> - <dep package="gnome-keyring"/> - </dependencies> - </autotools> - <autotools id="libglade"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="pygobject"> - <branch revision="pygobject-2-10"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="pygtk"> - <branch revision="pygtk-2-8"/> - <dependencies> - <dep package="pygobject"/> - <dep package="gtk+"/> - <dep package="pycairo-1-0"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="pyorbit"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - </dependencies> - </autotools> - <autotools id="gnome-python"> - <branch revision="gnome-python-2-12"/> - <dependencies> - <dep package="pygtk"/> - <dep package="pyorbit"/> - <dep package="libgnomecanvas"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-python-desktop"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gnome-python"/> - <dep package="gnome-panel"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="gtksourceview"/> - <dep package="libwnck"/> - <dep package="totem"/> - <dep package="libgtop"/> - <dep package="nautilus-cd-burner"/> - <dep package="gnome-media"/> - <dep package="metacity"/> - </dependencies> - </autotools> - <autotools id="gnome-python-extras"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gtkhtml2"/> - <dep package="gdl"/> - </dependencies> - </autotools> - <autotools id="bug-buddy"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-menus"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="libwnck"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="startup-notification"/> - </dependencies> - </autotools> - <autotools id="gnome-desktop" autogenargs="--with-gnome-distributor=JHBuild"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="startup-notification"/> - <dep package="gnome-themes"/> - <dep package="scrollkeeper"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-menus"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="intltool"/> - <dep package="gnome-common"/> - <dep package="glib"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="gnome-panel"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-desktop"/> - <dep package="libwnck"/> - <dep package="evolution-data-server"/> - <dep package="gnome-menus"/> - <dep package="gnome-vfs"/> - <dep package="libglade"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-session"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="esound"/> - </dependencies> - </autotools> - <autotools id="gnome-applets" autogenargs="--enable-gstreamer=0.10"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gnome-panel"/> - <dep package="libgtop"/> - <dep package="gail"/> - <dep package="libxklavier"/> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - <dep package="gucharmap"/> - <dep package="system-tools-backends-1.4"/> - </dependencies> - </autotools> - <autotools id="gnome-games"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="librsvg"/> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gob"/> - </dependencies> - </autotools> - <autotools id="libcroco" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="pango"/> - </dependencies> - </autotools> - <autotools id="librsvg" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libxml2"/> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - <dep package="gnome-common"/> - <dep package="libgsf"/> - <dep package="libcroco"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="eel"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - <dep package="gail"/> - <dep package="gnome-desktop"/> - <dep package="gnome-menus"/> - </dependencies> - </autotools> - <autotools id="nautilus"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="esound"/> - <dep package="eel"/> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - <dep package="gnome-desktop"/> - </dependencies> - </autotools> - <autotools id="nautilus-actions"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="nautilus-cd-burner"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="nautilus-open-terminal"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="nautilus-media" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="nautilus"/> - <dep package="gstreamer-0-8"/> - <dep package="gst-plugins-0-8"/> - </dependencies> - </autotools> - <autotools id="nautilus-vcs"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="metacity"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="intltool"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libgtop"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-system-monitor"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="libgtop"/> - </dependencies> - </autotools> - <autotools id="gnome-control-center" autogenargs="--enable-gstreamer=0.10" - supports-non-srcdir-builds="no"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="esound"/> - <dep package="gnome-desktop"/> - <dep package="metacity"/> - <dep package="nautilus"/> - <dep package="libxklavier"/> - <dep package="gnome-menus"/> - <dep package="gnome-doc-utils"/> - <dep package="gstreamer"/> - </dependencies> - </autotools> - <autotools id="yelp"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="gnome-doc-utils"/> - <dep package="startup-notification"/> - <dep package="libgnomeprintui"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="devhelp"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="gnome-utils"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gconf-editor" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-14" /> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <tarball id="audiofile" version="0.2.6" supports-non-srcdir-builds="no"> - <source href="http://www.68k.org/~michael/audiofile/audiofile-0.2.6.tar.gz" - size="374688" md5sum="9c1049876cd51c0f1b12c2886cce4d42"/> - </tarball> - <autotools id="esound"> - <branch/> - <dependencies> - <dep package="audiofile"/> - </dependencies> - </autotools> - <autotools id="gnome-media"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="esound"/> - <dep package="gail"/> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - <dep package="gst-plugins-good"/> - <dep package="nautilus-cd-burner"/> - </dependencies> - </autotools> - <autotools id="gdm2"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="librsvg"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="vte"> - <branch revision="vte-0-12"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="gnome-terminal"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="vte"/> - <dep package="startup-notification"/> - </dependencies> - </autotools> - <autotools id="gtk-engines"> - <branch revision="gtk-engines-2-6"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libgnomeprint"> - <branch/> - <dependencies> - <dep package="intltool"/> - <dep package="libart_lgpl"/> - <dep package="glib"/> - <dep package="gnome-common"/> - <dep package="pango"/> - <dep package="libgnomecups"/> - </dependencies> - </autotools> - <autotools id="libgnomeprintui"> - <branch/> - <dependencies> - <dep package="libgnomeprint"/> - <dep package="gtk+"/> - <dep package="libgnomecanvas"/> - <dep package="gnome-icon-theme"/> - </dependencies> - </autotools> - <autotools id="gedit"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-doc-utils"/> - <dep package="libgnomeprintui"/> - <dep package="gtksourceview"/> - <dep package="gnome-python-desktop"/> - </dependencies> - </autotools> - <autotools id="memprof"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="eog"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="libgsf"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gnome-vfs"/> - <dep package="libbonobo"/> - </dependencies> - </autotools> - <autotools id="goffice"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libgsf"/> - <dep package="libxml2"/> - <dep package="pango"/> - <dep package="libglade"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="libart_lgpl"/> - </dependencies> - </autotools> - <autotools id="gnumeric"> - <branch/> - <dependencies> - <dep package="goffice"/> - <dep package="libgsf"/> - <dep package="pygtk"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gimp" autogenargs="--disable-print"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - </dependencies> - </autotools> - <autotools id="glade"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="glade2c"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="sawfish"> - <branch revision="gnome-2"/> - <dependencies> - <dep package="rep-gtk"/> - </dependencies> - </autotools> - <autotools id="rep-gtk"> - <branch/> - <dependencies> - <dep package="librep"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="librep"> - <branch/> - </autotools> - <autotools id="rhythmbox"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gst-plugins-base"/> - <dep package="nautilus-cd-burner"/> - <dep package="totem"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gstreamer-0-8" autogenargs="-- --disable-plugin-builddir --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gstreamer" - revision="BRANCH-GSTREAMER-0_8" checkoutdir="gstreamer-0-8"/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - - <autotools id="gst-plugins-0-8" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins" - revision="BRANCH-GSTREAMER-0_8" checkoutdir="gst-plugins-0-8"/> - <dependencies> - <dep package="gstreamer-0-8"/> - <dep package="gnome-vfs"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - - <autotools id="gst-python-0-8" autogenargs="--" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-python" - revision="BRANCH-GSTREAMER-0_8" checkoutdir="gst-python-0-8"/> - <dependencies> - <dep package="gstreamer-0-8"/> - <dep package="gst-plugins-0-8"/> - </dependencies> - </autotools> - - <autotools id="gstreamer" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gstreamer"/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - - <autotools id="liboil"> - <branch repo="liboil.freedesktop.org" revision="liboil_0_3_6"/> - </autotools> - - <autotools id="gst-plugins-base" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins-base"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gnome-vfs"/> - <dep package="gtk+"/> - <dep package="liboil"/> - </dependencies> - </autotools> - - <autotools id="gst-plugins-good" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins-good"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="gst-plugins-ugly" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins-ugly"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="gst-plugins-bad" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins-bad"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="gst-ffmpeg" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-ffmpeg"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="gst-python" autogenargs="--" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-python"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="planner"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - <dep package="libgsf"/> - </dependencies> - </autotools> - <autotools id="file-roller"> - <branch revision="gnome-2-14" /> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="gnome-doc-utils"/> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="balsa"> - <branch revision="BALSA_2"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="pan"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnet"/> - </dependencies> - </autotools> - <autotools id="pyspi"> - <branch/> - <dependencies> - <dep package="at-spi"/> - </dependencies> - </autotools> - <autotools id="dogtail"> - <branch/> - <dependencies> - <dep package="pyspi"/> - </dependencies> - <after> - <dep package="gnome-python-desktop"/> - </after> - </autotools> - <autotools id="gcalctool" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="ggv" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="ekiga" autogenargs="--with-pwlib-dir=`ptlib-config --prefix` --with-opal-dir=`ptlib-config --prefix`"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="evolution-data-server"/> - <dep package="opal" /> - <dep package="avahi" /> - </dependencies> - </autotools> - <autotools id="pwlib" autogen-sh="configure"> - <branch repo="openh323.sf.net" module="ptlib_unix" checkoutdir="pwlib" - override-checkoutdir="no" update-new-dirs="no" /> - </autotools> - <autotools id="opal" autogen-sh="configure"> - <branch repo="openh323.sf.net"/> - <dependencies> - <dep package="pwlib"/> - </dependencies> - </autotools> - <autotools id="gucharmap" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gtksourceview" autogenargs="--enable-compile-warnings=maximum"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeprint"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="glimmer"> - <branch/> - <dependencies> - <dep package="gtksourceview"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="gdl"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="librsvg"/> - </dependencies> - </autotools> - <autotools id="gnome-build"> - <branch/> - <dependencies> - <dep package="gdl"/> - <dep package="gnome-vfs"/> - <dep package="gtkhtml2"/> - </dependencies> - </autotools> - <autotools id="scaffold"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="vte"/> - <dep package="gdl"/> - </dependencies> - </autotools> - <autotools id="libsigc++2"> - <branch revision="libsigc-2-0"/> - </autotools> - <autotools id="glibmm"> - <branch revision="glibmm-2-8"/> - <dependencies> - <dep package="glib"/> - <dep package="libsigc++2"/> - </dependencies> - </autotools> - <autotools id="gtkmm"> - <branch revision="gtkmm-2-8"/> - <dependencies> - <dep package="glibmm"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="orbitcpp"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomemm"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnome"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libglademm"> - <branch/> - <dependencies> - <dep package="libglade"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libbonobomm"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gtkmm"/> - <dep package="orbitcpp"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libbonobouimm"> - <branch/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="gnomemm/libbonobomm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomecanvasmm"> - <branch/> - <dependencies> - <dep package="libgnomecanvas"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gconfmm"> - <branch/> - <dependencies> - <dep package="gconf"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeuimm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgnomeui"/> - <dep package="gnomemm/libgnomemm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/libgnomecanvasmm"/> - <dep package="gnomemm/libglademm"/> - <dep package="gnomemm/gnome-vfsmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gnome-vfsmm"> - <branch/> - <dependencies> - <dep package="glibmm"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libpanelappletmm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeprintmm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeprintuimm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="gnomemm/libgnomeprintmm"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgdamm"> - <branch revision="libgda-1-2"/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgda-1-2"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gtkmm_hello"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="regexxer"> - <branch/> - <dependencies> - <dep package="intltool"/> - <dep package="gtkmm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/libglademm"/> - </dependencies> - </autotools> - <autotools id="gnet" autogenargs="--enable-glib2"> - <branch revision="GNET_1_1"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnomeicu"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="at-spi"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gail"/> - </dependencies> - </autotools> - <autotools id="libgail-gnome"> - <branch/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="at-poke"> - <branch/> - <dependencies> - <dep package="libgail-gnome"/> - </dependencies> - </autotools> - <autotools id="gnome-mag"> - <branch/> - <dependencies> - <dep package="at-spi"/> - </dependencies> - </autotools> - <autotools id="gok"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="esound"/> - <dep package="scrollkeeper"/> - <dep package="gnome-speech"/> - </dependencies> - </autotools> - <autotools id="gnome-speech"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libbonobo"/> - </dependencies> - </autotools> - <autotools id="gnopernicus"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gconf"/> - <dep package="libgnomeui"/> - <dep package="gnome-speech"/> - <dep package="gnome-mag"/> - </dependencies> - </autotools> - <autotools id="dasher" autogenargs="--with-a11y --with-gnome"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="gnome-speech"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="gnome-screensaver"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gconf"/> - <dep package="gtk+"/> - <dep package="dbus"/> - <dep package="gnome-menus"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-power-manager"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="hal"/> - <dep package="libwnck"/> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="intltool"/> - <dep package="libglade"/> - <dep package="libnotify"/> - </dependencies> - </autotools> - <autotools id="gthumb"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="libglade"/> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="fast-user-switch-applet"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="libglade"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="gnome-mount" autogenargs="--enable-nautilus-extension"> - <branch/> - <dependencies> - <dep package="gnome-keyring"/> - <dep package="libgnomeui"/> - <dep package="dbus"/> - <dep package="hal"/> - <dep package="gtk+"/> - <dep package="intltool"/> - <dep package="libglade"/> - <dep package="eel"/> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="libnotify"> - <branch repo="svn.galago-project.org" module="trunk/libnotify"/> - <dependencies> - <dep package="gtk+"/> - <dep package="dbus"/> - </dependencies> - </autotools> - <autotools id="libsexy"> - <branch repo="osiris.chipx86.com" module="trunk/libsexy"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="iso-codes"/> - </dependencies> - </autotools> - <autotools id="notification-daemon"> - <branch repo="svn.galago-project.org" module="trunk/notification-daemon"/> - <dependencies> - <dep package="gtk+"/> - <dep package="dbus"/> - <dep package="libsexy"/> - </dependencies> - </autotools> - - <metamodule id="meta-gnome-devel-platform"> - <dependencies> - <dep package="libgnome"/> - <dep package="libbonobo"/> - <dep package="libbonoboui"/> - <dep package="libgnomeui"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-core"> - <dependencies> - <dep package="gnome-desktop"/> - <dep package="gnome-panel"/> - <dep package="gnome-session"/> - <dep package="gnome-terminal"/> - <dep package="gnome-applets"/> - </dependencies> - </metamodule> - <metamodule id="meta-nautilus"> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-desktop"> - <dependencies> - <dep package="meta-gnome-core"/> - <dep package="gnome-control-center"/> - <dep package="meta-nautilus"/> - <dep package="yelp"/> - <dep package="bug-buddy"/> - <dep package="gedit"/> - <dep package="gtk-engines"/> - <dep package="eog"/> - <dep package="metacity"/> - <dep package="gconf-editor"/> - <dep package="gnome-utils"/> - <dep package="gnome-system-monitor"/> - <dep package="gstreamer"/> - <dep package="gnome-media"/> - <dep package="gnome-netstatus"/> - <dep package="gcalctool"/> - <dep package="gucharmap"/> - <dep package="nautilus-cd-burner"/> - <dep package="zenity"/> - <dep package="libgail-gnome"/> - <dep package="gnopernicus"/> - <dep package="gok"/> - <dep package="epiphany"/> - <dep package="gnome-games"/> - <dep package="gnome-user-docs"/> - <dep package="file-roller"/> - <dep package="gnome-system-tools"/> - <dep package="gnome-nettool"/> - <dep package="vino"/> - <dep package="gnome-volume-manager"/> - <dep package="totem"/> - <dep package="gnome-menus"/> - <dep package="gnome-backgrounds"/> - <dep package="sound-juicer"/> - <dep package="evolution"/> - <dep package="evolution-webcal"/> - <dep package="evolution-exchange"/> - <dep package="ekiga"/> - <dep package="evince"/> - <dep package="dasher"/> - <dep package="gnome-keyring-manager"/> - <dep package="deskbar-applet"/> - <dep package="fast-user-switch-applet"/> - <dep package="gnome-screensaver"/> - <dep package="meta-gnome-admin"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-admin"> - <dependencies> - <dep package="pessulus"/> - <dep package="sabayon"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-devel-tools"> - <dependencies> - <dep package="glade"/> - <dep package="memprof"/> - <dep package="gconf-editor"/> - <dep package="devhelp"/> - <dep package="nautilus-vcs"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-python"> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gnome-python-desktop"/> - </dependencies> - <after> - <dep package="gnome-python-extras"/> - </after> - </metamodule> - <metamodule id="meta-gnome-c++"> - <dependencies> - <dep package="gtkmm"/> - <dep package="gnomemm/libgnomeuimm"/> - <dep package="gnomemm/gnome-vfsmm"/> - <dep package="gnomemm/libpanelappletmm"/> - <dep package="gnomemm/libbonobouimm"/> - <dep package="gnomemm/libgnomeprintuimm"/> - <dep package="libxml++"/> - <dep package="gnomemm/libgdamm"/> - <dep package="bakery"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-accessibility"> - <dependencies> - <dep package="libgail-gnome"/> - <dep package="at-poke"/> - <dep package="dasher"/> - <dep package="gnome-mag"/> - <dep package="gok"/> - <dep package="gnome-speech"/> - <dep package="gnopernicus"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-proposed"> - <dependencies> - <dep package="libnotify"/> - <dep package="notification-daemon"/> - <dep package="gnome-power-manager"/> - </dependencies> - </metamodule> - <autotools id="sodipodi"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnomeprintui"/> - <dep package="libart_lgpl"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gnome-themes"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gtk-engines"/> - </dependencies> - </autotools> - <autotools id="gob"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="libgnetwork"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gconf"/> - <dep package="intltool"/> - </dependencies> - </autotools> - <autotools id="libgircclient"> - <branch/> - <dependencies> - <dep package="libgnetwork"/> - </dependencies> - </autotools> - <autotools id="gnomechat"> - <branch/> - <dependencies> - <dep package="libgnetwork"/> - <dep package="libgircclient"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <mozillamodule id="mozilla" autogenargs="--enable-default-toolkit=gtk2 --disable-mailnews --disable-ldap --disable-debug --enable-optimize --disable-tests --enable-crypto --enable-xft --with-system-zlib --disable-freetype2 --enable-application=browser" cvsroot="mozilla.org" revision="MOZILLA_1_7_BRANCH"> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </mozillamodule> - <autotools id="epiphany"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="iso-codes"/> - <dep package="libgnomeui"/> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gnome-doc-utils"/> - <dep package="libgnomeprintui"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="epiphany-extensions"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="epiphany"/> - </dependencies> - </autotools> - <autotools id="galeon"> - <branch/> - <dependencies> - <dep package="mozilla"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="libsoup"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gnutls"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gtkhtml"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="gail"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="libsoup"/> - </dependencies> - </autotools> - <autotools id="evolution-data-server" supports-non-srcdir-builds="no"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libbonobo"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - <dep package="libsoup"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="gnome-vfs"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="evolution"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="gtkhtml"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - </dependencies> - <after> - <dep package="libnotify"/> - </after> - </autotools> - <autotools id="evolution-webcal"> - <branch/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="libsoup"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="evolution-exchange"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="evolution"/> - <dep package="libsoup"/> - </dependencies> - </autotools> - <tarball id="xchat" version="2.4.5"> - <source href="http://xchat.org/files/source/2.4/xchat-2.4.5.tar.bz2" - size="1324626" md5sum="9107a92693e6c62ff2008030e698b92b"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - </dependencies> - </tarball> - <tarball id="camorama" version="0.17"> - <source href="http://camorama.fixedgear.org/downloads/camorama-0.17.tar.bz2" - size="312233" md5sum="2b2784af53a1ba8fa4419aa806967b35"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </tarball> - <autotools id="gtk-engines-cleanice"> - <branch repo="elysium-project.sf.net"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="gaim"> - <branch repo="gaim.sf.net"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="zenity"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="libgnomecanvas"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gpdf"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gnome-netstatus"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-doc-utils"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libxslt"/> - <dep package="intltool"/> - <dep package="glib"/> - </dependencies> - </autotools> - <tarball id="libmusicbrainz" version="2.1.2"> - <source href="ftp://ftp.musicbrainz.org/pub/musicbrainz/libmusicbrainz-2.1.2.tar.gz" - size="504432" md5sum="88d35af903665fecbdee77eb6d5e6cdd"/> - </tarball> - <autotools id="totem" autogenargs="--enable-gstreamer=0.10"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gnome-desktop"/> - <dep package="nautilus-cd-burner"/> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - <dep package="gst-plugins-good"/> - <dep package="libmusicbrainz"/> - <dep package="iso-codes"/> - </dependencies> - </autotools> - <autotools id="gnome-themes-extras"> - <branch/> - <dependencies> - <dep package="gnome-themes"/> - </dependencies> - </autotools> - - <autotools id="libgda"> - <branch module="libgda"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="libgda-1-2"> - <branch module="libgda" revision="release-1-2-branch" - checkoutdir="libgda-1-2"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - - <autotools id="libgnomedb" autogenargs="--enable-gnome=yes"> - <branch/> - <dependencies> - <dep package="libgda"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - </dependencies> - </autotools> - <autotools id="mergeant"> - <branch/> - <dependencies> - <dep package="libgnomedb"/> - </dependencies> - </autotools> - <autotools id="gtranslator"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-spell"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="libgnomecups"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-cups-manager"> - <branch/> - <dependencies> - <dep package="libgnomecups"/> - <dep package="libgnomeui"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libxml++"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="glibmm"/> - </dependencies> - </autotools> - <autotools id="bakery"> - <branch/> - <dependencies> - <dep package="libxml++"/> - <dep package="gtkmm"/> - <dep package="gnomemm/libglademm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/gnome-vfsmm"/> - </dependencies> - </autotools> - <autotools id="gnome-hello"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-system-tools"> - <branch revision="gnome-2-14" /> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="nautilus"/> - <dep package="system-tools-backends-1.4"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-user-docs"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="loudmouth"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gossip"> - <branch/> - <dependencies> - <dep package="loudmouth"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="conglomerate"> - <branch/> - <dependencies> - <dep package="libxslt"/> - <dep package="gconf"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="sound-juicer"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gnome-doc-utils"/> - <dep package="libgnomeui"/> - <dep package="gnome-media"/> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - <dep package="gst-plugins-good"/> - <dep package="nautilus-cd-burner"/> - </dependencies> - </autotools> - <autotools id="gnome-network"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <tarball id="guile" version="1.6.7"> - <source href="ftp://ftp.gnu.org/gnu/guile/guile-1.6.7.tar.gz" - size="3039294" md5sum="c2ff2a2231f0cbb2e838dd8701a587c5"/> - </tarball> - <tarball id="autogen" version="5.6.5"> - <source href="http://internap.dl.sourceforge.net/sourceforge/autogen/autogen-5.6.5.tar.gz" - size="1144260" md5sum="54a6cb0be7e6b526af9aba4a73013885"/> - <dependencies> - <dep package="guile"/> - </dependencies> - </tarball> - <autotools id="anjuta"> - <branch/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - <dep package="vte"/> - <dep package="gnome-build"/> - <dep package="autogen"/> - </dependencies> - </autotools> - <autotools id="OpenApplet"> - <branch/> - <dependencies> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="gtetrinet"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="glom"> - <branch/> - <dependencies> - <dep package="gnomemm/libgdamm"/> - <dep package="bakery"/> - <dep package="gnomemm/libgnomecanvasmm"/> - <dep package="libgnome"/> - <dep package="iso-codes"/> - <dep package="pygtk"/> - <dep package="gnome-python-extras"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="vino"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libglade"/> - <dep package="gconf"/> - <dep package="gnutls"/> - </dependencies> - </autotools> - <autotools id="gnome-keyring-manager" autogenargs="--disable-more-warnings"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-keyring"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <autotools id="gnome-volume-manager"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libglade"/> - <dep package="hal"/> - </dependencies> - </autotools> - <metamodule id="meta-storage"> - <dependencies> - <dep package="storage/storage-store"/> - <dep package="storage/vfs"/> - <dep package="storage/applet"/> - </dependencies> - </metamodule> - <autotools id="storage/storage-store"> - <branch/> - <dependencies> - <dep package="dbus"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage"> - <branch/> - <dependencies> - <dep package="gnome-vfs"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage-translators"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - </dependencies> - </autotools> - <autotools id="storage/vfs"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - <dep package="storage/libstorage-translators"/> - </dependencies> - </autotools> - <autotools id="storage/pet"> - <branch/> - </autotools> - <autotools id="storage/libmrs"> - <branch/> - <dependencies> - <dep package="storage/pet"/> - </dependencies> - </autotools> - <autotools id="storage/libmrs-converter"> - <branch/> - <dependencies> - <dep package="storage/libmrs"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage-nl"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - <dep package="storage/libmrs"/> - <dep package="storage/libmrs-converter"/> - </dependencies> - </autotools> - <autotools id="storage/applet"> - <branch/> - <dependencies> - <dep package="gnome-python"/> - <dep package="storage/libstorage-nl"/> - </dependencies> - </autotools> - <autotools id="gnome-nettool"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="monkey-bubble"> - <branch/> - <dependencies> - <dep package="gstreamer-0-8"/> - <dep package="gst-plugins-0-8"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-schedule"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="yelp"/> - </dependencies> - </autotools> - <autotools id="gnome-backgrounds"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="evince"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - <dep package="poppler"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="nautilus-python" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="nautilus"/> - <dep package="pygtk"/> - <dep package="gnome-python"/> - </dependencies> - </autotools> - <autotools id="inkscape"> - <branch repo="inkscape.sf.net"/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libxslt"/> - </dependencies> - </autotools> - <autotools id="NetworkManager"> - <branch repo="gnome.org"/> - <dependencies> - <dep package="dbus"/> - </dependencies> - </autotools> - <autotools id="atomix"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - <dep package="libxml2"/> - <dep package="libgnomecanvas"/> - <dep package="libbonoboui"/> - </dependencies> - </autotools> - <autotools id="deskbar-applet"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="gtk+"/> - <dep package="gnome-desktop"/> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gnome-python-desktop"/> - </dependencies> - </autotools> - <autotools id="pessulus"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - </dependencies> - </autotools> - <autotools id="sabayon"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="muine"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="gstreamer"/> - </dependencies> - </autotools> - <autotools id="gnonlin"> - <branch repo="gstreamer.freedesktop.org" module="gnonlin"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - <autotools id="pitivi"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gstreamer"/> - <dep package="gst-python"/> - <dep package="gnonlin"/> - </dependencies> - </autotools> -</moduleset> diff --git a/scripts/jhbuild/modulesets/gnome-2.16.modules b/scripts/jhbuild/modulesets/gnome-2.16.modules deleted file mode 100644 index 5459c26908..0000000000 --- a/scripts/jhbuild/modulesets/gnome-2.16.modules +++ /dev/null @@ -1,2087 +0,0 @@ -<?xml version="1.0"?><!--*- mode: nxml; indent-tabs-mode: nil -*--> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - <repository type="cvs" name="gnome.org" default="yes" - cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome" - password=""/> - <repository type="cvs" name="cairo.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/cairo" - password=""/> - <repository type="cvs" name="mozilla.org" - cvsroot=":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" - password="anonymous"/> - <repository type="cvs" name="liboil.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/liboil" - password=""/> - <repository type="cvs" name="gstreamer.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer" - password=""/> - <repository type="cvs" name="menu.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/menus" - password=""/> - <repository type="cvs" name="mime.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/mime" - password=""/> - <repository type="cvs" name="xklavier.freedesktop.org" - cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/xklavier" - password=""/> - <repository type="cvs" name="elysium-project.sf.net" - cvsroot=":pserver:anonymous@elysium-project.cvs.sourceforge.net:/cvsroot/elysium-project" - password=""/> - <repository type="svn" name="gaim.sf.net" - href="https://svn.sourceforge.net/svnroot/gaim/"/> - <repository type="cvs" name="inkscape.sf.net" - cvsroot=":pserver:anonymous@inkscape.cvs.sourceforge.net:/cvsroot/inkscape" - password=""/> - <repository type="svn" name="svn.galago-project.org" - href="http://svn.galago-project.org/"/> - <repository type="svn" name="osiris.chipx86.com" - href="http://osiris.chipx86.com/svn/osiris-misc/"/> - <repository type="svn" name="svn.debian.org" - href="svn://svn.debian.org/"/> - <repository type="cvs" name="openh323.sf.net" - cvsroot=":pserver:anonymous@openh323.cvs.sourceforge.net:/cvsroot/openh323" - password="" /> - <repository type="svn" name="svn.navi.cx" - href="http://svn.navi.cx/" /> - <repository type="cvs" name="anoncvs.abisource.com" - cvsroot=":pserver:anoncvs@anoncvs.abisource.com:/cvsroot" - password="anoncvs" /> - - - <tarball id="scrollkeeper" version="0.3.14" supports-non-srcdir-builds="no"> - <source href="http://easynews.dl.sourceforge.net/sourceforge/scrollkeeper/scrollkeeper-0.3.14.tar.gz" - size="679513" md5sum="161eb3f29e30e7b24f84eb93ac696155"/> - <dependencies> - <dep package="libxml2"/> - <dep package="libxslt"/> - <dep package="intltool"/> - </dependencies> - <patches> - <patch file="scrollkeeper_clean_xml_validation_context.patch" strip="1"/> - <patch file="scrollkeeper_language_fix.patch" strip="1"/> - <patch file="scrollkeeper_rw_offset_fix.patch" strip="1"/> - </patches> - </tarball> - - <autotools id="iso-codes"> - <branch repo="svn.debian.org" module="pkg-isocodes/trunk/iso-codes" checkoutdir="iso-codes"/> - </autotools> - - <include href="freedesktop.modules"/> - <include href="gnutls.modules"/> - - <autotools id="cairo-gtk-engine"> - <branch repo="cairo.freedesktop.org"/> - <dependencies> - <dep package="gtk+"/> - <dep package="cairo-1-0"/> - </dependencies> - </autotools> - - <autotools id="shared-mime-info" supports-non-srcdir-builds="no"> - <branch repo="mime.freedesktop.org"/> - <dependencies> - <dep package="intltool"/> - <dep package="libxml2"/> - <dep package="glib"/> - </dependencies> - </autotools> - - <autotools id="desktop-file-utils"> - <branch repo="menu.freedesktop.org"/> - <dependencies> - <dep package="glib"/> - <dep package="intltool"/> - </dependencies> - </autotools> - - <autotools id="libxklavier" supports-non-srcdir-builds="no"> - <branch repo="xklavier.freedesktop.org"/> - <dependencies> - <dep package="libxml2"/> - <dep package="gtk-doc"/> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="libbtctl"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-bluetooth"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="glib"/> - <dep package="libbtctl"/> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <autotools id="phonemgr"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="glib"/> - <dep package="libbtctl"/> - <dep package="gnome-bluetooth"/> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="libgnome"/> - <dep package="gconf"/> - </dependencies> - </autotools> - - <autotools id="intltool"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gnome-common"> - <branch/> - </autotools> - <autotools id="libxml2"> - <branch module="gnome-xml" checkoutdir="libxml2"/> - </autotools> - <autotools id="libxslt"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="libgcrypt"/> - </dependencies> - </autotools> - <autotools id="gtk-doc"> - <branch/> - <dependencies> - <dep package="libxslt"/> - <dep package="scrollkeeper"/> - </dependencies> - </autotools> - <autotools id="gamin"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="glib"> - <branch/> - <dependencies> - <dep package="gtk-doc"/> - </dependencies> - </autotools> - <autotools id="pango"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - <dep package="glib"/> - <dep package="cairo"/> - <dep package="libXft"/> - </dependencies> - </autotools> - <autotools id="atk"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gtk+"> - <branch/> - <dependencies> - <dep package="cairo"/> - <dep package="pango"/> - <dep package="atk"/> - <dep package="shared-mime-info"/> - </dependencies> - </autotools> - <autotools id="gail"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="atk"/> - <dep package="libgnomecanvas"/> - </dependencies> - </autotools> - <autotools id="gtkhtml2"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="gail"/> - </dependencies> - </autotools> - <autotools id="libIDL"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="ORBit2"> - <branch/> - <dependencies> - <dep package="libIDL"/> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="gconf"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - <dep package="libxml2"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libbonobo"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - <dep package="intltool"/> - <dep package="gnome-common"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gnome-mime-data"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-icon-theme"> - <branch/> - <dependencies> - <dep package="hicolor-icon-theme"/> - <dep package="icon-naming-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-vfs"> - <branch/> - <dependencies> - <dep package="gconf"/> - <dep package="desktop-file-utils"/> - <dep package="shared-mime-info"/> - <dep package="gnome-mime-data"/> - <dep package="avahi"/> - <dep package="hal"/> - <dep package="gamin"/> - </dependencies> - </autotools> - <autotools id="gnome-vfs-monikers"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="gnome-keyring"> - <branch/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libart_lgpl"> - <branch/> - </autotools> - <autotools id="libgnome"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="libxslt"/> - <dep package="libbonobo"/> - <dep package="gnome-vfs"/> - <dep package="gconf"/> - <dep package="esound"/> - </dependencies> - </autotools> - <autotools id="libgnomecanvas"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - <dep package="libglade"/> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="libbonoboui"> - <branch/> - <dependencies> - <dep package="libgnome"/> - <dep package="libbonobo"/> - <dep package="libgnomecanvas"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libgnomeui"> - <branch/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="gnome-icon-theme"/> - <dep package="gnome-keyring"/> - </dependencies> - </autotools> - <autotools id="libglade"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="pygobject"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="pygtk"> - <branch/> - <dependencies> - <dep package="pygobject"/> - <dep package="gtk+"/> - <dep package="pycairo"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="pyorbit"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - </dependencies> - </autotools> - <autotools id="gnome-python"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="pyorbit"/> - <dep package="libgnomecanvas"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-python-desktop"> - <branch/> - <dependencies> - <dep package="gnome-python"/> - <dep package="gnome-panel"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="gtksourceview"/> - <dep package="libwnck"/> - <dep package="totem"/> - <dep package="libgtop"/> - <dep package="nautilus-cd-burner"/> - <dep package="gnome-media"/> - <dep package="metacity"/> - </dependencies> - </autotools> - <autotools id="gnome-python-extras"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gtkhtml2"/> - <dep package="gdl"/> - </dependencies> - </autotools> - <autotools id="bug-buddy"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-menus"/> - <dep package="gnome-doc-utils"/> - <dep package="evolution-data-server"/> - <dep package="libsoup"/> - </dependencies> - <suggests> - <dep package="NetworkManager"/> - </suggests> - </autotools> - <autotools id="libwnck"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="startup-notification"/> - </dependencies> - </autotools> - <autotools id="gnome-desktop" autogenargs="--with-gnome-distributor=JHBuild"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="startup-notification"/> - <dep package="gnome-themes"/> - <dep package="scrollkeeper"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-menus"> - <branch/> - <dependencies> - <dep package="intltool"/> - <dep package="gnome-common"/> - <dep package="glib"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="gnome-panel"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-desktop"/> - <dep package="libwnck"/> - <dep package="evolution-data-server"/> - <dep package="gnome-menus"/> - <dep package="gnome-vfs"/> - <dep package="libglade"/> - <dep package="gnome-doc-utils"/> - <dep package="dbus-glib"/> - </dependencies> - </autotools> - <autotools id="gnome-session"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="esound"/> - <dep package="gnome-control-center"/> - <dep package="gnome-keyring"/> - </dependencies> - </autotools> - <autotools id="gnome-applets" autogenargs="--enable-gstreamer=0.10"> - <branch/> - <dependencies> - <dep package="gnome-panel"/> - <dep package="libgtop"/> - <dep package="gail"/> - <dep package="libxklavier"/> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - <dep package="gucharmap"/> - <dep package="system-tools-backends-1.4"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="gnome-games"> - <branch/> - <dependencies> - <dep package="librsvg"/> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gob"/> - </dependencies> - </autotools> - <autotools id="libcroco" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="pango"/> - </dependencies> - </autotools> - <autotools id="librsvg" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - <dep package="gnome-common"/> - <dep package="libgsf"/> - <dep package="libcroco"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="eel"> - <branch/> - <dependencies> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - <dep package="gail"/> - <dep package="gnome-desktop"/> - <dep package="gnome-menus"/> - </dependencies> - </autotools> - <autotools id="nautilus"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="esound"/> - <dep package="eel"/> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - <dep package="gnome-desktop"/> - </dependencies> - </autotools> - <autotools id="nautilus-actions"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="nautilus-cd-burner"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="nautilus-open-terminal"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="nautilus-media" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="nautilus"/> - <dep package="gstreamer-0-8"/> - <dep package="gst-plugins-0-8"/> - </dependencies> - </autotools> - <autotools id="nautilus-vcs"> - <branch/> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="metacity"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="intltool"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libgtop"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-system-monitor"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="libgtop"/> - </dependencies> - </autotools> - <autotools id="gnome-control-center" autogenargs="--enable-gstreamer=0.10" - supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="esound"/> - <dep package="gnome-desktop"/> - <dep package="metacity"/> - <dep package="nautilus"/> - <dep package="libxklavier"/> - <dep package="gnome-menus"/> - <dep package="gnome-doc-utils"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - <autotools id="yelp"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="gnome-doc-utils"/> - <dep package="startup-notification"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="devhelp"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="gnome-utils"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gconf-editor" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <tarball id="audiofile" version="0.2.6" supports-non-srcdir-builds="no"> - <source href="http://www.68k.org/~michael/audiofile/audiofile-0.2.6.tar.gz" - size="374688" md5sum="9c1049876cd51c0f1b12c2886cce4d42"/> - </tarball> - <autotools id="esound"> - <branch/> - <dependencies> - <dep package="audiofile"/> - </dependencies> - </autotools> - <autotools id="gnome-media"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="esound"/> - <dep package="gail"/> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - <dep package="gst-plugins-good"/> - <dep package="nautilus-cd-burner"/> - </dependencies> - </autotools> - <autotools id="gdm2"> - <branch/> - <dependencies> - <dep package="librsvg"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="vte"> - <branch/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="gnome-terminal"> - <branch/> - <dependencies> - <dep package="libglade"/> - <dep package="libgnomeui"/> - <dep package="vte"/> - <dep package="startup-notification"/> - </dependencies> - </autotools> - <autotools id="gtk-engines"> - <branch/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="libgnomeprint"> - <branch/> - <dependencies> - <dep package="intltool"/> - <dep package="libart_lgpl"/> - <dep package="glib"/> - <dep package="gnome-common"/> - <dep package="pango"/> - <dep package="libgnomecups"/> - </dependencies> - </autotools> - <autotools id="libgnomeprintui"> - <branch/> - <dependencies> - <dep package="libgnomeprint"/> - <dep package="gtk+"/> - <dep package="libgnomecanvas"/> - <dep package="gnome-icon-theme"/> - </dependencies> - </autotools> - <autotools id="gedit"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-doc-utils"/> - <dep package="libgnomeprintui"/> - <dep package="gtksourceview"/> - <dep package="gnome-python-desktop"/> - </dependencies> - </autotools> - <autotools id="gedit-plugins"> - <branch/> - <dependencies> - <dep package="gedit"/> - </dependencies> - </autotools> - <autotools id="memprof"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="eog"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="libgsf"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gnome-vfs"/> - <dep package="libbonobo"/> - </dependencies> - </autotools> - <autotools id="goffice"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libgsf"/> - <dep package="libxml2"/> - <dep package="pango"/> - <dep package="libglade"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="libart_lgpl"/> - </dependencies> - </autotools> - <autotools id="gnumeric"> - <branch/> - <dependencies> - <dep package="goffice"/> - <dep package="libgsf"/> - <dep package="pygtk"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gimp" autogenargs="--disable-print"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libart_lgpl"/> - </dependencies> - </autotools> - <autotools id="glade"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="glade2c"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="sawfish"> - <branch revision="gnome-2"/> - <dependencies> - <dep package="rep-gtk"/> - </dependencies> - </autotools> - <autotools id="rep-gtk"> - <branch/> - <dependencies> - <dep package="librep"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="librep"> - <branch/> - </autotools> - <autotools id="rhythmbox"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gst-plugins-base"/> - <dep package="nautilus-cd-burner"/> - <dep package="totem"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gstreamer-0-8" autogenargs="-- --disable-plugin-builddir --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gstreamer" - revision="BRANCH-GSTREAMER-0_8" checkoutdir="gstreamer-0-8"/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - - <autotools id="gst-plugins-0-8" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins" - revision="BRANCH-GSTREAMER-0_8" checkoutdir="gst-plugins-0-8"/> - <dependencies> - <dep package="gstreamer-0-8"/> - <dep package="gnome-vfs"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - - <autotools id="gst-python-0-8" autogenargs="--" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-python" - revision="BRANCH-GSTREAMER-0_8" checkoutdir="gst-python-0-8"/> - <dependencies> - <dep package="gstreamer-0-8"/> - <dep package="gst-plugins-0-8"/> - </dependencies> - </autotools> - - <autotools id="gstreamer" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gstreamer"/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - - <autotools id="liboil"> - <branch repo="liboil.freedesktop.org" revision="liboil_0_3_6"/> - </autotools> - - <autotools id="gst-plugins-base" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins-base"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gnome-vfs"/> - <dep package="gtk+"/> - <dep package="liboil"/> - </dependencies> - </autotools> - - <autotools id="gst-plugins-good" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins-good"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="gst-plugins-ugly" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins-ugly"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="gst-plugins-bad" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-plugins-bad"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="gst-ffmpeg" autogenargs="-- --disable-tests" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-ffmpeg"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="gst-python" autogenargs="--" supports-non-srcdir-builds="no"> - <branch repo="gstreamer.freedesktop.org" module="gst-python"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - - <autotools id="planner"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - <dep package="libgsf"/> - </dependencies> - </autotools> - <autotools id="file-roller"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="gnome-doc-utils"/> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="balsa"> - <branch revision="BALSA_2"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="pan"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnet"/> - </dependencies> - </autotools> - <distutils id="pyspi"> - <branch/> - <dependencies> - <dep package="at-spi"/> - </dependencies> - </distutils> - <distutils id="dogtail"> - <branch/> - <dependencies> - <dep package="pyspi"/> - </dependencies> - <after> - <dep package="gnome-python-desktop"/> - </after> - </distutils> - <autotools id="gcalctool" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="ggv" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="ekiga" autogenargs="--with-pwlib-dir=`ptlib-config --prefix` --with-opal-dir=`ptlib-config --prefix`"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="evolution-data-server"/> - <dep package="opal" /> - </dependencies> - </autotools> - <autotools id="pwlib" autogen-sh="configure"> - <branch repo="openh323.sf.net" module="ptlib_unix" checkoutdir="pwlib" - override-checkoutdir="no" update-new-dirs="no" /> - </autotools> - <autotools id="opal" autogen-sh="configure"> - <branch repo="openh323.sf.net"/> - <dependencies> - <dep package="pwlib"/> - </dependencies> - </autotools> - <autotools id="gucharmap"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gtksourceview" autogenargs="--enable-compile-warnings=maximum"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="libgnomeprint"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="glimmer"> - <branch/> - <dependencies> - <dep package="gtksourceview"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="gdl"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="librsvg"/> - </dependencies> - </autotools> - <autotools id="gnome-build"> - <branch/> - <dependencies> - <dep package="gdl"/> - <dep package="gnome-vfs"/> - <dep package="gtkhtml2"/> - </dependencies> - </autotools> - <autotools id="scaffold"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="vte"/> - <dep package="gdl"/> - </dependencies> - </autotools> - <autotools id="libsigc++2"> - <branch revision="libsigc-2-0"/> - </autotools> - <autotools id="glibmm"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libsigc++2"/> - </dependencies> - </autotools> - <autotools id="gtkmm"> - <branch/> - <dependencies> - <dep package="glibmm"/> - <dep package="cairomm"/> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="orbitcpp"> - <branch/> - <dependencies> - <dep package="ORBit2"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomemm"> - <branch/> - <dependencies> - <dep package="libgnome"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libglademm"> - <branch/> - <dependencies> - <dep package="libglade"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libbonobomm"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gtkmm"/> - <dep package="orbitcpp"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libbonobouimm"> - <branch/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="gnomemm/libbonobomm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomecanvasmm"> - <branch/> - <dependencies> - <dep package="libgnomecanvas"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gconfmm"> - <branch/> - <dependencies> - <dep package="gconf"/> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeuimm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgnomeui"/> - <dep package="gnomemm/libgnomemm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/libgnomecanvasmm"/> - <dep package="gnomemm/libglademm"/> - <dep package="gnomemm/gnome-vfsmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gnome-vfsmm"> - <branch/> - <dependencies> - <dep package="glibmm"/> - <dep package="gnome-vfs"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libpanelappletmm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeprintmm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgnomeprint"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgnomeprintuimm"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - <dep package="gnomemm/libgnomeprintmm"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gnomemm/libgdamm"> - <branch revision="libgda-1-2"/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libgda-1-2"/> - </dependencies> - </autotools> - <autotools id="gnomemm/gtkmm_hello"> - <branch/> - <dependencies> - <dep package="gtkmm"/> - </dependencies> - </autotools> - <autotools id="regexxer"> - <branch/> - <dependencies> - <dep package="intltool"/> - <dep package="gtkmm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/libglademm"/> - </dependencies> - </autotools> - <autotools id="gnet" autogenargs="--enable-glib2"> - <branch revision="GNET_1_1"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnomeicu"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="at-spi"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - <dep package="gail"/> - </dependencies> - </autotools> - <autotools id="libgail-gnome"> - <branch/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="at-poke"> - <branch/> - <dependencies> - <dep package="libgail-gnome"/> - </dependencies> - </autotools> - <autotools id="gnome-mag"> - <branch/> - <dependencies> - <dep package="at-spi"/> - </dependencies> - </autotools> - <autotools id="gok"> - <branch/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="libwnck"/> - <dep package="esound"/> - <dep package="scrollkeeper"/> - <dep package="gnome-speech"/> - </dependencies> - </autotools> - <autotools id="gnome-speech"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - </dependencies> - </autotools> - <autotools id="gnopernicus"> - <branch/> - <dependencies> - <dep package="gconf"/> - <dep package="libgnomeui"/> - <dep package="gnome-speech"/> - <dep package="gnome-mag"/> - </dependencies> - </autotools> - <autotools id="orca"> - <branch/> - <dependencies> - <dep package="gnome-python"/> - <dep package="libgail-gnome"/> - <dep package="gnome-mag"/> - <dep package="gnome-speech"/> - <dep package="eel"/> - </dependencies> - </autotools> - <autotools id="dasher" autogenargs="--with-a11y --with-gnome"> - <branch/> - <dependencies> - <dep package="at-spi"/> - <dep package="libgnomeui"/> - <dep package="gnome-speech"/> - <dep package="gnome-vfs"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-screensaver"> - <branch/> - <dependencies> - <dep package="gconf"/> - <dep package="gtk+"/> - <dep package="dbus"/> - <dep package="gnome-menus"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-power-manager"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="hal"/> - <dep package="libwnck"/> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="intltool"/> - <dep package="libglade"/> - <dep package="gnome-doc-utils"/> - </dependencies> - <suggests> - <dep package="libnotify"/> - </suggests> - </autotools> - <autotools id="gthumb"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-vfs"/> - <dep package="libglade"/> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="fast-user-switch-applet"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="libglade"/> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="gnome-mount" autogenargs="--enable-nautilus-extension"> - <branch/> - <dependencies> - <dep package="gnome-keyring"/> - <dep package="libgnomeui"/> - <dep package="dbus"/> - <dep package="hal"/> - <dep package="gtk+"/> - <dep package="intltool"/> - <dep package="libglade"/> - <dep package="eel"/> - <dep package="nautilus"/> - </dependencies> - </autotools> - <autotools id="libnotify"> - <branch repo="svn.galago-project.org" module="trunk/libnotify"/> - <dependencies> - <dep package="gtk+"/> - <dep package="dbus"/> - </dependencies> - </autotools> - <autotools id="libsexy"> - <branch repo="osiris.chipx86.com" module="trunk/libsexy"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - <dep package="iso-codes"/> - </dependencies> - </autotools> - <autotools id="notification-daemon"> - <branch repo="svn.galago-project.org" module="trunk/notification-daemon"/> - <dependencies> - <dep package="gtk+"/> - <dep package="dbus"/> - <dep package="libsexy"/> - </dependencies> - </autotools> - <autotools id="alacarte"> - <branch/> - <dependencies> - <dep package="gnome-menus"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - - <metamodule id="meta-gnome-devel-platform"> - <dependencies> - <dep package="libgnome"/> - <dep package="libbonobo"/> - <dep package="libbonoboui"/> - <dep package="libgnomeui"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-core"> - <dependencies> - <dep package="gnome-desktop"/> - <dep package="gnome-panel"/> - <dep package="gnome-session"/> - <dep package="gnome-terminal"/> - <dep package="gnome-applets"/> - </dependencies> - </metamodule> - <metamodule id="meta-nautilus"> - <dependencies> - <dep package="nautilus"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-desktop"> - <dependencies> - <dep package="meta-gnome-core"/> - <dep package="gnome-control-center"/> - <dep package="meta-nautilus"/> - <dep package="yelp"/> - <dep package="bug-buddy"/> - <dep package="gedit"/> - <dep package="gtk-engines"/> - <dep package="eog"/> - <dep package="metacity"/> - <dep package="gconf-editor"/> - <dep package="gnome-utils"/> - <dep package="gnome-system-monitor"/> - <dep package="gstreamer"/> - <dep package="gnome-media"/> - <dep package="gnome-netstatus"/> - <dep package="gcalctool"/> - <dep package="gucharmap"/> - <dep package="nautilus-cd-burner"/> - <dep package="zenity"/> - <dep package="libgail-gnome"/> - <dep package="gnopernicus"/> - <dep package="gok"/> - <dep package="epiphany"/> - <dep package="gnome-games"/> - <dep package="gnome-user-docs"/> - <dep package="file-roller"/> - <dep package="gnome-system-tools"/> - <dep package="gnome-nettool"/> - <dep package="vino"/> - <dep package="gnome-volume-manager"/> - <dep package="totem"/> - <dep package="gnome-menus"/> - <dep package="gnome-backgrounds"/> - <dep package="sound-juicer"/> - <dep package="evolution"/> - <dep package="evolution-webcal"/> - <dep package="evolution-exchange"/> - <dep package="ekiga"/> - <dep package="evince"/> - <dep package="dasher"/> - <dep package="gnome-keyring-manager"/> - <dep package="deskbar-applet"/> - <dep package="fast-user-switch-applet"/> - <dep package="gnome-screensaver"/> - <dep package="meta-gnome-admin"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-admin"> - <dependencies> - <dep package="pessulus"/> - <dep package="sabayon"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-devel-tools"> - <dependencies> - <dep package="glade"/> - <dep package="memprof"/> - <dep package="gconf-editor"/> - <dep package="devhelp"/> - <dep package="nautilus-vcs"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-python"> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gnome-python-desktop"/> - </dependencies> - <after> - <dep package="gnome-python-extras"/> - </after> - </metamodule> - <metamodule id="meta-gnome-c++"> - <dependencies> - <dep package="gtkmm"/> - <dep package="gnomemm/libgnomeuimm"/> - <dep package="gnomemm/gnome-vfsmm"/> - <dep package="gnomemm/libpanelappletmm"/> - <dep package="gnomemm/libbonobouimm"/> - <dep package="gnomemm/libgnomeprintuimm"/> - <dep package="libxml++"/> - <dep package="gnomemm/libgdamm"/> - <dep package="bakery"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-accessibility"> - <dependencies> - <dep package="libgail-gnome"/> - <dep package="at-poke"/> - <dep package="dasher"/> - <dep package="gnome-mag"/> - <dep package="gok"/> - <dep package="gnome-speech"/> - <dep package="gnopernicus"/> - </dependencies> - </metamodule> - <metamodule id="meta-gnome-proposed"> - <dependencies> - <dep package="alacarte"/> - <dep package="gnome-power-manager"/> - <dep package="orca"/> - </dependencies> - </metamodule> - <autotools id="sodipodi"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnomeprintui"/> - <dep package="libart_lgpl"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gnome-themes"> - <branch/> - <dependencies> - <dep package="gtk-engines"/> - </dependencies> - </autotools> - <autotools id="gob"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="libgnetwork"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gconf"/> - <dep package="intltool"/> - </dependencies> - </autotools> - <autotools id="libgircclient"> - <branch/> - <dependencies> - <dep package="libgnetwork"/> - </dependencies> - </autotools> - <autotools id="gnomechat"> - <branch/> - <dependencies> - <dep package="libgnetwork"/> - <dep package="libgircclient"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <mozillamodule id="mozilla" autogenargs="--enable-default-toolkit=gtk2 --disable-mailnews --disable-ldap --disable-debug --enable-optimize --disable-tests --enable-crypto --enable-xft --with-system-zlib --disable-freetype2 --enable-application=browser" cvsroot="mozilla.org" revision="MOZILLA_1_7_BRANCH"> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </mozillamodule> - <autotools id="enchant"> - <branch repo="anoncvs.abisource.com"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="epiphany"> - <branch/> - <dependencies> - <dep package="iso-codes"/> - <dep package="libgnomeui"/> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gnome-doc-utils"/> - </dependencies> - <suggests> - <dep package="enchant"/> - </suggests> - </autotools> - <autotools id="epiphany-extensions"> - <branch/> - <dependencies> - <dep package="epiphany"/> - </dependencies> - </autotools> - <autotools id="galeon"> - <branch/> - <dependencies> - <dep package="mozilla"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="libsoup"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="gnutls"/> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gtkhtml"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="gail"/> - <dep package="libgnomeprint"/> - <dep package="libgnomeprintui"/> - <dep package="libsoup"/> - </dependencies> - </autotools> - <autotools id="evolution-data-server" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="libbonobo"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - <dep package="libsoup"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="gnome-vfs"/> - <dep package="mozilla"/> - </dependencies> - </autotools> - <autotools id="evolution"> - <branch/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="gtkhtml"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - </dependencies> - <after> - <dep package="libnotify"/> - </after> - </autotools> - <autotools id="evolution-webcal"> - <branch/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="libsoup"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="evolution-exchange"> - <branch/> - <dependencies> - <dep package="evolution-data-server"/> - <dep package="evolution"/> - <dep package="libsoup"/> - </dependencies> - </autotools> - <tarball id="xchat" version="2.6.2"> - <source href="http://xchat.org/files/source/2.6/xchat-2.6.2.tar.bz2" - size="1046910" md5sum="6b534baf9a4df6bf23d7d16f7e4eb379"/> - <dependencies> - <dep package="gtk+"/> - <dep package="libxml2"/> - </dependencies> - </tarball> - <tarball id="camorama" version="0.17"> - <source href="http://camorama.fixedgear.org/downloads/camorama-0.17.tar.bz2" - size="312233" md5sum="2b2784af53a1ba8fa4419aa806967b35"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </tarball> - <autotools id="gtk-engines-cleanice"> - <branch repo="elysium-project.sf.net"/> - <dependencies> - <dep package="gtk+"/> - </dependencies> - </autotools> - <autotools id="gaim"> - <branch repo="gaim.sf.net" module="trunk" checkoutdir="gaim"/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="zenity"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="libgnomecanvas"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gpdf"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - </dependencies> - </autotools> - <autotools id="gnome-netstatus"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-panel"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-doc-utils"> - <branch/> - <dependencies> - <dep package="libxslt"/> - <dep package="intltool"/> - <dep package="glib"/> - </dependencies> - </autotools> - <tarball id="libmusicbrainz" version="2.1.2"> - <source href="http://ftp.musicbrainz.org/pub/musicbrainz/libmusicbrainz-2.1.2.tar.gz" - size="504432" md5sum="88d35af903665fecbdee77eb6d5e6cdd"/> - </tarball> - <autotools id="totem" autogenargs="--enable-gstreamer"> - <branch/> - <dependencies> - <dep package="gnome-desktop"/> - <dep package="nautilus-cd-burner"/> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - <dep package="gst-plugins-good"/> - <dep package="libmusicbrainz"/> - <dep package="iso-codes"/> - </dependencies> - </autotools> - <autotools id="gnome-themes-extras"> - <branch/> - <dependencies> - <dep package="gnome-themes"/> - </dependencies> - </autotools> - - <autotools id="libgda"> - <branch module="libgda"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="libgda-1-2"> - <branch module="libgda" revision="release-1-2-branch" - checkoutdir="libgda-1-2"/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - - <autotools id="libgnomedb" autogenargs="--enable-gnome=yes"> - <branch/> - <dependencies> - <dep package="libgda"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - </dependencies> - </autotools> - <autotools id="mergeant"> - <branch/> - <dependencies> - <dep package="libgnomedb"/> - </dependencies> - </autotools> - <autotools id="gtranslator"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-spell"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="libgnomecups"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gnome-cups-manager"> - <branch/> - <dependencies> - <dep package="libgnomecups"/> - <dep package="libgnomeui"/> - <dep package="libglade"/> - </dependencies> - </autotools> - <autotools id="libxml++"> - <branch/> - <dependencies> - <dep package="libxml2"/> - <dep package="glibmm"/> - </dependencies> - </autotools> - <autotools id="bakery"> - <branch/> - <dependencies> - <dep package="libxml++"/> - <dep package="gtkmm"/> - <dep package="gnomemm/libglademm"/> - <dep package="gnomemm/gconfmm"/> - <dep package="gnomemm/gnome-vfsmm"/> - </dependencies> - </autotools> - <autotools id="gnome-hello"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="liboobs"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="dbus"/> - <dep package="gtk-doc"/> - <dep package="system-tools-backends"/> - </dependencies> - </autotools> - <autotools id="gnome-system-tools"> - <branch revision="gnome-2-14"/> - <dependencies> - <dep package="glib"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="libgnomeui"/> - <dep package="libbonoboui"/> - <dep package="libglade"/> - <dep package="nautilus"/> - <dep package="system-tools-backends"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="gnome-user-docs"> - <branch/> - <dependencies> - <dep package="scrollkeeper"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="loudmouth"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gossip"> - <branch/> - <dependencies> - <dep package="loudmouth"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="conglomerate"> - <branch/> - <dependencies> - <dep package="libxslt"/> - <dep package="gconf"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="sound-juicer"> - <branch/> - <dependencies> - <dep package="gnome-doc-utils"/> - <dep package="libgnomeui"/> - <dep package="gnome-media"/> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - <dep package="gst-plugins-good"/> - <dep package="nautilus-cd-burner"/> - </dependencies> - </autotools> - <autotools id="gnome-network"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <tarball id="guile" version="1.8.0"> - <source href="ftp://ftp.gnu.org/gnu/guile/guile-1.8.0.tar.gz" - size="3691677" md5sum="3f47443602f93e94bf43218d9b86099d"/> - </tarball> - <tarball id="autogen" version="5.8.4"> - <source href="http://internap.dl.sourceforge.net/sourceforge/autogen/autogen-5.8.4.tar.bz2" - size="931015" md5sum="b65d4b9e3ddbcfd5418b708858c05b66"/> - <dependencies> - <dep package="guile"/> - </dependencies> - </tarball> - <autotools id="anjuta"> - <branch/> - <dependencies> - <dep package="libbonoboui"/> - <dep package="libgnomeprintui"/> - <dep package="vte"/> - <dep package="gnome-build"/> - <dep package="autogen"/> - <dep package="devhelp"/> - </dependencies> - </autotools> - <autotools id="OpenApplet"> - <branch/> - <dependencies> - <dep package="gnome-panel"/> - </dependencies> - </autotools> - <autotools id="gtetrinet"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="glom"> - <branch/> - <dependencies> - <dep package="gnomemm/libgdamm"/> - <dep package="bakery"/> - <dep package="gnomemm/libgnomecanvasmm"/> - <dep package="libgnome"/> - <dep package="iso-codes"/> - <dep package="pygtk"/> - <dep package="gnome-python-extras"/> - </dependencies> - </autotools> - <autotools id="vino"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libglade"/> - <dep package="gconf"/> - <dep package="gnutls"/> - </dependencies> - </autotools> - <autotools id="gnome-keyring-manager" autogenargs="--disable-more-warnings"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="gnome-keyring"/> - <dep package="gconf"/> - </dependencies> - </autotools> - <autotools id="gnome-volume-manager"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libglade"/> - <dep package="hal"/> - </dependencies> - </autotools> - <metamodule id="meta-storage"> - <dependencies> - <dep package="storage/storage-store"/> - <dep package="storage/vfs"/> - <dep package="storage/applet"/> - </dependencies> - </metamodule> - <autotools id="storage/storage-store"> - <branch/> - <dependencies> - <dep package="dbus"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage"> - <branch/> - <dependencies> - <dep package="gnome-vfs"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage-translators"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - </dependencies> - </autotools> - <autotools id="storage/vfs"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - <dep package="storage/libstorage-translators"/> - </dependencies> - </autotools> - <autotools id="storage/pet"> - <branch/> - </autotools> - <autotools id="storage/libmrs"> - <branch/> - <dependencies> - <dep package="storage/pet"/> - </dependencies> - </autotools> - <autotools id="storage/libmrs-converter"> - <branch/> - <dependencies> - <dep package="storage/libmrs"/> - </dependencies> - </autotools> - <autotools id="storage/libstorage-nl"> - <branch/> - <dependencies> - <dep package="storage/libstorage"/> - <dep package="storage/libmrs"/> - <dep package="storage/libmrs-converter"/> - </dependencies> - </autotools> - <autotools id="storage/applet"> - <branch/> - <dependencies> - <dep package="gnome-python"/> - <dep package="storage/libstorage-nl"/> - </dependencies> - </autotools> - <autotools id="gnome-nettool"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="gconf"/> - <dep package="libglade"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="monkey-bubble"> - <branch/> - <dependencies> - <dep package="gstreamer-0-8"/> - <dep package="gst-plugins-0-8"/> - <dep package="libxml2"/> - <dep package="gconf"/> - <dep package="librsvg"/> - <dep package="libgnomeui"/> - </dependencies> - </autotools> - <autotools id="gnome-schedule"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="yelp"/> - </dependencies> - </autotools> - <autotools id="gnome-backgrounds"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="evince"> - <branch/> - <dependencies> - <dep package="libgnomeui"/> - <dep package="libgnomeprintui"/> - <dep package="poppler"/> - <dep package="gnome-doc-utils"/> - </dependencies> - </autotools> - <autotools id="nautilus-python" supports-non-srcdir-builds="no"> - <branch/> - <dependencies> - <dep package="nautilus"/> - <dep package="pygtk"/> - <dep package="gnome-python"/> - </dependencies> - </autotools> - <autotools id="inkscape"> - <branch repo="inkscape.sf.net"/> - <dependencies> - <dep package="gtkmm"/> - <dep package="libxslt"/> - </dependencies> - </autotools> - <autotools id="NetworkManager"> - <branch repo="gnome.org"/> - <dependencies> - <dep package="dbus"/> - </dependencies> - </autotools> - <autotools id="atomix"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="libgnome"/> - <dep package="libgnomeui"/> - <dep package="libxml2"/> - <dep package="libgnomecanvas"/> - <dep package="libbonoboui"/> - </dependencies> - </autotools> - <autotools id="deskbar-applet"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="gnome-desktop"/> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gnome-python-desktop"/> - </dependencies> - </autotools> - <autotools id="pessulus"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - </dependencies> - </autotools> - <autotools id="sabayon"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="pygtk"/> - </dependencies> - </autotools> - <autotools id="muine"> - <branch/> - <dependencies> - <dep package="gtk+"/> - <dep package="gstreamer"/> - </dependencies> - </autotools> - <autotools id="gnonlin"> - <branch repo="gstreamer.freedesktop.org" module="gnonlin"/> - <dependencies> - <dep package="gstreamer"/> - <dep package="gst-plugins-base"/> - </dependencies> - </autotools> - <autotools id="pitivi"> - <branch/> - <dependencies> - <dep package="pygtk"/> - <dep package="gnome-python"/> - <dep package="gstreamer"/> - <dep package="gst-python"/> - <dep package="gnonlin"/> - </dependencies> - </autotools> - <autotools id="xchat-gnome"> - <branch repo="svn.navi.cx" module="misc/trunk/xchat-gnome"/> - <dependencies> - <dep package="gtk+" /> - <dep package="gconf" /> - <dep package="libgnomeui" /> - <dep package="libglade" /> - <dep package="gnome-vfs" /> - <dep package="libsexy" /> - </dependencies> - </autotools> -</moduleset> diff --git a/scripts/jhbuild/modulesets/gnutls.modules b/scripts/jhbuild/modulesets/gnutls.modules deleted file mode 100644 index e8f75cfe86..0000000000 --- a/scripts/jhbuild/modulesets/gnutls.modules +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*--> -<!DOCTYPE moduleset SYSTEM "moduleset.dtd"> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - <tarball id="libgpg-error" version="1.3"> - <source href="http://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.3.tar.bz2" - size="452266" md5sum="d978065d62cde48e79497b63f80ba8fc" /> - </tarball> - <tarball id="libgcrypt" version="1.2.2"> - <source href="http://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.2.2.tar.bz2" - size="780315" md5sum="4a8a9a7572892ae3803a5aa558e52e02" /> - <dependencies> - <dep package="libgpg-error" /> - </dependencies> - </tarball> - <tarball id="libtasn1" version="0.3.4" supports-non-srcdir-builds="no"> - <source href="http://ftp.gnupg.org/gcrypt/alpha/gnutls/libtasn1/libtasn1-0.3.4.tar.gz" - size="1246545" md5sum="1dbfce0e1fbd6aebc1a4506814c23d35" /> - </tarball> - <tarball id="opencdk" version="0.5.8" supports-non-srcdir-builds="no"> - <source href="http://ftp.gnupg.org/gcrypt/alpha/gnutls/opencdk/opencdk-0.5.8.tar.gz" - size="497122" md5sum="900c4dee7712845c19d7b2d2a93ea546" /> - <dependencies> - <dep package="libgcrypt" /> - </dependencies> - </tarball> - <tarball id="gnutls" version="1.4.0"> - <source href="http://ftp.gnupg.org/gcrypt/alpha/gnutls/gnutls-1.4.0.tar.bz2" - size="3281324" md5sum="9e1e1b07e971c604923ec394f6922301" /> - <dependencies> - <dep package="libgcrypt" /> - <dep package="libtasn1" /> - <dep package="opencdk" /> - </dependencies> - </tarball> -</moduleset> diff --git a/scripts/jhbuild/modulesets/gtk.modules b/scripts/jhbuild/modulesets/gtk.modules deleted file mode 100644 index a26a44c2ac..0000000000 --- a/scripts/jhbuild/modulesets/gtk.modules +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0"?><!--*- mode: nxml -*--> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - <repository type="cvs" name="gnome.org" default="yes" - cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome" - password=""/> - <repository type="cvs" name="mime.freedesktop.org" - cvsroot=":pserver:anoncvs@cvs.freedesktop.org:/cvs/mime" - password=""/> - - <include href="freedesktop.modules"/> - - <autotools id="gnome-common"> - <branch/> - </autotools> - <autotools id="intltool"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="shared-mime-info" supports-non-srcdir-builds="no"> - <branch repo="mime.freedesktop.org"/> - <dependencies> - <dep package="intltool"/> - </dependencies> - </autotools> - <autotools id="libxml2"> - <branch module="gnome-xml" checkoutdir="libxml2"/> - </autotools> - <autotools id="libxslt"> - <branch/> - <dependencies> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gtk-doc"> - <branch/> - <dependencies> - <dep package="libxslt"/> - </dependencies> - </autotools> - <autotools id="glib"> - <branch/> - <dependencies> - <dep package="gtk-doc"/> - </dependencies> - </autotools> - <autotools id="pango"> - <branch/> - <dependencies> - <dep package="glib"/> - <dep package="cairo"/> - <dep package="libXft"/> - </dependencies> - </autotools> - <autotools id="atk"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gtk+"> - <branch/> - <dependencies> - <dep package="cairo"/> - <dep package="atk"/> - <dep package="pango"/> - <dep package="shared-mime-info"/> - </dependencies> - </autotools> -</moduleset> diff --git a/scripts/jhbuild/modulesets/gtk28.modules b/scripts/jhbuild/modulesets/gtk28.modules deleted file mode 100644 index 5fe56ea926..0000000000 --- a/scripts/jhbuild/modulesets/gtk28.modules +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0"?><!--*- mode: nxml -*--> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - <repository type="cvs" name="gnome.org" default="yes" - cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome" - password=""/> - <repository type="cvs" name="mime.freedesktop.org" - cvsroot=":pserver:anoncvs@cvs.freedesktop.org:/cvs/mime" - password=""/> - - <include href="freedesktop.modules"/> - - <autotools id="gnome-common"> - <branch/> - </autotools> - <autotools id="intltool"> - <branch/> - <dependencies> - <dep package="gnome-common"/> - </dependencies> - </autotools> - <autotools id="shared-mime-info" supports-non-srcdir-builds="no"> - <branch repo="mime.freedesktop.org"/> - <dependencies> - <dep package="intltool"/> - </dependencies> - </autotools> - <autotools id="libxml2"> - <branch module="gnome-xml" checkoutdir="libxml2"/> - </autotools> - <autotools id="libxslt"> - <branch/> - <dependencies> - <dep package="libxml2"/> - </dependencies> - </autotools> - <autotools id="gtk-doc"> - <branch/> - <dependencies> - <dep package="libxslt"/> - </dependencies> - </autotools> - <autotools id="glib"> - <branch revision="glib-2-8"/> - <dependencies> - <dep package="gtk-doc"/> - </dependencies> - </autotools> - <autotools id="pango"> - <branch revision="pango-1-10"/> - <dependencies> - <dep package="glib"/> - <dep package="cairo"/> - <dep package="libXft"/> - </dependencies> - </autotools> - <autotools id="atk"> - <branch/> - <dependencies> - <dep package="glib"/> - </dependencies> - </autotools> - <autotools id="gtk+"> - <branch revision="gtk-2-8"/> - <dependencies> - <dep package="cairo"/> - <dep package="atk"/> - <dep package="pango"/> - <dep package="shared-mime-info"/> - </dependencies> - </autotools> -</moduleset> diff --git a/scripts/jhbuild/modulesets/moduleset.dtd b/scripts/jhbuild/modulesets/moduleset.dtd deleted file mode 100644 index bee7c8c17e..0000000000 --- a/scripts/jhbuild/modulesets/moduleset.dtd +++ /dev/null @@ -1,115 +0,0 @@ -<!ELEMENT moduleset ((cvsroot|svnroot|arch-archive|darcs-archive)*, - (include|cvsmodule|svnmodule|archmodule|darcsmodule| - metamodule|tarball|mozillamodule)*) > - -<!ELEMENT cvsroot EMPTY > -<!ATTLIST cvsroot - name CDATA #REQUIRED - root CDATA #REQUIRED - password CDATA #IMPLIED - default (yes|no) 'no' > - -<!ELEMENT svnroot EMPTY > -<!ATTLIST svnroot - name CDATA #REQUIRED - href CDATA #REQUIRED - default (yes|no) 'no' > - -<!ELEMENT arch-archive EMPTY > -<!ATTLIST arch-archive - name CDATA #REQUIRED - href CDATA #REQUIRED - default (yes|no) 'no' > - -<!ELEMENT darcs-archive EMPTY > -<!ATTLIST darcs-archive - name CDATA #REQUIRED - href CDATA #REQUIRED - default (yes|no) 'no' > - -<!ELEMENT include EMPTY > -<!ATTLIST include - href CDATA #REQUIRED > - -<!ELEMENT cvsmodule (dependencies?,suggests?) > -<!ATTLIST cvsmodule - id CDATA #REQUIRED - module CDATA #IMPLIED - revision CDATA #IMPLIED - checkoutdir CDATA #IMPLIED - autogenargs CDATA #IMPLIED - makeargs CDATA #IMPLIED - cvsroot CDATA #IMPLIED - supports-non-srcdir-builds (yes|no) 'yes' > - -<!ELEMENT svnmodule (dependencies?,suggests?) > -<!ATTLIST svnmodule - id CDATA #REQUIRED - module CDATA #IMPLIED - checkoutdir CDATA #IMPLIED - autogenargs CDATA #IMPLIED - makeargs CDATA #IMPLIED - root CDATA #IMPLIED - supports-non-srcdir-builds (yes|no) 'yes' > - -<!ELEMENT archmodule (dependencies?,suggests?) > -<!ATTLIST archmodule - id CDATA #REQUIRED - version CDATA #IMPLIED - checkoutdir CDATA #IMPLIED - autogenargs CDATA #IMPLIED - makeargs CDATA #IMPLIED - root CDATA #IMPLIED - supports-non-srcdir-builds (yes|no) 'yes' > - -<!ELEMENT darcsmodule (dependencies?,suggests?) > -<!ATTLIST darcsmodule - id CDATA #REQUIRED - checkoutdir CDATA #IMPLIED - autogenargs CDATA #IMPLIED - makeargs CDATA #IMPLIED - root CDATA #IMPLIED - supports-non-srcdir-builds (yes|no) 'yes' > - -<!ELEMENT metamodule (dependencies) > -<!ATTLIST metamodule - id CDATA #REQUIRED > - -<!ELEMENT tarball - (source,patches?,dependencies?,suggests?) > -<!ATTLIST tarball - id CDATA #REQUIRED - version CDATA #REQUIRED - checkoutdir CDATA #IMPLIED - autogenargs CDATA #IMPLIED - makeargs CDATA #IMPLIED - supports-non-srcdir-builds (yes|no) 'yes' > - -<!ELEMENT mozillamodule (dependencies?,suggests?) > -<!ATTLIST mozillamodule - id CDATA #REQUIRED - module CDATA #IMPLIED - revision CDATA #IMPLIED - checkoutdir CDATA #IMPLIED - autogenargs CDATA #IMPLIED - makeargs CDATA #IMPLIED - cvsroot CDATA #IMPLIED > - -<!-- Tarball sub-elements --> -<!ELEMENT source EMPTY > -<!ATTLIST source - href CDATA #REQUIRED - size CDATA #IMPLIED - md5sum CDATA #IMPLIED > -<!ELEMENT patches (patch)* > -<!ELEMENT patch EMPTY > -<!ATTLIST patch - file CDATA #REQUIRED - strip CDATA '0' > - -<!-- common sub-elements --> -<!ELEMENT dependencies (dep*) > -<!ELEMENT suggests (dep*) > -<!ELEMENT dep EMPTY > -<!ATTLIST dep - package CDATA #REQUIRED > diff --git a/scripts/jhbuild/modulesets/moduleset.rnc b/scripts/jhbuild/modulesets/moduleset.rnc deleted file mode 100644 index b46122101d..0000000000 --- a/scripts/jhbuild/modulesets/moduleset.rnc +++ /dev/null @@ -1,131 +0,0 @@ -default namespace = "" - -start = moduleset - -boolean = "yes" | "no" - -moduleset = element moduleset { repository*, - (\include|package)* } - -repository_cvs = attribute type { "cvs" }, - attribute cvsroot { text }, - attribute password { text }? -repository_svn = attribute type { "svn" }, - attribute href { xsd:anyURI } -repository_arch = attribute type { "arch" }, - attribute archive { text }, - attribute href { xsd:anyURI }? -repository_darcs = attribute type { "darcs" }, - attribute href { xsd:anyURI } -repository_git = attribute type { "git" }, - attribute href { xsd:anyURI } -repository_tarball = attribute type { "tarball" }, - attribute href { xsd:anyURI } - -repository = element repository { - attribute name { text }, - attribute default { boolean }?, - (repository_cvs|repository_svn|repository_arch| - repository_darcs|repository_git|repository_tarball) -} - -\include = element include { - attribute href { xsd:anyURI } -} - -package = autotools | - metamodule | - distutils | - perl | - tarball | - mozillamodule - -dep = element dep { - attribute package { text } -} -dependencies = element dependencies { dep* } -after = element after { dep* } | element suggests { dep* } - -common = attribute id { text } & dependencies* & after* - -branch_cvs = attribute module { text }?, - attribute checkoutdir { text }?, - attribute revision { text}?, - attribute override-checkoutdir { boolean }?, - attribute update-new-dirs { boolean }? -branch_svn = attribute module { xsd:anyURI }?, - attribute checkoutdir { text }? -branch_arch = attribute module { xsd:anyURI }?, - attribute checkoutdir { text }? -branch_darcs = attribute module { xsd:anyURI }?, - attribute checkoutdir { text }? -branch_git = attribute module { xsd:anyURI }?, - attribute checkoutdir { text }? -branch_tarball = attribute module { xsd:anyURI }, - attribute version { text }, - attribute size { text }?, - attribute md5sum { text }?, - element patch { - attribute file { text }, - attribute strip { text }? - }* - - -branch = element branch { - attribute repo { text }?, - (branch_cvs|branch_svn|branch_arch|branch_darcs|branch_git|branch_tarball) -} - -autotools = element autotools { - branch & - attribute autogen-sh { text }? & - attribute autogenargs { text }? & - attribute makeargs { text }? & - attribute supports-non-srcdir-builds { boolean }? & - common -} - -metamodule = element metamodule { common } - -distutils = element distutils { - branch & - attribute supports-non-srcdir-builds { boolean }? & - common -} - -perl = element perl { - branch & - attribute makeargs { text }? & - common -} - -tarball = element tarball { - attribute version { text }, - attribute checkoutdir { text }?, - attribute autogenargs { text }?, - attribute makeargs { text }?, - attribute supports-non-srcdir-builds { boolean }?, - - (element source { - attribute href { text }, - attribute size { text }?, - attribute md5sum { text }? } & - element patches { - element patch { - attribute file { text }, - attribute strip { text }? - }+ }? & - common) -} - -mozillamodule = element mozillamodule { - attribute module { text }?, - attribute revision { text }?, - attribute checkoutdir { text }?, - attribute autogenargs { text }?, - attribute makeargs { text }?, - attribute cvsroot { text }?, - attribute root { text }?, - common -} - diff --git a/scripts/jhbuild/modulesets/moduleset.xsl b/scripts/jhbuild/modulesets/moduleset.xsl deleted file mode 100644 index a057bfa692..0000000000 --- a/scripts/jhbuild/modulesets/moduleset.xsl +++ /dev/null @@ -1,283 +0,0 @@ -<?xml version='1.0'?> <!--*- mode: nxml -*--> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - version="1.0"> - - <xsl:output method="html" encoding="ISO-8859-1" indent="yes" /> - <xsl:key name="module-id" match="moduleset/*" use="@id" /> - - <xsl:template match="/"> - <html> - <head> - <title>Module Set</title> - <style type="text/css"> - <xsl:text> - div.cvsmodule, div.mozillamodule { - padding: 0.5em; - margin: 0.5em; - background: #87CEFA; - } - div.svnmodule { - padding: 0.5em; - margin: 0.5em; - background: #67AEDA; - } - div.metamodule { - padding: 0.5em; - margin: 0.5em; - background: #F08080; - } - div.tarball { - padding: 0.5em; - margin: 0.5em; - background: #EEDD82; - } - </xsl:text> - </style> - </head> - <body> - <xsl:apply-templates /> - </body> - </html> - </xsl:template> - - <xsl:template match="moduleset"> - <h1>Module Set</h1> - <xsl:apply-templates /> - </xsl:template> - - <xsl:template match="dependencies"> - <xsl:variable name="deps" select="dep/@package" /> - <xsl:for-each select="$deps"> - <a href="#{generate-id(key('module-id', .))}"> - <xsl:value-of select="." /> - </a> - <xsl:if test="not($deps[last()] = .)"> - <xsl:text>, </xsl:text> - </xsl:if> - </xsl:for-each> - </xsl:template> - - <xsl:template match="cvsmodule"> - <div class="{name(.)}"> - <h2> - <xsl:value-of select="@id" /> - <a name="{generate-id(.)}" /> - </h2> - <table> - <tr> - <th align="left">Module:</th> - <td> - <xsl:choose> - <xsl:when test="@module"> - <xsl:value-of select="@module" /> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="@id" /> - </xsl:otherwise> - </xsl:choose> - <xsl:if test="@revision"> - <xsl:text> rv:</xsl:text> - <xsl:value-of select="@revision" /> - </xsl:if> - </td> - </tr> - <xsl:if test="@checkoutdir"> - <tr> - <th align="left">Checkout directory:</th> - <td><xsl:value-of select="@checkoutdir" /></td> - </tr> - </xsl:if> - <xsl:if test="@autogenargs"> - <tr> - <th align="left">Autogen args:</th> - <td><xsl:value-of select="@autogenargs" /></td> - </tr> - </xsl:if> - <xsl:if test="@cvsroot"> - <tr> - <th align="left">CVS Root:</th> - <td><xsl:value-of select="@cvsroot" /></td> - </tr> - </xsl:if> - <xsl:if test="dependencies"> - <tr> - <th align="left" valign="top">Dependencies:</th> - <td><xsl:apply-templates select="dependencies" /></td> - </tr> - </xsl:if> - </table> - </div> - </xsl:template> - - <xsl:template match="svnmodule"> - <div class="{name(.)}"> - <h2> - <xsl:value-of select="@id" /> - <a name="{generate-id(.)}" /> - </h2> - <table> - <tr> - <th align="left">Module:</th> - <td> - <xsl:choose> - <xsl:when test="@module"> - <xsl:value-of select="@module" /> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="@id" /> - </xsl:otherwise> - </xsl:choose> - </td> - </tr> - <xsl:if test="@checkoutdir"> - <tr> - <th align="left">Checkout directory:</th> - <td><xsl:value-of select="@checkoutdir" /></td> - </tr> - </xsl:if> - <xsl:if test="@autogenargs"> - <tr> - <th align="left">Autogen args:</th> - <td><xsl:value-of select="@autogenargs" /></td> - </tr> - </xsl:if> - <xsl:if test="@svnroot"> - <tr> - <th align="left">SVN Repository:</th> - <td><xsl:value-of select="@svnroot" /><xsl:if test="@path"><xsl:value-of select="@path" /></xsl:if></td> - </tr> - </xsl:if> - <xsl:if test="dependencies"> - <tr> - <th align="left" valign="top">Dependencies:</th> - <td><xsl:apply-templates select="dependencies" /></td> - </tr> - </xsl:if> - </table> - </div> - </xsl:template> - - <xsl:template match="metamodule"> - <div class="{name(.)}"> - <h2> - <xsl:value-of select="@id" /> - <a name="{generate-id(.)}" /> - </h2> - <table> - <xsl:if test="dependencies"> - <tr> - <th align="left" valign="top">Dependencies:</th> - <td><xsl:apply-templates select="dependencies" /></td> - </tr> - </xsl:if> - </table> - </div> - </xsl:template> - - <xsl:template match="patches"> - <ul> - <xsl:for-each select="patch"> - <li><xsl:value-of select="." /></li> - </xsl:for-each> - </ul> - </xsl:template> - - <xsl:template match="tarball"> - <div class="{name(.)}"> - <h2> - <xsl:value-of select="@id" /> - <a name="{generate-id(.)}" /> - </h2> - <table> - <tr> - <th align="left">Version:</th> - <td><xsl:value-of select="@version" /></td> - </tr> - <xsl:if test="@versioncheck"> - <tr> - <th align="left">Version check:</th> - <td><xsl:value-of select="@versioncheck" /></td> - </tr> - </xsl:if> - <tr> - <th align="left">Source:</th> - <td> - <a href="{source/@href}"> - <xsl:value-of select="source/@href" /> - </a> - <xsl:if test="source/@size"> - <xsl:text> (</xsl:text> - <xsl:value-of select="source/@size" /> - <xsl:text> bytes)</xsl:text> - </xsl:if> - </td> - </tr> - <xsl:if test="patches"> - <tr> - <th align="left" valign="top">Patches:</th> - <td><xsl:apply-templates select="patches" /></td> - </tr> - </xsl:if> - <xsl:if test="dependencies"> - <tr> - <th align="left" valign="top">Dependencies:</th> - <td><xsl:apply-templates select="dependencies" /></td> - </tr> - </xsl:if> - </table> - </div> - </xsl:template> - - <xsl:template match="mozillamodule"> - <div class="{name(.)}"> - <h2> - <xsl:value-of select="@id" /> - <a name="{generate-id(.)}" /> - </h2> - <table> - <tr> - <th align="left">Module:</th> - <td> - <xsl:choose> - <xsl:when test="@module"> - <xsl:value-of select="@module" /> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="@id" /> - </xsl:otherwise> - </xsl:choose> - <xsl:if test="@revision"> - <xsl:text> rv:</xsl:text> - <xsl:value-of select="@revision" /> - </xsl:if> - </td> - </tr> - <xsl:if test="@checkoutdir"> - <tr> - <th align="left">Checkout directory:</th> - <td><xsl:value-of select="@checkoutdir" /></td> - </tr> - </xsl:if> - <xsl:if test="@autogenargs"> - <tr> - <th align="left">Autogen args:</th> - <td><xsl:value-of select="@autogenargs" /></td> - </tr> - </xsl:if> - <xsl:if test="@cvsroot"> - <tr> - <th align="left">CVS Root:</th> - <td><xsl:value-of select="@cvsroot" /></td> - </tr> - </xsl:if> - <xsl:if test="dependencies"> - <tr> - <th align="left" valign="top">Dependencies:</th> - <td><xsl:apply-templates select="dependencies" /></td> - </tr> - </xsl:if> - </table> - </div> - </xsl:template> - -</xsl:stylesheet> diff --git a/scripts/jhbuild/modulesets/schemas.xml b/scripts/jhbuild/modulesets/schemas.xml deleted file mode 100644 index 94675e4da6..0000000000 --- a/scripts/jhbuild/modulesets/schemas.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0"?> -<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0"> - <documentElement localName="moduleset" uri="moduleset.rnc" /> -</locatingRules> diff --git a/scripts/jhbuild/modulesets/xorg-7.0.modules b/scripts/jhbuild/modulesets/xorg-7.0.modules deleted file mode 100644 index 72e7328ab6..0000000000 --- a/scripts/jhbuild/modulesets/xorg-7.0.modules +++ /dev/null @@ -1,4847 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*--> - -<!DOCTYPE moduleset SYSTEM "moduleset.dtd"> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - - <!-- - Note that all of the dependencies below are in metamodules. The - reason for using this scheme is because the list of tarballs can - be automatically generated whereas the dependency information - currently cannot. - - The dependencies work as follows: Each tarball depends on a - metamodule with the same name (see below for the metamodule and - tarball id naming scheme used), and each metamodule can have - dependencies on other tarballs. - - Each metamodule id is "<module name>-<tarballname>". - Each tarball id is "<module name>/<tarballname>" - - For example, if you need to add a new dependency on - lib/foo-1.2.3.tar.bz2 to app/bar-4.5.6.tar.bz2, then you would - add a <dep package="lib/foo"/> to <metamodule id="app-bar">. - --> - - <!-- util --> - - <metamodule id="util-util-macros"/> - - <metamodule id="util-xorg-cf-files"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="util-makedepend"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="util-imake"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="util/xorg-cf-files"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - <metamodule id="util-gccmakedep"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="util-lndir"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - <metamodule id="util"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="util/xorg-cf-files"/> - <dep package="util/imake"/> - <dep package="util/makedepend"/> - <dep package="util/gccmakedep"/> - <dep package="util/lndir"/> - </dependencies> - </metamodule> - - - <!-- doc --> - - <metamodule id="doc-xorg-sgml-doctools"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="doc-xorg-docs"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="doc/xorg-sgml-doctools"/> - </dependencies> - </metamodule> - - <metamodule id="doc"> - <dependencies> - <dep package="doc/xorg-sgml-doctools"/> - <dep package="doc/xorg-docs"/> - </dependencies> - </metamodule> - - - <!-- proto --> - - <metamodule id="proto-applewmproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-bigreqsproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-compositeproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-damageproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-dmxproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-evieext"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-fixesproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-fontcacheproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-fontsproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-glproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-inputproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-kbproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-printproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xproxymanagementprotocol"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-randrproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-recordproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-renderproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-resourceproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-scrnsaverproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-trapproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-videoproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-windowswmproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xcmiscproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xextproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xf86bigfontproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xf86dgaproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xf86driproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xf86miscproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xf86rushproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xf86vidmodeproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xineramaproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto-xproto"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="proto"> - <dependencies> - <!-- <dep package="proto/applewmproto"/> --> - <dep package="proto/bigreqsproto"/> - <dep package="proto/compositeproto"/> - <dep package="proto/damageproto"/> - <dep package="proto/dmxproto"/> - <dep package="proto/evieext"/> - <dep package="proto/fixesproto"/> - <dep package="proto/fontcacheproto"/> - <dep package="proto/fontsproto"/> - <dep package="proto/glproto"/> - <dep package="proto/inputproto"/> - <dep package="proto/kbproto"/> - <dep package="proto/printproto"/> - <dep package="proto/xproxymanagementprotocol"/> - <dep package="proto/randrproto"/> - <dep package="proto/recordproto"/> - <dep package="proto/renderproto"/> - <dep package="proto/resourceproto"/> - <dep package="proto/scrnsaverproto"/> - <dep package="proto/trapproto"/> - <dep package="proto/videoproto"/> - <!-- <dep package="proto/windowswmproto"/> --> - <dep package="proto/xcmiscproto"/> - <dep package="proto/xextproto"/> - <dep package="proto/xf86bigfontproto"/> - <dep package="proto/xf86dgaproto"/> - <dep package="proto/xf86driproto"/> - <dep package="proto/xf86miscproto"/> - <dep package="proto/xf86rushproto"/> - <dep package="proto/xf86vidmodeproto"/> - <dep package="proto/xineramaproto"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - - <!-- lib --> - - <metamodule id="lib-libdmx"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - <dep package="proto/dmxproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libfontenc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libAppleWM"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libFS"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="proto/fontsproto"/> - <dep package="lib/xtrans"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libICE"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/xtrans"/> - </dependencies> - </metamodule> - - <metamodule id="lib-liblbxutil"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xextproto"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-liboldX"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libSM"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/libICE"/> - <dep package="lib/xtrans"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libX11"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="proto/bigreqsproto"/> - <dep package="proto/xextproto"/> - <dep package="lib/xtrans"/> - <dep package="lib/libXau"/> - <dep package="proto/xcmiscproto"/> - <dep package="proto/xf86bigfontproto"/> - <dep package="lib/libXdmcp"/> - <dep package="proto/kbproto"/> - <dep package="proto/inputproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXau"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXaw"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="lib/libXmu"/> - <dep package="lib/libXpm"/> - </dependencies> - <suggests> - <dep package="lib/libXp"/> - </suggests> - </metamodule> - - <metamodule id="lib-libXcomposite"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/compositeproto"/> - <dep package="lib/libX11"/> - <dep package="lib/libXfixes"/> - <dep package="lib/libXext"/> - <dep package="proto/fixesproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXcursor"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXrender"/> - <dep package="lib/libX11"/> - <dep package="lib/libXfixes"/> - <dep package="proto/fixesproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXdamage"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="proto/damageproto"/> - <dep package="lib/libXfixes"/> - <dep package="proto/fixesproto"/> - <dep package="proto/xextproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXdmcp"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXevie"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/libX11"/> - <dep package="proto/xextproto"/> - <dep package="lib/libXext"/> - <dep package="proto/evieext"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXext"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/libX11"/> - <dep package="proto/xextproto"/> - <dep package="lib/libXau"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXfixes"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="proto/xproto"/> - <dep package="proto/fixesproto"/> - <dep package="proto/xextproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXfont"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/xtrans"/> - <dep package="proto/fontsproto"/> - <dep package="lib/libfontenc"/> - <dep package="proto/fontcacheproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXfontcache"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - <dep package="proto/fontcacheproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXft"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXrender"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/libX11"/> - <dep package="proto/xextproto"/> - <dep package="lib/libXext"/> - <dep package="proto/inputproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXinerama"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - <dep package="proto/xineramaproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libxkbfile"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="proto/kbproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libxkbui"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="lib/libxkbfile"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXmu"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="lib/libXext"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXp"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="lib/libXau"/> - <dep package="proto/printproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXpm"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="proto/xproto"/> - <dep package="lib/libXt"/> - <dep package="lib/libXext"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXprintAppUtil"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXp"/> - <dep package="lib/libXprintUtil"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXprintUtil"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXp"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXrandr"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="lib/libXrender"/> - <dep package="proto/randrproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXrender"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/renderproto"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXres"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/resourceproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXScrnSaver"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - <dep package="proto/scrnsaverproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXt"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libSM"/> - <dep package="lib/libX11"/> - <dep package="proto/xproto"/> - <dep package="proto/kbproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXTrap"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="proto/trapproto"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXtst"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/recordproto"/> - <dep package="proto/xextproto"/> - <dep package="proto/inputproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXv"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - <dep package="proto/videoproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXvMC"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - <dep package="proto/videoproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXxf86dga"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - <dep package="proto/xf86dgaproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXxf86misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - <dep package="proto/xf86miscproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-libXxf86vm"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="proto/xextproto"/> - <dep package="proto/xf86vidmodeproto"/> - </dependencies> - </metamodule> - - <metamodule id="lib-xtrans"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="lib"> - <dependencies> - <!-- <dep package="lib/libAppleWM"/> --> - <dep package="lib/libdmx"/> - <dep package="lib/libfontenc"/> - <dep package="lib/libFS"/> - <dep package="lib/libICE"/> - <dep package="lib/liblbxutil"/> - <dep package="lib/liboldX"/> - <dep package="lib/libSM"/> - <!-- <dep package="lib/libWindowsWM"/> --> - <dep package="lib/libX11"/> - <dep package="lib/libXau"/> - <dep package="lib/libXaw"/> - <dep package="lib/libXcomposite"/> - <dep package="lib/libXcursor"/> - <dep package="lib/libXdamage"/> - <dep package="lib/libXdmcp"/> - <dep package="lib/libXevie"/> - <dep package="lib/libXext"/> - <dep package="lib/libXfixes"/> - <dep package="lib/libXfont"/> - <dep package="lib/libXfontcache"/> - <dep package="lib/libXft"/> - <dep package="lib/libXi"/> - <dep package="lib/libXinerama"/> - <dep package="lib/libxkbfile"/> - <dep package="lib/libxkbui"/> - <dep package="lib/libXmu"/> - <dep package="lib/libXp"/> - <dep package="lib/libXpm"/> - <dep package="lib/libXprintAppUtil"/> - <dep package="lib/libXprintUtil"/> - <dep package="lib/libXrandr"/> - <dep package="lib/libXrender"/> - <dep package="lib/libXres"/> - <dep package="lib/libXScrnSaver"/> - <dep package="lib/libXt"/> - <dep package="lib/libXTrap"/> - <dep package="lib/libXtst"/> - <dep package="lib/libXv"/> - <dep package="lib/libXvMC"/> - <dep package="lib/libXxf86dga"/> - <dep package="lib/libXxf86misc"/> - <dep package="lib/libXxf86vm"/> - <dep package="lib/xtrans"/> - </dependencies> - </metamodule> - - - <!-- font --> - - <metamodule id="font-encodings"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontscale"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-adobe-100dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-adobe-75dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-adobe-utopia-100dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-adobe-utopia-75dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-adobe-utopia-type1"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-alias"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-arabic-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bh-100dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bh-75dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bh-lucidatypewriter-100dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bh-lucidatypewriter-75dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bh-ttf"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bh-type1"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bitstream-100dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bitstream-75dpi"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bitstream-speedo"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-bitstream-type1"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-cronyx-cyrillic"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-cursor-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-daewoo-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-dec-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-ibm-type1"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-isas-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-jis-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-micro-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-misc-cyrillic"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-misc-ethiopic"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-misc-meltho"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-misc-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-mutt-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-schumacher-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="font/font-util"/>n - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-screen-cyrillic"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-sony-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-sun-misc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-util"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-winitzki-cyrillic"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/bdftopcf"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - </dependencies> - </metamodule> - - <metamodule id="font-font-xfree86-type1"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/mkfontscale"/> - <dep package="app/mkfontdir"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="font"> - <dependencies> - <dep package="font/encodings"/> - <dep package="font/font-adobe-100dpi"/> - <dep package="font/font-adobe-75dpi"/> - <dep package="font/font-adobe-utopia-100dpi"/> - <dep package="font/font-adobe-utopia-75dpi"/> - <dep package="font/font-adobe-utopia-type1"/> - <dep package="font/font-alias"/> - <dep package="font/font-arabic-misc"/> - <dep package="font/font-bh-100dpi"/> - <dep package="font/font-bh-75dpi"/> - <dep package="font/font-bh-lucidatypewriter-100dpi"/> - <dep package="font/font-bh-lucidatypewriter-75dpi"/> - <dep package="font/font-bh-ttf"/> - <dep package="font/font-bh-type1"/> - <dep package="font/font-bitstream-100dpi"/> - <dep package="font/font-bitstream-75dpi"/> - <dep package="font/font-bitstream-speedo"/> - <dep package="font/font-bitstream-type1"/> - <dep package="font/font-cronyx-cyrillic"/> - <dep package="font/font-cursor-misc"/> - <dep package="font/font-daewoo-misc"/> - <dep package="font/font-dec-misc"/> - <dep package="font/font-ibm-type1"/> - <dep package="font/font-isas-misc"/> - <dep package="font/font-jis-misc"/> - <dep package="font/font-micro-misc"/> - <dep package="font/font-misc-cyrillic"/> - <dep package="font/font-misc-ethiopic"/> - <dep package="font/font-misc-meltho"/> - <dep package="font/font-misc-misc"/> - <dep package="font/font-mutt-misc"/> - <dep package="font/font-schumacher-misc"/> - <dep package="font/font-screen-cyrillic"/> - <dep package="font/font-sony-misc"/> - <dep package="font/font-sun-misc"/> - <dep package="font/font-util"/> - <dep package="font/font-winitzki-cyrillic"/> - <dep package="font/font-xfree86-type1"/> - </dependencies> - </metamodule> - - - <!-- data --> - - <metamodule id="data-xbitmaps"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="data-xcursor-themes"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/xcursorgen"/> - </dependencies> - </metamodule> - - <metamodule id="data-xkbdata"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="app/xkbcomp"/> - </dependencies> - </metamodule> - - <metamodule id="data"> - <dependencies> - <dep package="data/xbitmaps"/> - <dep package="data/xcursor-themes"/> - <dep package="data/xkbdata"/> - </dependencies> - </metamodule> - - - <!-- app --> - - <metamodule id="app-appres"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - </dependencies> - </metamodule> - - <metamodule id="app-bdftopcf"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXfont"/> - <dep package="proto/fontsproto"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - <metamodule id="app-beforelight"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXScrnSaver"/> - <dep package="lib/libXt"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-bitmap"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - <dep package="lib/libXaw"/> - <dep package="data/xbitmaps"/> - </dependencies> - </metamodule> - - <metamodule id="app-constype"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="app-editres"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-fonttosfnt"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libfontenc"/> - <dep package="freetype2"/> - </dependencies> - </metamodule> - - <metamodule id="app-fslsfonts"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libFS"/> - </dependencies> - </metamodule> - - <metamodule id="app-fstobdf"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libFS"/> - </dependencies> - </metamodule> - - <metamodule id="app-iceauth"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libICE"/> - </dependencies> - </metamodule> - - <metamodule id="app-ico"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-lbxproxy"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/xtrans"/> - <dep package="lib/libXext"/> - <dep package="lib/liblbxutil"/> - <dep package="lib/libX11"/> - <dep package="lib/libICE"/> - <dep package="proto/xproxymanagementprotocol"/> - <dep package="proto/bigreqsproto"/> - </dependencies> - </metamodule> - - <metamodule id="app-listres"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-luit"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libfontenc"/> - </dependencies> - </metamodule> - - <metamodule id="app-mkcfm"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXfont"/> - <dep package="lib/libFS"/> - <dep package="proto/fontsproto"/> - <dep package="lib/libfontenc"/> - </dependencies> - </metamodule> - - <metamodule id="app-mkfontdir"> - <dependencies> - <dep package="util/util-macros"/> - </dependencies> - </metamodule> - - <metamodule id="app-mkfontscale"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libfontenc"/> - <dep package="freetype2"/> - </dependencies> - </metamodule> - - <metamodule id="app-oclock"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - <dep package="lib/libXext"/> - </dependencies> - </metamodule> - - <metamodule id="app-proxymngr"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="lib/libICE"/> - <dep package="proto/xproxymanagementprotocol"/> - </dependencies> - </metamodule> - - <metamodule id="app-rgb"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - <metamodule id="app-rstart"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-scripts"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-sessreg"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - </dependencies> - </metamodule> - - <metamodule id="app-setxkbmap"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libxkbfile"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-showfont"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libFS"/> - </dependencies> - </metamodule> - - <metamodule id="app-smproxy"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXt"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-twm"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-viewres"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-x11perf"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xauth"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXau"/> - <dep package="lib/libXext"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xbiff"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - <dep package="data/xbitmaps"/> - </dependencies> - </metamodule> - - <metamodule id="app-xcalc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xclipboard"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xclock"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xcmsdb"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-xconsole"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xcursorgen"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXcursor"/> - </dependencies> - </metamodule> - - <metamodule id="app-xdbedizzy"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXext"/> - </dependencies> - </metamodule> - - <metamodule id="app-xditview"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xdm"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - <dep package="lib/libXdmcp"/> - <dep package="proto/xproto"/> - <dep package="lib/libXau"/> - <dep package="lib/libXt"/> - </dependencies> - <suggests> - <dep package="lib/libXinerama"/> - <dep package="lib/libXpm"/> - </suggests> - </metamodule> - - <metamodule id="app-xdpyinfo"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXext"/> - <dep package="lib/libXtst"/> - </dependencies> - <suggests> - <dep package="proto/xextproto"/> - <dep package="proto/kbproto"/> - <dep package="proto/xf86vidmodeproto"/> - <dep package="lib/libXxf86vm"/> - <dep package="proto/xf86dgaproto"/> - <dep package="lib/libXxf86dga"/> - <dep package="proto/xf86miscproto"/> - <dep package="lib/libXxf86misc"/> - <dep package="proto/inputproto"/> - <dep package="lib/libXi"/> - <dep package="proto/renderproto"/> - <dep package="lib/libXrender"/> - <dep package="proto/xineramaproto"/> - <dep package="lib/libXinerama"/> - <dep package="proto/dmxproto"/> - <dep package="lib/libdmx"/> - <dep package="proto/printproto"/> - <dep package="lib/libXp"/> - </suggests> - </metamodule> - - <metamodule id="app-xdriinfo"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="proto/glproto"/> - </dependencies> - </metamodule> - - <metamodule id="app-xedit"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xev"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-xeyes"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="lib/libXext"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xf86dga"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXxf86dga"/> - <dep package="lib/libXt"/> - <dep package="lib/libXaw"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xfd"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - <dep package="lib/libXft"/> - <dep package="freetype2"/> - <dep package="fontconfig"/> - </dependencies> - </metamodule> - - <metamodule id="app-xfindproxy"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libICE"/> - <dep package="lib/libXt"/> - <dep package="proto/xproxymanagementprotocol"/> - </dependencies> - </metamodule> - - <metamodule id="app-xfontsel"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xfs"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libFS"/> - <dep package="lib/libXfont"/> - <dep package="proto/fontsproto"/> - <dep package="lib/xtrans"/> - </dependencies> - </metamodule> - - <metamodule id="app-xfsinfo"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libFS"/> - </dependencies> - </metamodule> - - <metamodule id="app-xfwp"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libICE"/> - <dep package="proto/xproxymanagementprotocol"/> - </dependencies> - </metamodule> - - <metamodule id="app-xgamma"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXxf86vm"/> - </dependencies> - </metamodule> - - <metamodule id="app-xgc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xhost"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - <dep package="lib/libXau"/> - </dependencies> - </metamodule> - - <metamodule id="app-xinit"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-xkbcomp"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libxkbfile"/> - </dependencies> - </metamodule> - - <metamodule id="app-xkbevd"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libxkbfile"/> - </dependencies> - </metamodule> - - <metamodule id="app-xkbprint"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libxkbfile"/> - </dependencies> - </metamodule> - - <metamodule id="app-xkbutils"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libxkbfile"/> - <dep package="lib/libXaw"/> - <dep package="proto/inputproto"/> - </dependencies> - </metamodule> - - <metamodule id="app-xkill"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xload"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xlogo"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xlsatoms"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xlsclients"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xlsfonts"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-xmag"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xman"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xmessage"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xmh"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xmodmap"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-xmore"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xphelloworld"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXaw"/> - <dep package="lib/libXprintUtil"/> - <dep package="lib/libXt"/> - </dependencies> - </metamodule> - - <metamodule id="app-xplsprinters"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXprintUtil"/> - <dep package="lib/libXt"/> - </dependencies> - </metamodule> - - <metamodule id="app-xpr"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xprehashprinterlist"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXp"/> - </dependencies> - </metamodule> - - <metamodule id="app-xprop"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xrandr"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXrandr"/> - </dependencies> - </metamodule> - - <metamodule id="app-xrdb"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xrefresh"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app-xrx"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXt"/> - <dep package="lib/libXext"/> - <dep package="lib/xtrans"/> - <dep package="proto/xproxymanagementprotocol"/> - </dependencies> - </metamodule> - - <metamodule id="app-xset"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXmu"/> - </dependencies> - <suggests> - <dep package="proto/xextproto"/> - <dep package="lib/libXext"/> - <dep package="proto/kbproto"/> - <dep package="lib/libX11"/> - <dep package="proto/xf86miscproto"/> - <dep package="lib/libXxf86misc"/> - <dep package="proto/fontcacheproto"/> - <dep package="lib/libXfontcache"/> - <dep package="proto/printproto"/> - <dep package="lib/libXp"/> - </suggests> - </metamodule> - - <metamodule id="app-xsetmode"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXi"/> - </dependencies> - </metamodule> - - <metamodule id="app-xsetpointer"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXi"/> - </dependencies> - </metamodule> - - <metamodule id="app-xsetroot"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - <dep package="data/xbitmaps"/> - </dependencies> - </metamodule> - - <metamodule id="app-xsm"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - </dependencies> - </metamodule> - - <metamodule id="app-xstdcmap"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xtrap"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXTrap"/> - </dependencies> - </metamodule> - - <metamodule id="app-xvidtune"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libXaw"/> - <dep package="lib/libXxf86vm"/> - </dependencies> - </metamodule> - - <metamodule id="app-xvinfo"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXv"/> - </dependencies> - </metamodule> - - <metamodule id="app-xwd"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xwininfo"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - <dep package="lib/libXmu"/> - </dependencies> - </metamodule> - - <metamodule id="app-xwud"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="lib/libX11"/> - </dependencies> - </metamodule> - - <metamodule id="app"> - <dependencies> - <dep package="app/appres"/> - <dep package="app/bdftopcf"/> - <dep package="app/beforelight"/> - <dep package="app/bitmap"/> - <!-- <dep package="app/constype"/> --> - <dep package="app/editres"/> - <dep package="app/fonttosfnt"/> - <dep package="app/fslsfonts"/> - <dep package="app/fstobdf"/> - <dep package="app/iceauth"/> - <dep package="app/ico"/> - <dep package="app/lbxproxy"/> - <dep package="app/listres"/> - <dep package="app/luit"/> - <dep package="app/mkcfm"/> - <dep package="app/mkfontdir"/> - <dep package="app/mkfontscale"/> - <dep package="app/oclock"/> - <dep package="app/proxymngr"/> - <dep package="app/rgb"/> - <dep package="app/rstart"/> - <dep package="app/scripts"/> - <dep package="app/sessreg"/> - <dep package="app/setxkbmap"/> - <dep package="app/showfont"/> - <dep package="app/smproxy"/> - <dep package="app/twm"/> - <dep package="app/viewres"/> - <dep package="app/x11perf"/> - <dep package="app/xauth"/> - <dep package="app/xbiff"/> - <dep package="app/xcalc"/> - <dep package="app/xclipboard"/> - <dep package="app/xclock"/> - <dep package="app/xcmsdb"/> - <dep package="app/xconsole"/> - <dep package="app/xcursorgen"/> - <dep package="app/xdbedizzy"/> - <dep package="app/xditview"/> - <dep package="app/xdm"/> - <dep package="app/xdpyinfo"/> - <dep package="app/xdriinfo"/> - <dep package="app/xedit"/> - <dep package="app/xev"/> - <dep package="app/xeyes"/> - <dep package="app/xf86dga"/> - <dep package="app/xfd"/> - <dep package="app/xfindproxy"/> - <dep package="app/xfontsel"/> - <dep package="app/xfs"/> - <dep package="app/xfsinfo"/> - <dep package="app/xfwp"/> - <dep package="app/xgamma"/> - <dep package="app/xgc"/> - <dep package="app/xhost"/> - <dep package="app/xinit"/> - <dep package="app/xkbcomp"/> - <dep package="app/xkbevd"/> - <dep package="app/xkbprint"/> - <dep package="app/xkbutils"/> - <dep package="app/xkill"/> - <dep package="app/xload"/> - <dep package="app/xlogo"/> - <dep package="app/xlsatoms"/> - <dep package="app/xlsclients"/> - <dep package="app/xlsfonts"/> - <dep package="app/xmag"/> - <dep package="app/xman"/> - <dep package="app/xmessage"/> - <dep package="app/xmh"/> - <dep package="app/xmodmap"/> - <dep package="app/xmore"/> - <dep package="app/xphelloworld"/> - <dep package="app/xplsprinters"/> - <dep package="app/xpr"/> - <dep package="app/xprehashprinterlist"/> - <dep package="app/xprop"/> - <dep package="app/xrandr"/> - <dep package="app/xrdb"/> - <dep package="app/xrefresh"/> - <dep package="app/xrx"/> - <dep package="app/xset"/> - <dep package="app/xsetmode"/> - <dep package="app/xsetpointer"/> - <dep package="app/xsetroot"/> - <dep package="app/xsm"/> - <dep package="app/xstdcmap"/> - <dep package="app/xtrap"/> - <dep package="app/xvidtune"/> - <dep package="app/xvinfo"/> - <dep package="app/xwd"/> - <dep package="app/xwininfo"/> - <dep package="app/xwud"/> - </dependencies> - </metamodule> - - - <!-- input drivers --> - - <metamodule id="driver-xf86-input-acecad"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-aiptek"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-calcomp"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-citron"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-digitaledge"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-dmc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-dynapro"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-elo2300"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-elographics"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-evdev"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-fpit"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-hyperpen"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-jamstudio"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-joystick"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-keyboard"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-magellan"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-magictouch"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-microtouch"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-mouse"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-mutouch"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-palmax"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-penmount"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-spaceorb"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-summa"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-tek4957"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-ur98"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-input-void"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - - <!-- video drivers --> - - <metamodule id="driver-xf86-video-apm"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-ark"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-ati"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-chips"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-cirrus"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-cyrix"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-dummy"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-fbdev"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-glide"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-glint"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-i128"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-i740"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-i810"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-imstt"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-mga"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-neomagic"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-newport"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-nsc"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-nv"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-rendition"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-s3"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-s3virge"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-savage"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-siliconmotion"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-sis"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-sisusb"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-sunbw2"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-suncg14"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-suncg3"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-suncg6"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-sunffb"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-sunleo"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-suntcx"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-tdfx"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-tga"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-trident"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-tseng"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-v4l"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-vesa"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-vga"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-via"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - <dep package="drm"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-vmware"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-voodoo"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-xf86-video-wsfb"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto/xproto"/> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - <metamodule id="driver-input"> - <dependencies> - <dep package="driver/xf86-input-acecad"/> - <dep package="driver/xf86-input-aiptek"/> - <dep package="driver/xf86-input-calcomp"/> - <dep package="driver/xf86-input-citron"/> - <dep package="driver/xf86-input-digitaledge"/> - <dep package="driver/xf86-input-dmc"/> - <dep package="driver/xf86-input-dynapro"/> - <dep package="driver/xf86-input-elo2300"/> - <dep package="driver/xf86-input-elographics"/> - <dep package="driver/xf86-input-evdev"/> - <dep package="driver/xf86-input-fpit"/> - <dep package="driver/xf86-input-hyperpen"/> - <dep package="driver/xf86-input-jamstudio"/> - <dep package="driver/xf86-input-joystick"/> - <dep package="driver/xf86-input-keyboard"/> - <dep package="driver/xf86-input-magellan"/> - <dep package="driver/xf86-input-magictouch"/> - <dep package="driver/xf86-input-microtouch"/> - <dep package="driver/xf86-input-mouse"/> - <dep package="driver/xf86-input-mutouch"/> - <dep package="driver/xf86-input-palmax"/> - <dep package="driver/xf86-input-penmount"/> - <dep package="driver/xf86-input-spaceorb"/> - <dep package="driver/xf86-input-summa"/> - <dep package="driver/xf86-input-tek4957"/> - <!-- <dep package="driver/xf86-input-ur98"/> --> - <dep package="driver/xf86-input-void"/> - </dependencies> - </metamodule> - - <metamodule id="driver-video"> - <dependencies> - <dep package="driver/xf86-video-apm"/> - <dep package="driver/xf86-video-ark"/> - <dep package="driver/xf86-video-ati"/> - <dep package="driver/xf86-video-chips"/> - <dep package="driver/xf86-video-cirrus"/> - <dep package="driver/xf86-video-cyrix"/> - <dep package="driver/xf86-video-dummy"/> - <dep package="driver/xf86-video-fbdev"/> - <!-- <dep package="driver/xf86-video-glide"/> --> - <dep package="driver/xf86-video-glint"/> - <dep package="driver/xf86-video-i128"/> - <dep package="driver/xf86-video-i740"/> - <dep package="driver/xf86-video-i810"/> - <dep package="driver/xf86-video-imstt"/> - <dep package="driver/xf86-video-mga"/> - <dep package="driver/xf86-video-neomagic"/> - <dep package="driver/xf86-video-newport"/> - <dep package="driver/xf86-video-nsc"/> - <dep package="driver/xf86-video-nv"/> - <dep package="driver/xf86-video-rendition"/> - <dep package="driver/xf86-video-s3"/> - <dep package="driver/xf86-video-s3virge"/> - <dep package="driver/xf86-video-savage"/> - <dep package="driver/xf86-video-siliconmotion"/> - <dep package="driver/xf86-video-sis"/> - <dep package="driver/xf86-video-sisusb"/> <!-- Linux only --> - <dep package="driver/xf86-video-sunbw2"/> - <dep package="driver/xf86-video-suncg14"/> - <dep package="driver/xf86-video-suncg3"/> - <dep package="driver/xf86-video-suncg6"/> - <dep package="driver/xf86-video-sunffb"/> - <dep package="driver/xf86-video-sunleo"/> - <dep package="driver/xf86-video-suntcx"/> - <dep package="driver/xf86-video-tdfx"/> - <dep package="driver/xf86-video-tga"/> - <dep package="driver/xf86-video-trident"/> - <dep package="driver/xf86-video-tseng"/> - <dep package="driver/xf86-video-v4l"/> <!-- Linux only --> - <dep package="driver/xf86-video-vesa"/> - <dep package="driver/xf86-video-vga"/> - <dep package="driver/xf86-video-via"/> - <dep package="driver/xf86-video-vmware"/> - <dep package="driver/xf86-video-voodoo"/> - </dependencies> - </metamodule> - - <metamodule id="driver-sun"> - <dependencies> - <dep package="driver/xf86-video-wsfb"/> - </dependencies> - </metamodule> - - <metamodule id="driver"> - <dependencies> - <dep package="driver-input"/> - <dep package="driver-video"/> - </dependencies> - </metamodule> - - - <!-- X servers --> - - <!-- TODO: Lots more work is needed here for deps --> - <metamodule id="xserver-xorg-server"> - <dependencies> - <dep package="util/util-macros"/> - <dep package="proto"/> - <dep package="lib/libXaw"/> - <dep package="lib/libxkbui"/> - <dep package="lib/libXfont"/> - <dep package="lib/xtrans"/> - <dep package="lib/libXau"/> - <dep package="lib/libxkbfile"/> - <dep package="lib/libXdmcp"/> - <dep package="lib/libXxf86misc"/> - <dep package="lib/libXxf86vm"/> - <dep package="drm"/> - </dependencies> - </metamodule> - - <metamodule id="xserver"> - <dependencies> - <dep package="xserver/xorg-server"/> - </dependencies> - </metamodule> - - - <!-- everything --> - - <!-- Note that data and utils are brought in from dependencies --> - <metamodule id="xorg"> - <dependencies> - <dep package="doc"/> - <dep package="proto"/> - <dep package="lib"/> - <dep package="app"/> - <dep package="xserver"/> - <dep package="driver"/> - <dep package="data"/> - <dep package="font"/> - <dep package="util"/> - </dependencies> - </metamodule> - - - <!-- Extras --> - - <tarball id="freetype2" version="2.1.9"> - <source href="http://ftp.x.org/pub/X11R7.0/src/extras/freetype-2.1.9.tar.gz" - size="1334560" md5sum="1336a6851753c962495ff02ff7ea71c1"/> - </tarball> - <tarball id="fontconfig" version="2.2.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/extras/fontconfig-2.2.3.tar.gz" - size="750035" md5sum="2466a797d645cda5eb466080fdaec416"/> - </tarball> - <tarball id="drm" version="2.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/extras/libdrm-2.0.tar.gz" - size="370965" md5sum="9d1aab104eb757ceeb2c1a6d38d57411"/> - </tarball> - - - <!-- Tarball set for X11R7-RC4 --> - - <tarball id="app/appres" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/appres-X11R7.0-1.0.0.tar.bz2" - size="74597" md5sum="3327357fc851a49e8e5dc44405e7b862"/> - <dependencies> - <dep package="app-appres"/> - </dependencies> - </tarball> - <tarball id="app/bdftopcf" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/bdftopcf-X11R7.0-1.0.0.tar.bz2" - size="74661" md5sum="f43667fcf613054cae0679f5dc5a1e7a"/> - <dependencies> - <dep package="app-bdftopcf"/> - </dependencies> - </tarball> - <tarball id="app/beforelight" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/beforelight-X11R7.0-1.0.1.tar.bz2" - size="77142" md5sum="e0326eff9d1bd4e3a1af9e615a0048b3"/> - <dependencies> - <dep package="app-beforelight"/> - </dependencies> - </tarball> - <tarball id="app/bitmap" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/bitmap-X11R7.0-1.0.1.tar.bz2" - size="117790" md5sum="bbb3df097821d3edb4d5a4b2ae731de6"/> - <dependencies> - <dep package="app-bitmap"/> - </dependencies> - </tarball> - <tarball id="app/editres" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/editres-X11R7.0-1.0.1.tar.bz2" - size="115967" md5sum="a9dc7f3b0cb59f08ab1e6554a5e60721"/> - <dependencies> - <dep package="app-editres"/> - </dependencies> - </tarball> - <tarball id="app/fonttosfnt" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/fonttosfnt-X11R7.0-1.0.1.tar.bz2" - size="90512" md5sum="89b65e010acaa3c5d370e1cc0ea9fce9"/> - <dependencies> - <dep package="app-fonttosfnt"/> - </dependencies> - </tarball> - <tarball id="app/fslsfonts" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/fslsfonts-X11R7.0-1.0.1.tar.bz2" - size="76899" md5sum="c500b96cfec485e362204a8fc0bdfd44"/> - <dependencies> - <dep package="app-fslsfonts"/> - </dependencies> - </tarball> - <tarball id="app/fstobdf" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/fstobdf-X11R7.0-1.0.1.tar.bz2" - size="78666" md5sum="233615dca862b64c69bc212090a22b4c"/> - <dependencies> - <dep package="app-fstobdf"/> - </dependencies> - </tarball> - <tarball id="app/iceauth" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/iceauth-X11R7.0-1.0.1.tar.bz2" - size="84372" md5sum="92035bd69b4c9aba47607ba0efcc8530"/> - <dependencies> - <dep package="app-iceauth"/> - </dependencies> - </tarball> - <tarball id="app/ico" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/ico-X11R7.0-1.0.1.tar.bz2" - size="85686" md5sum="9c63d68a779819ba79e45d9b15d26b1f"/> - <dependencies> - <dep package="app-ico"/> - </dependencies> - </tarball> - <tarball id="app/lbxproxy" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/lbxproxy-X11R7.0-1.0.1.tar.bz2" - size="179860" md5sum="d9c05283660eae742a77dcbc0091841a"/> - <dependencies> - <dep package="app-lbxproxy"/> - </dependencies> - </tarball> - <tarball id="app/listres" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/listres-X11R7.0-1.0.1.tar.bz2" - size="76647" md5sum="2eeb802272a7910bb8a52b308bf0d5f6"/> - <dependencies> - <dep package="app-listres"/> - </dependencies> - </tarball> - <tarball id="app/luit" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/luit-X11R7.0-1.0.1.tar.bz2" - size="92017" md5sum="30428b8ff783a0cfd61dab05a17cfaa7"/> - <dependencies> - <dep package="app-luit"/> - </dependencies> - </tarball> - <tarball id="app/mkcfm" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/mkcfm-X11R7.0-1.0.1.tar.bz2" - size="75940" md5sum="912e6305998441c26852309403742bec"/> - <dependencies> - <dep package="app-mkcfm"/> - </dependencies> - </tarball> - <tarball id="app/mkfontdir" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/mkfontdir-X11R7.0-1.0.1.tar.bz2" - size="60892" md5sum="29e6e5e8e7a29ed49abf33af192693cb"/> - <dependencies> - <dep package="app-mkfontdir"/> - </dependencies> - </tarball> - <tarball id="app/mkfontscale" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/mkfontscale-X11R7.0-1.0.1.tar.bz2" - size="87485" md5sum="75bbd1dc425849e415a60afd9e74d2ff"/> - <dependencies> - <dep package="app-mkfontscale"/> - </dependencies> - </tarball> - <tarball id="app/oclock" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/oclock-X11R7.0-1.0.1.tar.bz2" - size="83165" md5sum="e35af9699c49f0b77fad45a3b942c3b1"/> - <dependencies> - <dep package="app-oclock"/> - </dependencies> - </tarball> - <tarball id="app/proxymngr" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/proxymngr-X11R7.0-1.0.1.tar.bz2" - size="91718" md5sum="0d2ca6876d84302f966fd105a3b69a8e"/> - <dependencies> - <dep package="app-proxymngr"/> - </dependencies> - </tarball> - <tarball id="app/rgb" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/rgb-X11R7.0-1.0.0.tar.bz2" - size="87271" md5sum="675e72f221714c3db8730daf0b50f69f"/> - <dependencies> - <dep package="app-rgb"/> - </dependencies> - </tarball> - <tarball id="app/rstart" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/rstart-X11R7.0-1.0.1.tar.bz2" - size="88773" md5sum="6f33a1bd8e99372b7544ddfcad456369"/> - <dependencies> - <dep package="app-rstart"/> - </dependencies> - </tarball> - <tarball id="app/scripts" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/scripts-X11R7.0-1.0.1.tar.bz2" - size="72337" md5sum="b5b43aa53372b78f1d67c86301e3dc02"/> - <dependencies> - <dep package="app-scripts"/> - </dependencies> - </tarball> - <tarball id="app/sessreg" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/sessreg-X11R7.0-1.0.0.tar.bz2" - size="82144" md5sum="8289a5b947165449c23bdfad9af02b4c"/> - <dependencies> - <dep package="app-sessreg"/> - </dependencies> - </tarball> - <tarball id="app/setxkbmap" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/setxkbmap-X11R7.0-1.0.1.tar.bz2" - size="80162" md5sum="28b141ab0b1c44a5e90d31ad73bd1078"/> - <dependencies> - <dep package="app-setxkbmap"/> - </dependencies> - </tarball> - <tarball id="app/showfont" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/showfont-X11R7.0-1.0.1.tar.bz2" - size="76966" md5sum="334cb5133960108ac2c24ee27e16bb8e"/> - <dependencies> - <dep package="app-showfont"/> - </dependencies> - </tarball> - <tarball id="app/smproxy" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/smproxy-X11R7.0-1.0.1.tar.bz2" - size="82934" md5sum="60f54881b6fb27a8ba238629e4097c4d"/> - <dependencies> - <dep package="app-smproxy"/> - </dependencies> - </tarball> - <tarball id="app/twm" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/twm-X11R7.0-1.0.1.tar.bz2" - size="220067" md5sum="cd525ca3ac5e29d21a61deebc1e0c376"/> - <dependencies> - <dep package="app-twm"/> - </dependencies> - </tarball> - <tarball id="app/viewres" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/viewres-X11R7.0-1.0.1.tar.bz2" - size="84830" md5sum="004bf8dd4646aca86faf5aa22b0c3f2f"/> - <dependencies> - <dep package="app-viewres"/> - </dependencies> - </tarball> - <tarball id="app/x11perf" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/x11perf-X11R7.0-1.0.1.tar.bz2" - size="127363" md5sum="9986b20301c6a37bb144cb9733bf35a0"/> - <dependencies> - <dep package="app-x11perf"/> - </dependencies> - </tarball> - <tarball id="app/xauth" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xauth-X11R7.0-1.0.1.tar.bz2" - size="95898" md5sum="ef2359ddaaea6ffaf9072fa342d6eb09"/> - <dependencies> - <dep package="app-xauth"/> - </dependencies> - </tarball> - <tarball id="app/xbiff" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xbiff-X11R7.0-1.0.1.tar.bz2" - size="83656" md5sum="c4eb71a3187586d02365a67fc1445e54"/> - <dependencies> - <dep package="app-xbiff"/> - </dependencies> - </tarball> - <tarball id="app/xcalc" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xcalc-X11R7.0-1.0.1.tar.bz2" - size="93681" md5sum="c1ecea85be15f746a59931e288768bdb"/> - <dependencies> - <dep package="app-xcalc"/> - </dependencies> - </tarball> - <tarball id="app/xclipboard" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xclipboard-X11R7.0-1.0.1.tar.bz2" - size="83692" md5sum="a661b0f922cbdc62514bfd3e700d00fd"/> - <dependencies> - <dep package="app-xclipboard"/> - </dependencies> - </tarball> - <tarball id="app/xclock" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xclock-X11R7.0-1.0.1.tar.bz2" - size="100013" md5sum="00444fed4bf5cd51624476ee11dd1fab"/> - <dependencies> - <dep package="app-xclock"/> - </dependencies> - </tarball> - <tarball id="app/xcmsdb" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xcmsdb-X11R7.0-1.0.1.tar.bz2" - size="96468" md5sum="1c8396ed5c416e3a6658394ff6c415ad"/> - <dependencies> - <dep package="app-xcmsdb"/> - </dependencies> - </tarball> - <tarball id="app/xconsole" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xconsole-X11R7.0-1.0.1.tar.bz2" - size="82259" md5sum="f983b589ba9de198d90abee220a80f81"/> - <dependencies> - <dep package="app-xconsole"/> - </dependencies> - </tarball> - <tarball id="app/xcursorgen" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xcursorgen-X11R7.0-1.0.0.tar.bz2" - size="78039" md5sum="4d7b26dbb4442e89ec65c4147b31a5f7"/> - <dependencies> - <dep package="app-xcursorgen"/> - </dependencies> - </tarball> - <tarball id="app/xdbedizzy" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xdbedizzy-X11R7.0-1.0.1.tar.bz2" - size="83105" md5sum="ceaccde801650ffbffc1e5b0657960d2"/> - <dependencies> - <dep package="app-xdbedizzy"/> - </dependencies> - </tarball> - <tarball id="app/xditview" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xditview-X11R7.0-1.0.1.tar.bz2" - size="103002" md5sum="21887fe4ec1965d637e82b7840650a6f"/> - <dependencies> - <dep package="app-xditview"/> - </dependencies> - </tarball> - <tarball id="app/xdm" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xdm-X11R7.0-1.0.1.tar.bz2" - size="333977" md5sum="9ac363721dbb8cd39aa1064b260624a6"/> - <dependencies> - <dep package="app-xdm"/> - </dependencies> - </tarball> - <tarball id="app/xdpyinfo" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xdpyinfo-X11R7.0-1.0.1.tar.bz2" - size="87616" md5sum="2b08e9ca783e3aa91d7fb84fdd716e93"/> - <dependencies> - <dep package="app-xdpyinfo"/> - </dependencies> - </tarball> - <tarball id="app/xdriinfo" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xdriinfo-X11R7.0-1.0.0.tar.bz2" - size="77365" md5sum="75b8b53e29bb295f7fbae7909e0e9770"/> - <dependencies> - <dep package="app-xdriinfo"/> - </dependencies> - </tarball> - <tarball id="app/xedit" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xedit-X11R7.0-1.0.1.tar.bz2" - size="440739" md5sum="19f607d033f62fb1ee5965f4236b19d4"/> - <dependencies> - <dep package="app-xedit"/> - </dependencies> - </tarball> - <tarball id="app/xev" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xev-X11R7.0-1.0.1.tar.bz2" - size="79852" md5sum="5d0d3c13b03e9516eafe536e6bd756c7"/> - <dependencies> - <dep package="app-xev"/> - </dependencies> - </tarball> - <tarball id="app/xeyes" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xeyes-X11R7.0-1.0.1.tar.bz2" - size="81054" md5sum="3ffafa7f222ea799bcd9fcd85c60ab98"/> - <dependencies> - <dep package="app-xeyes"/> - </dependencies> - </tarball> - <tarball id="app/xf86dga" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xf86dga-X11R7.0-1.0.1.tar.bz2" - size="75128" md5sum="f518fd7ebef3d9e8dbaa57e50a3e2631"/> - <dependencies> - <dep package="app-xf86dga"/> - </dependencies> - </tarball> - <tarball id="app/xfd" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xfd-X11R7.0-1.0.1.tar.bz2" - size="88900" md5sum="26c83a6fe245906cc05055abf877d0f2"/> - <dependencies> - <dep package="app-xfd"/> - </dependencies> - </tarball> - <tarball id="app/xfindproxy" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xfindproxy-X11R7.0-1.0.1.tar.bz2" - size="77638" md5sum="5ef22b8876bb452f670e0fc425a12504"/> - <dependencies> - <dep package="app-xfindproxy"/> - </dependencies> - </tarball> - <tarball id="app/xfontsel" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xfontsel-X11R7.0-1.0.1.tar.bz2" - size="95794" md5sum="d1df7b8622b7f8ebca4b2463118d7073"/> - <dependencies> - <dep package="app-xfontsel"/> - </dependencies> - </tarball> - <tarball id="app/xfsinfo" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xfsinfo-X11R7.0-1.0.1.tar.bz2" - size="74357" md5sum="55ca0cfd09b1c1555d492d6961d9af46"/> - <dependencies> - <dep package="app-xfsinfo"/> - </dependencies> - </tarball> - <tarball id="app/xfs" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xfs-X11R7.0-1.0.1.tar.bz2" - size="141138" md5sum="a297da3d906110e9c29ec56c5ea578a8"/> - <dependencies> - <dep package="app-xfs"/> - </dependencies> - </tarball> - <tarball id="app/xfwp" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xfwp-X11R7.0-1.0.1.tar.bz2" - size="104581" md5sum="e1ef3fef10d1f7fbd936794982a8f0be"/> - <dependencies> - <dep package="app-xfwp"/> - </dependencies> - </tarball> - <tarball id="app/xgamma" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xgamma-X11R7.0-1.0.1.tar.bz2" - size="74972" md5sum="07167da3f6b21985e27174ec70f213c0"/> - <dependencies> - <dep package="app-xgamma"/> - </dependencies> - </tarball> - <tarball id="app/xgc" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xgc-X11R7.0-1.0.1.tar.bz2" - size="128835" md5sum="8cd01cf558c3eed738115abcf720277d"/> - <dependencies> - <dep package="app-xgc"/> - </dependencies> - </tarball> - <tarball id="app/xhost" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xhost-X11R7.0-1.0.0.tar.bz2" - size="85776" md5sum="76c44e84aaf4ad8e97cf15f4dbe4a24a"/> - <dependencies> - <dep package="app-xhost"/> - </dependencies> - </tarball> - <tarball id="app/xinit" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xinit-X11R7.0-1.0.1.tar.bz2" - size="92299" md5sum="6d2df59fa328cbc99c0de98bc2e14597"/> - <dependencies> - <dep package="app-xinit"/> - </dependencies> - </tarball> - <tarball id="app/xkbcomp" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xkbcomp-X11R7.0-1.0.1.tar.bz2" - size="179839" md5sum="46d1e015897200d4dfed64990abaa8b9"/> - <dependencies> - <dep package="app-xkbcomp"/> - </dependencies> - </tarball> - <tarball id="app/xkbevd" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xkbevd-X11R7.0-1.0.1.tar.bz2" - size="102145" md5sum="7ba0496f079552d1918d73bd09bde9b2"/> - <dependencies> - <dep package="app-xkbevd"/> - </dependencies> - </tarball> - <tarball id="app/xkbprint" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xkbprint-X11R7.0-1.0.1.tar.bz2" - size="115152" md5sum="6235c39690968d0a9a4c1b1c16c8905a"/> - <dependencies> - <dep package="app-xkbprint"/> - </dependencies> - </tarball> - <tarball id="app/xkbutils" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xkbutils-X11R7.0-1.0.1.tar.bz2" - size="65684" md5sum="798502eca0c6c3e8c02d76fabb910532"/> - <dependencies> - <dep package="app-xkbutils"/> - </dependencies> - </tarball> - <tarball id="app/xkill" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xkill-X11R7.0-1.0.1.tar.bz2" - size="77135" md5sum="35f47fd58d75c1ea5f414b21a10bdbf3"/> - <dependencies> - <dep package="app-xkill"/> - </dependencies> - </tarball> - <tarball id="app/xload" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xload-X11R7.0-1.0.1.tar.bz2" - size="87441" md5sum="11080456822146ebc0118b15f4b911d9"/> - <dependencies> - <dep package="app-xload"/> - </dependencies> - </tarball> - <tarball id="app/xlogo" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xlogo-X11R7.0-1.0.1.tar.bz2" - size="87040" md5sum="0314b2f5173da64957031400638fa5f8"/> - <dependencies> - <dep package="app-xlogo"/> - </dependencies> - </tarball> - <tarball id="app/xlsatoms" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xlsatoms-X11R7.0-1.0.1.tar.bz2" - size="74840" md5sum="737b4d7893aa886e8e4181c94380a421"/> - <dependencies> - <dep package="app-xlsatoms"/> - </dependencies> - </tarball> - <tarball id="app/xlsclients" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xlsclients-X11R7.0-1.0.1.tar.bz2" - size="75661" md5sum="cc0d64e90eab0b90b38355e841824588"/> - <dependencies> - <dep package="app-xlsclients"/> - </dependencies> - </tarball> - <tarball id="app/xlsfonts" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xlsfonts-X11R7.0-1.0.1.tar.bz2" - size="87658" md5sum="e8681e5671e7f01922ce6c8f2327e602"/> - <dependencies> - <dep package="app-xlsfonts"/> - </dependencies> - </tarball> - <tarball id="app/xmag" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xmag-X11R7.0-1.0.1.tar.bz2" - size="93663" md5sum="38ac487ac1b75be0253fe7f973947386"/> - <dependencies> - <dep package="app-xmag"/> - </dependencies> - </tarball> - <tarball id="app/xman" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xman-X11R7.0-1.0.1.tar.bz2" - size="134005" md5sum="a4f21547120952aeb8e5663ebd72e843"/> - <dependencies> - <dep package="app-xman"/> - </dependencies> - </tarball> - <tarball id="app/xmessage" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xmessage-X11R7.0-1.0.1.tar.bz2" - size="83378" md5sum="5a17607184fd348c2b36b5499ae9d2e6"/> - <dependencies> - <dep package="app-xmessage"/> - </dependencies> - </tarball> - <tarball id="app/xmh" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xmh-X11R7.0-1.0.1.tar.bz2" - size="153096" md5sum="53af2f87dc096d84f11ca6fbd6748b34"/> - <dependencies> - <dep package="app-xmh"/> - </dependencies> - </tarball> - <tarball id="app/xmodmap" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xmodmap-X11R7.0-1.0.0.tar.bz2" - size="89685" md5sum="240ed53111925e005d2f138ea98ef5e1"/> - <dependencies> - <dep package="app-xmodmap"/> - </dependencies> - </tarball> - <tarball id="app/xmore" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xmore-X11R7.0-1.0.1.tar.bz2" - size="92055" md5sum="99a48c50d486b7c9098b4f5598782cac"/> - <dependencies> - <dep package="app-xmore"/> - </dependencies> - </tarball> - <tarball id="app/xphelloworld" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xphelloworld-X11R7.0-1.0.1.tar.bz2" - size="73098" md5sum="80c9a23c7efb72b9674d7af6b7346992"/> - <dependencies> - <dep package="app-xphelloworld"/> - </dependencies> - </tarball> - <tarball id="app/xplsprinters" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xplsprinters-X11R7.0-1.0.1.tar.bz2" - size="77170" md5sum="1d0a68dada5e14ab07d7660abd4d03e3"/> - <dependencies> - <dep package="app-xplsprinters"/> - </dependencies> - </tarball> - <tarball id="app/xprehashprinterlist" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xprehashprinterlist-X11R7.0-1.0.1.tar.bz2" - size="75554" md5sum="3907bce78d304dedb2a5dd6944bd2ed5"/> - <dependencies> - <dep package="app-xprehashprinterlist"/> - </dependencies> - </tarball> - <tarball id="app/xprop" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xprop-X11R7.0-1.0.1.tar.bz2" - size="92550" md5sum="6730f0fbad6969825580de46e66b44dd"/> - <dependencies> - <dep package="app-xprop"/> - </dependencies> - </tarball> - <tarball id="app/xpr" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xpr-X11R7.0-1.0.1.tar.bz2" - size="107488" md5sum="487b5ab96b373acb80808758ce23eb49"/> - <dependencies> - <dep package="app-xpr"/> - </dependencies> - </tarball> - <tarball id="app/xrandr" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xrandr-X11R7.0-1.0.1.tar.bz2" - size="76130" md5sum="e433ccca3c4f9ab8609dfd1c9c8e36ea"/> - <dependencies> - <dep package="app-xrandr"/> - </dependencies> - </tarball> - <tarball id="app/xrdb" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xrdb-X11R7.0-1.0.1.tar.bz2" - size="85598" md5sum="a3c1fd6f5391de7f810239a912d39fa5"/> - <dependencies> - <dep package="app-xrdb"/> - </dependencies> - </tarball> - <tarball id="app/xrefresh" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xrefresh-X11R7.0-1.0.1.tar.bz2" - size="76351" md5sum="5a46d5fb82aeeb4d6aac58c9cc367439"/> - <dependencies> - <dep package="app-xrefresh"/> - </dependencies> - </tarball> - <tarball id="app/xrx" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xrx-X11R7.0-1.0.1.tar.bz2" - size="260441" md5sum="9de3b04392c98df59c79a34fd51c385f"/> - <dependencies> - <dep package="app-xrx"/> - </dependencies> - </tarball> - <tarball id="app/xsetmode" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xsetmode-X11R7.0-1.0.0.tar.bz2" - size="73740" md5sum="d83d6ef0b73762feab724aab95d9a4a2"/> - <dependencies> - <dep package="app-xsetmode"/> - </dependencies> - </tarball> - <tarball id="app/xsetpointer" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xsetpointer-X11R7.0-1.0.0.tar.bz2" - size="73882" md5sum="195614431e2431508e07a42a3b6d4568"/> - <dependencies> - <dep package="app-xsetpointer"/> - </dependencies> - </tarball> - <tarball id="app/xsetroot" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xsetroot-X11R7.0-1.0.1.tar.bz2" - size="77672" md5sum="e2831b39cd395d6f6f4824b0e25f55ed"/> - <dependencies> - <dep package="app-xsetroot"/> - </dependencies> - </tarball> - <tarball id="app/xset" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xset-X11R7.0-1.0.1.tar.bz2" - size="88719" md5sum="a0350e334a215829166266e2ce504b1c"/> - <dependencies> - <dep package="app-xset"/> - </dependencies> - </tarball> - <tarball id="app/xsm" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xsm-X11R7.0-1.0.1.tar.bz2" - size="116842" md5sum="e3588272ce3b7dc21d42ead683135a8a"/> - <dependencies> - <dep package="app-xsm"/> - </dependencies> - </tarball> - <tarball id="app/xstdcmap" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xstdcmap-X11R7.0-1.0.1.tar.bz2" - size="76275" md5sum="e276aa02d44dcacf5ac13aa0cabd404d"/> - <dependencies> - <dep package="app-xstdcmap"/> - </dependencies> - </tarball> - <tarball id="app/xtrap" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xtrap-X11R7.0-1.0.1.tar.bz2" - size="91255" md5sum="6d56946322d2875eb33f25f5e5f621a3"/> - <dependencies> - <dep package="app-xtrap"/> - </dependencies> - </tarball> - <tarball id="app/xvidtune" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xvidtune-X11R7.0-1.0.1.tar.bz2" - size="88178" md5sum="a12e27fb732cb115b6adc4c724c44c5d"/> - <dependencies> - <dep package="app-xvidtune"/> - </dependencies> - </tarball> - <tarball id="app/xvinfo" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xvinfo-X11R7.0-1.0.1.tar.bz2" - size="74754" md5sum="39d79590345bed51da6df838f6490cbf"/> - <dependencies> - <dep package="app-xvinfo"/> - </dependencies> - </tarball> - <tarball id="app/xwd" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xwd-X11R7.0-1.0.1.tar.bz2" - size="97002" md5sum="596c443465ab9ab67c59c794261d4571"/> - <dependencies> - <dep package="app-xwd"/> - </dependencies> - </tarball> - <tarball id="app/xwininfo" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xwininfo-X11R7.0-1.0.1.tar.bz2" - size="87409" md5sum="3ec67e4e1b9f5a1fe7e56b56ab931893"/> - <dependencies> - <dep package="app-xwininfo"/> - </dependencies> - </tarball> - <tarball id="app/xwud" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/app/xwud-X11R7.0-1.0.1.tar.bz2" - size="83089" md5sum="e08d2ee04abb89a6348f47c84a1ff3ed"/> - <dependencies> - <dep package="app-xwud"/> - </dependencies> - </tarball> - <tarball id="data/xbitmaps" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/data/xbitmaps-X11R7.0-1.0.1.tar.bz2" - size="55492" md5sum="22c6f4a17220cd6b41d9799905f8e357"/> - <dependencies> - <dep package="data-xbitmaps"/> - </dependencies> - </tarball> - <tarball id="data/xcursor-themes" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/data/xcursor-themes-X11R7.0-1.0.1.tar.bz2" - size="2219697" md5sum="c39afeae55a7d330297b2fec3d113634"/> - <dependencies> - <dep package="data-xcursor-themes"/> - </dependencies> - </tarball> - <tarball id="data/xkbdata" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/data/xkbdata-X11R7.0-1.0.1.tar.bz2" - size="285091" md5sum="1f706f92334ee65818512b3b45d7be65"/> - <dependencies> - <dep package="data-xkbdata"/> - </dependencies> - </tarball> - <tarball id="doc/xorg-docs" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/doc/xorg-docs-X11R7.0-1.0.1.tar.bz2" - size="8339757" md5sum="ac0d76afa46ef5da9e1cf33558f4b303"/> - <dependencies> - <dep package="doc-xorg-docs"/> - </dependencies> - </tarball> - <tarball id="doc/xorg-sgml-doctools" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/doc/xorg-sgml-doctools-X11R7.0-1.0.1.tar.bz2" - size="37232" md5sum="d08d4fd10ac46d8b4636efe4d8c0de74"/> - <dependencies> - <dep package="doc-xorg-sgml-doctools"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-acecad" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-acecad-X11R7.0-1.0.0.5.tar.bz2" - size="213979" md5sum="b35b1756579ebe296801622bdf063ab1"/> - <dependencies> - <dep package="driver-xf86-input-acecad"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-aiptek" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-aiptek-X11R7.0-1.0.0.5.tar.bz2" - size="225634" md5sum="9ee5109ef33e281ce0784ad077f26cee"/> - <dependencies> - <dep package="driver-xf86-input-aiptek"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-calcomp" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-calcomp-X11R7.0-1.0.0.5.tar.bz2" - size="215168" md5sum="f4199b5df063701462d5a8c84aadd190"/> - <dependencies> - <dep package="driver-xf86-input-calcomp"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-citron" version="X11R7.0-2.1.1.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-citron-X11R7.0-2.1.1.5.tar.bz2" - size="233902" md5sum="62b5405d337bc055bc9345565cc0da8c"/> - <dependencies> - <dep package="driver-xf86-input-citron"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-digitaledge" version="X11R7.0-1.0.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-digitaledge-X11R7.0-1.0.1.3.tar.bz2" - size="216971" md5sum="8342f3a0dcdaa1120af01dd25dabf0d7"/> - <dependencies> - <dep package="driver-xf86-input-digitaledge"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-dmc" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-dmc-X11R7.0-1.0.0.5.tar.bz2" - size="212774" md5sum="fdf127a2d419f7c2e02bec27273091d3"/> - <dependencies> - <dep package="driver-xf86-input-dmc"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-dynapro" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-dynapro-X11R7.0-1.0.0.5.tar.bz2" - size="212029" md5sum="89dbb839ab4c5fca3dbc3c2805a7efb9"/> - <dependencies> - <dep package="driver-xf86-input-dynapro"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-elo2300" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-elo2300-X11R7.0-1.0.0.5.tar.bz2" - size="214388" md5sum="6009a17f13a37bfde8b60c2fba5b0e5b"/> - <dependencies> - <dep package="driver-xf86-input-elo2300"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-elographics" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-elographics-X11R7.0-1.0.0.5.tar.bz2" - size="219736" md5sum="24c33f833bb2db72a07c3d28bfc0aae9"/> - <dependencies> - <dep package="driver-xf86-input-elographics"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-evdev" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-evdev-X11R7.0-1.0.0.5.tar.bz2" - size="212372" md5sum="d982c6f185f4c75a4b65703ceed7be06"/> - <dependencies> - <dep package="driver-xf86-input-evdev"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-fpit" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-fpit-X11R7.0-1.0.0.5.tar.bz2" - size="215828" md5sum="fc0e11fefc322623914a2d819d5b6d51"/> - <dependencies> - <dep package="driver-xf86-input-fpit"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-hyperpen" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-hyperpen-X11R7.0-1.0.0.5.tar.bz2" - size="218554" md5sum="0c4f2a6390e3045e4c48a48b47b6332c"/> - <dependencies> - <dep package="driver-xf86-input-hyperpen"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-jamstudio" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-jamstudio-X11R7.0-1.0.0.5.tar.bz2" - size="209954" md5sum="49de35ca024be2cb785832ae37ec30d0"/> - <dependencies> - <dep package="driver-xf86-input-jamstudio"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-joystick" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-joystick-X11R7.0-1.0.0.5.tar.bz2" - size="212507" md5sum="9e3ba60836f4c1d2e4cebc63a28321b4"/> - <dependencies> - <dep package="driver-xf86-input-joystick"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-keyboard" version="X11R7.0-1.0.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-keyboard-X11R7.0-1.0.1.3.tar.bz2" - size="215665" md5sum="8fb8a30fd9d7f152a1aef4eb8ef32b3f"/> - <dependencies> - <dep package="driver-xf86-input-keyboard"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-magellan" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-magellan-X11R7.0-1.0.0.5.tar.bz2" - size="212433" md5sum="fd7367f467dc3302604274cee59a7c7b"/> - <dependencies> - <dep package="driver-xf86-input-magellan"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-magictouch" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-magictouch-X11R7.0-1.0.0.5.tar.bz2" - size="214562" md5sum="a51d84792b8c0079d7c8d13eb17acf31"/> - <dependencies> - <dep package="driver-xf86-input-magictouch"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-microtouch" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-microtouch-X11R7.0-1.0.0.5.tar.bz2" - size="215714" md5sum="0c25e0340b6483fb2a600b0e885724a2"/> - <dependencies> - <dep package="driver-xf86-input-microtouch"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-mouse" version="X11R7.0-1.0.3.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-mouse-X11R7.0-1.0.3.1.tar.bz2" - size="259054" md5sum="12a908e5a97b1b03e8717abf167f4f27"/> - <dependencies> - <dep package="driver-xf86-input-mouse"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-mutouch" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-mutouch-X11R7.0-1.0.0.5.tar.bz2" - size="219973" md5sum="4758e667bfbba517df2a58d51270cfe2"/> - <dependencies> - <dep package="driver-xf86-input-mutouch"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-palmax" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-palmax-X11R7.0-1.0.0.5.tar.bz2" - size="213854" md5sum="d138024a20298304af883631d23c5338"/> - <dependencies> - <dep package="driver-xf86-input-palmax"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-penmount" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-penmount-X11R7.0-1.0.0.5.tar.bz2" - size="212934" md5sum="065b1cf862864741aebcfefcc7c09539"/> - <dependencies> - <dep package="driver-xf86-input-penmount"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-spaceorb" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-spaceorb-X11R7.0-1.0.0.5.tar.bz2" - size="211269" md5sum="193ca7b1e87c3995b86f15a01b63b297"/> - <dependencies> - <dep package="driver-xf86-input-spaceorb"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-summa" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-summa-X11R7.0-1.0.0.5.tar.bz2" - size="218264" md5sum="61d780857e5dc139081718c075e74a01"/> - <dependencies> - <dep package="driver-xf86-input-summa"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-tek4957" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-tek4957-X11R7.0-1.0.0.5.tar.bz2" - size="213488" md5sum="df633403c91a48c6a316c6a5f48e53e2"/> - <dependencies> - <dep package="driver-xf86-input-tek4957"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-ur98" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-ur98-X11R7.0-1.0.0.5.tar.bz2" - size="214459" md5sum="9b1530b3dcbb77690ad0e61f60489899"/> - <dependencies> - <dep package="driver-xf86-input-ur98"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-input-void" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-input-void-X11R7.0-1.0.0.5.tar.bz2" - size="209891" md5sum="c7ae53dee1f3e95fa5ce9659b34d8446"/> - <dependencies> - <dep package="driver-xf86-input-void"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-apm" version="X11R7.0-1.0.1.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-apm-X11R7.0-1.0.1.5.tar.bz2" - size="255034" md5sum="323911ab16a6147d3cabceff9336a3d2"/> - <dependencies> - <dep package="driver-xf86-video-apm"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-ark" version="X11R7.0-0.5.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-ark-X11R7.0-0.5.0.5.tar.bz2" - size="215060" md5sum="342937e275dbc92f437417a3186a8222"/> - <dependencies> - <dep package="driver-xf86-video-ark"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-ati" version="X11R7.0-6.5.7.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-ati-X11R7.0-6.5.7.3.tar.bz2" - size="659422" md5sum="92525195a7a36f5ffbffcb4e6a564e50"/> - <dependencies> - <dep package="driver-xf86-video-ati"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-chips" version="X11R7.0-1.0.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-chips-X11R7.0-1.0.1.3.tar.bz2" - size="302529" md5sum="90f23505faceac30d3f46ab94f7293e1"/> - <dependencies> - <dep package="driver-xf86-video-chips"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-cirrus" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-cirrus-X11R7.0-1.0.0.5.tar.bz2" - size="250335" md5sum="7708693ad9d73cd76d4caef7c644a46f"/> - <dependencies> - <dep package="driver-xf86-video-cirrus"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-cyrix" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-cyrix-X11R7.0-1.0.0.5.tar.bz2" - size="230817" md5sum="14f868d16554b19fef4f30398a7b9cf1"/> - <dependencies> - <dep package="driver-xf86-video-cyrix"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-dummy" version="X11R7.0-0.1.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-dummy-X11R7.0-0.1.0.5.tar.bz2" - size="212668" md5sum="462654f9be7e3022f97147e3390db97a"/> - <dependencies> - <dep package="driver-xf86-video-dummy"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-fbdev" version="X11R7.0-0.1.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-fbdev-X11R7.0-0.1.0.5.tar.bz2" - size="215158" md5sum="1cf374eeb9151ac16a7ec2cd38048737"/> - <dependencies> - <dep package="driver-xf86-video-fbdev"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-glint" version="X11R7.0-1.0.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-glint-X11R7.0-1.0.1.3.tar.bz2" - size="320027" md5sum="f14c2f1696c05760207adcaac856e5e5"/> - <dependencies> - <dep package="driver-xf86-video-glint"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-i128" version="X11R7.0-1.1.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-i128-X11R7.0-1.1.0.5.tar.bz2" - size="250215" md5sum="078eed8c3673488ee618dfc7a3ef101b"/> - <dependencies> - <dep package="driver-xf86-video-i128"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-i740" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-i740-X11R7.0-1.0.0.5.tar.bz2" - size="240418" md5sum="625448b13ebe2a13b7defad1efec05c4"/> - <dependencies> - <dep package="driver-xf86-video-i740"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-i810" version="X11R7.0-1.4.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-i810-X11R7.0-1.4.1.3.tar.bz2" - size="356294" md5sum="fe6bec726fc1657b537508bbe8c2005b"/> - <dependencies> - <dep package="driver-xf86-video-i810"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-imstt" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-imstt-X11R7.0-1.0.0.5.tar.bz2" - size="217637" md5sum="cc949688918b78f830d78a9613e6896b"/> - <dependencies> - <dep package="driver-xf86-video-imstt"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-mga" version="X11R7.0-1.2.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-mga-X11R7.0-1.2.1.3.tar.bz2" - size="335360" md5sum="cb0409782020b5cc7edc273624ffdd17"/> - <dependencies> - <dep package="driver-xf86-video-mga"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-neomagic" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-neomagic-X11R7.0-1.0.0.5.tar.bz2" - size="250327" md5sum="ffe9015678a41e97bdbd2825066bb47b"/> - <dependencies> - <dep package="driver-xf86-video-neomagic"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-newport" version="X11R7.0-0.1.4.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-newport-X11R7.0-0.1.4.1.tar.bz2" - size="233693" md5sum="d74d9896d57c3caf224ba3472630d874"/> - <dependencies> - <dep package="driver-xf86-video-newport"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-nsc" version="X11R7.0-2.7.6.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-nsc-X11R7.0-2.7.6.5.tar.bz2" - size="453051" md5sum="ab16611b3ec7d21503b16b0a31addae0"/> - <dependencies> - <dep package="driver-xf86-video-nsc"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-nv" version="X11R7.0-1.0.1.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-nv-X11R7.0-1.0.1.5.tar.bz2" - size="267738" md5sum="9a88547fe550e20edcc5a938d31e22b1"/> - <dependencies> - <dep package="driver-xf86-video-nv"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-rendition" version="X11R7.0-4.0.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-rendition-X11R7.0-4.0.1.3.tar.bz2" - size="278961" md5sum="f1a25db74a148dea45115e813027b932"/> - <dependencies> - <dep package="driver-xf86-video-rendition"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-s3virge" version="X11R7.0-1.8.6.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-s3virge-X11R7.0-1.8.6.5.tar.bz2" - size="270294" md5sum="d0164c37749ab5f565db9813487e1900"/> - <dependencies> - <dep package="driver-xf86-video-s3virge"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-s3" version="X11R7.0-0.3.5.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-s3-X11R7.0-0.3.5.5.tar.bz2" - size="234539" md5sum="83b9e8a9b8fc1c49bda2811358e5007c"/> - <dependencies> - <dep package="driver-xf86-video-s3"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-savage" version="X11R7.0-2.0.2.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-savage-X11R7.0-2.0.2.3.tar.bz2" - size="282811" md5sum="6b638dd500d10dba1822d3ea5061fc65"/> - <dependencies> - <dep package="driver-xf86-video-savage"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-siliconmotion" version="X11R7.0-1.3.1.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-siliconmotion-X11R7.0-1.3.1.5.tar.bz2" - size="257549" md5sum="957de4e2a3c687dbb2e9e18582397804"/> - <dependencies> - <dep package="driver-xf86-video-siliconmotion"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-sisusb" version="X11R7.0-0.7.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-sisusb-X11R7.0-0.7.1.3.tar.bz2" - size="282820" md5sum="781d726a0ca54b65521e383ab99043c8"/> - <dependencies> - <dep package="driver-xf86-video-sisusb"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-sis" version="X11R7.0-0.8.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-sis-X11R7.0-0.8.1.3.tar.bz2" - size="585512" md5sum="e3bac5a208b8bacfbec236b5a5b0ef40"/> - <dependencies> - <dep package="driver-xf86-video-sis"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-sunbw2" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-sunbw2-X11R7.0-1.0.0.5.tar.bz2" - size="211092" md5sum="0cdda1ab939ea1190c142aa8aabfaf83"/> - <dependencies> - <dep package="driver-xf86-video-sunbw2"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-suncg14" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-suncg14-X11R7.0-1.0.0.5.tar.bz2" - size="212377" md5sum="8f3a734d02ae716415f9c6344fa661bd"/> - <dependencies> - <dep package="driver-xf86-video-suncg14"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-suncg3" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-suncg3-X11R7.0-1.0.0.5.tar.bz2" - size="210725" md5sum="799a54cef1f4435e00fa94a1d97d056f"/> - <dependencies> - <dep package="driver-xf86-video-suncg3"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-suncg6" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-suncg6-X11R7.0-1.0.0.5.tar.bz2" - size="215040" md5sum="2227f3fb86b02148f347e002662e53c8"/> - <dependencies> - <dep package="driver-xf86-video-suncg6"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-sunffb" version="X11R7.0-1.0.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-sunffb-X11R7.0-1.0.1.3.tar.bz2" - size="278439" md5sum="bb5182e3b74b3baa6fee245ac8bbf09a"/> - <dependencies> - <dep package="driver-xf86-video-sunffb"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-sunleo" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-sunleo-X11R7.0-1.0.0.5.tar.bz2" - size="220890" md5sum="deb17a74ba68ee9593ac774206bd3612"/> - <dependencies> - <dep package="driver-xf86-video-sunleo"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-suntcx" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-suntcx-X11R7.0-1.0.0.5.tar.bz2" - size="214253" md5sum="74d6ba5e55afdfebff84db08b6589e26"/> - <dependencies> - <dep package="driver-xf86-video-suntcx"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-tdfx" version="X11R7.0-1.1.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-tdfx-X11R7.0-1.1.1.3.tar.bz2" - size="257113" md5sum="0201415230bf0454384c3bad099520d2"/> - <dependencies> - <dep package="driver-xf86-video-tdfx"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-tga" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-tga-X11R7.0-1.0.0.5.tar.bz2" - size="244810" md5sum="fa67bf34454888d38e15708395cfed87"/> - <dependencies> - <dep package="driver-xf86-video-tga"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-trident" version="X11R7.0-1.0.1.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-trident-X11R7.0-1.0.1.2.tar.bz2" - size="261260" md5sum="69f28afc7b585d01bb06b1e2f872f8ea"/> - <dependencies> - <dep package="driver-xf86-video-trident"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-tseng" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-tseng-X11R7.0-1.0.0.5.tar.bz2" - size="260944" md5sum="981f46914c1e54742418f0444ea2e092"/> - <dependencies> - <dep package="driver-xf86-video-tseng"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-v4l" version="X11R7.0-0.0.1.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-v4l-X11R7.0-0.0.1.5.tar.bz2" - size="218210" md5sum="e422c63bc83717ecd0686aef2036802b"/> - <dependencies> - <dep package="driver-xf86-video-v4l"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-vesa" version="X11R7.0-1.0.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-vesa-X11R7.0-1.0.1.3.tar.bz2" - size="218918" md5sum="049ada4df1abb5aa2b6633ba90353e78"/> - <dependencies> - <dep package="driver-xf86-video-vesa"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-vga" version="X11R7.0-4.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-vga-X11R7.0-4.0.0.5.tar.bz2" - size="216215" md5sum="24437857707acc337cab331cc56f64e2"/> - <dependencies> - <dep package="driver-xf86-video-vga"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-via" version="X11R7.0-0.1.33.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-via-X11R7.0-0.1.33.2.tar.bz2" - size="355172" md5sum="4d3268d226a40f580ab105796bfed1f5"/> - <dependencies> - <dep package="driver-xf86-video-via"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-vmware" version="X11R7.0-10.11.1.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-vmware-X11R7.0-10.11.1.3.tar.bz2" - size="239037" md5sum="4df79349e26add4c23f6be8bec347ad4"/> - <dependencies> - <dep package="driver-xf86-video-vmware"/> - </dependencies> - </tarball> - <tarball id="driver/xf86-video-voodoo" version="X11R7.0-1.0.0.5"> - <source href="http://ftp.x.org/pub/X11R7.0/src/driver/xf86-video-voodoo-X11R7.0-1.0.0.5.tar.bz2" - size="226952" md5sum="e00cc814ebdb3f3067e075bc93b26199"/> - <dependencies> - <dep package="driver-xf86-video-voodoo"/> - </dependencies> - </tarball> - <tarball id="font/encodings" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/encodings-X11R7.0-1.0.0.tar.bz2" - size="594892" md5sum="385cbd4093b610610ca54c06cbb0f497"/> - <dependencies> - <dep package="font-encodings"/> - </dependencies> - </tarball> - <tarball id="font/font-adobe-100dpi" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-adobe-100dpi-X11R7.0-1.0.0.tar.bz2" - size="1007038" md5sum="f5de34fa63976de9263f032453348f6c"/> - <dependencies> - <dep package="font-font-adobe-100dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-adobe-75dpi" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-adobe-75dpi-X11R7.0-1.0.0.tar.bz2" - size="789768" md5sum="361fc4c9da3c34c5105df4f4688029d0"/> - <dependencies> - <dep package="font-font-adobe-75dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-adobe-utopia-100dpi" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-adobe-utopia-100dpi-X11R7.0-1.0.1.tar.bz2" - size="284406" md5sum="b720eed8eba0e4c5bcb9fdf6c2003355"/> - <dependencies> - <dep package="font-font-adobe-utopia-100dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-adobe-utopia-75dpi" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-adobe-utopia-75dpi-X11R7.0-1.0.1.tar.bz2" - size="206053" md5sum="a6d5d355b92a7e640698c934b0b79b53"/> - <dependencies> - <dep package="font-font-adobe-utopia-75dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-adobe-utopia-type1" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-adobe-utopia-type1-X11R7.0-1.0.1.tar.bz2" - size="208787" md5sum="db1cc2f707cffd08a461f093b55ced5e"/> - <dependencies> - <dep package="font-font-adobe-utopia-type1"/> - </dependencies> - </tarball> - <tarball id="font/font-alias" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-alias-X11R7.0-1.0.1.tar.bz2" - size="42497" md5sum="de7035b15ba7edc36f8685ab3c17a9cf"/> - <dependencies> - <dep package="font-font-alias"/> - </dependencies> - </tarball> - <tarball id="font/font-arabic-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-arabic-misc-X11R7.0-1.0.0.tar.bz2" - size="52842" md5sum="b95dc750ddc7d511e1f570034d9e1b27"/> - <dependencies> - <dep package="font-font-arabic-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-bh-100dpi" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bh-100dpi-X11R7.0-1.0.0.tar.bz2" - size="642898" md5sum="29eeed0ad42653f27b929119581deb3e"/> - <dependencies> - <dep package="font-font-bh-100dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-bh-75dpi" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bh-75dpi-X11R7.0-1.0.0.tar.bz2" - size="475715" md5sum="7546c97560eb325400365adbc426308b"/> - <dependencies> - <dep package="font-font-bh-75dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-bh-lucidatypewriter-100dpi" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bh-lucidatypewriter-100dpi-X11R7.0-1.0.0.tar.bz2" - size="179267" md5sum="8a56f4cbea74f4dbbf9bdac95686dca8"/> - <dependencies> - <dep package="font-font-bh-lucidatypewriter-100dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-bh-lucidatypewriter-75dpi" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bh-lucidatypewriter-75dpi-X11R7.0-1.0.0.tar.bz2" - size="151564" md5sum="e5cccf93f4f1f793cd32adfa81cc1b40"/> - <dependencies> - <dep package="font-font-bh-lucidatypewriter-75dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-bh-ttf" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bh-ttf-X11R7.0-1.0.0.tar.bz2" - size="370568" md5sum="53b984889aec3c0c2eb07f8aaa49dba9"/> - <dependencies> - <dep package="font-font-bh-ttf"/> - </dependencies> - </tarball> - <tarball id="font/font-bh-type1" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bh-type1-X11R7.0-1.0.0.tar.bz2" - size="571692" md5sum="302111513d1e94303c0ec0139d5ae681"/> - <dependencies> - <dep package="font-font-bh-type1"/> - </dependencies> - </tarball> - <tarball id="font/font-bitstream-100dpi" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bitstream-100dpi-X11R7.0-1.0.0.tar.bz2" - size="129846" md5sum="dc595e77074de890974726769f25e123"/> - <dependencies> - <dep package="font-font-bitstream-100dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-bitstream-75dpi" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bitstream-75dpi-X11R7.0-1.0.0.tar.bz2" - size="103866" md5sum="408515646743d14e1e2e240da4fffdc2"/> - <dependencies> - <dep package="font-font-bitstream-75dpi"/> - </dependencies> - </tarball> - <tarball id="font/font-bitstream-speedo" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bitstream-speedo-X11R7.0-1.0.0.tar.bz2" - size="337301" md5sum="068c78ce48e5e6c4f25e0bba839a6b7a"/> - <dependencies> - <dep package="font-font-bitstream-speedo"/> - </dependencies> - </tarball> - <tarball id="font/font-bitstream-type1" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-bitstream-type1-X11R7.0-1.0.0.tar.bz2" - size="352053" md5sum="f4881a7e28eaeb7580d5eaf0f09239da"/> - <dependencies> - <dep package="font-font-bitstream-type1"/> - </dependencies> - </tarball> - <tarball id="font/font-cronyx-cyrillic" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-cronyx-cyrillic-X11R7.0-1.0.0.tar.bz2" - size="182134" md5sum="447163fff74b57968fc5139d8b2ad988"/> - <dependencies> - <dep package="font-font-cronyx-cyrillic"/> - </dependencies> - </tarball> - <tarball id="font/font-cursor-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-cursor-misc-X11R7.0-1.0.0.tar.bz2" - size="42627" md5sum="82e89de0e1b9c95f32b0fc12f5131d2c"/> - <dependencies> - <dep package="font-font-cursor-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-daewoo-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-daewoo-misc-X11R7.0-1.0.0.tar.bz2" - size="668277" md5sum="2fd7e6c8c21990ad906872efd02f3873"/> - <dependencies> - <dep package="font-font-daewoo-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-dec-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-dec-misc-X11R7.0-1.0.0.tar.bz2" - size="40713" md5sum="7ff9aba4c65aa226bda7528294c7998c"/> - <dependencies> - <dep package="font-font-dec-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-ibm-type1" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-ibm-type1-X11R7.0-1.0.0.tar.bz2" - size="315301" md5sum="fab2c49cb0f9fcee0bc0ac77e510d4e5"/> - <dependencies> - <dep package="font-font-ibm-type1"/> - </dependencies> - </tarball> - <tarball id="font/font-isas-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-isas-misc-X11R7.0-1.0.0.tar.bz2" - size="781027" md5sum="c0981507c9276c22956c7bfe932223d9"/> - <dependencies> - <dep package="font-font-isas-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-jis-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-jis-misc-X11R7.0-1.0.0.tar.bz2" - size="555563" md5sum="3732ca6c34d03e44c73f0c103512ef26"/> - <dependencies> - <dep package="font-font-jis-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-micro-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-micro-misc-X11R7.0-1.0.0.tar.bz2" - size="38802" md5sum="eb0050d73145c5b9fb6b9035305edeb6"/> - <dependencies> - <dep package="font-font-micro-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-misc-cyrillic" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-misc-cyrillic-X11R7.0-1.0.0.tar.bz2" - size="65603" md5sum="58d31311e8e51efbe16517adaf1a239d"/> - <dependencies> - <dep package="font-font-misc-cyrillic"/> - </dependencies> - </tarball> - <tarball id="font/font-misc-ethiopic" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-misc-ethiopic-X11R7.0-1.0.0.tar.bz2" - size="184289" md5sum="190738980705826a27fbf4685650d3b9"/> - <dependencies> - <dep package="font-font-misc-ethiopic"/> - </dependencies> - </tarball> - <tarball id="font/font-misc-meltho" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-misc-meltho-X11R7.0-1.0.0.tar.bz2" - size="1446293" md5sum="8812c57220bcd139b4ba6266eafbd712"/> - <dependencies> - <dep package="font-font-misc-meltho"/> - </dependencies> - </tarball> - <tarball id="font/font-misc-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-misc-misc-X11R7.0-1.0.0.tar.bz2" - size="1831073" md5sum="4a5a7987183a9e1ea232c8391ae4c244"/> - <dependencies> - <dep package="font-font-misc-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-mutt-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-mutt-misc-X11R7.0-1.0.0.tar.bz2" - size="199237" md5sum="139b368edecf8185d16a33b4a7c09657"/> - <dependencies> - <dep package="font-font-mutt-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-schumacher-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-schumacher-misc-X11R7.0-1.0.0.tar.bz2" - size="78036" md5sum="d51808138ef63b84363f7d82ed8bb681"/> - <dependencies> - <dep package="font-font-schumacher-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-screen-cyrillic" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-screen-cyrillic-X11R7.0-1.0.0.tar.bz2" - size="42859" md5sum="c08da585feb173e1b27c3fbf8f90ba45"/> - <dependencies> - <dep package="font-font-screen-cyrillic"/> - </dependencies> - </tarball> - <tarball id="font/font-sony-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-sony-misc-X11R7.0-1.0.0.tar.bz2" - size="48447" md5sum="014725f97635da9e5e9b303ab796817e"/> - <dependencies> - <dep package="font-font-sony-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-sun-misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-sun-misc-X11R7.0-1.0.0.tar.bz2" - size="56437" md5sum="0259436c430034f24f3b239113c9630e"/> - <dependencies> - <dep package="font-font-sun-misc"/> - </dependencies> - </tarball> - <tarball id="font/font-util" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-util-X11R7.0-1.0.0.tar.bz2" - size="94683" md5sum="73cc445cb20a658037ad3a7ac571f525"/> - <dependencies> - <dep package="font-font-util"/> - </dependencies> - </tarball> - <tarball id="font/font-winitzki-cyrillic" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-winitzki-cyrillic-X11R7.0-1.0.0.tar.bz2" - size="41002" md5sum="6dc447609609e4e2454ad7da29873501"/> - <dependencies> - <dep package="font-font-winitzki-cyrillic"/> - </dependencies> - </tarball> - <tarball id="font/font-xfree86-type1" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/font/font-xfree86-type1-X11R7.0-1.0.0.tar.bz2" - size="66041" md5sum="27a6bbf5c8bbe998ff7e8537929ccbc8"/> - <dependencies> - <dep package="font-font-xfree86-type1"/> - </dependencies> - </tarball> - <tarball id="lib/libAppleWM" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libAppleWM-X11R7.0-1.0.0.tar.bz2" - size="208693" md5sum="8af30932ebc278835375fca34a2790f5"/> - <dependencies> - <dep package="lib-libAppleWM"/> - </dependencies> - </tarball> - <tarball id="lib/libdmx" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libdmx-X11R7.0-1.0.1.tar.bz2" - size="213045" md5sum="ae6b3c48f1349fc5dfa7d7c4b9cf4718"/> - <dependencies> - <dep package="lib-libdmx"/> - </dependencies> - </tarball> - <tarball id="lib/libfontenc" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libfontenc-X11R7.0-1.0.1.tar.bz2" - size="211589" md5sum="d7971cbb2d1000737bba86a4bd70b900"/> - <dependencies> - <dep package="lib-libfontenc"/> - </dependencies> - </tarball> - <tarball id="lib/libFS" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libFS-X11R7.0-1.0.0.tar.bz2" - size="229218" md5sum="12d2d89e7eb6ab0eb5823c3296f4e7a5"/> - <dependencies> - <dep package="lib-libFS"/> - </dependencies> - </tarball> - <tarball id="lib/libICE" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libICE-X11R7.0-1.0.0.tar.bz2" - size="239843" md5sum="c778084b135311726da8dc74a16b3555"/> - <dependencies> - <dep package="lib-libICE"/> - </dependencies> - </tarball> - <tarball id="lib/liblbxutil" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/liblbxutil-X11R7.0-1.0.0.tar.bz2" - size="222016" md5sum="1bcffde85723f78243d1ba60e1ebaef6"/> - <dependencies> - <dep package="lib-liblbxutil"/> - </dependencies> - </tarball> - <tarball id="lib/liboldX" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/liboldX-X11R7.0-1.0.1.tar.bz2" - size="210365" md5sum="a443a2dc15aa96a3d18340a1617d1bae"/> - <dependencies> - <dep package="lib-liboldX"/> - </dependencies> - </tarball> - <tarball id="lib/libSM" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libSM-X11R7.0-1.0.0.tar.bz2" - size="220369" md5sum="8a4eec299e8f14e26200718af7b2dcfc"/> - <dependencies> - <dep package="lib-libSM"/> - </dependencies> - </tarball> - <tarball id="lib/libWindowsWM" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libWindowsWM-X11R7.0-1.0.0.tar.bz2" - size="211133" md5sum="d94f0389cd655b50e2987d5b988b82a5"/> - <dependencies> - <dep package="lib-libWindowsWM"/> - </dependencies> - </tarball> - <tarball id="lib/libX11" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libX11-X11R7.0-1.0.0.tar.bz2" - size="1344417" md5sum="dcf59f148c978816ebbe3fbc5c9ef0e1"/> - <dependencies> - <dep package="lib-libX11"/> - </dependencies> - </tarball> - <tarball id="lib/libXau" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXau-X11R7.0-1.0.0.tar.bz2" - size="213408" md5sum="51ceac78ae0eaf40ffb77b3cccc028cc"/> - <dependencies> - <dep package="lib-libXau"/> - </dependencies> - </tarball> - <tarball id="lib/libXaw" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXaw-X11R7.0-1.0.1.tar.bz2" - size="502016" md5sum="ded3c7ed6d6ca2c5e257f60079a1a824"/> - <dependencies> - <dep package="lib-libXaw"/> - </dependencies> - </tarball> - <tarball id="lib/libXcomposite" version="X11R7.0-0.2.2.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXcomposite-X11R7.0-0.2.2.2.tar.bz2" - size="200827" md5sum="5773fe74d0f44b7264bd37c874efc7b1"/> - <dependencies> - <dep package="lib-libXcomposite"/> - </dependencies> - </tarball> - <tarball id="lib/libXcursor" version="X11R7.0-1.1.5.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXcursor-X11R7.0-1.1.5.2.tar.bz2" - size="225765" md5sum="048e15b725d8e081ac520e021af9a62c"/> - <dependencies> - <dep package="lib-libXcursor"/> - </dependencies> - </tarball> - <tarball id="lib/libXdamage" version="X11R7.0-1.0.2.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXdamage-X11R7.0-1.0.2.2.tar.bz2" - size="205151" md5sum="e98c6cc1075db5f6e7e6c8aef303c562"/> - <dependencies> - <dep package="lib-libXdamage"/> - </dependencies> - </tarball> - <tarball id="lib/libXdmcp" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXdmcp-X11R7.0-1.0.0.tar.bz2" - size="211397" md5sum="509390dc46af61e3a6d07656fc5ad0ec"/> - <dependencies> - <dep package="lib-libXdmcp"/> - </dependencies> - </tarball> - <tarball id="lib/libXevie" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXevie-X11R7.0-1.0.0.tar.bz2" - size="207641" md5sum="70b1787315d8d5f961edac05fef95fd6"/> - <dependencies> - <dep package="lib-libXevie"/> - </dependencies> - </tarball> - <tarball id="lib/libXext" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXext-X11R7.0-1.0.0.tar.bz2" - size="250668" md5sum="9e47f574ac747446ac58ff9f6f402ceb"/> - <dependencies> - <dep package="lib-libXext"/> - </dependencies> - </tarball> - <tarball id="lib/libXfixes" version="X11R7.0-3.0.1.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXfixes-X11R7.0-3.0.1.2.tar.bz2" - size="209960" md5sum="5a027e5959dae32b69dce42118938544"/> - <dependencies> - <dep package="lib-libXfixes"/> - </dependencies> - </tarball> - <tarball id="lib/libXfontcache" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXfontcache-X11R7.0-1.0.1.tar.bz2" - size="204829" md5sum="1e3c7718ffaf4f617d3f67ada5a7601e"/> - <dependencies> - <dep package="lib-libXfontcache"/> - </dependencies> - </tarball> - <tarball id="lib/libXfont" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXfont-X11R7.0-1.0.0.tar.bz2" - size="586748" md5sum="955c41694772c9fd214e3e206f5d2178"/> - <dependencies> - <dep package="lib-libXfont"/> - </dependencies> - </tarball> - <tarball id="lib/libXft" version="X11R7.0-2.1.8.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXft-X11R7.0-2.1.8.2.tar.bz2" - size="248233" md5sum="c42292b35325a9eeb24eb0f8d3a6ec52"/> - <dependencies> - <dep package="lib-libXft"/> - </dependencies> - </tarball> - <tarball id="lib/libXinerama" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXinerama-X11R7.0-1.0.1.tar.bz2" - size="201413" md5sum="1a1be870bb106193a4acc73c8c584dbc"/> - <dependencies> - <dep package="lib-libXinerama"/> - </dependencies> - </tarball> - <tarball id="lib/libXi" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXi-X11R7.0-1.0.0.tar.bz2" - size="239015" md5sum="99503799b4d52ec0cac8e203341bb7b3"/> - <dependencies> - <dep package="lib-libXi"/> - </dependencies> - </tarball> - <tarball id="lib/libxkbfile" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libxkbfile-X11R7.0-1.0.1.tar.bz2" - size="255310" md5sum="0b1bb70a1df474c26dd83feab52e733d"/> - <dependencies> - <dep package="lib-libxkbfile"/> - </dependencies> - </tarball> - <tarball id="lib/libxkbui" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libxkbui-X11R7.0-1.0.1.tar.bz2" - size="203717" md5sum="1992547d377b510517fc7681207eead5"/> - <dependencies> - <dep package="lib-libxkbui"/> - </dependencies> - </tarball> - <tarball id="lib/libXmu" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXmu-X11R7.0-1.0.0.tar.bz2" - size="279996" md5sum="df62f44da82c6780f07dc475a68dd9fa"/> - <dependencies> - <dep package="lib-libXmu"/> - </dependencies> - </tarball> - <tarball id="lib/libXpm" version="X11R7.0-3.5.4.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXpm-X11R7.0-3.5.4.2.tar.bz2" - size="329956" md5sum="f3b3b6e687f567bbff7688d60edc81ba"/> - <dependencies> - <dep package="lib-libXpm"/> - </dependencies> - </tarball> - <tarball id="lib/libXprintAppUtil" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXprintAppUtil-X11R7.0-1.0.1.tar.bz2" - size="202104" md5sum="6d3f5d8d1f6c2c380bfc739128f41909"/> - <dependencies> - <dep package="lib-libXprintAppUtil"/> - </dependencies> - </tarball> - <tarball id="lib/libXprintUtil" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXprintUtil-X11R7.0-1.0.1.tar.bz2" - size="215208" md5sum="47f1863042a53a48b40c2fb0aa55a8f7"/> - <dependencies> - <dep package="lib-libXprintUtil"/> - </dependencies> - </tarball> - <tarball id="lib/libXp" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXp-X11R7.0-1.0.0.tar.bz2" - size="237834" md5sum="63c3048e06da4f6a033c5ce25217b0c3"/> - <dependencies> - <dep package="lib-libXp"/> - </dependencies> - </tarball> - <tarball id="lib/libXrandr" version="X11R7.0-1.1.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXrandr-X11R7.0-1.1.0.2.tar.bz2" - size="214724" md5sum="e10aed44c2e1e5d9e6848a62ff2c90c7"/> - <dependencies> - <dep package="lib-libXrandr"/> - </dependencies> - </tarball> - <tarball id="lib/libXrender" version="X11R7.0-0.9.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXrender-X11R7.0-0.9.0.2.tar.bz2" - size="221203" md5sum="3f0fa590dd84df07568631c91fbe68ab"/> - <dependencies> - <dep package="lib-libXrender"/> - </dependencies> - </tarball> - <tarball id="lib/libXres" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXres-X11R7.0-1.0.0.tar.bz2" - size="209322" md5sum="cc5c4f130c9305e5bd973fbb7c56a254"/> - <dependencies> - <dep package="lib-libXres"/> - </dependencies> - </tarball> - <tarball id="lib/libXScrnSaver" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXScrnSaver-X11R7.0-1.0.1.tar.bz2" - size="209914" md5sum="b9deb6ac3194aeab15d8f6220481af6d"/> - <dependencies> - <dep package="lib-libXScrnSaver"/> - </dependencies> - </tarball> - <tarball id="lib/libXTrap" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXTrap-X11R7.0-1.0.0.tar.bz2" - size="214200" md5sum="8f2f1cc3b35f005e9030e162d89e2bdd"/> - <dependencies> - <dep package="lib-libXTrap"/> - </dependencies> - </tarball> - <tarball id="lib/libXtst" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXtst-X11R7.0-1.0.1.tar.bz2" - size="207156" md5sum="3a3a3b88b4bc2a82f0b6de8ff526cc8c"/> - <dependencies> - <dep package="lib-libXtst"/> - </dependencies> - </tarball> - <tarball id="lib/libXt" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXt-X11R7.0-1.0.0.tar.bz2" - size="482948" md5sum="d9c1c161f086a4d6c7510a924ee35c94"/> - <dependencies> - <dep package="lib-libXt"/> - </dependencies> - </tarball> - <tarball id="lib/libXvMC" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXvMC-X11R7.0-1.0.1.tar.bz2" - size="212613" md5sum="c3eb4f526f08862489355a99e3eda1bd"/> - <dependencies> - <dep package="lib-libXvMC"/> - </dependencies> - </tarball> - <tarball id="lib/libXv" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXv-X11R7.0-1.0.1.tar.bz2" - size="217511" md5sum="9f0075619fc8d8df460be8aaa9d9ab5d"/> - <dependencies> - <dep package="lib-libXv"/> - </dependencies> - </tarball> - <tarball id="lib/libXxf86dga" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXxf86dga-X11R7.0-1.0.0.tar.bz2" - size="214036" md5sum="d2154a588953d8db4ae6252ebc7db439"/> - <dependencies> - <dep package="lib-libXxf86dga"/> - </dependencies> - </tarball> - <tarball id="lib/libXxf86misc" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXxf86misc-X11R7.0-1.0.0.tar.bz2" - size="205438" md5sum="338568c9ca48b801f314c89c97327397"/> - <dependencies> - <dep package="lib-libXxf86misc"/> - </dependencies> - </tarball> - <tarball id="lib/libXxf86vm" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/libXxf86vm-X11R7.0-1.0.0.tar.bz2" - size="210002" md5sum="ed59db622581b33ec2a62e12b2f9c274"/> - <dependencies> - <dep package="lib-libXxf86vm"/> - </dependencies> - </tarball> - <tarball id="lib/xtrans" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/lib/xtrans-X11R7.0-1.0.0.tar.bz2" - size="88972" md5sum="153642136a003871a9093c8103d6ac5a"/> - <dependencies> - <dep package="lib-xtrans"/> - </dependencies> - </tarball> - <tarball id="proto/applewmproto" version="X11R7.0-1.0.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/applewmproto-X11R7.0-1.0.3.tar.bz2" - size="38932" md5sum="2acf46c814a27c40acd3e448ed17fee3"/> - <dependencies> - <dep package="proto-applewmproto"/> - </dependencies> - </tarball> - <tarball id="proto/bigreqsproto" version="X11R7.0-1.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/bigreqsproto-X11R7.0-1.0.2.tar.bz2" - size="36662" md5sum="ec15d17e3f04ddb5870ef7239b4ab367"/> - <dependencies> - <dep package="proto-bigreqsproto"/> - </dependencies> - </tarball> - <tarball id="proto/compositeproto" version="X11R7.0-0.2.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/compositeproto-X11R7.0-0.2.2.tar.bz2" - size="37336" md5sum="4de13ee64fdfd409134dfee9b184e6a9"/> - <dependencies> - <dep package="proto-compositeproto"/> - </dependencies> - </tarball> - <tarball id="proto/damageproto" version="X11R7.0-1.0.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/damageproto-X11R7.0-1.0.3.tar.bz2" - size="37637" md5sum="b906344d68e09a5639deb0097bd74224"/> - <dependencies> - <dep package="proto-damageproto"/> - </dependencies> - </tarball> - <tarball id="proto/dmxproto" version="X11R7.0-2.2.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/dmxproto-X11R7.0-2.2.2.tar.bz2" - size="39332" md5sum="21c79302beb868a078490549f558cdcf"/> - <dependencies> - <dep package="proto-dmxproto"/> - </dependencies> - </tarball> - <tarball id="proto/evieext" version="X11R7.0-1.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/evieext-X11R7.0-1.0.2.tar.bz2" - size="37487" md5sum="411c0d4f9eaa7d220a8d13edc790e3de"/> - <dependencies> - <dep package="proto-evieext"/> - </dependencies> - </tarball> - <tarball id="proto/fixesproto" version="X11R7.0-3.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/fixesproto-X11R7.0-3.0.2.tar.bz2" - size="38756" md5sum="ff8899d2325ed8a5787cde372ca8f80f"/> - <dependencies> - <dep package="proto-fixesproto"/> - </dependencies> - </tarball> - <tarball id="proto/fontcacheproto" version="X11R7.0-0.1.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/fontcacheproto-X11R7.0-0.1.2.tar.bz2" - size="38175" md5sum="116997d63cf6f65b75593ff5ae7afecb"/> - <dependencies> - <dep package="proto-fontcacheproto"/> - </dependencies> - </tarball> - <tarball id="proto/fontsproto" version="X11R7.0-2.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/fontsproto-X11R7.0-2.0.2.tar.bz2" - size="45141" md5sum="e2ca22df3a20177f060f04f15b8ce19b"/> - <dependencies> - <dep package="proto-fontsproto"/> - </dependencies> - </tarball> - <tarball id="proto/glproto" version="X11R7.0-1.4.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/glproto-X11R7.0-1.4.3.tar.bz2" - size="53730" md5sum="0ecb98487d7457f0592298fe9b8688f0"/> - <dependencies> - <dep package="proto-glproto"/> - </dependencies> - </tarball> - <tarball id="proto/inputproto" version="X11R7.0-1.3.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/inputproto-X11R7.0-1.3.2.tar.bz2" - size="46316" md5sum="0da271f396bede5b8d09a61f6d1c4484"/> - <dependencies> - <dep package="proto-inputproto"/> - </dependencies> - </tarball> - <tarball id="proto/kbproto" version="X11R7.0-1.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/kbproto-X11R7.0-1.0.2.tar.bz2" - size="57988" md5sum="403f56d717b3fefe465ddd03d9c7bc81"/> - <dependencies> - <dep package="proto-kbproto"/> - </dependencies> - </tarball> - <tarball id="proto/printproto" version="X11R7.0-1.0.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/printproto-X11R7.0-1.0.3.tar.bz2" - size="43464" md5sum="15c629a109b074d669886b1c6b7b319e"/> - <dependencies> - <dep package="proto-printproto"/> - </dependencies> - </tarball> - <tarball id="proto/randrproto" version="X11R7.0-1.1.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/randrproto-X11R7.0-1.1.2.tar.bz2" - size="38331" md5sum="bcf36d524f6f50aa16ee8e183350f7b8"/> - <dependencies> - <dep package="proto-randrproto"/> - </dependencies> - </tarball> - <tarball id="proto/recordproto" version="X11R7.0-1.13.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/recordproto-X11R7.0-1.13.2.tar.bz2" - size="39255" md5sum="6f41a40e8cf4452f1c1725d46b08eb2e"/> - <dependencies> - <dep package="proto-recordproto"/> - </dependencies> - </tarball> - <tarball id="proto/renderproto" version="X11R7.0-0.9.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/renderproto-X11R7.0-0.9.2.tar.bz2" - size="40003" md5sum="a7f3be0960c92ecb6a06a1022fe957df"/> - <dependencies> - <dep package="proto-renderproto"/> - </dependencies> - </tarball> - <tarball id="proto/resourceproto" version="X11R7.0-1.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/resourceproto-X11R7.0-1.0.2.tar.bz2" - size="36828" md5sum="e13d7b0aa5c591224f073bbbd9d1b038"/> - <dependencies> - <dep package="proto-resourceproto"/> - </dependencies> - </tarball> - <tarball id="proto/scrnsaverproto" version="X11R7.0-1.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/scrnsaverproto-X11R7.0-1.0.2.tar.bz2" - size="38353" md5sum="3185971597710d8843d986da3271b83f"/> - <dependencies> - <dep package="proto-scrnsaverproto"/> - </dependencies> - </tarball> - <tarball id="proto/trapproto" version="X11R7.0-3.4.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/trapproto-X11R7.0-3.4.3.tar.bz2" - size="48801" md5sum="84ab290758d2c177df5924e10bff4835"/> - <dependencies> - <dep package="proto-trapproto"/> - </dependencies> - </tarball> - <tarball id="proto/videoproto" version="X11R7.0-2.2.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/videoproto-X11R7.0-2.2.2.tar.bz2" - size="42721" md5sum="de9e16a8a464531a54a36211d2f983bd"/> - <dependencies> - <dep package="proto-videoproto"/> - </dependencies> - </tarball> - <tarball id="proto/windowswmproto" version="X11R7.0-1.0.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/windowswmproto-X11R7.0-1.0.3.tar.bz2" - size="38828" md5sum="ea2f71075f68371fec22eb98a6af8074"/> - <dependencies> - <dep package="proto-windowswmproto"/> - </dependencies> - </tarball> - <tarball id="proto/xcmiscproto" version="X11R7.0-1.1.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xcmiscproto-X11R7.0-1.1.2.tar.bz2" - size="36766" md5sum="77f3ba0cbef119e0230d235507a1d916"/> - <dependencies> - <dep package="proto-xcmiscproto"/> - </dependencies> - </tarball> - <tarball id="proto/xextproto" version="X11R7.0-7.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xextproto-X11R7.0-7.0.2.tar.bz2" - size="68316" md5sum="c0e88fc3483d90a7fea6a399298d90ea"/> - <dependencies> - <dep package="proto-xextproto"/> - </dependencies> - </tarball> - <tarball id="proto/xf86bigfontproto" version="X11R7.0-1.1.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xf86bigfontproto-X11R7.0-1.1.2.tar.bz2" - size="37360" md5sum="5509d420a2bc898ca7d817cd8bf1b2a7"/> - <dependencies> - <dep package="proto-xf86bigfontproto"/> - </dependencies> - </tarball> - <tarball id="proto/xf86dgaproto" version="X11R7.0-2.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xf86dgaproto-X11R7.0-2.0.2.tar.bz2" - size="40016" md5sum="48ddcc6b764dba7e711f8e25596abdb0"/> - <dependencies> - <dep package="proto-xf86dgaproto"/> - </dependencies> - </tarball> - <tarball id="proto/xf86driproto" version="X11R7.0-2.0.3"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xf86driproto-X11R7.0-2.0.3.tar.bz2" - size="42797" md5sum="839a70dfb8d5b02bcfc24996ab99a618"/> - <dependencies> - <dep package="proto-xf86driproto"/> - </dependencies> - </tarball> - <tarball id="proto/xf86miscproto" version="X11R7.0-0.9.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xf86miscproto-X11R7.0-0.9.2.tar.bz2" - size="38412" md5sum="1cc082d8a6da5177ede354bedbacd4ed"/> - <dependencies> - <dep package="proto-xf86miscproto"/> - </dependencies> - </tarball> - <tarball id="proto/xf86rushproto" version="X11R7.0-1.1.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xf86rushproto-X11R7.0-1.1.2.tar.bz2" - size="37679" md5sum="1a6b258d72c3c3baccfd695d278e847c"/> - <dependencies> - <dep package="proto-xf86rushproto"/> - </dependencies> - </tarball> - <tarball id="proto/xf86vidmodeproto" version="X11R7.0-2.2.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xf86vidmodeproto-X11R7.0-2.2.2.tar.bz2" - size="39489" md5sum="475f19a2ffbfab9a0886791c5f89c978"/> - <dependencies> - <dep package="proto-xf86vidmodeproto"/> - </dependencies> - </tarball> - <tarball id="proto/xineramaproto" version="X11R7.0-1.1.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xineramaproto-X11R7.0-1.1.2.tar.bz2" - size="38362" md5sum="80516ad305063f4e6c6c3ccf42ea2142"/> - <dependencies> - <dep package="proto-xineramaproto"/> - </dependencies> - </tarball> - <tarball id="proto/xproto" version="X11R7.0-7.0.4"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xproto-X11R7.0-7.0.4.tar.bz2" - size="127645" md5sum="643259d00e02db8e9a6f4c047281b5d9"/> - <dependencies> - <dep package="proto-xproto"/> - </dependencies> - </tarball> - <tarball id="proto/xproxymanagementprotocol" version="X11R7.0-1.0.2"> - <source href="http://ftp.x.org/pub/X11R7.0/src/proto/xproxymanagementprotocol-X11R7.0-1.0.2.tar.bz2" - size="36984" md5sum="977ee3fd1525418aaa8bfc55ffbf6fc9"/> - <dependencies> - <dep package="proto-xproxymanagementprotocol"/> - </dependencies> - </tarball> - <tarball id="util/gccmakedep" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/util/gccmakedep-X11R7.0-1.0.1.tar.bz2" - size="66964" md5sum="328eea864d27b2d3a88ceb2fa66eca6d"/> - <dependencies> - <dep package="util-gccmakedep"/> - </dependencies> - </tarball> - <tarball id="util/imake" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/util/imake-X11R7.0-1.0.1.tar.bz2" - size="108622" md5sum="487b4b86b2bd0c09e6d220a85d94efae"/> - <dependencies> - <dep package="util-imake"/> - </dependencies> - </tarball> - <tarball id="util/lndir" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/util/lndir-X11R7.0-1.0.1.tar.bz2" - size="75972" md5sum="aa3616b9795e2445c85b2c79b0f94f7b"/> - <dependencies> - <dep package="util-lndir"/> - </dependencies> - </tarball> - <tarball id="util/makedepend" version="X11R7.0-1.0.0"> - <source href="http://ftp.x.org/pub/X11R7.0/src/util/makedepend-X11R7.0-1.0.0.tar.bz2" - size="103203" md5sum="7494c7ff65d8c31ef8db13661487b54c"/> - <dependencies> - <dep package="util-makedepend"/> - </dependencies> - </tarball> - <tarball id="util/util-macros" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/util/util-macros-X11R7.0-1.0.1.tar.bz2" - size="38475" md5sum="bc6be634532d4936eb753de54e1663d3"/> - <dependencies> - <dep package="util-util-macros"/> - </dependencies> - </tarball> - <tarball id="util/xorg-cf-files" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/util/xorg-cf-files-X11R7.0-1.0.1.tar.bz2" - size="252075" md5sum="f2dd453c37386293fb207431b4a073dd"/> - <dependencies> - <dep package="util-xorg-cf-files"/> - </dependencies> - </tarball> - <tarball id="xserver/xorg-server" version="X11R7.0-1.0.1"> - <source href="http://ftp.x.org/pub/X11R7.0/src/xserver/xorg-server-X11R7.0-1.0.1.tar.bz2" - size="5849840" md5sum="0e7527480fb845a3c2e333bd0f47ff50"/> - <dependencies> - <dep package="xserver-xorg-server"/> - </dependencies> - </tarball> - -</moduleset> diff --git a/scripts/jhbuild/modulesets/xorg.modules b/scripts/jhbuild/modulesets/xorg.modules deleted file mode 100644 index 1429cf09e3..0000000000 --- a/scripts/jhbuild/modulesets/xorg.modules +++ /dev/null @@ -1,2201 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*--> -<!-- TODO: what to do about AppleWM and WindowsWM? --> -<!-- TODO: what to do about doc/sgml-tools? --> -<!-- TODO: util/cf has problems, commented out --> - -<!DOCTYPE moduleset SYSTEM "moduleset.dtd"> -<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> -<moduleset> - <repository type="git" name="git.freedesktop.org" - href="git://anongit.freedesktop.org/git/"/> - - <cvsroot name="fontconfig.freedesktop.org" - root=":pserver:anoncvs@cvs.freedesktop.org:/cvs/fontconfig" - password="" /> - - <autotools id="macros"> - <branch repo="git.freedesktop.org" module="xorg/util/macros" checkoutdir="xorg/util/macros" /> - </autotools> - <autotools id="makedepend"> - <branch repo="git.freedesktop.org" module="xorg/util/makedepend" checkoutdir="xorg/util/makedepend" /> - </autotools> - <autotools id="cf"> - <branch repo="git.freedesktop.org" module="xorg/util/cf" checkoutdir="xorg/util/cf" /> - </autotools> - <autotools id="imake"> - <branch repo="git.freedesktop.org" module="xorg/util/imake" checkoutdir="xorg/util/imake" /> - <dependencies> - <!-- <dep package="util/cf"/> --> - </dependencies> - </autotools> - - <autotools id="bigreqsproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/bigreqsproto" checkoutdir="xorg/proto/bigreqsproto" /> - </autotools> - <autotools id="compositeproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/compositeproto" checkoutdir="xorg/proto/compositeproto" /> - </autotools> - <autotools id="damageproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/damageproto" checkoutdir="xorg/proto/damageproto" /> - </autotools> - <autotools id="dmxproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/dmxproto" checkoutdir="xorg/proto/dmxproto" /> - </autotools> - <autotools id="evieproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/evieproto" checkoutdir="xorg/proto/evieproto" /> - </autotools> - <autotools id="fixesproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/fixesproto" checkoutdir="xorg/proto/fixesproto" /> - </autotools> - <autotools id="fontcacheproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/fontcacheproto" checkoutdir="xorg/proto/fontcacheproto" /> - </autotools> - <autotools id="fontsproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/fontsproto" checkoutdir="xorg/proto/fontsproto" /> - </autotools> - <autotools id="glproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/glproto" checkoutdir="xorg/proto/glproto" /> - </autotools> - <autotools id="inputproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/inputproto" checkoutdir="xorg/proto/inputproto" /> - </autotools> - <autotools id="kbproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/kbproto" checkoutdir="xorg/proto/kbproto" /> - </autotools> - <autotools id="pmproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/pmproto" checkoutdir="xorg/proto/pmproto" /> - </autotools> - <autotools id="printproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/printproto" checkoutdir="xorg/proto/printproto" /> - </autotools> - <autotools id="randrproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/randrproto" checkoutdir="xorg/proto/randrproto" /> - </autotools> - <autotools id="recordproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/recordproto" checkoutdir="xorg/proto/recordproto" /> - </autotools> - <autotools id="renderproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/renderproto" checkoutdir="xorg/proto/renderproto" /> - </autotools> - <autotools id="resourceproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/resourceproto" checkoutdir="xorg/proto/resourceproto" /> - </autotools> - <autotools id="scrnsaverproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/scrnsaverproto" checkoutdir="xorg/proto/scrnsaverproto" /> - </autotools> - <autotools id="trapproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/trapproto" checkoutdir="xorg/proto/trapproto" /> - </autotools> - <autotools id="videoproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/videoproto" checkoutdir="xorg/proto/videoproto" /> - </autotools> - <autotools id="windowswmproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/windowswmproto" checkoutdir="xorg/proto/windowswmproto" /> - </autotools> - <autotools id="xcmiscproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/xcmiscproto" checkoutdir="xorg/proto/xcmiscproto" /> - </autotools> - <autotools id="xextproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/xextproto" checkoutdir="xorg/proto/xextproto" /> - </autotools> - <autotools id="xf86bigfontproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/xf86bigfontproto" checkoutdir="xorg/proto/xf86bigfontproto" /> - </autotools> - <autotools id="xf86dgaproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/xf86dgaproto" checkoutdir="xorg/proto/xf86dgaproto" /> - </autotools> - <autotools id="xf86driproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/xf86driproto" checkoutdir="xorg/proto/xf86driproto" /> - </autotools> - <autotools id="xf86miscproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/xf86miscproto" checkoutdir="xorg/proto/xf86miscproto" /> - </autotools> - <autotools id="xf86rushproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/xf86rushproto" checkoutdir="xorg/proto/xf86rushproto" /> - </autotools> - <autotools id="xf86vidmodeproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/xf86vidmodeproto" checkoutdir="xorg/proto/xf86vidmodeproto" /> - </autotools> - <autotools id="xineramaproto"> - <branch repo="git.freedesktop.org" module="xorg/proto/xineramaproto" checkoutdir="xorg/proto/xineramaproto" /> - </autotools> - <autotools id="x11proto"> - <branch repo="git.freedesktop.org" module="xorg/proto/x11proto" checkoutdir="xorg/proto/x11proto" /> - </autotools> - - <metamodule id="xorg-protos"> - <dependencies> - <dep package="bigreqsproto"/> - <dep package="compositeproto"/> - <dep package="damageproto"/> - <dep package="dmxproto"/> - <dep package="evieproto"/> - <dep package="fixesproto"/> - <dep package="fontcacheproto"/> - <dep package="fontsproto"/> - <dep package="glproto"/> - <dep package="inputproto"/> - <dep package="kbproto"/> - <dep package="xineramaproto"/> - <dep package="printproto"/> - <dep package="randrproto"/> - <dep package="recordproto"/> - <dep package="renderproto"/> - <dep package="resourceproto"/> - <dep package="scrnsaverproto"/> - <dep package="trapproto"/> - <dep package="videoproto"/> - <dep package="xcmiscproto"/> - <dep package="xextproto"/> - <dep package="xf86bigfontproto"/> - <dep package="xf86dgaproto"/> - <dep package="xf86driproto"/> - <dep package="xf86miscproto"/> - <dep package="xf86rushproto"/> - <dep package="xf86vidmodeproto"/> - <dep package="x11proto"/> - <dep package="pmproto"/> - </dependencies> - </metamodule> - - <!-- libs --> - - <autotools id="libFS"> - <branch repo="git.freedesktop.org" module="xorg/lib/libFS" checkoutdir="xorg/lib/libFS" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="fontsproto"/> - <dep package="libxtrans"/> - </dependencies> - </autotools> - - <autotools id="libICE"> - <branch repo="git.freedesktop.org" module="xorg/lib/libICE" checkoutdir="xorg/lib/libICE" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libxtrans"/> - </dependencies> - </autotools> - - <autotools id="libSM"> - <branch repo="git.freedesktop.org" module="xorg/lib/libSM" checkoutdir="xorg/lib/libSM" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libICE"/> - <dep package="libxtrans"/> - </dependencies> - </autotools> - - <autotools id="libX11"> - <branch repo="git.freedesktop.org" module="xorg/lib/libX11" checkoutdir="xorg/lib/libX11" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="bigreqsproto"/> - <dep package="xextproto"/> - <dep package="libxtrans"/> - <dep package="libXau"/> - <dep package="xcmiscproto"/> - <dep package="libXdmcp"/> - <dep package="kbproto"/> - <dep package="inputproto"/> - </dependencies> - </autotools> - - <autotools id="libXScrnSaver"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXScrnSaver" checkoutdir="xorg/lib/libXScrnSaver" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="xextproto"/> - <dep package="scrnsaverproto"/> - </dependencies> - </autotools> - - <autotools id="libXTrap"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXTrap" checkoutdir="xorg/lib/libXTrap" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXt"/> - <dep package="trapproto"/> - <dep package="libXext"/> - <dep package="xextproto"/> - </dependencies> - </autotools> - - <autotools id="libXau"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXau" checkoutdir="xorg/lib/libXau" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - </dependencies> - </autotools> - - <autotools id="libXaw"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXaw" checkoutdir="xorg/lib/libXaw" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libX11"/> - <dep package="libXt"/> - <dep package="libXmu"/> - <dep package="libXpm"/> - </dependencies> - </autotools> - - <autotools id="libXcomposite"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXcomposite" checkoutdir="xorg/lib/libXcomposite" /> - <dependencies> - <dep package="macros"/> - <dep package="compositeproto"/> - <dep package="libX11"/> - <dep package="libXfixes"/> - <dep package="libXext"/> - </dependencies> - </autotools> - - <autotools id="libXcursor"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXcursor" checkoutdir="xorg/lib/libXcursor" /> - <dependencies> - <dep package="macros"/> - <dep package="libXrender"/> - <dep package="libX11"/> - <dep package="libXfixes"/> - </dependencies> - </autotools> - - <autotools id="libXdamage"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXdamage" checkoutdir="xorg/lib/libXdamage" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="damageproto"/> - <dep package="libXfixes"/> - </dependencies> - </autotools> - - <autotools id="libXdmcp"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXdmcp" checkoutdir="xorg/lib/libXdmcp" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - </dependencies> - </autotools> - - <autotools id="libXevie"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXevie" checkoutdir="xorg/lib/libXevie" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libX11"/> - <dep package="xextproto"/> - <dep package="libXext"/> - <dep package="evieproto"/> - </dependencies> - </autotools> - - <autotools id="libXext"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXext" checkoutdir="xorg/lib/libXext" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libX11"/> - <dep package="xextproto"/> - </dependencies> - </autotools> - - <autotools id="libXfixes"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXfixes" checkoutdir="xorg/lib/libXfixes" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="fixesproto"/> - </dependencies> - </autotools> - - <autotools id="libXfont"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXfont" checkoutdir="xorg/lib/libXfont" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libxtrans"/> - <dep package="fontsproto"/> - <dep package="libfontenc"/> - <dep package="fontcacheproto"/> - </dependencies> - </autotools> - - <autotools id="libXfontcache"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXfontcache" checkoutdir="xorg/lib/libXfontcache" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="xextproto"/> - <dep package="fontcacheproto"/> - </dependencies> - </autotools> - - <cvsmodule id="fontconfig" cvsroot="fontconfig.freedesktop.org" /> - - <autotools id="libXft"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXft" checkoutdir="xorg/lib/libXft" /> - <dependencies> - <dep package="macros"/> - <dep package="libXrender"/> - <dep package="fontconfig"/> - </dependencies> - </autotools> - - <autotools id="libXi"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXi" checkoutdir="xorg/lib/libXi" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libX11"/> - <dep package="xextproto"/> - <dep package="libXext"/> - <dep package="inputproto"/> - </dependencies> - </autotools> - - <autotools id="libXinerama"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXinerama" checkoutdir="xorg/lib/libXinerama" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="xextproto"/> - <dep package="xineramaproto"/> - </dependencies> - </autotools> - - <autotools id="libXmu"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXmu" checkoutdir="xorg/lib/libXmu" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXt"/> - <dep package="libXext"/> - </dependencies> - </autotools> - - <autotools id="libXp"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXp" checkoutdir="xorg/lib/libXp" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="libXau"/> - <dep package="printproto"/> - </dependencies> - </autotools> - - <autotools id="libXpm"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXpm" checkoutdir="xorg/lib/libXpm" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="x11proto"/> - <dep package="libXt"/> - <dep package="libXext"/> - </dependencies> - </autotools> - - <autotools id="libXprintAppUtil"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXprintAppUtil" checkoutdir="xorg/lib/libXprintAppUtil" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXp"/> - <dep package="libXprintUtil"/> - </dependencies> - </autotools> - - <autotools id="libXprintUtil"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXprintUtil" checkoutdir="xorg/lib/libXprintUtil" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXp"/> - </dependencies> - </autotools> - - <autotools id="libXrandr"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXrandr" checkoutdir="xorg/lib/libXrandr" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="randrproto"/> - </dependencies> - </autotools> - - <autotools id="libXrender"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXrender" checkoutdir="xorg/lib/libXrender" /> - <dependencies> - <dep package="macros"/> - <dep package="renderproto"/> - <dep package="libX11"/> - </dependencies> - </autotools> - - <autotools id="libXRes"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXRes" checkoutdir="xorg/lib/libXRes" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="resourceproto"/> - </dependencies> - </autotools> - - <autotools id="libXt"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXt" checkoutdir="xorg/lib/libXt" /> - <dependencies> - <dep package="macros"/> - <dep package="libSM"/> - <dep package="libX11"/> - <dep package="x11proto"/> - </dependencies> - </autotools> - - <autotools id="libXtst"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXtst" checkoutdir="xorg/lib/libXtst" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="recordproto"/> - <dep package="xextproto"/> - </dependencies> - </autotools> - - <autotools id="libXv"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXv" checkoutdir="xorg/lib/libXv" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="xextproto"/> - <dep package="videoproto"/> - </dependencies> - </autotools> - - <autotools id="libXvMC"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXvMC" checkoutdir="xorg/lib/libXvMC" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="libXv"/> - <dep package="xextproto"/> - <dep package="videoproto"/> - </dependencies> - </autotools> - - <autotools id="libXxf86dga"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXxf86dga" checkoutdir="xorg/lib/libXxf86dga" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="xextproto"/> - <dep package="xf86dgaproto"/> - </dependencies> - </autotools> - - <autotools id="libXxf86misc"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXxf86misc" checkoutdir="xorg/lib/libXxf86misc" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="xextproto"/> - <dep package="xf86miscproto"/> - </dependencies> - </autotools> - - <autotools id="libXxf86vm"> - <branch repo="git.freedesktop.org" module="xorg/lib/libXxf86vm" checkoutdir="xorg/lib/libXxf86vm" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="xextproto"/> - <dep package="xf86vidmodeproto"/> - </dependencies> - </autotools> - - <autotools id="libdmx"> - <branch repo="git.freedesktop.org" module="xorg/lib/libdmx" checkoutdir="xorg/lib/libdmx" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="xextproto"/> - <dep package="dmxproto"/> - </dependencies> - </autotools> - - <autotools id="libfontenc"> - <branch repo="git.freedesktop.org" module="xorg/lib/libfontenc" checkoutdir="xorg/lib/libfontenc" /> - <dependencies> - <dep package="macros"/> - <dep package="x11proto"/> - </dependencies> - </autotools> - - <autotools id="liblbxutil"> - <branch repo="git.freedesktop.org" module="xorg/lib/liblbxutil" checkoutdir="xorg/lib/liblbxutil" /> - <dependencies> - <dep package="macros"/> - <dep package="xextproto"/> - </dependencies> - </autotools> - - <autotools id="liboldX"> - <branch repo="git.freedesktop.org" module="xorg/lib/liboldX" checkoutdir="xorg/lib/liboldX" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - </dependencies> - </autotools> - - <autotools id="libxkbfile"> - <branch repo="git.freedesktop.org" module="xorg/lib/libxkbfile" checkoutdir="xorg/lib/libxkbfile" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="kbproto"/> - </dependencies> - </autotools> - - <autotools id="libxkbui"> - <branch repo="git.freedesktop.org" module="xorg/lib/libxkbui" checkoutdir="xorg/lib/libxkbui" /> - <dependencies> - <dep package="macros"/> - <dep package="libX11"/> - <dep package="libXt"/> - <dep package="libxkbfile"/> - </dependencies> - </autotools> - - <autotools id="libxtrans"> - <branch repo="git.freedesktop.org" module="xorg/lib/libxtrans" checkoutdir="xorg/lib/libxtrans"/> - <dependencies> - <dep package="macros"/> - </dependencies> - </autotools> - - <autotools id="libdrm"> - <branch repo="git.freedesktop.org" module="mesa/drm"/> - <dependencies> - <dep package="macros"/> - </dependencies> - </autotools> - - <metamodule id="xorg-libs"> - <dependencies> - <dep package="libFS"/> - <dep package="libICE"/> - <dep package="libSM"/> - <dep package="libX11"/> - <dep package="libXScrnSaver"/> - <dep package="libXTrap"/> - <dep package="libXau"/> - <dep package="libXaw"/> - <dep package="libXcomposite"/> - <dep package="libXcursor"/> - <dep package="libXdamage"/> - <dep package="libXdmcp"/> - <dep package="libXevie"/> - <dep package="libXext"/> - <dep package="libXfixes"/> - <dep package="libXfont"/> - <dep package="libXfontcache"/> - <dep package="libXft"/> - <dep package="libXi"/> - <dep package="libXinerama"/> - <dep package="libXmu"/> - <dep package="libXp"/> - <dep package="libXpm"/> - <dep package="libXprintAppUtil"/> - <dep package="libXprintUtil"/> - <dep package="libXrandr"/> - <dep package="libXrender"/> - <dep package="libXRes"/> - <dep package="libXt"/> - <dep package="libXtst"/> - <dep package="libXv"/> - <dep package="libXvMC"/> - <dep package="libXxf86dga"/> - <dep package="libXxf86misc"/> - <dep package="libXxf86vm"/> - <dep package="libdmx"/> - <dep package="libfontenc"/> - <dep package="liblbxutil"/> - <dep package="liboldX"/> - <dep package="libxkbfile"/> - <dep package="libxkbui"/> - <dep package="libxtrans"/> - <dep package="libdrm"/> - </dependencies> - </metamodule> - - <autotools id="xtrans"> - <branch repo="git.freedesktop.org" module="xorg/lib/libxtrans" checkoutdir="xorg/lib/libxtrans" /> - </autotools> - - <autotools id="100dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/100dpi" checkoutdir="xorg/font/100dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="adobe-100dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/adobe-100dpi" checkoutdir="xorg/font/adobe-100dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="adobe-75dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/adobe-75dpi" checkoutdir="xorg/font/adobe-75dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="adobe-utopia-100dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/adobe-utopia-100dpi" checkoutdir="xorg/font/adobe-utopia-100dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="adobe-utopia-75dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/adobe-utopia-75dpi" checkoutdir="xorg/font/adobe-utopia-75dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="adobe-utopia-type1"> - <branch repo="git.freedesktop.org" module="xorg/font/adobe-utopia-type1" checkoutdir="xorg/font/adobe-utopia-type1" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="alias"> - <branch repo="git.freedesktop.org" module="xorg/font/alias" checkoutdir="xorg/font/alias" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="arabic-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/arabic-misc" checkoutdir="xorg/font/arabic-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bh-100dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/bh-100dpi" checkoutdir="xorg/font/bh-100dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bh-75dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/bh-75dpi" checkoutdir="xorg/font/bh-75dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bh-lucidatypewriter-100dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/bh-lucidatypewriter-100dpi" checkoutdir="xorg/font/bh-lucidatypewriter-100dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bh-lucidatypewriter-75dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/bh-lucidatypewriter-75dpi" checkoutdir="xorg/font/bh-lucidatypewriter-75dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bh-ttf"> - <branch repo="git.freedesktop.org" module="xorg/font/bh-ttf" checkoutdir="xorg/font/bh-ttf" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bh-type1"> - <branch repo="git.freedesktop.org" module="xorg/font/bh-type1" checkoutdir="xorg/font/bh-type1" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bitstream-100dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/bitstream-100dpi" checkoutdir="xorg/font/bitstream-100dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bitstream-75dpi"> - <branch repo="git.freedesktop.org" module="xorg/font/bitstream-75dpi" checkoutdir="xorg/font/bitstream-75dpi" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bitstream-speedo"> - <branch repo="git.freedesktop.org" module="xorg/font/bitstream-speedo" checkoutdir="xorg/font/bitstream-speedo" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="bitstream-type1"> - <branch repo="git.freedesktop.org" module="xorg/font/bitstream-type1" checkoutdir="xorg/font/bitstream-type1" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="cronyx-cyrillic"> - <branch repo="git.freedesktop.org" module="xorg/font/cronyx-cyrillic" checkoutdir="xorg/font/cronyx-cyrillic" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="cursor-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/cursor-misc" checkoutdir="xorg/font/cursor-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="CVS"> - <branch repo="git.freedesktop.org" module="xorg/font/CVS" checkoutdir="xorg/font/CVS" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="daewoo-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/daewoo-misc" checkoutdir="xorg/font/daewoo-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="dec-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/dec-misc" checkoutdir="xorg/font/dec-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="encodings"> - <branch repo="git.freedesktop.org" module="xorg/font/encodings" checkoutdir="xorg/font/encodings" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="ibm-type1"> - <branch repo="git.freedesktop.org" module="xorg/font/ibm-type1" checkoutdir="xorg/font/ibm-type1" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="isas-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/isas-misc" checkoutdir="xorg/font/isas-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="jis-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/jis-misc" checkoutdir="xorg/font/jis-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="micro-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/micro-misc" checkoutdir="xorg/font/micro-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="misc-cyrillic"> - <branch repo="git.freedesktop.org" module="xorg/font/misc-cyrillic" checkoutdir="xorg/font/misc-cyrillic" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="misc-ethiopic"> - <branch repo="git.freedesktop.org" module="xorg/font/misc-ethiopic" checkoutdir="xorg/font/misc-ethiopic" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="misc-meltho"> - <branch repo="git.freedesktop.org" module="xorg/font/misc-meltho" checkoutdir="xorg/font/misc-meltho" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="misc-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/misc-misc" checkoutdir="xorg/font/misc-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="mutt-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/mutt-misc" checkoutdir="xorg/font/mutt-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="schumacher-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/schumacher-misc" checkoutdir="xorg/font/schumacher-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="screen-cyrillic"> - <branch repo="git.freedesktop.org" module="xorg/font/screen-cyrillic" checkoutdir="xorg/font/screen-cyrillic" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="sony-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/sony-misc" checkoutdir="xorg/font/sony-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="sun-misc"> - <branch repo="git.freedesktop.org" module="xorg/font/sun-misc" checkoutdir="xorg/font/sun-misc" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="util"> - <branch repo="git.freedesktop.org" module="xorg/font/util" checkoutdir="xorg/font/util" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="winitzki-cyrillic"> - <branch repo="git.freedesktop.org" module="xorg/font/winitzki-cyrillic" checkoutdir="xorg/font/winitzki-cyrillic" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <autotools id="xfree86-type1"> - <branch repo="git.freedesktop.org" module="xorg/font/xfree86-type1" checkoutdir="xorg/font/xfree86-type1" /> - <dependencies> - <dep package="util"/> - </dependencies> - </autotools> - - <metamodule id="xorg-fonts"> - <dependencies> - <dep package="encodings"/> - <dep package="adobe-75dpi"/> - <dep package="adobe-100dpi"/> - <dep package="adobe-utopia-75dpi"/> - <dep package="adobe-utopia-100dpi"/> - <dep package="adobe-utopia-type1"/> - <dep package="alias"/> - <dep package="arabic-misc"/> - <dep package="bh-75dpi"/> - <dep package="bh-100dpi"/> - <dep package="bh-lucidatypewriter-75dpi"/> - <dep package="bh-lucidatypewriter-100dpi"/> - <dep package="bh-ttf"/> - <dep package="bh-type1"/> - <dep package="bitstream-75dpi"/> - <dep package="bitstream-100dpi"/> - <dep package="bitstream-type1"/> - <dep package="cronyx-cyrillic"/> - <dep package="cursor-misc"/> - <dep package="daewoo-misc"/> - <dep package="dec-misc"/> - <dep package="ibm-type1"/> - <dep package="isas-misc"/> - <dep package="jis-misc"/> - <dep package="micro-misc"/> - <dep package="misc-cyrillic"/> - <dep package="misc-misc"/> - <dep package="mutt-misc"/> - </dependencies> - </metamodule> - - <!-- data --> - <autotools id="bitmaps"> - <branch repo="git.freedesktop.org" module="xorg/data/bitmaps" checkoutdir="xorg/data/bitmaps" /> - <dependencies> - <dep package="macros"/> - </dependencies> - </autotools> - - <autotools id="cursors"> - <branch repo="git.freedesktop.org" module="xorg/data/cursors" checkoutdir="xorg/data/cursors" /> - <dependencies> - <dep package="app/xcursorgen"/> - </dependencies> - </autotools> - - <autotools id="xkbdata"> - <branch repo="git.freedesktop.org" module="xorg/data/xkbdata" checkoutdir="xorg/data/xkbdata" /> - <dependencies> - <dep package="app/xkbcomp"/> - </dependencies> - </autotools> - - <!-- apps --> - - <autotools id="appres"> - <branch repo="git.freedesktop.org" module="xorg/app/appres" checkoutdir="xorg/app/appres" /> - <dependencies> - <dep package="libXt"/> - </dependencies> - </autotools> - - <autotools id="bdftopcf"> - <branch repo="git.freedesktop.org" module="xorg/app/bdftopcf" checkoutdir="xorg/app/bdftopcf" /> - <dependencies> - <dep package="libXfont"/> - </dependencies> - </autotools> - - <autotools id="beforelight"> - <branch repo="git.freedesktop.org" module="xorg/app/beforelight" checkoutdir="xorg/app/beforelight" /> - <dependencies> - <dep package="libXScrnSaver"/> - <dep package="libXt"/> - </dependencies> - </autotools> - - <autotools id="bitmap"> - <branch repo="git.freedesktop.org" module="xorg/app/bitmap" checkoutdir="xorg/app/bitmap" /> - <dependencies> - <dep package="libXaw"/> - <dep package="libXmu"/> - <dep package="bitmaps"/> - </dependencies> - </autotools> - - <autotools id="editres"> - <branch repo="git.freedesktop.org" module="xorg/app/editres" checkoutdir="xorg/app/editres" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="fonttosfnt"> - <branch repo="git.freedesktop.org" module="xorg/app/fonttosfnt" checkoutdir="xorg/app/fonttosfnt" /> - <dependencies> - <dep package="libX11"/> - <dep package="libfontenc"/> - <!-- <dep package="freetype2"/> --> - </dependencies> - </autotools> - - <autotools id="fslsfonts"> - <branch repo="git.freedesktop.org" module="xorg/app/fslsfonts" checkoutdir="xorg/app/fslsfonts" /> - <dependencies> - <dep package="libX11"/> - <dep package="libFS"/> - </dependencies> - </autotools> - - <autotools id="fstobdf"> - <branch repo="git.freedesktop.org" module="xorg/app/fstobdf" checkoutdir="xorg/app/fstobdf" /> - <dependencies> - <dep package="libX11"/> - <dep package="libFS"/> - </dependencies> - </autotools> - - <autotools id="iceauth"> - <branch repo="git.freedesktop.org" module="xorg/app/iceauth" checkoutdir="xorg/app/iceauth" /> - <dependencies> - <dep package="libX11"/> - <dep package="libICE"/> - </dependencies> - </autotools> - - <autotools id="ico"> - <branch repo="git.freedesktop.org" module="xorg/app/ico" checkoutdir="xorg/app/ico" /> - <dependencies> - <dep package="libX11"/> - </dependencies> - </autotools> - - <autotools id="lbxproxy"> - <branch repo="git.freedesktop.org" module="xorg/app/lbxproxy" checkoutdir="xorg/app/lbxproxy" /> - <dependencies> - <dep package="libxtrans"/> - <dep package="libXext"/> - <dep package="liblbxutil"/> - <dep package="libX11"/> - <dep package="libICE"/> - <dep package="pmproto"/> - </dependencies> - </autotools> - - <autotools id="listres"> - <branch repo="git.freedesktop.org" module="xorg/app/listres" checkoutdir="xorg/app/listres" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="luit"> - <branch repo="git.freedesktop.org" module="xorg/app/luit" checkoutdir="xorg/app/luit" /> - <dependencies> - <dep package="libX11"/> - <dep package="libfontenc"/> - </dependencies> - </autotools> - - <autotools id="mkcfm"> - <branch repo="git.freedesktop.org" module="xorg/app/mkcfm" checkoutdir="xorg/app/mkcfm" /> - </autotools> - - <autotools id="mkfontdir"> - <branch repo="git.freedesktop.org" module="xorg/app/mkfontdir" checkoutdir="xorg/app/mkfontdir" /> - </autotools> - - <autotools id="mkfontscale"> - <branch repo="git.freedesktop.org" module="xorg/app/mkfontscale" checkoutdir="xorg/app/mkfontscale" /> - <dependencies> - <dep package="libfontenc"/> - <!-- <dep package="freetype2"/> --> - </dependencies> - </autotools> - - <autotools id="oclock"> - <branch repo="git.freedesktop.org" module="xorg/app/oclock" checkoutdir="xorg/app/oclock" /> - <dependencies> - <dep package="libX11"/> - <dep package="libXmu"/> - <dep package="libXext"/> - </dependencies> - </autotools> - - <autotools id="proxymngr"> - <branch repo="git.freedesktop.org" module="xorg/app/proxymngr" checkoutdir="xorg/app/proxymngr" /> - <dependencies> - <dep package="libX11"/> - <dep package="libXt"/> - <dep package="pmproto"/> - <dep package="libICE"/> - </dependencies> - </autotools> - - <autotools id="rgb"> - <branch repo="git.freedesktop.org" module="xorg/app/rgb" checkoutdir="xorg/app/rgb" /> - <dependencies> - <dep package="x11proto"/> - </dependencies> - </autotools> - - <autotools id="rstart"> - <branch repo="git.freedesktop.org" module="xorg/app/rstart" checkoutdir="xorg/app/rstart" /> - </autotools> - <autotools id="scripts"> - <branch repo="git.freedesktop.org" module="xorg/app/scripts" checkoutdir="xorg/app/scripts" /> - </autotools> - - <!-- <branch repo="git.freedesktop.org" module="xorg/app/sessreg"/> --> - - <autotools id="setxkbmap"> - <branch repo="git.freedesktop.org" module="xorg/app/setxkbmap" checkoutdir="xorg/app/setxkbmap" /> - </autotools> - <autotools id="showfont"> - <branch repo="git.freedesktop.org" module="xorg/app/showfont" checkoutdir="xorg/app/showfont" /> - </autotools> - <autotools id="smproxy"> - <branch repo="git.freedesktop.org" module="xorg/app/smproxy" checkoutdir="xorg/app/smproxy" /> - </autotools> - <autotools id="twm"> - <branch repo="git.freedesktop.org" module="xorg/app/twm" checkoutdir="xorg/app/twm" /> - </autotools> - - <autotools id="viewres"> - <branch repo="git.freedesktop.org" module="xorg/app/viewres" checkoutdir="xorg/app/viewres" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="x11perf"> - <branch repo="git.freedesktop.org" module="xorg/app/x11perf" checkoutdir="xorg/app/x11perf" /> - </autotools> - <autotools id="xauth"> - <branch repo="git.freedesktop.org" module="xorg/app/xauth" checkoutdir="xorg/app/xauth" /> - </autotools> - <autotools id="xbiff"> - <branch repo="git.freedesktop.org" module="xorg/app/xbiff" checkoutdir="xorg/app/xbiff" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xcalc"> - <branch repo="git.freedesktop.org" module="xorg/app/xcalc" checkoutdir="xorg/app/xcalc" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xclipboard"> - <branch repo="git.freedesktop.org" module="xorg/app/xclipboard" checkoutdir="xorg/app/xclipboard" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xclock"> - <branch repo="git.freedesktop.org" module="xorg/app/xclock" checkoutdir="xorg/app/xclock" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xcmsdb"> - <branch repo="git.freedesktop.org" module="xorg/app/xcmsdb" checkoutdir="xorg/app/xcmsdb" /> - </autotools> - <autotools id="xconsole"> - <branch repo="git.freedesktop.org" module="xorg/app/xconsole" checkoutdir="xorg/app/xconsole" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xcursorgen"> - <branch repo="git.freedesktop.org" module="xorg/app/xcursorgen" checkoutdir="xorg/app/xcursorgen" /> - </autotools> - <autotools id="xdbedizzy"> - <branch repo="git.freedesktop.org" module="xorg/app/xdbedizzy" checkoutdir="xorg/app/xdbedizzy" /> - </autotools> - <autotools id="xditview"> - <branch repo="git.freedesktop.org" module="xorg/app/xditview" checkoutdir="xorg/app/xditview" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xdm"> - <branch repo="git.freedesktop.org" module="xorg/app/xdm" checkoutdir="xorg/app/xdm" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xdpyinfo"> - <branch repo="git.freedesktop.org" module="xorg/app/xdpyinfo" checkoutdir="xorg/app/xdpyinfo" /> - <dependencies> - <dep package="libX11"/> - <dep package="libXext"/> - <dep package="libXtst"/> - </dependencies> - </autotools> - - <autotools id="xdriinfo"> - <branch repo="git.freedesktop.org" module="xorg/app/xdriinfo" checkoutdir="xorg/app/xdriinfo" /> - <dependencies> - <dep package="glproto"/> - </dependencies> - </autotools> - - <autotools id="xedit"> - <branch repo="git.freedesktop.org" module="xorg/app/xedit" checkoutdir="xorg/app/xedit" /> - </autotools> - <autotools id="xev"> - <branch repo="git.freedesktop.org" module="xorg/app/xev" checkoutdir="xorg/app/xev" /> - </autotools> - <autotools id="xeyes"> - <branch repo="git.freedesktop.org" module="xorg/app/xeyes" checkoutdir="xorg/app/xeyes" /> - </autotools> - <autotools id="xf86dga"> - <branch repo="git.freedesktop.org" module="xorg/app/xf86dga" checkoutdir="xorg/app/xf86dga" /> - </autotools> - <autotools id="xfd"> - <branch repo="git.freedesktop.org" module="xorg/app/xfd" checkoutdir="xorg/app/xfd" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xfindproxy"> - <branch repo="git.freedesktop.org" module="xorg/app/xfindproxy" checkoutdir="xorg/app/xfindproxy" /> - </autotools> - <autotools id="xfontsel"> - <branch repo="git.freedesktop.org" module="xorg/app/xfontsel" checkoutdir="xorg/app/xfontsel" /> - </autotools> - <autotools id="xfs"> - <branch repo="git.freedesktop.org" module="xorg/app/xfs" checkoutdir="xorg/app/xfs" /> - </autotools> - <autotools id="xfsinfo"> - <branch repo="git.freedesktop.org" module="xorg/app/xfsinfo" checkoutdir="xorg/app/xfsinfo" /> - </autotools> - <autotools id="xfwp"> - <branch repo="git.freedesktop.org" module="xorg/app/xfwp" checkoutdir="xorg/app/xfwp" /> - </autotools> - <autotools id="xgamma"> - <branch repo="git.freedesktop.org" module="xorg/app/xgamma" checkoutdir="xorg/app/xgamma" /> - </autotools> - <autotools id="xgc"> - <branch repo="git.freedesktop.org" module="xorg/app/xgc" checkoutdir="xorg/app/xgc" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xhost"> - <branch repo="git.freedesktop.org" module="xorg/app/xhost" checkoutdir="xorg/app/xhost" /> - </autotools> - <autotools id="xinit"> - <branch repo="git.freedesktop.org" module="xorg/app/xinit" checkoutdir="xorg/app/xinit" /> - </autotools> - <autotools id="xkbcomp"> - <branch repo="git.freedesktop.org" module="xorg/app/xkbcomp" checkoutdir="xorg/app/xkbcomp" /> - </autotools> - <autotools id="xkbevd"> - <branch repo="git.freedesktop.org" module="xorg/app/xkbevd" checkoutdir="xorg/app/xkbevd" /> - </autotools> - <autotools id="xkbprint"> - <branch repo="git.freedesktop.org" module="xorg/app/xkbprint" checkoutdir="xorg/app/xkbprint" /> - </autotools> - <autotools id="xkbutils"> - <branch repo="git.freedesktop.org" module="xorg/app/xkbutils" checkoutdir="xorg/app/xkbutils" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xkill"> - <branch repo="git.freedesktop.org" module="xorg/app/xkill" checkoutdir="xorg/app/xkill" /> - </autotools> - <autotools id="xload"> - <branch repo="git.freedesktop.org" module="xorg/app/xload" checkoutdir="xorg/app/xload" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xlogo"> - <branch repo="git.freedesktop.org" module="xorg/app/xlogo" checkoutdir="xorg/app/xlogo" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xlsatoms"> - <branch repo="git.freedesktop.org" module="xorg/app/xlsatoms" checkoutdir="xorg/app/xlsatoms" /> - </autotools> - <autotools id="xlsclients"> - <branch repo="git.freedesktop.org" module="xorg/app/xlsclients" checkoutdir="xorg/app/xlsclients" /> - </autotools> - <autotools id="xlsfonts"> - <branch repo="git.freedesktop.org" module="xorg/app/xlsfonts" checkoutdir="xorg/app/xlsfonts" /> - </autotools> - <autotools id="xmag"> - <branch repo="git.freedesktop.org" module="xorg/app/xmag" checkoutdir="xorg/app/xmag" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xman"> - <branch repo="git.freedesktop.org" module="xorg/app/xman" checkoutdir="xorg/app/xman" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xmessage"> - <branch repo="git.freedesktop.org" module="xorg/app/xmessage" checkoutdir="xorg/app/xmessage" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xmh"> - <branch repo="git.freedesktop.org" module="xorg/app/xmh" checkoutdir="xorg/app/xmh" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xmodmap"> - <branch repo="git.freedesktop.org" module="xorg/app/xmodmap" checkoutdir="xorg/app/xmodmap" /> - </autotools> - <autotools id="xmore"> - <branch repo="git.freedesktop.org" module="xorg/app/xmore" checkoutdir="xorg/app/xmore" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <!-- - <autotools id="xphelloworld"> - <branch repo="git.freedesktop.org" module="xorg/app/xphelloworld" checkoutdir="xorg/app/xphelloworld" /> - </autotools> - <autotools id="xplsprinters"> - <branch repo="git.freedesktop.org" module="xorg/app/xplsprinters" checkoutdir="xorg/app/xplsprinters" /> - </autotools> - <autotools id="xpr"> - <branch repo="git.freedesktop.org" module="xorg/app/xpr" checkoutdir="xorg/app/xpr" /> - </autotools> - <autotools id="xprehashprinterlist"> - <branch repo="git.freedesktop.org" module="xorg/app/xprehashprinterlist" checkoutdir="xorg/app/xprehashprinterlist" /> - </autotools> - --> - - <autotools id="xprop"> - <branch repo="git.freedesktop.org" module="xorg/app/xprop" checkoutdir="xorg/app/xprop" /> - </autotools> - <autotools id="xrandr"> - <branch repo="git.freedesktop.org" module="xorg/app/xrandr" checkoutdir="xorg/app/xrandr" /> - </autotools> - <autotools id="xrdb"> - <branch repo="git.freedesktop.org" module="xorg/app/xrdb" checkoutdir="xorg/app/xrdb" /> - </autotools> - <autotools id="xrefresh"> - <branch repo="git.freedesktop.org" module="xorg/app/xrefresh" checkoutdir="xorg/app/xrefresh" /> - </autotools> - - <autotools id="xrx"> - <branch repo="git.freedesktop.org" module="xorg/app/xrx" checkoutdir="xorg/app/xrx" /> - <dependencies> - <dep package="libXext"/> - </dependencies> - </autotools> - - <autotools id="xset"> - <branch repo="git.freedesktop.org" module="xorg/app/xset" checkoutdir="xorg/app/xset" /> - <dependencies> - <dep package="libXext"/> - </dependencies> - </autotools> - - <autotools id="xsetmode"> - <branch repo="git.freedesktop.org" module="xorg/app/xsetmode" checkoutdir="xorg/app/xsetmode" /> - </autotools> - <autotools id="xsetpointer"> - <branch repo="git.freedesktop.org" module="xorg/app/xsetpointer" checkoutdir="xorg/app/xsetpointer" /> - </autotools> - - <autotools id="xsetroot"> - <branch repo="git.freedesktop.org" module="xorg/app/xsetroot" checkoutdir="xorg/app/xsetroot" /> - <dependencies> - <dep package="libX11"/> - <dep package="libXmu"/> - <dep package="bitmaps"/> - </dependencies> - </autotools> - - <autotools id="xsm"> - <branch repo="git.freedesktop.org" module="xorg/app/xsm" checkoutdir="xorg/app/xsm" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xstdcmap"> - <branch repo="git.freedesktop.org" module="xorg/app/xstdcmap" checkoutdir="xorg/app/xstdcmap" /> - </autotools> - <autotools id="xtrap"> - <branch repo="git.freedesktop.org" module="xorg/app/xtrap" checkoutdir="xorg/app/xtrap" /> - </autotools> - - <autotools id="xvidtune"> - <branch repo="git.freedesktop.org" module="xorg/app/xvidtune" checkoutdir="xorg/app/xvidtune" /> - <dependencies> - <dep package="libXaw"/> - </dependencies> - </autotools> - - <autotools id="xvinfo"> - <branch repo="git.freedesktop.org" module="xorg/app/xvinfo" checkoutdir="xorg/app/xvinfo" /> - </autotools> - <autotools id="xwd"> - <branch repo="git.freedesktop.org" module="xorg/app/xwd" checkoutdir="xorg/app/xwd" /> - </autotools> - <autotools id="xwininfo"> - <branch repo="git.freedesktop.org" module="xorg/app/xwininfo" checkoutdir="xorg/app/xwininfo" /> - </autotools> - <autotools id="xwud"> - <branch repo="git.freedesktop.org" module="xorg/app/xwud" checkoutdir="xorg/app/xwud" /> - </autotools> - - <metamodule id="xorg-apps"> - <dependencies> - <dep package="appres"/> - <dep package="bdftopcf"/> - <dep package="beforelight"/> - <dep package="bitmap"/> - <dep package="editres"/> - <dep package="fonttosfnt"/> - <dep package="fslsfonts"/> - <dep package="fstobdf"/> - <dep package="iceauth"/> - <dep package="ico"/> - <dep package="lbxproxy"/> - <dep package="listres"/> - <dep package="luit"/> - <dep package="mkcfm"/> - <dep package="mkfontdir"/> - <dep package="mkfontscale"/> - <dep package="oclock"/> - <dep package="proxymngr"/> - <dep package="rgb"/> - <dep package="rstart"/> - <dep package="scripts"/> - <dep package="setxkbmap"/> - <dep package="showfont"/> - <dep package="smproxy"/> - <dep package="twm"/> - <dep package="viewres"/> - <dep package="x11perf"/> - <dep package="xauth"/> - <dep package="xbiff"/> - <dep package="xcalc"/> - <dep package="xclipboard"/> - <dep package="xclock"/> - <dep package="xcmsdb"/> - <dep package="xconsole"/> - <dep package="xcursorgen"/> - <dep package="xdbedizzy"/> - <dep package="xditview"/> - <dep package="xdm"/> - <dep package="xdpyinfo"/> - <dep package="xdriinfo"/> - <dep package="xedit"/> - <dep package="xev"/> - <dep package="xeyes"/> - <dep package="xf86dga"/> - <dep package="xfd"/> - <dep package="xfindproxy"/> - <dep package="xfontsel"/> - <dep package="xfs"/> - <dep package="xfsinfo"/> - <dep package="xfwp"/> - <dep package="xgamma"/> - <dep package="xgc"/> - <dep package="xhost"/> - <dep package="xinit"/> - <dep package="xkbcomp"/> - <dep package="xkbevd"/> - <dep package="xkbprint"/> - <dep package="xkbutils"/> - <dep package="xkill"/> - <dep package="xload"/> - <dep package="xlogo"/> - <dep package="xfontsel"/> - <dep package="xlsatoms"/> - <dep package="xlsclients"/> - <dep package="xlsfonts"/> - <dep package="xmag"/> - <dep package="xman"/> - <dep package="xmessage"/> - <dep package="xmh"/> - <dep package="xmodmap"/> - <dep package="xmore"/> - - <!-- - <dep package="xphelloworld"/> - <dep package="xplsprinters"/> - <dep package="xpr"/> - <dep package="xprehashprinterlist"/> - --> - - <dep package="xprop"/> - <dep package="xrandr"/> - <dep package="xrdb"/> - <dep package="xrefresh"/> - <dep package="xrx"/> - <dep package="xset"/> - <dep package="xsetmode"/> - <dep package="xsetpointer"/> - <dep package="xsetroot"/> - <dep package="xsm"/> - <dep package="xstdcmap"/> - <dep package="xtrap"/> - <dep package="xvidtune"/> - <dep package="xvinfo"/> - <dep package="xwd"/> - <dep package="xwininfo"/> - <dep package="xwud"/> - </dependencies> - </metamodule> - - <!-- input drivers --> - - <autotools id="xf86-input-acecad"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-acecad" checkoutdir="xorg/driver/xf86-input-acecad" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-aiptek"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-aiptek" checkoutdir="xorg/driver/xf86-input-aiptek" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-calcomp"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-calcomp" checkoutdir="xorg/driver/xf86-input-calcomp" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-citron"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-citron" checkoutdir="xorg/driver/xf86-input-citron" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-digitaledge"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-digitaledge" checkoutdir="xorg/driver/xf86-input-digitaledge" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-dmc"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-dmc" checkoutdir="xorg/driver/xf86-input-dmc" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-dynapro"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-dynapro" checkoutdir="xorg/driver/xf86-input-dynapro" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-elo2300"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-elo2300" checkoutdir="xorg/driver/xf86-input-elo2300" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-elographics"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-elographics" checkoutdir="xorg/driver/xf86-input-elographics" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-evdev"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-evdev" checkoutdir="xorg/driver/xf86-input-evdev" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-fpit"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-fpit" checkoutdir="xorg/driver/xf86-input-fpit" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-hyperpen"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-hyperpen" checkoutdir="xorg/driver/xf86-input-hyperpen" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-jamstudio"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-jamstudio" checkoutdir="xorg/driver/xf86-input-jamstudio" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-joystick"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-joystick" checkoutdir="xorg/driver/xf86-input-joystick" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-keyboard"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-keyboard" checkoutdir="xorg/driver/xf86-input-keyboard" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-magellan"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-magellan" checkoutdir="xorg/driver/xf86-input-magellan" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-magictouch"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-magictouch" checkoutdir="xorg/driver/xf86-input-magictouch" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-microtouch"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-microtouch" checkoutdir="xorg/driver/xf86-input-microtouch" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-mouse"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-mouse" checkoutdir="xorg/driver/xf86-input-mouse" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-mutouch"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-mutouch" checkoutdir="xorg/driver/xf86-input-mutouch" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-palmax"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-palmax" checkoutdir="xorg/driver/xf86-input-palmax" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-penmount"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-penmount" checkoutdir="xorg/driver/xf86-input-penmount" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-spaceorb"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-spaceorb" checkoutdir="xorg/driver/xf86-input-spaceorb" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-summa"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-summa" checkoutdir="xorg/driver/xf86-input-summa" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-tek4957"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-tek4957" checkoutdir="xorg/driver/xf86-input-tek4957" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-ur98"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-ur98" checkoutdir="xorg/driver/xf86-input-ur98" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-vmmouse"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-vmmouse" checkoutdir="xorg/driver/xf86-input-vmmouse" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-input-void"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-input-void" checkoutdir="xorg/driver/xf86-input-void" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-apm"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-apm" checkoutdir="xorg/driver/xf86-video-apm" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-ark"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-ark" checkoutdir="xorg/driver/xf86-video-ark" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-ati"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-ati" checkoutdir="xorg/driver/xf86-video-ati" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-chips"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-chips" checkoutdir="xorg/driver/xf86-video-chips" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-cirrus"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-cirrus" checkoutdir="xorg/driver/xf86-video-cirrus" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-cyrix"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-cyrix" checkoutdir="xorg/driver/xf86-video-cyrix" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-dummy"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-dummy" checkoutdir="xorg/driver/xf86-video-dummy" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-fbdev"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-fbdev" checkoutdir="xorg/driver/xf86-video-fbdev" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-glint"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-glint" checkoutdir="xorg/driver/xf86-video-glint" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-i128"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-i128" checkoutdir="xorg/driver/xf86-video-i128" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-i740"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-i740" checkoutdir="xorg/driver/xf86-video-i740" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-imstt"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-imstt" checkoutdir="xorg/driver/xf86-video-imstt" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-intel"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-intel" checkoutdir="xorg/driver/xf86-video-intel" /> - <dependencies> - <dep package="xserver"/> - <dep package="x11proto"/> - <dep package="libXvMC"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-mga"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-mga" checkoutdir="xorg/driver/xf86-video-mga" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-neomagic"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-neomagic" checkoutdir="xorg/driver/xf86-video-neomagic" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-newport"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-newport" checkoutdir="xorg/driver/xf86-video-newport" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-nsc"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-nsc" checkoutdir="xorg/driver/xf86-video-nsc" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-nv"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-nv" checkoutdir="xorg/driver/xf86-video-nv" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-rendition"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-rendition" checkoutdir="xorg/driver/xf86-video-rendition" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-s3"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-s3" checkoutdir="xorg/driver/xf86-video-s3" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-s3virge"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-s3virge" checkoutdir="xorg/driver/xf86-video-s3virge" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-savage"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-savage" checkoutdir="xorg/driver/xf86-video-savage" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-siliconmotion"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-siliconmotion" checkoutdir="xorg/driver/xf86-video-siliconmotion" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-sis"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-sis" checkoutdir="xorg/driver/xf86-video-sis" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-sisusb"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-sisusb" checkoutdir="xorg/driver/xf86-video-sisusb" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-sunbw2"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-sunbw2" checkoutdir="xorg/driver/xf86-video-sunbw2" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-suncg14"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-suncg14" checkoutdir="xorg/driver/xf86-video-suncg14" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-suncg3"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-suncg3" checkoutdir="xorg/driver/xf86-video-suncg3" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-suncg6"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-suncg6" checkoutdir="xorg/driver/xf86-video-suncg6" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-sunffb"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-sunffb" checkoutdir="xorg/driver/xf86-video-sunffb" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-sunleo"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-sunleo" checkoutdir="xorg/driver/xf86-video-sunleo" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-suntcx"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-suntcx" checkoutdir="xorg/driver/xf86-video-suntcx" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-tdfx"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-tdfx" checkoutdir="xorg/driver/xf86-video-tdfx" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-tga"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-tga" checkoutdir="xorg/driver/xf86-video-tga" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-trident"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-trident" checkoutdir="xorg/driver/xf86-video-trident" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-tseng"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-tseng" checkoutdir="xorg/driver/xf86-video-tseng" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-v4l"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-v4l" checkoutdir="xorg/driver/xf86-video-v4l" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-vesa"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-vesa" checkoutdir="xorg/driver/xf86-video-vesa" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-vga"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-vga" checkoutdir="xorg/driver/xf86-video-vga" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-via"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-via" checkoutdir="xorg/driver/xf86-video-via" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-vmware"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-vmware" checkoutdir="xorg/driver/xf86-video-vmware" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-voodoo"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-voodoo" checkoutdir="xorg/driver/xf86-video-voodoo" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <autotools id="xf86-video-wsfb"> - <branch repo="git.freedesktop.org" module="xorg/driver/xf86-video-wsfb" checkoutdir="xorg/driver/xf86-video-wsfb" /> - <dependencies> - <dep package="xserver"/> - </dependencies> - </autotools> - - <metamodule id="xorg-drivers"> - <dependencies> - <dep package="xf86-input-acecad"/> - <dep package="xf86-input-aiptek"/> - <dep package="xf86-input-calcomp"/> - <dep package="xf86-input-citron"/> - <dep package="xf86-input-digitaledge"/> - <dep package="xf86-input-dmc"/> - <dep package="xf86-input-dynapro"/> - <dep package="xf86-input-elo2300"/> - <dep package="xf86-input-elographics"/> - <dep package="xf86-input-evdev"/> - <dep package="xf86-input-fpit"/> - <dep package="xf86-input-hyperpen"/> - <dep package="xf86-input-jamstudio"/> - <dep package="xf86-input-joystick"/> - <dep package="xf86-input-keyboard"/> - <dep package="xf86-input-magellan"/> - <dep package="xf86-input-magictouch"/> - <dep package="xf86-input-microtouch"/> - <dep package="xf86-input-mouse"/> - <dep package="xf86-input-mutouch"/> - <dep package="xf86-input-palmax"/> - <dep package="xf86-input-penmount"/> - <dep package="xf86-input-spaceorb"/> - <dep package="xf86-input-tek4957"/> - <dep package="xf86-input-ur98"/> - <dep package="xf86-input-void"/> - <dep package="xf86-video-apm"/> - <dep package="xf86-video-ark"/> - <dep package="xf86-video-ati"/> - <dep package="xf86-video-chips"/> - <dep package="xf86-video-cirrus"/> - <dep package="xf86-video-cyrix"/> - <dep package="xf86-video-dummy"/> - <dep package="xf86-video-fbdev"/> - <dep package="xf86-video-glint"/> - <dep package="xf86-video-i128"/> - <dep package="xf86-video-i740"/> - <dep package="xf86-video-intel"/> - <dep package="xf86-video-imstt"/> - <dep package="xf86-video-mga"/> - <dep package="xf86-video-neomagic"/> - <dep package="xf86-video-newport"/> - <dep package="xf86-video-nsc"/> - <dep package="xf86-video-nv"/> - <dep package="xf86-video-rendition"/> - <dep package="xf86-video-s3"/> - <dep package="xf86-video-s3virge"/> - <dep package="xf86-video-savage"/> - <dep package="xf86-video-siliconmotion"/> - <dep package="xf86-video-sis"/> - <dep package="xf86-video-sisusb"/> - <dep package="xf86-video-sunbw2"/> - <dep package="xf86-video-suncg14"/> - <dep package="xf86-video-suncg3"/> - <dep package="xf86-video-suncg6"/> - <dep package="xf86-video-sunffb"/> - <dep package="xf86-video-sunleo"/> - <dep package="xf86-video-suntcx"/> - <dep package="xf86-video-tdfx"/> - <dep package="xf86-video-tga"/> - <dep package="xf86-video-trident"/> - <dep package="xf86-video-tseng"/> - <dep package="xf86-video-v4l"/> - <dep package="xf86-video-vesa"/> - <dep package="xf86-video-vga"/> - <dep package="xf86-video-via"/> - <dep package="xf86-video-vmware"/> - <dep package="xf86-video-voodoo"/> - <dep package="xf86-video-wsfb"/> - </dependencies> - </metamodule> - - <!-- Modules that only build on x86 (32 and 64bit) --> - - <metamodule id="xorg-x86-drivers"> - <dependencies> - <dep package="xf86-input-vmmouse"/> - </dependencies> - </metamodule> - - <!-- This probably isn't sufficient, but it is a start --> - - <metamodule id="xorg-sun-drivers"> - <dependencies> - <dep package="xf86-video-sunbw2"/> - <dep package="xf86-video-suncg14"/> - <dep package="xf86-video-suncg3"/> - <dep package="xf86-video-suncg6"/> - <dep package="xf86-video-sunffb"/> - <dep package="xf86-video-sunleo"/> - <dep package="xf86-video-suntcx"/> - </dependencies> - </metamodule> - - - <!-- Bogosity of depending on libraries caused by Xnest. Sigh --> - <autotools id="xserver"> - <branch repo="git.freedesktop.org" module="xorg/xserver"/> - <dependencies> - <dep package="xorg-protos"/> - <dep package="libXaw"/> - <dep package="libxkbui"/> - <dep package="libXfont"/> - <dep package="libxtrans"/> - <dep package="libXau"/> - <dep package="libxkbfile"/> - <dep package="libXdmcp"/> - <dep package="libXxf86misc"/> - <dep package="libXxf86vm"/> - <dep package="liblbxutil"/> - <dep package="libdrm"/> - </dependencies> - </autotools> - - <metamodule id="xorg"> - <dependencies> - <dep package="xorg-protos"/> - <dep package="xorg-libs"/> - <dep package="xorg-fonts"/> - <dep package="xorg-apps"/> - <dep package="xorg-drivers"/> - <dep package="xserver"/> - </dependencies> - </metamodule> - -</moduleset> diff --git a/scripts/lib/argparse_oe.py b/scripts/lib/argparse_oe.py new file mode 100644 index 0000000000..bf6eb17197 --- /dev/null +++ b/scripts/lib/argparse_oe.py @@ -0,0 +1,169 @@ +import sys +import argparse +from collections import defaultdict, OrderedDict + +class ArgumentUsageError(Exception): + """Exception class you can raise (and catch) in order to show the help""" + def __init__(self, message, subcommand=None): + self.message = message + self.subcommand = subcommand + +class ArgumentParser(argparse.ArgumentParser): + """Our own version of argparse's ArgumentParser""" + def __init__(self, *args, **kwargs): + kwargs.setdefault('formatter_class', OeHelpFormatter) + self._subparser_groups = OrderedDict() + super(ArgumentParser, self).__init__(*args, **kwargs) + self._positionals.title = 'arguments' + self._optionals.title = 'options' + + def error(self, message): + """error(message: string) + + Prints a help message incorporating the message to stderr and + exits. + """ + self._print_message('%s: error: %s\n' % (self.prog, message), sys.stderr) + self.print_help(sys.stderr) + sys.exit(2) + + def error_subcommand(self, message, subcommand): + if subcommand: + action = self._get_subparser_action() + try: + subparser = action._name_parser_map[subcommand] + except KeyError: + self.error('no subparser for name "%s"' % subcommand) + else: + subparser.error(message) + + self.error(message) + + def add_subparsers(self, *args, **kwargs): + if 'dest' not in kwargs: + kwargs['dest'] = '_subparser_name' + + ret = super(ArgumentParser, self).add_subparsers(*args, **kwargs) + # Need a way of accessing the parent parser + ret._parent_parser = self + # Ensure our class gets instantiated + ret._parser_class = ArgumentSubParser + # Hacky way of adding a method to the subparsers object + ret.add_subparser_group = self.add_subparser_group + return ret + + def add_subparser_group(self, groupname, groupdesc, order=0): + self._subparser_groups[groupname] = (groupdesc, order) + + def parse_args(self, args=None, namespace=None): + """Parse arguments, using the correct subparser to show the error.""" + args, argv = self.parse_known_args(args, namespace) + if argv: + message = 'unrecognized arguments: %s' % ' '.join(argv) + if self._subparsers: + subparser = self._get_subparser(args) + subparser.error(message) + else: + self.error(message) + sys.exit(2) + return args + + def _get_subparser(self, args): + action = self._get_subparser_action() + if action.dest == argparse.SUPPRESS: + self.error('cannot get subparser, the subparser action dest is suppressed') + + name = getattr(args, action.dest) + try: + return action._name_parser_map[name] + except KeyError: + self.error('no subparser for name "%s"' % name) + + def _get_subparser_action(self): + if not self._subparsers: + self.error('cannot return the subparser action, no subparsers added') + + for action in self._subparsers._group_actions: + if isinstance(action, argparse._SubParsersAction): + return action + + +class ArgumentSubParser(ArgumentParser): + def __init__(self, *args, **kwargs): + if 'group' in kwargs: + self._group = kwargs.pop('group') + if 'order' in kwargs: + self._order = kwargs.pop('order') + super(ArgumentSubParser, self).__init__(*args, **kwargs) + + def parse_known_args(self, args=None, namespace=None): + # This works around argparse not handling optional positional arguments being + # intermixed with other options. A pretty horrible hack, but we're not left + # with much choice given that the bug in argparse exists and it's difficult + # to subclass. + # Borrowed from http://stackoverflow.com/questions/20165843/argparse-how-to-handle-variable-number-of-arguments-nargs + # with an extra workaround (in format_help() below) for the positional + # arguments disappearing from the --help output, as well as structural tweaks. + # Originally simplified from http://bugs.python.org/file30204/test_intermixed.py + positionals = self._get_positional_actions() + for action in positionals: + # deactivate positionals + action.save_nargs = action.nargs + action.nargs = 0 + + namespace, remaining_args = super(ArgumentSubParser, self).parse_known_args(args, namespace) + for action in positionals: + # remove the empty positional values from namespace + if hasattr(namespace, action.dest): + delattr(namespace, action.dest) + for action in positionals: + action.nargs = action.save_nargs + # parse positionals + namespace, extras = super(ArgumentSubParser, self).parse_known_args(remaining_args, namespace) + return namespace, extras + + def format_help(self): + # Quick, restore the positionals! + positionals = self._get_positional_actions() + for action in positionals: + if hasattr(action, 'save_nargs'): + action.nargs = action.save_nargs + return super(ArgumentParser, self).format_help() + + +class OeHelpFormatter(argparse.HelpFormatter): + def _format_action(self, action): + if hasattr(action, '_get_subactions'): + # subcommands list + groupmap = defaultdict(list) + ordermap = {} + subparser_groups = action._parent_parser._subparser_groups + groups = sorted(subparser_groups.keys(), key=lambda item: subparser_groups[item][1], reverse=True) + for subaction in self._iter_indented_subactions(action): + parser = action._name_parser_map[subaction.dest] + group = getattr(parser, '_group', None) + groupmap[group].append(subaction) + if group not in groups: + groups.append(group) + order = getattr(parser, '_order', 0) + ordermap[subaction.dest] = order + + lines = [] + if len(groupmap) > 1: + groupindent = ' ' + else: + groupindent = '' + for group in groups: + subactions = groupmap[group] + if not subactions: + continue + if groupindent: + if not group: + group = 'other' + groupdesc = subparser_groups.get(group, (group, 0))[0] + lines.append(' %s:' % groupdesc) + for subaction in sorted(subactions, key=lambda item: ordermap[item.dest], reverse=True): + lines.append('%s%s' % (groupindent, self._format_action(subaction).rstrip())) + return '\n'.join(lines) + else: + return super(OeHelpFormatter, self)._format_action(action) diff --git a/scripts/lib/build_perf/__init__.py b/scripts/lib/build_perf/__init__.py new file mode 100644 index 0000000000..1f8b729078 --- /dev/null +++ b/scripts/lib/build_perf/__init__.py @@ -0,0 +1,31 @@ +# +# Copyright (c) 2017, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +"""Build performance test library functions""" + +def print_table(rows, row_fmt=None): + """Print data table""" + if not rows: + return + if not row_fmt: + row_fmt = ['{:{wid}} '] * len(rows[0]) + + # Go through the data to get maximum cell widths + num_cols = len(row_fmt) + col_widths = [0] * num_cols + for row in rows: + for i, val in enumerate(row): + col_widths[i] = max(col_widths[i], len(str(val))) + + for row in rows: + print(*[row_fmt[i].format(col, wid=col_widths[i]) for i, col in enumerate(row)]) + diff --git a/scripts/lib/build_perf/html.py b/scripts/lib/build_perf/html.py new file mode 100644 index 0000000000..578bb162ee --- /dev/null +++ b/scripts/lib/build_perf/html.py @@ -0,0 +1,19 @@ +# +# Copyright (c) 2017, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +"""Helper module for HTML reporting""" +from jinja2 import Environment, PackageLoader + + +env = Environment(loader=PackageLoader('build_perf', 'html')) + +template = env.get_template('report.html') diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html new file mode 100644 index 0000000000..65f1a227ad --- /dev/null +++ b/scripts/lib/build_perf/html/measurement_chart.html @@ -0,0 +1,50 @@ +<script type="text/javascript"> + chartsDrawing += 1; + google.charts.setOnLoadCallback(drawChart_{{ chart_elem_id }}); + function drawChart_{{ chart_elem_id }}() { + var data = new google.visualization.DataTable(); + + // Chart options + var options = { + theme : 'material', + legend: 'none', + hAxis: { format: '', title: 'Commit number', + minValue: {{ chart_opts.haxis.min }}, + maxValue: {{ chart_opts.haxis.max }} }, + {% if measurement.type == 'time' %} + vAxis: { format: 'h:mm:ss' }, + {% else %} + vAxis: { format: '' }, + {% endif %} + pointSize: 5, + chartArea: { left: 80, right: 15 }, + }; + + // Define data columns + data.addColumn('number', 'Commit'); + data.addColumn('{{ measurement.value_type.gv_data_type }}', + '{{ measurement.value_type.quantity }}'); + // Add data rows + data.addRows([ + {% for sample in measurement.samples %} + [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}], + {% endfor %} + ]); + + // Finally, draw the chart + chart_div = document.getElementById('{{ chart_elem_id }}'); + var chart = new google.visualization.LineChart(chart_div); + google.visualization.events.addListener(chart, 'ready', function () { + //chart_div = document.getElementById('{{ chart_elem_id }}'); + //chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">'; + png_div = document.getElementById('{{ chart_elem_id }}_png'); + png_div.outerHTML = '<a id="{{ chart_elem_id }}_png" href="' + chart.getImageURI() + '">PNG</a>'; + console.log("CHART READY: {{ chart_elem_id }}"); + chartsDrawing -= 1; + if (chartsDrawing == 0) + console.log("ALL CHARTS READY"); + }); + chart.draw(data, options); +} +</script> + diff --git a/scripts/lib/build_perf/html/report.html b/scripts/lib/build_perf/html/report.html new file mode 100644 index 0000000000..165cbb811c --- /dev/null +++ b/scripts/lib/build_perf/html/report.html @@ -0,0 +1,206 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +{# Scripts, for visualization#} +<!--START-OF-SCRIPTS--> +<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> +<script type="text/javascript"> +google.charts.load('current', {'packages':['corechart']}); +var chartsDrawing = 0; +</script> + +{# Render measurement result charts #} +{% for test in test_data %} + {% if test.status == 'SUCCESS' %} + {% for measurement in test.measurements %} + {% set chart_elem_id = test.name + '_' + measurement.name + '_chart' %} + {% include 'measurement_chart.html' %} + {% endfor %} + {% endif %} +{% endfor %} + +<!--END-OF-SCRIPTS--> + +{# Styles #} +<style> +.meta-table { + font-size: 14px; + text-align: left; + border-collapse: collapse; +} +.meta-table tr:nth-child(even){background-color: #f2f2f2} +meta-table th, .meta-table td { + padding: 4px; +} +.summary { + margin: 0; + font-size: 14px; + text-align: left; + border-collapse: collapse; +} +summary th, .meta-table td { + padding: 4px; +} +.measurement { + padding: 8px 0px 8px 8px; + border: 2px solid #f0f0f0; + margin-bottom: 10px; +} +.details { + margin: 0; + font-size: 12px; + text-align: left; + border-collapse: collapse; +} +.details th { + font-weight: normal; + padding-right: 8px; +} +.preformatted { + font-family: monospace; + white-space: pre-wrap; + background-color: #f0f0f0; + margin-left: 10px; +} +hr { + color: #f0f0f0; +} +h2 { + font-size: 20px; + margin-bottom: 0px; + color: #707070; +} +h3 { + font-size: 16px; + margin: 0px; + color: #707070; +} +</style> + +<title>{{ title }}</title> +</head> + +{% macro poky_link(commit) -%} + <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?id={{ commit }}">{{ commit[0:11] }}</a> +{%- endmacro %} + +<body><div style="width: 700px"> + {# Test metadata #} + <h2>General</h2> + <hr> + <table class="meta-table" style="width: 100%"> + <tr> + <th></th> + <th>Current commit</th> + <th>Comparing with</th> + </tr> + {% for key, item in metadata.items() %} + <tr> + <th>{{ item.title }}</th> + {%if key == 'commit' %} + <td>{{ poky_link(item.value) }}</td> + <td>{{ poky_link(item.value_old) }}</td> + {% else %} + <td>{{ item.value }}</td> + <td>{{ item.value_old }}</td> + {% endif %} + </tr> + {% endfor %} + </table> + + {# Test result summary #} + <h2>Test result summary</h2> + <hr> + <table class="summary" style="width: 100%"> + {% for test in test_data %} + {% if loop.index is even %} + {% set row_style = 'style="background-color: #f2f2f2"' %} + {% else %} + {% set row_style = 'style="background-color: #ffffff"' %} + {% endif %} + <tr {{ row_style }}><td>{{ test.name }}: {{ test.description }}</td> + {% if test.status == 'SUCCESS' %} + {% for measurement in test.measurements %} + {# add empty cell in place of the test name#} + {% if loop.index > 1 %}<td></td>{% endif %} + {% if measurement.absdiff > 0 %} + {% set result_style = "color: red" %} + {% elif measurement.absdiff == measurement.absdiff %} + {% set result_style = "color: green" %} + {% else %} + {% set result_style = "color: orange" %} + {%endif %} + <td>{{ measurement.description }}</td> + <td style="font-weight: bold">{{ measurement.value.mean }}</td> + <td style="{{ result_style }}">{{ measurement.absdiff_str }}</td> + <td style="{{ result_style }}">{{ measurement.reldiff }}</td> + </tr><tr {{ row_style }}> + {% endfor %} + {% else %} + <td style="font-weight: bold; color: red;">{{test.status }}</td> + <td></td> <td></td> <td></td> <td></td> + {% endif %} + </tr> + {% endfor %} + </table> + + {# Detailed test results #} + {% for test in test_data %} + <h2>{{ test.name }}: {{ test.description }}</h2> + <hr> + {% if test.status == 'SUCCESS' %} + {% for measurement in test.measurements %} + <div class="measurement"> + <h3>{{ measurement.description }}</h3> + <div style="font-weight:bold;"> + <span style="font-size: 23px;">{{ measurement.value.mean }}</span> + <span style="font-size: 20px; margin-left: 12px"> + {% if measurement.absdiff > 0 %} + <span style="color: red"> + {% elif measurement.absdiff == measurement.absdiff %} + <span style="color: green"> + {% else %} + <span style="color: orange"> + {% endif %} + {{ measurement.absdiff_str }} ({{measurement.reldiff}}) + </span></span> + </div> + <table style="width: 100%"> + <tr> + <td style="width: 75%"> + {# Linechart #} + <div id="{{ test.name }}_{{ measurement.name }}_chart"></div> + </td> + <td> + {# Measurement statistics #} + <table class="details"> + <tr> + <th>Test runs</th><td>{{ measurement.value.sample_cnt }}</td> + </tr><tr> + <th>-/+</th><td>-{{ measurement.value.minus }} / +{{ measurement.value.plus }}</td> + </tr><tr> + <th>Min</th><td>{{ measurement.value.min }}</td> + </tr><tr> + <th>Max</th><td>{{ measurement.value.max }}</td> + </tr><tr> + <th>Stdev</th><td>{{ measurement.value.stdev }}</td> + </tr><tr> + <th><div id="{{ test.name }}_{{ measurement.name }}_chart_png"></div></th> + </tr> + </table> + </td> + </tr> + </table> + </div> + {% endfor %} + {# Unsuccessful test #} + {% else %} + <span style="font-size: 150%; font-weight: bold; color: red;">{{ test.status }} + {% if test.err_type %}<span style="font-size: 75%; font-weight: normal">({{ test.err_type }})</span>{% endif %} + </span> + <div class="preformatted">{{ test.message }}</div> + {% endif %} + {% endfor %} +</div></body> +</html> + diff --git a/scripts/lib/build_perf/report.py b/scripts/lib/build_perf/report.py new file mode 100644 index 0000000000..eb00ccca2d --- /dev/null +++ b/scripts/lib/build_perf/report.py @@ -0,0 +1,342 @@ +# +# Copyright (c) 2017, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +"""Handling of build perf test reports""" +from collections import OrderedDict, Mapping +from datetime import datetime, timezone +from numbers import Number +from statistics import mean, stdev, variance + + +def isofmt_to_timestamp(string): + """Convert timestamp string in ISO 8601 format into unix timestamp""" + if '.' in string: + dt = datetime.strptime(string, '%Y-%m-%dT%H:%M:%S.%f') + else: + dt = datetime.strptime(string, '%Y-%m-%dT%H:%M:%S') + return dt.replace(tzinfo=timezone.utc).timestamp() + + +def metadata_xml_to_json(elem): + """Convert metadata xml into JSON format""" + assert elem.tag == 'metadata', "Invalid metadata file format" + + def _xml_to_json(elem): + """Convert xml element to JSON object""" + out = OrderedDict() + for child in elem.getchildren(): + key = child.attrib.get('name', child.tag) + if len(child): + out[key] = _xml_to_json(child) + else: + out[key] = child.text + return out + return _xml_to_json(elem) + + +def results_xml_to_json(elem): + """Convert results xml into JSON format""" + rusage_fields = ('ru_utime', 'ru_stime', 'ru_maxrss', 'ru_minflt', + 'ru_majflt', 'ru_inblock', 'ru_oublock', 'ru_nvcsw', + 'ru_nivcsw') + iostat_fields = ('rchar', 'wchar', 'syscr', 'syscw', 'read_bytes', + 'write_bytes', 'cancelled_write_bytes') + + def _read_measurement(elem): + """Convert measurement to JSON""" + data = OrderedDict() + data['type'] = elem.tag + data['name'] = elem.attrib['name'] + data['legend'] = elem.attrib['legend'] + values = OrderedDict() + + # SYSRES measurement + if elem.tag == 'sysres': + for subel in elem: + if subel.tag == 'time': + values['start_time'] = isofmt_to_timestamp(subel.attrib['timestamp']) + values['elapsed_time'] = float(subel.text) + elif subel.tag == 'rusage': + rusage = OrderedDict() + for field in rusage_fields: + if 'time' in field: + rusage[field] = float(subel.attrib[field]) + else: + rusage[field] = int(subel.attrib[field]) + values['rusage'] = rusage + elif subel.tag == 'iostat': + values['iostat'] = OrderedDict([(f, int(subel.attrib[f])) + for f in iostat_fields]) + elif subel.tag == 'buildstats_file': + values['buildstats_file'] = subel.text + else: + raise TypeError("Unknown sysres value element '{}'".format(subel.tag)) + # DISKUSAGE measurement + elif elem.tag == 'diskusage': + values['size'] = int(elem.find('size').text) + else: + raise Exception("Unknown measurement tag '{}'".format(elem.tag)) + data['values'] = values + return data + + def _read_testcase(elem): + """Convert testcase into JSON""" + assert elem.tag == 'testcase', "Expecting 'testcase' element instead of {}".format(elem.tag) + + data = OrderedDict() + data['name'] = elem.attrib['name'] + data['description'] = elem.attrib['description'] + data['status'] = 'SUCCESS' + data['start_time'] = isofmt_to_timestamp(elem.attrib['timestamp']) + data['elapsed_time'] = float(elem.attrib['time']) + measurements = OrderedDict() + + for subel in elem.getchildren(): + if subel.tag == 'error' or subel.tag == 'failure': + data['status'] = subel.tag.upper() + data['message'] = subel.attrib['message'] + data['err_type'] = subel.attrib['type'] + data['err_output'] = subel.text + elif subel.tag == 'skipped': + data['status'] = 'SKIPPED' + data['message'] = subel.text + else: + measurements[subel.attrib['name']] = _read_measurement(subel) + data['measurements'] = measurements + return data + + def _read_testsuite(elem): + """Convert suite to JSON""" + assert elem.tag == 'testsuite', \ + "Expecting 'testsuite' element instead of {}".format(elem.tag) + + data = OrderedDict() + if 'hostname' in elem.attrib: + data['tester_host'] = elem.attrib['hostname'] + data['start_time'] = isofmt_to_timestamp(elem.attrib['timestamp']) + data['elapsed_time'] = float(elem.attrib['time']) + tests = OrderedDict() + + for case in elem.getchildren(): + tests[case.attrib['name']] = _read_testcase(case) + data['tests'] = tests + return data + + # Main function + assert elem.tag == 'testsuites', "Invalid test report format" + assert len(elem) == 1, "Too many testsuites" + + return _read_testsuite(elem.getchildren()[0]) + + +def aggregate_metadata(metadata): + """Aggregate metadata into one, basically a sanity check""" + mutable_keys = ('pretty_name', 'version_id') + + def aggregate_obj(aggregate, obj, assert_str=True): + """Aggregate objects together""" + assert type(aggregate) is type(obj), \ + "Type mismatch: {} != {}".format(type(aggregate), type(obj)) + if isinstance(obj, Mapping): + assert set(aggregate.keys()) == set(obj.keys()) + for key, val in obj.items(): + aggregate_obj(aggregate[key], val, key not in mutable_keys) + elif isinstance(obj, list): + assert len(aggregate) == len(obj) + for i, val in enumerate(obj): + aggregate_obj(aggregate[i], val) + elif not isinstance(obj, str) or (isinstance(obj, str) and assert_str): + assert aggregate == obj, "Data mismatch {} != {}".format(aggregate, obj) + + if not metadata: + return {} + + # Do the aggregation + aggregate = metadata[0].copy() + for testrun in metadata[1:]: + aggregate_obj(aggregate, testrun) + aggregate['testrun_count'] = len(metadata) + return aggregate + + +def aggregate_data(data): + """Aggregate multiple test results JSON structures into one""" + + mutable_keys = ('status', 'message', 'err_type', 'err_output') + + class SampleList(list): + """Container for numerical samples""" + pass + + def new_aggregate_obj(obj): + """Create new object for aggregate""" + if isinstance(obj, Number): + new_obj = SampleList() + new_obj.append(obj) + elif isinstance(obj, str): + new_obj = obj + else: + # Lists and and dicts are kept as is + new_obj = obj.__class__() + aggregate_obj(new_obj, obj) + return new_obj + + def aggregate_obj(aggregate, obj, assert_str=True): + """Recursive "aggregation" of JSON objects""" + if isinstance(obj, Number): + assert isinstance(aggregate, SampleList) + aggregate.append(obj) + return + + assert type(aggregate) == type(obj), \ + "Type mismatch: {} != {}".format(type(aggregate), type(obj)) + if isinstance(obj, Mapping): + for key, val in obj.items(): + if not key in aggregate: + aggregate[key] = new_aggregate_obj(val) + else: + aggregate_obj(aggregate[key], val, key not in mutable_keys) + elif isinstance(obj, list): + for i, val in enumerate(obj): + if i >= len(aggregate): + aggregate[key] = new_aggregate_obj(val) + else: + aggregate_obj(aggregate[i], val) + elif isinstance(obj, str): + # Sanity check for data + if assert_str: + assert aggregate == obj, "Data mismatch {} != {}".format(aggregate, obj) + else: + raise Exception("BUG: unable to aggregate '{}' ({})".format(type(obj), str(obj))) + + if not data: + return {} + + # Do the aggregation + aggregate = data[0].__class__() + for testrun in data: + aggregate_obj(aggregate, testrun) + return aggregate + + +class MeasurementVal(float): + """Base class representing measurement values""" + gv_data_type = 'number' + + def gv_value(self): + """Value formatting for visualization""" + if self != self: + return "null" + else: + return self + + +class TimeVal(MeasurementVal): + """Class representing time values""" + quantity = 'time' + gv_title = 'elapsed time' + gv_data_type = 'timeofday' + + def hms(self): + """Split time into hours, minutes and seconeds""" + hhh = int(abs(self) / 3600) + mmm = int((abs(self) % 3600) / 60) + sss = abs(self) % 60 + return hhh, mmm, sss + + def __str__(self): + if self != self: + return "nan" + hh, mm, ss = self.hms() + sign = '-' if self < 0 else '' + if hh > 0: + return '{}{:d}:{:02d}:{:02.0f}'.format(sign, hh, mm, ss) + elif mm > 0: + return '{}{:d}:{:04.1f}'.format(sign, mm, ss) + elif ss > 1: + return '{}{:.1f} s'.format(sign, ss) + else: + return '{}{:.2f} s'.format(sign, ss) + + def gv_value(self): + """Value formatting for visualization""" + if self != self: + return "null" + hh, mm, ss = self.hms() + return [hh, mm, int(ss), int(ss*1000) % 1000] + + +class SizeVal(MeasurementVal): + """Class representing time values""" + quantity = 'size' + gv_title = 'size in MiB' + gv_data_type = 'number' + + def __str__(self): + if self != self: + return "nan" + if abs(self) < 1024: + return '{:.1f} kiB'.format(self) + elif abs(self) < 1048576: + return '{:.2f} MiB'.format(self / 1024) + else: + return '{:.2f} GiB'.format(self / 1048576) + + def gv_value(self): + """Value formatting for visualization""" + if self != self: + return "null" + return self / 1024 + +def measurement_stats(meas, prefix=''): + """Get statistics of a measurement""" + if not meas: + return {prefix + 'sample_cnt': 0, + prefix + 'mean': MeasurementVal('nan'), + prefix + 'stdev': MeasurementVal('nan'), + prefix + 'variance': MeasurementVal('nan'), + prefix + 'min': MeasurementVal('nan'), + prefix + 'max': MeasurementVal('nan'), + prefix + 'minus': MeasurementVal('nan'), + prefix + 'plus': MeasurementVal('nan')} + + stats = {'name': meas['name']} + if meas['type'] == 'sysres': + val_cls = TimeVal + values = meas['values']['elapsed_time'] + elif meas['type'] == 'diskusage': + val_cls = SizeVal + values = meas['values']['size'] + else: + raise Exception("Unknown measurement type '{}'".format(meas['type'])) + stats['val_cls'] = val_cls + stats['quantity'] = val_cls.quantity + stats[prefix + 'sample_cnt'] = len(values) + + mean_val = val_cls(mean(values)) + min_val = val_cls(min(values)) + max_val = val_cls(max(values)) + + stats[prefix + 'mean'] = mean_val + if len(values) > 1: + stats[prefix + 'stdev'] = val_cls(stdev(values)) + stats[prefix + 'variance'] = val_cls(variance(values)) + else: + stats[prefix + 'stdev'] = float('nan') + stats[prefix + 'variance'] = float('nan') + stats[prefix + 'min'] = min_val + stats[prefix + 'max'] = max_val + stats[prefix + 'minus'] = val_cls(mean_val - min_val) + stats[prefix + 'plus'] = val_cls(max_val - mean_val) + + return stats + diff --git a/scripts/lib/build_perf/scrape-html-report.js b/scripts/lib/build_perf/scrape-html-report.js new file mode 100644 index 0000000000..05a1f57001 --- /dev/null +++ b/scripts/lib/build_perf/scrape-html-report.js @@ -0,0 +1,56 @@ +var fs = require('fs'); +var system = require('system'); +var page = require('webpage').create(); + +// Examine console log for message from chart drawing +page.onConsoleMessage = function(msg) { + console.log(msg); + if (msg === "ALL CHARTS READY") { + window.charts_ready = true; + } + else if (msg.slice(0, 11) === "CHART READY") { + var chart_id = msg.split(" ")[2]; + console.log('grabbing ' + chart_id); + var png_data = page.evaluate(function (chart_id) { + var chart_div = document.getElementById(chart_id + '_png'); + return chart_div.outerHTML; + }, chart_id); + fs.write(args[2] + '/' + chart_id + '.png', png_data, 'w'); + } +}; + +// Check command line arguments +var args = system.args; +if (args.length != 3) { + console.log("USAGE: " + args[0] + " REPORT_HTML OUT_DIR\n"); + phantom.exit(1); +} + +// Open the web page +page.open(args[1], function(status) { + if (status == 'fail') { + console.log("Failed to open file '" + args[1] + "'"); + phantom.exit(1); + } +}); + +// Check status every 100 ms +interval = window.setInterval(function () { + //console.log('waiting'); + if (window.charts_ready) { + clearTimeout(timer); + clearInterval(interval); + + var fname = args[1].replace(/\/+$/, "").split("/").pop() + console.log("saving " + fname); + fs.write(args[2] + '/' + fname, page.content, 'w'); + phantom.exit(0); + } +}, 100); + +// Time-out after 10 seconds +timer = window.setTimeout(function () { + clearInterval(interval); + console.log("ERROR: timeout"); + phantom.exit(1); +}, 10000); diff --git a/scripts/lib/compatlayer/__init__.py b/scripts/lib/compatlayer/__init__.py new file mode 100644 index 0000000000..e35f8c0d32 --- /dev/null +++ b/scripts/lib/compatlayer/__init__.py @@ -0,0 +1,308 @@ +# Yocto Project compatibility layer tool +# +# Copyright (C) 2017 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import os +import subprocess +from enum import Enum + +import bb.tinfoil + +class LayerType(Enum): + BSP = 0 + DISTRO = 1 + SOFTWARE = 2 + ERROR_NO_LAYER_CONF = 98 + ERROR_BSP_DISTRO = 99 + +def _get_configurations(path): + configs = [] + + for f in os.listdir(path): + file_path = os.path.join(path, f) + if os.path.isfile(file_path) and f.endswith('.conf'): + configs.append(f[:-5]) # strip .conf + return configs + +def _get_layer_collections(layer_path, lconf=None, data=None): + import bb.parse + import bb.data + + if lconf is None: + lconf = os.path.join(layer_path, 'conf', 'layer.conf') + + if data is None: + ldata = bb.data.init() + bb.parse.init_parser(ldata) + else: + ldata = data.createCopy() + + ldata.setVar('LAYERDIR', layer_path) + try: + ldata = bb.parse.handle(lconf, ldata, include=True) + except BaseException as exc: + raise LayerError(exc) + ldata.expandVarref('LAYERDIR') + + collections = (ldata.getVar('BBFILE_COLLECTIONS', True) or '').split() + if not collections: + name = os.path.basename(layer_path) + collections = [name] + + collections = {c: {} for c in collections} + for name in collections: + priority = ldata.getVar('BBFILE_PRIORITY_%s' % name, True) + pattern = ldata.getVar('BBFILE_PATTERN_%s' % name, True) + depends = ldata.getVar('LAYERDEPENDS_%s' % name, True) + collections[name]['priority'] = priority + collections[name]['pattern'] = pattern + collections[name]['depends'] = depends + + return collections + +def _detect_layer(layer_path): + """ + Scans layer directory to detect what type of layer + is BSP, Distro or Software. + + Returns a dictionary with layer name, type and path. + """ + + layer = {} + layer_name = os.path.basename(layer_path) + + layer['name'] = layer_name + layer['path'] = layer_path + layer['conf'] = {} + + if not os.path.isfile(os.path.join(layer_path, 'conf', 'layer.conf')): + layer['type'] = LayerType.ERROR_NO_LAYER_CONF + return layer + + machine_conf = os.path.join(layer_path, 'conf', 'machine') + distro_conf = os.path.join(layer_path, 'conf', 'distro') + + is_bsp = False + is_distro = False + + if os.path.isdir(machine_conf): + machines = _get_configurations(machine_conf) + if machines: + is_bsp = True + + if os.path.isdir(distro_conf): + distros = _get_configurations(distro_conf) + if distros: + is_distro = True + + if is_bsp and is_distro: + layer['type'] = LayerType.ERROR_BSP_DISTRO + elif is_bsp: + layer['type'] = LayerType.BSP + layer['conf']['machines'] = machines + elif is_distro: + layer['type'] = LayerType.DISTRO + layer['conf']['distros'] = distros + else: + layer['type'] = LayerType.SOFTWARE + + layer['collections'] = _get_layer_collections(layer['path']) + + return layer + +def detect_layers(layer_directories, no_auto): + layers = [] + + for directory in layer_directories: + directory = os.path.realpath(directory) + if directory[-1] == '/': + directory = directory[0:-1] + + if no_auto: + conf_dir = os.path.join(directory, 'conf') + if os.path.isdir(conf_dir): + layer = _detect_layer(directory) + if layer: + layers.append(layer) + else: + for root, dirs, files in os.walk(directory): + dir_name = os.path.basename(root) + conf_dir = os.path.join(root, 'conf') + if os.path.isdir(conf_dir): + layer = _detect_layer(root) + if layer: + layers.append(layer) + + return layers + +def _find_layer_depends(depend, layers): + for layer in layers: + for collection in layer['collections']: + if depend == collection: + return layer + return None + +def add_layer_dependencies(bblayersconf, layer, layers, logger): + def recurse_dependencies(depends, layer, layers, logger, ret = []): + logger.debug('Processing dependencies %s for layer %s.' % \ + (depends, layer['name'])) + + for depend in depends.split(): + # core (oe-core) is suppose to be provided + if depend == 'core': + continue + + layer_depend = _find_layer_depends(depend, layers) + if not layer_depend: + logger.error('Layer %s depends on %s and isn\'t found.' % \ + (layer['name'], depend)) + ret = None + continue + + # We keep processing, even if ret is None, this allows us to report + # multiple errors at once + if ret is not None and layer_depend not in ret: + ret.append(layer_depend) + + # Recursively process... + if 'collections' not in layer_depend: + continue + + for collection in layer_depend['collections']: + collect_deps = layer_depend['collections'][collection]['depends'] + if not collect_deps: + continue + ret = recurse_dependencies(collect_deps, layer_depend, layers, logger, ret) + + return ret + + layer_depends = [] + for collection in layer['collections']: + depends = layer['collections'][collection]['depends'] + if not depends: + continue + + layer_depends = recurse_dependencies(depends, layer, layers, logger, layer_depends) + + # Note: [] (empty) is allowed, None is not! + if layer_depends is None: + return False + else: + for layer_depend in layer_depends: + logger.info('Adding layer dependency %s' % layer_depend['name']) + with open(bblayersconf, 'a+') as f: + f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path']) + return True + +def add_layer(bblayersconf, layer, layers, logger): + logger.info('Adding layer %s' % layer['name']) + with open(bblayersconf, 'a+') as f: + f.write("\nBBLAYERS += \"%s\"\n" % layer['path']) + + return True + +def check_command(error_msg, cmd): + ''' + Run a command under a shell, capture stdout and stderr in a single stream, + throw an error when command returns non-zero exit code. Returns the output. + ''' + + p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + output, _ = p.communicate() + if p.returncode: + msg = "%s\nCommand: %s\nOutput:\n%s" % (error_msg, cmd, output.decode('utf-8')) + raise RuntimeError(msg) + return output + +def get_signatures(builddir, failsafe=False, machine=None): + import re + + # some recipes needs to be excluded like meta-world-pkgdata + # because a layer can add recipes to a world build so signature + # will be change + exclude_recipes = ('meta-world-pkgdata',) + + sigs = {} + tune2tasks = {} + + cmd = '' + if machine: + cmd += 'MACHINE=%s ' % machine + cmd += 'bitbake ' + if failsafe: + cmd += '-k ' + cmd += '-S none world' + sigs_file = os.path.join(builddir, 'locked-sigs.inc') + if os.path.exists(sigs_file): + os.unlink(sigs_file) + try: + check_command('Generating signatures failed. This might be due to some parse error and/or general layer incompatibilities.', + cmd) + except RuntimeError as ex: + if failsafe and os.path.exists(sigs_file): + # Ignore the error here. Most likely some recipes active + # in a world build lack some dependencies. There is a + # separate test_machine_world_build which exposes the + # failure. + pass + else: + raise + + sig_regex = re.compile("^(?P<task>.*:.*):(?P<hash>.*) .$") + tune_regex = re.compile("(^|\s)SIGGEN_LOCKEDSIGS_t-(?P<tune>\S*)\s*=\s*") + current_tune = None + with open(sigs_file, 'r') as f: + for line in f.readlines(): + line = line.strip() + t = tune_regex.search(line) + if t: + current_tune = t.group('tune') + s = sig_regex.match(line) + if s: + exclude = False + for er in exclude_recipes: + (recipe, task) = s.group('task').split(':') + if er == recipe: + exclude = True + break + if exclude: + continue + + sigs[s.group('task')] = s.group('hash') + tune2tasks.setdefault(current_tune, []).append(s.group('task')) + + if not sigs: + raise RuntimeError('Can\'t load signatures from %s' % sigs_file) + + return (sigs, tune2tasks) + +def get_depgraph(targets=['world']): + ''' + Returns the dependency graph for the given target(s). + The dependency graph is taken directly from DepTreeEvent. + ''' + depgraph = None + with bb.tinfoil.Tinfoil() as tinfoil: + tinfoil.prepare(config_only=False) + tinfoil.set_event_mask(['bb.event.NoProvider', 'bb.event.DepTreeGenerated', 'bb.command.CommandCompleted']) + if not tinfoil.run_command('generateDepTreeEvent', targets, 'do_build'): + raise RuntimeError('starting generateDepTreeEvent failed') + while True: + event = tinfoil.wait_event(timeout=1000) + if event: + if isinstance(event, bb.command.CommandFailed): + raise RuntimeError('Generating dependency information failed: %s' % event.error) + elif isinstance(event, bb.command.CommandCompleted): + break + elif isinstance(event, bb.event.NoProvider): + if event._reasons: + raise RuntimeError('Nothing provides %s: %s' % (event._item, event._reasons)) + else: + raise RuntimeError('Nothing provides %s.' % (event._item)) + elif isinstance(event, bb.event.DepTreeGenerated): + depgraph = event._depgraph + + if depgraph is None: + raise RuntimeError('Could not retrieve the depgraph.') + return depgraph diff --git a/scripts/lib/compatlayer/case.py b/scripts/lib/compatlayer/case.py new file mode 100644 index 0000000000..54ce78aa60 --- /dev/null +++ b/scripts/lib/compatlayer/case.py @@ -0,0 +1,7 @@ +# Copyright (C) 2017 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +from oeqa.core.case import OETestCase + +class OECompatLayerTestCase(OETestCase): + pass diff --git a/scripts/lib/compatlayer/cases/__init__.py b/scripts/lib/compatlayer/cases/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/scripts/lib/compatlayer/cases/__init__.py diff --git a/scripts/lib/compatlayer/cases/bsp.py b/scripts/lib/compatlayer/cases/bsp.py new file mode 100644 index 0000000000..43efae406f --- /dev/null +++ b/scripts/lib/compatlayer/cases/bsp.py @@ -0,0 +1,204 @@ +# Copyright (C) 2017 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import unittest + +from compatlayer import LayerType, get_signatures, check_command, get_depgraph +from compatlayer.case import OECompatLayerTestCase + +class BSPCompatLayer(OECompatLayerTestCase): + @classmethod + def setUpClass(self): + if self.tc.layer['type'] != LayerType.BSP: + raise unittest.SkipTest("BSPCompatLayer: Layer %s isn't BSP one." %\ + self.tc.layer['name']) + + def test_bsp_defines_machines(self): + self.assertTrue(self.tc.layer['conf']['machines'], + "Layer is BSP but doesn't defines machines.") + + def test_bsp_no_set_machine(self): + from oeqa.utils.commands import get_bb_var + + machine = get_bb_var('MACHINE') + self.assertEqual(self.td['bbvars']['MACHINE'], machine, + msg="Layer %s modified machine %s -> %s" % \ + (self.tc.layer['name'], self.td['bbvars']['MACHINE'], machine)) + + + def test_machine_world(self): + ''' + "bitbake world" is expected to work regardless which machine is selected. + BSP layers sometimes break that by enabling a recipe for a certain machine + without checking whether that recipe actually can be built in the current + distro configuration (for example, OpenGL might not enabled). + + This test iterates over all machines. It would be nicer to instantiate + it once per machine. It merely checks for errors during parse + time. It does not actually attempt to build anything. + ''' + + if not self.td['machines']: + self.skipTest('No machines set with --machines.') + msg = [] + for machine in self.td['machines']: + # In contrast to test_machine_signatures() below, errors are fatal here. + try: + get_signatures(self.td['builddir'], failsafe=False, machine=machine) + except RuntimeError as ex: + msg.append(str(ex)) + if msg: + msg.insert(0, 'The following machines broke a world build:') + self.fail('\n'.join(msg)) + + def test_machine_signatures(self): + ''' + Selecting a machine may only affect the signature of tasks that are specific + to that machine. In other words, when MACHINE=A and MACHINE=B share a recipe + foo and the output of foo, then both machine configurations must build foo + in exactly the same way. Otherwise it is not possible to use both machines + in the same distribution. + + This criteria can only be tested by testing different machines in combination, + i.e. one main layer, potentially several additional BSP layers and an explicit + choice of machines: + yocto-compat-layer --additional-layers .../meta-intel --machines intel-corei7-64 imx6slevk -- .../meta-freescale + ''' + + if not self.td['machines']: + self.skipTest('No machines set with --machines.') + + # Collect signatures for all machines that we are testing + # and merge that into a hash: + # tune -> task -> signature -> list of machines with that combination + # + # It is an error if any tune/task pair has more than one signature, + # because that implies that the machines that caused those different + # signatures do not agree on how to execute the task. + tunes = {} + # Preserve ordering of machines as chosen by the user. + for machine in self.td['machines']: + curr_sigs, tune2tasks = get_signatures(self.td['builddir'], failsafe=True, machine=machine) + # Invert the tune -> [tasks] mapping. + tasks2tune = {} + for tune, tasks in tune2tasks.items(): + for task in tasks: + tasks2tune[task] = tune + for task, sighash in curr_sigs.items(): + tunes.setdefault(tasks2tune[task], {}).setdefault(task, {}).setdefault(sighash, []).append(machine) + + msg = [] + pruned = 0 + last_line_key = None + # do_fetch, do_unpack, ..., do_build + taskname_list = [] + if tunes: + # The output below is most useful when we start with tasks that are at + # the bottom of the dependency chain, i.e. those that run first. If + # those tasks differ, the rest also does. + # + # To get an ordering of tasks, we do a topological sort of the entire + # depgraph for the base configuration, then on-the-fly flatten that list by stripping + # out the recipe names and removing duplicates. The base configuration + # is not necessarily representative, but should be close enough. Tasks + # that were not encountered get a default priority. + depgraph = get_depgraph() + depends = depgraph['tdepends'] + WHITE = 1 + GRAY = 2 + BLACK = 3 + color = {} + found = set() + def visit(task): + color[task] = GRAY + for dep in depends.get(task, ()): + if color.setdefault(dep, WHITE) == WHITE: + visit(dep) + color[task] = BLACK + pn, taskname = task.rsplit('.', 1) + if taskname not in found: + taskname_list.append(taskname) + found.add(taskname) + for task in depends.keys(): + if color.setdefault(task, WHITE) == WHITE: + visit(task) + + taskname_order = dict([(task, index) for index, task in enumerate(taskname_list) ]) + def task_key(task): + pn, taskname = task.rsplit(':', 1) + return (pn, taskname_order.get(taskname, len(taskname_list)), taskname) + + for tune in sorted(tunes.keys()): + tasks = tunes[tune] + # As for test_signatures it would be nicer to sort tasks + # by dependencies here, but that is harder because we have + # to report on tasks from different machines, which might + # have different dependencies. We resort to pruning the + # output by reporting only one task per recipe if the set + # of machines matches. + # + # "bitbake-diffsigs -t -s" is intelligent enough to print + # diffs recursively, so often it does not matter that much + # if we don't pick the underlying difference + # here. However, sometimes recursion fails + # (https://bugzilla.yoctoproject.org/show_bug.cgi?id=6428). + # + # To mitigate that a bit, we use a hard-coded ordering of + # tasks that represents how they normally run and prefer + # to print the ones that run first. + for task in sorted(tasks.keys(), key=task_key): + signatures = tasks[task] + # do_build can be ignored: it is know to have + # different signatures in some cases, for example in + # the allarch ca-certificates due to RDEPENDS=openssl. + # That particular dependency is whitelisted via + # SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS, but still shows up + # in the sstate signature hash because filtering it + # out would be hard and running do_build multiple + # times doesn't really matter. + if len(signatures.keys()) > 1 and \ + not task.endswith(':do_build'): + # Error! + # + # Sort signatures by machines, because the hex values don't mean anything. + # => all-arch adwaita-icon-theme:do_build: 1234... (beaglebone, qemux86) != abcdf... (qemux86-64) + # + # Skip the line if it is covered already by the predecessor (same pn, same sets of machines). + pn, taskname = task.rsplit(':', 1) + next_line_key = (pn, sorted(signatures.values())) + if next_line_key != last_line_key: + line = ' %s %s: ' % (tune, task) + line += ' != '.join(['%s (%s)' % (signature, ', '.join([m for m in signatures[signature]])) for + signature in sorted(signatures.keys(), key=lambda s: signatures[s])]) + last_line_key = next_line_key + msg.append(line) + # Randomly pick two mismatched signatures and remember how to invoke + # bitbake-diffsigs for them. + iterator = iter(signatures.items()) + a = next(iterator) + b = next(iterator) + diffsig_machines = '(%s) != (%s)' % (', '.join(a[1]), ', '.join(b[1])) + diffsig_params = '-t %s %s -s %s %s' % (pn, taskname, a[0], b[0]) + else: + pruned += 1 + + if msg: + msg.insert(0, 'The machines have conflicting signatures for some shared tasks:') + if pruned > 0: + msg.append('') + msg.append('%d tasks where not listed because some other task of the recipe already differed.' % pruned) + msg.append('It is likely that differences from different recipes also have the same root cause.') + msg.append('') + # Explain how to investigate... + msg.append('To investigate, run bitbake-diffsigs -t recipename taskname -s fromsig tosig.') + cmd = 'bitbake-diffsigs %s' % diffsig_params + msg.append('Example: %s in the last line' % diffsig_machines) + msg.append('Command: %s' % cmd) + # ... and actually do it automatically for that example, but without aborting + # when that fails. + try: + output = check_command('Comparing signatures failed.', cmd).decode('utf-8') + except RuntimeError as ex: + output = str(ex) + msg.extend([' ' + line for line in output.splitlines()]) + self.fail('\n'.join(msg)) diff --git a/scripts/lib/compatlayer/cases/common.py b/scripts/lib/compatlayer/cases/common.py new file mode 100644 index 0000000000..8eeada9b1e --- /dev/null +++ b/scripts/lib/compatlayer/cases/common.py @@ -0,0 +1,91 @@ +# Copyright (C) 2017 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import os +import unittest +from compatlayer import get_signatures, LayerType, check_command, get_depgraph +from compatlayer.case import OECompatLayerTestCase + +class CommonCompatLayer(OECompatLayerTestCase): + def test_readme(self): + readme_file = os.path.join(self.tc.layer['path'], 'README') + self.assertTrue(os.path.isfile(readme_file), + msg="Layer doesn't contains README file.") + + data = '' + with open(readme_file, 'r') as f: + data = f.read() + self.assertTrue(data, + msg="Layer contains README file but is empty.") + + def test_parse(self): + check_command('Layer %s failed to parse.' % self.tc.layer['name'], + 'bitbake -p') + + def test_show_environment(self): + check_command('Layer %s failed to show environment.' % self.tc.layer['name'], + 'bitbake -e') + + def test_signatures(self): + if self.tc.layer['type'] == LayerType.SOFTWARE: + raise unittest.SkipTest("Layer %s isn't BSP or DISTRO one." \ + % self.tc.layer['name']) + + # task -> (old signature, new signature) + sig_diff = {} + curr_sigs, _ = get_signatures(self.td['builddir'], failsafe=True) + for task in self.td['sigs']: + if task in curr_sigs and \ + self.td['sigs'][task] != curr_sigs[task]: + sig_diff[task] = (self.td['sigs'][task], curr_sigs[task]) + + if sig_diff: + # Beware, depgraph uses task=<pn>.<taskname> whereas get_signatures() + # uses <pn>:<taskname>. Need to convert sometimes. The output follows + # the convention from get_signatures() because that seems closer to + # normal bitbake output. + def sig2graph(task): + pn, taskname = task.rsplit(':', 1) + return pn + '.' + taskname + def graph2sig(task): + pn, taskname = task.rsplit('.', 1) + return pn + ':' + taskname + depgraph = get_depgraph() + depends = depgraph['tdepends'] + + # If a task A has a changed signature, but none of its + # dependencies, then we need to report it because it is + # the one which introduces a change. Any task depending on + # A (directly or indirectly) will also have a changed + # signature, but we don't need to report it. It might have + # its own changes, which will become apparent once the + # issues that we do report are fixed and the test gets run + # again. + sig_diff_filtered = [] + for task, (old_sig, new_sig) in sig_diff.items(): + deps_tainted = False + for dep in depends.get(sig2graph(task), ()): + if graph2sig(dep) in sig_diff: + deps_tainted = True + break + if not deps_tainted: + sig_diff_filtered.append((task, old_sig, new_sig)) + + msg = [] + msg.append('Layer %s changed %d signatures, initial differences (first hash without, second with layer):' % + (self.tc.layer['name'], len(sig_diff))) + for diff in sorted(sig_diff_filtered): + recipe, taskname = diff[0].rsplit(':', 1) + cmd = 'bitbake-diffsigs --task %s %s --signature %s %s' % \ + (recipe, taskname, diff[1], diff[2]) + msg.append(' %s: %s -> %s' % diff) + msg.append(' %s' % cmd) + try: + output = check_command('Determining signature difference failed.', + cmd).decode('utf-8') + except RuntimeError as error: + output = str(error) + if output: + msg.extend([' ' + line for line in output.splitlines()]) + msg.append('') + self.fail('\n'.join(msg)) diff --git a/scripts/lib/compatlayer/cases/distro.py b/scripts/lib/compatlayer/cases/distro.py new file mode 100644 index 0000000000..523acc1e78 --- /dev/null +++ b/scripts/lib/compatlayer/cases/distro.py @@ -0,0 +1,26 @@ +# Copyright (C) 2017 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import unittest + +from compatlayer import LayerType +from compatlayer.case import OECompatLayerTestCase + +class DistroCompatLayer(OECompatLayerTestCase): + @classmethod + def setUpClass(self): + if self.tc.layer['type'] != LayerType.DISTRO: + raise unittest.SkipTest("DistroCompatLayer: Layer %s isn't Distro one." %\ + self.tc.layer['name']) + + def test_distro_defines_distros(self): + self.assertTrue(self.tc.layer['conf']['distros'], + "Layer is BSP but doesn't defines machines.") + + def test_distro_no_set_distros(self): + from oeqa.utils.commands import get_bb_var + + distro = get_bb_var('DISTRO') + self.assertEqual(self.td['bbvars']['DISTRO'], distro, + msg="Layer %s modified distro %s -> %s" % \ + (self.tc.layer['name'], self.td['bbvars']['DISTRO'], distro)) diff --git a/scripts/lib/compatlayer/context.py b/scripts/lib/compatlayer/context.py new file mode 100644 index 0000000000..4932238798 --- /dev/null +++ b/scripts/lib/compatlayer/context.py @@ -0,0 +1,14 @@ +# Copyright (C) 2017 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import os +import sys +import glob +import re + +from oeqa.core.context import OETestContext + +class CompatLayerTestContext(OETestContext): + def __init__(self, td=None, logger=None, layer=None): + super(CompatLayerTestContext, self).__init__(td, logger) + self.layer = layer diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py new file mode 100644 index 0000000000..d646b0cf63 --- /dev/null +++ b/scripts/lib/devtool/__init__.py @@ -0,0 +1,294 @@ +#!/usr/bin/env python3 + +# Development tool - utility functions for plugins +# +# Copyright (C) 2014 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +"""Devtool plugins module""" + +import os +import sys +import subprocess +import logging +import re +import codecs + +logger = logging.getLogger('devtool') + +class DevtoolError(Exception): + """Exception for handling devtool errors""" + def __init__(self, message, exitcode=1): + super(DevtoolError, self).__init__(message) + self.exitcode = exitcode + + +def exec_build_env_command(init_path, builddir, cmd, watch=False, **options): + """Run a program in bitbake build context""" + import bb + if not 'cwd' in options: + options["cwd"] = builddir + if init_path: + # As the OE init script makes use of BASH_SOURCE to determine OEROOT, + # and can't determine it when running under dash, we need to set + # the executable to bash to correctly set things up + if not 'executable' in options: + options['executable'] = 'bash' + logger.debug('Executing command: "%s" using init path %s' % (cmd, init_path)) + init_prefix = '. %s %s > /dev/null && ' % (init_path, builddir) + else: + logger.debug('Executing command "%s"' % cmd) + init_prefix = '' + if watch: + if sys.stdout.isatty(): + # Fool bitbake into thinking it's outputting to a terminal (because it is, indirectly) + cmd = 'script -e -q -c "%s" /dev/null' % cmd + return exec_watch('%s%s' % (init_prefix, cmd), **options) + else: + return bb.process.run('%s%s' % (init_prefix, cmd), **options) + +def exec_watch(cmd, **options): + """Run program with stdout shown on sys.stdout""" + import bb + if isinstance(cmd, str) and not "shell" in options: + options["shell"] = True + + process = subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **options + ) + + reader = codecs.getreader('utf-8')(process.stdout) + buf = '' + while True: + out = reader.read(1, 1) + if out: + sys.stdout.write(out) + sys.stdout.flush() + buf += out + elif out == '' and process.poll() != None: + break + + if process.returncode != 0: + raise bb.process.ExecutionError(cmd, process.returncode, buf, None) + + return buf, None + +def exec_fakeroot(d, cmd, **kwargs): + """Run a command under fakeroot (pseudo, in fact) so that it picks up the appropriate file permissions""" + # Grab the command and check it actually exists + fakerootcmd = d.getVar('FAKEROOTCMD') + if not os.path.exists(fakerootcmd): + logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built') + return 2 + # Set up the appropriate environment + newenv = dict(os.environ) + fakerootenv = d.getVar('FAKEROOTENV') + for varvalue in fakerootenv.split(): + if '=' in varvalue: + splitval = varvalue.split('=', 1) + newenv[splitval[0]] = splitval[1] + return subprocess.call("%s %s" % (fakerootcmd, cmd), env=newenv, **kwargs) + +def setup_tinfoil(config_only=False, basepath=None, tracking=False): + """Initialize tinfoil api from bitbake""" + import scriptpath + orig_cwd = os.path.abspath(os.curdir) + try: + if basepath: + os.chdir(basepath) + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + sys.exit(1) + + import bb.tinfoil + tinfoil = bb.tinfoil.Tinfoil(tracking=tracking) + try: + tinfoil.prepare(config_only) + tinfoil.logger.setLevel(logger.getEffectiveLevel()) + except bb.tinfoil.TinfoilUIException: + tinfoil.shutdown() + raise DevtoolError('Failed to start bitbake environment') + except: + tinfoil.shutdown() + raise + finally: + os.chdir(orig_cwd) + return tinfoil + +def parse_recipe(config, tinfoil, pn, appends, filter_workspace=True): + """Parse the specified recipe""" + try: + recipefile = tinfoil.get_recipe_file(pn) + except bb.providers.NoProvider as e: + logger.error(str(e)) + return None + if appends: + append_files = tinfoil.get_file_appends(recipefile) + if filter_workspace: + # Filter out appends from the workspace + append_files = [path for path in append_files if + not path.startswith(config.workspace_path)] + else: + append_files = None + try: + rd = tinfoil.parse_recipe_file(recipefile, appends, append_files) + except Exception as e: + logger.error(str(e)) + return None + return rd + +def check_workspace_recipe(workspace, pn, checksrc=True, bbclassextend=False): + """ + Check that a recipe is in the workspace and (optionally) that source + is present. + """ + + workspacepn = pn + + for recipe, value in workspace.items(): + if recipe == pn: + break + if bbclassextend: + recipefile = value['recipefile'] + if recipefile: + targets = get_bbclassextend_targets(recipefile, recipe) + if pn in targets: + workspacepn = recipe + break + else: + raise DevtoolError("No recipe named '%s' in your workspace" % pn) + + if checksrc: + srctree = workspace[workspacepn]['srctree'] + if not os.path.exists(srctree): + raise DevtoolError("Source tree %s for recipe %s does not exist" % (srctree, workspacepn)) + if not os.listdir(srctree): + raise DevtoolError("Source tree %s for recipe %s is empty" % (srctree, workspacepn)) + + return workspacepn + +def use_external_build(same_dir, no_same_dir, d): + """ + Determine if we should use B!=S (separate build and source directories) or not + """ + b_is_s = True + if no_same_dir: + logger.info('Using separate build directory since --no-same-dir specified') + b_is_s = False + elif same_dir: + logger.info('Using source tree as build directory since --same-dir specified') + elif bb.data.inherits_class('autotools-brokensep', d): + logger.info('Using source tree as build directory since recipe inherits autotools-brokensep') + elif d.getVar('B') == os.path.abspath(d.getVar('S')): + logger.info('Using source tree as build directory since that would be the default for this recipe') + else: + b_is_s = False + return b_is_s + +def setup_git_repo(repodir, version, devbranch, basetag='devtool-base', d=None): + """ + Set up the git repository for the source tree + """ + import bb.process + import oe.patch + if not os.path.exists(os.path.join(repodir, '.git')): + bb.process.run('git init', cwd=repodir) + bb.process.run('git add .', cwd=repodir) + commit_cmd = ['git'] + oe.patch.GitApplyTree.gitCommandUserOptions(commit_cmd, d=d) + commit_cmd += ['commit', '-q'] + stdout, _ = bb.process.run('git status --porcelain', cwd=repodir) + if not stdout: + commit_cmd.append('--allow-empty') + commitmsg = "Initial empty commit with no upstream sources" + elif version: + commitmsg = "Initial commit from upstream at version %s" % version + else: + commitmsg = "Initial commit from upstream" + commit_cmd += ['-m', commitmsg] + bb.process.run(commit_cmd, cwd=repodir) + + bb.process.run('git checkout -b %s' % devbranch, cwd=repodir) + bb.process.run('git tag -f %s' % basetag, cwd=repodir) + +def recipe_to_append(recipefile, config, wildcard=False): + """ + Convert a recipe file to a bbappend file path within the workspace. + NOTE: if the bbappend already exists, you should be using + workspace[args.recipename]['bbappend'] instead of calling this + function. + """ + appendname = os.path.splitext(os.path.basename(recipefile))[0] + if wildcard: + appendname = re.sub(r'_.*', '_%', appendname) + appendpath = os.path.join(config.workspace_path, 'appends') + appendfile = os.path.join(appendpath, appendname + '.bbappend') + return appendfile + +def get_bbclassextend_targets(recipefile, pn): + """ + Cheap function to get BBCLASSEXTEND and then convert that to the + list of targets that would result. + """ + import bb.utils + + values = {} + def get_bbclassextend_varfunc(varname, origvalue, op, newlines): + values[varname] = origvalue + return origvalue, None, 0, True + with open(recipefile, 'r') as f: + bb.utils.edit_metadata(f, ['BBCLASSEXTEND'], get_bbclassextend_varfunc) + + targets = [] + bbclassextend = values.get('BBCLASSEXTEND', '').split() + if bbclassextend: + for variant in bbclassextend: + if variant == 'nativesdk': + targets.append('%s-%s' % (variant, pn)) + elif variant in ['native', 'cross', 'crosssdk']: + targets.append('%s-%s' % (pn, variant)) + return targets + +def ensure_npm(config, basepath, fixed_setup=False, check_exists=True): + """ + Ensure that npm is available and either build it or show a + reasonable error message + """ + if check_exists: + tinfoil = setup_tinfoil(config_only=False, basepath=basepath) + try: + rd = tinfoil.parse_recipe('nodejs-native') + nativepath = rd.getVar('STAGING_BINDIR_NATIVE') + finally: + tinfoil.shutdown() + npmpath = os.path.join(nativepath, 'npm') + build_npm = not os.path.exists(npmpath) + else: + build_npm = True + + if build_npm: + logger.info('Building nodejs-native') + try: + exec_build_env_command(config.init_path, basepath, + 'bitbake -q nodejs-native -c addto_recipe_sysroot', watch=True) + except bb.process.ExecutionError as e: + if "Nothing PROVIDES 'nodejs-native'" in e.stdout: + if fixed_setup: + msg = 'nodejs-native is required for npm but is not available within this SDK' + else: + msg = 'nodejs-native is required for npm but is not available - you will likely need to add a layer that provides nodejs' + raise DevtoolError(msg) + else: + raise diff --git a/scripts/lib/devtool/build.py b/scripts/lib/devtool/build.py new file mode 100644 index 0000000000..252379e9b2 --- /dev/null +++ b/scripts/lib/devtool/build.py @@ -0,0 +1,86 @@ +# Development tool - build command plugin +# +# Copyright (C) 2014-2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +"""Devtool build plugin""" + +import os +import bb +import logging +import argparse +import tempfile +from devtool import exec_build_env_command, check_workspace_recipe, DevtoolError + +logger = logging.getLogger('devtool') + + +def _set_file_values(fn, values): + remaining = list(values.keys()) + + def varfunc(varname, origvalue, op, newlines): + newvalue = values.get(varname, origvalue) + remaining.remove(varname) + return (newvalue, '=', 0, True) + + with open(fn, 'r') as f: + (updated, newlines) = bb.utils.edit_metadata(f, values, varfunc) + + for item in remaining: + updated = True + newlines.append('%s = "%s"' % (item, values[item])) + + if updated: + with open(fn, 'w') as f: + f.writelines(newlines) + return updated + +def _get_build_tasks(config): + tasks = config.get('Build', 'build_task', 'populate_sysroot,packagedata').split(',') + return ['do_%s' % task.strip() for task in tasks] + +def build(args, config, basepath, workspace): + """Entry point for the devtool 'build' subcommand""" + workspacepn = check_workspace_recipe(workspace, args.recipename, bbclassextend=True) + + build_tasks = _get_build_tasks(config) + + bbappend = workspace[workspacepn]['bbappend'] + if args.disable_parallel_make: + logger.info("Disabling 'make' parallelism") + _set_file_values(bbappend, {'PARALLEL_MAKE': ''}) + try: + bbargs = [] + for task in build_tasks: + if args.recipename.endswith('-native') and 'package' in task: + continue + bbargs.append('%s:%s' % (args.recipename, task)) + exec_build_env_command(config.init_path, basepath, 'bitbake %s' % ' '.join(bbargs), watch=True) + except bb.process.ExecutionError as e: + # We've already seen the output since watch=True, so just ensure we return something to the user + return e.exitcode + finally: + if args.disable_parallel_make: + _set_file_values(bbappend, {'PARALLEL_MAKE': None}) + + return 0 + +def register_commands(subparsers, context): + """Register devtool subcommands from this plugin""" + parser_build = subparsers.add_parser('build', help='Build a recipe', + description='Builds the specified recipe using bitbake (up to and including %s)' % ', '.join(_get_build_tasks(context.config)), + group='working', order=50) + parser_build.add_argument('recipename', help='Recipe to build') + parser_build.add_argument('-s', '--disable-parallel-make', action="store_true", help='Disable make parallelism') + parser_build.set_defaults(func=build) diff --git a/scripts/lib/devtool/build_image.py b/scripts/lib/devtool/build_image.py new file mode 100644 index 0000000000..e5810389be --- /dev/null +++ b/scripts/lib/devtool/build_image.py @@ -0,0 +1,174 @@ +# Development tool - build-image plugin +# +# Copyright (C) 2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +"""Devtool plugin containing the build-image subcommand.""" + +import os +import errno +import logging + +from bb.process import ExecutionError +from devtool import exec_build_env_command, setup_tinfoil, parse_recipe, DevtoolError + +logger = logging.getLogger('devtool') + +class TargetNotImageError(Exception): + pass + +def _get_packages(tinfoil, workspace, config): + """Get list of packages from recipes in the workspace.""" + result = [] + for recipe in workspace: + data = parse_recipe(config, tinfoil, recipe, True) + if 'class-target' in data.getVar('OVERRIDES').split(':'): + if recipe in data.getVar('PACKAGES').split(): + result.append(recipe) + else: + logger.warning("Skipping recipe %s as it doesn't produce a " + "package with the same name", recipe) + return result + +def build_image(args, config, basepath, workspace): + """Entry point for the devtool 'build-image' subcommand.""" + + image = args.imagename + auto_image = False + if not image: + sdk_targets = config.get('SDK', 'sdk_targets', '').split() + if sdk_targets: + image = sdk_targets[0] + auto_image = True + if not image: + raise DevtoolError('Unable to determine image to build, please specify one') + + try: + if args.add_packages: + add_packages = args.add_packages.split(',') + else: + add_packages = None + result, outputdir = build_image_task(config, basepath, workspace, image, add_packages) + except TargetNotImageError: + if auto_image: + raise DevtoolError('Unable to determine image to build, please specify one') + else: + raise DevtoolError('Specified recipe %s is not an image recipe' % image) + + if result == 0: + logger.info('Successfully built %s. You can find output files in %s' + % (image, outputdir)) + return result + +def build_image_task(config, basepath, workspace, image, add_packages=None, task=None, extra_append=None): + # remove <image>.bbappend to make sure setup_tinfoil doesn't + # break because of it + target_basename = config.get('SDK', 'target_basename', '') + if target_basename: + appendfile = os.path.join(config.workspace_path, 'appends', + '%s.bbappend' % target_basename) + try: + os.unlink(appendfile) + except OSError as exc: + if exc.errno != errno.ENOENT: + raise + + tinfoil = setup_tinfoil(basepath=basepath) + try: + rd = parse_recipe(config, tinfoil, image, True) + if not rd: + # Error already shown + return (1, None) + if not bb.data.inherits_class('image', rd): + raise TargetNotImageError() + + # Get the actual filename used and strip the .bb and full path + target_basename = rd.getVar('FILE') + target_basename = os.path.splitext(os.path.basename(target_basename))[0] + config.set('SDK', 'target_basename', target_basename) + config.write() + + appendfile = os.path.join(config.workspace_path, 'appends', + '%s.bbappend' % target_basename) + + outputdir = None + try: + if workspace or add_packages: + if add_packages: + packages = add_packages + else: + packages = _get_packages(tinfoil, workspace, config) + else: + packages = None + if not task: + if not packages and not add_packages and workspace: + logger.warning('No recipes in workspace, building image %s unmodified', image) + elif not packages: + logger.warning('No packages to add, building image %s unmodified', image) + + if packages or extra_append: + bb.utils.mkdirhier(os.path.dirname(appendfile)) + with open(appendfile, 'w') as afile: + if packages: + # include packages from workspace recipes into the image + afile.write('IMAGE_INSTALL_append = " %s"\n' % ' '.join(packages)) + if not task: + logger.info('Building image %s with the following ' + 'additional packages: %s', image, ' '.join(packages)) + if extra_append: + for line in extra_append: + afile.write('%s\n' % line) + + if task in ['populate_sdk', 'populate_sdk_ext']: + outputdir = rd.getVar('SDK_DEPLOY') + else: + outputdir = rd.getVar('DEPLOY_DIR_IMAGE') + + tmp_tinfoil = tinfoil + tinfoil = None + tmp_tinfoil.shutdown() + + options = '' + if task: + options += '-c %s' % task + + # run bitbake to build image (or specified task) + try: + exec_build_env_command(config.init_path, basepath, + 'bitbake %s %s' % (options, image), watch=True) + except ExecutionError as err: + return (err.exitcode, None) + finally: + if os.path.isfile(appendfile): + os.unlink(appendfile) + finally: + if tinfoil: + tinfoil.shutdown() + return (0, outputdir) + + +def register_commands(subparsers, context): + """Register devtool subcommands from the build-image plugin""" + parser = subparsers.add_parser('build-image', + help='Build image including workspace recipe packages', + description='Builds an image, extending it to include ' + 'packages from recipes in the workspace', + group='testbuild', order=-10) + parser.add_argument('imagename', help='Image recipe to build', nargs='?') + parser.add_argument('-p', '--add-packages', help='Instead of adding packages for the ' + 'entire workspace, specify packages to be added to the image ' + '(separate multiple packages by commas)', + metavar='PACKAGES') + parser.set_defaults(func=build_image) diff --git a/scripts/lib/devtool/build_sdk.py b/scripts/lib/devtool/build_sdk.py new file mode 100644 index 0000000000..b89d65b0cb --- /dev/null +++ b/scripts/lib/devtool/build_sdk.py @@ -0,0 +1,65 @@ +# Development tool - build-sdk command plugin +# +# Copyright (C) 2015-2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import os +import subprocess +import logging +import glob +import shutil +import errno +import sys +import tempfile +from devtool import exec_build_env_command, setup_tinfoil, parse_recipe, DevtoolError +from devtool import build_image + +logger = logging.getLogger('devtool') + + +def build_sdk(args, config, basepath, workspace): + """Entry point for the devtool build-sdk command""" + + sdk_targets = config.get('SDK', 'sdk_targets', '').split() + if sdk_targets: + image = sdk_targets[0] + else: + raise DevtoolError('Unable to determine image to build SDK for') + + extra_append = ['SDK_DERIVATIVE = "1"'] + try: + result, outputdir = build_image.build_image_task(config, + basepath, + workspace, + image, + task='populate_sdk_ext', + extra_append=extra_append) + except build_image.TargetNotImageError: + raise DevtoolError('Unable to determine image to build SDK for') + + if result == 0: + logger.info('Successfully built SDK. You can find output files in %s' + % outputdir) + return result + + +def register_commands(subparsers, context): + """Register devtool subcommands""" + if context.fixed_setup: + parser_build_sdk = subparsers.add_parser('build-sdk', + help='Build a derivative SDK of this one', + description='Builds an extensible SDK based upon this one and the items in your workspace', + group='advanced') + parser_build_sdk.set_defaults(func=build_sdk) diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py new file mode 100644 index 0000000000..b3730ae833 --- /dev/null +++ b/scripts/lib/devtool/deploy.py @@ -0,0 +1,325 @@ +# Development tool - deploy/undeploy command plugin +# +# Copyright (C) 2014-2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +"""Devtool plugin containing the deploy subcommands""" + +import os +import subprocess +import logging +import tempfile +import shutil +import argparse_oe +from devtool import exec_fakeroot, setup_tinfoil, check_workspace_recipe, DevtoolError + +logger = logging.getLogger('devtool') + +deploylist_path = '/.devtool' + +def _prepare_remote_script(deploy, verbose=False, dryrun=False, undeployall=False, nopreserve=False, nocheckspace=False): + """ + Prepare a shell script for running on the target to + deploy/undeploy files. We have to be careful what we put in this + script - only commands that are likely to be available on the + target are suitable (the target might be constrained, e.g. using + busybox rather than bash with coreutils). + """ + lines = [] + lines.append('#!/bin/sh') + lines.append('set -e') + if undeployall: + # Yes, I know this is crude - but it does work + lines.append('for entry in %s/*.list; do' % deploylist_path) + lines.append('[ ! -f $entry ] && exit') + lines.append('set `basename $entry | sed "s/.list//"`') + if dryrun: + if not deploy: + lines.append('echo "Previously deployed files for $1:"') + lines.append('manifest="%s/$1.list"' % deploylist_path) + lines.append('preservedir="%s/$1.preserve"' % deploylist_path) + lines.append('if [ -f $manifest ] ; then') + # Read manifest in reverse and delete files / remove empty dirs + lines.append(' sed \'1!G;h;$!d\' $manifest | while read file') + lines.append(' do') + if dryrun: + lines.append(' if [ ! -d $file ] ; then') + lines.append(' echo $file') + lines.append(' fi') + else: + lines.append(' if [ -d $file ] ; then') + # Avoid deleting a preserved directory in case it has special perms + lines.append(' if [ ! -d $preservedir/$file ] ; then') + lines.append(' rmdir $file > /dev/null 2>&1 || true') + lines.append(' fi') + lines.append(' else') + lines.append(' rm $file') + lines.append(' fi') + lines.append(' done') + if not dryrun: + lines.append(' rm $manifest') + if not deploy and not dryrun: + # May as well remove all traces + lines.append(' rmdir `dirname $manifest` > /dev/null 2>&1 || true') + lines.append('fi') + + if deploy: + if not nocheckspace: + # Check for available space + # FIXME This doesn't take into account files spread across multiple + # partitions, but doing that is non-trivial + # Find the part of the destination path that exists + lines.append('checkpath="$2"') + lines.append('while [ "$checkpath" != "/" ] && [ ! -e $checkpath ]') + lines.append('do') + lines.append(' checkpath=`dirname "$checkpath"`') + lines.append('done') + lines.append(r'freespace=$(df -P $checkpath | sed -nre "s/^(\S+\s+){3}([0-9]+).*/\2/p")') + # First line of the file is the total space + lines.append('total=`head -n1 $3`') + lines.append('if [ $total -gt $freespace ] ; then') + lines.append(' echo "ERROR: insufficient space on target (available ${freespace}, needed ${total})"') + lines.append(' exit 1') + lines.append('fi') + if not nopreserve: + # Preserve any files that exist. Note that this will add to the + # preserved list with successive deployments if the list of files + # deployed changes, but because we've deleted any previously + # deployed files at this point it will never preserve anything + # that was deployed, only files that existed prior to any deploying + # (which makes the most sense) + lines.append('cat $3 | sed "1d" | while read file fsize') + lines.append('do') + lines.append(' if [ -e $file ] ; then') + lines.append(' dest="$preservedir/$file"') + lines.append(' mkdir -p `dirname $dest`') + lines.append(' mv $file $dest') + lines.append(' fi') + lines.append('done') + lines.append('rm $3') + lines.append('mkdir -p `dirname $manifest`') + lines.append('mkdir -p $2') + if verbose: + lines.append(' tar xv -C $2 -f - | tee $manifest') + else: + lines.append(' tar xv -C $2 -f - > $manifest') + lines.append('sed -i "s!^./!$2!" $manifest') + elif not dryrun: + # Put any preserved files back + lines.append('if [ -d $preservedir ] ; then') + lines.append(' cd $preservedir') + lines.append(' find . -type f -exec mv {} /{} \;') + lines.append(' cd /') + lines.append(' rm -rf $preservedir') + lines.append('fi') + + if undeployall: + if not dryrun: + lines.append('echo "NOTE: Successfully undeployed $1"') + lines.append('done') + + # Delete the script itself + lines.append('rm $0') + lines.append('') + + return '\n'.join(lines) + + +def deploy(args, config, basepath, workspace): + """Entry point for the devtool 'deploy' subcommand""" + import re + import math + import oe.recipeutils + + check_workspace_recipe(workspace, args.recipename, checksrc=False) + + try: + host, destdir = args.target.split(':') + except ValueError: + destdir = '/' + else: + args.target = host + if not destdir.endswith('/'): + destdir += '/' + + tinfoil = setup_tinfoil(basepath=basepath) + try: + try: + rd = tinfoil.parse_recipe(args.recipename) + except Exception as e: + raise DevtoolError('Exception parsing recipe %s: %s' % + (args.recipename, e)) + recipe_outdir = rd.getVar('D') + if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir): + raise DevtoolError('No files to deploy - have you built the %s ' + 'recipe? If so, the install step has not installed ' + 'any files.' % args.recipename) + + filelist = [] + ftotalsize = 0 + for root, _, files in os.walk(recipe_outdir): + for fn in files: + # Get the size in kiB (since we'll be comparing it to the output of du -k) + # MUST use lstat() here not stat() or getfilesize() since we don't want to + # dereference symlinks + fsize = int(math.ceil(float(os.lstat(os.path.join(root, fn)).st_size)/1024)) + ftotalsize += fsize + # The path as it would appear on the target + fpath = os.path.join(destdir, os.path.relpath(root, recipe_outdir), fn) + filelist.append((fpath, fsize)) + + if args.dry_run: + print('Files to be deployed for %s on target %s:' % (args.recipename, args.target)) + for item, _ in filelist: + print(' %s' % item) + return 0 + + + extraoptions = '' + if args.no_host_check: + extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + if not args.show_status: + extraoptions += ' -q' + + scp_port = '' + ssh_port = '' + if not args.port: + raise DevtoolError("If you specify -P/--port then you must provide the port to be used to connect to the target") + else: + scp_port = "-P %s" % args.port + ssh_port = "-p %s" % args.port + + # In order to delete previously deployed files and have the manifest file on + # the target, we write out a shell script and then copy it to the target + # so we can then run it (piping tar output to it). + # (We cannot use scp here, because it doesn't preserve symlinks.) + tmpdir = tempfile.mkdtemp(prefix='devtool') + try: + tmpscript = '/tmp/devtool_deploy.sh' + tmpfilelist = os.path.join(os.path.dirname(tmpscript), 'devtool_deploy.list') + shellscript = _prepare_remote_script(deploy=True, + verbose=args.show_status, + nopreserve=args.no_preserve, + nocheckspace=args.no_check_space) + # Write out the script to a file + with open(os.path.join(tmpdir, os.path.basename(tmpscript)), 'w') as f: + f.write(shellscript) + # Write out the file list + with open(os.path.join(tmpdir, os.path.basename(tmpfilelist)), 'w') as f: + f.write('%d\n' % ftotalsize) + for fpath, fsize in filelist: + f.write('%s %d\n' % (fpath, fsize)) + # Copy them to the target + ret = subprocess.call("scp %s %s %s/* %s:%s" % (scp_port, extraoptions, tmpdir, args.target, os.path.dirname(tmpscript)), shell=True) + if ret != 0: + raise DevtoolError('Failed to copy script to %s - rerun with -s to ' + 'get a complete error message' % args.target) + finally: + shutil.rmtree(tmpdir) + + # Now run the script + ret = exec_fakeroot(rd, 'tar cf - . | ssh %s %s %s \'sh %s %s %s %s\'' % (ssh_port, extraoptions, args.target, tmpscript, args.recipename, destdir, tmpfilelist), cwd=recipe_outdir, shell=True) + if ret != 0: + raise DevtoolError('Deploy failed - rerun with -s to get a complete ' + 'error message') + + logger.info('Successfully deployed %s' % recipe_outdir) + + files_list = [] + for root, _, files in os.walk(recipe_outdir): + for filename in files: + filename = os.path.relpath(os.path.join(root, filename), recipe_outdir) + files_list.append(os.path.join(destdir, filename)) + finally: + tinfoil.shutdown() + + return 0 + +def undeploy(args, config, basepath, workspace): + """Entry point for the devtool 'undeploy' subcommand""" + if args.all and args.recipename: + raise argparse_oe.ArgumentUsageError('Cannot specify -a/--all with a recipe name', 'undeploy-target') + elif not args.recipename and not args.all: + raise argparse_oe.ArgumentUsageError('If you don\'t specify a recipe, you must specify -a/--all', 'undeploy-target') + + extraoptions = '' + if args.no_host_check: + extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + if not args.show_status: + extraoptions += ' -q' + + scp_port = '' + ssh_port = '' + if not args.port: + raise DevtoolError("If you specify -P/--port then you must provide the port to be used to connect to the target") + else: + scp_port = "-P %s" % args.port + ssh_port = "-p %s" % args.port + + args.target = args.target.split(':')[0] + + tmpdir = tempfile.mkdtemp(prefix='devtool') + try: + tmpscript = '/tmp/devtool_undeploy.sh' + shellscript = _prepare_remote_script(deploy=False, dryrun=args.dry_run, undeployall=args.all) + # Write out the script to a file + with open(os.path.join(tmpdir, os.path.basename(tmpscript)), 'w') as f: + f.write(shellscript) + # Copy it to the target + ret = subprocess.call("scp %s %s %s/* %s:%s" % (scp_port, extraoptions, tmpdir, args.target, os.path.dirname(tmpscript)), shell=True) + if ret != 0: + raise DevtoolError('Failed to copy script to %s - rerun with -s to ' + 'get a complete error message' % args.target) + finally: + shutil.rmtree(tmpdir) + + # Now run the script + ret = subprocess.call('ssh %s %s %s \'sh %s %s\'' % (ssh_port, extraoptions, args.target, tmpscript, args.recipename), shell=True) + if ret != 0: + raise DevtoolError('Undeploy failed - rerun with -s to get a complete ' + 'error message') + + if not args.all and not args.dry_run: + logger.info('Successfully undeployed %s' % args.recipename) + return 0 + + +def register_commands(subparsers, context): + """Register devtool subcommands from the deploy plugin""" + parser_deploy = subparsers.add_parser('deploy-target', + help='Deploy recipe output files to live target machine', + description='Deploys a recipe\'s build output (i.e. the output of the do_install task) to a live target machine over ssh. By default, any existing files will be preserved instead of being overwritten and will be restored if you run devtool undeploy-target. Note: this only deploys the recipe itself and not any runtime dependencies, so it is assumed that those have been installed on the target beforehand.', + group='testbuild') + parser_deploy.add_argument('recipename', help='Recipe to deploy') + parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]') + parser_deploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') + parser_deploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true') + parser_deploy.add_argument('-n', '--dry-run', help='List files to be deployed only', action='store_true') + parser_deploy.add_argument('-p', '--no-preserve', help='Do not preserve existing files', action='store_true') + parser_deploy.add_argument('--no-check-space', help='Do not check for available space before deploying', action='store_true') + parser_deploy.add_argument('-P', '--port', default='22', help='Port to use for connection to the target') + parser_deploy.set_defaults(func=deploy) + + parser_undeploy = subparsers.add_parser('undeploy-target', + help='Undeploy recipe output files in live target machine', + description='Un-deploys recipe output files previously deployed to a live target machine by devtool deploy-target.', + group='testbuild') + parser_undeploy.add_argument('recipename', help='Recipe to undeploy (if not using -a/--all)', nargs='?') + parser_undeploy.add_argument('target', help='Live target machine running an ssh server: user@hostname') + parser_undeploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') + parser_undeploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true') + parser_undeploy.add_argument('-a', '--all', help='Undeploy all recipes deployed on the target', action='store_true') + parser_undeploy.add_argument('-n', '--dry-run', help='List files to be undeployed only', action='store_true') + parser_undeploy.add_argument('-P', '--port', default='22', help='Port to use for connection to the target') + parser_undeploy.set_defaults(func=undeploy) diff --git a/scripts/lib/devtool/package.py b/scripts/lib/devtool/package.py new file mode 100644 index 0000000000..af9e8f15f5 --- /dev/null +++ b/scripts/lib/devtool/package.py @@ -0,0 +1,60 @@ +# Development tool - package command plugin +# +# Copyright (C) 2014-2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +"""Devtool plugin containing the package subcommands""" + +import os +import subprocess +import logging +from bb.process import ExecutionError +from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError + +logger = logging.getLogger('devtool') + +def package(args, config, basepath, workspace): + """Entry point for the devtool 'package' subcommand""" + check_workspace_recipe(workspace, args.recipename) + + tinfoil = setup_tinfoil(basepath=basepath, config_only=True) + try: + image_pkgtype = config.get('Package', 'image_pkgtype', '') + if not image_pkgtype: + image_pkgtype = tinfoil.config_data.getVar('IMAGE_PKGTYPE') + + deploy_dir_pkg = tinfoil.config_data.getVar('DEPLOY_DIR_%s' % image_pkgtype.upper()) + finally: + tinfoil.shutdown() + + package_task = config.get('Package', 'package_task', 'package_write_%s' % image_pkgtype) + try: + exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (package_task, args.recipename), watch=True) + except bb.process.ExecutionError as e: + # We've already seen the output since watch=True, so just ensure we return something to the user + return e.exitcode + + logger.info('Your packages are in %s' % deploy_dir_pkg) + + return 0 + +def register_commands(subparsers, context): + """Register devtool subcommands from the package plugin""" + if context.fixed_setup: + parser_package = subparsers.add_parser('package', + help='Build packages for a recipe', + description='Builds packages for a recipe\'s output files', + group='testbuild', order=-5) + parser_package.add_argument('recipename', help='Recipe to package') + parser_package.set_defaults(func=package) diff --git a/scripts/lib/devtool/runqemu.py b/scripts/lib/devtool/runqemu.py new file mode 100644 index 0000000000..e26cf28c2f --- /dev/null +++ b/scripts/lib/devtool/runqemu.py @@ -0,0 +1,74 @@ +# Development tool - runqemu command plugin +# +# Copyright (C) 2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +"""Devtool runqemu plugin""" + +import os +import bb +import logging +import argparse +import glob +from devtool import exec_build_env_command, setup_tinfoil, DevtoolError + +logger = logging.getLogger('devtool') + +def runqemu(args, config, basepath, workspace): + """Entry point for the devtool 'runqemu' subcommand""" + + tinfoil = setup_tinfoil(config_only=True, basepath=basepath) + try: + machine = tinfoil.config_data.getVar('MACHINE') + bindir_native = os.path.join(tinfoil.config_data.getVar('STAGING_DIR'), + tinfoil.config_data.getVar('BUILD_ARCH'), + tinfoil.config_data.getVar('bindir_native').lstrip(os.path.sep)) + finally: + tinfoil.shutdown() + + if not glob.glob(os.path.join(bindir_native, 'qemu-system-*')): + raise DevtoolError('QEMU is not available within this SDK') + + imagename = args.imagename + if not imagename: + sdk_targets = config.get('SDK', 'sdk_targets', '').split() + if sdk_targets: + imagename = sdk_targets[0] + if not imagename: + raise DevtoolError('Unable to determine image name to run, please specify one') + + try: + # FIXME runqemu assumes that if OECORE_NATIVE_SYSROOT is set then it shouldn't + # run bitbake to find out the values of various environment variables, which + # isn't the case for the extensible SDK. Work around it for now. + newenv = dict(os.environ) + newenv.pop('OECORE_NATIVE_SYSROOT', '') + exec_build_env_command(config.init_path, basepath, 'runqemu %s %s %s' % (machine, imagename, " ".join(args.args)), watch=True, env=newenv) + except bb.process.ExecutionError as e: + # We've already seen the output since watch=True, so just ensure we return something to the user + return e.exitcode + + return 0 + +def register_commands(subparsers, context): + """Register devtool subcommands from this plugin""" + if context.fixed_setup: + parser_runqemu = subparsers.add_parser('runqemu', help='Run QEMU on the specified image', + description='Runs QEMU to boot the specified image', + group='testbuild', order=-20) + parser_runqemu.add_argument('imagename', help='Name of built image to boot within QEMU', nargs='?') + parser_runqemu.add_argument('args', help='Any remaining arguments are passed to the runqemu script (pass --help after imagename to see what these are)', + nargs=argparse.REMAINDER) + parser_runqemu.set_defaults(func=runqemu) diff --git a/scripts/lib/devtool/sdk.py b/scripts/lib/devtool/sdk.py new file mode 100644 index 0000000000..e8bf0ad98c --- /dev/null +++ b/scripts/lib/devtool/sdk.py @@ -0,0 +1,336 @@ +# Development tool - sdk-update command plugin +# +# Copyright (C) 2015-2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import os +import subprocess +import logging +import glob +import shutil +import errno +import sys +import tempfile +import re +from devtool import exec_build_env_command, setup_tinfoil, parse_recipe, DevtoolError + +logger = logging.getLogger('devtool') + +def parse_locked_sigs(sigfile_path): + """Return <pn:task>:<hash> dictionary""" + sig_dict = {} + with open(sigfile_path) as f: + lines = f.readlines() + for line in lines: + if ':' in line: + taskkey, _, hashval = line.rpartition(':') + sig_dict[taskkey.strip()] = hashval.split()[0] + return sig_dict + +def generate_update_dict(sigfile_new, sigfile_old): + """Return a dict containing <pn:task>:<hash> which indicates what need to be updated""" + update_dict = {} + sigdict_new = parse_locked_sigs(sigfile_new) + sigdict_old = parse_locked_sigs(sigfile_old) + for k in sigdict_new: + if k not in sigdict_old: + update_dict[k] = sigdict_new[k] + continue + if sigdict_new[k] != sigdict_old[k]: + update_dict[k] = sigdict_new[k] + continue + return update_dict + +def get_sstate_objects(update_dict, sstate_dir): + """Return a list containing sstate objects which are to be installed""" + sstate_objects = [] + for k in update_dict: + files = set() + hashval = update_dict[k] + p = sstate_dir + '/' + hashval[:2] + '/*' + hashval + '*.tgz' + files |= set(glob.glob(p)) + p = sstate_dir + '/*/' + hashval[:2] + '/*' + hashval + '*.tgz' + files |= set(glob.glob(p)) + files = list(files) + if len(files) == 1: + sstate_objects.extend(files) + elif len(files) > 1: + logger.error("More than one matching sstate object found for %s" % hashval) + + return sstate_objects + +def mkdir(d): + try: + os.makedirs(d) + except OSError as e: + if e.errno != errno.EEXIST: + raise e + +def install_sstate_objects(sstate_objects, src_sdk, dest_sdk): + """Install sstate objects into destination SDK""" + sstate_dir = os.path.join(dest_sdk, 'sstate-cache') + if not os.path.exists(sstate_dir): + logger.error("Missing sstate-cache directory in %s, it might not be an extensible SDK." % dest_sdk) + raise + for sb in sstate_objects: + dst = sb.replace(src_sdk, dest_sdk) + destdir = os.path.dirname(dst) + mkdir(destdir) + logger.debug("Copying %s to %s" % (sb, dst)) + shutil.copy(sb, dst) + +def check_manifest(fn, basepath): + import bb.utils + changedfiles = [] + with open(fn, 'r') as f: + for line in f: + splitline = line.split() + if len(splitline) > 1: + chksum = splitline[0] + fpath = splitline[1] + curr_chksum = bb.utils.sha256_file(os.path.join(basepath, fpath)) + if chksum != curr_chksum: + logger.debug('File %s changed: old csum = %s, new = %s' % (os.path.join(basepath, fpath), curr_chksum, chksum)) + changedfiles.append(fpath) + return changedfiles + +def sdk_update(args, config, basepath, workspace): + """Entry point for devtool sdk-update command""" + updateserver = args.updateserver + if not updateserver: + updateserver = config.get('SDK', 'updateserver', '') + logger.debug("updateserver: %s" % updateserver) + + # Make sure we are using sdk-update from within SDK + logger.debug("basepath = %s" % basepath) + old_locked_sig_file_path = os.path.join(basepath, 'conf/locked-sigs.inc') + if not os.path.exists(old_locked_sig_file_path): + logger.error("Not using devtool's sdk-update command from within an extensible SDK. Please specify correct basepath via --basepath option") + return -1 + else: + logger.debug("Found conf/locked-sigs.inc in %s" % basepath) + + if not '://' in updateserver: + logger.error("Update server must be a URL") + return -1 + + layers_dir = os.path.join(basepath, 'layers') + conf_dir = os.path.join(basepath, 'conf') + + # Grab variable values + tinfoil = setup_tinfoil(config_only=True, basepath=basepath) + try: + stamps_dir = tinfoil.config_data.getVar('STAMPS_DIR') + sstate_mirrors = tinfoil.config_data.getVar('SSTATE_MIRRORS') + site_conf_version = tinfoil.config_data.getVar('SITE_CONF_VERSION') + finally: + tinfoil.shutdown() + + tmpsdk_dir = tempfile.mkdtemp() + try: + os.makedirs(os.path.join(tmpsdk_dir, 'conf')) + new_locked_sig_file_path = os.path.join(tmpsdk_dir, 'conf', 'locked-sigs.inc') + # Fetch manifest from server + tmpmanifest = os.path.join(tmpsdk_dir, 'conf', 'sdk-conf-manifest') + ret = subprocess.call("wget -q -O %s %s/conf/sdk-conf-manifest" % (tmpmanifest, updateserver), shell=True) + changedfiles = check_manifest(tmpmanifest, basepath) + if not changedfiles: + logger.info("Already up-to-date") + return 0 + # Update metadata + logger.debug("Updating metadata via git ...") + #Check for the status before doing a fetch and reset + if os.path.exists(os.path.join(basepath, 'layers/.git')): + out = subprocess.check_output("git status --porcelain", shell=True, cwd=layers_dir) + if not out: + ret = subprocess.call("git fetch --all; git reset --hard", shell=True, cwd=layers_dir) + else: + logger.error("Failed to update metadata as there have been changes made to it. Aborting."); + logger.error("Changed files:\n%s" % out); + return -1 + else: + ret = -1 + if ret != 0: + ret = subprocess.call("git clone %s/layers/.git" % updateserver, shell=True, cwd=tmpsdk_dir) + if ret != 0: + logger.error("Updating metadata via git failed") + return ret + logger.debug("Updating conf files ...") + for changedfile in changedfiles: + ret = subprocess.call("wget -q -O %s %s/%s" % (changedfile, updateserver, changedfile), shell=True, cwd=tmpsdk_dir) + if ret != 0: + logger.error("Updating %s failed" % changedfile) + return ret + + # Check if UNINATIVE_CHECKSUM changed + uninative = False + if 'conf/local.conf' in changedfiles: + def read_uninative_checksums(fn): + chksumitems = [] + with open(fn, 'r') as f: + for line in f: + if line.startswith('UNINATIVE_CHECKSUM'): + splitline = re.split(r'[\[\]"\']', line) + if len(splitline) > 3: + chksumitems.append((splitline[1], splitline[3])) + return chksumitems + + oldsums = read_uninative_checksums(os.path.join(basepath, 'conf/local.conf')) + newsums = read_uninative_checksums(os.path.join(tmpsdk_dir, 'conf/local.conf')) + if oldsums != newsums: + uninative = True + for buildarch, chksum in newsums: + uninative_file = os.path.join('downloads', 'uninative', chksum, '%s-nativesdk-libc.tar.bz2' % buildarch) + mkdir(os.path.join(tmpsdk_dir, os.path.dirname(uninative_file))) + ret = subprocess.call("wget -q -O %s %s/%s" % (uninative_file, updateserver, uninative_file), shell=True, cwd=tmpsdk_dir) + + # Ok, all is well at this point - move everything over + tmplayers_dir = os.path.join(tmpsdk_dir, 'layers') + if os.path.exists(tmplayers_dir): + shutil.rmtree(layers_dir) + shutil.move(tmplayers_dir, layers_dir) + for changedfile in changedfiles: + destfile = os.path.join(basepath, changedfile) + os.remove(destfile) + shutil.move(os.path.join(tmpsdk_dir, changedfile), destfile) + os.remove(os.path.join(conf_dir, 'sdk-conf-manifest')) + shutil.move(tmpmanifest, conf_dir) + if uninative: + shutil.rmtree(os.path.join(basepath, 'downloads', 'uninative')) + shutil.move(os.path.join(tmpsdk_dir, 'downloads', 'uninative'), os.path.join(basepath, 'downloads')) + + if not sstate_mirrors: + with open(os.path.join(conf_dir, 'site.conf'), 'a') as f: + f.write('SCONF_VERSION = "%s"\n' % site_conf_version) + f.write('SSTATE_MIRRORS_append = " file://.* %s/sstate-cache/PATH \\n "\n' % updateserver) + finally: + shutil.rmtree(tmpsdk_dir) + + if not args.skip_prepare: + # Find all potentially updateable tasks + sdk_update_targets = [] + tasks = ['do_populate_sysroot', 'do_packagedata'] + for root, _, files in os.walk(stamps_dir): + for fn in files: + if not '.sigdata.' in fn: + for task in tasks: + if '.%s.' % task in fn or '.%s_setscene.' % task in fn: + sdk_update_targets.append('%s:%s' % (os.path.basename(root), task)) + # Run bitbake command for the whole SDK + logger.info("Preparing build system... (This may take some time.)") + try: + exec_build_env_command(config.init_path, basepath, 'bitbake --setscene-only %s' % ' '.join(sdk_update_targets), stderr=subprocess.STDOUT) + output, _ = exec_build_env_command(config.init_path, basepath, 'bitbake -n %s' % ' '.join(sdk_update_targets), stderr=subprocess.STDOUT) + runlines = [] + for line in output.splitlines(): + if 'Running task ' in line: + runlines.append(line) + if runlines: + logger.error('Unexecuted tasks found in preparation log:\n %s' % '\n '.join(runlines)) + return -1 + except bb.process.ExecutionError as e: + logger.error('Preparation failed:\n%s' % e.stdout) + return -1 + return 0 + +def sdk_install(args, config, basepath, workspace): + """Entry point for the devtool sdk-install command""" + + import oe.recipeutils + import bb.process + + for recipe in args.recipename: + if recipe in workspace: + raise DevtoolError('recipe %s is a recipe in your workspace' % recipe) + + tasks = ['do_populate_sysroot', 'do_packagedata'] + stampprefixes = {} + def checkstamp(recipe): + stampprefix = stampprefixes[recipe] + stamps = glob.glob(stampprefix + '*') + for stamp in stamps: + if '.sigdata.' not in stamp and stamp.startswith((stampprefix + '.', stampprefix + '_setscene.')): + return True + else: + return False + + install_recipes = [] + tinfoil = setup_tinfoil(config_only=False, basepath=basepath) + try: + for recipe in args.recipename: + rd = parse_recipe(config, tinfoil, recipe, True) + if not rd: + return 1 + stampprefixes[recipe] = '%s.%s' % (rd.getVar('STAMP'), tasks[0]) + if checkstamp(recipe): + logger.info('%s is already installed' % recipe) + else: + install_recipes.append(recipe) + finally: + tinfoil.shutdown() + + if install_recipes: + logger.info('Installing %s...' % ', '.join(install_recipes)) + install_tasks = [] + for recipe in install_recipes: + for task in tasks: + if recipe.endswith('-native') and 'package' in task: + continue + install_tasks.append('%s:%s' % (recipe, task)) + options = '' + if not args.allow_build: + options += ' --setscene-only' + try: + exec_build_env_command(config.init_path, basepath, 'bitbake %s %s' % (options, ' '.join(install_tasks)), watch=True) + except bb.process.ExecutionError as e: + raise DevtoolError('Failed to install %s:\n%s' % (recipe, str(e))) + failed = False + for recipe in install_recipes: + if checkstamp(recipe): + logger.info('Successfully installed %s' % recipe) + else: + raise DevtoolError('Failed to install %s - unavailable' % recipe) + failed = True + if failed: + return 2 + + try: + exec_build_env_command(config.init_path, basepath, 'bitbake build-sysroots', watch=True) + except bb.process.ExecutionError as e: + raise DevtoolError('Failed to bitbake build-sysroots:\n%s' % (str(e))) + + +def register_commands(subparsers, context): + """Register devtool subcommands from the sdk plugin""" + if context.fixed_setup: + parser_sdk = subparsers.add_parser('sdk-update', + help='Update SDK components', + description='Updates installed SDK components from a remote server', + group='sdk') + updateserver = context.config.get('SDK', 'updateserver', '') + if updateserver: + parser_sdk.add_argument('updateserver', help='The update server to fetch latest SDK components from (default %s)' % updateserver, nargs='?') + else: + parser_sdk.add_argument('updateserver', help='The update server to fetch latest SDK components from') + parser_sdk.add_argument('--skip-prepare', action="store_true", help='Skip re-preparing the build system after updating (for debugging only)') + parser_sdk.set_defaults(func=sdk_update) + + parser_sdk_install = subparsers.add_parser('sdk-install', + help='Install additional SDK components', + description='Installs additional recipe development files into the SDK. (You can use "devtool search" to find available recipes.)', + group='sdk') + parser_sdk_install.add_argument('recipename', help='Name of the recipe to install the development artifacts for', nargs='+') + parser_sdk_install.add_argument('-s', '--allow-build', help='Allow building requested item(s) from source', action='store_true') + parser_sdk_install.set_defaults(func=sdk_install) diff --git a/scripts/lib/devtool/search.py b/scripts/lib/devtool/search.py new file mode 100644 index 0000000000..054985b85d --- /dev/null +++ b/scripts/lib/devtool/search.py @@ -0,0 +1,88 @@ +# Development tool - search command plugin +# +# Copyright (C) 2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +"""Devtool search plugin""" + +import os +import bb +import logging +import argparse +import re +from devtool import setup_tinfoil, parse_recipe, DevtoolError + +logger = logging.getLogger('devtool') + +def search(args, config, basepath, workspace): + """Entry point for the devtool 'search' subcommand""" + + tinfoil = setup_tinfoil(config_only=False, basepath=basepath) + try: + pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR') + defsummary = tinfoil.config_data.getVar('SUMMARY', False) or '' + + keyword_rc = re.compile(args.keyword) + + for fn in os.listdir(pkgdata_dir): + pfn = os.path.join(pkgdata_dir, fn) + if not os.path.isfile(pfn): + continue + + packages = [] + match = False + if keyword_rc.search(fn): + match = True + + if not match: + with open(pfn, 'r') as f: + for line in f: + if line.startswith('PACKAGES:'): + packages = line.split(':', 1)[1].strip().split() + + for pkg in packages: + if keyword_rc.search(pkg): + match = True + break + if os.path.exists(os.path.join(pkgdata_dir, 'runtime', pkg + '.packaged')): + with open(os.path.join(pkgdata_dir, 'runtime', pkg), 'r') as f: + for line in f: + if ': ' in line: + splitline = line.split(':', 1) + key = splitline[0] + value = splitline[1].strip() + if key in ['PKG_%s' % pkg, 'DESCRIPTION', 'FILES_INFO'] or key.startswith('FILERPROVIDES_'): + if keyword_rc.search(value): + match = True + break + + if match: + rd = parse_recipe(config, tinfoil, fn, True) + summary = rd.getVar('SUMMARY') + if summary == rd.expand(defsummary): + summary = '' + print("%s %s" % (fn.ljust(20), summary)) + finally: + tinfoil.shutdown() + + return 0 + +def register_commands(subparsers, context): + """Register devtool subcommands from this plugin""" + parser_search = subparsers.add_parser('search', help='Search available recipes', + description='Searches for available target recipes. Matches on recipe name, package name, description and installed files, and prints the recipe name on match.', + group='info') + parser_search.add_argument('keyword', help='Keyword to search for (regular expression syntax allowed)') + parser_search.set_defaults(func=search, no_workspace=True) diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py new file mode 100644 index 0000000000..5ff1e230fd --- /dev/null +++ b/scripts/lib/devtool/standard.py @@ -0,0 +1,1918 @@ +# Development tool - standard commands plugin +# +# Copyright (C) 2014-2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +"""Devtool standard plugins""" + +import os +import sys +import re +import shutil +import subprocess +import tempfile +import logging +import argparse +import argparse_oe +import scriptutils +import errno +import glob +import filecmp +from collections import OrderedDict +from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, ensure_npm, DevtoolError +from devtool import parse_recipe + +logger = logging.getLogger('devtool') + + +def add(args, config, basepath, workspace): + """Entry point for the devtool 'add' subcommand""" + import bb + import oe.recipeutils + + if not args.recipename and not args.srctree and not args.fetch and not args.fetchuri: + raise argparse_oe.ArgumentUsageError('At least one of recipename, srctree, fetchuri or -f/--fetch must be specified', 'add') + + # These are positional arguments, but because we're nice, allow + # specifying e.g. source tree without name, or fetch URI without name or + # source tree (if we can detect that that is what the user meant) + if scriptutils.is_src_url(args.recipename): + if not args.fetchuri: + if args.fetch: + raise DevtoolError('URI specified as positional argument as well as -f/--fetch') + args.fetchuri = args.recipename + args.recipename = '' + elif scriptutils.is_src_url(args.srctree): + if not args.fetchuri: + if args.fetch: + raise DevtoolError('URI specified as positional argument as well as -f/--fetch') + args.fetchuri = args.srctree + args.srctree = '' + elif args.recipename and not args.srctree: + if os.sep in args.recipename: + args.srctree = args.recipename + args.recipename = None + elif os.path.isdir(args.recipename): + logger.warn('Ambiguous argument "%s" - assuming you mean it to be the recipe name' % args.recipename) + + if args.srctree and os.path.isfile(args.srctree): + args.fetchuri = 'file://' + os.path.abspath(args.srctree) + args.srctree = '' + + if args.fetch: + if args.fetchuri: + raise DevtoolError('URI specified as positional argument as well as -f/--fetch') + else: + logger.warn('-f/--fetch option is deprecated - you can now simply specify the URL to fetch as a positional argument instead') + args.fetchuri = args.fetch + + if args.recipename: + if args.recipename in workspace: + raise DevtoolError("recipe %s is already in your workspace" % + args.recipename) + reason = oe.recipeutils.validate_pn(args.recipename) + if reason: + raise DevtoolError(reason) + + if args.srctree: + srctree = os.path.abspath(args.srctree) + srctreeparent = None + tmpsrcdir = None + else: + srctree = None + srctreeparent = get_default_srctree(config) + bb.utils.mkdirhier(srctreeparent) + tmpsrcdir = tempfile.mkdtemp(prefix='devtoolsrc', dir=srctreeparent) + + if srctree and os.path.exists(srctree): + if args.fetchuri: + if not os.path.isdir(srctree): + raise DevtoolError("Cannot fetch into source tree path %s as " + "it exists and is not a directory" % + srctree) + elif os.listdir(srctree): + raise DevtoolError("Cannot fetch into source tree path %s as " + "it already exists and is non-empty" % + srctree) + elif not args.fetchuri: + if args.srctree: + raise DevtoolError("Specified source tree %s could not be found" % + args.srctree) + elif srctree: + raise DevtoolError("No source tree exists at default path %s - " + "either create and populate this directory, " + "or specify a path to a source tree, or a " + "URI to fetch source from" % srctree) + else: + raise DevtoolError("You must either specify a source tree " + "or a URI to fetch source from") + + if args.version: + if '_' in args.version or ' ' in args.version: + raise DevtoolError('Invalid version string "%s"' % args.version) + + if args.color == 'auto' and sys.stdout.isatty(): + color = 'always' + else: + color = args.color + extracmdopts = '' + if args.fetchuri: + if args.fetchuri.startswith('npm://'): + ensure_npm(config, basepath, args.fixed_setup) + + source = args.fetchuri + if srctree: + extracmdopts += ' -x %s' % srctree + else: + extracmdopts += ' -x %s' % tmpsrcdir + else: + source = srctree + if args.recipename: + extracmdopts += ' -N %s' % args.recipename + if args.version: + extracmdopts += ' -V %s' % args.version + if args.binary: + extracmdopts += ' -b' + if args.also_native: + extracmdopts += ' --also-native' + if args.src_subdir: + extracmdopts += ' --src-subdir "%s"' % args.src_subdir + if args.autorev: + extracmdopts += ' -a' + if args.fetch_dev: + extracmdopts += ' --fetch-dev' + + tempdir = tempfile.mkdtemp(prefix='devtool') + try: + builtnpm = False + while True: + try: + stdout, _ = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create --devtool -o %s \'%s\' %s' % (color, tempdir, source, extracmdopts), watch=True) + except bb.process.ExecutionError as e: + if e.exitcode == 14: + if builtnpm: + raise DevtoolError('Re-running recipetool still failed to find npm') + # FIXME this is a horrible hack that is unfortunately + # necessary due to the fact that we can't run bitbake from + # inside recipetool since recipetool keeps tinfoil active + # with references to it throughout the code, so we have + # to exit out and come back here to do it. + ensure_npm(config, basepath, args.fixed_setup, check_exists=False) + logger.info('Re-running recipe creation process after building nodejs') + builtnpm = True + continue + elif e.exitcode == 15: + raise DevtoolError('Could not auto-determine recipe name, please specify it on the command line') + else: + raise DevtoolError('Command \'%s\' failed' % e.command) + break + + recipes = glob.glob(os.path.join(tempdir, '*.bb')) + if recipes: + recipename = os.path.splitext(os.path.basename(recipes[0]))[0].split('_')[0] + if recipename in workspace: + raise DevtoolError('A recipe with the same name as the one being created (%s) already exists in your workspace' % recipename) + recipedir = os.path.join(config.workspace_path, 'recipes', recipename) + bb.utils.mkdirhier(recipedir) + recipefile = os.path.join(recipedir, os.path.basename(recipes[0])) + appendfile = recipe_to_append(recipefile, config) + if os.path.exists(appendfile): + # This shouldn't be possible, but just in case + raise DevtoolError('A recipe with the same name as the one being created already exists in your workspace') + if os.path.exists(recipefile): + raise DevtoolError('A recipe file %s already exists in your workspace; this shouldn\'t be there - please delete it before continuing' % recipefile) + if tmpsrcdir: + srctree = os.path.join(srctreeparent, recipename) + if os.path.exists(tmpsrcdir): + if os.path.exists(srctree): + if os.path.isdir(srctree): + try: + os.rmdir(srctree) + except OSError as e: + if e.errno == errno.ENOTEMPTY: + raise DevtoolError('Source tree path %s already exists and is not empty' % srctree) + else: + raise + else: + raise DevtoolError('Source tree path %s already exists and is not a directory' % srctree) + logger.info('Using default source tree path %s' % srctree) + shutil.move(tmpsrcdir, srctree) + else: + raise DevtoolError('Couldn\'t find source tree created by recipetool') + bb.utils.mkdirhier(recipedir) + shutil.move(recipes[0], recipefile) + # Move any additional files created by recipetool + for fn in os.listdir(tempdir): + shutil.move(os.path.join(tempdir, fn), recipedir) + else: + raise DevtoolError('Command \'%s\' did not create any recipe file:\n%s' % (e.command, e.stdout)) + attic_recipe = os.path.join(config.workspace_path, 'attic', recipename, os.path.basename(recipefile)) + if os.path.exists(attic_recipe): + logger.warn('A modified recipe from a previous invocation exists in %s - you may wish to move this over the top of the new recipe if you had changes in it that you want to continue with' % attic_recipe) + finally: + if tmpsrcdir and os.path.exists(tmpsrcdir): + shutil.rmtree(tmpsrcdir) + shutil.rmtree(tempdir) + + for fn in os.listdir(recipedir): + _add_md5(config, recipename, os.path.join(recipedir, fn)) + + tinfoil = setup_tinfoil(config_only=True, basepath=basepath) + try: + try: + rd = tinfoil.parse_recipe_file(recipefile, False) + except Exception as e: + logger.error(str(e)) + rd = None + if not rd: + # Parsing failed. We just created this recipe and we shouldn't + # leave it in the workdir or it'll prevent bitbake from starting + movefn = '%s.parsefailed' % recipefile + logger.error('Parsing newly created recipe failed, moving recipe to %s for reference. If this looks to be caused by the recipe itself, please report this error.' % movefn) + shutil.move(recipefile, movefn) + return 1 + + if args.fetchuri and not args.no_git: + setup_git_repo(srctree, args.version, 'devtool', d=tinfoil.config_data) + + initial_rev = None + if os.path.exists(os.path.join(srctree, '.git')): + (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) + initial_rev = stdout.rstrip() + + if args.src_subdir: + srctree = os.path.join(srctree, args.src_subdir) + + bb.utils.mkdirhier(os.path.dirname(appendfile)) + with open(appendfile, 'w') as f: + f.write('inherit externalsrc\n') + f.write('EXTERNALSRC = "%s"\n' % srctree) + + b_is_s = use_external_build(args.same_dir, args.no_same_dir, rd) + if b_is_s: + f.write('EXTERNALSRC_BUILD = "%s"\n' % srctree) + if initial_rev: + f.write('\n# initial_rev: %s\n' % initial_rev) + + if args.binary: + f.write('do_install_append() {\n') + f.write(' rm -rf ${D}/.git\n') + f.write(' rm -f ${D}/singletask.lock\n') + f.write('}\n') + + if bb.data.inherits_class('npm', rd): + f.write('do_install_append() {\n') + f.write(' # Remove files added to source dir by devtool/externalsrc\n') + f.write(' rm -f ${NPM_INSTALLDIR}/singletask.lock\n') + f.write(' rm -rf ${NPM_INSTALLDIR}/.git\n') + f.write(' rm -rf ${NPM_INSTALLDIR}/oe-local-files\n') + f.write(' for symlink in ${EXTERNALSRC_SYMLINKS} ; do\n') + f.write(' rm -f ${NPM_INSTALLDIR}/${symlink%%:*}\n') + f.write(' done\n') + f.write('}\n') + + _add_md5(config, recipename, appendfile) + + logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) + + finally: + tinfoil.shutdown() + + return 0 + + +def _check_compatible_recipe(pn, d): + """Check if the recipe is supported by devtool""" + if pn == 'perf': + raise DevtoolError("The perf recipe does not actually check out " + "source and thus cannot be supported by this tool", + 4) + + if pn in ['kernel-devsrc', 'package-index'] or pn.startswith('gcc-source'): + raise DevtoolError("The %s recipe is not supported by this tool" % pn, 4) + + if bb.data.inherits_class('image', d): + raise DevtoolError("The %s recipe is an image, and therefore is not " + "supported by this tool" % pn, 4) + + if bb.data.inherits_class('populate_sdk', d): + raise DevtoolError("The %s recipe is an SDK, and therefore is not " + "supported by this tool" % pn, 4) + + if bb.data.inherits_class('packagegroup', d): + raise DevtoolError("The %s recipe is a packagegroup, and therefore is " + "not supported by this tool" % pn, 4) + + if bb.data.inherits_class('meta', d): + raise DevtoolError("The %s recipe is a meta-recipe, and therefore is " + "not supported by this tool" % pn, 4) + + if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC'): + # Not an incompatibility error per se, so we don't pass the error code + raise DevtoolError("externalsrc is currently enabled for the %s " + "recipe. This prevents the normal do_patch task " + "from working. You will need to disable this " + "first." % pn) + +def _move_file(src, dst): + """Move a file. Creates all the directory components of destination path.""" + dst_d = os.path.dirname(dst) + if dst_d: + bb.utils.mkdirhier(dst_d) + shutil.move(src, dst) + +def _copy_file(src, dst): + """Copy a file. Creates all the directory components of destination path.""" + dst_d = os.path.dirname(dst) + if dst_d: + bb.utils.mkdirhier(dst_d) + shutil.copy(src, dst) + +def _git_ls_tree(repodir, treeish='HEAD', recursive=False): + """List contents of a git treeish""" + import bb + cmd = ['git', 'ls-tree', '-z', treeish] + if recursive: + cmd.append('-r') + out, _ = bb.process.run(cmd, cwd=repodir) + ret = {} + if out: + for line in out.split('\0'): + if line: + split = line.split(None, 4) + ret[split[3]] = split[0:3] + return ret + +def _git_exclude_path(srctree, path): + """Return pathspec (list of paths) that excludes certain path""" + # NOTE: "Filtering out" files/paths in this way is not entirely reliable - + # we don't catch files that are deleted, for example. A more reliable way + # to implement this would be to use "negative pathspecs" which were + # introduced in Git v1.9.0. Revisit this when/if the required Git version + # becomes greater than that. + path = os.path.normpath(path) + recurse = True if len(path.split(os.path.sep)) > 1 else False + git_files = list(_git_ls_tree(srctree, 'HEAD', recurse).keys()) + if path in git_files: + git_files.remove(path) + return git_files + else: + return ['.'] + +def _ls_tree(directory): + """Recursive listing of files in a directory""" + ret = [] + for root, dirs, files in os.walk(directory): + ret.extend([os.path.relpath(os.path.join(root, fname), directory) for + fname in files]) + return ret + + +def extract(args, config, basepath, workspace): + """Entry point for the devtool 'extract' subcommand""" + import bb + + tinfoil = _prep_extract_operation(config, basepath, args.recipename) + if not tinfoil: + # Error already shown + return 1 + try: + rd = parse_recipe(config, tinfoil, args.recipename, True) + if not rd: + return 1 + + srctree = os.path.abspath(args.srctree) + initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, rd, tinfoil) + logger.info('Source tree extracted to %s' % srctree) + + if initial_rev: + return 0 + else: + return 1 + finally: + tinfoil.shutdown() + +def sync(args, config, basepath, workspace): + """Entry point for the devtool 'sync' subcommand""" + import bb + + tinfoil = _prep_extract_operation(config, basepath, args.recipename) + if not tinfoil: + # Error already shown + return 1 + try: + rd = parse_recipe(config, tinfoil, args.recipename, True) + if not rd: + return 1 + + srctree = os.path.abspath(args.srctree) + initial_rev = _extract_source(srctree, args.keep_temp, args.branch, True, rd, tinfoil) + logger.info('Source tree %s synchronized' % srctree) + + if initial_rev: + return 0 + else: + return 1 + finally: + tinfoil.shutdown() + + +def _prep_extract_operation(config, basepath, recipename, tinfoil=None): + """HACK: Ugly workaround for making sure that requirements are met when + trying to extract a package. Returns the tinfoil instance to be used.""" + if not tinfoil: + tinfoil = setup_tinfoil(basepath=basepath) + + rd = parse_recipe(config, tinfoil, recipename, True) + if not rd: + return None + + if bb.data.inherits_class('kernel-yocto', rd): + tinfoil.shutdown() + try: + stdout, _ = exec_build_env_command(config.init_path, basepath, + 'bitbake kern-tools-native') + tinfoil = setup_tinfoil(basepath=basepath) + except bb.process.ExecutionError as err: + raise DevtoolError("Failed to build kern-tools-native:\n%s" % + err.stdout) + return tinfoil + + +def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil): + """Extract sources of a recipe""" + import oe.recipeutils + + pn = d.getVar('PN') + + _check_compatible_recipe(pn, d) + + if sync: + if not os.path.exists(srctree): + raise DevtoolError("output path %s does not exist" % srctree) + else: + if os.path.exists(srctree): + if not os.path.isdir(srctree): + raise DevtoolError("output path %s exists and is not a directory" % + srctree) + elif os.listdir(srctree): + raise DevtoolError("output path %s already exists and is " + "non-empty" % srctree) + + if 'noexec' in (d.getVarFlags('do_unpack', False) or []): + raise DevtoolError("The %s recipe has do_unpack disabled, unable to " + "extract source" % pn, 4) + + if not sync: + # Prepare for shutil.move later on + bb.utils.mkdirhier(srctree) + os.rmdir(srctree) + + initial_rev = None + # We need to redirect WORKDIR, STAMPS_DIR etc. under a temporary + # directory so that: + # (a) we pick up all files that get unpacked to the WORKDIR, and + # (b) we don't disturb the existing build + # However, with recipe-specific sysroots the sysroots for the recipe + # will be prepared under WORKDIR, and if we used the system temporary + # directory (i.e. usually /tmp) as used by mkdtemp by default, then + # our attempts to hardlink files into the recipe-specific sysroots + # will fail on systems where /tmp is a different filesystem, and it + # would have to fall back to copying the files which is a waste of + # time. Put the temp directory under the WORKDIR to prevent that from + # being a problem. + tempbasedir = d.getVar('WORKDIR') + bb.utils.mkdirhier(tempbasedir) + tempdir = tempfile.mkdtemp(prefix='devtooltmp-', dir=tempbasedir) + try: + tinfoil.logger.setLevel(logging.WARNING) + + crd = d.createCopy() + # Make a subdir so we guard against WORKDIR==S + workdir = os.path.join(tempdir, 'workdir') + crd.setVar('WORKDIR', workdir) + if not crd.getVar('S').startswith(workdir): + # Usually a shared workdir recipe (kernel, gcc) + # Try to set a reasonable default + if bb.data.inherits_class('kernel', d): + crd.setVar('S', '${WORKDIR}/source') + else: + crd.setVar('S', '${WORKDIR}/%s' % os.path.basename(d.getVar('S'))) + if bb.data.inherits_class('kernel', d): + # We don't want to move the source to STAGING_KERNEL_DIR here + crd.setVar('STAGING_KERNEL_DIR', '${S}') + + is_kernel_yocto = bb.data.inherits_class('kernel-yocto', d) + if not is_kernel_yocto: + crd.setVar('PATCHTOOL', 'git') + crd.setVar('PATCH_COMMIT_FUNCTIONS', '1') + + # Apply our changes to the datastore to the server's datastore + for key in crd.localkeys(): + tinfoil.config_data.setVar('%s_pn-%s' % (key, pn), crd.getVar(key, False)) + + tinfoil.config_data.setVar('STAMPS_DIR', os.path.join(tempdir, 'stamps')) + tinfoil.config_data.setVar('T', os.path.join(tempdir, 'temp')) + tinfoil.config_data.setVar('BUILDCFG_FUNCS', '') + tinfoil.config_data.setVar('BUILDCFG_HEADER', '') + tinfoil.config_data.setVar('BB_HASH_IGNORE_MISMATCH', '1') + + tinfoil.set_event_mask(['bb.event.BuildStarted', + 'bb.event.BuildCompleted', + 'logging.LogRecord', + 'bb.command.CommandCompleted', + 'bb.command.CommandFailed', + 'bb.build.TaskStarted', + 'bb.build.TaskSucceeded', + 'bb.build.TaskFailed', + 'bb.build.TaskFailedSilent']) + + def runtask(target, task): + if tinfoil.build_file(target, task): + while True: + event = tinfoil.wait_event(0.25) + if event: + if isinstance(event, bb.command.CommandCompleted): + break + elif isinstance(event, bb.command.CommandFailed): + raise DevtoolError('Task do_%s failed: %s' % (task, event.error)) + elif isinstance(event, bb.build.TaskFailed): + raise DevtoolError('Task do_%s failed' % task) + elif isinstance(event, bb.build.TaskStarted): + logger.info('Executing %s...' % event._task) + elif isinstance(event, logging.LogRecord): + if event.levelno <= logging.INFO: + continue + logger.handle(event) + + # we need virtual:native:/path/to/recipe if it's a BBCLASSEXTEND + fn = tinfoil.get_recipe_file(pn) + runtask(fn, 'unpack') + + if bb.data.inherits_class('kernel-yocto', d): + # Extra step for kernel to populate the source directory + runtask(fn, 'kernel_checkout') + + srcsubdir = crd.getVar('S') + + # Move local source files into separate subdir + recipe_patches = [os.path.basename(patch) for patch in + oe.recipeutils.get_recipe_patches(crd)] + local_files = oe.recipeutils.get_recipe_local_files(crd) + + # Ignore local files with subdir={BP} + srcabspath = os.path.abspath(srcsubdir) + local_files = [fname for fname in local_files if + os.path.exists(os.path.join(workdir, fname)) and + (srcabspath == workdir or not + os.path.join(workdir, fname).startswith(srcabspath + + os.sep))] + if local_files: + for fname in local_files: + _move_file(os.path.join(workdir, fname), + os.path.join(tempdir, 'oe-local-files', fname)) + with open(os.path.join(tempdir, 'oe-local-files', '.gitignore'), + 'w') as f: + f.write('# Ignore local files, by default. Remove this file ' + 'if you want to commit the directory to Git\n*\n') + + if srcsubdir == workdir: + # Find non-patch non-local sources that were "unpacked" to srctree + # directory + src_files = [fname for fname in _ls_tree(workdir) if + os.path.basename(fname) not in recipe_patches] + # Force separate S so that patch files can be left out from srctree + srcsubdir = tempfile.mkdtemp(dir=workdir) + tinfoil.config_data.setVar('S_task-patch', srcsubdir) + # Move source files to S + for path in src_files: + _move_file(os.path.join(workdir, path), + os.path.join(srcsubdir, path)) + elif os.path.dirname(srcsubdir) != workdir: + # Handle if S is set to a subdirectory of the source + srcsubdir = os.path.join(workdir, os.path.relpath(srcsubdir, workdir).split(os.sep)[0]) + + scriptutils.git_convert_standalone_clone(srcsubdir) + + # Make sure that srcsubdir exists + bb.utils.mkdirhier(srcsubdir) + if not os.path.exists(srcsubdir) or not os.listdir(srcsubdir): + logger.warning("no source unpacked to S, either the %s recipe " + "doesn't use any source or the correct source " + "directory could not be determined" % pn) + + setup_git_repo(srcsubdir, crd.getVar('PV'), devbranch, d=d) + + (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srcsubdir) + initial_rev = stdout.rstrip() + + logger.info('Patching...') + runtask(fn, 'patch') + + bb.process.run('git tag -f devtool-patched', cwd=srcsubdir) + + kconfig = None + if bb.data.inherits_class('kernel-yocto', d): + # Store generate and store kernel config + logger.info('Generating kernel config') + runtask(fn, 'configure') + kconfig = os.path.join(crd.getVar('B'), '.config') + + + tempdir_localdir = os.path.join(tempdir, 'oe-local-files') + srctree_localdir = os.path.join(srctree, 'oe-local-files') + + if sync: + bb.process.run('git fetch file://' + srcsubdir + ' ' + devbranch + ':' + devbranch, cwd=srctree) + + # Move oe-local-files directory to srctree + # As the oe-local-files is not part of the constructed git tree, + # remove them directly during the synchrounizating might surprise + # the users. Instead, we move it to oe-local-files.bak and remind + # user in the log message. + if os.path.exists(srctree_localdir + '.bak'): + shutil.rmtree(srctree_localdir, srctree_localdir + '.bak') + + if os.path.exists(srctree_localdir): + logger.info('Backing up current local file directory %s' % srctree_localdir) + shutil.move(srctree_localdir, srctree_localdir + '.bak') + + if os.path.exists(tempdir_localdir): + logger.info('Syncing local source files to srctree...') + shutil.copytree(tempdir_localdir, srctree_localdir) + else: + # Move oe-local-files directory to srctree + if os.path.exists(tempdir_localdir): + logger.info('Adding local source files to srctree...') + shutil.move(tempdir_localdir, srcsubdir) + + shutil.move(srcsubdir, srctree) + + if os.path.abspath(d.getVar('S')) == os.path.abspath(d.getVar('WORKDIR')): + # If recipe extracts to ${WORKDIR}, symlink the files into the srctree + # (otherwise the recipe won't build as expected) + local_files_dir = os.path.join(srctree, 'oe-local-files') + addfiles = [] + for root, _, files in os.walk(local_files_dir): + relpth = os.path.relpath(root, local_files_dir) + if relpth != '.': + bb.utils.mkdirhier(os.path.join(srctree, relpth)) + for fn in files: + if fn == '.gitignore': + continue + destpth = os.path.join(srctree, relpth, fn) + if os.path.exists(destpth): + os.unlink(destpth) + os.symlink('oe-local-files/%s' % fn, destpth) + addfiles.append(os.path.join(relpth, fn)) + if addfiles: + bb.process.run('git add %s' % ' '.join(addfiles), cwd=srctree) + useroptions = [] + oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=d) + bb.process.run('git %s commit -a -m "Committing local file symlinks\n\n%s"' % (' '.join(useroptions), oe.patch.GitApplyTree.ignore_commit_prefix), cwd=srctree) + + if kconfig: + logger.info('Copying kernel config to srctree') + shutil.copy2(kconfig, srctree) + + finally: + if keep_temp: + logger.info('Preserving temporary directory %s' % tempdir) + else: + shutil.rmtree(tempdir) + return initial_rev + +def _add_md5(config, recipename, filename): + """Record checksum of a file (or recursively for a directory) to the md5-file of the workspace""" + import bb.utils + + def addfile(fn): + md5 = bb.utils.md5_file(fn) + with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f: + f.write('%s|%s|%s\n' % (recipename, os.path.relpath(fn, config.workspace_path), md5)) + + if os.path.isdir(filename): + for root, _, files in os.walk(filename): + for f in files: + addfile(os.path.join(root, f)) + else: + addfile(filename) + +def _check_preserve(config, recipename): + """Check if a file was manually changed and needs to be saved in 'attic' + directory""" + import bb.utils + origfile = os.path.join(config.workspace_path, '.devtool_md5') + newfile = os.path.join(config.workspace_path, '.devtool_md5_new') + preservepath = os.path.join(config.workspace_path, 'attic', recipename) + with open(origfile, 'r') as f: + with open(newfile, 'w') as tf: + for line in f.readlines(): + splitline = line.rstrip().split('|') + if splitline[0] == recipename: + removefile = os.path.join(config.workspace_path, splitline[1]) + try: + md5 = bb.utils.md5_file(removefile) + except IOError as err: + if err.errno == 2: + # File no longer exists, skip it + continue + else: + raise + if splitline[2] != md5: + bb.utils.mkdirhier(preservepath) + preservefile = os.path.basename(removefile) + logger.warn('File %s modified since it was written, preserving in %s' % (preservefile, preservepath)) + shutil.move(removefile, os.path.join(preservepath, preservefile)) + else: + os.remove(removefile) + else: + tf.write(line) + os.rename(newfile, origfile) + +def modify(args, config, basepath, workspace): + """Entry point for the devtool 'modify' subcommand""" + import bb + import oe.recipeutils + + if args.recipename in workspace: + raise DevtoolError("recipe %s is already in your workspace" % + args.recipename) + + tinfoil = setup_tinfoil(basepath=basepath) + try: + rd = parse_recipe(config, tinfoil, args.recipename, True) + if not rd: + return 1 + + pn = rd.getVar('PN') + if pn != args.recipename: + logger.info('Mapping %s to %s' % (args.recipename, pn)) + if pn in workspace: + raise DevtoolError("recipe %s is already in your workspace" % + pn) + + if args.srctree: + srctree = os.path.abspath(args.srctree) + else: + srctree = get_default_srctree(config, pn) + + if args.no_extract and not os.path.isdir(srctree): + raise DevtoolError("--no-extract specified and source path %s does " + "not exist or is not a directory" % + srctree) + if not args.no_extract: + tinfoil = _prep_extract_operation(config, basepath, pn, tinfoil) + if not tinfoil: + # Error already shown + return 1 + # We need to re-parse because tinfoil may have been re-initialised + rd = parse_recipe(config, tinfoil, args.recipename, True) + + recipefile = rd.getVar('FILE') + appendfile = recipe_to_append(recipefile, config, args.wildcard) + if os.path.exists(appendfile): + raise DevtoolError("Another variant of recipe %s is already in your " + "workspace (only one variant of a recipe can " + "currently be worked on at once)" + % pn) + + _check_compatible_recipe(pn, rd) + + initial_rev = None + commits = [] + if not args.no_extract: + initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, rd, tinfoil) + if not initial_rev: + return 1 + logger.info('Source tree extracted to %s' % srctree) + # Get list of commits since this revision + (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=srctree) + commits = stdout.split() + else: + if os.path.exists(os.path.join(srctree, '.git')): + # Check if it's a tree previously extracted by us + try: + (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=srctree) + except bb.process.ExecutionError: + stdout = '' + for line in stdout.splitlines(): + if line.startswith('*'): + (stdout, _) = bb.process.run('git rev-parse devtool-base', cwd=srctree) + initial_rev = stdout.rstrip() + if not initial_rev: + # Otherwise, just grab the head revision + (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) + initial_rev = stdout.rstrip() + + # Check that recipe isn't using a shared workdir + s = os.path.abspath(rd.getVar('S')) + workdir = os.path.abspath(rd.getVar('WORKDIR')) + if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir: + # Handle if S is set to a subdirectory of the source + srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] + srctree = os.path.join(srctree, srcsubdir) + + bb.utils.mkdirhier(os.path.dirname(appendfile)) + with open(appendfile, 'w') as f: + f.write('FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n') + # Local files can be modified/tracked in separate subdir under srctree + # Mostly useful for packages with S != WORKDIR + f.write('FILESPATH_prepend := "%s:"\n' % + os.path.join(srctree, 'oe-local-files')) + + f.write('\ninherit externalsrc\n') + f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n') + f.write('EXTERNALSRC_pn-%s = "%s"\n' % (pn, srctree)) + + b_is_s = use_external_build(args.same_dir, args.no_same_dir, rd) + if b_is_s: + f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (pn, srctree)) + + if bb.data.inherits_class('kernel', rd): + f.write('SRCTREECOVEREDTASKS = "do_validate_branches do_kernel_checkout ' + 'do_fetch do_unpack do_patch do_kernel_configme do_kernel_configcheck"\n') + f.write('\ndo_configure_append() {\n' + ' cp ${B}/.config ${S}/.config.baseline\n' + ' ln -sfT ${B}/.config ${S}/.config.new\n' + '}\n') + if initial_rev: + f.write('\n# initial_rev: %s\n' % initial_rev) + for commit in commits: + f.write('# commit: %s\n' % commit) + + _add_md5(config, pn, appendfile) + + logger.info('Recipe %s now set up to build from %s' % (pn, srctree)) + + finally: + tinfoil.shutdown() + + return 0 + + +def rename(args, config, basepath, workspace): + """Entry point for the devtool 'rename' subcommand""" + import bb + import oe.recipeutils + + check_workspace_recipe(workspace, args.recipename) + + if not (args.newname or args.version): + raise DevtoolError('You must specify a new name, a version with -V/--version, or both') + + recipefile = workspace[args.recipename]['recipefile'] + if not recipefile: + raise DevtoolError('devtool rename can only be used where the recipe file itself is in the workspace (e.g. after devtool add)') + + if args.newname and args.newname != args.recipename: + reason = oe.recipeutils.validate_pn(args.newname) + if reason: + raise DevtoolError(reason) + newname = args.newname + else: + newname = args.recipename + + append = workspace[args.recipename]['bbappend'] + appendfn = os.path.splitext(os.path.basename(append))[0] + splitfn = appendfn.split('_') + if len(splitfn) > 1: + origfnver = appendfn.split('_')[1] + else: + origfnver = '' + + recipefilemd5 = None + tinfoil = setup_tinfoil(basepath=basepath, tracking=True) + try: + rd = parse_recipe(config, tinfoil, args.recipename, True) + if not rd: + return 1 + + bp = rd.getVar('BP') + bpn = rd.getVar('BPN') + if newname != args.recipename: + localdata = rd.createCopy() + localdata.setVar('PN', newname) + newbpn = localdata.getVar('BPN') + else: + newbpn = bpn + s = rd.getVar('S', False) + src_uri = rd.getVar('SRC_URI', False) + pv = rd.getVar('PV') + + # Correct variable values that refer to the upstream source - these + # values must stay the same, so if the name/version are changing then + # we need to fix them up + new_s = s + new_src_uri = src_uri + if newbpn != bpn: + # ${PN} here is technically almost always incorrect, but people do use it + new_s = new_s.replace('${BPN}', bpn) + new_s = new_s.replace('${PN}', bpn) + new_s = new_s.replace('${BP}', '%s-${PV}' % bpn) + new_src_uri = new_src_uri.replace('${BPN}', bpn) + new_src_uri = new_src_uri.replace('${PN}', bpn) + new_src_uri = new_src_uri.replace('${BP}', '%s-${PV}' % bpn) + if args.version and origfnver == pv: + new_s = new_s.replace('${PV}', pv) + new_s = new_s.replace('${BP}', '${BPN}-%s' % pv) + new_src_uri = new_src_uri.replace('${PV}', pv) + new_src_uri = new_src_uri.replace('${BP}', '${BPN}-%s' % pv) + patchfields = {} + if new_s != s: + patchfields['S'] = new_s + if new_src_uri != src_uri: + patchfields['SRC_URI'] = new_src_uri + if patchfields: + recipefilemd5 = bb.utils.md5_file(recipefile) + oe.recipeutils.patch_recipe(rd, recipefile, patchfields) + newrecipefilemd5 = bb.utils.md5_file(recipefile) + finally: + tinfoil.shutdown() + + if args.version: + newver = args.version + else: + newver = origfnver + + if newver: + newappend = '%s_%s.bbappend' % (newname, newver) + newfile = '%s_%s.bb' % (newname, newver) + else: + newappend = '%s.bbappend' % newname + newfile = '%s.bb' % newname + + oldrecipedir = os.path.dirname(recipefile) + newrecipedir = os.path.join(config.workspace_path, 'recipes', newname) + if oldrecipedir != newrecipedir: + bb.utils.mkdirhier(newrecipedir) + + newappend = os.path.join(os.path.dirname(append), newappend) + newfile = os.path.join(newrecipedir, newfile) + + # Rename bbappend + logger.info('Renaming %s to %s' % (append, newappend)) + os.rename(append, newappend) + # Rename recipe file + logger.info('Renaming %s to %s' % (recipefile, newfile)) + os.rename(recipefile, newfile) + + # Rename source tree if it's the default path + appendmd5 = None + if not args.no_srctree: + srctree = workspace[args.recipename]['srctree'] + if os.path.abspath(srctree) == os.path.join(config.workspace_path, 'sources', args.recipename): + newsrctree = os.path.join(config.workspace_path, 'sources', newname) + logger.info('Renaming %s to %s' % (srctree, newsrctree)) + shutil.move(srctree, newsrctree) + # Correct any references (basically EXTERNALSRC*) in the .bbappend + appendmd5 = bb.utils.md5_file(newappend) + appendlines = [] + with open(newappend, 'r') as f: + for line in f: + appendlines.append(line) + with open(newappend, 'w') as f: + for line in appendlines: + if srctree in line: + line = line.replace(srctree, newsrctree) + f.write(line) + newappendmd5 = bb.utils.md5_file(newappend) + + bpndir = None + newbpndir = None + if newbpn != bpn: + bpndir = os.path.join(oldrecipedir, bpn) + if os.path.exists(bpndir): + newbpndir = os.path.join(newrecipedir, newbpn) + logger.info('Renaming %s to %s' % (bpndir, newbpndir)) + shutil.move(bpndir, newbpndir) + + bpdir = None + newbpdir = None + if newver != origfnver or newbpn != bpn: + bpdir = os.path.join(oldrecipedir, bp) + if os.path.exists(bpdir): + newbpdir = os.path.join(newrecipedir, '%s-%s' % (newbpn, newver)) + logger.info('Renaming %s to %s' % (bpdir, newbpdir)) + shutil.move(bpdir, newbpdir) + + if oldrecipedir != newrecipedir: + # Move any stray files and delete the old recipe directory + for entry in os.listdir(oldrecipedir): + oldpath = os.path.join(oldrecipedir, entry) + newpath = os.path.join(newrecipedir, entry) + logger.info('Renaming %s to %s' % (oldpath, newpath)) + shutil.move(oldpath, newpath) + os.rmdir(oldrecipedir) + + # Now take care of entries in .devtool_md5 + md5entries = [] + with open(os.path.join(config.workspace_path, '.devtool_md5'), 'r') as f: + for line in f: + md5entries.append(line) + + if bpndir and newbpndir: + relbpndir = os.path.relpath(bpndir, config.workspace_path) + '/' + else: + relbpndir = None + if bpdir and newbpdir: + relbpdir = os.path.relpath(bpdir, config.workspace_path) + '/' + else: + relbpdir = None + + with open(os.path.join(config.workspace_path, '.devtool_md5'), 'w') as f: + for entry in md5entries: + splitentry = entry.rstrip().split('|') + if len(splitentry) > 2: + if splitentry[0] == args.recipename: + splitentry[0] = newname + if splitentry[1] == os.path.relpath(append, config.workspace_path): + splitentry[1] = os.path.relpath(newappend, config.workspace_path) + if appendmd5 and splitentry[2] == appendmd5: + splitentry[2] = newappendmd5 + elif splitentry[1] == os.path.relpath(recipefile, config.workspace_path): + splitentry[1] = os.path.relpath(newfile, config.workspace_path) + if recipefilemd5 and splitentry[2] == recipefilemd5: + splitentry[2] = newrecipefilemd5 + elif relbpndir and splitentry[1].startswith(relbpndir): + splitentry[1] = os.path.relpath(os.path.join(newbpndir, splitentry[1][len(relbpndir):]), config.workspace_path) + elif relbpdir and splitentry[1].startswith(relbpdir): + splitentry[1] = os.path.relpath(os.path.join(newbpdir, splitentry[1][len(relbpdir):]), config.workspace_path) + entry = '|'.join(splitentry) + '\n' + f.write(entry) + return 0 + + +def _get_patchset_revs(srctree, recipe_path, initial_rev=None): + """Get initial and update rev of a recipe. These are the start point of the + whole patchset and start point for the patches to be re-generated/updated. + """ + import bb + + # Parse initial rev from recipe if not specified + commits = [] + with open(recipe_path, 'r') as f: + for line in f: + if line.startswith('# initial_rev:'): + if not initial_rev: + initial_rev = line.split(':')[-1].strip() + elif line.startswith('# commit:'): + commits.append(line.split(':')[-1].strip()) + + update_rev = initial_rev + changed_revs = None + if initial_rev: + # Find first actually changed revision + stdout, _ = bb.process.run('git rev-list --reverse %s..HEAD' % + initial_rev, cwd=srctree) + newcommits = stdout.split() + for i in range(min(len(commits), len(newcommits))): + if newcommits[i] == commits[i]: + update_rev = commits[i] + + try: + stdout, _ = bb.process.run('git cherry devtool-patched', + cwd=srctree) + except bb.process.ExecutionError as err: + stdout = None + + if stdout is not None: + changed_revs = [] + for line in stdout.splitlines(): + if line.startswith('+ '): + rev = line.split()[1] + if rev in newcommits: + changed_revs.append(rev) + + return initial_rev, update_rev, changed_revs + +def _remove_file_entries(srcuri, filelist): + """Remove file:// entries from SRC_URI""" + remaining = filelist[:] + entries = [] + for fname in filelist: + basename = os.path.basename(fname) + for i in range(len(srcuri)): + if (srcuri[i].startswith('file://') and + os.path.basename(srcuri[i].split(';')[0]) == basename): + entries.append(srcuri[i]) + remaining.remove(fname) + srcuri.pop(i) + break + return entries, remaining + +def _replace_srcuri_entry(srcuri, filename, newentry): + """Replace entry corresponding to specified file with a new entry""" + basename = os.path.basename(filename) + for i in range(len(srcuri)): + if os.path.basename(srcuri[i].split(';')[0]) == basename: + srcuri.pop(i) + srcuri.insert(i, newentry) + break + +def _remove_source_files(append, files, destpath): + """Unlink existing patch files""" + for path in files: + if append: + if not destpath: + raise Exception('destpath should be set here') + path = os.path.join(destpath, os.path.basename(path)) + + if os.path.exists(path): + logger.info('Removing file %s' % path) + # FIXME "git rm" here would be nice if the file in question is + # tracked + # FIXME there's a chance that this file is referred to by + # another recipe, in which case deleting wouldn't be the + # right thing to do + os.remove(path) + # Remove directory if empty + try: + os.rmdir(os.path.dirname(path)) + except OSError as ose: + if ose.errno != errno.ENOTEMPTY: + raise + + +def _export_patches(srctree, rd, start_rev, destdir, changed_revs=None): + """Export patches from srctree to given location. + Returns three-tuple of dicts: + 1. updated - patches that already exist in SRCURI + 2. added - new patches that don't exist in SRCURI + 3 removed - patches that exist in SRCURI but not in exported patches + In each dict the key is the 'basepath' of the URI and value is the + absolute path to the existing file in recipe space (if any). + """ + import oe.recipeutils + from oe.patch import GitApplyTree + updated = OrderedDict() + added = OrderedDict() + seqpatch_re = re.compile('^([0-9]{4}-)?(.+)') + + existing_patches = dict((os.path.basename(path), path) for path in + oe.recipeutils.get_recipe_patches(rd)) + + # Generate patches from Git, exclude local files directory + patch_pathspec = _git_exclude_path(srctree, 'oe-local-files') + GitApplyTree.extractPatches(srctree, start_rev, destdir, patch_pathspec) + + new_patches = sorted(os.listdir(destdir)) + for new_patch in new_patches: + # Strip numbering from patch names. If it's a git sequence named patch, + # the numbers might not match up since we are starting from a different + # revision This does assume that people are using unique shortlog + # values, but they ought to be anyway... + new_basename = seqpatch_re.match(new_patch).group(2) + match_name = None + for old_patch in existing_patches: + old_basename = seqpatch_re.match(old_patch).group(2) + old_basename_splitext = os.path.splitext(old_basename) + if old_basename.endswith(('.gz', '.bz2', '.Z')) and old_basename_splitext[0] == new_basename: + old_patch_noext = os.path.splitext(old_patch)[0] + match_name = old_patch_noext + break + elif new_basename == old_basename: + match_name = old_patch + break + if match_name: + # Rename patch files + if new_patch != match_name: + os.rename(os.path.join(destdir, new_patch), + os.path.join(destdir, match_name)) + # Need to pop it off the list now before checking changed_revs + oldpath = existing_patches.pop(old_patch) + if changed_revs is not None: + # Avoid updating patches that have not actually changed + with open(os.path.join(destdir, match_name), 'r') as f: + firstlineitems = f.readline().split() + # Looking for "From <hash>" line + if len(firstlineitems) > 1 and len(firstlineitems[1]) == 40: + if not firstlineitems[1] in changed_revs: + continue + # Recompress if necessary + if oldpath.endswith(('.gz', '.Z')): + bb.process.run(['gzip', match_name], cwd=destdir) + if oldpath.endswith('.gz'): + match_name += '.gz' + else: + match_name += '.Z' + elif oldpath.endswith('.bz2'): + bb.process.run(['bzip2', match_name], cwd=destdir) + match_name += '.bz2' + updated[match_name] = oldpath + else: + added[new_patch] = None + return (updated, added, existing_patches) + + +def _create_kconfig_diff(srctree, rd, outfile): + """Create a kconfig fragment""" + # Only update config fragment if both config files exist + orig_config = os.path.join(srctree, '.config.baseline') + new_config = os.path.join(srctree, '.config.new') + if os.path.exists(orig_config) and os.path.exists(new_config): + cmd = ['diff', '--new-line-format=%L', '--old-line-format=', + '--unchanged-line-format=', orig_config, new_config] + pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + stdout, stderr = pipe.communicate() + if pipe.returncode == 1: + logger.info("Updating config fragment %s" % outfile) + with open(outfile, 'wb') as fobj: + fobj.write(stdout) + elif pipe.returncode == 0: + logger.info("Would remove config fragment %s" % outfile) + if os.path.exists(outfile): + # Remove fragment file in case of empty diff + logger.info("Removing config fragment %s" % outfile) + os.unlink(outfile) + else: + raise bb.process.ExecutionError(cmd, pipe.returncode, stdout, stderr) + return True + return False + + +def _export_local_files(srctree, rd, destdir): + """Copy local files from srctree to given location. + Returns three-tuple of dicts: + 1. updated - files that already exist in SRCURI + 2. added - new files files that don't exist in SRCURI + 3 removed - files that exist in SRCURI but not in exported files + In each dict the key is the 'basepath' of the URI and value is the + absolute path to the existing file in recipe space (if any). + """ + import oe.recipeutils + + # Find out local files (SRC_URI files that exist in the "recipe space"). + # Local files that reside in srctree are not included in patch generation. + # Instead they are directly copied over the original source files (in + # recipe space). + existing_files = oe.recipeutils.get_recipe_local_files(rd) + new_set = None + updated = OrderedDict() + added = OrderedDict() + removed = OrderedDict() + local_files_dir = os.path.join(srctree, 'oe-local-files') + git_files = _git_ls_tree(srctree) + if 'oe-local-files' in git_files: + # If tracked by Git, take the files from srctree HEAD. First get + # the tree object of the directory + tmp_index = os.path.join(srctree, '.git', 'index.tmp.devtool') + tree = git_files['oe-local-files'][2] + bb.process.run(['git', 'checkout', tree, '--', '.'], cwd=srctree, + env=dict(os.environ, GIT_WORK_TREE=destdir, + GIT_INDEX_FILE=tmp_index)) + new_set = list(_git_ls_tree(srctree, tree, True).keys()) + elif os.path.isdir(local_files_dir): + # If not tracked by Git, just copy from working copy + new_set = _ls_tree(os.path.join(srctree, 'oe-local-files')) + bb.process.run(['cp', '-ax', + os.path.join(srctree, 'oe-local-files', '.'), destdir]) + else: + new_set = [] + + # Special handling for kernel config + if bb.data.inherits_class('kernel-yocto', rd): + fragment_fn = 'devtool-fragment.cfg' + fragment_path = os.path.join(destdir, fragment_fn) + if _create_kconfig_diff(srctree, rd, fragment_path): + if os.path.exists(fragment_path): + if fragment_fn not in new_set: + new_set.append(fragment_fn) + # Copy fragment to local-files + if os.path.isdir(local_files_dir): + shutil.copy2(fragment_path, local_files_dir) + else: + if fragment_fn in new_set: + new_set.remove(fragment_fn) + # Remove fragment from local-files + if os.path.exists(os.path.join(local_files_dir, fragment_fn)): + os.unlink(os.path.join(local_files_dir, fragment_fn)) + + if new_set is not None: + for fname in new_set: + if fname in existing_files: + origpath = existing_files.pop(fname) + workpath = os.path.join(local_files_dir, fname) + if not filecmp.cmp(origpath, workpath): + updated[fname] = origpath + elif fname != '.gitignore': + added[fname] = None + + workdir = rd.getVar('WORKDIR') + s = rd.getVar('S') + if not s.endswith(os.sep): + s += os.sep + + if workdir != s: + # Handle files where subdir= was specified + for fname in list(existing_files.keys()): + # FIXME handle both subdir starting with BP and not? + fworkpath = os.path.join(workdir, fname) + if fworkpath.startswith(s): + fpath = os.path.join(srctree, os.path.relpath(fworkpath, s)) + if os.path.exists(fpath): + origpath = existing_files.pop(fname) + if not filecmp.cmp(origpath, fpath): + updated[fpath] = origpath + + removed = existing_files + return (updated, added, removed) + + +def _determine_files_dir(rd): + """Determine the appropriate files directory for a recipe""" + recipedir = rd.getVar('FILE_DIRNAME') + for entry in rd.getVar('FILESPATH').split(':'): + relpth = os.path.relpath(entry, recipedir) + if not os.sep in relpth: + # One (or zero) levels below only, so we don't put anything in machine-specific directories + if os.path.isdir(entry): + return entry + return os.path.join(recipedir, rd.getVar('BPN')) + + +def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remove): + """Implement the 'srcrev' mode of update-recipe""" + import bb + import oe.recipeutils + + recipefile = rd.getVar('FILE') + logger.info('Updating SRCREV in recipe %s' % os.path.basename(recipefile)) + + # Get HEAD revision + try: + stdout, _ = bb.process.run('git rev-parse HEAD', cwd=srctree) + except bb.process.ExecutionError as err: + raise DevtoolError('Failed to get HEAD revision in %s: %s' % + (srctree, err)) + srcrev = stdout.strip() + if len(srcrev) != 40: + raise DevtoolError('Invalid hash returned by git: %s' % stdout) + + destpath = None + remove_files = [] + patchfields = {} + patchfields['SRCREV'] = srcrev + orig_src_uri = rd.getVar('SRC_URI', False) or '' + srcuri = orig_src_uri.split() + tempdir = tempfile.mkdtemp(prefix='devtool') + update_srcuri = False + try: + local_files_dir = tempfile.mkdtemp(dir=tempdir) + upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir) + if not no_remove: + # Find list of existing patches in recipe file + patches_dir = tempfile.mkdtemp(dir=tempdir) + old_srcrev = (rd.getVar('SRCREV', False) or '') + upd_p, new_p, del_p = _export_patches(srctree, rd, old_srcrev, + patches_dir) + + # Remove deleted local files and "overlapping" patches + remove_files = list(del_f.values()) + list(upd_p.values()) + if remove_files: + removedentries = _remove_file_entries(srcuri, remove_files)[0] + update_srcuri = True + + if appendlayerdir: + files = dict((os.path.join(local_files_dir, key), val) for + key, val in list(upd_f.items()) + list(new_f.items())) + removevalues = {} + if update_srcuri: + removevalues = {'SRC_URI': removedentries} + patchfields['SRC_URI'] = '\\\n '.join(srcuri) + _, destpath = oe.recipeutils.bbappend_recipe( + rd, appendlayerdir, files, wildcardver=wildcard_version, + extralines=patchfields, removevalues=removevalues) + else: + files_dir = _determine_files_dir(rd) + for basepath, path in upd_f.items(): + logger.info('Updating file %s' % basepath) + if os.path.isabs(basepath): + # Original file (probably with subdir pointing inside source tree) + # so we do not want to move it, just copy + _copy_file(basepath, path) + else: + _move_file(os.path.join(local_files_dir, basepath), path) + update_srcuri= True + for basepath, path in new_f.items(): + logger.info('Adding new file %s' % basepath) + _move_file(os.path.join(local_files_dir, basepath), + os.path.join(files_dir, basepath)) + srcuri.append('file://%s' % basepath) + update_srcuri = True + if update_srcuri: + patchfields['SRC_URI'] = ' '.join(srcuri) + oe.recipeutils.patch_recipe(rd, recipefile, patchfields) + finally: + shutil.rmtree(tempdir) + if not 'git://' in orig_src_uri: + logger.info('You will need to update SRC_URI within the recipe to ' + 'point to a git repository where you have pushed your ' + 'changes') + + _remove_source_files(appendlayerdir, remove_files, destpath) + return True + +def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, initial_rev): + """Implement the 'patch' mode of update-recipe""" + import bb + import oe.recipeutils + + recipefile = rd.getVar('FILE') + append = workspace[recipename]['bbappend'] + if not os.path.exists(append): + raise DevtoolError('unable to find workspace bbappend for recipe %s' % + recipename) + + initial_rev, update_rev, changed_revs = _get_patchset_revs(srctree, append, initial_rev) + if not initial_rev: + raise DevtoolError('Unable to find initial revision - please specify ' + 'it with --initial-rev') + + dl_dir = rd.getVar('DL_DIR') + if not dl_dir.endswith('/'): + dl_dir += '/' + + tempdir = tempfile.mkdtemp(prefix='devtool') + try: + local_files_dir = tempfile.mkdtemp(dir=tempdir) + upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir) + + remove_files = [] + if not no_remove: + # Get all patches from source tree and check if any should be removed + all_patches_dir = tempfile.mkdtemp(dir=tempdir) + upd_p, new_p, del_p = _export_patches(srctree, rd, initial_rev, + all_patches_dir) + # Remove deleted local files and patches + remove_files = list(del_f.values()) + list(del_p.values()) + + # Get updated patches from source tree + patches_dir = tempfile.mkdtemp(dir=tempdir) + upd_p, new_p, del_p = _export_patches(srctree, rd, update_rev, + patches_dir, changed_revs) + updatefiles = False + updaterecipe = False + destpath = None + srcuri = (rd.getVar('SRC_URI', False) or '').split() + if appendlayerdir: + files = dict((os.path.join(local_files_dir, key), val) for + key, val in list(upd_f.items()) + list(new_f.items())) + files.update(dict((os.path.join(patches_dir, key), val) for + key, val in list(upd_p.items()) + list(new_p.items()))) + if files or remove_files: + removevalues = None + if remove_files: + removedentries, remaining = _remove_file_entries( + srcuri, remove_files) + if removedentries or remaining: + remaining = ['file://' + os.path.basename(item) for + item in remaining] + removevalues = {'SRC_URI': removedentries + remaining} + _, destpath = oe.recipeutils.bbappend_recipe( + rd, appendlayerdir, files, + wildcardver=wildcard_version, + removevalues=removevalues) + else: + logger.info('No patches or local source files needed updating') + else: + # Update existing files + files_dir = _determine_files_dir(rd) + for basepath, path in upd_f.items(): + logger.info('Updating file %s' % basepath) + if os.path.isabs(basepath): + # Original file (probably with subdir pointing inside source tree) + # so we do not want to move it, just copy + _copy_file(basepath, path) + else: + _move_file(os.path.join(local_files_dir, basepath), path) + updatefiles = True + for basepath, path in upd_p.items(): + patchfn = os.path.join(patches_dir, basepath) + if os.path.dirname(path) + '/' == dl_dir: + # This is a a downloaded patch file - we now need to + # replace the entry in SRC_URI with our local version + logger.info('Replacing remote patch %s with updated local version' % basepath) + path = os.path.join(files_dir, basepath) + _replace_srcuri_entry(srcuri, basepath, 'file://%s' % basepath) + updaterecipe = True + else: + logger.info('Updating patch %s' % basepath) + logger.debug('Moving new patch %s to %s' % (patchfn, path)) + _move_file(patchfn, path) + updatefiles = True + # Add any new files + for basepath, path in new_f.items(): + logger.info('Adding new file %s' % basepath) + _move_file(os.path.join(local_files_dir, basepath), + os.path.join(files_dir, basepath)) + srcuri.append('file://%s' % basepath) + updaterecipe = True + for basepath, path in new_p.items(): + logger.info('Adding new patch %s' % basepath) + _move_file(os.path.join(patches_dir, basepath), + os.path.join(files_dir, basepath)) + srcuri.append('file://%s' % basepath) + updaterecipe = True + # Update recipe, if needed + if _remove_file_entries(srcuri, remove_files)[0]: + updaterecipe = True + if updaterecipe: + logger.info('Updating recipe %s' % os.path.basename(recipefile)) + oe.recipeutils.patch_recipe(rd, recipefile, + {'SRC_URI': ' '.join(srcuri)}) + elif not updatefiles: + # Neither patches nor recipe were updated + logger.info('No patches or files need updating') + return False + finally: + shutil.rmtree(tempdir) + + _remove_source_files(appendlayerdir, remove_files, destpath) + return True + +def _guess_recipe_update_mode(srctree, rdata): + """Guess the recipe update mode to use""" + src_uri = (rdata.getVar('SRC_URI', False) or '').split() + git_uris = [uri for uri in src_uri if uri.startswith('git://')] + if not git_uris: + return 'patch' + # Just use the first URI for now + uri = git_uris[0] + # Check remote branch + params = bb.fetch.decodeurl(uri)[5] + upstr_branch = params['branch'] if 'branch' in params else 'master' + # Check if current branch HEAD is found in upstream branch + stdout, _ = bb.process.run('git rev-parse HEAD', cwd=srctree) + head_rev = stdout.rstrip() + stdout, _ = bb.process.run('git branch -r --contains %s' % head_rev, + cwd=srctree) + remote_brs = [branch.strip() for branch in stdout.splitlines()] + if 'origin/' + upstr_branch in remote_brs: + return 'srcrev' + + return 'patch' + +def _update_recipe(recipename, workspace, rd, mode, appendlayerdir, wildcard_version, no_remove, initial_rev): + srctree = workspace[recipename]['srctree'] + if mode == 'auto': + mode = _guess_recipe_update_mode(srctree, rd) + + if mode == 'srcrev': + updated = _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remove) + elif mode == 'patch': + updated = _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, initial_rev) + else: + raise DevtoolError('update_recipe: invalid mode %s' % mode) + return updated + +def update_recipe(args, config, basepath, workspace): + """Entry point for the devtool 'update-recipe' subcommand""" + check_workspace_recipe(workspace, args.recipename) + + if args.append: + if not os.path.exists(args.append): + raise DevtoolError('bbappend destination layer directory "%s" ' + 'does not exist' % args.append) + if not os.path.exists(os.path.join(args.append, 'conf', 'layer.conf')): + raise DevtoolError('conf/layer.conf not found in bbappend ' + 'destination layer "%s"' % args.append) + + tinfoil = setup_tinfoil(basepath=basepath, tracking=True) + try: + + rd = parse_recipe(config, tinfoil, args.recipename, True) + if not rd: + return 1 + + updated = _update_recipe(args.recipename, workspace, rd, args.mode, args.append, args.wildcard_version, args.no_remove, args.initial_rev) + + if updated: + rf = rd.getVar('FILE') + if rf.startswith(config.workspace_path): + logger.warn('Recipe file %s has been updated but is inside the workspace - you will need to move it (and any associated files next to it) out to the desired layer before using "devtool reset" in order to keep any changes' % rf) + finally: + tinfoil.shutdown() + + return 0 + + +def status(args, config, basepath, workspace): + """Entry point for the devtool 'status' subcommand""" + if workspace: + for recipe, value in workspace.items(): + recipefile = value['recipefile'] + if recipefile: + recipestr = ' (%s)' % recipefile + else: + recipestr = '' + print("%s: %s%s" % (recipe, value['srctree'], recipestr)) + else: + logger.info('No recipes currently in your workspace - you can use "devtool modify" to work on an existing recipe or "devtool add" to add a new one') + return 0 + + +def _reset(recipes, no_clean, config, basepath, workspace): + """Reset one or more recipes""" + + if recipes and not no_clean: + if len(recipes) == 1: + logger.info('Cleaning sysroot for recipe %s...' % recipes[0]) + else: + logger.info('Cleaning sysroot for recipes %s...' % ', '.join(recipes)) + # If the recipe file itself was created in the workspace, and + # it uses BBCLASSEXTEND, then we need to also clean the other + # variants + targets = [] + for recipe in recipes: + targets.append(recipe) + recipefile = workspace[recipe]['recipefile'] + if recipefile and os.path.exists(recipefile): + targets.extend(get_bbclassextend_targets(recipefile, recipe)) + try: + exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % ' '.join(targets)) + except bb.process.ExecutionError as e: + raise DevtoolError('Command \'%s\' failed, output:\n%s\nIf you ' + 'wish, you may specify -n/--no-clean to ' + 'skip running this command when resetting' % + (e.command, e.stdout)) + + for pn in recipes: + _check_preserve(config, pn) + + preservepath = os.path.join(config.workspace_path, 'attic', pn, pn) + def preservedir(origdir): + if os.path.exists(origdir): + for root, dirs, files in os.walk(origdir): + for fn in files: + logger.warn('Preserving %s in %s' % (fn, preservepath)) + _move_file(os.path.join(origdir, fn), + os.path.join(preservepath, fn)) + for dn in dirs: + preservedir(os.path.join(root, dn)) + os.rmdir(origdir) + + preservedir(os.path.join(config.workspace_path, 'recipes', pn)) + # We don't automatically create this dir next to appends, but the user can + preservedir(os.path.join(config.workspace_path, 'appends', pn)) + + srctree = workspace[pn]['srctree'] + if os.path.isdir(srctree): + if os.listdir(srctree): + # We don't want to risk wiping out any work in progress + logger.info('Leaving source tree %s as-is; if you no ' + 'longer need it then please delete it manually' + % srctree) + else: + # This is unlikely, but if it's empty we can just remove it + os.rmdir(srctree) + + +def reset(args, config, basepath, workspace): + """Entry point for the devtool 'reset' subcommand""" + import bb + if args.recipename: + if args.all: + raise DevtoolError("Recipe cannot be specified if -a/--all is used") + else: + for recipe in args.recipename: + check_workspace_recipe(workspace, recipe, checksrc=False) + elif not args.all: + raise DevtoolError("Recipe must be specified, or specify -a/--all to " + "reset all recipes") + if args.all: + recipes = list(workspace.keys()) + else: + recipes = args.recipename + + _reset(recipes, args.no_clean, config, basepath, workspace) + + return 0 + + +def _get_layer(layername, d): + """Determine the base layer path for the specified layer name/path""" + layerdirs = d.getVar('BBLAYERS').split() + layers = {os.path.basename(p): p for p in layerdirs} + # Provide some shortcuts + if layername.lower() in ['oe-core', 'openembedded-core']: + layerdir = layers.get('meta', None) + else: + layerdir = layers.get(layername, None) + if layerdir: + layerdir = os.path.abspath(layerdir) + return layerdir or layername + +def finish(args, config, basepath, workspace): + """Entry point for the devtool 'finish' subcommand""" + import bb + import oe.recipeutils + + check_workspace_recipe(workspace, args.recipename) + + no_clean = False + tinfoil = setup_tinfoil(basepath=basepath, tracking=True) + try: + rd = parse_recipe(config, tinfoil, args.recipename, True) + if not rd: + return 1 + + destlayerdir = _get_layer(args.destination, tinfoil.config_data) + origlayerdir = oe.recipeutils.find_layerdir(rd.getVar('FILE')) + + if not os.path.isdir(destlayerdir): + raise DevtoolError('Unable to find layer or directory matching "%s"' % args.destination) + + if os.path.abspath(destlayerdir) == config.workspace_path: + raise DevtoolError('"%s" specifies the workspace layer - that is not a valid destination' % args.destination) + + # If it's an upgrade, grab the original path + origpath = None + origfilelist = None + append = workspace[args.recipename]['bbappend'] + with open(append, 'r') as f: + for line in f: + if line.startswith('# original_path:'): + origpath = line.split(':')[1].strip() + elif line.startswith('# original_files:'): + origfilelist = line.split(':')[1].split() + + if origlayerdir == config.workspace_path: + # Recipe file itself is in workspace, update it there first + appendlayerdir = None + origrelpath = None + if origpath: + origlayerpath = oe.recipeutils.find_layerdir(origpath) + if origlayerpath: + origrelpath = os.path.relpath(origpath, origlayerpath) + destpath = oe.recipeutils.get_bbfile_path(rd, destlayerdir, origrelpath) + if not destpath: + raise DevtoolError("Unable to determine destination layer path - check that %s specifies an actual layer and %s/conf/layer.conf specifies BBFILES. You may also need to specify a more complete path." % (args.destination, destlayerdir)) + # Warn if the layer isn't in bblayers.conf (the code to create a bbappend will do this in other cases) + layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS').split()] + if not os.path.abspath(destlayerdir) in layerdirs: + bb.warn('Specified destination layer is not currently enabled in bblayers.conf, so the %s recipe will now be unavailable in your current configuration until you add the layer there' % args.recipename) + + elif destlayerdir == origlayerdir: + # Same layer, update the original recipe + appendlayerdir = None + destpath = None + else: + # Create/update a bbappend in the specified layer + appendlayerdir = destlayerdir + destpath = None + + # Remove any old files in the case of an upgrade + if origpath and origfilelist and oe.recipeutils.find_layerdir(origpath) == oe.recipeutils.find_layerdir(destlayerdir): + for fn in origfilelist: + fnp = os.path.join(origpath, fn) + try: + os.remove(fnp) + except FileNotFoundError: + pass + + # Actually update the recipe / bbappend + _update_recipe(args.recipename, workspace, rd, args.mode, appendlayerdir, wildcard_version=True, no_remove=False, initial_rev=args.initial_rev) + + if origlayerdir == config.workspace_path and destpath: + # Recipe file itself is in the workspace - need to move it and any + # associated files to the specified layer + no_clean = True + logger.info('Moving recipe file to %s' % destpath) + recipedir = os.path.dirname(rd.getVar('FILE')) + for root, _, files in os.walk(recipedir): + for fn in files: + srcpath = os.path.join(root, fn) + relpth = os.path.relpath(os.path.dirname(srcpath), recipedir) + destdir = os.path.abspath(os.path.join(destpath, relpth)) + bb.utils.mkdirhier(destdir) + shutil.move(srcpath, os.path.join(destdir, fn)) + + finally: + tinfoil.shutdown() + + # Everything else has succeeded, we can now reset + _reset([args.recipename], no_clean=no_clean, config=config, basepath=basepath, workspace=workspace) + + return 0 + + +def get_default_srctree(config, recipename=''): + """Get the default srctree path""" + srctreeparent = config.get('General', 'default_source_parent_dir', config.workspace_path) + if recipename: + return os.path.join(srctreeparent, 'sources', recipename) + else: + return os.path.join(srctreeparent, 'sources') + +def register_commands(subparsers, context): + """Register devtool subcommands from this plugin""" + + defsrctree = get_default_srctree(context.config) + parser_add = subparsers.add_parser('add', help='Add a new recipe', + description='Adds a new recipe to the workspace to build a specified source tree. Can optionally fetch a remote URI and unpack it to create the source tree.', + group='starting', order=100) + parser_add.add_argument('recipename', nargs='?', help='Name for new recipe to add (just name - no version, path or extension). If not specified, will attempt to auto-detect it.') + parser_add.add_argument('srctree', nargs='?', help='Path to external source tree. If not specified, a subdirectory of %s will be used.' % defsrctree) + parser_add.add_argument('fetchuri', nargs='?', help='Fetch the specified URI and extract it to create the source tree') + group = parser_add.add_mutually_exclusive_group() + group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") + group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") + parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create the source tree (deprecated - pass as positional argument instead)', metavar='URI') + parser_add.add_argument('--fetch-dev', help='For npm, also fetch devDependencies', action="store_true") + parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') + parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true") + parser_add.add_argument('--autorev', '-a', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true") + parser_add.add_argument('--binary', '-b', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure). Useful with binary packages e.g. RPMs.', action='store_true') + parser_add.add_argument('--also-native', help='Also add native variant (i.e. support building recipe for the build host as well as the target machine)', action='store_true') + parser_add.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR') + parser_add.set_defaults(func=add, fixed_setup=context.fixed_setup) + + parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe', + description='Sets up the build environment to modify the source for an existing recipe. The default behaviour is to extract the source being fetched by the recipe into a git tree so you can work on it; alternatively if you already have your own pre-prepared source tree you can specify -n/--no-extract.', + group='starting', order=90) + parser_modify.add_argument('recipename', help='Name of existing recipe to edit (just name - no version, path or extension)') + parser_modify.add_argument('srctree', nargs='?', help='Path to external source tree. If not specified, a subdirectory of %s will be used.' % defsrctree) + parser_modify.add_argument('--wildcard', '-w', action="store_true", help='Use wildcard for unversioned bbappend') + group = parser_modify.add_mutually_exclusive_group() + group.add_argument('--extract', '-x', action="store_true", help='Extract source for recipe (default)') + group.add_argument('--no-extract', '-n', action="store_true", help='Do not extract source, expect it to exist') + group = parser_modify.add_mutually_exclusive_group() + group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") + group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") + parser_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (when not using -n/--no-extract) (default "%(default)s")') + parser_modify.add_argument('--keep-temp', help='Keep temporary directory (for debugging)', action="store_true") + parser_modify.set_defaults(func=modify) + + parser_extract = subparsers.add_parser('extract', help='Extract the source for an existing recipe', + description='Extracts the source for an existing recipe', + group='advanced') + parser_extract.add_argument('recipename', help='Name of recipe to extract the source for') + parser_extract.add_argument('srctree', help='Path to where to extract the source tree') + parser_extract.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (default "%(default)s")') + parser_extract.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') + parser_extract.set_defaults(func=extract, no_workspace=True) + + parser_sync = subparsers.add_parser('sync', help='Synchronize the source tree for an existing recipe', + description='Synchronize the previously extracted source tree for an existing recipe', + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + group='advanced') + parser_sync.add_argument('recipename', help='Name of recipe to sync the source for') + parser_sync.add_argument('srctree', help='Path to the source tree') + parser_sync.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout') + parser_sync.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') + parser_sync.set_defaults(func=sync) + + parser_rename = subparsers.add_parser('rename', help='Rename a recipe file in the workspace', + description='Renames the recipe file for a recipe in the workspace, changing the name or version part or both, ensuring that all references within the workspace are updated at the same time. Only works when the recipe file itself is in the workspace, e.g. after devtool add. Particularly useful when devtool add did not automatically determine the correct name.', + group='working', order=10) + parser_rename.add_argument('recipename', help='Current name of recipe to rename') + parser_rename.add_argument('newname', nargs='?', help='New name for recipe (optional, not needed if you only want to change the version)') + parser_rename.add_argument('--version', '-V', help='Change the version (NOTE: this does not change the version fetched by the recipe, just the version in the recipe file name)') + parser_rename.add_argument('--no-srctree', '-s', action='store_true', help='Do not rename the source tree directory (if the default source tree path has been used) - keeping the old name may be desirable if there are internal/other external references to this path') + parser_rename.set_defaults(func=rename) + + parser_update_recipe = subparsers.add_parser('update-recipe', help='Apply changes from external source tree to recipe', + description='Applies changes from external source tree to a recipe (updating/adding/removing patches as necessary, or by updating SRCREV). Note that these changes need to have been committed to the git repository in order to be recognised.', + group='working', order=-90) + parser_update_recipe.add_argument('recipename', help='Name of recipe to update') + parser_update_recipe.add_argument('--mode', '-m', choices=['patch', 'srcrev', 'auto'], default='auto', help='Update mode (where %(metavar)s is %(choices)s; default is %(default)s)', metavar='MODE') + parser_update_recipe.add_argument('--initial-rev', help='Override starting revision for patches') + parser_update_recipe.add_argument('--append', '-a', help='Write changes to a bbappend in the specified layer instead of the recipe', metavar='LAYERDIR') + parser_update_recipe.add_argument('--wildcard-version', '-w', help='In conjunction with -a/--append, use a wildcard to make the bbappend apply to any recipe version', action='store_true') + parser_update_recipe.add_argument('--no-remove', '-n', action="store_true", help='Don\'t remove patches, only add or update') + parser_update_recipe.set_defaults(func=update_recipe) + + parser_status = subparsers.add_parser('status', help='Show workspace status', + description='Lists recipes currently in your workspace and the paths to their respective external source trees', + group='info', order=100) + parser_status.set_defaults(func=status) + + parser_reset = subparsers.add_parser('reset', help='Remove a recipe from your workspace', + description='Removes the specified recipe(s) from your workspace (resetting its state back to that defined by the metadata).', + group='working', order=-100) + parser_reset.add_argument('recipename', nargs='*', help='Recipe to reset') + parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all recipes (clear workspace)') + parser_reset.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output') + parser_reset.set_defaults(func=reset) + + parser_finish = subparsers.add_parser('finish', help='Finish working on a recipe in your workspace', + description='Pushes any committed changes to the specified recipe to the specified layer and removes it from your workspace. Roughly equivalent to an update-recipe followed by reset, except the update-recipe step will do the "right thing" depending on the recipe and the destination layer specified.', + group='working', order=-100) + parser_finish.add_argument('recipename', help='Recipe to finish') + parser_finish.add_argument('destination', help='Layer/path to put recipe into. Can be the name of a layer configured in your bblayers.conf, the path to the base of a layer, or a partial path inside a layer. %(prog)s will attempt to complete the path based on the layer\'s structure.') + parser_finish.add_argument('--mode', '-m', choices=['patch', 'srcrev', 'auto'], default='auto', help='Update mode (where %(metavar)s is %(choices)s; default is %(default)s)', metavar='MODE') + parser_finish.add_argument('--initial-rev', help='Override starting revision for patches') + parser_finish.set_defaults(func=finish) diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py new file mode 100644 index 0000000000..05fb9e5ed0 --- /dev/null +++ b/scripts/lib/devtool/upgrade.py @@ -0,0 +1,409 @@ +# Development tool - upgrade command plugin +# +# Copyright (C) 2014-2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +"""Devtool upgrade plugin""" + +import os +import sys +import re +import shutil +import tempfile +import logging +import argparse +import scriptutils +import errno +import bb + +devtool_path = os.path.dirname(os.path.realpath(__file__)) + '/../../../meta/lib' +sys.path = sys.path + [devtool_path] + +import oe.recipeutils +from devtool import standard +from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build + +logger = logging.getLogger('devtool') + +def _run(cmd, cwd=''): + logger.debug("Running command %s> %s" % (cwd,cmd)) + return bb.process.run('%s' % cmd, cwd=cwd) + +def _get_srctree(tmpdir): + srctree = tmpdir + dirs = os.listdir(tmpdir) + if len(dirs) == 1: + srctree = os.path.join(tmpdir, dirs[0]) + return srctree + +def _copy_source_code(orig, dest): + for path in standard._ls_tree(orig): + dest_dir = os.path.join(dest, os.path.dirname(path)) + bb.utils.mkdirhier(dest_dir) + dest_path = os.path.join(dest, path) + shutil.move(os.path.join(orig, path), dest_path) + +def _get_checksums(rf): + import re + checksums = {} + with open(rf) as f: + for line in f: + for cs in ['md5sum', 'sha256sum']: + m = re.match("^SRC_URI\[%s\].*=.*\"(.*)\"" % cs, line) + if m: + checksums[cs] = m.group(1) + return checksums + +def _remove_patch_dirs(recipefolder): + for root, dirs, files in os.walk(recipefolder): + for d in dirs: + shutil.rmtree(os.path.join(root,d)) + +def _recipe_contains(rd, var): + rf = rd.getVar('FILE') + varfiles = oe.recipeutils.get_var_files(rf, [var], rd) + for var, fn in varfiles.items(): + if fn and fn.startswith(os.path.dirname(rf) + os.sep): + return True + return False + +def _rename_recipe_dirs(oldpv, newpv, path): + for root, dirs, files in os.walk(path): + # Rename directories with the version in their name + for olddir in dirs: + if olddir.find(oldpv) != -1: + newdir = olddir.replace(oldpv, newpv) + if olddir != newdir: + shutil.move(os.path.join(path, olddir), os.path.join(path, newdir)) + # Rename any inc files with the version in their name (unusual, but possible) + for oldfile in files: + if oldfile.endswith('.inc'): + if oldfile.find(oldpv) != -1: + newfile = oldfile.replace(oldpv, newpv) + if oldfile != newfile: + os.rename(os.path.join(path, oldfile), os.path.join(path, newfile)) + +def _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path): + oldrecipe = os.path.basename(oldrecipe) + if oldrecipe.endswith('_%s.bb' % oldpv): + newrecipe = '%s_%s.bb' % (bpn, newpv) + if oldrecipe != newrecipe: + shutil.move(os.path.join(path, oldrecipe), os.path.join(path, newrecipe)) + else: + newrecipe = oldrecipe + return os.path.join(path, newrecipe) + +def _rename_recipe_files(oldrecipe, bpn, oldpv, newpv, path): + _rename_recipe_dirs(oldpv, newpv, path) + return _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path) + +def _write_append(rc, srctree, same_dir, no_same_dir, rev, copied, workspace, d): + """Writes an append file""" + if not os.path.exists(rc): + raise DevtoolError("bbappend not created because %s does not exist" % rc) + + appendpath = os.path.join(workspace, 'appends') + if not os.path.exists(appendpath): + bb.utils.mkdirhier(appendpath) + + brf = os.path.basename(os.path.splitext(rc)[0]) # rc basename + + srctree = os.path.abspath(srctree) + pn = d.getVar('PN') + af = os.path.join(appendpath, '%s.bbappend' % brf) + with open(af, 'w') as f: + f.write('FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n\n') + f.write('inherit externalsrc\n') + f.write(('# NOTE: We use pn- overrides here to avoid affecting' + 'multiple variants in the case where the recipe uses BBCLASSEXTEND\n')) + f.write('EXTERNALSRC_pn-%s = "%s"\n' % (pn, srctree)) + b_is_s = use_external_build(same_dir, no_same_dir, d) + if b_is_s: + f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (pn, srctree)) + f.write('\n') + if rev: + f.write('# initial_rev: %s\n' % rev) + if copied: + f.write('# original_path: %s\n' % os.path.dirname(d.getVar('FILE'))) + f.write('# original_files: %s\n' % ' '.join(copied)) + return af + +def _cleanup_on_error(rf, srctree): + rfp = os.path.split(rf)[0] # recipe folder + rfpp = os.path.split(rfp)[0] # recipes folder + if os.path.exists(rfp): + shutil.rmtree(b) + if not len(os.listdir(rfpp)): + os.rmdir(rfpp) + srctree = os.path.abspath(srctree) + if os.path.exists(srctree): + shutil.rmtree(srctree) + +def _upgrade_error(e, rf, srctree): + if rf: + cleanup_on_error(rf, srctree) + logger.error(e) + raise DevtoolError(e) + +def _get_uri(rd): + srcuris = rd.getVar('SRC_URI').split() + if not len(srcuris): + raise DevtoolError('SRC_URI not found on recipe') + # Get first non-local entry in SRC_URI - usually by convention it's + # the first entry, but not always! + srcuri = None + for entry in srcuris: + if not entry.startswith('file://'): + srcuri = entry + break + if not srcuri: + raise DevtoolError('Unable to find non-local entry in SRC_URI') + srcrev = '${AUTOREV}' + if '://' in srcuri: + # Fetch a URL + rev_re = re.compile(';rev=([^;]+)') + res = rev_re.search(srcuri) + if res: + srcrev = res.group(1) + srcuri = rev_re.sub('', srcuri) + return srcuri, srcrev + +def _extract_new_source(newpv, srctree, no_patch, srcrev, branch, keep_temp, tinfoil, rd): + """Extract sources of a recipe with a new version""" + + def __run(cmd): + """Simple wrapper which calls _run with srctree as cwd""" + return _run(cmd, srctree) + + crd = rd.createCopy() + + pv = crd.getVar('PV') + crd.setVar('PV', newpv) + + tmpsrctree = None + uri, rev = _get_uri(crd) + if srcrev: + rev = srcrev + if uri.startswith('git://'): + __run('git fetch') + __run('git checkout %s' % rev) + __run('git tag -f devtool-base-new') + md5 = None + sha256 = None + else: + __run('git checkout devtool-base -b devtool-%s' % newpv) + + tmpdir = tempfile.mkdtemp(prefix='devtool') + try: + md5, sha256 = scriptutils.fetch_uri(tinfoil.config_data, uri, tmpdir, rev) + except bb.fetch2.FetchError as e: + raise DevtoolError(e) + + tmpsrctree = _get_srctree(tmpdir) + srctree = os.path.abspath(srctree) + + # Delete all sources so we ensure no stray files are left over + for item in os.listdir(srctree): + if item in ['.git', 'oe-local-files']: + continue + itempath = os.path.join(srctree, item) + if os.path.isdir(itempath): + shutil.rmtree(itempath) + else: + os.remove(itempath) + + # Copy in new ones + _copy_source_code(tmpsrctree, srctree) + + (stdout,_) = __run('git ls-files --modified --others --exclude-standard') + for f in stdout.splitlines(): + __run('git add "%s"' % f) + + useroptions = [] + oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=rd) + __run('git %s commit -q -m "Commit of upstream changes at version %s" --allow-empty' % (' '.join(useroptions), newpv)) + __run('git tag -f devtool-base-%s' % newpv) + + (stdout, _) = __run('git rev-parse HEAD') + rev = stdout.rstrip() + + if no_patch: + patches = oe.recipeutils.get_recipe_patches(crd) + if len(patches): + logger.warn('By user choice, the following patches will NOT be applied') + for patch in patches: + logger.warn("%s" % os.path.basename(patch)) + else: + __run('git checkout devtool-patched -b %s' % branch) + skiptag = False + try: + __run('git rebase %s' % rev) + except bb.process.ExecutionError as e: + skiptag = True + if 'conflict' in e.stdout: + logger.warn('Command \'%s\' failed:\n%s\n\nYou will need to resolve conflicts in order to complete the upgrade.' % (e.command, e.stdout.rstrip())) + else: + logger.warn('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) + if not skiptag: + if uri.startswith('git://'): + suffix = 'new' + else: + suffix = newpv + __run('git tag -f devtool-patched-%s' % suffix) + + if tmpsrctree: + if keep_temp: + logger.info('Preserving temporary directory %s' % tmpsrctree) + else: + shutil.rmtree(tmpsrctree) + + return (rev, md5, sha256) + +def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil, rd): + """Creates the new recipe under workspace""" + + bpn = rd.getVar('BPN') + path = os.path.join(workspace, 'recipes', bpn) + bb.utils.mkdirhier(path) + copied, _ = oe.recipeutils.copy_recipe_files(rd, path) + + oldpv = rd.getVar('PV') + if not newpv: + newpv = oldpv + origpath = rd.getVar('FILE') + fullpath = _rename_recipe_files(origpath, bpn, oldpv, newpv, path) + logger.debug('Upgraded %s => %s' % (origpath, fullpath)) + + newvalues = {} + if _recipe_contains(rd, 'PV') and newpv != oldpv: + newvalues['PV'] = newpv + + if srcrev: + newvalues['SRCREV'] = srcrev + + if srcbranch: + src_uri = oe.recipeutils.split_var_value(rd.getVar('SRC_URI', False) or '') + changed = False + replacing = True + new_src_uri = [] + for entry in src_uri: + scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(entry) + if replacing and scheme in ['git', 'gitsm']: + branch = params.get('branch', 'master') + if rd.expand(branch) != srcbranch: + # Handle case where branch is set through a variable + res = re.match(r'\$\{([^}@]+)\}', branch) + if res: + newvalues[res.group(1)] = srcbranch + # We know we won't change SRC_URI now, so break out + break + else: + params['branch'] = srcbranch + entry = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params)) + changed = True + replacing = False + new_src_uri.append(entry) + if changed: + newvalues['SRC_URI'] = ' '.join(new_src_uri) + + newvalues['PR'] = None + + if md5 and sha256: + newvalues['SRC_URI[md5sum]'] = md5 + newvalues['SRC_URI[sha256sum]'] = sha256 + + rd = tinfoil.parse_recipe_file(fullpath, False) + oe.recipeutils.patch_recipe(rd, fullpath, newvalues) + + return fullpath, copied + +def upgrade(args, config, basepath, workspace): + """Entry point for the devtool 'upgrade' subcommand""" + + if args.recipename in workspace: + raise DevtoolError("recipe %s is already in your workspace" % args.recipename) + if not args.version and not args.srcrev: + raise DevtoolError("You must provide a version using the --version/-V option, or for recipes that fetch from an SCM such as git, the --srcrev/-S option") + if args.srcbranch and not args.srcrev: + raise DevtoolError("If you specify --srcbranch/-B then you must use --srcrev/-S to specify the revision" % args.recipename) + + tinfoil = setup_tinfoil(basepath=basepath, tracking=True) + try: + rd = parse_recipe(config, tinfoil, args.recipename, True) + if not rd: + return 1 + + pn = rd.getVar('PN') + if pn != args.recipename: + logger.info('Mapping %s to %s' % (args.recipename, pn)) + if pn in workspace: + raise DevtoolError("recipe %s is already in your workspace" % pn) + + if args.srctree: + srctree = os.path.abspath(args.srctree) + else: + srctree = standard.get_default_srctree(config, pn) + + standard._check_compatible_recipe(pn, rd) + old_srcrev = rd.getVar('SRCREV') + if old_srcrev == 'INVALID': + old_srcrev = None + if old_srcrev and not args.srcrev: + raise DevtoolError("Recipe specifies a SRCREV value; you must specify a new one when upgrading") + if rd.getVar('PV') == args.version and old_srcrev == args.srcrev: + raise DevtoolError("Current and upgrade versions are the same version") + + rf = None + try: + rev1 = standard._extract_source(srctree, False, 'devtool-orig', False, rd, tinfoil) + rev2, md5, sha256 = _extract_new_source(args.version, srctree, args.no_patch, + args.srcrev, args.branch, args.keep_temp, + tinfoil, rd) + rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd) + except bb.process.CmdError as e: + _upgrade_error(e, rf, srctree) + except DevtoolError as e: + _upgrade_error(e, rf, srctree) + standard._add_md5(config, pn, os.path.dirname(rf)) + + af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2, + copied, config.workspace_path, rd) + standard._add_md5(config, pn, af) + logger.info('Upgraded source extracted to %s' % srctree) + logger.info('New recipe is %s' % rf) + finally: + tinfoil.shutdown() + return 0 + +def register_commands(subparsers, context): + """Register devtool subcommands from this plugin""" + + defsrctree = standard.get_default_srctree(context.config) + + parser_upgrade = subparsers.add_parser('upgrade', help='Upgrade an existing recipe', + description='Upgrades an existing recipe to a new upstream version. Puts the upgraded recipe file into the workspace along with any associated files, and extracts the source tree to a specified location (in case patches need rebasing or adding to as a result of the upgrade).', + group='starting') + parser_upgrade.add_argument('recipename', help='Name of recipe to upgrade (just name - no version, path or extension)') + parser_upgrade.add_argument('srctree', nargs='?', help='Path to where to extract the source tree. If not specified, a subdirectory of %s will be used.' % defsrctree) + parser_upgrade.add_argument('--version', '-V', help='Version to upgrade to (PV)') + parser_upgrade.add_argument('--srcrev', '-S', help='Source revision to upgrade to (required if fetching from an SCM such as git)') + parser_upgrade.add_argument('--srcbranch', '-B', help='Branch in source repository containing the revision to use (if fetching from an SCM such as git)') + parser_upgrade.add_argument('--branch', '-b', default="devtool", help='Name for new development branch to checkout (default "%(default)s")') + parser_upgrade.add_argument('--no-patch', action="store_true", help='Do not apply patches from the recipe to the new source code') + group = parser_upgrade.add_mutually_exclusive_group() + group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") + group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") + parser_upgrade.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') + parser_upgrade.set_defaults(func=upgrade) diff --git a/scripts/lib/devtool/utilcmds.py b/scripts/lib/devtool/utilcmds.py new file mode 100644 index 0000000000..0437e6417c --- /dev/null +++ b/scripts/lib/devtool/utilcmds.py @@ -0,0 +1,233 @@ +# Development tool - utility commands plugin +# +# Copyright (C) 2015-2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +"""Devtool utility plugins""" + +import os +import sys +import shutil +import tempfile +import logging +import argparse +import subprocess +import scriptutils +from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError +from devtool import parse_recipe + +logger = logging.getLogger('devtool') + + +def edit_recipe(args, config, basepath, workspace): + """Entry point for the devtool 'edit-recipe' subcommand""" + if args.any_recipe: + tinfoil = setup_tinfoil(config_only=False, basepath=basepath) + try: + rd = parse_recipe(config, tinfoil, args.recipename, True) + if not rd: + return 1 + recipefile = rd.getVar('FILE') + finally: + tinfoil.shutdown() + else: + check_workspace_recipe(workspace, args.recipename) + recipefile = workspace[args.recipename]['recipefile'] + if not recipefile: + raise DevtoolError("Recipe file for %s is not under the workspace" % + args.recipename) + + return scriptutils.run_editor(recipefile) + + +def configure_help(args, config, basepath, workspace): + """Entry point for the devtool 'configure-help' subcommand""" + import oe.utils + + check_workspace_recipe(workspace, args.recipename) + tinfoil = setup_tinfoil(config_only=False, basepath=basepath) + try: + rd = parse_recipe(config, tinfoil, args.recipename, appends=True, filter_workspace=False) + if not rd: + return 1 + b = rd.getVar('B') + s = rd.getVar('S') + configurescript = os.path.join(s, 'configure') + confdisabled = 'noexec' in rd.getVarFlags('do_configure') or 'do_configure' not in (rd.getVar('__BBTASKS', False) or []) + configureopts = oe.utils.squashspaces(rd.getVar('CONFIGUREOPTS') or '') + extra_oeconf = oe.utils.squashspaces(rd.getVar('EXTRA_OECONF') or '') + extra_oecmake = oe.utils.squashspaces(rd.getVar('EXTRA_OECMAKE') or '') + do_configure = rd.getVar('do_configure') or '' + do_configure_noexpand = rd.getVar('do_configure', False) or '' + packageconfig = rd.getVarFlags('PACKAGECONFIG') or [] + autotools = bb.data.inherits_class('autotools', rd) and ('oe_runconf' in do_configure or 'autotools_do_configure' in do_configure) + cmake = bb.data.inherits_class('cmake', rd) and ('cmake_do_configure' in do_configure) + cmake_do_configure = rd.getVar('cmake_do_configure') + pn = rd.getVar('PN') + finally: + tinfoil.shutdown() + + if 'doc' in packageconfig: + del packageconfig['doc'] + + if autotools and not os.path.exists(configurescript): + logger.info('Running do_configure to generate configure script') + try: + stdout, _ = exec_build_env_command(config.init_path, basepath, + 'bitbake -c configure %s' % args.recipename, + stderr=subprocess.STDOUT) + except bb.process.ExecutionError: + pass + + if confdisabled or do_configure.strip() in ('', ':'): + raise DevtoolError("do_configure task has been disabled for this recipe") + elif args.no_pager and not os.path.exists(configurescript): + raise DevtoolError("No configure script found and no other information to display") + else: + configopttext = '' + if autotools and configureopts: + configopttext = ''' +Arguments currently passed to the configure script: + +%s + +Some of those are fixed.''' % (configureopts + ' ' + extra_oeconf) + if extra_oeconf: + configopttext += ''' The ones that are specified through EXTRA_OECONF (which you can change or add to easily): + +%s''' % extra_oeconf + + elif cmake: + in_cmake = False + cmake_cmd = '' + for line in cmake_do_configure.splitlines(): + if in_cmake: + cmake_cmd = cmake_cmd + ' ' + line.strip().rstrip('\\') + if not line.endswith('\\'): + break + if line.lstrip().startswith('cmake '): + cmake_cmd = line.strip().rstrip('\\') + if line.endswith('\\'): + in_cmake = True + else: + break + if cmake_cmd: + configopttext = ''' +The current cmake command line: + +%s + +Arguments specified through EXTRA_OECMAKE (which you can change or add to easily) + +%s''' % (oe.utils.squashspaces(cmake_cmd), extra_oecmake) + else: + configopttext = ''' +The current implementation of cmake_do_configure: + +cmake_do_configure() { +%s +} + +Arguments specified through EXTRA_OECMAKE (which you can change or add to easily) + +%s''' % (cmake_do_configure.rstrip(), extra_oecmake) + + elif do_configure: + configopttext = ''' +The current implementation of do_configure: + +do_configure() { +%s +}''' % do_configure.rstrip() + if '${EXTRA_OECONF}' in do_configure_noexpand: + configopttext += ''' + +Arguments specified through EXTRA_OECONF (which you can change or add to easily): + +%s''' % extra_oeconf + + if packageconfig: + configopttext += ''' + +Some of these options may be controlled through PACKAGECONFIG; for more details please see the recipe.''' + + if args.arg: + helpargs = ' '.join(args.arg) + elif cmake: + helpargs = '-LH' + else: + helpargs = '--help' + + msg = '''configure information for %s +------------------------------------------ +%s''' % (pn, configopttext) + + if cmake: + msg += ''' + +The cmake %s output for %s follows. After "-- Cache values" you should see a list of variables you can add to EXTRA_OECMAKE (prefixed with -D and suffixed with = followed by the desired value, without any spaces). +------------------------------------------''' % (helpargs, pn) + elif os.path.exists(configurescript): + msg += ''' + +The ./configure %s output for %s follows. +------------------------------------------''' % (helpargs, pn) + + olddir = os.getcwd() + tmppath = tempfile.mkdtemp() + with tempfile.NamedTemporaryFile('w', delete=False) as tf: + if not args.no_header: + tf.write(msg + '\n') + tf.close() + try: + try: + cmd = 'cat %s' % tf.name + if cmake: + cmd += '; cmake %s %s 2>&1' % (helpargs, s) + os.chdir(b) + elif os.path.exists(configurescript): + cmd += '; %s %s' % (configurescript, helpargs) + if sys.stdout.isatty() and not args.no_pager: + pager = os.environ.get('PAGER', 'less') + cmd = '(%s) | %s' % (cmd, pager) + subprocess.check_call(cmd, shell=True) + except subprocess.CalledProcessError as e: + return e.returncode + finally: + os.chdir(olddir) + shutil.rmtree(tmppath) + os.remove(tf.name) + + +def register_commands(subparsers, context): + """Register devtool subcommands from this plugin""" + parser_edit_recipe = subparsers.add_parser('edit-recipe', help='Edit a recipe file in your workspace', + description='Runs the default editor (as specified by the EDITOR variable) on the specified recipe. Note that the recipe file itself must be in the workspace (i.e. as a result of "devtool add" or "devtool upgrade"); you can override this with the -a/--any-recipe option.', + group='working') + parser_edit_recipe.add_argument('recipename', help='Recipe to edit') + parser_edit_recipe.add_argument('--any-recipe', '-a', action="store_true", help='Edit any recipe, not just where the recipe file itself is in the workspace') + parser_edit_recipe.set_defaults(func=edit_recipe) + + # NOTE: Needed to override the usage string here since the default + # gets the order wrong - recipename must come before --arg + parser_configure_help = subparsers.add_parser('configure-help', help='Get help on configure script options', + usage='devtool configure-help [options] recipename [--arg ...]', + description='Displays the help for the configure script for the specified recipe (i.e. runs ./configure --help) prefaced by a header describing the current options being specified. Output is piped through less (or whatever PAGER is set to, if set) for easy browsing.', + group='working') + parser_configure_help.add_argument('recipename', help='Recipe to show configure help for') + parser_configure_help.add_argument('-p', '--no-pager', help='Disable paged output', action="store_true") + parser_configure_help.add_argument('-n', '--no-header', help='Disable explanatory header text', action="store_true") + parser_configure_help.add_argument('--arg', help='Pass remaining arguments to the configure script instead of --help (useful if the script has additional help options)', nargs=argparse.REMAINDER) + parser_configure_help.set_defaults(func=configure_help) diff --git a/scripts/lib/recipetool/__init__.py b/scripts/lib/recipetool/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/scripts/lib/recipetool/__init__.py diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py new file mode 100644 index 0000000000..69c8bb77a0 --- /dev/null +++ b/scripts/lib/recipetool/append.py @@ -0,0 +1,457 @@ +# Recipe creation tool - append plugin +# +# Copyright (C) 2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import os +import argparse +import glob +import fnmatch +import re +import subprocess +import logging +import stat +import shutil +import scriptutils +import errno +from collections import defaultdict + +logger = logging.getLogger('recipetool') + +tinfoil = None + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + + +# FIXME guessing when we don't have pkgdata? +# FIXME mode to create patch rather than directly substitute + +class InvalidTargetFileError(Exception): + pass + +def find_target_file(targetpath, d, pkglist=None): + """Find the recipe installing the specified target path, optionally limited to a select list of packages""" + import json + + pkgdata_dir = d.getVar('PKGDATA_DIR') + + # The mix between /etc and ${sysconfdir} here may look odd, but it is just + # being consistent with usage elsewhere + invalidtargets = {'${sysconfdir}/version': '${sysconfdir}/version is written out at image creation time', + '/etc/timestamp': '/etc/timestamp is written out at image creation time', + '/dev/*': '/dev is handled by udev (or equivalent) and the kernel (devtmpfs)', + '/etc/passwd': '/etc/passwd should be managed through the useradd and extrausers classes', + '/etc/group': '/etc/group should be managed through the useradd and extrausers classes', + '/etc/shadow': '/etc/shadow should be managed through the useradd and extrausers classes', + '/etc/gshadow': '/etc/gshadow should be managed through the useradd and extrausers classes', + '${sysconfdir}/hostname': '${sysconfdir}/hostname contents should be set by setting hostname_pn-base-files = "value" in configuration',} + + for pthspec, message in invalidtargets.items(): + if fnmatch.fnmatchcase(targetpath, d.expand(pthspec)): + raise InvalidTargetFileError(d.expand(message)) + + targetpath_re = re.compile(r'\s+(\$D)?%s(\s|$)' % targetpath) + + recipes = defaultdict(list) + for root, dirs, files in os.walk(os.path.join(pkgdata_dir, 'runtime')): + if pkglist: + filelist = pkglist + else: + filelist = files + for fn in filelist: + pkgdatafile = os.path.join(root, fn) + if pkglist and not os.path.exists(pkgdatafile): + continue + with open(pkgdatafile, 'r') as f: + pn = '' + # This does assume that PN comes before other values, but that's a fairly safe assumption + for line in f: + if line.startswith('PN:'): + pn = line.split(':', 1)[1].strip() + elif line.startswith('FILES_INFO:'): + val = line.split(':', 1)[1].strip() + dictval = json.loads(val) + for fullpth in dictval.keys(): + if fnmatch.fnmatchcase(fullpth, targetpath): + recipes[targetpath].append(pn) + elif line.startswith('pkg_preinst_') or line.startswith('pkg_postinst_'): + scriptval = line.split(':', 1)[1].strip().encode('utf-8').decode('unicode_escape') + if 'update-alternatives --install %s ' % targetpath in scriptval: + recipes[targetpath].append('?%s' % pn) + elif targetpath_re.search(scriptval): + recipes[targetpath].append('!%s' % pn) + return recipes + +def _parse_recipe(pn, tinfoil): + try: + rd = tinfoil.parse_recipe(pn) + except bb.providers.NoProvider as e: + logger.error(str(e)) + return None + return rd + +def determine_file_source(targetpath, rd): + """Assuming we know a file came from a specific recipe, figure out exactly where it came from""" + import oe.recipeutils + + # See if it's in do_install for the recipe + workdir = rd.getVar('WORKDIR') + src_uri = rd.getVar('SRC_URI') + srcfile = '' + modpatches = [] + elements = check_do_install(rd, targetpath) + if elements: + logger.debug('do_install line:\n%s' % ' '.join(elements)) + srcpath = get_source_path(elements) + logger.debug('source path: %s' % srcpath) + if not srcpath.startswith('/'): + # Handle non-absolute path + srcpath = os.path.abspath(os.path.join(rd.getVarFlag('do_install', 'dirs').split()[-1], srcpath)) + if srcpath.startswith(workdir): + # OK, now we have the source file name, look for it in SRC_URI + workdirfile = os.path.relpath(srcpath, workdir) + # FIXME this is where we ought to have some code in the fetcher, because this is naive + for item in src_uri.split(): + localpath = bb.fetch2.localpath(item, rd) + # Source path specified in do_install might be a glob + if fnmatch.fnmatch(os.path.basename(localpath), workdirfile): + srcfile = 'file://%s' % localpath + elif '/' in workdirfile: + if item == 'file://%s' % workdirfile: + srcfile = 'file://%s' % localpath + + # Check patches + srcpatches = [] + patchedfiles = oe.recipeutils.get_recipe_patched_files(rd) + for patch, filelist in patchedfiles.items(): + for fileitem in filelist: + if fileitem[0] == srcpath: + srcpatches.append((patch, fileitem[1])) + if srcpatches: + addpatch = None + for patch in srcpatches: + if patch[1] == 'A': + addpatch = patch[0] + else: + modpatches.append(patch[0]) + if addpatch: + srcfile = 'patch://%s' % addpatch + + return (srcfile, elements, modpatches) + +def get_source_path(cmdelements): + """Find the source path specified within a command""" + command = cmdelements[0] + if command in ['install', 'cp']: + helptext = subprocess.check_output('LC_ALL=C %s --help' % command, shell=True).decode('utf-8') + argopts = '' + argopt_line_re = re.compile('^-([a-zA-Z0-9]), --[a-z-]+=') + for line in helptext.splitlines(): + line = line.lstrip() + res = argopt_line_re.search(line) + if res: + argopts += res.group(1) + if not argopts: + # Fallback + if command == 'install': + argopts = 'gmoSt' + elif command == 'cp': + argopts = 't' + else: + raise Exception('No fallback arguments for command %s' % command) + + skipnext = False + for elem in cmdelements[1:-1]: + if elem.startswith('-'): + if len(elem) > 1 and elem[1] in argopts: + skipnext = True + continue + if skipnext: + skipnext = False + continue + return elem + else: + raise Exception('get_source_path: no handling for command "%s"') + +def get_func_deps(func, d): + """Find the function dependencies of a shell function""" + deps = bb.codeparser.ShellParser(func, logger).parse_shell(d.getVar(func)) + deps |= set((d.getVarFlag(func, "vardeps") or "").split()) + funcdeps = [] + for dep in deps: + if d.getVarFlag(dep, 'func'): + funcdeps.append(dep) + return funcdeps + +def check_do_install(rd, targetpath): + """Look at do_install for a command that installs/copies the specified target path""" + instpath = os.path.abspath(os.path.join(rd.getVar('D'), targetpath.lstrip('/'))) + do_install = rd.getVar('do_install') + # Handle where do_install calls other functions (somewhat crudely, but good enough for this purpose) + deps = get_func_deps('do_install', rd) + for dep in deps: + do_install = do_install.replace(dep, rd.getVar(dep)) + + # Look backwards through do_install as we want to catch where a later line (perhaps + # from a bbappend) is writing over the top + for line in reversed(do_install.splitlines()): + line = line.strip() + if (line.startswith('install ') and ' -m' in line) or line.startswith('cp '): + elements = line.split() + destpath = os.path.abspath(elements[-1]) + if destpath == instpath: + return elements + elif destpath.rstrip('/') == os.path.dirname(instpath): + # FIXME this doesn't take recursive copy into account; unsure if it's practical to do so + srcpath = get_source_path(elements) + if fnmatch.fnmatchcase(os.path.basename(instpath), os.path.basename(srcpath)): + return elements + return None + + +def appendfile(args): + import oe.recipeutils + + stdout = '' + try: + (stdout, _) = bb.process.run('LANG=C file -b %s' % args.newfile, shell=True) + if 'cannot open' in stdout: + raise bb.process.ExecutionError(stdout) + except bb.process.ExecutionError as err: + logger.debug('file command returned error: %s' % err) + stdout = '' + if stdout: + logger.debug('file command output: %s' % stdout.rstrip()) + if ('executable' in stdout and not 'shell script' in stdout) or 'shared object' in stdout: + logger.warn('This file looks like it is a binary or otherwise the output of compilation. If it is, you should consider building it properly instead of substituting a binary file directly.') + + if args.recipe: + recipes = {args.targetpath: [args.recipe],} + else: + try: + recipes = find_target_file(args.targetpath, tinfoil.config_data) + except InvalidTargetFileError as e: + logger.error('%s cannot be handled by this tool: %s' % (args.targetpath, e)) + return 1 + if not recipes: + logger.error('Unable to find any package producing path %s - this may be because the recipe packaging it has not been built yet' % args.targetpath) + return 1 + + alternative_pns = [] + postinst_pns = [] + + selectpn = None + for targetpath, pnlist in recipes.items(): + for pn in pnlist: + if pn.startswith('?'): + alternative_pns.append(pn[1:]) + elif pn.startswith('!'): + postinst_pns.append(pn[1:]) + elif selectpn: + # hit here with multilibs + continue + else: + selectpn = pn + + if not selectpn and len(alternative_pns) == 1: + selectpn = alternative_pns[0] + logger.error('File %s is an alternative possibly provided by recipe %s but seemingly no other, selecting it by default - you should double check other recipes' % (args.targetpath, selectpn)) + + if selectpn: + logger.debug('Selecting recipe %s for file %s' % (selectpn, args.targetpath)) + if postinst_pns: + logger.warn('%s be modified by postinstall scripts for the following recipes:\n %s\nThis may or may not be an issue depending on what modifications these postinstall scripts make.' % (args.targetpath, '\n '.join(postinst_pns))) + rd = _parse_recipe(selectpn, tinfoil) + if not rd: + # Error message already shown + return 1 + sourcefile, instelements, modpatches = determine_file_source(args.targetpath, rd) + sourcepath = None + if sourcefile: + sourcetype, sourcepath = sourcefile.split('://', 1) + logger.debug('Original source file is %s (%s)' % (sourcepath, sourcetype)) + if sourcetype == 'patch': + logger.warn('File %s is added by the patch %s - you may need to remove or replace this patch in order to replace the file.' % (args.targetpath, sourcepath)) + sourcepath = None + else: + logger.debug('Unable to determine source file, proceeding anyway') + if modpatches: + logger.warn('File %s is modified by the following patches:\n %s' % (args.targetpath, '\n '.join(modpatches))) + + if instelements and sourcepath: + install = None + else: + # Auto-determine permissions + # Check destination + binpaths = '${bindir}:${sbindir}:${base_bindir}:${base_sbindir}:${libexecdir}:${sysconfdir}/init.d' + perms = '0644' + if os.path.abspath(os.path.dirname(args.targetpath)) in rd.expand(binpaths).split(':'): + # File is going into a directory normally reserved for executables, so it should be executable + perms = '0755' + else: + # Check source + st = os.stat(args.newfile) + if st.st_mode & stat.S_IXUSR: + perms = '0755' + install = {args.newfile: (args.targetpath, perms)} + oe.recipeutils.bbappend_recipe(rd, args.destlayer, {args.newfile: sourcepath}, install, wildcardver=args.wildcard_version, machine=args.machine) + return 0 + else: + if alternative_pns: + logger.error('File %s is an alternative possibly provided by the following recipes:\n %s\nPlease select recipe with -r/--recipe' % (targetpath, '\n '.join(alternative_pns))) + elif postinst_pns: + logger.error('File %s may be written out in a pre/postinstall script of the following recipes:\n %s\nPlease select recipe with -r/--recipe' % (targetpath, '\n '.join(postinst_pns))) + return 3 + + +def appendsrc(args, files, rd, extralines=None): + import oe.recipeutils + + srcdir = rd.getVar('S') + workdir = rd.getVar('WORKDIR') + + import bb.fetch + simplified = {} + src_uri = rd.getVar('SRC_URI').split() + for uri in src_uri: + if uri.endswith(';'): + uri = uri[:-1] + simple_uri = bb.fetch.URI(uri) + simple_uri.params = {} + simplified[str(simple_uri)] = uri + + copyfiles = {} + extralines = extralines or [] + for newfile, srcfile in files.items(): + src_destdir = os.path.dirname(srcfile) + if not args.use_workdir: + if rd.getVar('S') == rd.getVar('STAGING_KERNEL_DIR'): + srcdir = os.path.join(workdir, 'git') + if not bb.data.inherits_class('kernel-yocto', rd): + logger.warn('S == STAGING_KERNEL_DIR and non-kernel-yocto, unable to determine path to srcdir, defaulting to ${WORKDIR}/git') + src_destdir = os.path.join(os.path.relpath(srcdir, workdir), src_destdir) + src_destdir = os.path.normpath(src_destdir) + + source_uri = 'file://{0}'.format(os.path.basename(srcfile)) + if src_destdir and src_destdir != '.': + source_uri += ';subdir={0}'.format(src_destdir) + + simple = bb.fetch.URI(source_uri) + simple.params = {} + simple_str = str(simple) + if simple_str in simplified: + existing = simplified[simple_str] + if source_uri != existing: + logger.warn('{0!r} is already in SRC_URI, with different parameters: {1!r}, not adding'.format(source_uri, existing)) + else: + logger.warn('{0!r} is already in SRC_URI, not adding'.format(source_uri)) + else: + extralines.append('SRC_URI += {0}'.format(source_uri)) + copyfiles[newfile] = srcfile + + oe.recipeutils.bbappend_recipe(rd, args.destlayer, copyfiles, None, wildcardver=args.wildcard_version, machine=args.machine, extralines=extralines) + + +def appendsrcfiles(parser, args): + recipedata = _parse_recipe(args.recipe, tinfoil) + if not recipedata: + parser.error('RECIPE must be a valid recipe name') + + files = dict((f, os.path.join(args.destdir, os.path.basename(f))) + for f in args.files) + return appendsrc(args, files, recipedata) + + +def appendsrcfile(parser, args): + recipedata = _parse_recipe(args.recipe, tinfoil) + if not recipedata: + parser.error('RECIPE must be a valid recipe name') + + if not args.destfile: + args.destfile = os.path.basename(args.file) + elif args.destfile.endswith('/'): + args.destfile = os.path.join(args.destfile, os.path.basename(args.file)) + + return appendsrc(args, {args.file: args.destfile}, recipedata) + + +def layer(layerpath): + if not os.path.exists(os.path.join(layerpath, 'conf', 'layer.conf')): + raise argparse.ArgumentTypeError('{0!r} must be a path to a valid layer'.format(layerpath)) + return layerpath + + +def existing_path(filepath): + if not os.path.exists(filepath): + raise argparse.ArgumentTypeError('{0!r} must be an existing path'.format(filepath)) + return filepath + + +def existing_file(filepath): + filepath = existing_path(filepath) + if os.path.isdir(filepath): + raise argparse.ArgumentTypeError('{0!r} must be a file, not a directory'.format(filepath)) + return filepath + + +def destination_path(destpath): + if os.path.isabs(destpath): + raise argparse.ArgumentTypeError('{0!r} must be a relative path, not absolute'.format(destpath)) + return destpath + + +def target_path(targetpath): + if not os.path.isabs(targetpath): + raise argparse.ArgumentTypeError('{0!r} must be an absolute path, not relative'.format(targetpath)) + return targetpath + + +def register_commands(subparsers): + common = argparse.ArgumentParser(add_help=False) + common.add_argument('-m', '--machine', help='Make bbappend changes specific to a machine only', metavar='MACHINE') + common.add_argument('-w', '--wildcard-version', help='Use wildcard to make the bbappend apply to any recipe version', action='store_true') + common.add_argument('destlayer', metavar='DESTLAYER', help='Base directory of the destination layer to write the bbappend to', type=layer) + + parser_appendfile = subparsers.add_parser('appendfile', + parents=[common], + help='Create/update a bbappend to replace a target file', + description='Creates a bbappend (or updates an existing one) to replace the specified file that appears in the target system, determining the recipe that packages the file and the required path and name for the bbappend automatically. Note that the ability to determine the recipe packaging a particular file depends upon the recipe\'s do_packagedata task having already run prior to running this command (which it will have when the recipe has been built successfully, which in turn will have happened if one or more of the recipe\'s packages is included in an image that has been built successfully).') + parser_appendfile.add_argument('targetpath', help='Path to the file to be replaced (as it would appear within the target image, e.g. /etc/motd)', type=target_path) + parser_appendfile.add_argument('newfile', help='Custom file to replace the target file with', type=existing_file) + parser_appendfile.add_argument('-r', '--recipe', help='Override recipe to apply to (default is to find which recipe already packages the file)') + parser_appendfile.set_defaults(func=appendfile, parserecipes=True) + + common_src = argparse.ArgumentParser(add_help=False, parents=[common]) + common_src.add_argument('-W', '--workdir', help='Unpack file into WORKDIR rather than S', dest='use_workdir', action='store_true') + common_src.add_argument('recipe', metavar='RECIPE', help='Override recipe to apply to') + + parser = subparsers.add_parser('appendsrcfiles', + parents=[common_src], + help='Create/update a bbappend to add or replace source files', + description='Creates a bbappend (or updates an existing one) to add or replace the specified file in the recipe sources, either those in WORKDIR or those in the source tree. This command lets you specify multiple files with a destination directory, so cannot specify the destination filename. See the `appendsrcfile` command for the other behavior.') + parser.add_argument('-D', '--destdir', help='Destination directory (relative to S or WORKDIR, defaults to ".")', default='', type=destination_path) + parser.add_argument('files', nargs='+', metavar='FILE', help='File(s) to be added to the recipe sources (WORKDIR or S)', type=existing_path) + parser.set_defaults(func=lambda a: appendsrcfiles(parser, a), parserecipes=True) + + parser = subparsers.add_parser('appendsrcfile', + parents=[common_src], + help='Create/update a bbappend to add or replace a source file', + description='Creates a bbappend (or updates an existing one) to add or replace the specified files in the recipe sources, either those in WORKDIR or those in the source tree. This command lets you specify the destination filename, not just destination directory, but only works for one file. See the `appendsrcfiles` command for the other behavior.') + parser.add_argument('file', metavar='FILE', help='File to be added to the recipe sources (WORKDIR or S)', type=existing_path) + parser.add_argument('destfile', metavar='DESTFILE', nargs='?', help='Destination path (relative to S or WORKDIR, optional)', type=destination_path) + parser.set_defaults(func=lambda a: appendsrcfile(parser, a), parserecipes=True) diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py new file mode 100644 index 0000000000..5af58a12f7 --- /dev/null +++ b/scripts/lib/recipetool/create.py @@ -0,0 +1,1165 @@ +# Recipe creation tool - create command plugin +# +# Copyright (C) 2014-2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import os +import argparse +import glob +import fnmatch +import re +import json +import logging +import scriptutils +from urllib.parse import urlparse, urldefrag, urlsplit +import hashlib + +logger = logging.getLogger('recipetool') + +tinfoil = None +plugins = None + +def log_error_cond(message, debugonly): + if debugonly: + logger.debug(message) + else: + logger.error(message) + +def log_info_cond(message, debugonly): + if debugonly: + logger.debug(message) + else: + logger.info(message) + +def plugin_init(pluginlist): + # Take a reference to the list so we can use it later + global plugins + plugins = pluginlist + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + +class RecipeHandler(object): + recipelibmap = {} + recipeheadermap = {} + recipecmakefilemap = {} + recipebinmap = {} + + def __init__(self): + self._devtool = False + + @staticmethod + def load_libmap(d): + '''Load library->recipe mapping''' + import oe.package + + if RecipeHandler.recipelibmap: + return + # First build up library->package mapping + shlib_providers = oe.package.read_shlib_providers(d) + libdir = d.getVar('libdir') + base_libdir = d.getVar('base_libdir') + libpaths = list(set([base_libdir, libdir])) + libname_re = re.compile('^lib(.+)\.so.*$') + pkglibmap = {} + for lib, item in shlib_providers.items(): + for path, pkg in item.items(): + if path in libpaths: + res = libname_re.match(lib) + if res: + libname = res.group(1) + if not libname in pkglibmap: + pkglibmap[libname] = pkg[0] + else: + logger.debug('unable to extract library name from %s' % lib) + + # Now turn it into a library->recipe mapping + pkgdata_dir = d.getVar('PKGDATA_DIR') + for libname, pkg in pkglibmap.items(): + try: + with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: + for line in f: + if line.startswith('PN:'): + RecipeHandler.recipelibmap[libname] = line.split(':', 1)[-1].strip() + break + except IOError as ioe: + if ioe.errno == 2: + logger.warn('unable to find a pkgdata file for package %s' % pkg) + else: + raise + + # Some overrides - these should be mapped to the virtual + RecipeHandler.recipelibmap['GL'] = 'virtual/libgl' + RecipeHandler.recipelibmap['EGL'] = 'virtual/egl' + RecipeHandler.recipelibmap['GLESv2'] = 'virtual/libgles2' + + @staticmethod + def load_devel_filemap(d): + '''Build up development file->recipe mapping''' + if RecipeHandler.recipeheadermap: + return + pkgdata_dir = d.getVar('PKGDATA_DIR') + includedir = d.getVar('includedir') + cmakedir = os.path.join(d.getVar('libdir'), 'cmake') + for pkg in glob.glob(os.path.join(pkgdata_dir, 'runtime', '*-dev')): + with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: + pn = None + headers = [] + cmakefiles = [] + for line in f: + if line.startswith('PN:'): + pn = line.split(':', 1)[-1].strip() + elif line.startswith('FILES_INFO:'): + val = line.split(':', 1)[1].strip() + dictval = json.loads(val) + for fullpth in sorted(dictval): + if fullpth.startswith(includedir) and fullpth.endswith('.h'): + headers.append(os.path.relpath(fullpth, includedir)) + elif fullpth.startswith(cmakedir) and fullpth.endswith('.cmake'): + cmakefiles.append(os.path.relpath(fullpth, cmakedir)) + if pn and headers: + for header in headers: + RecipeHandler.recipeheadermap[header] = pn + if pn and cmakefiles: + for fn in cmakefiles: + RecipeHandler.recipecmakefilemap[fn] = pn + + @staticmethod + def load_binmap(d): + '''Build up native binary->recipe mapping''' + if RecipeHandler.recipebinmap: + return + sstate_manifests = d.getVar('SSTATE_MANIFESTS') + staging_bindir_native = d.getVar('STAGING_BINDIR_NATIVE') + build_arch = d.getVar('BUILD_ARCH') + fileprefix = 'manifest-%s-' % build_arch + for fn in glob.glob(os.path.join(sstate_manifests, '%s*-native.populate_sysroot' % fileprefix)): + with open(fn, 'r') as f: + pn = os.path.basename(fn).rsplit('.', 1)[0][len(fileprefix):] + for line in f: + if line.startswith(staging_bindir_native): + prog = os.path.basename(line.rstrip()) + RecipeHandler.recipebinmap[prog] = pn + + @staticmethod + def checkfiles(path, speclist, recursive=False): + results = [] + if recursive: + for root, _, files in os.walk(path): + for fn in files: + for spec in speclist: + if fnmatch.fnmatch(fn, spec): + results.append(os.path.join(root, fn)) + else: + for spec in speclist: + results.extend(glob.glob(os.path.join(path, spec))) + return results + + @staticmethod + def handle_depends(libdeps, pcdeps, deps, outlines, values, d): + if pcdeps: + recipemap = read_pkgconfig_provides(d) + if libdeps: + RecipeHandler.load_libmap(d) + + ignorelibs = ['socket'] + ignoredeps = ['gcc-runtime', 'glibc', 'uclibc', 'musl', 'tar-native', 'binutils-native', 'coreutils-native'] + + unmappedpc = [] + pcdeps = list(set(pcdeps)) + for pcdep in pcdeps: + if isinstance(pcdep, str): + recipe = recipemap.get(pcdep, None) + if recipe: + deps.append(recipe) + else: + if not pcdep.startswith('$'): + unmappedpc.append(pcdep) + else: + for item in pcdep: + recipe = recipemap.get(pcdep, None) + if recipe: + deps.append(recipe) + break + else: + unmappedpc.append('(%s)' % ' or '.join(pcdep)) + + unmappedlibs = [] + for libdep in libdeps: + if isinstance(libdep, tuple): + lib, header = libdep + else: + lib = libdep + header = None + + if lib in ignorelibs: + logger.debug('Ignoring library dependency %s' % lib) + continue + + recipe = RecipeHandler.recipelibmap.get(lib, None) + if recipe: + deps.append(recipe) + elif recipe is None: + if header: + RecipeHandler.load_devel_filemap(d) + recipe = RecipeHandler.recipeheadermap.get(header, None) + if recipe: + deps.append(recipe) + elif recipe is None: + unmappedlibs.append(lib) + else: + unmappedlibs.append(lib) + + deps = set(deps).difference(set(ignoredeps)) + + if unmappedpc: + outlines.append('# NOTE: unable to map the following pkg-config dependencies: %s' % ' '.join(unmappedpc)) + outlines.append('# (this is based on recipes that have previously been built and packaged)') + + if unmappedlibs: + outlines.append('# NOTE: the following library dependencies are unknown, ignoring: %s' % ' '.join(list(set(unmappedlibs)))) + outlines.append('# (this is based on recipes that have previously been built and packaged)') + + if deps: + values['DEPENDS'] = ' '.join(deps) + + @staticmethod + def genfunction(outlines, funcname, content, python=False, forcespace=False): + if python: + prefix = 'python ' + else: + prefix = '' + outlines.append('%s%s () {' % (prefix, funcname)) + if python or forcespace: + indent = ' ' + else: + indent = '\t' + addnoop = not python + for line in content: + outlines.append('%s%s' % (indent, line)) + if addnoop: + strippedline = line.lstrip() + if strippedline and not strippedline.startswith('#'): + addnoop = False + if addnoop: + # Without this there'll be a syntax error + outlines.append('%s:' % indent) + outlines.append('}') + outlines.append('') + + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + return False + + +def validate_pv(pv): + if not pv or '_version' in pv.lower() or pv[0] not in '0123456789': + return False + return True + +def determine_from_filename(srcfile): + """Determine name and version from a filename""" + if is_package(srcfile): + # Force getting the value from the package metadata + return None, None + + if '.tar.' in srcfile: + namepart = srcfile.split('.tar.')[0] + else: + namepart = os.path.splitext(srcfile)[0] + namepart = namepart.lower().replace('_', '-') + if namepart.endswith('.src'): + namepart = namepart[:-4] + if namepart.endswith('.orig'): + namepart = namepart[:-5] + splitval = namepart.split('-') + logger.debug('determine_from_filename: split name %s into: %s' % (srcfile, splitval)) + + ver_re = re.compile('^v?[0-9]') + + pv = None + pn = None + if len(splitval) == 1: + # Try to split the version out if there is no separator (or a .) + res = re.match('^([^0-9]+)([0-9.]+.*)$', namepart) + if res: + if len(res.group(1)) > 1 and len(res.group(2)) > 1: + pn = res.group(1).rstrip('.') + pv = res.group(2) + else: + pn = namepart + else: + if splitval[-1] in ['source', 'src']: + splitval.pop() + if len(splitval) > 2 and re.match('^(alpha|beta|stable|release|rc[0-9]|pre[0-9]|p[0-9]|[0-9]{8})', splitval[-1]) and ver_re.match(splitval[-2]): + pv = '-'.join(splitval[-2:]) + if pv.endswith('-release'): + pv = pv[:-8] + splitval = splitval[:-2] + elif ver_re.match(splitval[-1]): + pv = splitval.pop() + pn = '-'.join(splitval) + if pv and pv.startswith('v'): + pv = pv[1:] + logger.debug('determine_from_filename: name = "%s" version = "%s"' % (pn, pv)) + return (pn, pv) + +def determine_from_url(srcuri): + """Determine name and version from a URL""" + pn = None + pv = None + parseres = urlparse(srcuri.lower().split(';', 1)[0]) + if parseres.path: + if 'github.com' in parseres.netloc: + res = re.search(r'.*/(.*?)/archive/(.*)-final\.(tar|zip)', parseres.path) + if res: + pn = res.group(1).strip().replace('_', '-') + pv = res.group(2).strip().replace('_', '.') + else: + res = re.search(r'.*/(.*?)/archive/v?(.*)\.(tar|zip)', parseres.path) + if res: + pn = res.group(1).strip().replace('_', '-') + pv = res.group(2).strip().replace('_', '.') + elif 'bitbucket.org' in parseres.netloc: + res = re.search(r'.*/(.*?)/get/[a-zA-Z_-]*([0-9][0-9a-zA-Z_.]*)\.(tar|zip)', parseres.path) + if res: + pn = res.group(1).strip().replace('_', '-') + pv = res.group(2).strip().replace('_', '.') + + if not pn and not pv and parseres.scheme not in ['git', 'gitsm', 'svn', 'hg']: + srcfile = os.path.basename(parseres.path.rstrip('/')) + pn, pv = determine_from_filename(srcfile) + + logger.debug('Determined from source URL: name = "%s", version = "%s"' % (pn, pv)) + return (pn, pv) + +def supports_srcrev(uri): + localdata = bb.data.createCopy(tinfoil.config_data) + # This is a bit sad, but if you don't have this set there can be some + # odd interactions with the urldata cache which lead to errors + localdata.setVar('SRCREV', '${AUTOREV}') + try: + fetcher = bb.fetch2.Fetch([uri], localdata) + urldata = fetcher.ud + for u in urldata: + if urldata[u].method.supports_srcrev(): + return True + except bb.fetch2.FetchError as e: + logger.debug('FetchError in supports_srcrev: %s' % str(e)) + # Fall back to basic check + if uri.startswith(('git://', 'gitsm://')): + return True + return False + +def reformat_git_uri(uri): + '''Convert any http[s]://....git URI into git://...;protocol=http[s]''' + checkuri = uri.split(';', 1)[0] + if checkuri.endswith('.git') or '/git/' in checkuri or re.match('https?://github.com/[^/]+/[^/]+/?$', checkuri): + res = re.match('(http|https|ssh)://([^;]+(\.git)?)(;.*)?$', uri) + if res: + # Need to switch the URI around so that the git fetcher is used + return 'git://%s;protocol=%s%s' % (res.group(2), res.group(1), res.group(4) or '') + elif '@' in checkuri: + # Catch e.g. git@git.example.com:repo.git + return 'git://%s;protocol=ssh' % checkuri.replace(':', '/', 1) + return uri + +def is_package(url): + '''Check if a URL points to a package''' + checkurl = url.split(';', 1)[0] + if checkurl.endswith(('.deb', '.ipk', '.rpm', '.srpm')): + return True + return False + +def create_recipe(args): + import bb.process + import tempfile + import shutil + import oe.recipeutils + + pkgarch = "" + if args.machine: + pkgarch = "${MACHINE_ARCH}" + + extravalues = {} + checksums = (None, None) + tempsrc = '' + source = args.source + srcsubdir = '' + srcrev = '${AUTOREV}' + + if os.path.isfile(source): + source = 'file://%s' % os.path.abspath(source) + + if scriptutils.is_src_url(source): + # Fetch a URL + fetchuri = reformat_git_uri(urldefrag(source)[0]) + if args.binary: + # Assume the archive contains the directory structure verbatim + # so we need to extract to a subdirectory + fetchuri += ';subdir=${BP}' + srcuri = fetchuri + rev_re = re.compile(';rev=([^;]+)') + res = rev_re.search(srcuri) + if res: + srcrev = res.group(1) + srcuri = rev_re.sub('', srcuri) + tempsrc = tempfile.mkdtemp(prefix='recipetool-') + srctree = tempsrc + d = bb.data.createCopy(tinfoil.config_data) + if fetchuri.startswith('npm://'): + # Check if npm is available + npm_bindir = check_npm(tinfoil, args.devtool) + d.prependVar('PATH', '%s:' % npm_bindir) + logger.info('Fetching %s...' % srcuri) + try: + checksums = scriptutils.fetch_uri(d, fetchuri, srctree, srcrev) + except bb.fetch2.BBFetchException as e: + logger.error(str(e).rstrip()) + sys.exit(1) + dirlist = os.listdir(srctree) + if 'git.indirectionsymlink' in dirlist: + dirlist.remove('git.indirectionsymlink') + if len(dirlist) == 1: + singleitem = os.path.join(srctree, dirlist[0]) + if os.path.isdir(singleitem): + # We unpacked a single directory, so we should use that + srcsubdir = dirlist[0] + srctree = os.path.join(srctree, srcsubdir) + else: + with open(singleitem, 'r', errors='surrogateescape') as f: + if '<html' in f.read(100).lower(): + logger.error('Fetching "%s" returned a single HTML page - check the URL is correct and functional' % fetchuri) + sys.exit(1) + if os.path.exists(os.path.join(srctree, '.gitmodules')) and srcuri.startswith('git://'): + srcuri = 'gitsm://' + srcuri[6:] + logger.info('Fetching submodules...') + bb.process.run('git submodule update --init --recursive', cwd=srctree) + + if is_package(fetchuri): + tmpfdir = tempfile.mkdtemp(prefix='recipetool-') + try: + pkgfile = None + try: + fileuri = fetchuri + ';unpack=0' + scriptutils.fetch_uri(tinfoil.config_data, fileuri, tmpfdir, srcrev) + for root, _, files in os.walk(tmpfdir): + for f in files: + pkgfile = os.path.join(root, f) + break + except bb.fetch2.BBFetchException as e: + logger.warn('Second fetch to get metadata failed: %s' % str(e).rstrip()) + + if pkgfile: + if pkgfile.endswith(('.deb', '.ipk')): + stdout, _ = bb.process.run('ar x %s' % pkgfile, cwd=tmpfdir) + stdout, _ = bb.process.run('tar xf control.tar.gz', cwd=tmpfdir) + values = convert_debian(tmpfdir) + extravalues.update(values) + elif pkgfile.endswith(('.rpm', '.srpm')): + stdout, _ = bb.process.run('rpm -qp --xml %s > pkginfo.xml' % pkgfile, cwd=tmpfdir) + values = convert_rpm_xml(os.path.join(tmpfdir, 'pkginfo.xml')) + extravalues.update(values) + finally: + shutil.rmtree(tmpfdir) + else: + # Assume we're pointing to an existing source tree + if args.extract_to: + logger.error('--extract-to cannot be specified if source is a directory') + sys.exit(1) + if not os.path.isdir(source): + logger.error('Invalid source directory %s' % source) + sys.exit(1) + srctree = source + srcuri = '' + if os.path.exists(os.path.join(srctree, '.git')): + # Try to get upstream repo location from origin remote + try: + stdout, _ = bb.process.run('git remote -v', cwd=srctree, shell=True) + except bb.process.ExecutionError as e: + stdout = None + if stdout: + for line in stdout.splitlines(): + splitline = line.split() + if len(splitline) > 1: + if splitline[0] == 'origin' and scriptutils.is_src_url(splitline[1]): + srcuri = reformat_git_uri(splitline[1]) + srcsubdir = 'git' + break + + if args.src_subdir: + srcsubdir = os.path.join(srcsubdir, args.src_subdir) + srctree_use = os.path.join(srctree, args.src_subdir) + else: + srctree_use = srctree + + if args.outfile and os.path.isdir(args.outfile): + outfile = None + outdir = args.outfile + else: + outfile = args.outfile + outdir = None + if outfile and outfile != '-': + if os.path.exists(outfile): + logger.error('Output file %s already exists' % outfile) + sys.exit(1) + + lines_before = [] + lines_after = [] + + lines_before.append('# Recipe created by %s' % os.path.basename(sys.argv[0])) + lines_before.append('# This is the basis of a recipe and may need further editing in order to be fully functional.') + lines_before.append('# (Feel free to remove these comments when editing.)') + # We need a blank line here so that patch_recipe_lines can rewind before the LICENSE comments + lines_before.append('') + + handled = [] + licvalues = handle_license_vars(srctree_use, lines_before, handled, extravalues, tinfoil.config_data) + + classes = [] + + # FIXME This is kind of a hack, we probably ought to be using bitbake to do this + pn = None + pv = None + if outfile: + recipefn = os.path.splitext(os.path.basename(outfile))[0] + fnsplit = recipefn.split('_') + if len(fnsplit) > 1: + pn = fnsplit[0] + pv = fnsplit[1] + else: + pn = recipefn + + if args.version: + pv = args.version + + if args.name: + pn = args.name + if args.name.endswith('-native'): + if args.also_native: + logger.error('--also-native cannot be specified for a recipe named *-native (*-native denotes a recipe that is already only for native) - either remove the -native suffix from the name or drop --also-native') + sys.exit(1) + classes.append('native') + elif args.name.startswith('nativesdk-'): + if args.also_native: + logger.error('--also-native cannot be specified for a recipe named nativesdk-* (nativesdk-* denotes a recipe that is already only for nativesdk)') + sys.exit(1) + classes.append('nativesdk') + + if pv and pv not in 'git svn hg'.split(): + realpv = pv + else: + realpv = None + + if srcuri and not realpv or not pn: + name_pn, name_pv = determine_from_url(srcuri) + if name_pn and not pn: + pn = name_pn + if name_pv and not realpv: + realpv = name_pv + + if not srcuri: + lines_before.append('# No information for SRC_URI yet (only an external source tree was specified)') + lines_before.append('SRC_URI = "%s"' % srcuri) + (md5value, sha256value) = checksums + if md5value: + lines_before.append('SRC_URI[md5sum] = "%s"' % md5value) + if sha256value: + lines_before.append('SRC_URI[sha256sum] = "%s"' % sha256value) + if srcuri and supports_srcrev(srcuri): + lines_before.append('') + lines_before.append('# Modify these as desired') + lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0')) + if not args.autorev and srcrev == '${AUTOREV}': + if os.path.exists(os.path.join(srctree, '.git')): + (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) + srcrev = stdout.rstrip() + lines_before.append('SRCREV = "%s"' % srcrev) + lines_before.append('') + + if srcsubdir and not args.binary: + # (for binary packages we explicitly specify subdir= when fetching to + # match the default value of S, so we don't need to set it in that case) + lines_before.append('S = "${WORKDIR}/%s"' % srcsubdir) + lines_before.append('') + + if pkgarch: + lines_after.append('PACKAGE_ARCH = "%s"' % pkgarch) + lines_after.append('') + + if args.binary: + lines_after.append('INSANE_SKIP_${PN} += "already-stripped"') + lines_after.append('') + + if args.fetch_dev: + extravalues['fetchdev'] = True + else: + extravalues['fetchdev'] = None + + # Find all plugins that want to register handlers + logger.debug('Loading recipe handlers') + raw_handlers = [] + for plugin in plugins: + if hasattr(plugin, 'register_recipe_handlers'): + plugin.register_recipe_handlers(raw_handlers) + # Sort handlers by priority + handlers = [] + for i, handler in enumerate(raw_handlers): + if isinstance(handler, tuple): + handlers.append((handler[0], handler[1], i)) + else: + handlers.append((handler, 0, i)) + handlers.sort(key=lambda item: (item[1], -item[2]), reverse=True) + for handler, priority, _ in handlers: + logger.debug('Handler: %s (priority %d)' % (handler.__class__.__name__, priority)) + setattr(handler, '_devtool', args.devtool) + handlers = [item[0] for item in handlers] + + # Apply the handlers + if args.binary: + classes.append('bin_package') + handled.append('buildsystem') + + for handler in handlers: + handler.process(srctree_use, classes, lines_before, lines_after, handled, extravalues) + + extrafiles = extravalues.pop('extrafiles', {}) + extra_pn = extravalues.pop('PN', None) + extra_pv = extravalues.pop('PV', None) + + if extra_pv and not realpv: + realpv = extra_pv + if not validate_pv(realpv): + realpv = None + else: + realpv = realpv.lower().split()[0] + if '_' in realpv: + realpv = realpv.replace('_', '-') + if extra_pn and not pn: + pn = extra_pn + if pn.startswith('GNU '): + pn = pn[4:] + if ' ' in pn: + # Probably a descriptive identifier rather than a proper name + pn = None + else: + pn = pn.lower() + if '_' in pn: + pn = pn.replace('_', '-') + + if not outfile: + if not pn: + log_error_cond('Unable to determine short program name from source tree - please specify name with -N/--name or output file name with -o/--outfile', args.devtool) + # devtool looks for this specific exit code, so don't change it + sys.exit(15) + else: + if srcuri and srcuri.startswith(('gitsm://', 'git://', 'hg://', 'svn://')): + suffix = srcuri.split(':', 1)[0] + if suffix == 'gitsm': + suffix = 'git' + outfile = '%s_%s.bb' % (pn, suffix) + elif realpv: + outfile = '%s_%s.bb' % (pn, realpv) + else: + outfile = '%s.bb' % pn + if outdir: + outfile = os.path.join(outdir, outfile) + # We need to check this again + if os.path.exists(outfile): + logger.error('Output file %s already exists' % outfile) + sys.exit(1) + + # Move any extra files the plugins created to a directory next to the recipe + if extrafiles: + if outfile == '-': + extraoutdir = pn + else: + extraoutdir = os.path.join(os.path.dirname(outfile), pn) + bb.utils.mkdirhier(extraoutdir) + for destfn, extrafile in extrafiles.items(): + shutil.move(extrafile, os.path.join(extraoutdir, destfn)) + + lines = lines_before + lines_before = [] + skipblank = True + for line in lines: + if skipblank: + skipblank = False + if not line: + continue + if line.startswith('S = '): + if realpv and pv not in 'git svn hg'.split(): + line = line.replace(realpv, '${PV}') + if pn: + line = line.replace(pn, '${BPN}') + if line == 'S = "${WORKDIR}/${BPN}-${PV}"': + skipblank = True + continue + elif line.startswith('SRC_URI = '): + if realpv: + line = line.replace(realpv, '${PV}') + elif line.startswith('PV = '): + if realpv: + line = re.sub('"[^+]*\+', '"%s+' % realpv, line) + lines_before.append(line) + + if args.also_native: + lines = lines_after + lines_after = [] + bbclassextend = None + for line in lines: + if line.startswith('BBCLASSEXTEND ='): + splitval = line.split('"') + if len(splitval) > 1: + bbclassextend = splitval[1].split() + if not 'native' in bbclassextend: + bbclassextend.insert(0, 'native') + line = 'BBCLASSEXTEND = "%s"' % ' '.join(bbclassextend) + lines_after.append(line) + if not bbclassextend: + lines_after.append('BBCLASSEXTEND = "native"') + + postinst = ("postinst", extravalues.pop('postinst', None)) + postrm = ("postrm", extravalues.pop('postrm', None)) + preinst = ("preinst", extravalues.pop('preinst', None)) + prerm = ("prerm", extravalues.pop('prerm', None)) + funcs = [postinst, postrm, preinst, prerm] + for func in funcs: + if func[1]: + RecipeHandler.genfunction(lines_after, 'pkg_%s_${PN}' % func[0], func[1]) + + outlines = [] + outlines.extend(lines_before) + if classes: + if outlines[-1] and not outlines[-1].startswith('#'): + outlines.append('') + outlines.append('inherit %s' % ' '.join(classes)) + outlines.append('') + outlines.extend(lines_after) + + if extravalues: + if 'LICENSE' in extravalues and not licvalues: + # Don't blow away 'CLOSED' value that comments say we set + del extravalues['LICENSE'] + _, outlines = oe.recipeutils.patch_recipe_lines(outlines, extravalues, trailing_newline=False) + + if args.extract_to: + scriptutils.git_convert_standalone_clone(srctree) + if os.path.isdir(args.extract_to): + # If the directory exists we'll move the temp dir into it instead of + # its contents - of course, we could try to always move its contents + # but that is a pain if there are symlinks; the simplest solution is + # to just remove it first + os.rmdir(args.extract_to) + shutil.move(srctree, args.extract_to) + if tempsrc == srctree: + tempsrc = None + log_info_cond('Source extracted to %s' % args.extract_to, args.devtool) + + if outfile == '-': + sys.stdout.write('\n'.join(outlines) + '\n') + else: + with open(outfile, 'w') as f: + lastline = None + for line in outlines: + if not lastline and not line: + # Skip extra blank lines + continue + f.write('%s\n' % line) + lastline = line + log_info_cond('Recipe %s has been created; further editing may be required to make it fully functional' % outfile, args.devtool) + + if tempsrc: + if args.keep_temp: + logger.info('Preserving temporary directory %s' % tempsrc) + else: + shutil.rmtree(tempsrc) + + return 0 + +def handle_license_vars(srctree, lines_before, handled, extravalues, d): + licvalues = guess_license(srctree, d) + lic_files_chksum = [] + lic_unknown = [] + if licvalues: + licenses = [] + for licvalue in licvalues: + if not licvalue[0] in licenses: + licenses.append(licvalue[0]) + lic_files_chksum.append('file://%s;md5=%s' % (licvalue[1], licvalue[2])) + if licvalue[0] == 'Unknown': + lic_unknown.append(licvalue[1]) + lines_before.append('# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is') + lines_before.append('# your responsibility to verify that the values are complete and correct.') + if len(licvalues) > 1: + lines_before.append('#') + lines_before.append('# NOTE: multiple licenses have been detected; they have been separated with &') + lines_before.append('# in the LICENSE value for now since it is a reasonable assumption that all') + lines_before.append('# of the licenses apply. If instead there is a choice between the multiple') + lines_before.append('# licenses then you should change the value to separate the licenses with |') + lines_before.append('# instead of &. If there is any doubt, check the accompanying documentation') + lines_before.append('# to determine which situation is applicable.') + if lic_unknown: + lines_before.append('#') + lines_before.append('# The following license files were not able to be identified and are') + lines_before.append('# represented as "Unknown" below, you will need to check them yourself:') + for licfile in lic_unknown: + lines_before.append('# %s' % licfile) + lines_before.append('#') + else: + lines_before.append('# Unable to find any files that looked like license statements. Check the accompanying') + lines_before.append('# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.') + lines_before.append('#') + lines_before.append('# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if') + lines_before.append('# this is not accurate with respect to the licensing of the software being built (it') + lines_before.append('# will not be in most cases) you must specify the correct value before using this') + lines_before.append('# recipe for anything other than initial testing/development!') + licenses = ['CLOSED'] + pkg_license = extravalues.pop('LICENSE', None) + if pkg_license: + if licenses == ['Unknown']: + lines_before.append('# NOTE: The following LICENSE value was determined from the original package metadata') + licenses = [pkg_license] + else: + lines_before.append('# NOTE: Original package metadata indicates license is: %s' % pkg_license) + lines_before.append('LICENSE = "%s"' % ' & '.join(licenses)) + lines_before.append('LIC_FILES_CHKSUM = "%s"' % ' \\\n '.join(lic_files_chksum)) + lines_before.append('') + handled.append(('license', licvalues)) + return licvalues + +def get_license_md5sums(d, static_only=False): + import bb.utils + md5sums = {} + if not static_only: + # Gather md5sums of license files in common license dir + commonlicdir = d.getVar('COMMON_LICENSE_DIR') + for fn in os.listdir(commonlicdir): + md5value = bb.utils.md5_file(os.path.join(commonlicdir, fn)) + md5sums[md5value] = fn + # The following were extracted from common values in various recipes + # (double checking the license against the license file itself, not just + # the LICENSE value in the recipe) + md5sums['94d55d512a9ba36caa9b7df079bae19f'] = 'GPLv2' + md5sums['b234ee4d69f5fce4486a80fdaf4a4263'] = 'GPLv2' + md5sums['59530bdf33659b29e73d4adb9f9f6552'] = 'GPLv2' + md5sums['0636e73ff0215e8d672dc4c32c317bb3'] = 'GPLv2' + md5sums['eb723b61539feef013de476e68b5c50a'] = 'GPLv2' + md5sums['751419260aa954499f7abaabaa882bbe'] = 'GPLv2' + md5sums['393a5ca445f6965873eca0259a17f833'] = 'GPLv2' + md5sums['12f884d2ae1ff87c09e5b7ccc2c4ca7e'] = 'GPLv2' + md5sums['8ca43cbc842c2336e835926c2166c28b'] = 'GPLv2' + md5sums['ebb5c50ab7cab4baeffba14977030c07'] = 'GPLv2' + md5sums['c93c0550bd3173f4504b2cbd8991e50b'] = 'GPLv2' + md5sums['9ac2e7cff1ddaf48b6eab6028f23ef88'] = 'GPLv2' + md5sums['4325afd396febcb659c36b49533135d4'] = 'GPLv2' + md5sums['18810669f13b87348459e611d31ab760'] = 'GPLv2' + md5sums['d7810fab7487fb0aad327b76f1be7cd7'] = 'GPLv2' # the Linux kernel's COPYING file + md5sums['bbb461211a33b134d42ed5ee802b37ff'] = 'LGPLv2.1' + md5sums['7fbc338309ac38fefcd64b04bb903e34'] = 'LGPLv2.1' + md5sums['4fbd65380cdd255951079008b364516c'] = 'LGPLv2.1' + md5sums['2d5025d4aa3495befef8f17206a5b0a1'] = 'LGPLv2.1' + md5sums['fbc093901857fcd118f065f900982c24'] = 'LGPLv2.1' + md5sums['a6f89e2100d9b6cdffcea4f398e37343'] = 'LGPLv2.1' + md5sums['d8045f3b8f929c1cb29a1e3fd737b499'] = 'LGPLv2.1' + md5sums['fad9b3332be894bab9bc501572864b29'] = 'LGPLv2.1' + md5sums['3bf50002aefd002f49e7bb854063f7e7'] = 'LGPLv2' + md5sums['9f604d8a4f8e74f4f5140845a21b6674'] = 'LGPLv2' + md5sums['5f30f0716dfdd0d91eb439ebec522ec2'] = 'LGPLv2' + md5sums['55ca817ccb7d5b5b66355690e9abc605'] = 'LGPLv2' + md5sums['252890d9eee26aab7b432e8b8a616475'] = 'LGPLv2' + md5sums['3214f080875748938ba060314b4f727d'] = 'LGPLv2' + md5sums['db979804f025cf55aabec7129cb671ed'] = 'LGPLv2' + md5sums['d32239bcb673463ab874e80d47fae504'] = 'GPLv3' + md5sums['f27defe1e96c2e1ecd4e0c9be8967949'] = 'GPLv3' + md5sums['6a6a8e020838b23406c81b19c1d46df6'] = 'LGPLv3' + md5sums['3b83ef96387f14655fc854ddc3c6bd57'] = 'Apache-2.0' + md5sums['385c55653886acac3821999a3ccd17b3'] = 'Artistic-1.0 | GPL-2.0' # some perl modules + md5sums['54c7042be62e169199200bc6477f04d1'] = 'BSD-3-Clause' + return md5sums + +def crunch_license(licfile): + ''' + Remove non-material text from a license file and then check + its md5sum against a known list. This works well for licenses + which contain a copyright statement, but is also a useful way + to handle people's insistence upon reformatting the license text + slightly (with no material difference to the text of the + license). + ''' + + import oe.utils + + # Note: these are carefully constructed! + license_title_re = re.compile('^\(?(#+ *)?(The )?.{1,10} [Ll]icen[sc]e( \(.{1,10}\))?\)?:?$') + license_statement_re = re.compile('^(This (project|software) is( free software)? (released|licen[sc]ed)|(Released|Licen[cs]ed)) under the .{1,10} [Ll]icen[sc]e:?$') + copyright_re = re.compile('^(#+)? *Copyright .*$') + + crunched_md5sums = {} + # The following two were gleaned from the "forever" npm package + crunched_md5sums['0a97f8e4cbaf889d6fa51f84b89a79f6'] = 'ISC' + crunched_md5sums['eecf6429523cbc9693547cf2db790b5c'] = 'MIT' + # https://github.com/vasi/pixz/blob/master/LICENSE + crunched_md5sums['2f03392b40bbe663597b5bd3cc5ebdb9'] = 'BSD-2-Clause' + # https://github.com/waffle-gl/waffle/blob/master/LICENSE.txt + crunched_md5sums['e72e5dfef0b1a4ca8a3d26a60587db66'] = 'BSD-2-Clause' + # https://github.com/spigwitmer/fakeds1963s/blob/master/LICENSE + crunched_md5sums['8be76ac6d191671f347ee4916baa637e'] = 'GPLv2' + # https://github.com/datto/dattobd/blob/master/COPYING + # http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/GPLv2.TXT + crunched_md5sums['1d65c5ad4bf6489f85f4812bf08ae73d'] = 'GPLv2' + # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt + # http://git.neil.brown.name/?p=mdadm.git;a=blob;f=COPYING;h=d159169d1050894d3ea3b98e1c965c4058208fe1;hb=HEAD + crunched_md5sums['fb530f66a7a89ce920f0e912b5b66d4b'] = 'GPLv2' + # https://github.com/gkos/nrf24/blob/master/COPYING + crunched_md5sums['7b6aaa4daeafdfa6ed5443fd2684581b'] = 'GPLv2' + # https://github.com/josch09/resetusb/blob/master/COPYING + crunched_md5sums['8b8ac1d631a4d220342e83bcf1a1fbc3'] = 'GPLv3' + # https://github.com/FFmpeg/FFmpeg/blob/master/COPYING.LGPLv2.1 + crunched_md5sums['2ea316ed973ae176e502e2297b574bb3'] = 'LGPLv2.1' + # unixODBC-2.3.4 COPYING + crunched_md5sums['1daebd9491d1e8426900b4fa5a422814'] = 'LGPLv2.1' + # https://github.com/FFmpeg/FFmpeg/blob/master/COPYING.LGPLv3 + crunched_md5sums['2ebfb3bb49b9a48a075cc1425e7f4129'] = 'LGPLv3' + lictext = [] + with open(licfile, 'r', errors='surrogateescape') as f: + for line in f: + # Drop opening statements + if copyright_re.match(line): + continue + elif license_title_re.match(line): + continue + elif license_statement_re.match(line): + continue + # Squash spaces, and replace smart quotes, double quotes + # and backticks with single quotes + line = oe.utils.squashspaces(line.strip()) + line = line.replace(u"\u2018", "'").replace(u"\u2019", "'").replace(u"\u201c","'").replace(u"\u201d", "'").replace('"', '\'').replace('`', '\'') + if line: + lictext.append(line) + + m = hashlib.md5() + try: + m.update(' '.join(lictext).encode('utf-8')) + md5val = m.hexdigest() + except UnicodeEncodeError: + md5val = None + lictext = '' + license = crunched_md5sums.get(md5val, None) + return license, md5val, lictext + +def guess_license(srctree, d): + import bb + md5sums = get_license_md5sums(d) + + licenses = [] + licspecs = ['*LICEN[CS]E*', 'COPYING*', '*[Ll]icense*', 'LEGAL*', '[Ll]egal*', '*GPL*', 'README.lic*', 'COPYRIGHT*', '[Cc]opyright*'] + licfiles = [] + for root, dirs, files in os.walk(srctree): + for fn in files: + for spec in licspecs: + if fnmatch.fnmatch(fn, spec): + fullpath = os.path.join(root, fn) + if not fullpath in licfiles: + licfiles.append(fullpath) + for licfile in licfiles: + md5value = bb.utils.md5_file(licfile) + license = md5sums.get(md5value, None) + if not license: + license, crunched_md5, lictext = crunch_license(licfile) + if not license: + license = 'Unknown' + licenses.append((license, os.path.relpath(licfile, srctree), md5value)) + + # FIXME should we grab at least one source file with a license header and add that too? + + return licenses + +def split_pkg_licenses(licvalues, packages, outlines, fallback_licenses=None, pn='${PN}'): + """ + Given a list of (license, path, md5sum) as returned by guess_license(), + a dict of package name to path mappings, write out a set of + package-specific LICENSE values. + """ + pkglicenses = {pn: []} + for license, licpath, _ in licvalues: + for pkgname, pkgpath in packages.items(): + if licpath.startswith(pkgpath + '/'): + if pkgname in pkglicenses: + pkglicenses[pkgname].append(license) + else: + pkglicenses[pkgname] = [license] + break + else: + # Accumulate on the main package + pkglicenses[pn].append(license) + outlicenses = {} + for pkgname in packages: + license = ' '.join(list(set(pkglicenses.get(pkgname, ['Unknown'])))) or 'Unknown' + if license == 'Unknown' and pkgname in fallback_licenses: + license = fallback_licenses[pkgname] + outlines.append('LICENSE_%s = "%s"' % (pkgname, license)) + outlicenses[pkgname] = license.split() + return outlicenses + +def read_pkgconfig_provides(d): + pkgdatadir = d.getVar('PKGDATA_DIR') + pkgmap = {} + for fn in glob.glob(os.path.join(pkgdatadir, 'shlibs2', '*.pclist')): + with open(fn, 'r') as f: + for line in f: + pkgmap[os.path.basename(line.rstrip())] = os.path.splitext(os.path.basename(fn))[0] + recipemap = {} + for pc, pkg in pkgmap.items(): + pkgdatafile = os.path.join(pkgdatadir, 'runtime', pkg) + if os.path.exists(pkgdatafile): + with open(pkgdatafile, 'r') as f: + for line in f: + if line.startswith('PN: '): + recipemap[pc] = line.split(':', 1)[1].strip() + return recipemap + +def convert_debian(debpath): + value_map = {'Package': 'PN', + 'Version': 'PV', + 'Section': 'SECTION', + 'License': 'LICENSE', + 'Homepage': 'HOMEPAGE'} + + # FIXME extend this mapping - perhaps use distro_alias.inc? + depmap = {'libz-dev': 'zlib'} + + values = {} + depends = [] + with open(os.path.join(debpath, 'control'), 'r', errors='surrogateescape') as f: + indesc = False + for line in f: + if indesc: + if line.startswith(' '): + if line.startswith(' This package contains'): + indesc = False + else: + if 'DESCRIPTION' in values: + values['DESCRIPTION'] += ' ' + line.strip() + else: + values['DESCRIPTION'] = line.strip() + else: + indesc = False + if not indesc: + splitline = line.split(':', 1) + if len(splitline) < 2: + continue + key = splitline[0] + value = splitline[1].strip() + if key == 'Build-Depends': + for dep in value.split(','): + dep = dep.split()[0] + mapped = depmap.get(dep, '') + if mapped: + depends.append(mapped) + elif key == 'Description': + values['SUMMARY'] = value + indesc = True + else: + varname = value_map.get(key, None) + if varname: + values[varname] = value + postinst = os.path.join(debpath, 'postinst') + postrm = os.path.join(debpath, 'postrm') + preinst = os.path.join(debpath, 'preinst') + prerm = os.path.join(debpath, 'prerm') + sfiles = [postinst, postrm, preinst, prerm] + for sfile in sfiles: + if os.path.isfile(sfile): + logger.info("Converting %s file to recipe function..." % + os.path.basename(sfile).upper()) + content = [] + with open(sfile) as f: + for line in f: + if "#!/" in line: + continue + line = line.rstrip("\n") + if line.strip(): + content.append(line) + if content: + values[os.path.basename(f.name)] = content + + #if depends: + # values['DEPENDS'] = ' '.join(depends) + + return values + +def convert_rpm_xml(xmlfile): + '''Converts the output from rpm -qp --xml to a set of variable values''' + import xml.etree.ElementTree as ElementTree + rpmtag_map = {'Name': 'PN', + 'Version': 'PV', + 'Summary': 'SUMMARY', + 'Description': 'DESCRIPTION', + 'License': 'LICENSE', + 'Url': 'HOMEPAGE'} + + values = {} + tree = ElementTree.parse(xmlfile) + root = tree.getroot() + for child in root: + if child.tag == 'rpmTag': + name = child.attrib.get('name', None) + if name: + varname = rpmtag_map.get(name, None) + if varname: + values[varname] = child[0].text + return values + + +def check_npm(tinfoil, debugonly=False): + try: + rd = tinfoil.parse_recipe('nodejs-native') + except bb.providers.NoProvider: + # We still conditionally show the message and exit with the special + # return code, otherwise we can't show the proper message for eSDK + # users + log_error_cond('nodejs-native is required for npm but is not available - you will likely need to add a layer that provides nodejs', debugonly) + sys.exit(14) + bindir = rd.getVar('STAGING_BINDIR_NATIVE') + npmpath = os.path.join(bindir, 'npm') + if not os.path.exists(npmpath): + log_error_cond('npm required to process specified source, but npm is not available - you need to run bitbake -c addto_recipe_sysroot nodejs-native first', debugonly) + sys.exit(14) + return bindir + +def register_commands(subparsers): + parser_create = subparsers.add_parser('create', + help='Create a new recipe', + description='Creates a new recipe from a source tree') + parser_create.add_argument('source', help='Path or URL to source') + parser_create.add_argument('-o', '--outfile', help='Specify filename for recipe to create') + parser_create.add_argument('-m', '--machine', help='Make recipe machine-specific as opposed to architecture-specific', action='store_true') + parser_create.add_argument('-x', '--extract-to', metavar='EXTRACTPATH', help='Assuming source is a URL, fetch it and extract it to the directory specified as %(metavar)s') + parser_create.add_argument('-N', '--name', help='Name to use within recipe (PN)') + parser_create.add_argument('-V', '--version', help='Version to use within recipe (PV)') + parser_create.add_argument('-b', '--binary', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure)', action='store_true') + parser_create.add_argument('--also-native', help='Also add native variant (i.e. support building recipe for the build host as well as the target machine)', action='store_true') + parser_create.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR') + parser_create.add_argument('-a', '--autorev', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true") + parser_create.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') + parser_create.add_argument('--fetch-dev', action="store_true", help='For npm, also fetch devDependencies') + parser_create.add_argument('--devtool', action="store_true", help=argparse.SUPPRESS) + # FIXME I really hate having to set parserecipes for this, but given we may need + # to call into npm (and we don't know in advance if we will or not) and in order + # to do so we need to know npm's recipe sysroot path, there's not much alternative + parser_create.set_defaults(func=create_recipe, parserecipes=True) + diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py new file mode 100644 index 0000000000..e914e53aab --- /dev/null +++ b/scripts/lib/recipetool/create_buildsys.py @@ -0,0 +1,889 @@ +# Recipe creation tool - create command build system handlers +# +# Copyright (C) 2014-2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import re +import logging +import glob +from recipetool.create import RecipeHandler, validate_pv + +logger = logging.getLogger('recipetool') + +tinfoil = None +plugins = None + +def plugin_init(pluginlist): + # Take a reference to the list so we can use it later + global plugins + plugins = pluginlist + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + + +class CmakeRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + if 'buildsystem' in handled: + return False + + if RecipeHandler.checkfiles(srctree, ['CMakeLists.txt']): + classes.append('cmake') + values = CmakeRecipeHandler.extract_cmake_deps(lines_before, srctree, extravalues) + classes.extend(values.pop('inherit', '').split()) + for var, value in values.items(): + lines_before.append('%s = "%s"' % (var, value)) + lines_after.append('# Specify any options you want to pass to cmake using EXTRA_OECMAKE:') + lines_after.append('EXTRA_OECMAKE = ""') + lines_after.append('') + handled.append('buildsystem') + return True + return False + + @staticmethod + def extract_cmake_deps(outlines, srctree, extravalues, cmakelistsfile=None): + # Find all plugins that want to register handlers + logger.debug('Loading cmake handlers') + handlers = [] + for plugin in plugins: + if hasattr(plugin, 'register_cmake_handlers'): + plugin.register_cmake_handlers(handlers) + + values = {} + inherits = [] + + if cmakelistsfile: + srcfiles = [cmakelistsfile] + else: + srcfiles = RecipeHandler.checkfiles(srctree, ['CMakeLists.txt']) + + # Note that some of these are non-standard, but probably better to + # be able to map them anyway if we see them + cmake_pkgmap = {'alsa': 'alsa-lib', + 'aspell': 'aspell', + 'atk': 'atk', + 'bison': 'bison-native', + 'boost': 'boost', + 'bzip2': 'bzip2', + 'cairo': 'cairo', + 'cups': 'cups', + 'curl': 'curl', + 'curses': 'ncurses', + 'cvs': 'cvs', + 'drm': 'libdrm', + 'dbus': 'dbus', + 'dbusglib': 'dbus-glib', + 'egl': 'virtual/egl', + 'expat': 'expat', + 'flex': 'flex-native', + 'fontconfig': 'fontconfig', + 'freetype': 'freetype', + 'gettext': '', + 'git': '', + 'gio': 'glib-2.0', + 'giounix': 'glib-2.0', + 'glew': 'glew', + 'glib': 'glib-2.0', + 'glib2': 'glib-2.0', + 'glu': 'libglu', + 'glut': 'freeglut', + 'gobject': 'glib-2.0', + 'gperf': 'gperf-native', + 'gnutls': 'gnutls', + 'gtk2': 'gtk+', + 'gtk3': 'gtk+3', + 'gtk': 'gtk+3', + 'harfbuzz': 'harfbuzz', + 'icu': 'icu', + 'intl': 'virtual/libintl', + 'jpeg': 'jpeg', + 'libarchive': 'libarchive', + 'libiconv': 'virtual/libiconv', + 'liblzma': 'xz', + 'libxml2': 'libxml2', + 'libxslt': 'libxslt', + 'opengl': 'virtual/libgl', + 'openmp': '', + 'openssl': 'openssl', + 'pango': 'pango', + 'perl': '', + 'perllibs': '', + 'pkgconfig': '', + 'png': 'libpng', + 'pthread': '', + 'pythoninterp': '', + 'pythonlibs': '', + 'ruby': 'ruby-native', + 'sdl': 'libsdl', + 'sdl2': 'libsdl2', + 'subversion': 'subversion-native', + 'swig': 'swig-native', + 'tcl': 'tcl-native', + 'threads': '', + 'tiff': 'tiff', + 'wget': 'wget', + 'x11': 'libx11', + 'xcb': 'libxcb', + 'xext': 'libxext', + 'xfixes': 'libxfixes', + 'zlib': 'zlib', + } + + pcdeps = [] + libdeps = [] + deps = [] + unmappedpkgs = [] + + proj_re = re.compile('project\s*\(([^)]*)\)', re.IGNORECASE) + pkgcm_re = re.compile('pkg_check_modules\s*\(\s*[a-zA-Z0-9-_]+\s*(REQUIRED)?\s+([^)\s]+)\s*\)', re.IGNORECASE) + pkgsm_re = re.compile('pkg_search_module\s*\(\s*[a-zA-Z0-9-_]+\s*(REQUIRED)?((\s+[^)\s]+)+)\s*\)', re.IGNORECASE) + findpackage_re = re.compile('find_package\s*\(\s*([a-zA-Z0-9-_]+)\s*.*', re.IGNORECASE) + findlibrary_re = re.compile('find_library\s*\(\s*[a-zA-Z0-9-_]+\s*(NAMES\s+)?([a-zA-Z0-9-_ ]+)\s*.*') + checklib_re = re.compile('check_library_exists\s*\(\s*([^\s)]+)\s*.*', re.IGNORECASE) + include_re = re.compile('include\s*\(\s*([^)\s]*)\s*\)', re.IGNORECASE) + subdir_re = re.compile('add_subdirectory\s*\(\s*([^)\s]*)\s*([^)\s]*)\s*\)', re.IGNORECASE) + dep_re = re.compile('([^ ><=]+)( *[<>=]+ *[^ ><=]+)?') + + def find_cmake_package(pkg): + RecipeHandler.load_devel_filemap(tinfoil.config_data) + for fn, pn in RecipeHandler.recipecmakefilemap.items(): + splitname = fn.split('/') + if len(splitname) > 1: + if splitname[0].lower().startswith(pkg.lower()): + if splitname[1] == '%s-config.cmake' % pkg.lower() or splitname[1] == '%sConfig.cmake' % pkg or splitname[1] == 'Find%s.cmake' % pkg: + return pn + return None + + def interpret_value(value): + return value.strip('"') + + def parse_cmake_file(fn, paths=None): + searchpaths = (paths or []) + [os.path.dirname(fn)] + logger.debug('Parsing file %s' % fn) + with open(fn, 'r', errors='surrogateescape') as f: + for line in f: + line = line.strip() + for handler in handlers: + if handler.process_line(srctree, fn, line, libdeps, pcdeps, deps, outlines, inherits, values): + continue + res = include_re.match(line) + if res: + includefn = bb.utils.which(':'.join(searchpaths), res.group(1)) + if includefn: + parse_cmake_file(includefn, searchpaths) + else: + logger.debug('Unable to recurse into include file %s' % res.group(1)) + continue + res = subdir_re.match(line) + if res: + subdirfn = os.path.join(os.path.dirname(fn), res.group(1), 'CMakeLists.txt') + if os.path.exists(subdirfn): + parse_cmake_file(subdirfn, searchpaths) + else: + logger.debug('Unable to recurse into subdirectory file %s' % subdirfn) + continue + res = proj_re.match(line) + if res: + extravalues['PN'] = interpret_value(res.group(1).split()[0]) + continue + res = pkgcm_re.match(line) + if res: + res = dep_re.findall(res.group(2)) + if res: + pcdeps.extend([interpret_value(x[0]) for x in res]) + inherits.append('pkgconfig') + continue + res = pkgsm_re.match(line) + if res: + res = dep_re.findall(res.group(2)) + if res: + # Note: appending a tuple here! + item = tuple((interpret_value(x[0]) for x in res)) + if len(item) == 1: + item = item[0] + pcdeps.append(item) + inherits.append('pkgconfig') + continue + res = findpackage_re.match(line) + if res: + origpkg = res.group(1) + pkg = interpret_value(origpkg) + found = False + for handler in handlers: + if handler.process_findpackage(srctree, fn, pkg, deps, outlines, inherits, values): + logger.debug('Mapped CMake package %s via handler %s' % (pkg, handler.__class__.__name__)) + found = True + break + if found: + continue + elif pkg == 'Gettext': + inherits.append('gettext') + elif pkg == 'Perl': + inherits.append('perlnative') + elif pkg == 'PkgConfig': + inherits.append('pkgconfig') + elif pkg == 'PythonInterp': + inherits.append('pythonnative') + elif pkg == 'PythonLibs': + inherits.append('python-dir') + else: + # Try to map via looking at installed CMake packages in pkgdata + dep = find_cmake_package(pkg) + if dep: + logger.debug('Mapped CMake package %s to recipe %s via pkgdata' % (pkg, dep)) + deps.append(dep) + else: + dep = cmake_pkgmap.get(pkg.lower(), None) + if dep: + logger.debug('Mapped CMake package %s to recipe %s via internal list' % (pkg, dep)) + deps.append(dep) + elif dep is None: + unmappedpkgs.append(origpkg) + continue + res = checklib_re.match(line) + if res: + lib = interpret_value(res.group(1)) + if not lib.startswith('$'): + libdeps.append(lib) + res = findlibrary_re.match(line) + if res: + libs = res.group(2).split() + for lib in libs: + if lib in ['HINTS', 'PATHS', 'PATH_SUFFIXES', 'DOC', 'NAMES_PER_DIR'] or lib.startswith(('NO_', 'CMAKE_', 'ONLY_CMAKE_')): + break + lib = interpret_value(lib) + if not lib.startswith('$'): + libdeps.append(lib) + if line.lower().startswith('useswig'): + deps.append('swig-native') + continue + + parse_cmake_file(srcfiles[0]) + + if unmappedpkgs: + outlines.append('# NOTE: unable to map the following CMake package dependencies: %s' % ' '.join(list(set(unmappedpkgs)))) + + RecipeHandler.handle_depends(libdeps, pcdeps, deps, outlines, values, tinfoil.config_data) + + for handler in handlers: + handler.post_process(srctree, libdeps, pcdeps, deps, outlines, inherits, values) + + if inherits: + values['inherit'] = ' '.join(list(set(inherits))) + + return values + + +class CmakeExtensionHandler(object): + '''Base class for CMake extension handlers''' + def process_line(self, srctree, fn, line, libdeps, pcdeps, deps, outlines, inherits, values): + ''' + Handle a line parsed out of an CMake file. + Return True if you've completely handled the passed in line, otherwise return False. + ''' + return False + + def process_findpackage(self, srctree, fn, pkg, deps, outlines, inherits, values): + ''' + Handle a find_package package parsed out of a CMake file. + Return True if you've completely handled the passed in package, otherwise return False. + ''' + return False + + def post_process(self, srctree, fn, pkg, deps, outlines, inherits, values): + ''' + Apply any desired post-processing on the output + ''' + return + + + +class SconsRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + if 'buildsystem' in handled: + return False + + if RecipeHandler.checkfiles(srctree, ['SConstruct', 'Sconstruct', 'sconstruct']): + classes.append('scons') + lines_after.append('# Specify any options you want to pass to scons using EXTRA_OESCONS:') + lines_after.append('EXTRA_OESCONS = ""') + lines_after.append('') + handled.append('buildsystem') + return True + return False + + +class QmakeRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + if 'buildsystem' in handled: + return False + + if RecipeHandler.checkfiles(srctree, ['*.pro']): + classes.append('qmake2') + handled.append('buildsystem') + return True + return False + + +class AutotoolsRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + if 'buildsystem' in handled: + return False + + autoconf = False + if RecipeHandler.checkfiles(srctree, ['configure.ac', 'configure.in']): + autoconf = True + values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, extravalues) + classes.extend(values.pop('inherit', '').split()) + for var, value in values.items(): + lines_before.append('%s = "%s"' % (var, value)) + else: + conffile = RecipeHandler.checkfiles(srctree, ['configure']) + if conffile: + # Check if this is just a pre-generated autoconf configure script + with open(conffile[0], 'r', errors='surrogateescape') as f: + for i in range(1, 10): + if 'Generated by GNU Autoconf' in f.readline(): + autoconf = True + break + + if autoconf and not ('PV' in extravalues and 'PN' in extravalues): + # Last resort + conffile = RecipeHandler.checkfiles(srctree, ['configure']) + if conffile: + with open(conffile[0], 'r', errors='surrogateescape') as f: + for line in f: + line = line.strip() + if line.startswith('VERSION=') or line.startswith('PACKAGE_VERSION='): + pv = line.split('=')[1].strip('"\'') + if pv and not 'PV' in extravalues and validate_pv(pv): + extravalues['PV'] = pv + elif line.startswith('PACKAGE_NAME=') or line.startswith('PACKAGE='): + pn = line.split('=')[1].strip('"\'') + if pn and not 'PN' in extravalues: + extravalues['PN'] = pn + + if autoconf: + lines_before.append('') + lines_before.append('# NOTE: if this software is not capable of being built in a separate build directory') + lines_before.append('# from the source, you should replace autotools with autotools-brokensep in the') + lines_before.append('# inherit line') + classes.append('autotools') + lines_after.append('# Specify any options you want to pass to the configure script using EXTRA_OECONF:') + lines_after.append('EXTRA_OECONF = ""') + lines_after.append('') + handled.append('buildsystem') + return True + + return False + + @staticmethod + def extract_autotools_deps(outlines, srctree, extravalues=None, acfile=None): + import shlex + + # Find all plugins that want to register handlers + logger.debug('Loading autotools handlers') + handlers = [] + for plugin in plugins: + if hasattr(plugin, 'register_autotools_handlers'): + plugin.register_autotools_handlers(handlers) + + values = {} + inherits = [] + + # Hardcoded map, we also use a dynamic one based on what's in the sysroot + progmap = {'flex': 'flex-native', + 'bison': 'bison-native', + 'm4': 'm4-native', + 'tar': 'tar-native', + 'ar': 'binutils-native', + 'ranlib': 'binutils-native', + 'ld': 'binutils-native', + 'strip': 'binutils-native', + 'libtool': '', + 'autoconf': '', + 'autoheader': '', + 'automake': '', + 'uname': '', + 'rm': '', + 'cp': '', + 'mv': '', + 'find': '', + 'awk': '', + 'sed': '', + } + progclassmap = {'gconftool-2': 'gconf', + 'pkg-config': 'pkgconfig', + 'python': 'pythonnative', + 'python3': 'python3native', + 'perl': 'perlnative', + 'makeinfo': 'texinfo', + } + + pkg_re = re.compile('PKG_CHECK_MODULES\(\s*\[?[a-zA-Z0-9_]*\]?,\s*\[?([^,\]]*)\]?[),].*') + pkgce_re = re.compile('PKG_CHECK_EXISTS\(\s*\[?([^,\]]*)\]?[),].*') + lib_re = re.compile('AC_CHECK_LIB\(\s*\[?([^,\]]*)\]?,.*') + libx_re = re.compile('AX_CHECK_LIBRARY\(\s*\[?[^,\]]*\]?,\s*\[?([^,\]]*)\]?,\s*\[?([a-zA-Z0-9-]*)\]?,.*') + progs_re = re.compile('_PROGS?\(\s*\[?[a-zA-Z0-9_]*\]?,\s*\[?([^,\]]*)\]?[),].*') + dep_re = re.compile('([^ ><=]+)( [<>=]+ [^ ><=]+)?') + ac_init_re = re.compile('AC_INIT\(\s*([^,]+),\s*([^,]+)[,)].*') + am_init_re = re.compile('AM_INIT_AUTOMAKE\(\s*([^,]+),\s*([^,]+)[,)].*') + define_re = re.compile('\s*(m4_)?define\(\s*([^,]+),\s*([^,]+)\)') + version_re = re.compile('([0-9.]+)') + + defines = {} + def subst_defines(value): + newvalue = value + for define, defval in defines.items(): + newvalue = newvalue.replace(define, defval) + if newvalue != value: + return subst_defines(newvalue) + return value + + def process_value(value): + value = value.replace('[', '').replace(']', '') + if value.startswith('m4_esyscmd(') or value.startswith('m4_esyscmd_s('): + cmd = subst_defines(value[value.index('(')+1:-1]) + try: + if '|' in cmd: + cmd = 'set -o pipefail; ' + cmd + stdout, _ = bb.process.run(cmd, cwd=srctree, shell=True) + ret = stdout.rstrip() + except bb.process.ExecutionError as e: + ret = '' + elif value.startswith('m4_'): + return None + ret = subst_defines(value) + if ret: + ret = ret.strip('"\'') + return ret + + # Since a configure.ac file is essentially a program, this is only ever going to be + # a hack unfortunately; but it ought to be enough of an approximation + if acfile: + srcfiles = [acfile] + else: + srcfiles = RecipeHandler.checkfiles(srctree, ['acinclude.m4', 'configure.ac', 'configure.in']) + + pcdeps = [] + libdeps = [] + deps = [] + unmapped = [] + + RecipeHandler.load_binmap(tinfoil.config_data) + + def process_macro(keyword, value): + for handler in handlers: + if handler.process_macro(srctree, keyword, value, process_value, libdeps, pcdeps, deps, outlines, inherits, values): + return + logger.debug('Found keyword %s with value "%s"' % (keyword, value)) + if keyword == 'PKG_CHECK_MODULES': + res = pkg_re.search(value) + if res: + res = dep_re.findall(res.group(1)) + if res: + pcdeps.extend([x[0] for x in res]) + inherits.append('pkgconfig') + elif keyword == 'PKG_CHECK_EXISTS': + res = pkgce_re.search(value) + if res: + res = dep_re.findall(res.group(1)) + if res: + pcdeps.extend([x[0] for x in res]) + inherits.append('pkgconfig') + elif keyword in ('AM_GNU_GETTEXT', 'AM_GLIB_GNU_GETTEXT', 'GETTEXT_PACKAGE'): + inherits.append('gettext') + elif keyword in ('AC_PROG_INTLTOOL', 'IT_PROG_INTLTOOL'): + deps.append('intltool-native') + elif keyword == 'AM_PATH_GLIB_2_0': + deps.append('glib-2.0') + elif keyword in ('AC_CHECK_PROG', 'AC_PATH_PROG', 'AX_WITH_PROG'): + res = progs_re.search(value) + if res: + for prog in shlex.split(res.group(1)): + prog = prog.split()[0] + for handler in handlers: + if handler.process_prog(srctree, keyword, value, prog, deps, outlines, inherits, values): + return + progclass = progclassmap.get(prog, None) + if progclass: + inherits.append(progclass) + else: + progdep = RecipeHandler.recipebinmap.get(prog, None) + if not progdep: + progdep = progmap.get(prog, None) + if progdep: + deps.append(progdep) + elif progdep is None: + if not prog.startswith('$'): + unmapped.append(prog) + elif keyword == 'AC_CHECK_LIB': + res = lib_re.search(value) + if res: + lib = res.group(1) + if not lib.startswith('$'): + libdeps.append(lib) + elif keyword == 'AX_CHECK_LIBRARY': + res = libx_re.search(value) + if res: + lib = res.group(2) + if not lib.startswith('$'): + header = res.group(1) + libdeps.append((lib, header)) + elif keyword == 'AC_PATH_X': + deps.append('libx11') + elif keyword in ('AX_BOOST', 'BOOST_REQUIRE'): + deps.append('boost') + elif keyword in ('AC_PROG_LEX', 'AM_PROG_LEX', 'AX_PROG_FLEX'): + deps.append('flex-native') + elif keyword in ('AC_PROG_YACC', 'AX_PROG_BISON'): + deps.append('bison-native') + elif keyword == 'AX_CHECK_ZLIB': + deps.append('zlib') + elif keyword in ('AX_CHECK_OPENSSL', 'AX_LIB_CRYPTO'): + deps.append('openssl') + elif keyword == 'AX_LIB_CURL': + deps.append('curl') + elif keyword == 'AX_LIB_BEECRYPT': + deps.append('beecrypt') + elif keyword == 'AX_LIB_EXPAT': + deps.append('expat') + elif keyword == 'AX_LIB_GCRYPT': + deps.append('libgcrypt') + elif keyword == 'AX_LIB_NETTLE': + deps.append('nettle') + elif keyword == 'AX_LIB_READLINE': + deps.append('readline') + elif keyword == 'AX_LIB_SQLITE3': + deps.append('sqlite3') + elif keyword == 'AX_LIB_TAGLIB': + deps.append('taglib') + elif keyword in ['AX_PKG_SWIG', 'AC_PROG_SWIG']: + deps.append('swig-native') + elif keyword == 'AX_PROG_XSLTPROC': + deps.append('libxslt-native') + elif keyword in ['AC_PYTHON_DEVEL', 'AX_PYTHON_DEVEL', 'AM_PATH_PYTHON']: + pythonclass = 'pythonnative' + res = version_re.search(value) + if res: + if res.group(1).startswith('3'): + pythonclass = 'python3native' + # Avoid replacing python3native with pythonnative + if not pythonclass in inherits and not 'python3native' in inherits: + if 'pythonnative' in inherits: + inherits.remove('pythonnative') + inherits.append(pythonclass) + elif keyword == 'AX_WITH_CURSES': + deps.append('ncurses') + elif keyword == 'AX_PATH_BDB': + deps.append('db') + elif keyword == 'AX_PATH_LIB_PCRE': + deps.append('libpcre') + elif keyword == 'AC_INIT': + if extravalues is not None: + res = ac_init_re.match(value) + if res: + extravalues['PN'] = process_value(res.group(1)) + pv = process_value(res.group(2)) + if validate_pv(pv): + extravalues['PV'] = pv + elif keyword == 'AM_INIT_AUTOMAKE': + if extravalues is not None: + if 'PN' not in extravalues: + res = am_init_re.match(value) + if res: + if res.group(1) != 'AC_PACKAGE_NAME': + extravalues['PN'] = process_value(res.group(1)) + pv = process_value(res.group(2)) + if validate_pv(pv): + extravalues['PV'] = pv + elif keyword == 'define(': + res = define_re.match(value) + if res: + key = res.group(2).strip('[]') + value = process_value(res.group(3)) + if value is not None: + defines[key] = value + + keywords = ['PKG_CHECK_MODULES', + 'PKG_CHECK_EXISTS', + 'AM_GNU_GETTEXT', + 'AM_GLIB_GNU_GETTEXT', + 'GETTEXT_PACKAGE', + 'AC_PROG_INTLTOOL', + 'IT_PROG_INTLTOOL', + 'AM_PATH_GLIB_2_0', + 'AC_CHECK_PROG', + 'AC_PATH_PROG', + 'AX_WITH_PROG', + 'AC_CHECK_LIB', + 'AX_CHECK_LIBRARY', + 'AC_PATH_X', + 'AX_BOOST', + 'BOOST_REQUIRE', + 'AC_PROG_LEX', + 'AM_PROG_LEX', + 'AX_PROG_FLEX', + 'AC_PROG_YACC', + 'AX_PROG_BISON', + 'AX_CHECK_ZLIB', + 'AX_CHECK_OPENSSL', + 'AX_LIB_CRYPTO', + 'AX_LIB_CURL', + 'AX_LIB_BEECRYPT', + 'AX_LIB_EXPAT', + 'AX_LIB_GCRYPT', + 'AX_LIB_NETTLE', + 'AX_LIB_READLINE' + 'AX_LIB_SQLITE3', + 'AX_LIB_TAGLIB', + 'AX_PKG_SWIG', + 'AC_PROG_SWIG', + 'AX_PROG_XSLTPROC', + 'AC_PYTHON_DEVEL', + 'AX_PYTHON_DEVEL', + 'AM_PATH_PYTHON', + 'AX_WITH_CURSES', + 'AX_PATH_BDB', + 'AX_PATH_LIB_PCRE', + 'AC_INIT', + 'AM_INIT_AUTOMAKE', + 'define(', + ] + + for handler in handlers: + handler.extend_keywords(keywords) + + for srcfile in srcfiles: + nesting = 0 + in_keyword = '' + partial = '' + with open(srcfile, 'r', errors='surrogateescape') as f: + for line in f: + if in_keyword: + partial += ' ' + line.strip() + if partial.endswith('\\'): + partial = partial[:-1] + nesting = nesting + line.count('(') - line.count(')') + if nesting == 0: + process_macro(in_keyword, partial) + partial = '' + in_keyword = '' + else: + for keyword in keywords: + if keyword in line: + nesting = line.count('(') - line.count(')') + if nesting > 0: + partial = line.strip() + if partial.endswith('\\'): + partial = partial[:-1] + in_keyword = keyword + else: + process_macro(keyword, line.strip()) + break + + if in_keyword: + process_macro(in_keyword, partial) + + if extravalues: + for k,v in list(extravalues.items()): + if v: + if v.startswith('$') or v.startswith('@') or v.startswith('%'): + del extravalues[k] + else: + extravalues[k] = v.strip('"\'').rstrip('()') + + if unmapped: + outlines.append('# NOTE: the following prog dependencies are unknown, ignoring: %s' % ' '.join(list(set(unmapped)))) + + RecipeHandler.handle_depends(libdeps, pcdeps, deps, outlines, values, tinfoil.config_data) + + for handler in handlers: + handler.post_process(srctree, libdeps, pcdeps, deps, outlines, inherits, values) + + if inherits: + values['inherit'] = ' '.join(list(set(inherits))) + + return values + + +class AutotoolsExtensionHandler(object): + '''Base class for Autotools extension handlers''' + def process_macro(self, srctree, keyword, value, process_value, libdeps, pcdeps, deps, outlines, inherits, values): + ''' + Handle a macro parsed out of an autotools file. Note that if you want this to be called + for any macro other than the ones AutotoolsRecipeHandler already looks for, you'll need + to add it to the keywords list in extend_keywords(). + Return True if you've completely handled the passed in macro, otherwise return False. + ''' + return False + + def extend_keywords(self, keywords): + '''Adds keywords to be recognised by the parser (so that you get a call to process_macro)''' + return + + def process_prog(self, srctree, keyword, value, prog, deps, outlines, inherits, values): + ''' + Handle an AC_PATH_PROG, AC_CHECK_PROG etc. line + Return True if you've completely handled the passed in macro, otherwise return False. + ''' + return False + + def post_process(self, srctree, fn, pkg, deps, outlines, inherits, values): + ''' + Apply any desired post-processing on the output + ''' + return + + +class MakefileRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + if 'buildsystem' in handled: + return False + + makefile = RecipeHandler.checkfiles(srctree, ['Makefile', 'makefile', 'GNUmakefile']) + if makefile: + lines_after.append('# NOTE: this is a Makefile-only piece of software, so we cannot generate much of the') + lines_after.append('# recipe automatically - you will need to examine the Makefile yourself and ensure') + lines_after.append('# that the appropriate arguments are passed in.') + lines_after.append('') + + scanfile = os.path.join(srctree, 'configure.scan') + skipscan = False + try: + stdout, stderr = bb.process.run('autoscan', cwd=srctree, shell=True) + except bb.process.ExecutionError as e: + skipscan = True + if scanfile and os.path.exists(scanfile): + values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, acfile=scanfile) + classes.extend(values.pop('inherit', '').split()) + for var, value in values.items(): + if var == 'DEPENDS': + lines_before.append('# NOTE: some of these dependencies may be optional, check the Makefile and/or upstream documentation') + lines_before.append('%s = "%s"' % (var, value)) + lines_before.append('') + for f in ['configure.scan', 'autoscan.log']: + fp = os.path.join(srctree, f) + if os.path.exists(fp): + os.remove(fp) + + self.genfunction(lines_after, 'do_configure', ['# Specify any needed configure commands here']) + + func = [] + func.append('# You will almost certainly need to add additional arguments here') + func.append('oe_runmake') + self.genfunction(lines_after, 'do_compile', func) + + installtarget = True + try: + stdout, stderr = bb.process.run('make -n install', cwd=srctree, shell=True) + except bb.process.ExecutionError as e: + if e.exitcode != 1: + installtarget = False + func = [] + if installtarget: + func.append('# This is a guess; additional arguments may be required') + makeargs = '' + with open(makefile[0], 'r', errors='surrogateescape') as f: + for i in range(1, 100): + if 'DESTDIR' in f.readline(): + makeargs += " 'DESTDIR=${D}'" + break + func.append('oe_runmake install%s' % makeargs) + else: + func.append('# NOTE: unable to determine what to put here - there is a Makefile but no') + func.append('# target named "install", so you will need to define this yourself') + self.genfunction(lines_after, 'do_install', func) + + handled.append('buildsystem') + else: + lines_after.append('# NOTE: no Makefile found, unable to determine what needs to be done') + lines_after.append('') + self.genfunction(lines_after, 'do_configure', ['# Specify any needed configure commands here']) + self.genfunction(lines_after, 'do_compile', ['# Specify compilation commands here']) + self.genfunction(lines_after, 'do_install', ['# Specify install commands here']) + + +class VersionFileRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + if 'PV' not in extravalues: + # Look for a VERSION or version file containing a single line consisting + # only of a version number + filelist = RecipeHandler.checkfiles(srctree, ['VERSION', 'version']) + version = None + for fileitem in filelist: + linecount = 0 + with open(fileitem, 'r', errors='surrogateescape') as f: + for line in f: + line = line.rstrip().strip('"\'') + linecount += 1 + if line: + if linecount > 1: + version = None + break + else: + if validate_pv(line): + version = line + if version: + extravalues['PV'] = version + break + + +class SpecFileRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + if 'PV' in extravalues and 'PN' in extravalues: + return + filelist = RecipeHandler.checkfiles(srctree, ['*.spec'], recursive=True) + valuemap = {'Name': 'PN', + 'Version': 'PV', + 'Summary': 'SUMMARY', + 'Url': 'HOMEPAGE', + 'License': 'LICENSE'} + foundvalues = {} + for fileitem in filelist: + linecount = 0 + with open(fileitem, 'r', errors='surrogateescape') as f: + for line in f: + for value, varname in valuemap.items(): + if line.startswith(value + ':') and not varname in foundvalues: + foundvalues[varname] = line.split(':', 1)[1].strip() + break + if len(foundvalues) == len(valuemap): + break + if 'PV' in foundvalues: + if not validate_pv(foundvalues['PV']): + del foundvalues['PV'] + license = foundvalues.pop('LICENSE', None) + if license: + liccomment = '# NOTE: spec file indicates the license may be "%s"' % license + for i, line in enumerate(lines_before): + if line.startswith('LICENSE ='): + lines_before.insert(i, liccomment) + break + else: + lines_before.append(liccomment) + extravalues.update(foundvalues) + +def register_recipe_handlers(handlers): + # Set priorities with some gaps so that other plugins can insert + # their own handlers (so avoid changing these numbers) + handlers.append((CmakeRecipeHandler(), 50)) + handlers.append((AutotoolsRecipeHandler(), 40)) + handlers.append((SconsRecipeHandler(), 30)) + handlers.append((QmakeRecipeHandler(), 20)) + handlers.append((MakefileRecipeHandler(), 10)) + handlers.append((VersionFileRecipeHandler(), -1)) + handlers.append((SpecFileRecipeHandler(), -1)) diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py new file mode 100644 index 0000000000..ec5449bee9 --- /dev/null +++ b/scripts/lib/recipetool/create_buildsys_python.py @@ -0,0 +1,717 @@ +# Recipe creation tool - create build system handler for python +# +# Copyright (C) 2015 Mentor Graphics Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import ast +import codecs +import collections +import distutils.command.build_py +import email +import imp +import glob +import itertools +import logging +import os +import re +import sys +import subprocess +from recipetool.create import RecipeHandler + +logger = logging.getLogger('recipetool') + +tinfoil = None + + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + + +class PythonRecipeHandler(RecipeHandler): + base_pkgdeps = ['python-core'] + excluded_pkgdeps = ['python-dbg'] + # os.path is provided by python-core + assume_provided = ['builtins', 'os.path'] + # Assumes that the host python builtin_module_names is sane for target too + assume_provided = assume_provided + list(sys.builtin_module_names) + + bbvar_map = { + 'Name': 'PN', + 'Version': 'PV', + 'Home-page': 'HOMEPAGE', + 'Summary': 'SUMMARY', + 'Description': 'DESCRIPTION', + 'License': 'LICENSE', + 'Requires': 'RDEPENDS_${PN}', + 'Provides': 'RPROVIDES_${PN}', + 'Obsoletes': 'RREPLACES_${PN}', + } + # PN/PV are already set by recipetool core & desc can be extremely long + excluded_fields = [ + 'Description', + ] + setup_parse_map = { + 'Url': 'Home-page', + 'Classifiers': 'Classifier', + 'Description': 'Summary', + } + setuparg_map = { + 'Home-page': 'url', + 'Classifier': 'classifiers', + 'Summary': 'description', + 'Description': 'long-description', + } + # Values which are lists, used by the setup.py argument based metadata + # extraction method, to determine how to process the setup.py output. + setuparg_list_fields = [ + 'Classifier', + 'Requires', + 'Provides', + 'Obsoletes', + 'Platform', + 'Supported-Platform', + ] + setuparg_multi_line_values = ['Description'] + replacements = [ + ('License', r' +$', ''), + ('License', r'^ +', ''), + ('License', r' ', '-'), + ('License', r'^GNU-', ''), + ('License', r'-[Ll]icen[cs]e(,?-[Vv]ersion)?', ''), + ('License', r'^UNKNOWN$', ''), + + # Remove currently unhandled version numbers from these variables + ('Requires', r' *\([^)]*\)', ''), + ('Provides', r' *\([^)]*\)', ''), + ('Obsoletes', r' *\([^)]*\)', ''), + ('Install-requires', r'^([^><= ]+).*', r'\1'), + ('Extras-require', r'^([^><= ]+).*', r'\1'), + ('Tests-require', r'^([^><= ]+).*', r'\1'), + + # Remove unhandled dependency on particular features (e.g. foo[PDF]) + ('Install-requires', r'\[[^\]]+\]$', ''), + ] + + classifier_license_map = { + 'License :: OSI Approved :: Academic Free License (AFL)': 'AFL', + 'License :: OSI Approved :: Apache Software License': 'Apache', + 'License :: OSI Approved :: Apple Public Source License': 'APSL', + 'License :: OSI Approved :: Artistic License': 'Artistic', + 'License :: OSI Approved :: Attribution Assurance License': 'AAL', + 'License :: OSI Approved :: BSD License': 'BSD', + 'License :: OSI Approved :: Common Public License': 'CPL', + 'License :: OSI Approved :: Eiffel Forum License': 'EFL', + 'License :: OSI Approved :: European Union Public Licence 1.0 (EUPL 1.0)': 'EUPL-1.0', + 'License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)': 'EUPL-1.1', + 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)': 'AGPL-3.0+', + 'License :: OSI Approved :: GNU Affero General Public License v3': 'AGPL-3.0', + 'License :: OSI Approved :: GNU Free Documentation License (FDL)': 'GFDL', + 'License :: OSI Approved :: GNU General Public License (GPL)': 'GPL', + 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)': 'GPL-2.0', + 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)': 'GPL-2.0+', + 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)': 'GPL-3.0', + 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)': 'GPL-3.0+', + 'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)': 'LGPL-2.0', + 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)': 'LGPL-2.0+', + 'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)': 'LGPL-3.0', + 'License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)': 'LGPL-3.0+', + 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)': 'LGPL', + 'License :: OSI Approved :: IBM Public License': 'IPL', + 'License :: OSI Approved :: ISC License (ISCL)': 'ISC', + 'License :: OSI Approved :: Intel Open Source License': 'Intel', + 'License :: OSI Approved :: Jabber Open Source License': 'Jabber', + 'License :: OSI Approved :: MIT License': 'MIT', + 'License :: OSI Approved :: MITRE Collaborative Virtual Workspace License (CVW)': 'CVWL', + 'License :: OSI Approved :: Motosoto License': 'Motosoto', + 'License :: OSI Approved :: Mozilla Public License 1.0 (MPL)': 'MPL-1.0', + 'License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)': 'MPL-1.1', + 'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)': 'MPL-2.0', + 'License :: OSI Approved :: Nethack General Public License': 'NGPL', + 'License :: OSI Approved :: Nokia Open Source License': 'Nokia', + 'License :: OSI Approved :: Open Group Test Suite License': 'OGTSL', + 'License :: OSI Approved :: Python License (CNRI Python License)': 'CNRI-Python', + 'License :: OSI Approved :: Python Software Foundation License': 'PSF', + 'License :: OSI Approved :: Qt Public License (QPL)': 'QPL', + 'License :: OSI Approved :: Ricoh Source Code Public License': 'RSCPL', + 'License :: OSI Approved :: Sleepycat License': 'Sleepycat', + 'License :: OSI Approved :: Sun Industry Standards Source License (SISSL)': '-- Sun Industry Standards Source License (SISSL)', + 'License :: OSI Approved :: Sun Public License': 'SPL', + 'License :: OSI Approved :: University of Illinois/NCSA Open Source License': 'NCSA', + 'License :: OSI Approved :: Vovida Software License 1.0': 'VSL-1.0', + 'License :: OSI Approved :: W3C License': 'W3C', + 'License :: OSI Approved :: X.Net License': 'Xnet', + 'License :: OSI Approved :: Zope Public License': 'ZPL', + 'License :: OSI Approved :: zlib/libpng License': 'Zlib', + } + + def __init__(self): + pass + + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + if 'buildsystem' in handled: + return False + + if not RecipeHandler.checkfiles(srctree, ['setup.py']): + return + + # setup.py is always parsed to get at certain required information, such as + # distutils vs setuptools + # + # If egg info is available, we use it for both its PKG-INFO metadata + # and for its requires.txt for install_requires. + # If PKG-INFO is available but no egg info is, we use that for metadata in preference to + # the parsed setup.py, but use the install_requires info from the + # parsed setup.py. + + setupscript = os.path.join(srctree, 'setup.py') + try: + setup_info, uses_setuptools, setup_non_literals, extensions = self.parse_setup_py(setupscript) + except Exception: + logger.exception("Failed to parse setup.py") + setup_info, uses_setuptools, setup_non_literals, extensions = {}, True, [], [] + + egginfo = glob.glob(os.path.join(srctree, '*.egg-info')) + if egginfo: + info = self.get_pkginfo(os.path.join(egginfo[0], 'PKG-INFO')) + requires_txt = os.path.join(egginfo[0], 'requires.txt') + if os.path.exists(requires_txt): + with codecs.open(requires_txt) as f: + inst_req = [] + extras_req = collections.defaultdict(list) + current_feature = None + for line in f.readlines(): + line = line.rstrip() + if not line: + continue + + if line.startswith('['): + current_feature = line[1:-1] + elif current_feature: + extras_req[current_feature].append(line) + else: + inst_req.append(line) + info['Install-requires'] = inst_req + info['Extras-require'] = extras_req + elif RecipeHandler.checkfiles(srctree, ['PKG-INFO']): + info = self.get_pkginfo(os.path.join(srctree, 'PKG-INFO')) + + if setup_info: + if 'Install-requires' in setup_info: + info['Install-requires'] = setup_info['Install-requires'] + if 'Extras-require' in setup_info: + info['Extras-require'] = setup_info['Extras-require'] + else: + if setup_info: + info = setup_info + else: + info = self.get_setup_args_info(setupscript) + + # Grab the license value before applying replacements + license_str = info.get('License', '').strip() + + self.apply_info_replacements(info) + + if uses_setuptools: + classes.append('setuptools') + else: + classes.append('distutils') + + if license_str: + for i, line in enumerate(lines_before): + if line.startswith('LICENSE = '): + lines_before.insert(i, '# NOTE: License in setup.py/PKGINFO is: %s' % license_str) + break + + if 'Classifier' in info: + existing_licenses = info.get('License', '') + licenses = [] + for classifier in info['Classifier']: + if classifier in self.classifier_license_map: + license = self.classifier_license_map[classifier] + if license == 'Apache' and 'Apache-2.0' in existing_licenses: + license = 'Apache-2.0' + elif license == 'GPL': + if 'GPL-2.0' in existing_licenses or 'GPLv2' in existing_licenses: + license = 'GPL-2.0' + elif 'GPL-3.0' in existing_licenses or 'GPLv3' in existing_licenses: + license = 'GPL-3.0' + elif license == 'LGPL': + if 'LGPL-2.1' in existing_licenses or 'LGPLv2.1' in existing_licenses: + license = 'LGPL-2.1' + elif 'LGPL-2.0' in existing_licenses or 'LGPLv2' in existing_licenses: + license = 'LGPL-2.0' + elif 'LGPL-3.0' in existing_licenses or 'LGPLv3' in existing_licenses: + license = 'LGPL-3.0' + licenses.append(license) + + if licenses: + info['License'] = ' & '.join(licenses) + + # Map PKG-INFO & setup.py fields to bitbake variables + for field, values in info.items(): + if field in self.excluded_fields: + continue + + if field not in self.bbvar_map: + continue + + if isinstance(values, str): + value = values + else: + value = ' '.join(str(v) for v in values if v) + + bbvar = self.bbvar_map[field] + if bbvar not in extravalues and value: + extravalues[bbvar] = value + + mapped_deps, unmapped_deps = self.scan_setup_python_deps(srctree, setup_info, setup_non_literals) + + extras_req = set() + if 'Extras-require' in info: + extras_req = info['Extras-require'] + if extras_req: + lines_after.append('# The following configs & dependencies are from setuptools extras_require.') + lines_after.append('# These dependencies are optional, hence can be controlled via PACKAGECONFIG.') + lines_after.append('# The upstream names may not correspond exactly to bitbake package names.') + lines_after.append('#') + lines_after.append('# Uncomment this line to enable all the optional features.') + lines_after.append('#PACKAGECONFIG ?= "{}"'.format(' '.join(k.lower() for k in extras_req))) + for feature, feature_reqs in extras_req.items(): + unmapped_deps.difference_update(feature_reqs) + + feature_req_deps = ('python-' + r.replace('.', '-').lower() for r in sorted(feature_reqs)) + lines_after.append('PACKAGECONFIG[{}] = ",,,{}"'.format(feature.lower(), ' '.join(feature_req_deps))) + + inst_reqs = set() + if 'Install-requires' in info: + if extras_req: + lines_after.append('') + inst_reqs = info['Install-requires'] + if inst_reqs: + unmapped_deps.difference_update(inst_reqs) + + inst_req_deps = ('python-' + r.replace('.', '-').lower() for r in sorted(inst_reqs)) + lines_after.append('# WARNING: the following rdepends are from setuptools install_requires. These') + lines_after.append('# upstream names may not correspond exactly to bitbake package names.') + lines_after.append('RDEPENDS_${{PN}} += "{}"'.format(' '.join(inst_req_deps))) + + if mapped_deps: + name = info.get('Name') + if name and name[0] in mapped_deps: + # Attempt to avoid self-reference + mapped_deps.remove(name[0]) + mapped_deps -= set(self.excluded_pkgdeps) + if inst_reqs or extras_req: + lines_after.append('') + lines_after.append('# WARNING: the following rdepends are determined through basic analysis of the') + lines_after.append('# python sources, and might not be 100% accurate.') + lines_after.append('RDEPENDS_${{PN}} += "{}"'.format(' '.join(sorted(mapped_deps)))) + + unmapped_deps -= set(extensions) + unmapped_deps -= set(self.assume_provided) + if unmapped_deps: + if mapped_deps: + lines_after.append('') + lines_after.append('# WARNING: We were unable to map the following python package/module') + lines_after.append('# dependencies to the bitbake packages which include them:') + lines_after.extend('# {}'.format(d) for d in sorted(unmapped_deps)) + + handled.append('buildsystem') + + def get_pkginfo(self, pkginfo_fn): + msg = email.message_from_file(open(pkginfo_fn, 'r')) + msginfo = {} + for field in msg.keys(): + values = msg.get_all(field) + if len(values) == 1: + msginfo[field] = values[0] + else: + msginfo[field] = values + return msginfo + + def parse_setup_py(self, setupscript='./setup.py'): + with codecs.open(setupscript) as f: + info, imported_modules, non_literals, extensions = gather_setup_info(f) + + def _map(key): + key = key.replace('_', '-') + key = key[0].upper() + key[1:] + if key in self.setup_parse_map: + key = self.setup_parse_map[key] + return key + + # Naive mapping of setup() arguments to PKG-INFO field names + for d in [info, non_literals]: + for key, value in list(d.items()): + new_key = _map(key) + if new_key != key: + del d[key] + d[new_key] = value + + return info, 'setuptools' in imported_modules, non_literals, extensions + + def get_setup_args_info(self, setupscript='./setup.py'): + cmd = ['python', setupscript] + info = {} + keys = set(self.bbvar_map.keys()) + keys |= set(self.setuparg_list_fields) + keys |= set(self.setuparg_multi_line_values) + grouped_keys = itertools.groupby(keys, lambda k: (k in self.setuparg_list_fields, k in self.setuparg_multi_line_values)) + for index, keys in grouped_keys: + if index == (True, False): + # Splitlines output for each arg as a list value + for key in keys: + arg = self.setuparg_map.get(key, key.lower()) + try: + arg_info = self.run_command(cmd + ['--' + arg], cwd=os.path.dirname(setupscript)) + except (OSError, subprocess.CalledProcessError): + pass + else: + info[key] = [l.rstrip() for l in arg_info.splitlines()] + elif index == (False, True): + # Entire output for each arg + for key in keys: + arg = self.setuparg_map.get(key, key.lower()) + try: + arg_info = self.run_command(cmd + ['--' + arg], cwd=os.path.dirname(setupscript)) + except (OSError, subprocess.CalledProcessError): + pass + else: + info[key] = arg_info + else: + info.update(self.get_setup_byline(list(keys), setupscript)) + return info + + def get_setup_byline(self, fields, setupscript='./setup.py'): + info = {} + + cmd = ['python', setupscript] + cmd.extend('--' + self.setuparg_map.get(f, f.lower()) for f in fields) + try: + info_lines = self.run_command(cmd, cwd=os.path.dirname(setupscript)).splitlines() + except (OSError, subprocess.CalledProcessError): + pass + else: + if len(fields) != len(info_lines): + logger.error('Mismatch between setup.py output lines and number of fields') + sys.exit(1) + + for lineno, line in enumerate(info_lines): + line = line.rstrip() + info[fields[lineno]] = line + return info + + def apply_info_replacements(self, info): + for variable, search, replace in self.replacements: + if variable not in info: + continue + + def replace_value(search, replace, value): + if replace is None: + if re.search(search, value): + return None + else: + new_value = re.sub(search, replace, value) + if value != new_value: + return new_value + return value + + value = info[variable] + if isinstance(value, str): + new_value = replace_value(search, replace, value) + if new_value is None: + del info[variable] + elif new_value != value: + info[variable] = new_value + elif hasattr(value, 'items'): + for dkey, dvalue in list(value.items()): + new_list = [] + for pos, a_value in enumerate(dvalue): + new_value = replace_value(search, replace, a_value) + if new_value is not None and new_value != value: + new_list.append(new_value) + + if value != new_list: + value[dkey] = new_list + else: + new_list = [] + for pos, a_value in enumerate(value): + new_value = replace_value(search, replace, a_value) + if new_value is not None and new_value != value: + new_list.append(new_value) + + if value != new_list: + info[variable] = new_list + + def scan_setup_python_deps(self, srctree, setup_info, setup_non_literals): + if 'Package-dir' in setup_info: + package_dir = setup_info['Package-dir'] + else: + package_dir = {} + + class PackageDir(distutils.command.build_py.build_py): + def __init__(self, package_dir): + self.package_dir = package_dir + + pd = PackageDir(package_dir) + to_scan = [] + if not any(v in setup_non_literals for v in ['Py-modules', 'Scripts', 'Packages']): + if 'Py-modules' in setup_info: + for module in setup_info['Py-modules']: + try: + package, module = module.rsplit('.', 1) + except ValueError: + package, module = '.', module + module_path = os.path.join(pd.get_package_dir(package), module + '.py') + to_scan.append(module_path) + + if 'Packages' in setup_info: + for package in setup_info['Packages']: + to_scan.append(pd.get_package_dir(package)) + + if 'Scripts' in setup_info: + to_scan.extend(setup_info['Scripts']) + else: + logger.info("Scanning the entire source tree, as one or more of the following setup keywords are non-literal: py_modules, scripts, packages.") + + if not to_scan: + to_scan = ['.'] + + logger.info("Scanning paths for packages & dependencies: %s", ', '.join(to_scan)) + + provided_packages = self.parse_pkgdata_for_python_packages() + scanned_deps = self.scan_python_dependencies([os.path.join(srctree, p) for p in to_scan]) + mapped_deps, unmapped_deps = set(self.base_pkgdeps), set() + for dep in scanned_deps: + mapped = provided_packages.get(dep) + if mapped: + logger.debug('Mapped %s to %s' % (dep, mapped)) + mapped_deps.add(mapped) + else: + logger.debug('Could not map %s' % dep) + unmapped_deps.add(dep) + return mapped_deps, unmapped_deps + + def scan_python_dependencies(self, paths): + deps = set() + try: + dep_output = self.run_command(['pythondeps', '-d'] + paths) + except (OSError, subprocess.CalledProcessError): + pass + else: + for line in dep_output.splitlines(): + line = line.rstrip() + dep, filename = line.split('\t', 1) + if filename.endswith('/setup.py'): + continue + deps.add(dep) + + try: + provides_output = self.run_command(['pythondeps', '-p'] + paths) + except (OSError, subprocess.CalledProcessError): + pass + else: + provides_lines = (l.rstrip() for l in provides_output.splitlines()) + provides = set(l for l in provides_lines if l and l != 'setup') + deps -= provides + + return deps + + def parse_pkgdata_for_python_packages(self): + suffixes = [t[0] for t in imp.get_suffixes()] + pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR') + + ldata = tinfoil.config_data.createCopy() + bb.parse.handle('classes/python-dir.bbclass', ldata, True) + python_sitedir = ldata.getVar('PYTHON_SITEPACKAGES_DIR') + + dynload_dir = os.path.join(os.path.dirname(python_sitedir), 'lib-dynload') + python_dirs = [python_sitedir + os.sep, + os.path.join(os.path.dirname(python_sitedir), 'dist-packages') + os.sep, + os.path.dirname(python_sitedir) + os.sep] + packages = {} + for pkgdatafile in glob.glob('{}/runtime/*'.format(pkgdata_dir)): + files_info = None + with open(pkgdatafile, 'r') as f: + for line in f.readlines(): + field, value = line.split(': ', 1) + if field == 'FILES_INFO': + files_info = ast.literal_eval(value) + break + else: + continue + + for fn in files_info: + for suffix in suffixes: + if fn.endswith(suffix): + break + else: + continue + + if fn.startswith(dynload_dir + os.sep): + if '/.debug/' in fn: + continue + base = os.path.basename(fn) + provided = base.split('.', 1)[0] + packages[provided] = os.path.basename(pkgdatafile) + continue + + for python_dir in python_dirs: + if fn.startswith(python_dir): + relpath = fn[len(python_dir):] + relstart, _, relremaining = relpath.partition(os.sep) + if relstart.endswith('.egg'): + relpath = relremaining + base, _ = os.path.splitext(relpath) + + if '/.debug/' in base: + continue + if os.path.basename(base) == '__init__': + base = os.path.dirname(base) + base = base.replace(os.sep + os.sep, os.sep) + provided = base.replace(os.sep, '.') + packages[provided] = os.path.basename(pkgdatafile) + return packages + + @classmethod + def run_command(cls, cmd, **popenargs): + if 'stderr' not in popenargs: + popenargs['stderr'] = subprocess.STDOUT + try: + return subprocess.check_output(cmd, **popenargs).decode('utf-8') + except OSError as exc: + logger.error('Unable to run `{}`: {}', ' '.join(cmd), exc) + raise + except subprocess.CalledProcessError as exc: + logger.error('Unable to run `{}`: {}', ' '.join(cmd), exc.output) + raise + + +def gather_setup_info(fileobj): + parsed = ast.parse(fileobj.read(), fileobj.name) + visitor = SetupScriptVisitor() + visitor.visit(parsed) + + non_literals, extensions = {}, [] + for key, value in list(visitor.keywords.items()): + if key == 'ext_modules': + if isinstance(value, list): + for ext in value: + if (isinstance(ext, ast.Call) and + isinstance(ext.func, ast.Name) and + ext.func.id == 'Extension' and + not has_non_literals(ext.args)): + extensions.append(ext.args[0]) + elif has_non_literals(value): + non_literals[key] = value + del visitor.keywords[key] + + return visitor.keywords, visitor.imported_modules, non_literals, extensions + + +class SetupScriptVisitor(ast.NodeVisitor): + def __init__(self): + ast.NodeVisitor.__init__(self) + self.keywords = {} + self.non_literals = [] + self.imported_modules = set() + + def visit_Expr(self, node): + if isinstance(node.value, ast.Call) and \ + isinstance(node.value.func, ast.Name) and \ + node.value.func.id == 'setup': + self.visit_setup(node.value) + + def visit_setup(self, node): + call = LiteralAstTransform().visit(node) + self.keywords = call.keywords + for k, v in self.keywords.items(): + if has_non_literals(v): + self.non_literals.append(k) + + def visit_Import(self, node): + for alias in node.names: + self.imported_modules.add(alias.name) + + def visit_ImportFrom(self, node): + self.imported_modules.add(node.module) + + +class LiteralAstTransform(ast.NodeTransformer): + """Simplify the ast through evaluation of literals.""" + excluded_fields = ['ctx'] + + def visit(self, node): + if not isinstance(node, ast.AST): + return node + else: + return ast.NodeTransformer.visit(self, node) + + def generic_visit(self, node): + try: + return ast.literal_eval(node) + except ValueError: + for field, value in ast.iter_fields(node): + if field in self.excluded_fields: + delattr(node, field) + if value is None: + continue + + if isinstance(value, list): + if field in ('keywords', 'kwargs'): + new_value = dict((kw.arg, self.visit(kw.value)) for kw in value) + else: + new_value = [self.visit(i) for i in value] + else: + new_value = self.visit(value) + setattr(node, field, new_value) + return node + + def visit_Name(self, node): + if hasattr('__builtins__', node.id): + return getattr(__builtins__, node.id) + else: + return self.generic_visit(node) + + def visit_Tuple(self, node): + return tuple(self.visit(v) for v in node.elts) + + def visit_List(self, node): + return [self.visit(v) for v in node.elts] + + def visit_Set(self, node): + return set(self.visit(v) for v in node.elts) + + def visit_Dict(self, node): + keys = (self.visit(k) for k in node.keys) + values = (self.visit(v) for v in node.values) + return dict(zip(keys, values)) + + +def has_non_literals(value): + if isinstance(value, ast.AST): + return True + elif isinstance(value, str): + return False + elif hasattr(value, 'values'): + return any(has_non_literals(v) for v in value.values()) + elif hasattr(value, '__iter__'): + return any(has_non_literals(v) for v in value) + + +def register_recipe_handlers(handlers): + # We need to make sure this is ahead of the makefile fallback handler + handlers.append((PythonRecipeHandler(), 70)) diff --git a/scripts/lib/recipetool/create_kernel.py b/scripts/lib/recipetool/create_kernel.py new file mode 100644 index 0000000000..ca4996c7ac --- /dev/null +++ b/scripts/lib/recipetool/create_kernel.py @@ -0,0 +1,99 @@ +# Recipe creation tool - kernel support plugin +# +# Copyright (C) 2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import re +import logging +from recipetool.create import RecipeHandler, read_pkgconfig_provides, validate_pv + +logger = logging.getLogger('recipetool') + +tinfoil = None + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + + +class KernelRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + import bb.process + if 'buildsystem' in handled: + return False + + for tell in ['arch', 'firmware', 'Kbuild', 'Kconfig']: + if not os.path.exists(os.path.join(srctree, tell)): + return False + + handled.append('buildsystem') + del lines_after[:] + del classes[:] + template = os.path.join(tinfoil.config_data.getVar('COREBASE'), 'meta-skeleton', 'recipes-kernel', 'linux', 'linux-yocto-custom.bb') + def handle_var(varname, origvalue, op, newlines): + if varname in ['SRCREV', 'SRCREV_machine']: + while newlines[-1].startswith('#'): + del newlines[-1] + try: + stdout, _ = bb.process.run('git rev-parse HEAD', cwd=srctree, shell=True) + except bb.process.ExecutionError as e: + stdout = None + if stdout: + return stdout.strip(), op, 0, True + elif varname == 'LINUX_VERSION': + makefile = os.path.join(srctree, 'Makefile') + if os.path.exists(makefile): + kversion = -1 + kpatchlevel = -1 + ksublevel = -1 + kextraversion = '' + with open(makefile, 'r', errors='surrogateescape') as f: + for i, line in enumerate(f): + if i > 10: + break + if line.startswith('VERSION ='): + kversion = int(line.split('=')[1].strip()) + elif line.startswith('PATCHLEVEL ='): + kpatchlevel = int(line.split('=')[1].strip()) + elif line.startswith('SUBLEVEL ='): + ksublevel = int(line.split('=')[1].strip()) + elif line.startswith('EXTRAVERSION ='): + kextraversion = line.split('=')[1].strip() + version = '' + if kversion > -1 and kpatchlevel > -1: + version = '%d.%d' % (kversion, kpatchlevel) + if ksublevel > -1: + version += '.%d' % ksublevel + version += kextraversion + if version: + return version, op, 0, True + elif varname == 'SRC_URI': + while newlines[-1].startswith('#'): + del newlines[-1] + elif varname == 'COMPATIBLE_MACHINE': + while newlines[-1].startswith('#'): + del newlines[-1] + machine = tinfoil.config_data.getVar('MACHINE') + return machine, op, 0, True + return origvalue, op, 0, True + with open(template, 'r') as f: + varlist = ['SRCREV', 'SRCREV_machine', 'SRC_URI', 'LINUX_VERSION', 'COMPATIBLE_MACHINE'] + (_, newlines) = bb.utils.edit_metadata(f, varlist, handle_var) + lines_before[:] = [line.rstrip('\n') for line in newlines] + + return True + +def register_recipe_handlers(handlers): + handlers.append((KernelRecipeHandler(), 100)) diff --git a/scripts/lib/recipetool/create_kmod.py b/scripts/lib/recipetool/create_kmod.py new file mode 100644 index 0000000000..7cf188db21 --- /dev/null +++ b/scripts/lib/recipetool/create_kmod.py @@ -0,0 +1,152 @@ +# Recipe creation tool - kernel module support plugin +# +# Copyright (C) 2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import re +import logging +from recipetool.create import RecipeHandler, read_pkgconfig_provides, validate_pv + +logger = logging.getLogger('recipetool') + +tinfoil = None + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + + +class KernelModuleRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + import bb.process + if 'buildsystem' in handled: + return False + + module_inc_re = re.compile(r'^#include\s+<linux/module.h>$') + makefiles = [] + is_module = False + + makefiles = [] + + files = RecipeHandler.checkfiles(srctree, ['*.c', '*.h'], recursive=True) + if files: + for cfile in files: + # Look in same dir or parent for Makefile + for makefile in [os.path.join(os.path.dirname(cfile), 'Makefile'), os.path.join(os.path.dirname(os.path.dirname(cfile)), 'Makefile')]: + if makefile in makefiles: + break + else: + if os.path.exists(makefile): + makefiles.append(makefile) + break + else: + continue + with open(cfile, 'r', errors='surrogateescape') as f: + for line in f: + if module_inc_re.match(line.strip()): + is_module = True + break + if is_module: + break + + if is_module: + classes.append('module') + handled.append('buildsystem') + # module.bbclass and the classes it inherits do most of the hard + # work, but we need to tweak it slightly depending on what the + # Makefile does (and there is a range of those) + # Check the makefile for the appropriate install target + install_lines = [] + compile_lines = [] + in_install = False + in_compile = False + install_target = None + with open(makefile, 'r', errors='surrogateescape') as f: + for line in f: + if line.startswith('install:'): + if not install_lines: + in_install = True + install_target = 'install' + elif line.startswith('modules_install:'): + install_lines = [] + in_install = True + install_target = 'modules_install' + elif line.startswith('modules:'): + compile_lines = [] + in_compile = True + elif line.startswith(('all:', 'default:')): + if not compile_lines: + in_compile = True + elif line: + if line[0] == '\t': + if in_install: + install_lines.append(line) + elif in_compile: + compile_lines.append(line) + elif ':' in line: + in_install = False + in_compile = False + + def check_target(lines, install): + kdirpath = '' + manual_install = False + for line in lines: + splitline = line.split() + if splitline[0] in ['make', 'gmake', '$(MAKE)']: + if '-C' in splitline: + idx = splitline.index('-C') + 1 + if idx < len(splitline): + kdirpath = splitline[idx] + break + elif install and splitline[0] == 'install': + if '.ko' in line: + manual_install = True + return kdirpath, manual_install + + kdirpath = None + manual_install = False + if install_lines: + kdirpath, manual_install = check_target(install_lines, install=True) + if compile_lines and not kdirpath: + kdirpath, _ = check_target(compile_lines, install=False) + + if manual_install or not install_lines: + lines_after.append('EXTRA_OEMAKE_append_task-install = " -C ${STAGING_KERNEL_DIR} M=${S}"') + elif install_target and install_target != 'modules_install': + lines_after.append('MODULES_INSTALL_TARGET = "install"') + + warnmsg = None + kdirvar = None + if kdirpath: + res = re.match(r'\$\(([^$)]+)\)', kdirpath) + if res: + kdirvar = res.group(1) + if kdirvar != 'KERNEL_SRC': + lines_after.append('EXTRA_OEMAKE += "%s=${STAGING_KERNEL_DIR}"' % kdirvar) + elif kdirpath.startswith('/lib/'): + warnmsg = 'Kernel path in install makefile is hardcoded - you will need to patch the makefile' + if not kdirvar and not warnmsg: + warnmsg = 'Unable to find means of passing kernel path into install makefile - if kernel path is hardcoded you will need to patch the makefile' + if warnmsg: + warnmsg += '. Note that the variable KERNEL_SRC will be passed in as the kernel source path.' + logger.warn(warnmsg) + lines_after.append('# %s' % warnmsg) + + return True + + return False + +def register_recipe_handlers(handlers): + handlers.append((KernelModuleRecipeHandler(), 15)) diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py new file mode 100644 index 0000000000..cb8f338b8b --- /dev/null +++ b/scripts/lib/recipetool/create_npm.py @@ -0,0 +1,344 @@ +# Recipe creation tool - node.js NPM module support plugin +# +# Copyright (C) 2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import os +import logging +import subprocess +import tempfile +import shutil +import json +from recipetool.create import RecipeHandler, split_pkg_licenses, handle_license_vars, check_npm + +logger = logging.getLogger('recipetool') + + +tinfoil = None + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + + +class NpmRecipeHandler(RecipeHandler): + lockdownpath = None + + def _handle_license(self, data): + ''' + Handle the license value from an npm package.json file + ''' + license = None + if 'license' in data: + license = data['license'] + if isinstance(license, dict): + license = license.get('type', None) + if license: + if 'OR' in license: + license = license.replace('OR', '|') + license = license.replace('AND', '&') + license = license.replace(' ', '_') + if not license[0] == '(': + license = '(' + license + ')' + print('LICENSE: {}'.format(license)) + else: + license = license.replace('AND', '&') + if license[0] == '(': + license = license[1:] + if license[-1] == ')': + license = license[:-1] + license = license.replace('MIT/X11', 'MIT') + license = license.replace('Public Domain', 'PD') + license = license.replace('SEE LICENSE IN EULA', + 'SEE-LICENSE-IN-EULA') + return license + + def _shrinkwrap(self, srctree, localfilesdir, extravalues, lines_before, d): + try: + runenv = dict(os.environ, PATH=d.getVar('PATH')) + bb.process.run('npm shrinkwrap', cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True) + except bb.process.ExecutionError as e: + logger.warn('npm shrinkwrap failed:\n%s' % e.stdout) + return + + tmpfile = os.path.join(localfilesdir, 'npm-shrinkwrap.json') + shutil.move(os.path.join(srctree, 'npm-shrinkwrap.json'), tmpfile) + extravalues.setdefault('extrafiles', {}) + extravalues['extrafiles']['npm-shrinkwrap.json'] = tmpfile + lines_before.append('NPM_SHRINKWRAP := "${THISDIR}/${PN}/npm-shrinkwrap.json"') + + def _lockdown(self, srctree, localfilesdir, extravalues, lines_before, d): + runenv = dict(os.environ, PATH=d.getVar('PATH')) + if not NpmRecipeHandler.lockdownpath: + NpmRecipeHandler.lockdownpath = tempfile.mkdtemp('recipetool-npm-lockdown') + bb.process.run('npm install lockdown --prefix %s' % NpmRecipeHandler.lockdownpath, + cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True) + relockbin = os.path.join(NpmRecipeHandler.lockdownpath, 'node_modules', 'lockdown', 'relock.js') + if not os.path.exists(relockbin): + logger.warn('Could not find relock.js within lockdown directory; skipping lockdown') + return + try: + bb.process.run('node %s' % relockbin, cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True) + except bb.process.ExecutionError as e: + logger.warn('lockdown-relock failed:\n%s' % e.stdout) + return + + tmpfile = os.path.join(localfilesdir, 'lockdown.json') + shutil.move(os.path.join(srctree, 'lockdown.json'), tmpfile) + extravalues.setdefault('extrafiles', {}) + extravalues['extrafiles']['lockdown.json'] = tmpfile + lines_before.append('NPM_LOCKDOWN := "${THISDIR}/${PN}/lockdown.json"') + + def _handle_dependencies(self, d, deps, optdeps, devdeps, lines_before, srctree): + import scriptutils + # If this isn't a single module we need to get the dependencies + # and add them to SRC_URI + def varfunc(varname, origvalue, op, newlines): + if varname == 'SRC_URI': + if not origvalue.startswith('npm://'): + src_uri = origvalue.split() + changed = False + deplist = {} + for dep, depver in optdeps.items(): + depdata = self.get_npm_data(dep, depver, d) + if self.check_npm_optional_dependency(depdata): + deplist[dep] = depdata + for dep, depver in devdeps.items(): + depdata = self.get_npm_data(dep, depver, d) + if self.check_npm_optional_dependency(depdata): + deplist[dep] = depdata + for dep, depver in deps.items(): + depdata = self.get_npm_data(dep, depver, d) + deplist[dep] = depdata + + for dep, depdata in deplist.items(): + version = depdata.get('version', None) + if version: + url = 'npm://registry.npmjs.org;name=%s;version=%s;subdir=node_modules/%s' % (dep, version, dep) + scriptutils.fetch_uri(d, url, srctree) + src_uri.append(url) + changed = True + if changed: + return src_uri, None, -1, True + return origvalue, None, 0, True + updated, newlines = bb.utils.edit_metadata(lines_before, ['SRC_URI'], varfunc) + if updated: + del lines_before[:] + for line in newlines: + # Hack to avoid newlines that edit_metadata inserts + if line.endswith('\n'): + line = line[:-1] + lines_before.append(line) + return updated + + def _replace_license_vars(self, srctree, lines_before, handled, extravalues, d): + for item in handled: + if isinstance(item, tuple): + if item[0] == 'license': + del item + break + + calledvars = [] + def varfunc(varname, origvalue, op, newlines): + if varname in ['LICENSE', 'LIC_FILES_CHKSUM']: + for i, e in enumerate(reversed(newlines)): + if not e.startswith('#'): + stop = i + while stop > 0: + newlines.pop() + stop -= 1 + break + calledvars.append(varname) + if len(calledvars) > 1: + # The second time around, put the new license text in + insertpos = len(newlines) + handle_license_vars(srctree, newlines, handled, extravalues, d) + return None, None, 0, True + return origvalue, None, 0, True + updated, newlines = bb.utils.edit_metadata(lines_before, ['LICENSE', 'LIC_FILES_CHKSUM'], varfunc) + if updated: + del lines_before[:] + lines_before.extend(newlines) + else: + raise Exception('Did not find license variables') + + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): + import bb.utils + import oe + from collections import OrderedDict + + if 'buildsystem' in handled: + return False + + def read_package_json(fn): + with open(fn, 'r', errors='surrogateescape') as f: + return json.loads(f.read()) + + files = RecipeHandler.checkfiles(srctree, ['package.json']) + if files: + d = bb.data.createCopy(tinfoil.config_data) + npm_bindir = check_npm(tinfoil, self._devtool) + d.prependVar('PATH', '%s:' % npm_bindir) + + data = read_package_json(files[0]) + if 'name' in data and 'version' in data: + extravalues['PN'] = data['name'] + extravalues['PV'] = data['version'] + classes.append('npm') + handled.append('buildsystem') + if 'description' in data: + extravalues['SUMMARY'] = data['description'] + if 'homepage' in data: + extravalues['HOMEPAGE'] = data['homepage'] + + fetchdev = extravalues['fetchdev'] or None + deps, optdeps, devdeps = self.get_npm_package_dependencies(data, fetchdev) + updated = self._handle_dependencies(d, deps, optdeps, devdeps, lines_before, srctree) + if updated: + # We need to redo the license stuff + self._replace_license_vars(srctree, lines_before, handled, extravalues, d) + + # Shrinkwrap + localfilesdir = tempfile.mkdtemp(prefix='recipetool-npm') + self._shrinkwrap(srctree, localfilesdir, extravalues, lines_before, d) + + # Lockdown + self._lockdown(srctree, localfilesdir, extravalues, lines_before, d) + + # Split each npm module out to is own package + npmpackages = oe.package.npm_split_package_dirs(srctree) + for item in handled: + if isinstance(item, tuple): + if item[0] == 'license': + licvalues = item[1] + break + if licvalues: + # Augment the license list with information we have in the packages + licenses = {} + license = self._handle_license(data) + if license: + licenses['${PN}'] = license + for pkgname, pkgitem in npmpackages.items(): + _, pdata = pkgitem + license = self._handle_license(pdata) + if license: + licenses[pkgname] = license + # Now write out the package-specific license values + # We need to strip out the json data dicts for this since split_pkg_licenses + # isn't expecting it + packages = OrderedDict((x,y[0]) for x,y in npmpackages.items()) + packages['${PN}'] = '' + pkglicenses = split_pkg_licenses(licvalues, packages, lines_after, licenses) + all_licenses = list(set([item.replace('_', ' ') for pkglicense in pkglicenses.values() for item in pkglicense])) + if '&' in all_licenses: + all_licenses.remove('&') + # Go back and update the LICENSE value since we have a bit more + # information than when that was written out (and we know all apply + # vs. there being a choice, so we can join them with &) + for i, line in enumerate(lines_before): + if line.startswith('LICENSE = '): + lines_before[i] = 'LICENSE = "%s"' % ' & '.join(all_licenses) + break + + # Need to move S setting after inherit npm + for i, line in enumerate(lines_before): + if line.startswith('S ='): + lines_before.pop(i) + lines_after.insert(0, '# Must be set after inherit npm since that itself sets S') + lines_after.insert(1, line) + break + + return True + + return False + + # FIXME this is duplicated from lib/bb/fetch2/npm.py + def _parse_view(self, output): + ''' + Parse the output of npm view --json; the last JSON result + is assumed to be the one that we're interested in. + ''' + pdata = None + outdeps = {} + datalines = [] + bracelevel = 0 + for line in output.splitlines(): + if bracelevel: + datalines.append(line) + elif '{' in line: + datalines = [] + datalines.append(line) + bracelevel = bracelevel + line.count('{') - line.count('}') + if datalines: + pdata = json.loads('\n'.join(datalines)) + return pdata + + # FIXME this is effectively duplicated from lib/bb/fetch2/npm.py + # (split out from _getdependencies()) + def get_npm_data(self, pkg, version, d): + import bb.fetch2 + pkgfullname = pkg + if version != '*' and not '/' in version: + pkgfullname += "@'%s'" % version + logger.debug(2, "Calling getdeps on %s" % pkg) + runenv = dict(os.environ, PATH=d.getVar('PATH')) + fetchcmd = "npm view %s --json" % pkgfullname + output, _ = bb.process.run(fetchcmd, stderr=subprocess.STDOUT, env=runenv, shell=True) + data = self._parse_view(output) + return data + + # FIXME this is effectively duplicated from lib/bb/fetch2/npm.py + # (split out from _getdependencies()) + def get_npm_package_dependencies(self, pdata, fetchdev): + dependencies = pdata.get('dependencies', {}) + optionalDependencies = pdata.get('optionalDependencies', {}) + dependencies.update(optionalDependencies) + if fetchdev: + devDependencies = pdata.get('devDependencies', {}) + dependencies.update(devDependencies) + else: + devDependencies = {} + depsfound = {} + optdepsfound = {} + devdepsfound = {} + for dep in dependencies: + if dep in optionalDependencies: + optdepsfound[dep] = dependencies[dep] + elif dep in devDependencies: + devdepsfound[dep] = dependencies[dep] + else: + depsfound[dep] = dependencies[dep] + return depsfound, optdepsfound, devdepsfound + + # FIXME this is effectively duplicated from lib/bb/fetch2/npm.py + # (split out from _getdependencies()) + def check_npm_optional_dependency(self, pdata): + pkg_os = pdata.get('os', None) + if pkg_os: + if not isinstance(pkg_os, list): + pkg_os = [pkg_os] + blacklist = False + for item in pkg_os: + if item.startswith('!'): + blacklist = True + break + if (not blacklist and 'linux' not in pkg_os) or '!linux' in pkg_os: + logger.debug(2, "Skipping %s since it's incompatible with Linux" % pkg) + return False + return True + + +def register_recipe_handlers(handlers): + handlers.append((NpmRecipeHandler(), 60)) diff --git a/scripts/lib/recipetool/newappend.py b/scripts/lib/recipetool/newappend.py new file mode 100644 index 0000000000..0b63759d8c --- /dev/null +++ b/scripts/lib/recipetool/newappend.py @@ -0,0 +1,89 @@ +# Recipe creation tool - newappend plugin +# +# This sub-command creates a bbappend for the specified target and prints the +# path to the bbappend. +# +# Example: recipetool newappend meta-mylayer busybox +# +# Copyright (C) 2015 Christopher Larson <kergoth@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import argparse +import errno +import logging +import os +import re +import subprocess +import sys +import scriptutils + + +logger = logging.getLogger('recipetool') +tinfoil = None + + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + + +def layer(layerpath): + if not os.path.exists(os.path.join(layerpath, 'conf', 'layer.conf')): + raise argparse.ArgumentTypeError('{0!r} must be a path to a valid layer'.format(layerpath)) + return layerpath + + +def newappend(args): + import oe.recipeutils + + recipe_path = tinfoil.get_recipe_file(args.target) + + rd = tinfoil.config_data.createCopy() + rd.setVar('FILE', recipe_path) + append_path, path_ok = oe.recipeutils.get_bbappend_path(rd, args.destlayer, args.wildcard_version) + if not append_path: + logger.error('Unable to determine layer directory containing %s', recipe_path) + return 1 + + if not path_ok: + logger.warn('Unable to determine correct subdirectory path for bbappend file - check that what %s adds to BBFILES also matches .bbappend files. Using %s for now, but until you fix this the bbappend will not be applied.', os.path.join(args.destlayer, 'conf', 'layer.conf'), os.path.dirname(append_path)) + + layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS').split()] + if not os.path.abspath(args.destlayer) in layerdirs: + logger.warn('Specified layer is not currently enabled in bblayers.conf, you will need to add it before this bbappend will be active') + + if not os.path.exists(append_path): + bb.utils.mkdirhier(os.path.dirname(append_path)) + + try: + open(append_path, 'a').close() + except (OSError, IOError) as exc: + logger.critical(str(exc)) + return 1 + + if args.edit: + return scriptutils.run_editor([append_path, recipe_path]) + else: + print(append_path) + + +def register_commands(subparsers): + parser = subparsers.add_parser('newappend', + help='Create a bbappend for the specified target in the specified layer') + parser.add_argument('-e', '--edit', help='Edit the new append. This obeys $VISUAL if set, otherwise $EDITOR, otherwise vi.', action='store_true') + parser.add_argument('-w', '--wildcard-version', help='Use wildcard to make the bbappend apply to any recipe version', action='store_true') + parser.add_argument('destlayer', help='Base directory of the destination layer to write the bbappend to', type=layer) + parser.add_argument('target', help='Target recipe/provide to append') + parser.set_defaults(func=newappend, parserecipes=True) diff --git a/scripts/lib/recipetool/setvar.py b/scripts/lib/recipetool/setvar.py new file mode 100644 index 0000000000..9de315a0ef --- /dev/null +++ b/scripts/lib/recipetool/setvar.py @@ -0,0 +1,75 @@ +# Recipe creation tool - set variable plugin +# +# Copyright (C) 2015 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import os +import argparse +import glob +import fnmatch +import re +import logging +import scriptutils + +logger = logging.getLogger('recipetool') + +tinfoil = None +plugins = None + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + +def setvar(args): + import oe.recipeutils + + if args.delete: + if args.value: + logger.error('-D/--delete and specifying a value are mutually exclusive') + return 1 + value = None + else: + if args.value is None: + logger.error('You must specify a value if not using -D/--delete') + return 1 + value = args.value + varvalues = {args.varname: value} + + if args.recipe_only: + patches = [oe.recipeutils.patch_recipe_file(args.recipefile, varvalues, patch=args.patch)] + else: + rd = tinfoil.parse_recipe_file(args.recipefile, False) + if not rd: + return 1 + patches = oe.recipeutils.patch_recipe(rd, args.recipefile, varvalues, patch=args.patch) + if args.patch: + for patch in patches: + for line in patch: + sys.stdout.write(line) + return 0 + + +def register_commands(subparsers): + parser_setvar = subparsers.add_parser('setvar', + help='Set a variable within a recipe', + description='Adds/updates the value a variable is set to in a recipe') + parser_setvar.add_argument('recipefile', help='Recipe file to update') + parser_setvar.add_argument('varname', help='Variable name to set') + parser_setvar.add_argument('value', nargs='?', help='New value to set the variable to') + parser_setvar.add_argument('--recipe-only', '-r', help='Do not set variable in any include file if present', action='store_true') + parser_setvar.add_argument('--patch', '-p', help='Create a patch to make the change instead of modifying the recipe', action='store_true') + parser_setvar.add_argument('--delete', '-D', help='Delete the specified value instead of setting it', action='store_true') + parser_setvar.set_defaults(func=setvar) diff --git a/scripts/lib/scriptpath.py b/scripts/lib/scriptpath.py new file mode 100644 index 0000000000..d00317e18d --- /dev/null +++ b/scripts/lib/scriptpath.py @@ -0,0 +1,42 @@ +# Path utility functions for OE python scripts +# +# Copyright (C) 2012-2014 Intel Corporation +# Copyright (C) 2011 Mentor Graphics Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import os +import os.path + +def add_oe_lib_path(): + basepath = os.path.abspath(os.path.dirname(__file__) + '/../..') + newpath = basepath + '/meta/lib' + sys.path.insert(0, newpath) + +def add_bitbake_lib_path(): + basepath = os.path.abspath(os.path.dirname(__file__) + '/../..') + bitbakepath = None + if os.path.exists(basepath + '/bitbake/lib/bb'): + bitbakepath = basepath + '/bitbake' + else: + # look for bitbake/bin dir in PATH + for pth in os.environ['PATH'].split(':'): + if os.path.exists(os.path.join(pth, '../lib/bb')): + bitbakepath = os.path.abspath(os.path.join(pth, '..')) + break + + if bitbakepath: + sys.path.insert(0, bitbakepath + '/lib') + return bitbakepath diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py new file mode 100644 index 0000000000..4ccbe5c108 --- /dev/null +++ b/scripts/lib/scriptutils.py @@ -0,0 +1,135 @@ +# Script utility functions +# +# Copyright (C) 2014 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import os +import logging +import glob +import argparse +import subprocess + +def logger_create(name, stream=None): + logger = logging.getLogger(name) + loggerhandler = logging.StreamHandler(stream=stream) + loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) + logger.addHandler(loggerhandler) + logger.setLevel(logging.INFO) + return logger + +def logger_setup_color(logger, color='auto'): + from bb.msg import BBLogFormatter + console = logging.StreamHandler(sys.stdout) + formatter = BBLogFormatter("%(levelname)s: %(message)s") + console.setFormatter(formatter) + logger.handlers = [console] + if color == 'always' or (color=='auto' and console.stream.isatty()): + formatter.enable_color() + + +def load_plugins(logger, plugins, pluginpath): + import imp + + def load_plugin(name): + logger.debug('Loading plugin %s' % name) + fp, pathname, description = imp.find_module(name, [pluginpath]) + try: + return imp.load_module(name, fp, pathname, description) + finally: + if fp: + fp.close() + + def plugin_name(filename): + return os.path.splitext(os.path.basename(filename))[0] + + known_plugins = [plugin_name(p.__name__) for p in plugins] + logger.debug('Loading plugins from %s...' % pluginpath) + for fn in glob.glob(os.path.join(pluginpath, '*.py')): + name = plugin_name(fn) + if name != '__init__' and name not in known_plugins: + plugin = load_plugin(name) + if hasattr(plugin, 'plugin_init'): + plugin.plugin_init(plugins) + plugins.append(plugin) + +def git_convert_standalone_clone(repodir): + """If specified directory is a git repository, ensure it's a standalone clone""" + import bb.process + if os.path.exists(os.path.join(repodir, '.git')): + alternatesfile = os.path.join(repodir, '.git', 'objects', 'info', 'alternates') + if os.path.exists(alternatesfile): + # This will have been cloned with -s, so we need to convert it so none + # of the contents is shared + bb.process.run('git repack -a', cwd=repodir) + os.remove(alternatesfile) + +def fetch_uri(d, uri, destdir, srcrev=None): + """Fetch a URI to a local directory""" + import bb.data + bb.utils.mkdirhier(destdir) + localdata = bb.data.createCopy(d) + localdata.setVar('BB_STRICT_CHECKSUM', '') + localdata.setVar('SRCREV', srcrev) + ret = (None, None) + olddir = os.getcwd() + try: + fetcher = bb.fetch2.Fetch([uri], localdata) + for u in fetcher.ud: + ud = fetcher.ud[u] + ud.ignore_checksums = True + fetcher.download() + for u in fetcher.ud: + ud = fetcher.ud[u] + if ud.localpath.rstrip(os.sep) == localdata.getVar('DL_DIR').rstrip(os.sep): + raise Exception('Local path is download directory - please check that the URI "%s" is correct' % uri) + fetcher.unpack(destdir) + for u in fetcher.ud: + ud = fetcher.ud[u] + if ud.method.recommends_checksum(ud): + md5value = bb.utils.md5_file(ud.localpath) + sha256value = bb.utils.sha256_file(ud.localpath) + ret = (md5value, sha256value) + finally: + os.chdir(olddir) + return ret + +def run_editor(fn): + if isinstance(fn, str): + params = '"%s"' % fn + else: + params = '' + for fnitem in fn: + params += ' "%s"' % fnitem + + editor = os.getenv('VISUAL', os.getenv('EDITOR', 'vi')) + try: + return subprocess.check_call('%s %s' % (editor, params), shell=True) + except OSError as exc: + logger.error("Execution of editor '%s' failed: %s", editor, exc) + return 1 + +def is_src_url(param): + """ + Check if a parameter is a URL and return True if so + NOTE: be careful about changing this as it will influence how devtool/recipetool command line handling works + """ + if not param: + return False + elif '://' in param: + return True + elif param.startswith('git@') or ('@' in param and param.endswith('.git')): + return True + return False diff --git a/scripts/lib/wic/__init__.py b/scripts/lib/wic/__init__.py new file mode 100644 index 0000000000..85876b138c --- /dev/null +++ b/scripts/lib/wic/__init__.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python -tt +# +# Copyright (c) 2007 Red Hat, Inc. +# Copyright (c) 2011 Intel, Inc. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; version 2 of the License +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +class WicError(Exception): + pass diff --git a/scripts/lib/wic/canned-wks/common.wks.inc b/scripts/lib/wic/canned-wks/common.wks.inc new file mode 100644 index 0000000000..5cf2fd1f3e --- /dev/null +++ b/scripts/lib/wic/canned-wks/common.wks.inc @@ -0,0 +1,3 @@ +# This file is included into 3 canned wks files from this directory +part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 +part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 diff --git a/scripts/lib/wic/canned-wks/directdisk-bootloader-config.cfg b/scripts/lib/wic/canned-wks/directdisk-bootloader-config.cfg new file mode 100644 index 0000000000..d5a07d2048 --- /dev/null +++ b/scripts/lib/wic/canned-wks/directdisk-bootloader-config.cfg @@ -0,0 +1,27 @@ +# This is an example configuration file for syslinux. +TIMEOUT 50 +ALLOWOPTIONS 1 +SERIAL 0 115200 +PROMPT 0 + +UI vesamenu.c32 +menu title Select boot options +menu tabmsg Press [Tab] to edit, [Return] to select + +DEFAULT Graphics console boot + +LABEL Graphics console boot +KERNEL /vmlinuz +APPEND label=boot root=/dev/sda2 rootwait + +LABEL Serial console boot +KERNEL /vmlinuz +APPEND label=boot root=/dev/sda2 rootwait console=ttyS0,115200 + +LABEL Graphics console install +KERNEL /vmlinuz +APPEND label=install root=/dev/sda2 rootwait + +LABEL Serial console install +KERNEL /vmlinuz +APPEND label=install root=/dev/sda2 rootwait console=ttyS0,115200 diff --git a/scripts/lib/wic/canned-wks/directdisk-bootloader-config.wks b/scripts/lib/wic/canned-wks/directdisk-bootloader-config.wks new file mode 100644 index 0000000000..3529e05c87 --- /dev/null +++ b/scripts/lib/wic/canned-wks/directdisk-bootloader-config.wks @@ -0,0 +1,8 @@ +# short-description: Create a 'pcbios' direct disk image with custom bootloader config +# long-description: Creates a partitioned legacy BIOS disk image that the user +# can directly dd to boot media. The bootloader configuration source is a user file. + +include common.wks.inc + +bootloader --configfile="directdisk-bootloader-config.cfg" + diff --git a/scripts/lib/wic/canned-wks/directdisk-gpt.wks b/scripts/lib/wic/canned-wks/directdisk-gpt.wks new file mode 100644 index 0000000000..8d7d8de6ea --- /dev/null +++ b/scripts/lib/wic/canned-wks/directdisk-gpt.wks @@ -0,0 +1,10 @@ +# short-description: Create a 'pcbios' direct disk image +# long-description: Creates a partitioned legacy BIOS disk image that the user +# can directly dd to boot media. + + +part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 +part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid + +bootloader --ptable gpt --timeout=0 --append="rootwait rootfstype=ext4 video=vesafb vga=0x318 console=tty0 console=ttyS0,115200n8" + diff --git a/scripts/lib/wic/canned-wks/directdisk-multi-rootfs.wks b/scripts/lib/wic/canned-wks/directdisk-multi-rootfs.wks new file mode 100644 index 0000000000..f61d941d6d --- /dev/null +++ b/scripts/lib/wic/canned-wks/directdisk-multi-rootfs.wks @@ -0,0 +1,23 @@ +# short-description: Create multi rootfs image using rootfs plugin +# long-description: Creates a partitioned disk image with two rootfs partitions +# using rootfs plugin. +# +# Partitions can use either +# - indirect rootfs references to image recipe(s): +# wic create directdisk-multi-indirect-recipes -e core-image-minimal \ +# --rootfs-dir rootfs1=core-image-minimal +# --rootfs-dir rootfs2=core-image-minimal-dev +# +# - or paths to rootfs directories: +# wic create directdisk-multi-rootfs \ +# --rootfs-dir rootfs1=tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs/ +# --rootfs-dir rootfs2=tmp/work/qemux86_64-poky-linux/core-image-minimal-dev/1.0-r0/rootfs/ +# +# - or any combinations of -r and --rootfs command line options + +part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 +part / --source rootfs --rootfs-dir=rootfs1 --ondisk sda --fstype=ext4 --label platform --align 1024 +part /rescue --source rootfs --rootfs-dir=rootfs2 --ondisk sda --fstype=ext4 --label secondary --align 1024 + +bootloader --timeout=0 --append="rootwait rootfstype=ext4 video=vesafb vga=0x318 console=tty0 console=ttyS0,115200n8" + diff --git a/scripts/lib/wic/canned-wks/directdisk.wks b/scripts/lib/wic/canned-wks/directdisk.wks new file mode 100644 index 0000000000..8c8e06b02c --- /dev/null +++ b/scripts/lib/wic/canned-wks/directdisk.wks @@ -0,0 +1,8 @@ +# short-description: Create a 'pcbios' direct disk image +# long-description: Creates a partitioned legacy BIOS disk image that the user +# can directly dd to boot media. + +include common.wks.inc + +bootloader --timeout=0 --append="rootwait rootfstype=ext4 video=vesafb vga=0x318 console=tty0 console=ttyS0,115200n8" + diff --git a/scripts/lib/wic/canned-wks/mkefidisk.wks b/scripts/lib/wic/canned-wks/mkefidisk.wks new file mode 100644 index 0000000000..9f534fe184 --- /dev/null +++ b/scripts/lib/wic/canned-wks/mkefidisk.wks @@ -0,0 +1,11 @@ +# short-description: Create an EFI disk image +# long-description: Creates a partitioned EFI disk image that the user +# can directly dd to boot media. + +part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024 + +part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid + +part swap --ondisk sda --size 44 --label swap1 --fstype=swap + +bootloader --ptable gpt --timeout=5 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0" diff --git a/scripts/lib/wic/canned-wks/mkhybridiso.wks b/scripts/lib/wic/canned-wks/mkhybridiso.wks new file mode 100644 index 0000000000..9d34e9b477 --- /dev/null +++ b/scripts/lib/wic/canned-wks/mkhybridiso.wks @@ -0,0 +1,7 @@ +# short-description: Create a hybrid ISO image +# long-description: Creates an EFI and legacy bootable hybrid ISO image +# which can be used on optical media as well as USB media. + +part /boot --source isoimage-isohybrid --sourceparams="loader=grub-efi,image_name=HYBRID_ISO_IMG" --ondisk cd --label HYBRIDISO --fstype=ext4 + +bootloader --timeout=15 --append="" diff --git a/scripts/lib/wic/canned-wks/qemux86-directdisk.wks b/scripts/lib/wic/canned-wks/qemux86-directdisk.wks new file mode 100644 index 0000000000..db30bbced0 --- /dev/null +++ b/scripts/lib/wic/canned-wks/qemux86-directdisk.wks @@ -0,0 +1,8 @@ +# short-description: Create a qemu machine 'pcbios' direct disk image +# long-description: Creates a partitioned legacy BIOS disk image that the user +# can directly use to boot a qemu machine. + +include common.wks.inc + +bootloader --timeout=0 --append="vga=0 uvesafb.mode_option=640x480-32 root=/dev/sda2 rw mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 rootfstype=ext4 " + diff --git a/scripts/lib/wic/canned-wks/sdimage-bootpart.wks b/scripts/lib/wic/canned-wks/sdimage-bootpart.wks new file mode 100644 index 0000000000..7ffd632f4a --- /dev/null +++ b/scripts/lib/wic/canned-wks/sdimage-bootpart.wks @@ -0,0 +1,6 @@ +# short-description: Create SD card image with a boot partition +# long-description: Creates a partitioned SD card image. Boot files +# are located in the first vfat partition. + +part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4 --size 16 +part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4 diff --git a/scripts/lib/wic/canned-wks/systemd-bootdisk.wks b/scripts/lib/wic/canned-wks/systemd-bootdisk.wks new file mode 100644 index 0000000000..4bd9d6a65f --- /dev/null +++ b/scripts/lib/wic/canned-wks/systemd-bootdisk.wks @@ -0,0 +1,11 @@ +# short-description: Create an EFI disk image with systemd-boot +# long-description: Creates a partitioned EFI disk image that the user +# can directly dd to boot media. The selected bootloader is systemd-boot. + +part /boot --source bootimg-efi --sourceparams="loader=systemd-boot" --ondisk sda --label msdos --active --align 1024 + +part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid + +part swap --ondisk sda --size 44 --label swap1 --fstype=swap + +bootloader --ptable gpt --timeout=5 --append="rootwait rootfstype=ext4 console=ttyS0,115200 console=tty0" diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py new file mode 100644 index 0000000000..f59821fea6 --- /dev/null +++ b/scripts/lib/wic/engine.py @@ -0,0 +1,257 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2013, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION + +# This module implements the image creation engine used by 'wic' to +# create images. The engine parses through the OpenEmbedded kickstart +# (wks) file specified and generates images that can then be directly +# written onto media. +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# + +import logging +import os + +from wic import WicError +from wic.pluginbase import PluginMgr +from wic.utils.misc import get_bitbake_var + +logger = logging.getLogger('wic') + +def verify_build_env(): + """ + Verify that the build environment is sane. + + Returns True if it is, false otherwise + """ + if not os.environ.get("BUILDDIR"): + raise WicError("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") + + return True + + +CANNED_IMAGE_DIR = "lib/wic/canned-wks" # relative to scripts +SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR +WIC_DIR = "wic" + +def build_canned_image_list(path): + layers_path = get_bitbake_var("BBLAYERS") + canned_wks_layer_dirs = [] + + if layers_path is not None: + for layer_path in layers_path.split(): + for wks_path in (WIC_DIR, SCRIPTS_CANNED_IMAGE_DIR): + cpath = os.path.join(layer_path, wks_path) + if os.path.isdir(cpath): + canned_wks_layer_dirs.append(cpath) + + cpath = os.path.join(path, CANNED_IMAGE_DIR) + canned_wks_layer_dirs.append(cpath) + + return canned_wks_layer_dirs + +def find_canned_image(scripts_path, wks_file): + """ + Find a .wks file with the given name in the canned files dir. + + Return False if not found + """ + layers_canned_wks_dir = build_canned_image_list(scripts_path) + + for canned_wks_dir in layers_canned_wks_dir: + for root, dirs, files in os.walk(canned_wks_dir): + for fname in files: + if fname.endswith("~") or fname.endswith("#"): + continue + if fname.endswith(".wks") and wks_file + ".wks" == fname: + fullpath = os.path.join(canned_wks_dir, fname) + return fullpath + return None + + +def list_canned_images(scripts_path): + """ + List the .wks files in the canned image dir, minus the extension. + """ + layers_canned_wks_dir = build_canned_image_list(scripts_path) + + for canned_wks_dir in layers_canned_wks_dir: + for root, dirs, files in os.walk(canned_wks_dir): + for fname in files: + if fname.endswith("~") or fname.endswith("#"): + continue + if fname.endswith(".wks"): + fullpath = os.path.join(canned_wks_dir, fname) + with open(fullpath) as wks: + for line in wks: + desc = "" + idx = line.find("short-description:") + if idx != -1: + desc = line[idx + len("short-description:"):].strip() + break + basename = os.path.splitext(fname)[0] + print(" %s\t\t%s" % (basename.ljust(30), desc)) + + +def list_canned_image_help(scripts_path, fullpath): + """ + List the help and params in the specified canned image. + """ + found = False + with open(fullpath) as wks: + for line in wks: + if not found: + idx = line.find("long-description:") + if idx != -1: + print() + print(line[idx + len("long-description:"):].strip()) + found = True + continue + if not line.strip(): + break + idx = line.find("#") + if idx != -1: + print(line[idx + len("#:"):].rstrip()) + else: + break + + +def list_source_plugins(): + """ + List the available source plugins i.e. plugins available for --source. + """ + plugins = PluginMgr.get_plugins('source') + + for plugin in plugins: + print(" %s" % plugin) + + +def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, + native_sysroot, options): + """ + Create image + + wks_file - user-defined OE kickstart file + rootfs_dir - absolute path to the build's /rootfs dir + bootimg_dir - absolute path to the build's boot artifacts directory + kernel_dir - absolute path to the build's kernel directory + native_sysroot - absolute path to the build's native sysroots dir + image_output_dir - dirname to create for image + options - wic command line options (debug, bmap, etc) + + Normally, the values for the build artifacts values are determined + by 'wic -e' from the output of the 'bitbake -e' command given an + image name e.g. 'core-image-minimal' and a given machine set in + local.conf. If that's the case, the variables get the following + values from the output of 'bitbake -e': + + rootfs_dir: IMAGE_ROOTFS + kernel_dir: DEPLOY_DIR_IMAGE + native_sysroot: STAGING_DIR_NATIVE + + In the above case, bootimg_dir remains unset and the + plugin-specific image creation code is responsible for finding the + bootimg artifacts. + + In the case where the values are passed in explicitly i.e 'wic -e' + is not used but rather the individual 'wic' options are used to + explicitly specify these values. + """ + try: + oe_builddir = os.environ["BUILDDIR"] + except KeyError: + raise WicError("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") + + if not os.path.exists(options.outdir): + os.makedirs(options.outdir) + + pname = 'direct' + plugin_class = PluginMgr.get_plugins('imager').get(pname) + if not plugin_class: + raise WicError('Unknown plugin: %s' % pname) + + plugin = plugin_class(wks_file, rootfs_dir, bootimg_dir, kernel_dir, + native_sysroot, oe_builddir, options) + + plugin.do_create() + + logger.info("The image(s) were created using OE kickstart file:\n %s", wks_file) + + +def wic_list(args, scripts_path): + """ + Print the list of images or source plugins. + """ + if len(args) < 1: + return False + + if args == ["images"]: + list_canned_images(scripts_path) + return True + elif args == ["source-plugins"]: + list_source_plugins() + return True + elif len(args) == 2 and args[1] == "help": + wks_file = args[0] + fullpath = find_canned_image(scripts_path, wks_file) + if not fullpath: + raise WicError("No image named %s found, exiting. " + "(Use 'wic list images' to list available images, " + "or specify a fully-qualified OE kickstart (.wks) " + "filename)" % wks_file) + + list_canned_image_help(scripts_path, fullpath) + return True + + return False + +def find_canned(scripts_path, file_name): + """ + Find a file either by its path or by name in the canned files dir. + + Return None if not found + """ + if os.path.exists(file_name): + return file_name + + layers_canned_wks_dir = build_canned_image_list(scripts_path) + for canned_wks_dir in layers_canned_wks_dir: + for root, dirs, files in os.walk(canned_wks_dir): + for fname in files: + if fname == file_name: + fullpath = os.path.join(canned_wks_dir, fname) + return fullpath + +def get_custom_config(boot_file): + """ + Get the custom configuration to be used for the bootloader. + + Return None if the file can't be found. + """ + # Get the scripts path of poky + scripts_path = os.path.abspath("%s/../.." % os.path.dirname(__file__)) + + cfg_file = find_canned(scripts_path, boot_file) + if cfg_file: + with open(cfg_file, "r") as f: + config = f.read() + return config diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py new file mode 100644 index 0000000000..1f1aacc522 --- /dev/null +++ b/scripts/lib/wic/filemap.py @@ -0,0 +1,564 @@ +# Copyright (c) 2012 Intel, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License, version 2, +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +""" +This module implements python implements a way to get file block. Two methods +are supported - the FIEMAP ioctl and the 'SEEK_HOLE / SEEK_DATA' features of +the file seek syscall. The former is implemented by the 'FilemapFiemap' class, +the latter is implemented by the 'FilemapSeek' class. Both classes provide the +same API. The 'filemap' function automatically selects which class can be used +and returns an instance of the class. +""" + +# Disable the following pylint recommendations: +# * Too many instance attributes (R0902) +# pylint: disable=R0902 + +import os +import struct +import array +import fcntl +import tempfile +import logging + +def get_block_size(file_obj): + """ + Returns block size for file object 'file_obj'. Errors are indicated by the + 'IOError' exception. + """ + + from fcntl import ioctl + import struct + + # Get the block size of the host file-system for the image file by calling + # the FIGETBSZ ioctl (number 2). + binary_data = ioctl(file_obj, 2, struct.pack('I', 0)) + return struct.unpack('I', binary_data)[0] + +class ErrorNotSupp(Exception): + """ + An exception of this type is raised when the 'FIEMAP' or 'SEEK_HOLE' feature + is not supported either by the kernel or the file-system. + """ + pass + +class Error(Exception): + """A class for all the other exceptions raised by this module.""" + pass + + +class _FilemapBase(object): + """ + This is a base class for a couple of other classes in this module. This + class simply performs the common parts of the initialization process: opens + the image file, gets its size, etc. The 'log' parameter is the logger object + to use for printing messages. + """ + + def __init__(self, image, log=None): + """ + Initialize a class instance. The 'image' argument is full path to the + file or file object to operate on. + """ + + self._log = log + if self._log is None: + self._log = logging.getLogger(__name__) + + self._f_image_needs_close = False + + if hasattr(image, "fileno"): + self._f_image = image + self._image_path = image.name + else: + self._image_path = image + self._open_image_file() + + try: + self.image_size = os.fstat(self._f_image.fileno()).st_size + except IOError as err: + raise Error("cannot get information about file '%s': %s" + % (self._f_image.name, err)) + + try: + self.block_size = get_block_size(self._f_image) + except IOError as err: + raise Error("cannot get block size for '%s': %s" + % (self._image_path, err)) + + self.blocks_cnt = self.image_size + self.block_size - 1 + self.blocks_cnt //= self.block_size + + try: + self._f_image.flush() + except IOError as err: + raise Error("cannot flush image file '%s': %s" + % (self._image_path, err)) + + try: + os.fsync(self._f_image.fileno()), + except OSError as err: + raise Error("cannot synchronize image file '%s': %s " + % (self._image_path, err.strerror)) + + self._log.debug("opened image \"%s\"" % self._image_path) + self._log.debug("block size %d, blocks count %d, image size %d" + % (self.block_size, self.blocks_cnt, self.image_size)) + + def __del__(self): + """The class destructor which just closes the image file.""" + if self._f_image_needs_close: + self._f_image.close() + + def _open_image_file(self): + """Open the image file.""" + try: + self._f_image = open(self._image_path, 'rb') + except IOError as err: + raise Error("cannot open image file '%s': %s" + % (self._image_path, err)) + + self._f_image_needs_close = True + + def block_is_mapped(self, block): # pylint: disable=W0613,R0201 + """ + This method has has to be implemented by child classes. It returns + 'True' if block number 'block' of the image file is mapped and 'False' + otherwise. + """ + + raise Error("the method is not implemented") + + def block_is_unmapped(self, block): # pylint: disable=W0613,R0201 + """ + This method has has to be implemented by child classes. It returns + 'True' if block number 'block' of the image file is not mapped (hole) + and 'False' otherwise. + """ + + raise Error("the method is not implemented") + + def get_mapped_ranges(self, start, count): # pylint: disable=W0613,R0201 + """ + This method has has to be implemented by child classes. This is a + generator which yields ranges of mapped blocks in the file. The ranges + are tuples of 2 elements: [first, last], where 'first' is the first + mapped block and 'last' is the last mapped block. + + The ranges are yielded for the area of the file of size 'count' blocks, + starting from block 'start'. + """ + + raise Error("the method is not implemented") + + def get_unmapped_ranges(self, start, count): # pylint: disable=W0613,R0201 + """ + This method has has to be implemented by child classes. Just like + 'get_mapped_ranges()', but yields unmapped block ranges instead + (holes). + """ + + raise Error("the method is not implemented") + + +# The 'SEEK_HOLE' and 'SEEK_DATA' options of the file seek system call +_SEEK_DATA = 3 +_SEEK_HOLE = 4 + +def _lseek(file_obj, offset, whence): + """This is a helper function which invokes 'os.lseek' for file object + 'file_obj' and with specified 'offset' and 'whence'. The 'whence' + argument is supposed to be either '_SEEK_DATA' or '_SEEK_HOLE'. When + there is no more data or hole starting from 'offset', this function + returns '-1'. Otherwise the data or hole position is returned.""" + + try: + return os.lseek(file_obj.fileno(), offset, whence) + except OSError as err: + # The 'lseek' system call returns the ENXIO if there is no data or + # hole starting from the specified offset. + if err.errno == os.errno.ENXIO: + return -1 + elif err.errno == os.errno.EINVAL: + raise ErrorNotSupp("the kernel or file-system does not support " + "\"SEEK_HOLE\" and \"SEEK_DATA\"") + else: + raise + +class FilemapSeek(_FilemapBase): + """ + This class uses the 'SEEK_HOLE' and 'SEEK_DATA' to find file block mapping. + Unfortunately, the current implementation requires the caller to have write + access to the image file. + """ + + def __init__(self, image, log=None): + """Refer the '_FilemapBase' class for the documentation.""" + + # Call the base class constructor first + _FilemapBase.__init__(self, image, log) + self._log.debug("FilemapSeek: initializing") + + self._probe_seek_hole() + + def _probe_seek_hole(self): + """ + Check whether the system implements 'SEEK_HOLE' and 'SEEK_DATA'. + Unfortunately, there seems to be no clean way for detecting this, + because often the system just fakes them by just assuming that all + files are fully mapped, so 'SEEK_HOLE' always returns EOF and + 'SEEK_DATA' always returns the requested offset. + + I could not invent a better way of detecting the fake 'SEEK_HOLE' + implementation than just to create a temporary file in the same + directory where the image file resides. It would be nice to change this + to something better. + """ + + directory = os.path.dirname(self._image_path) + + try: + tmp_obj = tempfile.TemporaryFile("w+", dir=directory) + except IOError as err: + raise ErrorNotSupp("cannot create a temporary in \"%s\": %s" + % (directory, err)) + + try: + os.ftruncate(tmp_obj.fileno(), self.block_size) + except OSError as err: + raise ErrorNotSupp("cannot truncate temporary file in \"%s\": %s" + % (directory, err)) + + offs = _lseek(tmp_obj, 0, _SEEK_HOLE) + if offs != 0: + # We are dealing with the stub 'SEEK_HOLE' implementation which + # always returns EOF. + self._log.debug("lseek(0, SEEK_HOLE) returned %d" % offs) + raise ErrorNotSupp("the file-system does not support " + "\"SEEK_HOLE\" and \"SEEK_DATA\" but only " + "provides a stub implementation") + + tmp_obj.close() + + def block_is_mapped(self, block): + """Refer the '_FilemapBase' class for the documentation.""" + offs = _lseek(self._f_image, block * self.block_size, _SEEK_DATA) + if offs == -1: + result = False + else: + result = (offs // self.block_size == block) + + self._log.debug("FilemapSeek: block_is_mapped(%d) returns %s" + % (block, result)) + return result + + def block_is_unmapped(self, block): + """Refer the '_FilemapBase' class for the documentation.""" + return not self.block_is_mapped(block) + + def _get_ranges(self, start, count, whence1, whence2): + """ + This function implements 'get_mapped_ranges()' and + 'get_unmapped_ranges()' depending on what is passed in the 'whence1' + and 'whence2' arguments. + """ + + assert whence1 != whence2 + end = start * self.block_size + limit = end + count * self.block_size + + while True: + start = _lseek(self._f_image, end, whence1) + if start == -1 or start >= limit or start == self.image_size: + break + + end = _lseek(self._f_image, start, whence2) + if end == -1 or end == self.image_size: + end = self.blocks_cnt * self.block_size + if end > limit: + end = limit + + start_blk = start // self.block_size + end_blk = end // self.block_size - 1 + self._log.debug("FilemapSeek: yielding range (%d, %d)" + % (start_blk, end_blk)) + yield (start_blk, end_blk) + + def get_mapped_ranges(self, start, count): + """Refer the '_FilemapBase' class for the documentation.""" + self._log.debug("FilemapSeek: get_mapped_ranges(%d, %d(%d))" + % (start, count, start + count - 1)) + return self._get_ranges(start, count, _SEEK_DATA, _SEEK_HOLE) + + def get_unmapped_ranges(self, start, count): + """Refer the '_FilemapBase' class for the documentation.""" + self._log.debug("FilemapSeek: get_unmapped_ranges(%d, %d(%d))" + % (start, count, start + count - 1)) + return self._get_ranges(start, count, _SEEK_HOLE, _SEEK_DATA) + + +# Below goes the FIEMAP ioctl implementation, which is not very readable +# because it deals with the rather complex FIEMAP ioctl. To understand the +# code, you need to know the FIEMAP interface, which is documented in the +# "Documentation/filesystems/fiemap.txt" file in the Linux kernel sources. + +# Format string for 'struct fiemap' +_FIEMAP_FORMAT = "=QQLLLL" +# sizeof(struct fiemap) +_FIEMAP_SIZE = struct.calcsize(_FIEMAP_FORMAT) +# Format string for 'struct fiemap_extent' +_FIEMAP_EXTENT_FORMAT = "=QQQQQLLLL" +# sizeof(struct fiemap_extent) +_FIEMAP_EXTENT_SIZE = struct.calcsize(_FIEMAP_EXTENT_FORMAT) +# The FIEMAP ioctl number +_FIEMAP_IOCTL = 0xC020660B +# This FIEMAP ioctl flag which instructs the kernel to sync the file before +# reading the block map +_FIEMAP_FLAG_SYNC = 0x00000001 +# Size of the buffer for 'struct fiemap_extent' elements which will be used +# when invoking the FIEMAP ioctl. The larger is the buffer, the less times the +# FIEMAP ioctl will be invoked. +_FIEMAP_BUFFER_SIZE = 256 * 1024 + +class FilemapFiemap(_FilemapBase): + """ + This class provides API to the FIEMAP ioctl. Namely, it allows to iterate + over all mapped blocks and over all holes. + + This class synchronizes the image file every time it invokes the FIEMAP + ioctl in order to work-around early FIEMAP implementation kernel bugs. + """ + + def __init__(self, image, log=None): + """ + Initialize a class instance. The 'image' argument is full the file + object to operate on. + """ + + # Call the base class constructor first + _FilemapBase.__init__(self, image, log) + self._log.debug("FilemapFiemap: initializing") + + self._buf_size = _FIEMAP_BUFFER_SIZE + + # Calculate how many 'struct fiemap_extent' elements fit the buffer + self._buf_size -= _FIEMAP_SIZE + self._fiemap_extent_cnt = self._buf_size // _FIEMAP_EXTENT_SIZE + assert self._fiemap_extent_cnt > 0 + self._buf_size = self._fiemap_extent_cnt * _FIEMAP_EXTENT_SIZE + self._buf_size += _FIEMAP_SIZE + + # Allocate a mutable buffer for the FIEMAP ioctl + self._buf = array.array('B', [0] * self._buf_size) + + # Check if the FIEMAP ioctl is supported + self.block_is_mapped(0) + + def _invoke_fiemap(self, block, count): + """ + Invoke the FIEMAP ioctl for 'count' blocks of the file starting from + block number 'block'. + + The full result of the operation is stored in 'self._buf' on exit. + Returns the unpacked 'struct fiemap' data structure in form of a python + list (just like 'struct.upack()'). + """ + + if self.blocks_cnt != 0 and (block < 0 or block >= self.blocks_cnt): + raise Error("bad block number %d, should be within [0, %d]" + % (block, self.blocks_cnt)) + + # Initialize the 'struct fiemap' part of the buffer. We use the + # '_FIEMAP_FLAG_SYNC' flag in order to make sure the file is + # synchronized. The reason for this is that early FIEMAP + # implementations had many bugs related to cached dirty data, and + # synchronizing the file is a necessary work-around. + struct.pack_into(_FIEMAP_FORMAT, self._buf, 0, block * self.block_size, + count * self.block_size, _FIEMAP_FLAG_SYNC, 0, + self._fiemap_extent_cnt, 0) + + try: + fcntl.ioctl(self._f_image, _FIEMAP_IOCTL, self._buf, 1) + except IOError as err: + # Note, the FIEMAP ioctl is supported by the Linux kernel starting + # from version 2.6.28 (year 2008). + if err.errno == os.errno.EOPNOTSUPP: + errstr = "FilemapFiemap: the FIEMAP ioctl is not supported " \ + "by the file-system" + self._log.debug(errstr) + raise ErrorNotSupp(errstr) + if err.errno == os.errno.ENOTTY: + errstr = "FilemapFiemap: the FIEMAP ioctl is not supported " \ + "by the kernel" + self._log.debug(errstr) + raise ErrorNotSupp(errstr) + raise Error("the FIEMAP ioctl failed for '%s': %s" + % (self._image_path, err)) + + return struct.unpack(_FIEMAP_FORMAT, self._buf[:_FIEMAP_SIZE]) + + def block_is_mapped(self, block): + """Refer the '_FilemapBase' class for the documentation.""" + struct_fiemap = self._invoke_fiemap(block, 1) + + # The 3rd element of 'struct_fiemap' is the 'fm_mapped_extents' field. + # If it contains zero, the block is not mapped, otherwise it is + # mapped. + result = bool(struct_fiemap[3]) + self._log.debug("FilemapFiemap: block_is_mapped(%d) returns %s" + % (block, result)) + return result + + def block_is_unmapped(self, block): + """Refer the '_FilemapBase' class for the documentation.""" + return not self.block_is_mapped(block) + + def _unpack_fiemap_extent(self, index): + """ + Unpack a 'struct fiemap_extent' structure object number 'index' from + the internal 'self._buf' buffer. + """ + + offset = _FIEMAP_SIZE + _FIEMAP_EXTENT_SIZE * index + return struct.unpack(_FIEMAP_EXTENT_FORMAT, + self._buf[offset : offset + _FIEMAP_EXTENT_SIZE]) + + def _do_get_mapped_ranges(self, start, count): + """ + Implements most the functionality for the 'get_mapped_ranges()' + generator: invokes the FIEMAP ioctl, walks through the mapped extents + and yields mapped block ranges. However, the ranges may be consecutive + (e.g., (1, 100), (100, 200)) and 'get_mapped_ranges()' simply merges + them. + """ + + block = start + while block < start + count: + struct_fiemap = self._invoke_fiemap(block, count) + + mapped_extents = struct_fiemap[3] + if mapped_extents == 0: + # No more mapped blocks + return + + extent = 0 + while extent < mapped_extents: + fiemap_extent = self._unpack_fiemap_extent(extent) + + # Start of the extent + extent_start = fiemap_extent[0] + # Starting block number of the extent + extent_block = extent_start // self.block_size + # Length of the extent + extent_len = fiemap_extent[2] + # Count of blocks in the extent + extent_count = extent_len // self.block_size + + # Extent length and offset have to be block-aligned + assert extent_start % self.block_size == 0 + assert extent_len % self.block_size == 0 + + if extent_block > start + count - 1: + return + + first = max(extent_block, block) + last = min(extent_block + extent_count, start + count) - 1 + yield (first, last) + + extent += 1 + + block = extent_block + extent_count + + def get_mapped_ranges(self, start, count): + """Refer the '_FilemapBase' class for the documentation.""" + self._log.debug("FilemapFiemap: get_mapped_ranges(%d, %d(%d))" + % (start, count, start + count - 1)) + iterator = self._do_get_mapped_ranges(start, count) + first_prev, last_prev = next(iterator) + + for first, last in iterator: + if last_prev == first - 1: + last_prev = last + else: + self._log.debug("FilemapFiemap: yielding range (%d, %d)" + % (first_prev, last_prev)) + yield (first_prev, last_prev) + first_prev, last_prev = first, last + + self._log.debug("FilemapFiemap: yielding range (%d, %d)" + % (first_prev, last_prev)) + yield (first_prev, last_prev) + + def get_unmapped_ranges(self, start, count): + """Refer the '_FilemapBase' class for the documentation.""" + self._log.debug("FilemapFiemap: get_unmapped_ranges(%d, %d(%d))" + % (start, count, start + count - 1)) + hole_first = start + for first, last in self._do_get_mapped_ranges(start, count): + if first > hole_first: + self._log.debug("FilemapFiemap: yielding range (%d, %d)" + % (hole_first, first - 1)) + yield (hole_first, first - 1) + + hole_first = last + 1 + + if hole_first < start + count: + self._log.debug("FilemapFiemap: yielding range (%d, %d)" + % (hole_first, start + count - 1)) + yield (hole_first, start + count - 1) + +def filemap(image, log=None): + """ + Create and return an instance of a Filemap class - 'FilemapFiemap' or + 'FilemapSeek', depending on what the system we run on supports. If the + FIEMAP ioctl is supported, an instance of the 'FilemapFiemap' class is + returned. Otherwise, if 'SEEK_HOLE' is supported an instance of the + 'FilemapSeek' class is returned. If none of these are supported, the + function generates an 'Error' type exception. + """ + + try: + return FilemapFiemap(image, log) + except ErrorNotSupp: + return FilemapSeek(image, log) + +def sparse_copy(src_fname, dst_fname, offset=0, skip=0, api=None): + """Efficiently copy sparse file to or into another file.""" + if not api: + api = filemap + fmap = api(src_fname) + try: + dst_file = open(dst_fname, 'r+b') + except IOError: + dst_file = open(dst_fname, 'wb') + dst_file.truncate(os.path.getsize(src_fname)) + + for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt): + start = first * fmap.block_size + end = (last + 1) * fmap.block_size + + if start < skip < end: + fmap._f_image.seek(skip, os.SEEK_SET) + else: + fmap._f_image.seek(start, os.SEEK_SET) + dst_file.seek(offset + start, os.SEEK_SET) + + chunk_size = 1024 * 1024 + to_read = end - start + read = 0 + + while read < to_read: + if read + chunk_size > to_read: + chunk_size = to_read - read + chunk = fmap._f_image.read(chunk_size) + dst_file.write(chunk) + read += chunk_size + dst_file.close() diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py new file mode 100644 index 0000000000..d6e027d253 --- /dev/null +++ b/scripts/lib/wic/help.py @@ -0,0 +1,797 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2013, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION +# This module implements some basic help invocation functions along +# with the bulk of the help topic text for the OE Core Image Tools. +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# + +import subprocess +import logging + +from wic.pluginbase import PluginMgr, PLUGIN_TYPES + +logger = logging.getLogger('wic') + +def subcommand_error(args): + logger.info("invalid subcommand %s", args[0]) + + +def display_help(subcommand, subcommands): + """ + Display help for subcommand. + """ + if subcommand not in subcommands: + return False + + hlp = subcommands.get(subcommand, subcommand_error)[2] + if callable(hlp): + hlp = hlp() + pager = subprocess.Popen('less', stdin=subprocess.PIPE) + pager.communicate(hlp.encode('utf-8')) + + return True + + +def wic_help(args, usage_str, subcommands): + """ + Subcommand help dispatcher. + """ + if len(args) == 1 or not display_help(args[1], subcommands): + print(usage_str) + + +def get_wic_plugins_help(): + """ + Combine wic_plugins_help with the help for every known + source plugin. + """ + result = wic_plugins_help + for plugin_type in PLUGIN_TYPES: + result += '\n\n%s PLUGINS\n\n' % plugin_type.upper() + for name, plugin in PluginMgr.get_plugins(plugin_type).items(): + result += "\n %s plugin:\n" % name + if plugin.__doc__: + result += plugin.__doc__ + else: + result += "\n %s is missing docstring\n" % plugin + return result + + +def invoke_subcommand(args, parser, main_command_usage, subcommands): + """ + Dispatch to subcommand handler borrowed from combo-layer. + Should use argparse, but has to work in 2.6. + """ + if not args: + logger.error("No subcommand specified, exiting") + parser.print_help() + return 1 + elif args[0] == "help": + wic_help(args, main_command_usage, subcommands) + elif args[0] not in subcommands: + logger.error("Unsupported subcommand %s, exiting\n", args[0]) + parser.print_help() + return 1 + else: + usage = subcommands.get(args[0], subcommand_error)[1] + subcommands.get(args[0], subcommand_error)[0](args[1:], usage) + + +## +# wic help and usage strings +## + +wic_usage = """ + + Create a customized OpenEmbedded image + + usage: wic [--version] | [--help] | [COMMAND [ARGS]] + + Current 'wic' commands are: + help Show help for command or one of the topics (see below) + create Create a new OpenEmbedded image + list List available canned images and source plugins + + Help topics: + overview wic overview - General overview of wic + plugins wic plugins - Overview and API + kickstart wic kickstart - wic kickstart reference +""" + +wic_help_usage = """ + + usage: wic help <subcommand> + + This command displays detailed help for the specified subcommand. +""" + +wic_create_usage = """ + + Create a new OpenEmbedded image + + usage: wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>] + [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] + [-e | --image-name] [-s, --skip-build-check] [-D, --debug] + [-r, --rootfs-dir] [-b, --bootimg-dir] + [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs] + + This command creates an OpenEmbedded image based on the 'OE kickstart + commands' found in the <wks file>. + + The -o option can be used to place the image in a directory with a + different name and location. + + See 'wic help create' for more detailed instructions. +""" + +wic_create_help = """ + +NAME + wic create - Create a new OpenEmbedded image + +SYNOPSIS + wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>] + [-e | --image-name] [-s, --skip-build-check] [-D, --debug] + [-r, --rootfs-dir] [-b, --bootimg-dir] + [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs] + [-c, --compress-with] [-m, --bmap] + +DESCRIPTION + This command creates an OpenEmbedded image based on the 'OE + kickstart commands' found in the <wks file>. + + In order to do this, wic needs to know the locations of the + various build artifacts required to build the image. + + Users can explicitly specify the build artifact locations using + the -r, -b, -k, and -n options. See below for details on where + the corresponding artifacts are typically found in a normal + OpenEmbedded build. + + Alternatively, users can use the -e option to have 'wic' determine + those locations for a given image. If the -e option is used, the + user needs to have set the appropriate MACHINE variable in + local.conf, and have sourced the build environment. + + The -e option is used to specify the name of the image to use the + artifacts from e.g. core-image-sato. + + The -r option is used to specify the path to the /rootfs dir to + use as the .wks rootfs source. + + The -b option is used to specify the path to the dir containing + the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the + .wks bootimg source. + + The -k option is used to specify the path to the dir containing + the kernel to use in the .wks bootimg. + + The -n option is used to specify the path to the native sysroot + containing the tools to use to build the image. + + The -f option is used to build rootfs by running "bitbake <image>" + + The -s option is used to skip the build check. The build check is + a simple sanity check used to determine whether the user has + sourced the build environment so that the -e option can operate + correctly. If the user has specified the build artifact locations + explicitly, 'wic' assumes the user knows what he or she is doing + and skips the build check. + + The -D option is used to display debug information detailing + exactly what happens behind the scenes when a create request is + fulfilled (or not, as the case may be). It enumerates and + displays the command sequence used, and should be included in any + bug report describing unexpected results. + + When 'wic -e' is used, the locations for the build artifacts + values are determined by 'wic -e' from the output of the 'bitbake + -e' command given an image name e.g. 'core-image-minimal' and a + given machine set in local.conf. In that case, the image is + created as if the following 'bitbake -e' variables were used: + + -r: IMAGE_ROOTFS + -k: STAGING_KERNEL_DIR + -n: STAGING_DIR_NATIVE + -b: empty (plugin-specific handlers must determine this) + + If 'wic -e' is not used, the user needs to select the appropriate + value for -b (as well as -r, -k, and -n). + + The -o option can be used to place the image in a directory with a + different name and location. + + The -c option is used to specify compressor utility to compress + an image. gzip, bzip2 and xz compressors are supported. + + The -m option is used to produce .bmap file for the image. This file + can be used to flash image using bmaptool utility. +""" + +wic_list_usage = """ + + List available OpenEmbedded images and source plugins + + usage: wic list images + wic list <image> help + wic list source-plugins + + This command enumerates the set of available canned images as well as + help for those images. It also can be used to list of available source + plugins. + + The first form enumerates all the available 'canned' images. + + The second form lists the detailed help information for a specific + 'canned' image. + + The third form enumerates all the available --sources (source + plugins). + + See 'wic help list' for more details. +""" + +wic_list_help = """ + +NAME + wic list - List available OpenEmbedded images and source plugins + +SYNOPSIS + wic list images + wic list <image> help + wic list source-plugins + +DESCRIPTION + This command enumerates the set of available canned images as well + as help for those images. It also can be used to list available + source plugins. + + The first form enumerates all the available 'canned' images. + These are actually just the set of .wks files that have been moved + into the /scripts/lib/wic/canned-wks directory). + + The second form lists the detailed help information for a specific + 'canned' image. + + The third form enumerates all the available --sources (source + plugins). The contents of a given partition are driven by code + defined in 'source plugins'. Users specify a specific plugin via + the --source parameter of the partition .wks command. Normally + this is the 'rootfs' plugin but can be any of the more specialized + sources listed by the 'list source-plugins' command. Users can + also add their own source plugins - see 'wic help plugins' for + details. +""" + +wic_plugins_help = """ + +NAME + wic plugins - Overview and API + +DESCRIPTION + plugins allow wic functionality to be extended and specialized by + users. This section documents the plugin interface, which is + currently restricted to 'source' plugins. + + 'Source' plugins provide a mechanism to customize various aspects + of the image generation process in wic, mainly the contents of + partitions. + + Source plugins provide a mechanism for mapping values specified in + .wks files using the --source keyword to a particular plugin + implementation that populates a corresponding partition. + + A source plugin is created as a subclass of SourcePlugin (see + scripts/lib/wic/pluginbase.py) and the plugin file containing it + is added to scripts/lib/wic/plugins/source/ to make the plugin + implementation available to the wic implementation. + + Source plugins can also be implemented and added by external + layers - any plugins found in a scripts/lib/wic/plugins/source/ + directory in an external layer will also be made available. + + When the wic implementation needs to invoke a partition-specific + implementation, it looks for the plugin that has the same name as + the --source param given to that partition. For example, if the + partition is set up like this: + + part /boot --source bootimg-pcbios ... + + then the methods defined as class members of the plugin having the + matching bootimg-pcbios .name class member would be used. + + To be more concrete, here's the plugin definition that would match + a '--source bootimg-pcbios' usage, along with an example method + that would be called by the wic implementation when it needed to + invoke an implementation-specific partition-preparation function: + + class BootimgPcbiosPlugin(SourcePlugin): + name = 'bootimg-pcbios' + + @classmethod + def do_prepare_partition(self, part, ...) + + If the subclass itself doesn't implement a function, a 'default' + version in a superclass will be located and used, which is why all + plugins must be derived from SourcePlugin. + + The SourcePlugin class defines the following methods, which is the + current set of methods that can be implemented/overridden by + --source plugins. Any methods not implemented by a SourcePlugin + subclass inherit the implementations present in the SourcePlugin + class (see the SourcePlugin source for details): + + do_prepare_partition() + Called to do the actual content population for a + partition. In other words, it 'prepares' the final partition + image which will be incorporated into the disk image. + + do_configure_partition() + Called before do_prepare_partition(), typically used to + create custom configuration files for a partition, for + example syslinux or grub config files. + + do_install_disk() + Called after all partitions have been prepared and assembled + into a disk image. This provides a hook to allow + finalization of a disk image, for example to write an MBR to + it. + + do_stage_partition() + Special content-staging hook called before + do_prepare_partition(), normally empty. + + Typically, a partition will just use the passed-in + parameters, for example the unmodified value of bootimg_dir. + In some cases however, things may need to be more tailored. + As an example, certain files may additionally need to be + take from bootimg_dir + /boot. This hook allows those files + to be staged in a customized fashion. Note that + get_bitbake_var() allows you to access non-standard + variables that you might want to use for these types of + situations. + + This scheme is extensible - adding more hooks is a simple matter + of adding more plugin methods to SourcePlugin and derived classes. + Please see the implementation for details. +""" + +wic_overview_help = """ + +NAME + wic overview - General overview of wic + +DESCRIPTION + The 'wic' command generates partitioned images from existing + OpenEmbedded build artifacts. Image generation is driven by + partitioning commands contained in an 'Openembedded kickstart' + (.wks) file (see 'wic help kickstart') specified either directly + on the command-line or as one of a selection of canned .wks files + (see 'wic list images'). When applied to a given set of build + artifacts, the result is an image or set of images that can be + directly written onto media and used on a particular system. + + The 'wic' command and the infrastructure it's based on is by + definition incomplete - its purpose is to allow the generation of + customized images, and as such was designed to be completely + extensible via a plugin interface (see 'wic help plugins'). + + Background and Motivation + + wic is meant to be a completely independent standalone utility + that initially provides easier-to-use and more flexible + replacements for a couple bits of existing functionality in + oe-core: directdisk.bbclass and mkefidisk.sh. The difference + between wic and those examples is that with wic the functionality + of those scripts is implemented by a general-purpose partitioning + 'language' based on Redhat kickstart syntax). + + The initial motivation and design considerations that lead to the + current tool are described exhaustively in Yocto Bug #3847 + (https://bugzilla.yoctoproject.org/show_bug.cgi?id=3847). + + Implementation and Examples + + wic can be used in two different modes, depending on how much + control the user needs in specifying the Openembedded build + artifacts that will be used in creating the image: 'raw' and + 'cooked'. + + If used in 'raw' mode, artifacts are explicitly specified via + command-line arguments (see example below). + + The more easily usable 'cooked' mode uses the current MACHINE + setting and a specified image name to automatically locate the + artifacts used to create the image. + + OE kickstart files (.wks) can of course be specified directly on + the command-line, but the user can also choose from a set of + 'canned' .wks files available via the 'wic list images' command + (example below). + + In any case, the prerequisite for generating any image is to have + the build artifacts already available. The below examples assume + the user has already build a 'core-image-minimal' for a specific + machine (future versions won't require this redundant step, but + for now that's typically how build artifacts get generated). + + The other prerequisite is to source the build environment: + + $ source oe-init-build-env + + To start out with, we'll generate an image from one of the canned + .wks files. The following generates a list of availailable + images: + + $ wic list images + mkefidisk Create an EFI disk image + directdisk Create a 'pcbios' direct disk image + + You can get more information about any of the available images by + typing 'wic list xxx help', where 'xxx' is one of the image names: + + $ wic list mkefidisk help + + Creates a partitioned EFI disk image that the user can directly dd + to boot media. + + At any time, you can get help on the 'wic' command or any + subcommand (currently 'list' and 'create'). For instance, to get + the description of 'wic create' command and its parameters: + + $ wic create + + Usage: + + Create a new OpenEmbedded image + + usage: wic create <wks file or image name> [-o <DIRNAME> | ...] + [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] + [-e | --image-name] [-s, --skip-build-check] [-D, --debug] + [-r, --rootfs-dir] [-b, --bootimg-dir] [-k, --kernel-dir] + [-n, --native-sysroot] [-f, --build-rootfs] + + This command creates an OpenEmbedded image based on the 'OE + kickstart commands' found in the <wks file>. + + The -o option can be used to place the image in a directory + with a different name and location. + + See 'wic help create' for more detailed instructions. + ... + + As mentioned in the command, you can get even more detailed + information by adding 'help' to the above: + + $ wic help create + + So, the easiest way to create an image is to use the -e option + with a canned .wks file. To use the -e option, you need to + specify the image used to generate the artifacts and you actually + need to have the MACHINE used to build them specified in your + local.conf (these requirements aren't necessary if you aren't + using the -e options.) Below, we generate a directdisk image, + pointing the process at the core-image-minimal artifacts for the + current MACHINE: + + $ wic create directdisk -e core-image-minimal + + Checking basic build environment... + Done. + + Creating image(s)... + + Info: The new image(s) can be found here: + /var/tmp/wic/build/directdisk-201309252350-sda.direct + + The following build artifacts were used to create the image(s): + + ROOTFS_DIR: ... + BOOTIMG_DIR: ... + KERNEL_DIR: ... + NATIVE_SYSROOT: ... + + The image(s) were created using OE kickstart file: + .../scripts/lib/wic/canned-wks/directdisk.wks + + The output shows the name and location of the image created, and + so that you know exactly what was used to generate the image, each + of the artifacts and the kickstart file used. + + Similarly, you can create a 'mkefidisk' image in the same way + (notice that this example uses a different machine - because it's + using the -e option, you need to change the MACHINE in your + local.conf): + + $ wic create mkefidisk -e core-image-minimal + Checking basic build environment... + Done. + + Creating image(s)... + + Info: The new image(s) can be found here: + /var/tmp/wic/build/mkefidisk-201309260027-sda.direct + + ... + + Here's an example that doesn't take the easy way out and manually + specifies each build artifact, along with a non-canned .wks file, + and also uses the -o option to have wic create the output + somewhere other than the default /var/tmp/wic: + + $ wic create ./test.wks -o ./out --rootfs-dir + tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs + --bootimg-dir tmp/sysroots/qemux86-64/usr/share + --kernel-dir tmp/deploy/images/qemux86-64 + --native-sysroot tmp/sysroots/x86_64-linux + + Creating image(s)... + + Info: The new image(s) can be found here: + out/build/test-201507211313-sda.direct + + The following build artifacts were used to create the image(s): + ROOTFS_DIR: tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs + BOOTIMG_DIR: tmp/sysroots/qemux86-64/usr/share + KERNEL_DIR: tmp/deploy/images/qemux86-64 + NATIVE_SYSROOT: tmp/sysroots/x86_64-linux + + The image(s) were created using OE kickstart file: + ./test.wks + + Here is a content of test.wks: + + part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 + part / --source rootfs --ondisk sda --fstype=ext3 --label platform --align 1024 + + bootloader --timeout=0 --append="rootwait rootfstype=ext3 video=vesafb vga=0x318 console=tty0" + + + Finally, here's an example of the actual partition language + commands used to generate the mkefidisk image i.e. these are the + contents of the mkefidisk.wks OE kickstart file: + + # short-description: Create an EFI disk image + # long-description: Creates a partitioned EFI disk image that the user + # can directly dd to boot media. + + part /boot --source bootimg-efi --ondisk sda --fstype=efi --active + + part / --source rootfs --ondisk sda --fstype=ext3 --label platform + + part swap --ondisk sda --size 44 --label swap1 --fstype=swap + + bootloader --timeout=10 --append="rootwait console=ttyPCH0,115200" + + You can get a complete listing and description of all the + kickstart commands available for use in .wks files from 'wic help + kickstart'. +""" + +wic_kickstart_help = """ + +NAME + wic kickstart - wic kickstart reference + +DESCRIPTION + This section provides the definitive reference to the wic + kickstart language. It also provides documentation on the list of + --source plugins available for use from the 'part' command (see + the 'Platform-specific Plugins' section below). + + The current wic implementation supports only the basic kickstart + partitioning commands: partition (or part for short) and + bootloader. + + The following is a listing of the commands, their syntax, and + meanings. The commands are based on the Fedora kickstart + documentation but with modifications to reflect wic capabilities. + + http://fedoraproject.org/wiki/Anaconda/Kickstart#part_or_partition + http://fedoraproject.org/wiki/Anaconda/Kickstart#bootloader + + Commands + + * 'part' or 'partition' + + This command creates a partition on the system and uses the + following syntax: + + part [<mountpoint>] + + The <mountpoint> is where the partition will be mounted and + must take of one of the following forms: + + /<path>: For example: /, /usr, or /home + + swap: The partition will be used as swap space. + + If a <mountpoint> is not specified the partition will be created + but will not be mounted. + + Partitions with a <mountpoint> specified will be automatically mounted. + This is achieved by wic adding entries to the fstab during image + generation. In order for a valid fstab to be generated one of the + --ondrive, --ondisk or --use-uuid partition options must be used for + each partition that specifies a mountpoint. + + + The following are supported 'part' options: + + --size: The minimum partition size. Specify an integer value + such as 500. Multipliers k, M ang G can be used. If + not specified, the size is in MB. + You do not need this option if you use --source. + + --fixed-size: Exact partition size. Value format is the same + as for --size option. This option cannot be + specified along with --size. If partition data + is larger than --fixed-size and error will be + raised when assembling disk image. + + --source: This option is a wic-specific option that names the + source of the data that will populate the + partition. The most common value for this option + is 'rootfs', but can be any value which maps to a + valid 'source plugin' (see 'wic help plugins'). + + If '--source rootfs' is used, it tells the wic + command to create a partition as large as needed + and to fill it with the contents of the root + filesystem pointed to by the '-r' wic command-line + option (or the equivalent rootfs derived from the + '-e' command-line option). The filesystem type + that will be used to create the partition is driven + by the value of the --fstype option specified for + the partition (see --fstype below). + + If --source <plugin-name>' is used, it tells the + wic command to create a partition as large as + needed and to fill with the contents of the + partition that will be generated by the specified + plugin name using the data pointed to by the '-r' + wic command-line option (or the equivalent rootfs + derived from the '-e' command-line option). + Exactly what those contents and filesystem type end + up being are dependent on the given plugin + implementation. + + If --source option is not used, the wic command + will create empty partition. --size parameter has + to be used to specify size of empty partition. + + --ondisk or --ondrive: Forces the partition to be created on + a particular disk. + + --fstype: Sets the file system type for the partition. These + apply to partitions created using '--source rootfs' (see + --source above). Valid values are: + + vfat + msdos + ext2 + ext3 + ext4 + btrfs + squashfs + swap + + --fsoptions: Specifies a free-form string of options to be + used when mounting the filesystem. This string + will be copied into the /etc/fstab file of the + installed system and should be enclosed in + quotes. If not specified, the default string is + "defaults". + + --label label: Specifies the label to give to the filesystem + to be made on the partition. If the given + label is already in use by another filesystem, + a new label is created for the partition. + + --active: Marks the partition as active. + + --align (in KBytes): This option is specific to wic and says + to start a partition on an x KBytes + boundary. + + --no-table: This option is specific to wic. Space will be + reserved for the partition and it will be + populated but it will not be added to the + partition table. It may be useful for + bootloaders. + + --exclude-path: This option is specific to wic. It excludes the given + relative path from the resulting image. If the path + ends with a slash, only the content of the directory + is omitted, not the directory itself. This option only + has an effect with the rootfs source plugin. + + --extra-space: This option is specific to wic. It adds extra + space after the space filled by the content + of the partition. The final size can go + beyond the size specified by --size. + By default, 10MB. This option cannot be used + with --fixed-size option. + + --overhead-factor: This option is specific to wic. The + size of the partition is multiplied by + this factor. It has to be greater than or + equal to 1. The default value is 1.3. + This option cannot be used with --fixed-size + option. + + --part-type: This option is specific to wic. It specifies partition + type GUID for GPT partitions. + List of partition type GUIDS can be found here: + http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs + + --use-uuid: This option is specific to wic. It makes wic to generate + random globally unique identifier (GUID) for the partition + and use it in bootloader configuration to specify root partition. + + --uuid: This option is specific to wic. It specifies partition UUID. + It's useful if preconfigured partition UUID is added to kernel command line + in bootloader configuration before running wic. In this case .wks file can + be generated or modified to set preconfigured parition UUID using this option. + + --system-id: This option is specific to wic. It specifies partition system id. It's useful + for the harware that requires non-default partition system ids. The parameter + in one byte long hex number either with 0x prefix or without it. + + * bootloader + + This command allows the user to specify various bootloader + options. The following are supported 'bootloader' options: + + --timeout: Specifies the number of seconds before the + bootloader times out and boots the default option. + + --append: Specifies kernel parameters. These will be added to + bootloader command-line - for example, the syslinux + APPEND or grub kernel command line. + + --configfile: Specifies a user defined configuration file for + the bootloader. This file must be located in the + canned-wks folder or could be the full path to the + file. Using this option will override any other + bootloader option. + + Note that bootloader functionality and boot partitions are + implemented by the various --source plugins that implement + bootloader functionality; the bootloader command essentially + provides a means of modifying bootloader configuration. + + * include + + This command allows the user to include the content of .wks file + into original .wks file. + + Command uses the following syntax: + + include <file> + + The <file> is either path to the file or its name. If name is + specified wic will try to find file in the directories with canned + .wks files. + +""" diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py new file mode 100644 index 0000000000..d026caad0f --- /dev/null +++ b/scripts/lib/wic/ksparser.py @@ -0,0 +1,227 @@ +#!/usr/bin/env python -tt +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2016 Intel, Inc. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; version 2 of the License +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# DESCRIPTION +# This module provides parser for kickstart format +# +# AUTHORS +# Ed Bartosh <ed.bartosh> (at] linux.intel.com> + +"""Kickstart parser module.""" + +import os +import shlex +import logging + +from argparse import ArgumentParser, ArgumentError, ArgumentTypeError + +from wic.engine import find_canned +from wic.partition import Partition + +logger = logging.getLogger('wic') + +class KickStartError(Exception): + """Custom exception.""" + pass + +class KickStartParser(ArgumentParser): + """ + This class overwrites error method to throw exception + instead of producing usage message(default argparse behavior). + """ + def error(self, message): + raise ArgumentError(None, message) + +def sizetype(arg): + """ + Custom type for ArgumentParser + Converts size string in <num>[K|k|M|G] format into the integer value + """ + if arg.isdigit(): + return int(arg) * 1024 + + if not arg[:-1].isdigit(): + raise ArgumentTypeError("Invalid size: %r" % arg) + + size = int(arg[:-1]) + if arg.endswith("k") or arg.endswith("K"): + return size + if arg.endswith("M"): + return size * 1024 + if arg.endswith("G"): + return size * 1024 * 1024 + + raise ArgumentTypeError("Invalid size: %r" % arg) + +def overheadtype(arg): + """ + Custom type for ArgumentParser + Converts overhead string to float and checks if it's bigger than 1.0 + """ + try: + result = float(arg) + except ValueError: + raise ArgumentTypeError("Invalid value: %r" % arg) + + if result < 1.0: + raise ArgumentTypeError("Overhead factor should be > 1.0" % arg) + + return result + +def cannedpathtype(arg): + """ + Custom type for ArgumentParser + Tries to find file in the list of canned wks paths + """ + scripts_path = os.path.abspath(os.path.dirname(__file__) + '../../..') + result = find_canned(scripts_path, arg) + if not result: + raise ArgumentTypeError("file not found: %s" % arg) + return result + +def systemidtype(arg): + """ + Custom type for ArgumentParser + Checks if the argument sutisfies system id requirements, + i.e. if it's one byte long integer > 0 + """ + error = "Invalid system type: %s. must be hex "\ + "between 0x1 and 0xFF" % arg + try: + result = int(arg, 16) + except ValueError: + raise ArgumentTypeError(error) + + if result <= 0 or result > 0xff: + raise ArgumentTypeError(error) + + return arg + +class KickStart(): + """"Kickstart parser implementation.""" + + DEFAULT_EXTRA_SPACE = 10*1024 + DEFAULT_OVERHEAD_FACTOR = 1.3 + + def __init__(self, confpath): + + self.partitions = [] + self.bootloader = None + self.lineno = 0 + self.partnum = 0 + + parser = KickStartParser() + subparsers = parser.add_subparsers() + + part = subparsers.add_parser('part') + part.add_argument('mountpoint', nargs='?') + part.add_argument('--active', action='store_true') + part.add_argument('--align', type=int) + part.add_argument('--exclude-path', nargs='+') + part.add_argument("--extra-space", type=sizetype) + part.add_argument('--fsoptions', dest='fsopts') + part.add_argument('--fstype', default='vfat', + choices=('ext2', 'ext3', 'ext4', 'btrfs', + 'squashfs', 'vfat', 'msdos', 'swap')) + part.add_argument('--label') + part.add_argument('--no-table', action='store_true') + part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda') + part.add_argument("--overhead-factor", type=overheadtype) + part.add_argument('--part-type') + part.add_argument('--rootfs-dir') + + # --size and --fixed-size cannot be specified together; options + # ----extra-space and --overhead-factor should also raise a parser + # --error, but since nesting mutually exclusive groups does not work, + # ----extra-space/--overhead-factor are handled later + sizeexcl = part.add_mutually_exclusive_group() + sizeexcl.add_argument('--size', type=sizetype, default=0) + sizeexcl.add_argument('--fixed-size', type=sizetype, default=0) + + part.add_argument('--source') + part.add_argument('--sourceparams') + part.add_argument('--system-id', type=systemidtype) + part.add_argument('--use-uuid', action='store_true') + part.add_argument('--uuid') + + bootloader = subparsers.add_parser('bootloader') + bootloader.add_argument('--append') + bootloader.add_argument('--configfile') + bootloader.add_argument('--ptable', choices=('msdos', 'gpt'), + default='msdos') + bootloader.add_argument('--timeout', type=int) + bootloader.add_argument('--source') + + include = subparsers.add_parser('include') + include.add_argument('path', type=cannedpathtype) + + self._parse(parser, confpath) + if not self.bootloader: + logger.warning('bootloader config not specified, using defaults\n') + self.bootloader = bootloader.parse_args([]) + + def _parse(self, parser, confpath): + """ + Parse file in .wks format using provided parser. + """ + with open(confpath) as conf: + lineno = 0 + for line in conf: + line = line.strip() + lineno += 1 + if line and line[0] != '#': + try: + line_args = shlex.split(line) + parsed = parser.parse_args(line_args) + except ArgumentError as err: + raise KickStartError('%s:%d: %s' % \ + (confpath, lineno, err)) + if line.startswith('part'): + # using ArgumentParser one cannot easily tell if option + # was passed as argument, if said option has a default + # value; --overhead-factor/--extra-space cannot be used + # with --fixed-size, so at least detect when these were + # passed with non-0 values ... + if parsed.fixed_size: + if parsed.overhead_factor or parsed.extra_space: + err = "%s:%d: arguments --overhead-factor and --extra-space not "\ + "allowed with argument --fixed-size" \ + % (confpath, lineno) + raise KickStartError(err) + else: + # ... and provide defaults if not using + # --fixed-size iff given option was not used + # (again, one cannot tell if option was passed but + # with value equal to 0) + if '--overhead-factor' not in line_args: + parsed.overhead_factor = self.DEFAULT_OVERHEAD_FACTOR + if '--extra-space' not in line_args: + parsed.extra_space = self.DEFAULT_EXTRA_SPACE + + self.partnum += 1 + self.partitions.append(Partition(parsed, self.partnum)) + elif line.startswith('include'): + self._parse(parser, parsed.path) + elif line.startswith('bootloader'): + if not self.bootloader: + self.bootloader = parsed + else: + err = "%s:%d: more than one bootloader specified" \ + % (confpath, lineno) + raise KickStartError(err) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py new file mode 100644 index 0000000000..939e66731b --- /dev/null +++ b/scripts/lib/wic/partition.py @@ -0,0 +1,411 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2013-2016 Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION +# This module provides the OpenEmbedded partition object definitions. +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# Ed Bartosh <ed.bartosh> (at] linux.intel.com> + +import logging +import os +import tempfile + +from wic import WicError +from wic.utils.misc import exec_cmd, exec_native_cmd, get_bitbake_var +from wic.pluginbase import PluginMgr + +logger = logging.getLogger('wic') + +class Partition(): + + def __init__(self, args, lineno): + self.args = args + self.active = args.active + self.align = args.align + self.disk = args.disk + self.device = None + self.extra_space = args.extra_space + self.exclude_path = args.exclude_path + self.fsopts = args.fsopts + self.fstype = args.fstype + self.label = args.label + self.mountpoint = args.mountpoint + self.no_table = args.no_table + self.num = None + self.overhead_factor = args.overhead_factor + self.part_type = args.part_type + self.rootfs_dir = args.rootfs_dir + self.size = args.size + self.fixed_size = args.fixed_size + self.source = args.source + self.sourceparams = args.sourceparams + self.system_id = args.system_id + self.use_uuid = args.use_uuid + self.uuid = args.uuid + + self.lineno = lineno + self.source_file = "" + self.sourceparams_dict = {} + + def get_extra_block_count(self, current_blocks): + """ + The --size param is reflected in self.size (in kB), and we already + have current_blocks (1k) blocks, calculate and return the + number of (1k) blocks we need to add to get to --size, 0 if + we're already there or beyond. + """ + logger.debug("Requested partition size for %s: %d", + self.mountpoint, self.size) + + if not self.size: + return 0 + + requested_blocks = self.size + + logger.debug("Requested blocks %d, current_blocks %d", + requested_blocks, current_blocks) + + if requested_blocks > current_blocks: + return requested_blocks - current_blocks + else: + return 0 + + def get_rootfs_size(self, actual_rootfs_size=0): + """ + Calculate the required size of rootfs taking into consideration + --size/--fixed-size flags as well as overhead and extra space, as + specified in kickstart file. Raises an error if the + `actual_rootfs_size` is larger than fixed-size rootfs. + + """ + if self.fixed_size: + rootfs_size = self.fixed_size + if actual_rootfs_size > rootfs_size: + raise WicError("Actual rootfs size (%d kB) is larger than " + "allowed size %d kB" % + (actual_rootfs_size, rootfs_size)) + else: + extra_blocks = self.get_extra_block_count(actual_rootfs_size) + if extra_blocks < self.extra_space: + extra_blocks = self.extra_space + + rootfs_size = actual_rootfs_size + extra_blocks + rootfs_size *= self.overhead_factor + + logger.debug("Added %d extra blocks to %s to get to %d total blocks", + extra_blocks, self.mountpoint, rootfs_size) + + return rootfs_size + + @property + def disk_size(self): + """ + Obtain on-disk size of partition taking into consideration + --size/--fixed-size options. + + """ + return self.fixed_size if self.fixed_size else self.size + + def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir, + bootimg_dir, kernel_dir, native_sysroot): + """ + Prepare content for individual partitions, depending on + partition command parameters. + """ + if not self.source: + if not self.size and not self.fixed_size: + raise WicError("The %s partition has a size of zero. Please " + "specify a non-zero --size/--fixed-size for that " + "partition." % self.mountpoint) + + if self.fstype == "swap": + self.prepare_swap_partition(cr_workdir, oe_builddir, + native_sysroot) + self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype) + else: + if self.fstype == 'squashfs': + raise WicError("It's not possible to create empty squashfs " + "partition '%s'" % (self.mountpoint)) + + rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label, + self.lineno, self.fstype) + if os.path.isfile(rootfs): + os.remove(rootfs) + + prefix = "ext" if self.fstype.startswith("ext") else self.fstype + method = getattr(self, "prepare_empty_partition_" + prefix) + method(rootfs, oe_builddir, native_sysroot) + self.source_file = rootfs + return + + plugins = PluginMgr.get_plugins('source') + + if self.source not in plugins: + raise WicError("The '%s' --source specified for %s doesn't exist.\n\t" + "See 'wic list source-plugins' for a list of available" + " --sources.\n\tSee 'wic help source-plugins' for " + "details on adding a new source plugin." % + (self.source, self.mountpoint)) + + srcparams_dict = {} + if self.sourceparams: + # Split sourceparams string of the form key1=val1[,key2=val2,...] + # into a dict. Also accepts valueless keys i.e. without = + splitted = self.sourceparams.split(',') + srcparams_dict = dict(par.split('=') for par in splitted if par) + + plugin = PluginMgr.get_plugins('source')[self.source] + plugin.do_configure_partition(self, srcparams_dict, creator, + cr_workdir, oe_builddir, bootimg_dir, + kernel_dir, native_sysroot) + plugin.do_stage_partition(self, srcparams_dict, creator, + cr_workdir, oe_builddir, bootimg_dir, + kernel_dir, native_sysroot) + plugin.do_prepare_partition(self, srcparams_dict, creator, + cr_workdir, oe_builddir, bootimg_dir, + kernel_dir, rootfs_dir, native_sysroot) + + # further processing required Partition.size to be an integer, make + # sure that it is one + if not isinstance(self.size, int): + raise WicError("Partition %s internal size is not an integer. " + "This a bug in source plugin %s and needs to be fixed." % + (self.mountpoint, self.source)) + + if self.fixed_size and self.size > self.fixed_size: + raise WicError("File system image of partition %s is " + "larger (%d kB) than its allowed size %d kB" % + (self.mountpoint, self.size, self.fixed_size)) + + def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir, + native_sysroot): + """ + Prepare content for a rootfs partition i.e. create a partition + and fill it from a /rootfs dir. + + Currently handles ext2/3/4, btrfs and vfat. + """ + p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot) + p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR", + "%s/../pseudo" % rootfs_dir) + p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir) + p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1") + pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix + pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % p_localstatedir + pseudo += "export PSEUDO_PASSWD=%s;" % p_passwd + pseudo += "export PSEUDO_NOSYMLINKEXP=%s;" % p_nosymlinkexp + pseudo += "%s " % get_bitbake_var("FAKEROOTCMD") + + rootfs = "%s/rootfs_%s.%s.%s" % (cr_workdir, self.label, + self.lineno, self.fstype) + if os.path.isfile(rootfs): + os.remove(rootfs) + + # Get rootfs size from bitbake variable if it's not set in .ks file + if not self.size: + # Bitbake variable ROOTFS_SIZE is calculated in + # Image._get_rootfs_size method from meta/lib/oe/image.py + # using IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_ALIGNMENT, + # IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE + rsize_bb = get_bitbake_var('ROOTFS_SIZE') + if rsize_bb: + logger.warning('overhead-factor was specified, but size was not,' + ' so bitbake variables will be used for the size.' + ' In this case both IMAGE_OVERHEAD_FACTOR and ' + '--overhead-factor will be applied') + self.size = int(round(float(rsize_bb))) + + prefix = "ext" if self.fstype.startswith("ext") else self.fstype + method = getattr(self, "prepare_rootfs_" + prefix) + method(rootfs, oe_builddir, rootfs_dir, native_sysroot, pseudo) + self.source_file = rootfs + + # get the rootfs size in the right units for kickstart (kB) + du_cmd = "du -Lbks %s" % rootfs + out = exec_cmd(du_cmd) + self.size = int(out.split()[0]) + + def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir, + native_sysroot, pseudo): + """ + Prepare content for an ext2/3/4 rootfs partition. + """ + du_cmd = "du -ks %s" % rootfs_dir + out = exec_cmd(du_cmd) + actual_rootfs_size = int(out.split()[0]) + + rootfs_size = self.get_rootfs_size(actual_rootfs_size) + + with open(rootfs, 'w') as sparse: + os.ftruncate(sparse.fileno(), rootfs_size * 1024) + + extra_imagecmd = "-i 8192" + + label_str = "" + if self.label: + label_str = "-L %s" % self.label + + mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \ + (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir) + exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) + + mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs) + exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) + + def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir, + native_sysroot, pseudo): + """ + Prepare content for a btrfs rootfs partition. + + Currently handles ext2/3/4 and btrfs. + """ + du_cmd = "du -ks %s" % rootfs_dir + out = exec_cmd(du_cmd) + actual_rootfs_size = int(out.split()[0]) + + rootfs_size = self.get_rootfs_size(actual_rootfs_size) + + with open(rootfs, 'w') as sparse: + os.ftruncate(sparse.fileno(), rootfs_size * 1024) + + label_str = "" + if self.label: + label_str = "-L %s" % self.label + + mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \ + (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, rootfs) + exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) + + def prepare_rootfs_msdos(self, rootfs, oe_builddir, rootfs_dir, + native_sysroot, pseudo): + """ + Prepare content for a msdos/vfat rootfs partition. + """ + du_cmd = "du -bks %s" % rootfs_dir + out = exec_cmd(du_cmd) + blocks = int(out.split()[0]) + + rootfs_size = self.get_rootfs_size(blocks) + + label_str = "-n boot" + if self.label: + label_str = "-n %s" % self.label + + size_str = "" + if self.fstype == 'msdos': + size_str = "-F 16" # FAT 16 + + dosfs_cmd = "mkdosfs %s -S 512 %s -C %s %d" % (label_str, size_str, + rootfs, rootfs_size) + exec_native_cmd(dosfs_cmd, native_sysroot) + + mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir) + exec_native_cmd(mcopy_cmd, native_sysroot) + + chmod_cmd = "chmod 644 %s" % rootfs + exec_cmd(chmod_cmd) + + prepare_rootfs_vfat = prepare_rootfs_msdos + + def prepare_rootfs_squashfs(self, rootfs, oe_builddir, rootfs_dir, + native_sysroot, pseudo): + """ + Prepare content for a squashfs rootfs partition. + """ + squashfs_cmd = "mksquashfs %s %s -noappend" % \ + (rootfs_dir, rootfs) + exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo) + + def prepare_empty_partition_ext(self, rootfs, oe_builddir, + native_sysroot): + """ + Prepare an empty ext2/3/4 partition. + """ + size = self.disk_size + with open(rootfs, 'w') as sparse: + os.ftruncate(sparse.fileno(), size * 1024) + + extra_imagecmd = "-i 8192" + + label_str = "" + if self.label: + label_str = "-L %s" % self.label + + mkfs_cmd = "mkfs.%s -F %s %s %s" % \ + (self.fstype, extra_imagecmd, label_str, rootfs) + exec_native_cmd(mkfs_cmd, native_sysroot) + + def prepare_empty_partition_btrfs(self, rootfs, oe_builddir, + native_sysroot): + """ + Prepare an empty btrfs partition. + """ + size = self.disk_size + with open(rootfs, 'w') as sparse: + os.ftruncate(sparse.fileno(), size * 1024) + + label_str = "" + if self.label: + label_str = "-L %s" % self.label + + mkfs_cmd = "mkfs.%s -b %d %s %s" % \ + (self.fstype, self.size * 1024, label_str, rootfs) + exec_native_cmd(mkfs_cmd, native_sysroot) + + def prepare_empty_partition_msdos(self, rootfs, oe_builddir, + native_sysroot): + """ + Prepare an empty vfat partition. + """ + blocks = self.disk_size + + label_str = "-n boot" + if self.label: + label_str = "-n %s" % self.label + + size_str = "" + if self.fstype == 'msdos': + size_str = "-F 16" # FAT 16 + + dosfs_cmd = "mkdosfs %s -S 512 %s -C %s %d" % (label_str, size_str, + rootfs, blocks) + exec_native_cmd(dosfs_cmd, native_sysroot) + + chmod_cmd = "chmod 644 %s" % rootfs + exec_cmd(chmod_cmd) + + prepare_empty_partition_vfat = prepare_empty_partition_msdos + + def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot): + """ + Prepare a swap partition. + """ + path = "%s/fs.%s" % (cr_workdir, self.fstype) + + with open(path, 'w') as sparse: + os.ftruncate(sparse.fileno(), self.size * 1024) + + import uuid + label_str = "" + if self.label: + label_str = "-L %s" % self.label + mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path) + exec_native_cmd(mkswap_cmd, native_sysroot) diff --git a/scripts/lib/wic/pluginbase.py b/scripts/lib/wic/pluginbase.py new file mode 100644 index 0000000000..fb3d179c2d --- /dev/null +++ b/scripts/lib/wic/pluginbase.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python -tt +# +# Copyright (c) 2011 Intel, Inc. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; version 2 of the License +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +__all__ = ['ImagerPlugin', 'SourcePlugin'] + +import os +import logging + +from collections import defaultdict +from importlib.machinery import SourceFileLoader + +from wic import WicError +from wic.utils.misc import get_bitbake_var + +PLUGIN_TYPES = ["imager", "source"] + +SCRIPTS_PLUGIN_DIR = "scripts/lib/wic/plugins" + +logger = logging.getLogger('wic') + +PLUGINS = defaultdict(dict) + +class PluginMgr: + _plugin_dirs = [] + + @classmethod + def get_plugins(cls, ptype): + """Get dictionary of <plugin_name>:<class> pairs.""" + if ptype not in PLUGIN_TYPES: + raise WicError('%s is not valid plugin type' % ptype) + + # collect plugin directories + if not cls._plugin_dirs: + cls._plugin_dirs = [os.path.join(os.path.dirname(__file__), 'plugins')] + layers = get_bitbake_var("BBLAYERS") or '' + for layer_path in layers.split(): + path = os.path.join(layer_path, SCRIPTS_PLUGIN_DIR) + path = os.path.abspath(os.path.expanduser(path)) + if path not in cls._plugin_dirs and os.path.isdir(path): + cls._plugin_dirs.insert(0, path) + + if ptype not in PLUGINS: + # load all ptype plugins + for pdir in cls._plugin_dirs: + ppath = os.path.join(pdir, ptype) + if os.path.isdir(ppath): + for fname in os.listdir(ppath): + if fname.endswith('.py'): + mname = fname[:-3] + mpath = os.path.join(ppath, fname) + logger.debug("loading plugin module %s", mpath) + SourceFileLoader(mname, mpath).load_module() + + return PLUGINS.get(ptype) + +class PluginMeta(type): + def __new__(cls, name, bases, attrs): + class_type = type.__new__(cls, name, bases, attrs) + if 'name' in attrs: + PLUGINS[class_type.wic_plugin_type][attrs['name']] = class_type + + return class_type + +class ImagerPlugin(metaclass=PluginMeta): + wic_plugin_type = "imager" + + def do_create(self): + raise WicError("Method %s.do_create is not implemented" % + self.__class__.__name__) + +class SourcePlugin(metaclass=PluginMeta): + wic_plugin_type = "source" + """ + The methods that can be implemented by --source plugins. + + Any methods not implemented in a subclass inherit these. + """ + + @classmethod + def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir, + bootimg_dir, kernel_dir, native_sysroot): + """ + Called after all partitions have been prepared and assembled into a + disk image. This provides a hook to allow finalization of a + disk image e.g. to write an MBR to it. + """ + logger.debug("SourcePlugin: do_install_disk: disk: %s", disk_name) + + @classmethod + def do_stage_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + native_sysroot): + """ + Special content staging hook called before do_prepare_partition(), + normally empty. + + Typically, a partition will just use the passed-in parame e.g + straight bootimg_dir, etc, but in some cases, things need to + be more tailored e.g. to use a deploy dir + /boot, etc. This + hook allows those files to be staged in a customized fashion. + Not that get_bitbake_var() allows you to acces non-standard + variables that you might want to use for this. + """ + logger.debug("SourcePlugin: do_stage_partition: part: %s", part) + + @classmethod + def do_configure_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + native_sysroot): + """ + Called before do_prepare_partition(), typically used to create + custom configuration files for a partition, for example + syslinux or grub config files. + """ + logger.debug("SourcePlugin: do_configure_partition: part: %s", part) + + @classmethod + def do_prepare_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, rootfs_dir, + native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + """ + logger.debug("SourcePlugin: do_prepare_partition: part: %s", part) + diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py new file mode 100644 index 0000000000..f2e6127331 --- /dev/null +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -0,0 +1,561 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2013, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION +# This implements the 'direct' imager plugin class for 'wic' +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# + +import logging +import os +import shutil +import tempfile +import uuid + +from time import strftime + +from wic import WicError +from wic.filemap import sparse_copy +from wic.ksparser import KickStart, KickStartError +from wic.pluginbase import PluginMgr, ImagerPlugin +from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd + +logger = logging.getLogger('wic') + +class DirectPlugin(ImagerPlugin): + """ + Install a system into a file containing a partitioned disk image. + + An image file is formatted with a partition table, each partition + created from a rootfs or other OpenEmbedded build artifact and dd'ed + into the virtual disk. The disk image can subsequently be dd'ed onto + media and used on actual hardware. + """ + name = 'direct' + + def __init__(self, wks_file, rootfs_dir, bootimg_dir, kernel_dir, + native_sysroot, oe_builddir, options): + try: + self.ks = KickStart(wks_file) + except KickStartError as err: + raise WicError(str(err)) + + # parse possible 'rootfs=name' items + self.rootfs_dir = dict(rdir.split('=') for rdir in rootfs_dir.split(' ')) + self.bootimg_dir = bootimg_dir + self.kernel_dir = kernel_dir + self.native_sysroot = native_sysroot + self.oe_builddir = oe_builddir + + self.outdir = options.outdir + self.compressor = options.compressor + self.bmap = options.bmap + + self.name = "%s-%s" % (os.path.splitext(os.path.basename(wks_file))[0], + strftime("%Y%m%d%H%M")) + self.workdir = tempfile.mkdtemp(dir=self.outdir, prefix='tmp.wic.') + self._image = None + self.ptable_format = self.ks.bootloader.ptable + self.parts = self.ks.partitions + + # as a convenience, set source to the boot partition source + # instead of forcing it to be set via bootloader --source + for part in self.parts: + if not self.ks.bootloader.source and part.mountpoint == "/boot": + self.ks.bootloader.source = part.source + break + + image_path = self._full_path(self.workdir, self.parts[0].disk, "direct") + self._image = PartitionedImage(image_path, self.ptable_format, + self.parts, self.native_sysroot) + + def do_create(self): + """ + Plugin entry point. + """ + try: + self.create() + self.assemble() + self.finalize() + self.print_info() + finally: + self.cleanup() + + def _write_fstab(self, image_rootfs): + """overriden to generate fstab (temporarily) in rootfs. This is called + from _create, make sure it doesn't get called from + BaseImage.create() + """ + if not image_rootfs: + return + + fstab_path = image_rootfs + "/etc/fstab" + if not os.path.isfile(fstab_path): + return + + with open(fstab_path) as fstab: + fstab_lines = fstab.readlines() + + if self._update_fstab(fstab_lines, self.parts): + shutil.copyfile(fstab_path, fstab_path + ".orig") + + with open(fstab_path, "w") as fstab: + fstab.writelines(fstab_lines) + + return fstab_path + + def _update_fstab(self, fstab_lines, parts): + """Assume partition order same as in wks""" + updated = False + for part in parts: + if not part.realnum or not part.mountpoint \ + or part.mountpoint in ("/", "/boot"): + continue + + # mmc device partitions are named mmcblk0p1, mmcblk0p2.. + prefix = 'p' if part.disk.startswith('mmcblk') else '' + device_name = "/dev/%s%s%d" % (part.disk, prefix, part.realnum) + + opts = part.fsopts if part.fsopts else "defaults" + line = "\t".join([device_name, part.mountpoint, part.fstype, + opts, "0", "0"]) + "\n" + + fstab_lines.append(line) + updated = True + + return updated + + def _full_path(self, path, name, extention): + """ Construct full file path to a file we generate. """ + return os.path.join(path, "%s-%s.%s" % (self.name, name, extention)) + + # + # Actual implemention + # + def create(self): + """ + For 'wic', we already have our build artifacts - we just create + filesystems from the artifacts directly and combine them into + a partitioned image. + """ + fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) + + for part in self.parts: + # get rootfs size from bitbake variable if it's not set in .ks file + if not part.size: + # and if rootfs name is specified for the partition + image_name = self.rootfs_dir.get(part.rootfs_dir) + if image_name and os.path.sep not in image_name: + # Bitbake variable ROOTFS_SIZE is calculated in + # Image._get_rootfs_size method from meta/lib/oe/image.py + # using IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_ALIGNMENT, + # IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE + rsize_bb = get_bitbake_var('ROOTFS_SIZE', image_name) + if rsize_bb: + part.size = int(round(float(rsize_bb))) + + self._image.prepare(self) + + if fstab_path: + shutil.move(fstab_path + ".orig", fstab_path) + + self._image.layout_partitions() + self._image.create() + + def assemble(self): + """ + Assemble partitions into disk image + """ + self._image.assemble() + + def finalize(self): + """ + Finalize the disk image. + + For example, prepare the image to be bootable by e.g. + creating and installing a bootloader configuration. + """ + source_plugin = self.ks.bootloader.source + disk_name = self.parts[0].disk + if source_plugin: + plugin = PluginMgr.get_plugins('source')[source_plugin] + plugin.do_install_disk(self._image, disk_name, self, self.workdir, + self.oe_builddir, self.bootimg_dir, + self.kernel_dir, self.native_sysroot) + + full_path = self._image.path + # Generate .bmap + if self.bmap: + logger.debug("Generating bmap file for %s", disk_name) + exec_native_cmd("bmaptool create %s -o %s.bmap" % (full_path, full_path), + self.native_sysroot) + # Compress the image + if self.compressor: + logger.debug("Compressing disk %s with %s", disk_name, self.compressor) + exec_cmd("%s %s" % (self.compressor, full_path)) + + def print_info(self): + """ + Print the image(s) and artifacts used, for the user. + """ + msg = "The new image(s) can be found here:\n" + + extension = "direct" + {"gzip": ".gz", + "bzip2": ".bz2", + "xz": ".xz", + None: ""}.get(self.compressor) + full_path = self._full_path(self.outdir, self.parts[0].disk, extension) + msg += ' %s\n\n' % full_path + + msg += 'The following build artifacts were used to create the image(s):\n' + for part in self.parts: + if part.rootfs_dir is None: + continue + if part.mountpoint == '/': + suffix = ':' + else: + suffix = '["%s"]:' % (part.mountpoint or part.label) + msg += ' ROOTFS_DIR%s%s\n' % (suffix.ljust(20), part.rootfs_dir) + + msg += ' BOOTIMG_DIR: %s\n' % self.bootimg_dir + msg += ' KERNEL_DIR: %s\n' % self.kernel_dir + msg += ' NATIVE_SYSROOT: %s\n' % self.native_sysroot + + logger.info(msg) + + @property + def rootdev(self): + """ + Get root device name to use as a 'root' parameter + in kernel command line. + + Assume partition order same as in wks + """ + for part in self.parts: + if part.mountpoint == "/": + if part.uuid: + return "PARTUUID=%s" % part.uuid + else: + suffix = 'p' if part.disk.startswith('mmcblk') else '' + return "/dev/%s%s%-d" % (part.disk, suffix, part.realnum) + + def cleanup(self): + if self._image: + self._image.cleanup() + + # Move results to the output dir + if not os.path.exists(self.outdir): + os.makedirs(self.outdir) + + for fname in os.listdir(self.workdir): + path = os.path.join(self.workdir, fname) + if os.path.isfile(path): + shutil.move(path, os.path.join(self.outdir, fname)) + + # remove work directory + shutil.rmtree(self.workdir, ignore_errors=True) + +# Overhead of the MBR partitioning scheme (just one sector) +MBR_OVERHEAD = 1 + +# Overhead of the GPT partitioning scheme +GPT_OVERHEAD = 34 + +# Size of a sector in bytes +SECTOR_SIZE = 512 + +class PartitionedImage(): + """ + Partitioned image in a file. + """ + + def __init__(self, path, ptable_format, partitions, native_sysroot=None): + self.path = path # Path to the image file + self.numpart = 0 # Number of allocated partitions + self.realpart = 0 # Number of partitions in the partition table + self.offset = 0 # Offset of next partition (in sectors) + self.min_size = 0 # Minimum required disk size to fit + # all partitions (in bytes) + self.ptable_format = ptable_format # Partition table format + # Disk system identifier + self.identifier = int.from_bytes(os.urandom(4), 'little') + + self.partitions = partitions + self.partimages = [] + # Size of a sector used in calculations + self.sector_size = SECTOR_SIZE + self.native_sysroot = native_sysroot + + # calculate the real partition number, accounting for partitions not + # in the partition table and logical partitions + realnum = 0 + for part in self.partitions: + if part.no_table: + part.realnum = 0 + else: + realnum += 1 + if self.ptable_format == 'msdos' and realnum > 3: + part.realnum = realnum + 1 + continue + part.realnum = realnum + + # generate parition UUIDs + for part in self.partitions: + if not part.uuid and part.use_uuid: + if self.ptable_format == 'gpt': + part.uuid = str(uuid.uuid4()) + else: # msdos partition table + part.uuid = '%08x-%02d' % (self.identifier, part.realnum) + + def prepare(self, imager): + """Prepare an image. Call prepare method of all image partitions.""" + for part in self.partitions: + # need to create the filesystems in order to get their + # sizes before we can add them and do the layout. + part.prepare(imager, imager.workdir, imager.oe_builddir, + imager.rootfs_dir, imager.bootimg_dir, + imager.kernel_dir, imager.native_sysroot) + + # Converting kB to sectors for parted + part.size_sec = part.disk_size * 1024 // self.sector_size + + def layout_partitions(self): + """ Layout the partitions, meaning calculate the position of every + partition on the disk. The 'ptable_format' parameter defines the + partition table format and may be "msdos". """ + + logger.debug("Assigning %s partitions to disks", self.ptable_format) + + # The number of primary and logical partitions. Extended partition and + # partitions not listed in the table are not included. + num_real_partitions = len([p for p in self.partitions if not p.no_table]) + + # Go through partitions in the order they are added in .ks file + for num in range(len(self.partitions)): + part = self.partitions[num] + + if self.ptable_format == 'msdos' and part.part_type: + # The --part-type can also be implemented for MBR partitions, + # in which case it would map to the 1-byte "partition type" + # filed at offset 3 of the partition entry. + raise WicError("setting custom partition type is not " \ + "implemented for msdos partitions") + + # Get the disk where the partition is located + self.numpart += 1 + if not part.no_table: + self.realpart += 1 + + if self.numpart == 1: + if self.ptable_format == "msdos": + overhead = MBR_OVERHEAD + elif self.ptable_format == "gpt": + overhead = GPT_OVERHEAD + + # Skip one sector required for the partitioning scheme overhead + self.offset += overhead + + if self.realpart > 3 and num_real_partitions > 4: + # Reserve a sector for EBR for every logical partition + # before alignment is performed. + if self.ptable_format == "msdos": + self.offset += 1 + + if part.align: + # If not first partition and we do have alignment set we need + # to align the partition. + # FIXME: This leaves a empty spaces to the disk. To fill the + # gaps we could enlargea the previous partition? + + # Calc how much the alignment is off. + align_sectors = self.offset % (part.align * 1024 // self.sector_size) + + if align_sectors: + # If partition is not aligned as required, we need + # to move forward to the next alignment point + align_sectors = (part.align * 1024 // self.sector_size) - align_sectors + + logger.debug("Realignment for %s%s with %s sectors, original" + " offset %s, target alignment is %sK.", + part.disk, self.numpart, align_sectors, + self.offset, part.align) + + # increase the offset so we actually start the partition on right alignment + self.offset += align_sectors + + part.start = self.offset + self.offset += part.size_sec + + part.type = 'primary' + if not part.no_table: + part.num = self.realpart + else: + part.num = 0 + + if self.ptable_format == "msdos": + # only count the partitions that are in partition table + if num_real_partitions > 4: + if self.realpart > 3: + part.type = 'logical' + part.num = self.realpart + 1 + + logger.debug("Assigned %s to %s%d, sectors range %d-%d size %d " + "sectors (%d bytes).", part.mountpoint, part.disk, + part.num, part.start, self.offset - 1, part.size_sec, + part.size_sec * self.sector_size) + + # Once all the partitions have been layed out, we can calculate the + # minumim disk size + self.min_size = self.offset + if self.ptable_format == "gpt": + self.min_size += GPT_OVERHEAD + + self.min_size *= self.sector_size + + def _create_partition(self, device, parttype, fstype, start, size): + """ Create a partition on an image described by the 'device' object. """ + + # Start is included to the size so we need to substract one from the end. + end = start + size - 1 + logger.debug("Added '%s' partition, sectors %d-%d, size %d sectors", + parttype, start, end, size) + + cmd = "parted -s %s unit s mkpart %s" % (device, parttype) + if fstype: + cmd += " %s" % fstype + cmd += " %d %d" % (start, end) + + return exec_native_cmd(cmd, self.native_sysroot) + + def create(self): + logger.debug("Creating sparse file %s", self.path) + with open(self.path, 'w') as sparse: + os.ftruncate(sparse.fileno(), self.min_size) + + logger.debug("Initializing partition table for %s", self.path) + exec_native_cmd("parted -s %s mklabel %s" % + (self.path, self.ptable_format), self.native_sysroot) + + logger.debug("Set disk identifier %x", self.identifier) + with open(self.path, 'r+b') as img: + img.seek(0x1B8) + img.write(self.identifier.to_bytes(4, 'little')) + + logger.debug("Creating partitions") + + for part in self.partitions: + if part.num == 0: + continue + + if self.ptable_format == "msdos" and part.num == 5: + # Create an extended partition (note: extended + # partition is described in MBR and contains all + # logical partitions). The logical partitions save a + # sector for an EBR just before the start of a + # partition. The extended partition must start one + # sector before the start of the first logical + # partition. This way the first EBR is inside of the + # extended partition. Since the extended partitions + # starts a sector before the first logical partition, + # add a sector at the back, so that there is enough + # room for all logical partitions. + self._create_partition(self.path, "extended", + None, part.start - 1, + self.offset - part.start + 1) + + if part.fstype == "swap": + parted_fs_type = "linux-swap" + elif part.fstype == "vfat": + parted_fs_type = "fat32" + elif part.fstype == "msdos": + parted_fs_type = "fat16" + if not part.system_id: + part.system_id = '0x6' # FAT16 + else: + # Type for ext2/ext3/ext4/btrfs + parted_fs_type = "ext2" + + # Boot ROM of OMAP boards require vfat boot partition to have an + # even number of sectors. + if part.mountpoint == "/boot" and part.fstype in ["vfat", "msdos"] \ + and part.size_sec % 2: + logger.debug("Subtracting one sector from '%s' partition to " + "get even number of sectors for the partition", + part.mountpoint) + part.size_sec -= 1 + + self._create_partition(self.path, part.type, + parted_fs_type, part.start, part.size_sec) + + if part.part_type: + logger.debug("partition %d: set type UID to %s", + part.num, part.part_type) + exec_native_cmd("sgdisk --typecode=%d:%s %s" % \ + (part.num, part.part_type, + self.path), self.native_sysroot) + + if part.uuid and self.ptable_format == "gpt": + logger.debug("partition %d: set UUID to %s", + part.num, part.uuid) + exec_native_cmd("sgdisk --partition-guid=%d:%s %s" % \ + (part.num, part.uuid, self.path), + self.native_sysroot) + + if part.label and self.ptable_format == "gpt": + logger.debug("partition %d: set name to %s", + part.num, part.label) + exec_native_cmd("parted -s %s name %d %s" % \ + (self.path, part.num, part.label), + self.native_sysroot) + + if part.active: + flag_name = "legacy_boot" if self.ptable_format == 'gpt' else "boot" + logger.debug("Set '%s' flag for partition '%s' on disk '%s'", + flag_name, part.num, self.path) + exec_native_cmd("parted -s %s set %d %s on" % \ + (self.path, part.num, flag_name), + self.native_sysroot) + if part.system_id: + exec_native_cmd("sfdisk --part-type %s %s %s" % \ + (self.path, part.num, part.system_id), + self.native_sysroot) + + def cleanup(self): + # remove partition images + for image in set(self.partimages): + os.remove(image) + + def assemble(self): + logger.debug("Installing partitions") + + for part in self.partitions: + source = part.source_file + if source: + # install source_file contents into a partition + sparse_copy(source, self.path, part.start * self.sector_size) + + logger.debug("Installed %s in partition %d, sectors %d-%d, " + "size %d sectors", source, part.num, part.start, + part.start + part.size_sec - 1, part.size_sec) + + partimage = self.path + '.p%d' % part.num + os.rename(source, partimage) + self.partimages.append(partimage) diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py new file mode 100644 index 0000000000..9879cb9fce --- /dev/null +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -0,0 +1,257 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2014, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION +# This implements the 'bootimg-efi' source plugin class for 'wic' +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# + +import logging +import os +import shutil + +from wic import WicError +from wic.engine import get_custom_config +from wic.pluginbase import SourcePlugin +from wic.utils.misc import (exec_cmd, exec_native_cmd, get_bitbake_var, + BOOTDD_EXTRA_SPACE) + +logger = logging.getLogger('wic') + +class BootimgEFIPlugin(SourcePlugin): + """ + Create EFI boot partition. + This plugin supports GRUB 2 and systemd-boot bootloaders. + """ + + name = 'bootimg-efi' + + @classmethod + def do_configure_grubefi(cls, creator, cr_workdir): + """ + Create loader-specific (grub-efi) config + """ + configfile = creator.ks.bootloader.configfile + custom_cfg = None + if configfile: + custom_cfg = get_custom_config(configfile) + if custom_cfg: + # Use a custom configuration for grub + grubefi_conf = custom_cfg + logger.debug("Using custom configuration file " + "%s for grub.cfg", configfile) + else: + raise WicError("configfile is specified but failed to " + "get it from %s." % configfile) + + if not custom_cfg: + # Create grub configuration using parameters from wks file + bootloader = creator.ks.bootloader + + grubefi_conf = "" + grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" + grubefi_conf += "default=boot\n" + grubefi_conf += "timeout=%s\n" % bootloader.timeout + grubefi_conf += "menuentry 'boot'{\n" + + kernel = "/bzImage" + + grubefi_conf += "linux %s root=%s rootwait %s\n" \ + % (kernel, creator.rootdev, bootloader.append) + grubefi_conf += "}\n" + + logger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg", + cr_workdir) + cfg = open("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "w") + cfg.write(grubefi_conf) + cfg.close() + + @classmethod + def do_configure_systemdboot(cls, hdddir, creator, cr_workdir, source_params): + """ + Create loader-specific systemd-boot/gummiboot config + """ + install_cmd = "install -d %s/loader" % hdddir + exec_cmd(install_cmd) + + install_cmd = "install -d %s/loader/entries" % hdddir + exec_cmd(install_cmd) + + bootloader = creator.ks.bootloader + + loader_conf = "" + loader_conf += "default boot\n" + loader_conf += "timeout %d\n" % bootloader.timeout + + initrd = source_params.get('initrd') + + if initrd: + # obviously we need to have a common common deploy var + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not bootimg_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + + cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir) + exec_cmd(cp_cmd, True) + else: + logger.debug("Ignoring missing initrd") + + logger.debug("Writing systemd-boot config " + "%s/hdd/boot/loader/loader.conf", cr_workdir) + cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") + cfg.write(loader_conf) + cfg.close() + + configfile = creator.ks.bootloader.configfile + custom_cfg = None + if configfile: + custom_cfg = get_custom_config(configfile) + if custom_cfg: + # Use a custom configuration for systemd-boot + boot_conf = custom_cfg + logger.debug("Using custom configuration file " + "%s for systemd-boots's boot.conf", configfile) + else: + raise WicError("configfile is specified but failed to " + "get it from %s.", configfile) + + if not custom_cfg: + # Create systemd-boot configuration using parameters from wks file + kernel = "/bzImage" + + boot_conf = "" + boot_conf += "title boot\n" + boot_conf += "linux %s\n" % kernel + boot_conf += "options LABEL=Boot root=%s %s\n" % \ + (creator.rootdev, bootloader.append) + + if initrd: + boot_conf += "initrd /%s\n" % initrd + + logger.debug("Writing systemd-boot config " + "%s/hdd/boot/loader/entries/boot.conf", cr_workdir) + cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w") + cfg.write(boot_conf) + cfg.close() + + + @classmethod + def do_configure_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + native_sysroot): + """ + Called before do_prepare_partition(), creates loader-specific config + """ + hdddir = "%s/hdd/boot" % cr_workdir + + install_cmd = "install -d %s/EFI/BOOT" % hdddir + exec_cmd(install_cmd) + + try: + if source_params['loader'] == 'grub-efi': + cls.do_configure_grubefi(creator, cr_workdir) + elif source_params['loader'] == 'systemd-boot': + cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) + else: + raise WicError("unrecognized bootimg-efi loader: %s" % source_params['loader']) + except KeyError: + raise WicError("bootimg-efi requires a loader, none specified") + + + @classmethod + def do_prepare_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + In this case, prepare content for an EFI (grub) boot partition. + """ + if not kernel_dir: + kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not kernel_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + + staging_kernel_dir = kernel_dir + + hdddir = "%s/hdd/boot" % cr_workdir + + install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \ + (staging_kernel_dir, hdddir) + exec_cmd(install_cmd) + + + try: + if source_params['loader'] == 'grub-efi': + shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, + "%s/grub.cfg" % cr_workdir) + for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]: + cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:]) + exec_cmd(cp_cmd, True) + shutil.move("%s/grub.cfg" % cr_workdir, + "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) + elif source_params['loader'] == 'systemd-boot': + for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]: + cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:]) + exec_cmd(cp_cmd, True) + else: + raise WicError("unrecognized bootimg-efi loader: %s" % + source_params['loader']) + except KeyError: + raise WicError("bootimg-efi requires a loader, none specified") + + startup = os.path.join(kernel_dir, "startup.nsh") + if os.path.exists(startup): + cp_cmd = "cp %s %s/" % (startup, hdddir) + exec_cmd(cp_cmd, True) + + du_cmd = "du -bks %s" % hdddir + out = exec_cmd(du_cmd) + blocks = int(out.split()[0]) + + extra_blocks = part.get_extra_block_count(blocks) + + if extra_blocks < BOOTDD_EXTRA_SPACE: + extra_blocks = BOOTDD_EXTRA_SPACE + + blocks += extra_blocks + + logger.debug("Added %d extra blocks to %s to get to %d total blocks", + extra_blocks, part.mountpoint, blocks) + + # dosfs image, created by mkdosfs + bootimg = "%s/boot.img" % cr_workdir + + dosfs_cmd = "mkdosfs -n efi -C %s %d" % (bootimg, blocks) + exec_native_cmd(dosfs_cmd, native_sysroot) + + mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) + exec_native_cmd(mcopy_cmd, native_sysroot) + + chmod_cmd = "chmod 644 %s" % bootimg + exec_cmd(chmod_cmd) + + du_cmd = "du -Lbks %s" % bootimg + out = exec_cmd(du_cmd) + bootimg_size = out.split()[0] + + part.size = int(bootimg_size) + part.source_file = bootimg diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py new file mode 100644 index 0000000000..13fddbd478 --- /dev/null +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -0,0 +1,123 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION +# This implements the 'bootimg-partition' source plugin class for +# 'wic'. The plugin creates an image of boot partition, copying over +# files listed in IMAGE_BOOT_FILES bitbake variable. +# +# AUTHORS +# Maciej Borzecki <maciej.borzecki (at] open-rnd.pl> +# + +import logging +import os +import re + +from glob import glob + +from wic import WicError +from wic.pluginbase import SourcePlugin +from wic.utils.misc import exec_cmd, get_bitbake_var + +logger = logging.getLogger('wic') + +class BootimgPartitionPlugin(SourcePlugin): + """ + Create an image of boot partition, copying over files + listed in IMAGE_BOOT_FILES bitbake variable. + """ + + name = 'bootimg-partition' + + @classmethod + def do_prepare_partition(cls, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + In this case, does the following: + - sets up a vfat partition + - copies all files listed in IMAGE_BOOT_FILES variable + """ + hdddir = "%s/boot" % cr_workdir + install_cmd = "install -d %s" % hdddir + exec_cmd(install_cmd) + + if not kernel_dir: + kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not kernel_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + + logger.debug('Kernel dir: %s', bootimg_dir) + + boot_files = get_bitbake_var("IMAGE_BOOT_FILES") + + if not boot_files: + raise WicError('No boot files defined, IMAGE_BOOT_FILES unset') + + logger.debug('Boot files: %s', boot_files) + + # list of tuples (src_name, dst_name) + deploy_files = [] + for src_entry in re.findall(r'[\w;\-\./\*]+', boot_files): + if ';' in src_entry: + dst_entry = tuple(src_entry.split(';')) + if not dst_entry[0] or not dst_entry[1]: + raise WicError('Malformed boot file entry: %s' % src_entry) + else: + dst_entry = (src_entry, src_entry) + + logger.debug('Destination entry: %r', dst_entry) + deploy_files.append(dst_entry) + + for deploy_entry in deploy_files: + src, dst = deploy_entry + install_task = [] + if '*' in src: + # by default install files under their basename + entry_name_fn = os.path.basename + if dst != src: + # unless a target name was given, then treat name + # as a directory and append a basename + entry_name_fn = lambda name: \ + os.path.join(dst, + os.path.basename(name)) + + srcs = glob(os.path.join(kernel_dir, src)) + + logger.debug('Globbed sources: %s', ', '.join(srcs)) + for entry in srcs: + entry_dst_name = entry_name_fn(entry) + install_task.append((entry, + os.path.join(hdddir, + entry_dst_name))) + else: + install_task = [(os.path.join(kernel_dir, src), + os.path.join(hdddir, dst))] + + for task in install_task: + src_path, dst_path = task + logger.debug('Install %s as %s', + os.path.basename(src_path), dst_path) + install_cmd = "install -m 0644 -D %s %s" \ + % (src_path, dst_path) + exec_cmd(install_cmd) + + logger.debug('Prepare boot partition using rootfs in %s', hdddir) + part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, + native_sysroot) diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py new file mode 100644 index 0000000000..5890c1267b --- /dev/null +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -0,0 +1,208 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2014, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION +# This implements the 'bootimg-pcbios' source plugin class for 'wic' +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# + +import logging +import os + +from wic import WicError +from wic.engine import get_custom_config +from wic.utils import runner +from wic.pluginbase import SourcePlugin +from wic.utils.misc import (exec_cmd, exec_native_cmd, + get_bitbake_var, BOOTDD_EXTRA_SPACE) + +logger = logging.getLogger('wic') + +class BootimgPcbiosPlugin(SourcePlugin): + """ + Create MBR boot partition and install syslinux on it. + """ + + name = 'bootimg-pcbios' + + @classmethod + def _get_bootimg_dir(cls, bootimg_dir, dirname): + """ + Check if dirname exists in default bootimg_dir or + in wic-tools STAGING_DIR. + """ + for result in (bootimg_dir, get_bitbake_var("STAGING_DATADIR", "wic-tools")): + if os.path.exists("%s/%s" % (result, dirname)): + return result + + raise WicError("Couldn't find correct bootimg_dir, exiting") + + @classmethod + def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir, + bootimg_dir, kernel_dir, native_sysroot): + """ + Called after all partitions have been prepared and assembled into a + disk image. In this case, we install the MBR. + """ + bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux') + mbrfile = "%s/syslinux/" % bootimg_dir + if creator.ptable_format == 'msdos': + mbrfile += "mbr.bin" + elif creator.ptable_format == 'gpt': + mbrfile += "gptmbr.bin" + else: + raise WicError("Unsupported partition table: %s" % + creator.ptable_format) + + if not os.path.exists(mbrfile): + raise WicError("Couldn't find %s. If using the -e option, do you " + "have the right MACHINE set in local.conf? If not, " + "is the bootimg_dir path correct?" % mbrfile) + + full_path = creator._full_path(workdir, disk_name, "direct") + logger.debug("Installing MBR on disk %s as %s with size %s bytes", + disk_name, full_path, disk.min_size) + + dd_cmd = "dd if=%s of=%s conv=notrunc" % (mbrfile, full_path) + exec_cmd(dd_cmd, native_sysroot) + + @classmethod + def do_configure_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + native_sysroot): + """ + Called before do_prepare_partition(), creates syslinux config + """ + hdddir = "%s/hdd/boot" % cr_workdir + + install_cmd = "install -d %s" % hdddir + exec_cmd(install_cmd) + + bootloader = creator.ks.bootloader + + custom_cfg = None + if bootloader.configfile: + custom_cfg = get_custom_config(bootloader.configfile) + if custom_cfg: + # Use a custom configuration for grub + syslinux_conf = custom_cfg + logger.debug("Using custom configuration file %s " + "for syslinux.cfg", bootloader.configfile) + else: + raise WicError("configfile is specified but failed to " + "get it from %s." % bootloader.configfile) + + if not custom_cfg: + # Create syslinux configuration using parameters from wks file + splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg") + if os.path.exists(splash): + splashline = "menu background splash.jpg" + else: + splashline = "" + + syslinux_conf = "" + syslinux_conf += "PROMPT 0\n" + syslinux_conf += "TIMEOUT " + str(bootloader.timeout) + "\n" + syslinux_conf += "\n" + syslinux_conf += "ALLOWOPTIONS 1\n" + syslinux_conf += "SERIAL 0 115200\n" + syslinux_conf += "\n" + if splashline: + syslinux_conf += "%s\n" % splashline + syslinux_conf += "DEFAULT boot\n" + syslinux_conf += "LABEL boot\n" + + kernel = "/vmlinuz" + syslinux_conf += "KERNEL " + kernel + "\n" + + syslinux_conf += "APPEND label=boot root=%s %s\n" % \ + (creator.rootdev, bootloader.append) + + logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg", + cr_workdir) + cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w") + cfg.write(syslinux_conf) + cfg.close() + + @classmethod + def do_prepare_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + In this case, prepare content for legacy bios boot partition. + """ + bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux') + + staging_kernel_dir = kernel_dir + + hdddir = "%s/hdd/boot" % cr_workdir + + cmds = ("install -m 0644 %s/bzImage %s/vmlinuz" % + (staging_kernel_dir, hdddir), + "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" % + (bootimg_dir, hdddir), + "install -m 0644 %s/syslinux/vesamenu.c32 %s/vesamenu.c32" % + (bootimg_dir, hdddir), + "install -m 444 %s/syslinux/libcom32.c32 %s/libcom32.c32" % + (bootimg_dir, hdddir), + "install -m 444 %s/syslinux/libutil.c32 %s/libutil.c32" % + (bootimg_dir, hdddir)) + + for install_cmd in cmds: + exec_cmd(install_cmd) + + du_cmd = "du -bks %s" % hdddir + out = exec_cmd(du_cmd) + blocks = int(out.split()[0]) + + extra_blocks = part.get_extra_block_count(blocks) + + if extra_blocks < BOOTDD_EXTRA_SPACE: + extra_blocks = BOOTDD_EXTRA_SPACE + + blocks += extra_blocks + + logger.debug("Added %d extra blocks to %s to get to %d total blocks", + extra_blocks, part.mountpoint, blocks) + + # dosfs image, created by mkdosfs + bootimg = "%s/boot.img" % cr_workdir + + dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (bootimg, blocks) + exec_native_cmd(dosfs_cmd, native_sysroot) + + mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) + exec_native_cmd(mcopy_cmd, native_sysroot) + + syslinux_cmd = "syslinux %s" % bootimg + exec_native_cmd(syslinux_cmd, native_sysroot) + + chmod_cmd = "chmod 644 %s" % bootimg + exec_cmd(chmod_cmd) + + du_cmd = "du -Lbks %s" % bootimg + out = exec_cmd(du_cmd) + bootimg_size = out.split()[0] + + part.size = int(bootimg_size) + part.source_file = bootimg diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py new file mode 100644 index 0000000000..1ceba62be0 --- /dev/null +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -0,0 +1,494 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION +# This implements the 'isoimage-isohybrid' source plugin class for 'wic' +# +# AUTHORS +# Mihaly Varga <mihaly.varga (at] ni.com> + +import glob +import logging +import os +import re +import shutil + +from wic import WicError +from wic.engine import get_custom_config +from wic.pluginbase import SourcePlugin +from wic.utils.misc import exec_cmd, exec_native_cmd, get_bitbake_var + +logger = logging.getLogger('wic') + +class IsoImagePlugin(SourcePlugin): + """ + Create a bootable ISO image + + This plugin creates a hybrid, legacy and EFI bootable ISO image. The + generated image can be used on optical media as well as USB media. + + Legacy boot uses syslinux and EFI boot uses grub or gummiboot (not + implemented yet) as bootloader. The plugin creates the directories required + by bootloaders and populates them by creating and configuring the + bootloader files. + + Example kickstart file: + part /boot --source isoimage-isohybrid --sourceparams="loader=grub-efi, \\ + image_name= IsoImage" --ondisk cd --label LIVECD --fstype=ext2 + bootloader --timeout=10 --append=" " + + In --sourceparams "loader" specifies the bootloader used for booting in EFI + mode, while "image_name" specifies the name of the generated image. In the + example above, wic creates an ISO image named IsoImage-cd.direct (default + extension added by direct imeger plugin) and a file named IsoImage-cd.iso + """ + + name = 'isoimage-isohybrid' + + @classmethod + def do_configure_syslinux(cls, creator, cr_workdir): + """ + Create loader-specific (syslinux) config + """ + splash = os.path.join(cr_workdir, "ISO/boot/splash.jpg") + if os.path.exists(splash): + splashline = "menu background splash.jpg" + else: + splashline = "" + + bootloader = creator.ks.bootloader + + syslinux_conf = "" + syslinux_conf += "PROMPT 0\n" + syslinux_conf += "TIMEOUT %s \n" % (bootloader.timeout or 10) + syslinux_conf += "\n" + syslinux_conf += "ALLOWOPTIONS 1\n" + syslinux_conf += "SERIAL 0 115200\n" + syslinux_conf += "\n" + if splashline: + syslinux_conf += "%s\n" % splashline + syslinux_conf += "DEFAULT boot\n" + syslinux_conf += "LABEL boot\n" + + kernel = "/bzImage" + syslinux_conf += "KERNEL " + kernel + "\n" + syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" \ + % bootloader.append + + logger.debug("Writing syslinux config %s/ISO/isolinux/isolinux.cfg", + cr_workdir) + + with open("%s/ISO/isolinux/isolinux.cfg" % cr_workdir, "w") as cfg: + cfg.write(syslinux_conf) + + @classmethod + def do_configure_grubefi(cls, part, creator, cr_workdir): + """ + Create loader-specific (grub-efi) config + """ + configfile = creator.ks.bootloader.configfile + if configfile: + grubefi_conf = get_custom_config(configfile) + if grubefi_conf: + logger.debug("Using custom configuration file %s for grub.cfg", + configfile) + else: + raise WicError("configfile is specified " + "but failed to get it from %s", configfile) + else: + splash = os.path.join(cr_workdir, "EFI/boot/splash.jpg") + if os.path.exists(splash): + splashline = "menu background splash.jpg" + else: + splashline = "" + + bootloader = creator.ks.bootloader + + grubefi_conf = "" + grubefi_conf += "serial --unit=0 --speed=115200 --word=8 " + grubefi_conf += "--parity=no --stop=1\n" + grubefi_conf += "default=boot\n" + grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10) + grubefi_conf += "\n" + grubefi_conf += "search --set=root --label %s " % part.label + grubefi_conf += "\n" + grubefi_conf += "menuentry 'boot'{\n" + + kernel = "/bzImage" + + grubefi_conf += "linux %s rootwait %s\n" \ + % (kernel, bootloader.append) + grubefi_conf += "initrd /initrd \n" + grubefi_conf += "}\n" + + if splashline: + grubefi_conf += "%s\n" % splashline + + logger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg", cr_workdir) + + with open("%s/EFI/BOOT/grub.cfg" % cr_workdir, "w") as cfg: + cfg.write(grubefi_conf) + + @staticmethod + def _build_initramfs_path(rootfs_dir, cr_workdir): + """ + Create path for initramfs image + """ + + initrd = get_bitbake_var("INITRD_LIVE") or get_bitbake_var("INITRD") + if not initrd: + initrd_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not initrd_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting.") + + image_name = get_bitbake_var("IMAGE_BASENAME") + if not image_name: + raise WicError("Couldn't find IMAGE_BASENAME, exiting.") + + image_type = get_bitbake_var("INITRAMFS_FSTYPES") + if not image_type: + raise WicError("Couldn't find INITRAMFS_FSTYPES, exiting.") + + target_arch = get_bitbake_var("TRANSLATED_TARGET_ARCH") + if not target_arch: + raise WicError("Couldn't find TRANSLATED_TARGET_ARCH, exiting.") + + initrd = glob.glob('%s/%s*%s.%s' % (initrd_dir, image_name, target_arch, image_type))[0] + + if not os.path.exists(initrd): + # Create initrd from rootfs directory + initrd = "%s/initrd.cpio.gz" % cr_workdir + initrd_dir = "%s/INITRD" % cr_workdir + shutil.copytree("%s" % rootfs_dir, \ + "%s" % initrd_dir, symlinks=True) + + if os.path.isfile("%s/init" % rootfs_dir): + shutil.copy2("%s/init" % rootfs_dir, "%s/init" % initrd_dir) + elif os.path.lexists("%s/init" % rootfs_dir): + os.symlink(os.readlink("%s/init" % rootfs_dir), \ + "%s/init" % initrd_dir) + elif os.path.isfile("%s/sbin/init" % rootfs_dir): + shutil.copy2("%s/sbin/init" % rootfs_dir, \ + "%s" % initrd_dir) + elif os.path.lexists("%s/sbin/init" % rootfs_dir): + os.symlink(os.readlink("%s/sbin/init" % rootfs_dir), \ + "%s/init" % initrd_dir) + else: + raise WicError("Couldn't find or build initrd, exiting.") + + exec_cmd("cd %s && find . | cpio -o -H newc -R +0:+0 >./initrd.cpio " \ + % initrd_dir, as_shell=True) + exec_cmd("gzip -f -9 -c %s/initrd.cpio > %s" \ + % (cr_workdir, initrd), as_shell=True) + shutil.rmtree(initrd_dir) + + return initrd + + @classmethod + def do_configure_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + native_sysroot): + """ + Called before do_prepare_partition(), creates loader-specific config + """ + isodir = "%s/ISO/" % cr_workdir + + if os.path.exists(cr_workdir): + shutil.rmtree(cr_workdir) + + install_cmd = "install -d %s " % isodir + exec_cmd(install_cmd) + + # Overwrite the name of the created image + logger.debug(source_params) + if 'image_name' in source_params and \ + source_params['image_name'].strip(): + creator.name = source_params['image_name'].strip() + logger.debug("The name of the image is: %s", creator.name) + + @classmethod + def do_prepare_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + In this case, prepare content for a bootable ISO image. + """ + + isodir = "%s/ISO" % cr_workdir + + if part.rootfs_dir is None: + if not 'ROOTFS_DIR' in rootfs_dir: + raise WicError("Couldn't find --rootfs-dir, exiting.") + rootfs_dir = rootfs_dir['ROOTFS_DIR'] + else: + if part.rootfs_dir in rootfs_dir: + rootfs_dir = rootfs_dir[part.rootfs_dir] + elif part.rootfs_dir: + rootfs_dir = part.rootfs_dir + else: + raise WicError("Couldn't find --rootfs-dir=%s connection " + "or it is not a valid path, exiting." % + part.rootfs_dir) + + if not os.path.isdir(rootfs_dir): + rootfs_dir = get_bitbake_var("IMAGE_ROOTFS") + if not os.path.isdir(rootfs_dir): + raise WicError("Couldn't find IMAGE_ROOTFS, exiting.") + + part.rootfs_dir = rootfs_dir + + # Prepare rootfs.img + deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + img_iso_dir = get_bitbake_var("ISODIR") + rootfs_img = "%s/rootfs.img" % img_iso_dir + if not os.path.isfile(rootfs_img): + # check if rootfs.img is in deploydir + deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + image_name = get_bitbake_var("IMAGE_LINK_NAME") + rootfs_img = "%s/%s.%s" \ + % (deploy_dir, image_name, part.fstype) + + if not os.path.isfile(rootfs_img): + # create image file with type specified by --fstype + # which contains rootfs + du_cmd = "du -bks %s" % rootfs_dir + out = exec_cmd(du_cmd) + part.size = int(out.split()[0]) + part.extra_space = 0 + part.overhead_factor = 1.2 + part.prepare_rootfs(cr_workdir, oe_builddir, rootfs_dir, \ + native_sysroot) + rootfs_img = part.source_file + + install_cmd = "install -m 0644 %s %s/rootfs.img" \ + % (rootfs_img, isodir) + exec_cmd(install_cmd) + + # Remove the temporary file created by part.prepare_rootfs() + if os.path.isfile(part.source_file): + os.remove(part.source_file) + + # Support using a different initrd other than default + if source_params.get('initrd'): + initrd = source_params['initrd'] + if not deploy_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + cp_cmd = "cp %s/%s %s" % (deploy_dir, initrd, cr_workdir) + exec_cmd(cp_cmd) + else: + # Prepare initial ramdisk + initrd = "%s/initrd" % deploy_dir + if not os.path.isfile(initrd): + initrd = "%s/initrd" % img_iso_dir + if not os.path.isfile(initrd): + initrd = cls._build_initramfs_path(rootfs_dir, cr_workdir) + + install_cmd = "install -m 0644 %s %s/initrd" % (initrd, isodir) + exec_cmd(install_cmd) + + # Remove the temporary file created by _build_initramfs_path function + if os.path.isfile("%s/initrd.cpio.gz" % cr_workdir): + os.remove("%s/initrd.cpio.gz" % cr_workdir) + + # Install bzImage + install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \ + (kernel_dir, isodir) + exec_cmd(install_cmd) + + #Create bootloader for efi boot + try: + if source_params['loader'] == 'grub-efi': + # Builds grub.cfg if ISODIR didn't exist or + # didn't contains grub.cfg + bootimg_dir = img_iso_dir + if not os.path.exists("%s/EFI/BOOT" % bootimg_dir): + bootimg_dir = "%s/bootimg" % cr_workdir + if os.path.exists(bootimg_dir): + shutil.rmtree(bootimg_dir) + install_cmd = "install -d %s/EFI/BOOT" % bootimg_dir + exec_cmd(install_cmd) + + if not os.path.isfile("%s/EFI/BOOT/boot.cfg" % bootimg_dir): + cls.do_configure_grubefi(part, creator, bootimg_dir) + + # Builds bootx64.efi/bootia32.efi if ISODIR didn't exist or + # didn't contains it + target_arch = get_bitbake_var("TARGET_SYS") + if not target_arch: + raise WicError("Coludn't find target architecture") + + if re.match("x86_64", target_arch): + grub_target = 'x86_64-efi' + grub_image = "bootx64.efi" + elif re.match('i.86', target_arch): + grub_target = 'i386-efi' + grub_image = "bootia32.efi" + else: + raise WicError("grub-efi is incompatible with target %s" % + target_arch) + + if not os.path.isfile("%s/EFI/BOOT/%s" \ + % (bootimg_dir, grub_image)): + grub_path = get_bitbake_var("STAGING_LIBDIR", "wic-tools") + if not grub_path: + raise WicError("Couldn't find STAGING_LIBDIR, exiting.") + + grub_core = "%s/grub/%s" % (grub_path, grub_target) + if not os.path.exists(grub_core): + raise WicError("Please build grub-efi first") + + grub_cmd = "grub-mkimage -p '/EFI/BOOT' " + grub_cmd += "-d %s " % grub_core + grub_cmd += "-O %s -o %s/EFI/BOOT/%s " \ + % (grub_target, bootimg_dir, grub_image) + grub_cmd += "part_gpt part_msdos ntfs ntfscomp fat ext2 " + grub_cmd += "normal chain boot configfile linux multiboot " + grub_cmd += "search efi_gop efi_uga font gfxterm gfxmenu " + grub_cmd += "terminal minicmd test iorw loadenv echo help " + grub_cmd += "reboot serial terminfo iso9660 loopback tar " + grub_cmd += "memdisk ls search_fs_uuid udf btrfs xfs lvm " + grub_cmd += "reiserfs ata " + exec_native_cmd(grub_cmd, native_sysroot) + + else: + raise WicError("unrecognized bootimg-efi loader: %s" % + source_params['loader']) + except KeyError: + raise WicError("bootimg-efi requires a loader, none specified") + + if os.path.exists("%s/EFI/BOOT" % isodir): + shutil.rmtree("%s/EFI/BOOT" % isodir) + + shutil.copytree(bootimg_dir+"/EFI/BOOT", isodir+"/EFI/BOOT") + + # If exists, remove cr_workdir/bootimg temporary folder + if os.path.exists("%s/bootimg" % cr_workdir): + shutil.rmtree("%s/bootimg" % cr_workdir) + + # Create efi.img that contains bootloader files for EFI booting + # if ISODIR didn't exist or didn't contains it + if os.path.isfile("%s/efi.img" % img_iso_dir): + install_cmd = "install -m 0644 %s/efi.img %s/efi.img" % \ + (img_iso_dir, isodir) + exec_cmd(install_cmd) + else: + du_cmd = "du -bks %s/EFI" % isodir + out = exec_cmd(du_cmd) + blocks = int(out.split()[0]) + # Add some extra space for file system overhead + blocks += 100 + logger.debug("Added 100 extra blocks to %s to get to %d " + "total blocks", part.mountpoint, blocks) + + # dosfs image for EFI boot + bootimg = "%s/efi.img" % isodir + + dosfs_cmd = 'mkfs.vfat -n "EFIimg" -S 512 -C %s %d' \ + % (bootimg, blocks) + exec_native_cmd(dosfs_cmd, native_sysroot) + + mmd_cmd = "mmd -i %s ::/EFI" % bootimg + exec_native_cmd(mmd_cmd, native_sysroot) + + mcopy_cmd = "mcopy -i %s -s %s/EFI/* ::/EFI/" \ + % (bootimg, isodir) + exec_native_cmd(mcopy_cmd, native_sysroot) + + chmod_cmd = "chmod 644 %s" % bootimg + exec_cmd(chmod_cmd) + + # Prepare files for legacy boot + syslinux_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools") + if not syslinux_dir: + raise WicError("Couldn't find STAGING_DATADIR, exiting.") + + if os.path.exists("%s/isolinux" % isodir): + shutil.rmtree("%s/isolinux" % isodir) + + install_cmd = "install -d %s/isolinux" % isodir + exec_cmd(install_cmd) + + cls.do_configure_syslinux(creator, cr_workdir) + + install_cmd = "install -m 444 %s/syslinux/ldlinux.sys " % syslinux_dir + install_cmd += "%s/isolinux/ldlinux.sys" % isodir + exec_cmd(install_cmd) + + install_cmd = "install -m 444 %s/syslinux/isohdpfx.bin " % syslinux_dir + install_cmd += "%s/isolinux/isohdpfx.bin" % isodir + exec_cmd(install_cmd) + + install_cmd = "install -m 644 %s/syslinux/isolinux.bin " % syslinux_dir + install_cmd += "%s/isolinux/isolinux.bin" % isodir + exec_cmd(install_cmd) + + install_cmd = "install -m 644 %s/syslinux/ldlinux.c32 " % syslinux_dir + install_cmd += "%s/isolinux/ldlinux.c32" % isodir + exec_cmd(install_cmd) + + #create ISO image + iso_img = "%s/tempiso_img.iso" % cr_workdir + iso_bootimg = "isolinux/isolinux.bin" + iso_bootcat = "isolinux/boot.cat" + efi_img = "efi.img" + + mkisofs_cmd = "mkisofs -V %s " % part.label + mkisofs_cmd += "-o %s -U " % iso_img + mkisofs_cmd += "-J -joliet-long -r -iso-level 2 -b %s " % iso_bootimg + mkisofs_cmd += "-c %s -no-emul-boot -boot-load-size 4 " % iso_bootcat + mkisofs_cmd += "-boot-info-table -eltorito-alt-boot " + mkisofs_cmd += "-eltorito-platform 0xEF -eltorito-boot %s " % efi_img + mkisofs_cmd += "-no-emul-boot %s " % isodir + + logger.debug("running command: %s", mkisofs_cmd) + exec_native_cmd(mkisofs_cmd, native_sysroot) + + shutil.rmtree(isodir) + + du_cmd = "du -Lbks %s" % iso_img + out = exec_cmd(du_cmd) + isoimg_size = int(out.split()[0]) + + part.size = isoimg_size + part.source_file = iso_img + + @classmethod + def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir, + bootimg_dir, kernel_dir, native_sysroot): + """ + Called after all partitions have been prepared and assembled into a + disk image. In this case, we insert/modify the MBR using isohybrid + utility for booting via BIOS from disk storage devices. + """ + + iso_img = "%s.p1" % disk.path + full_path = creator._full_path(workdir, disk_name, "direct") + full_path_iso = creator._full_path(workdir, disk_name, "iso") + + isohybrid_cmd = "isohybrid -u %s" % iso_img + logger.debug("running command: %s", isohybrid_cmd) + exec_native_cmd(isohybrid_cmd, native_sysroot) + + # Replace the image created by direct plugin with the one created by + # mkisofs command. This is necessary because the iso image created by + # mkisofs has a very specific MBR is system area of the ISO image, and + # direct plugin adds and configures an another MBR. + logger.debug("Replaceing the image created by direct plugin\n") + os.remove(disk.path) + shutil.copy2(iso_img, full_path_iso) + shutil.copy2(full_path_iso, full_path) diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py new file mode 100644 index 0000000000..e1c4f5e7db --- /dev/null +++ b/scripts/lib/wic/plugins/source/rawcopy.py @@ -0,0 +1,69 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +import logging +import os + +from wic import WicError +from wic.pluginbase import SourcePlugin +from wic.utils.misc import exec_cmd, get_bitbake_var +from wic.filemap import sparse_copy + +logger = logging.getLogger('wic') + +class RawCopyPlugin(SourcePlugin): + """ + Populate partition content from raw image file. + """ + + name = 'rawcopy' + + @classmethod + def do_prepare_partition(cls, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + """ + if not kernel_dir: + kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not kernel_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + + logger.debug('Kernel dir: %s', kernel_dir) + + if 'file' not in source_params: + raise WicError("No file specified") + + src = os.path.join(kernel_dir, source_params['file']) + dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno)) + + if 'skip' in source_params: + sparse_copy(src, dst, skip=int(source_params['skip'])) + else: + sparse_copy(src, dst) + + # get the size in the right units for kickstart (kB) + du_cmd = "du -Lbks %s" % dst + out = exec_cmd(du_cmd) + filesize = int(out.split()[0]) + + if filesize > part.size: + part.size = filesize + + part.source_file = dst diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py new file mode 100644 index 0000000000..f2e2ca8a2b --- /dev/null +++ b/scripts/lib/wic/plugins/source/rootfs.py @@ -0,0 +1,125 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2014, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION +# This implements the 'rootfs' source plugin class for 'wic' +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# Joao Henrique Ferreira de Freitas <joaohf (at] gmail.com> +# + +import logging +import os +import shutil + +from oe.path import copyhardlinktree + +from wic import WicError +from wic.pluginbase import SourcePlugin +from wic.utils.misc import get_bitbake_var, exec_cmd + +logger = logging.getLogger('wic') + +class RootfsPlugin(SourcePlugin): + """ + Populate partition content from a rootfs directory. + """ + + name = 'rootfs' + + @staticmethod + def __get_rootfs_dir(rootfs_dir): + if os.path.isdir(rootfs_dir): + return rootfs_dir + + image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) + if not os.path.isdir(image_rootfs_dir): + raise WicError("No valid artifact IMAGE_ROOTFS from image " + "named %s has been found at %s, exiting." % + (rootfs_dir, image_rootfs_dir)) + + return image_rootfs_dir + + @classmethod + def do_prepare_partition(cls, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + krootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + In this case, prepare content for legacy bios boot partition. + """ + if part.rootfs_dir is None: + if not 'ROOTFS_DIR' in krootfs_dir: + raise WicError("Couldn't find --rootfs-dir, exiting") + + rootfs_dir = krootfs_dir['ROOTFS_DIR'] + else: + if part.rootfs_dir in krootfs_dir: + rootfs_dir = krootfs_dir[part.rootfs_dir] + elif part.rootfs_dir: + rootfs_dir = part.rootfs_dir + else: + raise WicError("Couldn't find --rootfs-dir=%s connection or " + "it is not a valid path, exiting" % part.rootfs_dir) + + real_rootfs_dir = cls.__get_rootfs_dir(rootfs_dir) + + # Handle excluded paths. + if part.exclude_path is not None: + # We need a new rootfs directory we can delete files from. Copy to + # workdir. + new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs")) + + if os.path.lexists(new_rootfs): + shutil.rmtree(os.path.join(new_rootfs)) + + copyhardlinktree(real_rootfs_dir, new_rootfs) + + real_rootfs_dir = new_rootfs + + for orig_path in part.exclude_path: + path = orig_path + if os.path.isabs(path): + msger.error("Must be relative: --exclude-path=%s" % orig_path) + + full_path = os.path.realpath(os.path.join(new_rootfs, path)) + + # Disallow climbing outside of parent directory using '..', + # because doing so could be quite disastrous (we will delete the + # directory). + if not full_path.startswith(new_rootfs): + msger.error("'%s' points to a path outside the rootfs" % orig_path) + + if path.endswith(os.sep): + # Delete content only. + for entry in os.listdir(full_path): + full_entry = os.path.join(full_path, entry) + if os.path.isdir(full_entry) and not os.path.islink(full_entry): + shutil.rmtree(full_entry) + else: + os.remove(full_entry) + else: + # Delete whole directory. + shutil.rmtree(full_path) + + part.rootfs_dir = real_rootfs_dir + part.prepare_rootfs(cr_workdir, oe_builddir, + real_rootfs_dir, native_sysroot) diff --git a/scripts/lib/wic/utils/__init__.py b/scripts/lib/wic/utils/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/scripts/lib/wic/utils/__init__.py diff --git a/scripts/lib/wic/utils/misc.py b/scripts/lib/wic/utils/misc.py new file mode 100644 index 0000000000..46099840ca --- /dev/null +++ b/scripts/lib/wic/utils/misc.py @@ -0,0 +1,230 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2013, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION +# This module provides a place to collect various wic-related utils +# for the OpenEmbedded Image Tools. +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# +"""Miscellaneous functions.""" + +import logging +import os +import re + +from collections import defaultdict +from distutils import spawn + +from wic import WicError +from wic.utils import runner + +logger = logging.getLogger('wic') + +# executable -> recipe pairs for exec_native_cmd +NATIVE_RECIPES = {"bmaptool": "bmap-tools", + "grub-mkimage": "grub-efi", + "isohybrid": "syslinux", + "mcopy": "mtools", + "mkdosfs": "dosfstools", + "mkisofs": "cdrtools", + "mkfs.btrfs": "btrfs-tools", + "mkfs.ext2": "e2fsprogs", + "mkfs.ext3": "e2fsprogs", + "mkfs.ext4": "e2fsprogs", + "mkfs.vfat": "dosfstools", + "mksquashfs": "squashfs-tools", + "mkswap": "util-linux", + "mmd": "syslinux", + "parted": "parted", + "sfdisk": "util-linux", + "sgdisk": "gptfdisk", + "syslinux": "syslinux" + } + +def _exec_cmd(cmd_and_args, as_shell=False): + """ + Execute command, catching stderr, stdout + + Need to execute as_shell if the command uses wildcards + """ + logger.debug("_exec_cmd: %s", cmd_and_args) + args = cmd_and_args.split() + logger.debug(args) + + if as_shell: + ret, out = runner.runtool(cmd_and_args) + else: + ret, out = runner.runtool(args) + out = out.strip() + if ret != 0: + raise WicError("_exec_cmd: %s returned '%s' instead of 0\noutput: %s" % \ + (cmd_and_args, ret, out)) + + logger.debug("_exec_cmd: output for %s (rc = %d): %s", + cmd_and_args, ret, out) + + return ret, out + + +def exec_cmd(cmd_and_args, as_shell=False): + """ + Execute command, return output + """ + return _exec_cmd(cmd_and_args, as_shell)[1] + + +def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): + """ + Execute native command, catching stderr, stdout + + Need to execute as_shell if the command uses wildcards + + Always need to execute native commands as_shell + """ + # The reason -1 is used is because there may be "export" commands. + args = cmd_and_args.split(';')[-1].split() + logger.debug(args) + + if pseudo: + cmd_and_args = pseudo + cmd_and_args + + wtools_sysroot = get_bitbake_var("RECIPE_SYSROOT_NATIVE", "wic-tools") + + native_paths = \ + "%s/sbin:%s/usr/sbin:%s/usr/bin:%s/sbin:%s/usr/sbin:%s/usr/bin" % \ + (wtools_sysroot, wtools_sysroot, wtools_sysroot, + native_sysroot, native_sysroot, native_sysroot) + native_cmd_and_args = "export PATH=%s:$PATH;%s" % \ + (native_paths, cmd_and_args) + logger.debug("exec_native_cmd: %s", native_cmd_and_args) + + # If the command isn't in the native sysroot say we failed. + if spawn.find_executable(args[0], native_paths): + ret, out = _exec_cmd(native_cmd_and_args, True) + else: + ret = 127 + out = "can't find native executable %s in %s" % (args[0], native_paths) + + prog = args[0] + # shell command-not-found + if ret == 127 \ + or (pseudo and ret == 1 and out == "Can't find '%s' in $PATH." % prog): + msg = "A native program %s required to build the image "\ + "was not found (see details above).\n\n" % prog + recipe = NATIVE_RECIPES.get(prog) + if recipe: + msg += "Please make sure wic-tools have %s-native in its DEPENDS, bake it with 'bitbake wic-tools' "\ + "and try again.\n" % recipe + else: + msg += "Wic failed to find a recipe to build native %s. Please "\ + "file a bug against wic.\n" % prog + raise WicError(msg) + + return ret, out + +BOOTDD_EXTRA_SPACE = 16384 + +class BitbakeVars(defaultdict): + """ + Container for Bitbake variables. + """ + def __init__(self): + defaultdict.__init__(self, dict) + + # default_image and vars_dir attributes should be set from outside + self.default_image = None + self.vars_dir = None + + def _parse_line(self, line, image, matcher=re.compile(r"^(\w+)=(.+)")): + """ + Parse one line from bitbake -e output or from .env file. + Put result key-value pair into the storage. + """ + if "=" not in line: + return + match = matcher.match(line) + if not match: + return + key, val = match.groups() + self[image][key] = val.strip('"') + + def get_var(self, var, image=None, cache=True): + """ + Get bitbake variable from 'bitbake -e' output or from .env file. + This is a lazy method, i.e. it runs bitbake or parses file only when + only when variable is requested. It also caches results. + """ + if not image: + image = self.default_image + + if image not in self: + if image and self.vars_dir: + fname = os.path.join(self.vars_dir, image + '.env') + if os.path.isfile(fname): + # parse .env file + with open(fname) as varsfile: + for line in varsfile: + self._parse_line(line, image) + else: + print("Couldn't get bitbake variable from %s." % fname) + print("File %s doesn't exist." % fname) + return + else: + # Get bitbake -e output + cmd = "bitbake -e" + if image: + cmd += " %s" % image + + log_level = logger.getEffectiveLevel() + logger.setLevel(logging.INFO) + ret, lines = _exec_cmd(cmd) + logger.setLevel(log_level) + + if ret: + logger.error("Couldn't get '%s' output.", cmd) + logger.error("Bitbake failed with error:\n%s\n", lines) + return + + # Parse bitbake -e output + for line in lines.split('\n'): + self._parse_line(line, image) + + # Make first image a default set of variables + if cache: + images = [key for key in self if key] + if len(images) == 1: + self[None] = self[image] + + result = self[image].get(var) + if not cache: + self.pop(image, None) + + return result + +# Create BB_VARS singleton +BB_VARS = BitbakeVars() + +def get_bitbake_var(var, image=None, cache=True): + """ + Provide old get_bitbake_var API by wrapping + get_var method of BB_VARS singleton. + """ + return BB_VARS.get_var(var, image, cache) diff --git a/scripts/lib/wic/utils/runner.py b/scripts/lib/wic/utils/runner.py new file mode 100644 index 0000000000..4aa00fbe20 --- /dev/null +++ b/scripts/lib/wic/utils/runner.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python -tt +# +# Copyright (c) 2011 Intel, Inc. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; version 2 of the License +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston, MA 02111-1307, USA. +import subprocess + +from wic import WicError + +def runtool(cmdln_or_args): + """ wrapper for most of the subprocess calls + input: + cmdln_or_args: can be both args and cmdln str (shell=True) + return: + rc, output + """ + if isinstance(cmdln_or_args, list): + cmd = cmdln_or_args[0] + shell = False + else: + import shlex + cmd = shlex.split(cmdln_or_args)[0] + shell = True + + sout = subprocess.PIPE + serr = subprocess.STDOUT + + try: + process = subprocess.Popen(cmdln_or_args, stdout=sout, + stderr=serr, shell=shell) + sout, serr = process.communicate() + # combine stdout and stderr, filter None out and decode + out = ''.join([out.decode('utf-8') for out in [sout, serr] if out]) + except OSError as err: + if err.errno == 2: + # [Errno 2] No such file or directory + raise WicError('Cannot run command: %s, lost dependency?' % cmd) + else: + raise # relay + + return process.returncode, out diff --git a/scripts/lnr b/scripts/lnr new file mode 100755 index 0000000000..5fed780eb2 --- /dev/null +++ b/scripts/lnr @@ -0,0 +1,21 @@ +#! /usr/bin/env python3 + +# Create a *relative* symlink, just like ln --relative does but without needing +# coreutils 8.16. + +import sys, os + +if len(sys.argv) != 3: + print("$ lnr TARGET LINK_NAME") + sys.exit(1) + +target = sys.argv[1] +linkname = sys.argv[2] + +if os.path.isabs(target): + if not os.path.isabs(linkname): + linkname = os.path.abspath(linkname) + start = os.path.dirname(linkname) + target = os.path.relpath(target, start) + +os.symlink(target, linkname) diff --git a/scripts/multilib_header_wrapper.h b/scripts/multilib_header_wrapper.h index 5a87540884..f516673b63 100644 --- a/scripts/multilib_header_wrapper.h +++ b/scripts/multilib_header_wrapper.h @@ -21,11 +21,23 @@ * */ -#include <bits/wordsize.h> -#ifdef __WORDSIZE +#if defined (__arm__) +#define __MHWORDSIZE 32 +#elif defined (__aarch64__) && defined ( __LP64__) +#define __MHWORDSIZE 64 +#elif defined (__aarch64__) +#define __MHWORDSIZE 32 +#else +#include <bits/wordsize.h> +#if defined (__WORDSIZE) +#define __MHWORDSIZE __WORDSIZE +#else +#error "__WORDSIZE is not defined" +#endif +#endif -#if __WORDSIZE == 32 +#if __MHWORDSIZE == 32 #ifdef _MIPS_SIM @@ -41,15 +53,9 @@ #include <ENTER_HEADER_FILENAME_HERE-32.h> #endif -#elif __WORDSIZE == 64 +#elif __MHWORDSIZE == 64 #include <ENTER_HEADER_FILENAME_HERE-64.h> #else #error "Unknown __WORDSIZE detected" #endif /* matches #if __WORDSIZE == 32 */ - -#else /* __WORDSIZE is not defined */ - -#error "__WORDSIZE is not defined" - -#endif diff --git a/scripts/oe-build-perf-report b/scripts/oe-build-perf-report new file mode 100755 index 0000000000..ced5ff2e12 --- /dev/null +++ b/scripts/oe-build-perf-report @@ -0,0 +1,531 @@ +#!/usr/bin/python3 +# +# Examine build performance test results +# +# Copyright (c) 2017, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +import argparse +import json +import logging +import os +import re +import sys +from collections import namedtuple, OrderedDict +from operator import attrgetter +from xml.etree import ElementTree as ET + +# Import oe libs +scripts_path = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(scripts_path, 'lib')) +import scriptpath +from build_perf import print_table +from build_perf.report import (metadata_xml_to_json, results_xml_to_json, + aggregate_data, aggregate_metadata, measurement_stats) +from build_perf import html + +scriptpath.add_oe_lib_path() + +from oeqa.utils.git import GitRepo + + +# Setup logging +logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") +log = logging.getLogger('oe-build-perf-report') + + +# Container class for tester revisions +TestedRev = namedtuple('TestedRev', 'commit commit_number tags') + + +def get_test_runs(repo, tag_name, **kwargs): + """Get a sorted list of test runs, matching given pattern""" + # First, get field names from the tag name pattern + field_names = [m.group(1) for m in re.finditer(r'{(\w+)}', tag_name)] + undef_fields = [f for f in field_names if f not in kwargs.keys()] + + # Fields for formatting tag name pattern + str_fields = dict([(f, '*') for f in field_names]) + str_fields.update(kwargs) + + # Get a list of all matching tags + tag_pattern = tag_name.format(**str_fields) + tags = repo.run_cmd(['tag', '-l', tag_pattern]).splitlines() + log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern) + + # Parse undefined fields from tag names + str_fields = dict([(f, r'(?P<{}>[\w\-.]+)'.format(f)) for f in field_names]) + str_fields['commit'] = '(?P<commit>[0-9a-f]{7,40})' + str_fields['commit_number'] = '(?P<commit_number>[0-9]{1,7})' + str_fields['tag_number'] = '(?P<tag_number>[0-9]{1,5})' + str_fields.update(kwargs) + tag_re = re.compile(tag_name.format(**str_fields)) + + # Parse fields from tags + revs = [] + for tag in tags: + m = tag_re.match(tag) + groups = m.groupdict() + revs.append([groups[f] for f in undef_fields] + [tag]) + + # Return field names and a sorted list of revs + return undef_fields, sorted(revs) + +def list_test_revs(repo, tag_name, **kwargs): + """Get list of all tested revisions""" + fields, revs = get_test_runs(repo, tag_name, **kwargs) + ignore_fields = ['tag_number'] + print_fields = [i for i, f in enumerate(fields) if f not in ignore_fields] + + # Sort revs + rows = [[fields[i].upper() for i in print_fields] + ['TEST RUNS']] + prev = [''] * len(revs) + for rev in revs: + # Only use fields that we want to print + rev = [rev[i] for i in print_fields] + + if rev != prev: + new_row = [''] * len(print_fields) + [1] + for i in print_fields: + if rev[i] != prev[i]: + break + new_row[i:-1] = rev[i:] + rows.append(new_row) + else: + rows[-1][-1] += 1 + prev = rev + + print_table(rows) + +def get_test_revs(repo, tag_name, **kwargs): + """Get list of all tested revisions""" + fields, runs = get_test_runs(repo, tag_name, **kwargs) + + revs = {} + commit_i = fields.index('commit') + commit_num_i = fields.index('commit_number') + for run in runs: + commit = run[commit_i] + commit_num = run[commit_num_i] + tag = run[-1] + if not commit in revs: + revs[commit] = TestedRev(commit, commit_num, [tag]) + else: + assert commit_num == revs[commit].commit_number, "Commit numbers do not match" + revs[commit].tags.append(tag) + + # Return in sorted table + revs = sorted(revs.values(), key=attrgetter('commit_number')) + log.debug("Found %d tested revisions:\n %s", len(revs), + "\n ".join(['{} ({})'.format(rev.commit_number, rev.commit) for rev in revs])) + return revs + +def rev_find(revs, attr, val): + """Search from a list of TestedRev""" + for i, rev in enumerate(revs): + if getattr(rev, attr) == val: + return i + raise ValueError("Unable to find '{}' value '{}'".format(attr, val)) + +def is_xml_format(repo, commit): + """Check if the commit contains xml (or json) data""" + if repo.rev_parse(commit + ':results.xml'): + log.debug("Detected report in xml format in %s", commit) + return True + else: + log.debug("No xml report in %s, assuming json formatted results", commit) + return False + +def read_results(repo, tags, xml=True): + """Read result files from repo""" + + def parse_xml_stream(data): + """Parse multiple concatenated XML objects""" + objs = [] + xml_d = "" + for line in data.splitlines(): + if xml_d and line.startswith('<?xml version='): + objs.append(ET.fromstring(xml_d)) + xml_d = line + else: + xml_d += line + objs.append(ET.fromstring(xml_d)) + return objs + + def parse_json_stream(data): + """Parse multiple concatenated JSON objects""" + objs = [] + json_d = "" + for line in data.splitlines(): + if line == '}{': + json_d += '}' + objs.append(json.loads(json_d, object_pairs_hook=OrderedDict)) + json_d = '{' + else: + json_d += line + objs.append(json.loads(json_d, object_pairs_hook=OrderedDict)) + return objs + + num_revs = len(tags) + + # Optimize by reading all data with one git command + log.debug("Loading raw result data from %d tags, %s...", num_revs, tags[0]) + if xml: + git_objs = [tag + ':metadata.xml' for tag in tags] + [tag + ':results.xml' for tag in tags] + data = parse_xml_stream(repo.run_cmd(['show'] + git_objs + ['--'])) + return ([metadata_xml_to_json(e) for e in data[0:num_revs]], + [results_xml_to_json(e) for e in data[num_revs:]]) + else: + git_objs = [tag + ':metadata.json' for tag in tags] + [tag + ':results.json' for tag in tags] + data = parse_json_stream(repo.run_cmd(['show'] + git_objs + ['--'])) + return data[0:num_revs], data[num_revs:] + + +def get_data_item(data, key): + """Nested getitem lookup""" + for k in key.split('.'): + data = data[k] + return data + + +def metadata_diff(metadata_l, metadata_r): + """Prepare a metadata diff for printing""" + keys = [('Hostname', 'hostname', 'hostname'), + ('Branch', 'branch', 'layers.meta.branch'), + ('Commit number', 'commit_num', 'layers.meta.commit_count'), + ('Commit', 'commit', 'layers.meta.commit'), + ('Number of test runs', 'testrun_count', 'testrun_count') + ] + + def _metadata_diff(key): + """Diff metadata from two test reports""" + try: + val1 = get_data_item(metadata_l, key) + except KeyError: + val1 = '(N/A)' + try: + val2 = get_data_item(metadata_r, key) + except KeyError: + val2 = '(N/A)' + return val1, val2 + + metadata = OrderedDict() + for title, key, key_json in keys: + value_l, value_r = _metadata_diff(key_json) + metadata[key] = {'title': title, + 'value_old': value_l, + 'value': value_r} + return metadata + + +def print_diff_report(metadata_l, data_l, metadata_r, data_r): + """Print differences between two data sets""" + + # First, print general metadata + print("\nTEST METADATA:\n==============") + meta_diff = metadata_diff(metadata_l, metadata_r) + rows = [] + row_fmt = ['{:{wid}} ', '{:<{wid}} ', '{:<{wid}}'] + rows = [['', 'CURRENT COMMIT', 'COMPARING WITH']] + for key, val in meta_diff.items(): + # Shorten commit hashes + if key == 'commit': + rows.append([val['title'] + ':', val['value'][:20], val['value_old'][:20]]) + else: + rows.append([val['title'] + ':', val['value'], val['value_old']]) + print_table(rows, row_fmt) + + + # Print test results + print("\nTEST RESULTS:\n=============") + + tests = list(data_l['tests'].keys()) + # Append tests that are only present in 'right' set + tests += [t for t in list(data_r['tests'].keys()) if t not in tests] + + # Prepare data to be printed + rows = [] + row_fmt = ['{:8}', '{:{wid}}', '{:{wid}}', ' {:>{wid}}', ' {:{wid}} ', '{:{wid}}', + ' {:>{wid}}', ' {:>{wid}}'] + num_cols = len(row_fmt) + for test in tests: + test_l = data_l['tests'][test] if test in data_l['tests'] else None + test_r = data_r['tests'][test] if test in data_r['tests'] else None + pref = ' ' + if test_l is None: + pref = '+' + elif test_r is None: + pref = '-' + descr = test_l['description'] if test_l else test_r['description'] + heading = "{} {}: {}".format(pref, test, descr) + + rows.append([heading]) + + # Generate the list of measurements + meas_l = test_l['measurements'] if test_l else {} + meas_r = test_r['measurements'] if test_r else {} + measurements = list(meas_l.keys()) + measurements += [m for m in list(meas_r.keys()) if m not in measurements] + + for meas in measurements: + m_pref = ' ' + if meas in meas_l: + stats_l = measurement_stats(meas_l[meas], 'l.') + else: + stats_l = measurement_stats(None, 'l.') + m_pref = '+' + if meas in meas_r: + stats_r = measurement_stats(meas_r[meas], 'r.') + else: + stats_r = measurement_stats(None, 'r.') + m_pref = '-' + stats = stats_l.copy() + stats.update(stats_r) + + absdiff = stats['val_cls'](stats['r.mean'] - stats['l.mean']) + reldiff = "{:+.1f} %".format(absdiff * 100 / stats['l.mean']) + if stats['r.mean'] > stats['l.mean']: + absdiff = '+' + str(absdiff) + else: + absdiff = str(absdiff) + rows.append(['', m_pref, stats['name'] + ' ' + stats['quantity'], + str(stats['l.mean']), '->', str(stats['r.mean']), + absdiff, reldiff]) + rows.append([''] * num_cols) + + print_table(rows, row_fmt) + + print() + + +def print_html_report(data, id_comp): + """Print report in html format""" + # Handle metadata + metadata = {'branch': {'title': 'Branch', 'value': 'master'}, + 'hostname': {'title': 'Hostname', 'value': 'foobar'}, + 'commit': {'title': 'Commit', 'value': '1234'} + } + metadata = metadata_diff(data[id_comp][0], data[-1][0]) + + + # Generate list of tests + tests = [] + for test in data[-1][1]['tests'].keys(): + test_r = data[-1][1]['tests'][test] + new_test = {'name': test_r['name'], + 'description': test_r['description'], + 'status': test_r['status'], + 'measurements': [], + 'err_type': test_r.get('err_type'), + } + # Limit length of err output shown + if 'message' in test_r: + lines = test_r['message'].splitlines() + if len(lines) > 20: + new_test['message'] = '...\n' + '\n'.join(lines[-20:]) + else: + new_test['message'] = test_r['message'] + + + # Generate the list of measurements + for meas in test_r['measurements'].keys(): + meas_r = test_r['measurements'][meas] + meas_type = 'time' if meas_r['type'] == 'sysres' else 'size' + new_meas = {'name': meas_r['name'], + 'legend': meas_r['legend'], + 'description': meas_r['name'] + ' ' + meas_type, + } + samples = [] + + # Run through all revisions in our data + for meta, test_data in data: + if (not test in test_data['tests'] or + not meas in test_data['tests'][test]['measurements']): + samples.append(measurement_stats(None)) + continue + test_i = test_data['tests'][test] + meas_i = test_i['measurements'][meas] + commit_num = get_data_item(meta, 'layers.meta.commit_count') + samples.append(measurement_stats(meas_i)) + samples[-1]['commit_num'] = commit_num + + absdiff = samples[-1]['val_cls'](samples[-1]['mean'] - samples[id_comp]['mean']) + new_meas['absdiff'] = absdiff + new_meas['absdiff_str'] = str(absdiff) if absdiff < 0 else '+' + str(absdiff) + new_meas['reldiff'] = "{:+.1f} %".format(absdiff * 100 / samples[id_comp]['mean']) + new_meas['samples'] = samples + new_meas['value'] = samples[-1] + new_meas['value_type'] = samples[-1]['val_cls'] + + new_test['measurements'].append(new_meas) + tests.append(new_test) + + # Chart options + chart_opts = {'haxis': {'min': get_data_item(data[0][0], 'layers.meta.commit_count'), + 'max': get_data_item(data[0][0], 'layers.meta.commit_count')} + } + + print(html.template.render(metadata=metadata, test_data=tests, chart_opts=chart_opts)) + + +def auto_args(repo, args): + """Guess arguments, if not defined by the user""" + # Get the latest commit in the repo + log.debug("Guessing arguments from the latest commit") + msg = repo.run_cmd(['log', '-1', '--branches', '--remotes', '--format=%b']) + for line in msg.splitlines(): + split = line.split(':', 1) + if len(split) != 2: + continue + + key = split[0] + val = split[1].strip() + if key == 'hostname': + log.debug("Using hostname %s", val) + args.hostname = val + elif key == 'branch': + log.debug("Using branch %s", val) + args.branch = val + + +def parse_args(argv): + """Parse command line arguments""" + description = """ +Examine build performance test results from a Git repository""" + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + description=description) + + parser.add_argument('--debug', '-d', action='store_true', + help="Verbose logging") + parser.add_argument('--repo', '-r', required=True, + help="Results repository (local git clone)") + parser.add_argument('--list', '-l', action='store_true', + help="List available test runs") + parser.add_argument('--html', action='store_true', + help="Generate report in html format") + group = parser.add_argument_group('Tag and revision') + group.add_argument('--tag-name', '-t', + default='{hostname}/{branch}/{machine}/{commit_number}-g{commit}/{tag_number}', + help="Tag name (pattern) for finding results") + group.add_argument('--hostname', '-H') + group.add_argument('--branch', '-B', default='master') + group.add_argument('--machine', default='qemux86') + group.add_argument('--history-length', default=25, type=int, + help="Number of tested revisions to plot in html report") + group.add_argument('--commit', + help="Revision to search for") + group.add_argument('--commit-number', + help="Revision number to search for, redundant if " + "--commit is specified") + group.add_argument('--commit2', + help="Revision to compare with") + group.add_argument('--commit-number2', + help="Revision number to compare with, redundant if " + "--commit2 is specified") + + return parser.parse_args(argv) + + +def main(argv=None): + """Script entry point""" + args = parse_args(argv) + if args.debug: + log.setLevel(logging.DEBUG) + + repo = GitRepo(args.repo) + + if args.list: + list_test_revs(repo, args.tag_name) + return 0 + + # Determine hostname which to use + if not args.hostname: + auto_args(repo, args) + + revs = get_test_revs(repo, args.tag_name, hostname=args.hostname, + branch=args.branch, machine=args.machine) + if len(revs) < 2: + log.error("%d tester revisions found, unable to generate report", + len(revs)) + return 1 + + # Pick revisions + if args.commit: + if args.commit_number: + log.warning("Ignoring --commit-number as --commit was specified") + index1 = rev_find(revs, 'commit', args.commit) + elif args.commit_number: + index1 = rev_find(revs, 'commit_number', args.commit_number) + else: + index1 = len(revs) - 1 + + if args.commit2: + if args.commit_number2: + log.warning("Ignoring --commit-number2 as --commit2 was specified") + index2 = rev_find(revs, 'commit', args.commit2) + elif args.commit_number2: + index2 = rev_find(revs, 'commit_number', args.commit_number2) + else: + if index1 > 0: + index2 = index1 - 1 + else: + log.error("Unable to determine the other commit, use " + "--commit2 or --commit-number2 to specify it") + return 1 + + index_l = min(index1, index2) + index_r = max(index1, index2) + + rev_l = revs[index_l] + rev_r = revs[index_r] + log.debug("Using 'left' revision %s (%s), %s test runs:\n %s", + rev_l.commit_number, rev_l.commit, len(rev_l.tags), + '\n '.join(rev_l.tags)) + log.debug("Using 'right' revision %s (%s), %s test runs:\n %s", + rev_r.commit_number, rev_r.commit, len(rev_r.tags), + '\n '.join(rev_r.tags)) + + # Check report format used in the repo (assume all reports in the same fmt) + xml = is_xml_format(repo, revs[index_r].tags[-1]) + + if args.html: + index_0 = max(0, index_r - args.history_length) + rev_range = range(index_0, index_r + 1) + else: + # We do not need range of commits for text report (no graphs) + index_0 = index_l + rev_range = (index_l, index_r) + + # Read raw data + log.debug("Reading %d revisions, starting from %s (%s)", + len(rev_range), revs[index_0].commit_number, revs[index_0].commit) + raw_data = [read_results(repo, revs[i].tags, xml) for i in rev_range] + + data = [] + for raw_m, raw_d in raw_data: + data.append((aggregate_metadata(raw_m), aggregate_data(raw_d))) + + # Re-map list indexes to the new table starting from index 0 + index_r = index_r - index_0 + index_l = index_l - index_0 + + # Print report + if not args.html: + print_diff_report(data[index_l][0], data[index_l][1], + data[index_r][0], data[index_r][1]) + else: + print_html_report(data, index_l) + + return 0 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/oe-build-perf-test b/scripts/oe-build-perf-test new file mode 100755 index 0000000000..669470fa97 --- /dev/null +++ b/scripts/oe-build-perf-test @@ -0,0 +1,223 @@ +#!/usr/bin/python3 +# +# Build performance test script +# +# Copyright (c) 2016, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +"""Build performance test script""" +import argparse +import errno +import fcntl +import json +import logging +import os +import re +import shutil +import sys +from datetime import datetime + +sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib') +import scriptpath +scriptpath.add_oe_lib_path() +scriptpath.add_bitbake_lib_path() +import oeqa.buildperf +from oeqa.buildperf import (BuildPerfTestLoader, BuildPerfTestResult, + BuildPerfTestRunner, KernelDropCaches) +from oeqa.utils.commands import runCmd +from oeqa.utils.metadata import metadata_from_bb, write_metadata_file + + +# Set-up logging +LOG_FORMAT = '[%(asctime)s] %(levelname)s: %(message)s' +logging.basicConfig(level=logging.INFO, format=LOG_FORMAT, + datefmt='%Y-%m-%d %H:%M:%S') +log = logging.getLogger() + + +def acquire_lock(lock_f): + """Acquire flock on file""" + log.debug("Acquiring lock %s", os.path.abspath(lock_f.name)) + try: + fcntl.flock(lock_f, fcntl.LOCK_EX | fcntl.LOCK_NB) + except IOError as err: + if err.errno == errno.EAGAIN: + return False + raise + log.debug("Lock acquired") + return True + + +def pre_run_sanity_check(): + """Sanity check of build environment""" + build_dir = os.environ.get("BUILDDIR") + if not build_dir: + log.error("BUILDDIR not set. Please run the build environmnent setup " + "script.") + return False + if os.getcwd() != build_dir: + log.error("Please run this script under BUILDDIR (%s)", build_dir) + return False + + ret = runCmd('which bitbake', ignore_status=True) + if ret.status: + log.error("bitbake command not found") + return False + return True + +def setup_file_logging(log_file): + """Setup loggin to file""" + log_dir = os.path.dirname(log_file) + if not os.path.exists(log_dir): + os.makedirs(log_dir) + formatter = logging.Formatter(LOG_FORMAT) + handler = logging.FileHandler(log_file) + handler.setFormatter(formatter) + log.addHandler(handler) + + +def archive_build_conf(out_dir): + """Archive build/conf to test results""" + src_dir = os.path.join(os.environ['BUILDDIR'], 'conf') + tgt_dir = os.path.join(out_dir, 'build', 'conf') + os.makedirs(os.path.dirname(tgt_dir)) + shutil.copytree(src_dir, tgt_dir) + + +def update_globalres_file(result_obj, filename, metadata): + """Write results to globalres csv file""" + # Map test names to time and size columns in globalres + # The tuples represent index and length of times and sizes + # respectively + gr_map = {'test1': ((0, 1), (8, 1)), + 'test12': ((1, 1), (None, None)), + 'test13': ((2, 1), (9, 1)), + 'test2': ((3, 1), (None, None)), + 'test3': ((4, 3), (None, None)), + 'test4': ((7, 1), (10, 2))} + + values = ['0'] * 12 + for status, test, _ in result_obj.all_results(): + if status in ['ERROR', 'SKIPPED']: + continue + (t_ind, t_len), (s_ind, s_len) = gr_map[test.name] + if t_ind is not None: + values[t_ind:t_ind + t_len] = test.times + if s_ind is not None: + values[s_ind:s_ind + s_len] = test.sizes + + log.debug("Writing globalres log to %s", filename) + rev_info = metadata['layers']['meta'] + with open(filename, 'a') as fobj: + fobj.write('{},{}:{},{},'.format(metadata['hostname'], + rev_info['branch'], + rev_info['commit'], + rev_info['commit'])) + fobj.write(','.join(values) + '\n') + + +def parse_args(argv): + """Parse command line arguments""" + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('-D', '--debug', action='store_true', + help='Enable debug level logging') + parser.add_argument('--globalres-file', + type=os.path.abspath, + help="Append results to 'globalres' csv file") + parser.add_argument('--lock-file', default='./oe-build-perf.lock', + metavar='FILENAME', type=os.path.abspath, + help="Lock file to use") + parser.add_argument('-o', '--out-dir', default='results-{date}', + type=os.path.abspath, + help="Output directory for test results") + parser.add_argument('-x', '--xml', action='store_true', + help='Enable JUnit xml output') + parser.add_argument('--log-file', + default='{out_dir}/oe-build-perf-test.log', + help="Log file of this script") + parser.add_argument('--run-tests', nargs='+', metavar='TEST', + help="List of tests to run") + + return parser.parse_args(argv) + + +def main(argv=None): + """Script entry point""" + args = parse_args(argv) + + # Set-up log file + out_dir = args.out_dir.format(date=datetime.now().strftime('%Y%m%d%H%M%S')) + setup_file_logging(args.log_file.format(out_dir=out_dir)) + + if args.debug: + log.setLevel(logging.DEBUG) + + lock_f = open(args.lock_file, 'w') + if not acquire_lock(lock_f): + log.error("Another instance of this script is running, exiting...") + return 1 + + if not pre_run_sanity_check(): + return 1 + + # Check our capability to drop caches and ask pass if needed + KernelDropCaches.check() + + # Load build perf tests + loader = BuildPerfTestLoader() + if args.run_tests: + suite = loader.loadTestsFromNames(args.run_tests, oeqa.buildperf) + else: + suite = loader.loadTestsFromModule(oeqa.buildperf) + + # Save test metadata + metadata = metadata_from_bb() + log.info("Testing Git revision branch:commit %s:%s (%s)", + metadata['layers']['meta']['branch'], + metadata['layers']['meta']['commit'], + metadata['layers']['meta']['commit_count']) + if args.xml: + write_metadata_file(os.path.join(out_dir, 'metadata.xml'), metadata) + else: + with open(os.path.join(out_dir, 'metadata.json'), 'w') as fobj: + json.dump(metadata, fobj, indent=2) + archive_build_conf(out_dir) + + runner = BuildPerfTestRunner(out_dir, verbosity=2) + + # Suppress logger output to stderr so that the output from unittest + # is not mixed with occasional logger output + log.handlers[0].setLevel(logging.CRITICAL) + + # Run actual tests + result = runner.run(suite) + + # Restore logger output to stderr + log.handlers[0].setLevel(log.level) + + if args.xml: + result.write_results_xml() + else: + result.write_results_json() + result.write_buildstats_json() + if args.globalres_file: + update_globalres_file(result, args.globalres_file, metadata) + if result.wasSuccessful(): + return 0 + + return 2 + + +if __name__ == '__main__': + sys.exit(main()) + diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal index bba6f8fea3..c8905524ff 100755 --- a/scripts/oe-buildenv-internal +++ b/scripts/oe-buildenv-internal @@ -18,39 +18,57 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +if ! $(return >/dev/null 2>&1) ; then + echo 'oe-buildenv-internal: error: this script must be sourced' + echo '' + echo 'Usage: . $OEROOT/scripts/oe-buildenv-internal &&' + echo '' + echo 'OpenEmbedded oe-buildenv-internal - an internal script that is' + echo 'used in oe-init-build-env and oe-init-build-env-memres to' + echo 'initialize oe build environment' + echo '' + exit 2 +fi + # It is assumed OEROOT is already defined when this is called if [ -z "$OEROOT" ]; then echo >&2 "Error: OEROOT is not defined!" return 1 fi -if [ ! -z "$OECORE_SDK_VERSION" ]; then +if [ -z "$OE_SKIP_SDK_CHECK" ] && [ -n "$OECORE_SDK_VERSION" ]; then echo >&2 "Error: The OE SDK/ADT was detected as already being present in this shell environment. Please use a clean shell when sourcing this environment script." return 1 fi -# Make sure we're not using python v3.x. This check can't go into -# sanity.bbclass because bitbake's source code doesn't even pass -# parsing stage when used with python v3, so we catch it here so we -# can offer a meaningful error message. -py_v3_check=`/usr/bin/env python --version 2>&1 | grep "Python 3"` -if [ "$py_v3_check" != "" ]; then - echo >&2 "Bitbake is not compatible with python v3" - echo >&2 "Please set up python v2 as your default python interpreter" - return 1 +# Make sure we're not using python v3.x as 'python', we don't support it. +py_v2_check=$(/usr/bin/env python --version 2>&1 | grep "Python 3") +if [ -n "$py_v2_check" ]; then + echo >&2 "OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3." + echo >&2 "Please set up python v2 as your default 'python' interpreter." + return 1 +fi +unset py_v2_check + +py_v27_check=$(python -c 'import sys; print sys.version_info >= (2,7,3)') +if [ "$py_v27_check" != "True" ]; then + echo >&2 "OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3." + echo >&2 "Please upgrade your python v2." fi +unset py_v27_check -# Similarly, we now have code that doesn't parse correctly with older -# versions of Python, and rather than fixing that and being eternally -# vigilant for any other new feature use, just check the version here. -py_v26_check=`python -c 'import sys; print sys.version_info >= (2,7,3)'` -if [ "$py_v26_check" != "True" ]; then - echo >&2 "BitBake requires Python 2.7.3 or later" - return 1 +# We potentially have code that doesn't parse correctly with older versions +# of Python, and rather than fixing that and being eternally vigilant for +# any other new feature use, just check the version here. +py_v34_check=$(python3 -c 'import sys; print(sys.version_info >= (3,4,0))') +if [ "$py_v34_check" != "True" ]; then + echo >&2 "BitBake requires Python 3.4.0 or later as 'python3'" + return 1 fi +unset py_v34_check -if [ "x$BDIR" = "x" ]; then - if [ "x$1" = "x" ]; then +if [ -z "$BDIR" ]; then + if [ -z "$1" ]; then BDIR="build" else BDIR="$1" @@ -62,48 +80,58 @@ if [ "x$BDIR" = "x" ]; then # Remove any possible trailing slashes. This is used to work around # buggy readlink in Ubuntu 10.04 that doesn't ignore trailing slashes # and hence "readlink -f new_dir_to_be_created/" returns empty. - BDIR=`echo $BDIR | sed -re 's|/+$||'` + BDIR=$(echo $BDIR | sed -re 's|/+$||') - BDIR=`readlink -f "$BDIR"` + BDIR=$(readlink -f "$BDIR") if [ -z "$BDIR" ]; then - PARENTDIR=`dirname "$1"` + PARENTDIR=$(dirname "$1") echo >&2 "Error: the directory $PARENTDIR does not exist?" return 1 fi fi - if [ "x$2" != "x" ]; then + if [ -n "$2" ]; then BITBAKEDIR="$2" fi fi -if expr "$BDIR" : '/.*' > /dev/null ; then +if [ "${BDIR#/}" != "$BDIR" ]; then BUILDDIR="$BDIR" else - BUILDDIR="`pwd`/$BDIR" + BUILDDIR="$(pwd)/$BDIR" fi unset BDIR -if [ "x$BITBAKEDIR" = "x" ]; then - BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/" +if [ -z "$BITBAKEDIR" ]; then + BITBAKEDIR="$OEROOT/bitbake$BBEXTRA" fi -BITBAKEDIR=`readlink -f "$BITBAKEDIR"` -BUILDDIR=`readlink -f "$BUILDDIR"` +BITBAKEDIR=$(readlink -f "$BITBAKEDIR") +BUILDDIR=$(readlink -f "$BUILDDIR") -if ! (test -d "$BITBAKEDIR"); then - echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Please ensure a copy of bitbake exists at this location" +if [ ! -d "$BITBAKEDIR" ]; then + echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Please ensure a copy of bitbake exists at this location or specify an alternative path on the command line" return 1 fi # Make sure our paths are at the beginning of $PATH -NEWPATHS="${OEROOT}/scripts:$BITBAKEDIR/bin:" -PATH=$NEWPATHS$(echo $PATH | sed -e "s|:$NEWPATHS|:|g" -e "s|^$NEWPATHS||") -unset BITBAKEDIR NEWPATHS +for newpath in "$BITBAKEDIR/bin" "$OEROOT/scripts"; do + # Remove any existences of $newpath from $PATH + PATH=$(echo $PATH | sed -re "s#(^|:)$newpath(:|$)#\2#g;s#^:##") + + # Add $newpath to $PATH + PATH="$newpath:$PATH" +done +unset BITBAKEDIR newpath # Used by the runqemu script export BUILDDIR export PATH -export BB_ENV_EXTRAWHITE="MACHINE DISTRO TCMODE TCLIBC HTTP_PROXY http_proxy \ + +BB_ENV_EXTRAWHITE_OE="MACHINE DISTRO TCMODE TCLIBC HTTP_PROXY http_proxy \ HTTPS_PROXY https_proxy FTP_PROXY ftp_proxy FTPS_PROXY ftps_proxy ALL_PROXY \ all_proxy NO_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY \ SDKMACHINE BB_NUMBER_THREADS BB_NO_NETWORK PARALLEL_MAKE GIT_PROXY_COMMAND \ -SOCKS5_PASSWD SOCKS5_USER SCREENDIR STAMPS_DIR" +SOCKS5_PASSWD SOCKS5_USER SCREENDIR STAMPS_DIR BBPATH_EXTRA BB_SETSCENE_ENFORCE" + +BB_ENV_EXTRAWHITE="$(echo $BB_ENV_EXTRAWHITE $BB_ENV_EXTRAWHITE_OE | tr ' ' '\n' | LC_ALL=C sort --unique | tr '\n' ' ')" + +export BB_ENV_EXTRAWHITE diff --git a/scripts/oe-check-sstate b/scripts/oe-check-sstate new file mode 100755 index 0000000000..d06efe436a --- /dev/null +++ b/scripts/oe-check-sstate @@ -0,0 +1,121 @@ +#!/usr/bin/env python3 + +# Query which tasks will be restored from sstate +# +# Copyright 2016 Intel Corporation +# Authored-by: Paul Eggleton <paul.eggleton@intel.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import os +import subprocess +import tempfile +import shutil +import re + +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptutils +import scriptpath +scriptpath.add_bitbake_lib_path() +import argparse_oe + + +def translate_virtualfns(tasks): + import bb.tinfoil + tinfoil = bb.tinfoil.Tinfoil() + try: + tinfoil.prepare(False) + + recipecaches = tinfoil.cooker.recipecaches + outtasks = [] + for task in tasks: + (mc, fn, taskname) = bb.runqueue.split_tid(task) + if taskname.endswith('_setscene'): + taskname = taskname[:-9] + outtasks.append('%s:%s' % (recipecaches[mc].pkg_fn[fn], taskname)) + finally: + tinfoil.shutdown() + return outtasks + + +def check(args): + tmpdir = tempfile.mkdtemp(prefix='oe-check-sstate-') + try: + env = os.environ.copy() + if not args.same_tmpdir: + env['BB_ENV_EXTRAWHITE'] = env.get('BB_ENV_EXTRAWHITE', '') + ' TMPDIR_forcevariable' + env['TMPDIR_forcevariable'] = tmpdir + + try: + output = subprocess.check_output( + 'bitbake -n %s' % ' '.join(args.target), + stderr=subprocess.STDOUT, + env=env, + shell=True) + + task_re = re.compile('NOTE: Running setscene task [0-9]+ of [0-9]+ \(([^)]+)\)') + tasks = [] + for line in output.decode('utf-8').splitlines(): + res = task_re.match(line) + if res: + tasks.append(res.group(1)) + outtasks = translate_virtualfns(tasks) + except subprocess.CalledProcessError as e: + print('ERROR: bitbake failed:\n%s' % e.output.decode('utf-8')) + return e.returncode + finally: + shutil.rmtree(tmpdir) + + if args.log: + with open(args.log, 'wb') as f: + f.write(output) + + if args.outfile: + with open(args.outfile, 'w') as f: + for task in outtasks: + f.write('%s\n' % task) + else: + for task in outtasks: + print(task) + + return 0 + + +def main(): + parser = argparse_oe.ArgumentParser(description='OpenEmbedded sstate check tool. Does a dry-run to check restoring the specified targets from shared state, and lists the tasks that would be restored. Set BB_SETSCENE_ENFORCE=1 in the environment if you wish to ensure real tasks are disallowed.') + + parser.add_argument('target', nargs='+', help='Target to check') + parser.add_argument('-o', '--outfile', help='Write list to a file instead of stdout') + parser.add_argument('-l', '--log', help='Write full log to a file') + parser.add_argument('-s', '--same-tmpdir', action='store_true', help='Use same TMPDIR for check (list will then be dependent on what tasks have executed previously)') + + parser.set_defaults(func=check) + + args = parser.parse_args() + + ret = args.func(args) + return ret + + +if __name__ == "__main__": + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc() + sys.exit(ret) diff --git a/scripts/oe-find-native-sysroot b/scripts/oe-find-native-sysroot index 81d62b8882..235a67c95c 100755 --- a/scripts/oe-find-native-sysroot +++ b/scripts/oe-find-native-sysroot @@ -2,14 +2,14 @@ # # Find a native sysroot to use - either from an in-tree OE build or # from a toolchain installation. It then ensures the variable -# $OECORE_NATIVE_SYSROOT is set to the sysroot's base directory, and sets +# $OECORE_NATIVE_SYSROOT is set to the sysroot's base directory, and sets # $PSEUDO to the path of the pseudo binary. # # This script is intended to be run within other scripts by source'ing # it, e.g: # # SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot` -# . $SYSROOT_SETUP_SCRIPT +# . $SYSROOT_SETUP_SCRIPT <recipe> # # This script will terminate execution of your calling program unless # you set a variable $SKIP_STRICT_SYSROOT_CHECK to a non-empty string @@ -30,6 +30,38 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +if [ "$1" = '--help' -o "$1" = '-h' -o $# -ne 1 ] ; then + echo 'Usage: oe-find-native-sysroot <recipe> [-h|--help]' + echo '' + echo 'OpenEmbedded find-native-sysroot - helper script to set' + echo 'environment variables OECORE_NATIVE_SYSROOT and PSEUDO' + echo 'to the path of the native sysroot directory and pseudo' + echo 'executable binary' + echo '' + echo 'options:' + echo ' recipe its STAGING_DIR_NATIVE is used as native sysroot' + echo ' -h, --help show this help message and exit' + echo '' + exit 2 +fi + +# Global vars +BITBAKE_E="" +set_oe_native_sysroot(){ + echo "Running bitbake -e $1" + BITBAKE_E="`bitbake -e $1`" + OECORE_NATIVE_SYSROOT=`echo "$BITBAKE_E" | grep ^STAGING_DIR_NATIVE | cut -d '"' -f2` + + if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then + # This indicates that there was an error running bitbake -e that + # the user needs to be informed of + echo "There was an error running bitbake to determine STAGING_DIR_NATIVE" + echo "Here is the output from bitbake -e $1" + echo $BITBAKE_E + exit 1 + fi +} + if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then BITBAKE=`which bitbake 2> /dev/null` if [ "x$BITBAKE" != "x" ]; then @@ -40,10 +72,10 @@ if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then exit 1 fi touch conf/sanity.conf - OECORE_NATIVE_SYSROOT=`bitbake -e | grep ^STAGING_DIR_NATIVE | cut -d '"' -f2` + set_oe_native_sysroot $1 rm -f conf/sanity.conf else - OECORE_NATIVE_SYSROOT=`bitbake -e | grep ^STAGING_DIR_NATIVE | cut -d '"' -f2` + set_oe_native_sysroot $1 fi else echo "Error: Unable to locate bitbake command." @@ -55,21 +87,15 @@ if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then fi fi -if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then - # This indicates that there was an error running bitbake -e that - # the user needs to be informed of - echo "There was an error running bitbake to determine STAGING_DIR_NATIVE" - echo "Here is the output from bitbake -e" - bitbake -e - exit 1 -fi - -# Set up pseudo command -if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/pseudo" ]; then - echo "Error: Unable to find pseudo binary in $OECORE_NATIVE_SYSROOT/usr/bin/" +if [ ! -e "$OECORE_NATIVE_SYSROOT/" ]; then + echo "Error: $OECORE_NATIVE_SYSROOT doesn't exist." if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then - echo "Have you run 'bitbake meta-ide-support'?" + if [[ $1 =~ .*native.* ]]; then + echo "Have you run 'bitbake $1 -caddto_recipe_sysroot'?" + else + echo "Have you run 'bitbake $1 '?" + fi else echo "This shouldn't happen - something is wrong with your toolchain installation" fi @@ -78,4 +104,12 @@ if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/pseudo" ]; then exit 1 fi fi -PSEUDO="$OECORE_NATIVE_SYSROOT/usr/bin/pseudo" + +# Set up pseudo command +pseudo="$OECORE_NATIVE_SYSROOT/usr/bin/pseudo" +if [ -e "$pseudo" ]; then + echo "PSEUDO=$pseudo" + PSEUDO="$pseudo" +else + echo "PSEUDO $pseudo is not found." +fi diff --git a/scripts/oe-git-archive b/scripts/oe-git-archive new file mode 100755 index 0000000000..ab19cb9aa3 --- /dev/null +++ b/scripts/oe-git-archive @@ -0,0 +1,271 @@ +#!/usr/bin/python3 +# +# Helper script for committing data to git and pushing upstream +# +# Copyright (c) 2017, Intel Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +import argparse +import glob +import json +import logging +import math +import os +import re +import sys +from collections import namedtuple, OrderedDict +from datetime import datetime, timedelta, tzinfo +from operator import attrgetter + +# Import oe and bitbake libs +scripts_path = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(scripts_path, 'lib')) +import scriptpath +scriptpath.add_bitbake_lib_path() +scriptpath.add_oe_lib_path() + +from oeqa.utils.git import GitRepo, GitError +from oeqa.utils.metadata import metadata_from_bb + + +# Setup logging +logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") +log = logging.getLogger() + + +class ArchiveError(Exception): + """Internal error handling of this script""" + + +def format_str(string, fields): + """Format string using the given fields (dict)""" + try: + return string.format(**fields) + except KeyError as err: + raise ArchiveError("Unable to expand string '{}': unknown field {} " + "(valid fields are: {})".format( + string, err, ', '.join(sorted(fields.keys())))) + + +def init_git_repo(path, no_create, bare): + """Initialize local Git repository""" + path = os.path.abspath(path) + if os.path.isfile(path): + raise ArchiveError("Invalid Git repo at {}: path exists but is not a " + "directory".format(path)) + if not os.path.isdir(path) or not os.listdir(path): + if no_create: + raise ArchiveError("No git repo at {}, refusing to create " + "one".format(path)) + if not os.path.isdir(path): + try: + os.mkdir(path) + except (FileNotFoundError, PermissionError) as err: + raise ArchiveError("Failed to mkdir {}: {}".format(path, err)) + if not os.listdir(path): + log.info("Initializing a new Git repo at %s", path) + repo = GitRepo.init(path, bare) + try: + repo = GitRepo(path, is_topdir=True) + except GitError: + raise ArchiveError("Non-empty directory that is not a Git repository " + "at {}\nPlease specify an existing Git repository, " + "an empty directory or a non-existing directory " + "path.".format(path)) + return repo + + +def git_commit_data(repo, data_dir, branch, message, exclude, notes): + """Commit data into a Git repository""" + log.info("Committing data into to branch %s", branch) + tmp_index = os.path.join(repo.git_dir, 'index.oe-git-archive') + try: + # Create new tree object from the data + env_update = {'GIT_INDEX_FILE': tmp_index, + 'GIT_WORK_TREE': os.path.abspath(data_dir)} + repo.run_cmd('add .', env_update) + + # Remove files that are excluded + if exclude: + repo.run_cmd(['rm', '--cached'] + [f for f in exclude], env_update) + + tree = repo.run_cmd('write-tree', env_update) + + # Create new commit object from the tree + parent = repo.rev_parse(branch) + git_cmd = ['commit-tree', tree, '-m', message] + if parent: + git_cmd += ['-p', parent] + commit = repo.run_cmd(git_cmd, env_update) + + # Create git notes + for ref, filename in notes: + ref = ref.format(branch_name=branch) + repo.run_cmd(['notes', '--ref', ref, 'add', + '-F', os.path.abspath(filename), commit]) + + # Update branch head + git_cmd = ['update-ref', 'refs/heads/' + branch, commit] + if parent: + git_cmd.append(parent) + repo.run_cmd(git_cmd) + + # Update current HEAD, if we're on branch 'branch' + if not repo.bare and repo.get_current_branch() == branch: + log.info("Updating %s HEAD to latest commit", repo.top_dir) + repo.run_cmd('reset --hard') + + return commit + finally: + if os.path.exists(tmp_index): + os.unlink(tmp_index) + + +def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern, + keywords): + """Generate tag name and message, with support for running id number""" + keyws = keywords.copy() + # Tag number is handled specially: if not defined, we autoincrement it + if 'tag_number' not in keyws: + # Fill in all other fields than 'tag_number' + keyws['tag_number'] = '{tag_number}' + tag_re = format_str(name_pattern, keyws) + # Replace parentheses for proper regex matching + tag_re = tag_re.replace('(', '\(').replace(')', '\)') + '$' + # Inject regex group pattern for 'tag_number' + tag_re = tag_re.format(tag_number='(?P<tag_number>[0-9]{1,5})') + + keyws['tag_number'] = 0 + for existing_tag in repo.run_cmd('tag').splitlines(): + match = re.match(tag_re, existing_tag) + + if match and int(match.group('tag_number')) >= keyws['tag_number']: + keyws['tag_number'] = int(match.group('tag_number')) + 1 + + tag_name = format_str(name_pattern, keyws) + msg_subj= format_str(msg_subj_pattern.strip(), keyws) + msg_body = format_str(msg_body_pattern, keyws) + return tag_name, msg_subj + '\n\n' + msg_body + + +def parse_args(argv): + """Parse command line arguments""" + parser = argparse.ArgumentParser( + description="Commit data to git and push upstream", + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('--debug', '-D', action='store_true', + help="Verbose logging") + parser.add_argument('--git-dir', '-g', required=True, + help="Local git directory to use") + parser.add_argument('--no-create', action='store_true', + help="If GIT_DIR is not a valid Git repository, do not " + "try to create one") + parser.add_argument('--bare', action='store_true', + help="Initialize a bare repository when creating a " + "new one") + parser.add_argument('--push', '-p', nargs='?', default=False, const=True, + help="Push to remote") + parser.add_argument('--branch-name', '-b', + default='{hostname}/{branch}/{machine}', + help="Git branch name (pattern) to use") + parser.add_argument('--no-tag', action='store_true', + help="Do not create Git tag") + parser.add_argument('--tag-name', '-t', + default='{hostname}/{branch}/{machine}/{commit_count}-g{commit}/{tag_number}', + help="Tag name (pattern) to use") + parser.add_argument('--commit-msg-subject', + default='Results of {branch}:{commit} on {hostname}', + help="Subject line (pattern) to use in the commit message") + parser.add_argument('--commit-msg-body', + default='branch: {branch}\ncommit: {commit}\nhostname: {hostname}', + help="Commit message body (pattern)") + parser.add_argument('--tag-msg-subject', + default='Test run #{tag_number} of {branch}:{commit} on {hostname}', + help="Subject line (pattern) of the tag message") + parser.add_argument('--tag-msg-body', + default='', + help="Tag message body (pattern)") + parser.add_argument('--exclude', action='append', default=[], + help="Glob to exclude files from the commit. Relative " + "to DATA_DIR. May be specified multiple times") + parser.add_argument('--notes', nargs=2, action='append', default=[], + metavar=('GIT_REF', 'FILE'), + help="Add a file as a note under refs/notes/GIT_REF. " + "{branch_name} in GIT_REF will be expanded to the " + "actual target branch name (specified by " + "--branch-name). This option may be specified " + "multiple times.") + parser.add_argument('data_dir', metavar='DATA_DIR', + help="Data to commit") + return parser.parse_args(argv) + + +def main(argv=None): + """Script entry point""" + args = parse_args(argv) + if args.debug: + log.setLevel(logging.DEBUG) + + try: + if not os.path.isdir(args.data_dir): + raise ArchiveError("Not a directory: {}".format(args.data_dir)) + + data_repo = init_git_repo(args.git_dir, args.no_create, args.bare) + + # Get keywords to be used in tag and branch names and messages + metadata = metadata_from_bb() + keywords = {'hostname': metadata['hostname'], + 'branch': metadata['layers']['meta']['branch'], + 'commit': metadata['layers']['meta']['commit'], + 'commit_count': metadata['layers']['meta']['commit_count'], + 'machine': metadata['config']['MACHINE']} + + # Expand strings early in order to avoid getting into inconsistent + # state (e.g. no tag even if data was committed) + commit_msg = format_str(args.commit_msg_subject.strip(), keywords) + commit_msg += '\n\n' + format_str(args.commit_msg_body, keywords) + branch_name = format_str(args.branch_name, keywords) + tag_name = None + if not args.no_tag and args.tag_name: + tag_name, tag_msg = expand_tag_strings(data_repo, args.tag_name, + args.tag_msg_subject, + args.tag_msg_body, keywords) + + # Commit data + commit = git_commit_data(data_repo, args.data_dir, branch_name, + commit_msg, args.exclude, args.notes) + + # Create tag + if tag_name: + log.info("Creating tag %s", tag_name) + data_repo.run_cmd(['tag', '-a', '-m', tag_msg, tag_name, commit]) + + # Push data to remote + if args.push: + cmd = ['push', '--tags'] + # If no remote is given we push with the default settings from + # gitconfig + if args.push is not True: + notes_refs = ['refs/notes/' + ref.format(branch_name=branch_name) + for ref, _ in args.notes] + cmd.extend([args.push, branch_name] + notes_refs) + log.info("Pushing data to remote") + data_repo.run_cmd(cmd) + + except ArchiveError as err: + log.error(str(err)) + return 1 + + return 0 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/oe-git-proxy b/scripts/oe-git-proxy index 98191faadd..7a43fe6a6e 100755 --- a/scripts/oe-git-proxy +++ b/scripts/oe-git-proxy @@ -1,10 +1,12 @@ #!/bin/bash # oe-git-proxy is a simple tool to be via GIT_PROXY_COMMAND. It uses socat -# to make SOCKS5 or HTTPS proxy connections. It uses ALL_PROXY to determine the -# proxy server, protocol, and port. It uses NO_PROXY to skip using the proxy for -# a comma delimited list of hosts, host globs (*.example.com), IPs, or CIDR -# masks (192.168.1.0/24). It is known to work with both bash and dash shells. +# to make SOCKS5 or HTTPS proxy connections. +# It uses ALL_PROXY or all_proxy or http_proxy to determine the proxy server, +# protocol, and port. +# It uses NO_PROXY to skip using the proxy for a comma delimited list of +# hosts, host globs (*.example.com), IPs, or CIDR masks (192.168.1.0/24). It +# is known to work with both bash and dash shells. # # Example ALL_PROXY values: # ALL_PROXY=socks://socks.example.com:1080 @@ -16,10 +18,31 @@ # AUTHORS # Darren Hart <dvhart@linux.intel.com> +if [ $# -lt 2 -o "$1" = '--help' -o "$1" = '-h' ] ; then + echo 'oe-git-proxy: error: the following arguments are required: host port' + echo 'Usage: oe-git-proxy host port' + echo '' + echo 'OpenEmbedded git-proxy - a simple tool to be used via GIT_PROXY_COMMAND.' + echo 'It uses socat to make SOCKS or HTTPS proxy connections.' + echo 'It uses ALL_PROXY to determine the proxy server, protocol, and port.' + echo 'It uses NO_PROXY to skip using the proxy for a comma delimited list' + echo 'of hosts, host globs (*.example.com), IPs, or CIDR masks (192.168.1.0/24).' + echo 'It is known to work with both bash and dash shells.runs native tools' + echo '' + echo 'arguments:' + echo ' host proxy host to use' + echo ' port proxy port to use' + echo '' + echo 'options:' + echo ' -h, --help show this help message and exit' + echo '' + exit 2 +fi + # Locate the netcat binary SOCAT=$(which socat 2>/dev/null) if [ $? -ne 0 ]; then - echo "ERROR: socat binary not in PATH" + echo "ERROR: socat binary not in PATH" 1>&2 exit 1 fi METHOD="" @@ -53,6 +76,7 @@ match_ipv4() { # Determine the mask bitlength BITS=${CIDR##*/} + [ "$BITS" != "$CIDR" ] || BITS=32 if [ -z "$BITS" ]; then return 1 fi @@ -83,13 +107,14 @@ match_host() { # Match by netmask if valid_ipv4 $GLOB; then - HOST_IP=$(gethostip -d $HOST) - if valid_ipv4 $HOST_IP; then - match_ipv4 $GLOB $HOST_IP - if [ $? -eq 0 ]; then - return 0 + for HOST_IP in $(getent ahostsv4 $HOST | grep ' STREAM ' | cut -d ' ' -f 1) ; do + if valid_ipv4 $HOST_IP; then + match_ipv4 $GLOB $HOST_IP + if [ $? -eq 0 ]; then + return 0 + fi fi - fi + done fi return 1 @@ -98,6 +123,9 @@ match_host() { # If no proxy is set or needed, just connect directly METHOD="TCP:$1:$2" +[ -z "${ALL_PROXY}" ] && ALL_PROXY=$all_proxy +[ -z "${ALL_PROXY}" ] && ALL_PROXY=$http_proxy + if [ -z "$ALL_PROXY" ]; then exec $SOCAT STDIO $METHOD fi @@ -110,14 +138,34 @@ for H in ${NO_PROXY//,/ }; do done # Proxy is necessary, determine protocol, server, and port -PROTO=$(echo $ALL_PROXY | sed -e 's/\([^:]*\):\/\/.*/\1/') -PROXY=$(echo $ALL_PROXY | sed -e 's/.*:\/\/\([^:]*\).*/\1/') -PORT=$(echo $ALL_PROXY | sed -e 's/.*:\([0-9]*\)\/?$/\1/') -if [ "$PORT" = "$ALL_PROXY" ]; then +# extract protocol +PROTO=${ALL_PROXY%://*} +# strip protocol:// from string +ALL_PROXY=${ALL_PROXY#*://} +# extract host & port parts: +# 1) drop username/password +PROXY=${ALL_PROXY##*@} +# 2) remove optional trailing /? +PROXY=${PROXY%%/*} +# 3) extract optional port +PORT=${PROXY##*:} +if [ "$PORT" = "$PROXY" ]; then PORT="" fi +# 4) remove port +PROXY=${PROXY%%:*} + +# extract username & password +PROXYAUTH="${ALL_PROXY%@*}" +[ "$PROXYAUTH" = "$ALL_PROXY" ] && PROXYAUTH= +[ -n "${PROXYAUTH}" ] && PROXYAUTH=",proxyauth=${PROXYAUTH}" -if [ "$PROTO" = "socks" ]; then +if [ "$PROTO" = "socks" ] || [ "$PROTO" = "socks4a" ]; then + if [ -z "$PORT" ]; then + PORT="1080" + fi + METHOD="SOCKS4A:$PROXY:$1:$2,socksport=$PORT" +elif [ "$PROTO" = "socks4" ]; then if [ -z "$PORT" ]; then PORT="1080" fi @@ -127,7 +175,7 @@ else if [ -z "$PORT" ]; then PORT="8080" fi - METHOD="PROXY:$PROXY:$1:$2,proxyport=$PORT" + METHOD="PROXY:$PROXY:$1:$2,proxyport=${PORT}${PROXYAUTH}" fi -exec $SOCAT STDIO $METHOD +exec $SOCAT STDIO "$METHOD" diff --git a/scripts/oe-gnome-terminal-phonehome b/scripts/oe-gnome-terminal-phonehome new file mode 100755 index 0000000000..e02354883a --- /dev/null +++ b/scripts/oe-gnome-terminal-phonehome @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Gnome terminal won't tell us which PID a given command is run as +# or allow a single instance so we can't tell when it completes. +# This allows us to figure out the PID of the target so we can tell +# when its done. +# +echo $$ > $1 +shift +exec $@ diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index c63f87d7e6..6255662a4b 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util @@ -1,10 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # OpenEmbedded pkgdata utility # # Written by: Paul Eggleton <paul.eggleton@linux.intel.com> # -# Copyright 2012 Intel Corporation +# Copyright 2012-2015 Intel Corporation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -19,56 +19,63 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# -# Currently only has two functions: -# 1) glob - mapping of packages to their dev/dbg/doc/locale etc. counterparts. -# 2) read-value - mapping of packagenames to their location in -# pkgdata and then returns value of selected variable (e.g. PKGSIZE) -# Could be extended in future to perform other useful querying functions on the -# pkgdata though. -# import sys import os import os.path import fnmatch import re +import argparse +import logging +from collections import defaultdict, OrderedDict -def usage(): - print("syntax: oe-pkgdata-util glob [-d] <pkgdatadir> <vendor-os> <pkglist> \"<globs>\"\n \ - read-value [-d] <pkgdatadir> <vendor-os> <value-name> \"<package-name>_<package_architecture>\""); +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptutils +import argparse_oe +logger = scriptutils.logger_create('pkgdatautil') +def tinfoil_init(): + import bb.tinfoil + import logging + tinfoil = bb.tinfoil.Tinfoil() + tinfoil.prepare(True) + tinfoil.logger.setLevel(logging.WARNING) + return tinfoil -def glob(args): - if len(args) < 4: - usage() - sys.exit(1) - pkgdata_dir = args[0] - target_suffix = args[1] - pkglist_file = args[2] - globs = args[3].split() +def glob(args): + # Handle both multiple arguments and multiple values within an arg (old syntax) + globs = [] + for globitem in args.glob: + globs.extend(globitem.split()) - if target_suffix.startswith("-"): - target_suffix = target_suffix[1:] + if not os.path.exists(args.pkglistfile): + logger.error('Unable to find package list file %s' % args.pkglistfile) + sys.exit(1) - skipregex = re.compile("-locale-|^locale-base-|-dev$|-doc$|-dbg$|-staticdev$|^kernel-module-") + skipval = "-locale-|^locale-base-|-dev$|-doc$|-dbg$|-staticdev$|^kernel-module-" + if args.exclude: + skipval += "|" + args.exclude + skipregex = re.compile(skipval) + skippedpkgs = set() mappedpkgs = set() - with open(pkglist_file, 'r') as f: + with open(args.pkglistfile, 'r') as f: for line in f: fields = line.rstrip().split() - if len(fields) < 2: + if not fields: continue pkg = fields[0] - arch = fields[1] - multimach_target_sys = "%s-%s" % (arch, target_suffix) + # We don't care about other args (used to need the package architecture but the + # new pkgdata structure avoids the need for that) # Skip packages for which there is no point applying globs if skipregex.search(pkg): - if debug: - print("%s -> !!" % pkg) + logger.debug("%s -> !!" % pkg) + skippedpkgs.add(pkg) continue # Skip packages that already match the globs, so if e.g. a dev package @@ -80,15 +87,15 @@ def glob(args): already = True break if already: - if debug: - print("%s -> !" % pkg) + skippedpkgs.add(pkg) + logger.debug("%s -> !" % pkg) continue # Define some functions def revpkgdata(pkgn): - return os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkgn) + return os.path.join(args.pkgdata_dir, "runtime-reverse", pkgn) def fwdpkgdata(pkgn): - return os.path.join(pkgdata_dir, multimach_target_sys, "runtime", pkgn) + return os.path.join(args.pkgdata_dir, "runtime", pkgn) def readpn(pkgdata_file): pn = "" with open(pkgdata_file, 'r') as f: @@ -138,92 +145,447 @@ def glob(args): mappedpkg = "" else: # Package doesn't even exist... - if debug: - print "%s is not a valid package!" % (pkg) + logger.debug("%s is not a valid package!" % (pkg)) break if mappedpkg: - if debug: - print "%s (%s) -> %s" % (pkg, g, mappedpkg) + logger.debug("%s (%s) -> %s" % (pkg, g, mappedpkg)) mappedpkgs.add(mappedpkg) else: - if debug: - print "%s (%s) -> ?" % (pkg, g) + logger.debug("%s (%s) -> ?" % (pkg, g)) - if debug: - print "------" + logger.debug("------") - print("\n".join(mappedpkgs)) + print("\n".join(mappedpkgs - skippedpkgs)) def read_value(args): - if len(args) < 4: - usage() - sys.exit(1) - - pkgdata_dir = args[0] - target_suffix = args[1] - var = args[2] - packages = args[3].split() - - if target_suffix.startswith("-"): - target_suffix = target_suffix[1:] + # Handle both multiple arguments and multiple values within an arg (old syntax) + packages = [] + if args.file: + with open(args.file, 'r') as f: + for line in f: + splitline = line.split() + if splitline: + packages.append(splitline[0]) + else: + for pkgitem in args.pkg: + packages.extend(pkgitem.split()) + if not packages: + logger.error("No packages specified") + sys.exit(1) - def readvar(pkgdata_file, var): + def readvar(pkgdata_file, valuename, mappedpkg): val = "" with open(pkgdata_file, 'r') as f: for line in f: - if line.startswith(var + ":"): - val = line.split(': ')[1].rstrip() + if (line.startswith(valuename + ":") or + line.startswith(valuename + "_" + mappedpkg + ":")): + val = line.split(': ', 1)[1].rstrip() return val - if debug: - print "read-value('%s', '%s', '%s' '%s'" % (pkgdata_dir, target_suffix, var, packages) + logger.debug("read-value('%s', '%s' '%s')" % (args.pkgdata_dir, args.valuename, packages)) for package in packages: pkg_split = package.split('_') pkg_name = pkg_split[0] - pkg_arch = '_'.join(pkg_split[1:]) - if debug: - print "package: name: '%s', arch: '%s'" % (pkg_name, pkg_arch) - multimach_target_sys = "%s-%s" % (pkg_arch, target_suffix) - revlink = os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkg_name) - if debug: - print(revlink) - if not os.path.exists(revlink): - # [YOCTO #4227] try to drop -gnueabi from TARGET_OS - multimach_target_sys = '-'.join(multimach_target_sys.split('-')[:-1]) - revlink = os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkg_name) - if debug: - print(revlink) + logger.debug("package: '%s'" % pkg_name) + revlink = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg_name) + logger.debug(revlink) if os.path.exists(revlink): mappedpkg = os.path.basename(os.readlink(revlink)) - qvar = var + qvar = args.valuename + value = readvar(revlink, qvar, mappedpkg) if qvar == "PKGSIZE": - # append packagename - qvar = "%s_%s" % (var, mappedpkg) - print(readvar(revlink, qvar)) - -# Too lazy to use getopt -debug = False -noopt = False -args = [] -for arg in sys.argv[1:]: - if arg == "--": - noopt = True + # PKGSIZE is now in bytes, but we we want it in KB + pkgsize = (int(value) + 1024 // 2) // 1024 + value = "%d" % pkgsize + if args.prefix_name: + print('%s %s' % (pkg_name, value)) + else: + print(value) + else: + logger.debug("revlink %s does not exist", revlink) + +def lookup_pkglist(pkgs, pkgdata_dir, reverse): + if reverse: + mappings = OrderedDict() + for pkg in pkgs: + revlink = os.path.join(pkgdata_dir, "runtime-reverse", pkg) + logger.debug(revlink) + if os.path.exists(revlink): + mappings[pkg] = os.path.basename(os.readlink(revlink)) else: - if not noopt: - if arg == "-d": - debug = True - continue - args.append(arg) - -if len(args) < 1: - usage() - sys.exit(1) - -if args[0] == "glob": - glob(args[1:]) -elif args[0] == "read-value": - read_value(args[1:]) -else: - usage() - sys.exit(1) + mappings = defaultdict(list) + for pkg in pkgs: + pkgfile = os.path.join(pkgdata_dir, 'runtime', pkg) + if os.path.exists(pkgfile): + with open(pkgfile, 'r') as f: + for line in f: + fields = line.rstrip().split(': ') + if fields[0] == 'PKG_%s' % pkg: + mappings[pkg].append(fields[1]) + break + return mappings + +def lookup_pkg(args): + # Handle both multiple arguments and multiple values within an arg (old syntax) + pkgs = [] + for pkgitem in args.pkg: + pkgs.extend(pkgitem.split()) + + mappings = lookup_pkglist(pkgs, args.pkgdata_dir, args.reverse) + + if len(mappings) < len(pkgs): + missing = list(set(pkgs) - set(mappings.keys())) + logger.error("The following packages could not be found: %s" % ', '.join(missing)) + sys.exit(1) + + if args.reverse: + items = list(mappings.values()) + else: + items = [] + for pkg in pkgs: + items.extend(mappings.get(pkg, [])) + + print('\n'.join(items)) + +def lookup_recipe(args): + # Handle both multiple arguments and multiple values within an arg (old syntax) + pkgs = [] + for pkgitem in args.pkg: + pkgs.extend(pkgitem.split()) + + mappings = defaultdict(list) + for pkg in pkgs: + pkgfile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg) + if os.path.exists(pkgfile): + with open(pkgfile, 'r') as f: + for line in f: + fields = line.rstrip().split(': ') + if fields[0] == 'PN': + mappings[pkg].append(fields[1]) + break + if len(mappings) < len(pkgs): + missing = list(set(pkgs) - set(mappings.keys())) + logger.error("The following packages could not be found: %s" % ', '.join(missing)) + sys.exit(1) + + items = [] + for pkg in pkgs: + items.extend(mappings.get(pkg, [])) + print('\n'.join(items)) + +def package_info(args): + # Handle both multiple arguments and multiple values within an arg (old syntax) + packages = [] + if args.file: + with open(args.file, 'r') as f: + for line in f: + splitline = line.split() + if splitline: + packages.append(splitline[0]) + else: + for pkgitem in args.pkg: + packages.extend(pkgitem.split()) + if not packages: + logger.error("No packages specified") + sys.exit(1) + + mappings = defaultdict(lambda: defaultdict(str)) + for pkg in packages: + pkgfile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg) + if os.path.exists(pkgfile): + with open(pkgfile, 'r') as f: + for line in f: + fields = line.rstrip().split(': ') + if fields[0].endswith("_" + pkg): + k = fields[0][:len(fields[0]) - len(pkg) - 1] + else: + k = fields[0] + v = fields[1] if len(fields) == 2 else "" + mappings[pkg][k] = v + + if len(mappings) < len(packages): + missing = list(set(packages) - set(mappings.keys())) + logger.error("The following packages could not be found: %s" % + ', '.join(missing)) + sys.exit(1) + + items = [] + for pkg in packages: + pkg_version = mappings[pkg]['PKGV'] + if mappings[pkg]['PKGE']: + pkg_version = mappings[pkg]['PKGE'] + ":" + pkg_version + if mappings[pkg]['PKGR']: + pkg_version = pkg_version + "-" + mappings[pkg]['PKGR'] + recipe = mappings[pkg]['PN'] + recipe_version = mappings[pkg]['PV'] + if mappings[pkg]['PE']: + recipe_version = mappings[pkg]['PE'] + ":" + recipe_version + if mappings[pkg]['PR']: + recipe_version = recipe_version + "-" + mappings[pkg]['PR'] + pkg_size = mappings[pkg]['PKGSIZE'] + + items.append("%s %s %s %s %s" % + (pkg, pkg_version, recipe, recipe_version, pkg_size)) + print('\n'.join(items)) + +def get_recipe_pkgs(pkgdata_dir, recipe, unpackaged): + recipedatafile = os.path.join(pkgdata_dir, recipe) + if not os.path.exists(recipedatafile): + logger.error("Unable to find packaged recipe with name %s" % recipe) + sys.exit(1) + packages = [] + with open(recipedatafile, 'r') as f: + for line in f: + fields = line.rstrip().split(': ') + if fields[0] == 'PACKAGES': + packages = fields[1].split() + break + + if not unpackaged: + pkglist = [] + for pkg in packages: + if os.path.exists(os.path.join(pkgdata_dir, 'runtime', '%s.packaged' % pkg)): + pkglist.append(pkg) + return pkglist + else: + return packages + +def list_pkgs(args): + found = False + + def matchpkg(pkg): + if args.pkgspec: + matched = False + for pkgspec in args.pkgspec: + if fnmatch.fnmatchcase(pkg, pkgspec): + matched = True + break + if not matched: + return False + if not args.unpackaged: + if args.runtime: + revlink = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg) + if os.path.exists(revlink): + # We're unlikely to get here if the package was not packaged, but just in case + # we add the symlinks for unpackaged files in the future + mappedpkg = os.path.basename(os.readlink(revlink)) + if not os.path.exists(os.path.join(args.pkgdata_dir, 'runtime', '%s.packaged' % mappedpkg)): + return False + else: + return False + else: + if not os.path.exists(os.path.join(args.pkgdata_dir, 'runtime', '%s.packaged' % pkg)): + return False + return True + + if args.recipe: + packages = get_recipe_pkgs(args.pkgdata_dir, args.recipe, args.unpackaged) + + if args.runtime: + pkglist = [] + runtime_pkgs = lookup_pkglist(packages, args.pkgdata_dir, False) + for rtpkgs in runtime_pkgs.values(): + pkglist.extend(rtpkgs) + else: + pkglist = packages + + for pkg in pkglist: + if matchpkg(pkg): + found = True + print("%s" % pkg) + else: + if args.runtime: + searchdir = 'runtime-reverse' + else: + searchdir = 'runtime' + + for root, dirs, files in os.walk(os.path.join(args.pkgdata_dir, searchdir)): + for fn in files: + if fn.endswith('.packaged'): + continue + if matchpkg(fn): + found = True + print("%s" % fn) + if not found: + if args.pkgspec: + logger.error("Unable to find any package matching %s" % args.pkgspec) + else: + logger.error("No packages found") + sys.exit(1) + +def list_pkg_files(args): + import json + + if args.recipe: + if args.pkg: + logger.error("list-pkg-files: If -p/--recipe is specified then a package name cannot be specified") + sys.exit(1) + recipepkglist = get_recipe_pkgs(args.pkgdata_dir, args.recipe, args.unpackaged) + if args.runtime: + pkglist = [] + runtime_pkgs = lookup_pkglist(recipepkglist, args.pkgdata_dir, False) + for rtpkgs in runtime_pkgs.values(): + pkglist.extend(rtpkgs) + else: + pkglist = recipepkglist + else: + if not args.pkg: + logger.error("list-pkg-files: If -p/--recipe is not specified then at least one package name must be specified") + sys.exit(1) + pkglist = args.pkg + + for pkg in sorted(pkglist): + print("%s:" % pkg) + if args.runtime: + pkgdatafile = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg) + if not os.path.exists(pkgdatafile): + if args.recipe: + # This package was empty and thus never packaged, ignore + continue + logger.error("Unable to find any built runtime package named %s" % pkg) + sys.exit(1) + else: + pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg) + if not os.path.exists(pkgdatafile): + logger.error("Unable to find any built recipe-space package named %s" % pkg) + sys.exit(1) + + with open(pkgdatafile, 'r') as f: + found = False + for line in f: + if line.startswith('FILES_INFO:'): + found = True + val = line.split(':', 1)[1].strip() + dictval = json.loads(val) + for fullpth in sorted(dictval): + print("\t%s" % fullpth) + break + if not found: + logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile) + sys.exit(1) + +def find_path(args): + import json + + found = False + for root, dirs, files in os.walk(os.path.join(args.pkgdata_dir, 'runtime')): + for fn in files: + with open(os.path.join(root,fn)) as f: + for line in f: + if line.startswith('FILES_INFO:'): + val = line.split(':', 1)[1].strip() + dictval = json.loads(val) + for fullpth in dictval.keys(): + if fnmatch.fnmatchcase(fullpth, args.targetpath): + found = True + print("%s: %s" % (fn, fullpth)) + break + if not found: + logger.error("Unable to find any package producing path %s" % args.targetpath) + sys.exit(1) + + +def main(): + parser = argparse_oe.ArgumentParser(description="OpenEmbedded pkgdata tool - queries the pkgdata files written out during do_package", + epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') + parser.add_argument('-p', '--pkgdata-dir', help='Path to pkgdata directory (determined automatically if not specified)') + subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') + subparsers.required = True + + parser_lookup_pkg = subparsers.add_parser('lookup-pkg', + help='Translate between recipe-space package names and runtime package names', + description='Looks up the specified recipe-space package name(s) to see what the final runtime package name is (e.g. glibc becomes libc6), or with -r/--reverse looks up the other way.') + parser_lookup_pkg.add_argument('pkg', nargs='+', help='Package name to look up') + parser_lookup_pkg.add_argument('-r', '--reverse', help='Switch to looking up recipe-space package names from runtime package names', action='store_true') + parser_lookup_pkg.set_defaults(func=lookup_pkg) + + parser_list_pkgs = subparsers.add_parser('list-pkgs', + help='List packages', + description='Lists packages that have been built') + parser_list_pkgs.add_argument('pkgspec', nargs='*', help='Package name to search for (wildcards * ? allowed, use quotes to avoid shell expansion)') + parser_list_pkgs.add_argument('-r', '--runtime', help='Show runtime package names instead of recipe-space package names', action='store_true') + parser_list_pkgs.add_argument('-p', '--recipe', help='Limit to packages produced by the specified recipe') + parser_list_pkgs.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages', action='store_true') + parser_list_pkgs.set_defaults(func=list_pkgs) + + parser_list_pkg_files = subparsers.add_parser('list-pkg-files', + help='List files within a package', + description='Lists files included in one or more packages') + parser_list_pkg_files.add_argument('pkg', nargs='*', help='Package name to report on (if -p/--recipe is not specified)') + parser_list_pkg_files.add_argument('-r', '--runtime', help='Specified package(s) are runtime package names instead of recipe-space package names', action='store_true') + parser_list_pkg_files.add_argument('-p', '--recipe', help='Report on all packages produced by the specified recipe') + parser_list_pkg_files.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages (only useful with -p/--recipe)', action='store_true') + parser_list_pkg_files.set_defaults(func=list_pkg_files) + + parser_lookup_recipe = subparsers.add_parser('lookup-recipe', + help='Find recipe producing one or more packages', + description='Looks up the specified runtime package(s) to see which recipe they were produced by') + parser_lookup_recipe.add_argument('pkg', nargs='+', help='Runtime package name to look up') + parser_lookup_recipe.set_defaults(func=lookup_recipe) + + parser_package_info = subparsers.add_parser('package-info', + help='Show version, recipe and size information for one or more packages', + description='Looks up the specified runtime package(s) and display information') + parser_package_info.add_argument('pkg', nargs='*', help='Runtime package name to look up') + parser_package_info.add_argument('-f', '--file', help='Read package names from the specified file (one per line, first field only)') + parser_package_info.set_defaults(func=package_info) + + parser_find_path = subparsers.add_parser('find-path', + help='Find package providing a target path', + description='Finds the recipe-space package providing the specified target path') + parser_find_path.add_argument('targetpath', help='Path to find (wildcards * ? allowed, use quotes to avoid shell expansion)') + parser_find_path.set_defaults(func=find_path) + + parser_read_value = subparsers.add_parser('read-value', + help='Read any pkgdata value for one or more packages', + description='Reads the named value from the pkgdata files for the specified packages') + parser_read_value.add_argument('valuename', help='Name of the value to look up') + parser_read_value.add_argument('pkg', nargs='*', help='Runtime package name to look up') + parser_read_value.add_argument('-f', '--file', help='Read package names from the specified file (one per line, first field only)') + parser_read_value.add_argument('-n', '--prefix-name', help='Prefix output with package name', action='store_true') + parser_read_value.set_defaults(func=read_value) + + parser_glob = subparsers.add_parser('glob', + help='Expand package name glob expression', + description='Expands one or more glob expressions over the packages listed in pkglistfile') + parser_glob.add_argument('pkglistfile', help='File listing packages (one package name per line)') + parser_glob.add_argument('glob', nargs="+", help='Glob expression for package names, e.g. *-dev') + parser_glob.add_argument('-x', '--exclude', help='Exclude packages matching specified regex from the glob operation') + parser_glob.set_defaults(func=glob) + + + args = parser.parse_args() + + if args.debug: + logger.setLevel(logging.DEBUG) + + if not args.pkgdata_dir: + import scriptpath + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + sys.exit(1) + logger.debug('Found bitbake path: %s' % bitbakepath) + tinfoil = tinfoil_init() + try: + args.pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR') + finally: + tinfoil.shutdown() + logger.debug('Value of PKGDATA_DIR is "%s"' % args.pkgdata_dir) + if not args.pkgdata_dir: + logger.error('Unable to determine pkgdata directory from PKGDATA_DIR') + sys.exit(1) + + if not os.path.exists(args.pkgdata_dir): + logger.error('Unable to find pkgdata directory %s' % args.pkgdata_dir) + sys.exit(1) + + ret = args.func(args) + + return ret + + +if __name__ == "__main__": + main() diff --git a/scripts/oe-publish-sdk b/scripts/oe-publish-sdk new file mode 100755 index 0000000000..9f7963c249 --- /dev/null +++ b/scripts/oe-publish-sdk @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 + +# OpenEmbedded SDK publishing tool + +# Copyright (C) 2015-2016 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import os +import argparse +import glob +import re +import subprocess +import logging +import shutil +import errno + +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptutils +import argparse_oe +logger = scriptutils.logger_create('sdktool') + +def mkdir(d): + try: + os.makedirs(d) + except OSError as e: + if e.errno != errno.EEXIST: + raise e + +def publish(args): + logger.debug("In publish function") + target_sdk = args.sdk + destination = args.dest + logger.debug("target_sdk = %s, update_server = %s" % (target_sdk, destination)) + sdk_basename = os.path.basename(target_sdk) + + # Ensure the SDK exists + if not os.path.exists(target_sdk): + logger.error("Specified SDK %s doesn't exist" % target_sdk) + return -1 + if os.path.isdir(target_sdk): + logger.error("%s is a directory - expected path to SDK installer file" % target_sdk) + return -1 + + if ':' in destination: + is_remote = True + host, destdir = destination.split(':') + dest_sdk = os.path.join(destdir, sdk_basename) + else: + is_remote = False + dest_sdk = os.path.join(destination, sdk_basename) + destdir = destination + + # Making sure the directory exists + logger.debug("Making sure the destination directory exists") + if not is_remote: + mkdir(destination) + else: + cmd = "ssh %s 'mkdir -p %s'" % (host, destdir) + ret = subprocess.call(cmd, shell=True) + if ret != 0: + logger.error("Making directory %s on %s failed" % (destdir, host)) + return ret + + # Copying the SDK to the destination + logger.info("Copying the SDK to destination") + if not is_remote: + if os.path.exists(dest_sdk): + os.remove(dest_sdk) + if (os.stat(target_sdk).st_dev == os.stat(destination).st_dev): + os.link(target_sdk, dest_sdk) + else: + shutil.copy(target_sdk, dest_sdk) + else: + cmd = "scp %s %s" % (target_sdk, destination) + ret = subprocess.call(cmd, shell=True) + if ret != 0: + logger.error("scp %s %s failed" % (target_sdk, destination)) + return ret + + # Unpack the SDK + logger.info("Unpacking SDK") + if not is_remote: + cmd = "sh %s -p -y -d %s" % (dest_sdk, destination) + ret = subprocess.call(cmd, shell=True) + if ret == 0: + logger.info('Successfully unpacked %s to %s' % (dest_sdk, destination)) + os.remove(dest_sdk) + else: + logger.error('Failed to unpack %s to %s' % (dest_sdk, destination)) + return ret + else: + cmd = "ssh %s 'sh %s -p -y -d %s && rm -f %s'" % (host, dest_sdk, destdir, dest_sdk) + ret = subprocess.call(cmd, shell=True) + if ret == 0: + logger.info('Successfully unpacked %s to %s' % (dest_sdk, destdir)) + else: + logger.error('Failed to unpack %s to %s' % (dest_sdk, destdir)) + return ret + + # Setting up the git repo + if not is_remote: + cmd = 'set -e; mkdir -p %s/layers; cd %s/layers; if [ ! -e .git ]; then git init .; mv .git/hooks/post-update.sample .git/hooks/post-update; echo "*.pyc\n*.pyo\npyshtables.py" > .gitignore; fi; git add -A .; git config user.email "oe@oe.oe" && git config user.name "OE" && git commit -q -m "init repo" || true; git update-server-info' % (destination, destination) + else: + cmd = "ssh %s 'set -e; mkdir -p %s/layers; cd %s/layers; if [ ! -e .git ]; then git init .; mv .git/hooks/post-update.sample .git/hooks/post-update; echo '*.pyc\n*.pyo\npyshtables.py' > .gitignore; fi; git add -A .; git config user.email 'oe@oe.oe' && git config user.name 'OE' && git commit -q -m \"init repo\" || true; git update-server-info'" % (host, destdir, destdir) + ret = subprocess.call(cmd, shell=True) + if ret == 0: + logger.info('SDK published successfully') + else: + logger.error('Failed to set up layer git repo') + return ret + + +def main(): + parser = argparse_oe.ArgumentParser(description="OpenEmbedded extensible SDK publishing tool - writes server-side data to support the extensible SDK update process to a specified location") + parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') + parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') + + parser.add_argument('sdk', help='Extensible SDK to publish (path to .sh installer file)') + parser.add_argument('dest', help='Destination to publish SDK to; can be local path or remote in the form of user@host:/path (in the latter case ssh/scp will be used).') + + parser.set_defaults(func=publish) + + args = parser.parse_args() + + if args.debug: + logger.setLevel(logging.DEBUG) + elif args.quiet: + logger.setLevel(logging.ERROR) + + ret = args.func(args) + return ret + +if __name__ == "__main__": + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc() + sys.exit(ret) diff --git a/scripts/oe-run-native b/scripts/oe-run-native new file mode 100755 index 0000000000..1131122e68 --- /dev/null +++ b/scripts/oe-run-native @@ -0,0 +1,68 @@ +#!/bin/bash +# +# Copyright (c) 2016, Intel Corporation. +# All Rights Reserved +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see <http://www.gnu.org/licenses/> +# + +# +# This script is for running tools from native oe sysroot +# + +if [ $# -lt 1 -o "$1" = '--help' -o "$1" = '-h' ] ; then + echo 'oe-run-native: the following arguments are required: <native recipe> <native tool>' + echo 'Usage: oe-run-native native-recipe tool [parameters]' + echo '' + echo 'OpenEmbedded run-native - runs native tools' + echo '' + echo 'arguments:' + echo ' native-recipe The recipe which provoides tool' + echo ' tool Native tool to run' + echo '' + exit 2 +fi + +native_recipe="$1" +tool="$2" + +if [ "${native_recipe%-native}" = "$native_recipe" ]; then + echo Error: $native_recipe is not a native recipe + echo Error: Use \"oe-run-native -h\" for help + exit 1 +fi + +shift + +SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null` +if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then + echo "Error: Unable to find oe-find-native-sysroot script" + exit 1 +fi +. $SYSROOT_SETUP_SCRIPT $native_recipe + +OLD_PATH=$PATH + +# look for a tool only in native sysroot +PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$OECORE_NATIVE_SYSROOT/bin:$OECORE_NATIVE_SYSROOT/usr/sbin:$OECORE_NATIVE_SYSROOT/sbin +tool_find=`/usr/bin/which $tool 2>/dev/null` + +if [ -n "$tool_find" ] ; then + # add old path to allow usage of host tools + PATH=$PATH:$OLD_PATH $@ +else + echo "Error: Unable to find '$tool' in $PATH" + echo "Error: Have you run 'bitbake $native_recipe -caddto_recipe_sysroot'?" + exit 1 +fi diff --git a/scripts/oe-selftest b/scripts/oe-selftest new file mode 100755 index 0000000000..52366b1c8d --- /dev/null +++ b/scripts/oe-selftest @@ -0,0 +1,814 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2013 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# DESCRIPTION +# This script runs tests defined in meta/lib/oeqa/selftest/ +# It's purpose is to automate the testing of different bitbake tools. +# To use it you just need to source your build environment setup script and +# add the meta-selftest layer to your BBLAYERS. +# Call the script as: "oe-selftest -a" to run all the tests in meta/lib/oeqa/selftest/ +# Call the script as: "oe-selftest -r <module>.<Class>.<method>" to run just a single test +# E.g: "oe-selftest -r bblayers.BitbakeLayers" will run just the BitbakeLayers class from meta/lib/oeqa/selftest/bblayers.py + + +import os +import sys +import unittest +import logging +import argparse +import subprocess +import time as t +import re +import fnmatch +import collections +import imp + +sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib') +import scriptpath +scriptpath.add_bitbake_lib_path() +scriptpath.add_oe_lib_path() +import argparse_oe + +import oeqa.selftest +import oeqa.utils.ftools as ftools +from oeqa.utils.commands import runCmd, get_bb_var, get_test_layer +from oeqa.utils.metadata import metadata_from_bb, write_metadata_file +from oeqa.selftest.base import oeSelfTest, get_available_machines + +try: + import xmlrunner + from xmlrunner.result import _XMLTestResult as TestResult + from xmlrunner import XMLTestRunner as _TestRunner +except ImportError: + # use the base runner instead + from unittest import TextTestResult as TestResult + from unittest import TextTestRunner as _TestRunner + +log_prefix = "oe-selftest-" + t.strftime("%Y%m%d-%H%M%S") + +def logger_create(): + log_file = log_prefix + ".log" + if os.path.lexists("oe-selftest.log"): + os.remove("oe-selftest.log") + os.symlink(log_file, "oe-selftest.log") + + log = logging.getLogger("selftest") + log.setLevel(logging.DEBUG) + + fh = logging.FileHandler(filename=log_file, mode='w') + fh.setLevel(logging.DEBUG) + + ch = logging.StreamHandler(sys.stdout) + ch.setLevel(logging.INFO) + + formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') + fh.setFormatter(formatter) + ch.setFormatter(formatter) + + log.addHandler(fh) + log.addHandler(ch) + + return log + +log = logger_create() + +def get_args_parser(): + description = "Script that runs unit tests against bitbake and other Yocto related tools. The goal is to validate tools functionality and metadata integrity. Refer to https://wiki.yoctoproject.org/wiki/Oe-selftest for more information." + parser = argparse_oe.ArgumentParser(description=description) + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument('-r', '--run-tests', required=False, action='store', nargs='*', dest="run_tests", default=None, help='Select what tests to run (modules, classes or test methods). Format should be: <module>.<class>.<test_method>') + group.add_argument('-a', '--run-all-tests', required=False, action="store_true", dest="run_all_tests", default=False, help='Run all (unhidden) tests') + group.add_argument('-m', '--list-modules', required=False, action="store_true", dest="list_modules", default=False, help='List all available test modules.') + group.add_argument('--list-classes', required=False, action="store_true", dest="list_allclasses", default=False, help='List all available test classes.') + parser.add_argument('--coverage', action="store_true", help="Run code coverage when testing") + parser.add_argument('--coverage-source', dest="coverage_source", nargs="+", help="Specifiy the directories to take coverage from") + parser.add_argument('--coverage-include', dest="coverage_include", nargs="+", help="Specify extra patterns to include into the coverage measurement") + parser.add_argument('--coverage-omit', dest="coverage_omit", nargs="+", help="Specify with extra patterns to exclude from the coverage measurement") + group.add_argument('--run-tests-by', required=False, dest='run_tests_by', default=False, nargs='*', + help='run-tests-by <name|class|module|id|tag> <list of tests|classes|modules|ids|tags>') + group.add_argument('--list-tests-by', required=False, dest='list_tests_by', default=False, nargs='*', + help='list-tests-by <name|class|module|id|tag> <list of tests|classes|modules|ids|tags>') + group.add_argument('-l', '--list-tests', required=False, action="store_true", dest="list_tests", default=False, + help='List all available tests.') + group.add_argument('--list-tags', required=False, dest='list_tags', default=False, action="store_true", + help='List all tags that have been set to test cases.') + parser.add_argument('--machine', required=False, dest='machine', choices=['random', 'all'], default=None, + help='Run tests on different machines (random/all).') + parser.add_argument('--repository', required=False, dest='repository', default='', action='store', + help='Submit test results to a repository') + return parser + +builddir = None + + +def preflight_check(): + + global builddir + + log.info("Checking that everything is in order before running the tests") + + if not os.environ.get("BUILDDIR"): + log.error("BUILDDIR isn't set. Did you forget to source your build environment setup script?") + return False + + builddir = os.environ.get("BUILDDIR") + if os.getcwd() != builddir: + log.info("Changing cwd to %s" % builddir) + os.chdir(builddir) + + if not "meta-selftest" in get_bb_var("BBLAYERS"): + log.warn("meta-selftest layer not found in BBLAYERS, adding it") + meta_selftestdir = os.path.join( + get_bb_var("BBLAYERS_FETCH_DIR"), + 'meta-selftest') + if os.path.isdir(meta_selftestdir): + runCmd("bitbake-layers add-layer %s" %meta_selftestdir) + else: + log.error("could not locate meta-selftest in:\n%s" + %meta_selftestdir) + return False + + if "buildhistory.bbclass" in get_bb_var("BBINCLUDED"): + log.error("You have buildhistory enabled already and this isn't recommended for selftest, please disable it first.") + return False + + if get_bb_var("PRSERV_HOST"): + log.error("Please unset PRSERV_HOST in order to run oe-selftest") + return False + + if get_bb_var("SANITY_TESTED_DISTROS"): + log.error("Please unset SANITY_TESTED_DISTROS in order to run oe-selftest") + return False + + log.info("Running bitbake -p") + runCmd("bitbake -p") + + return True + +def add_include(): + global builddir + if "#include added by oe-selftest.py" \ + not in ftools.read_file(os.path.join(builddir, "conf/local.conf")): + log.info("Adding: \"include selftest.inc\" in local.conf") + ftools.append_file(os.path.join(builddir, "conf/local.conf"), \ + "\n#include added by oe-selftest.py\ninclude machine.inc\ninclude selftest.inc") + + if "#include added by oe-selftest.py" \ + not in ftools.read_file(os.path.join(builddir, "conf/bblayers.conf")): + log.info("Adding: \"include bblayers.inc\" in bblayers.conf") + ftools.append_file(os.path.join(builddir, "conf/bblayers.conf"), \ + "\n#include added by oe-selftest.py\ninclude bblayers.inc") + +def remove_include(): + global builddir + if builddir is None: + return + if "#include added by oe-selftest.py" \ + in ftools.read_file(os.path.join(builddir, "conf/local.conf")): + log.info("Removing the include from local.conf") + ftools.remove_from_file(os.path.join(builddir, "conf/local.conf"), \ + "\n#include added by oe-selftest.py\ninclude machine.inc\ninclude selftest.inc") + + if "#include added by oe-selftest.py" \ + in ftools.read_file(os.path.join(builddir, "conf/bblayers.conf")): + log.info("Removing the include from bblayers.conf") + ftools.remove_from_file(os.path.join(builddir, "conf/bblayers.conf"), \ + "\n#include added by oe-selftest.py\ninclude bblayers.inc") + +def remove_inc_files(): + global builddir + if builddir is None: + return + try: + os.remove(os.path.join(builddir, "conf/selftest.inc")) + for root, _, files in os.walk(get_test_layer()): + for f in files: + if f == 'test_recipe.inc': + os.remove(os.path.join(root, f)) + except OSError as e: + pass + + for incl_file in ['conf/bblayers.inc', 'conf/machine.inc']: + try: + os.remove(os.path.join(builddir, incl_file)) + except: + pass + + +def get_tests_modules(include_hidden=False): + modules_list = list() + for modules_path in oeqa.selftest.__path__: + for (p, d, f) in os.walk(modules_path): + files = sorted([f for f in os.listdir(p) if f.endswith('.py') and not (f.startswith('_') and not include_hidden) and not f.startswith('__') and f != 'base.py']) + for f in files: + submodules = p.split("selftest")[-1] + module = "" + if submodules: + module = 'oeqa.selftest' + submodules.replace("/",".") + "." + f.split('.py')[0] + else: + module = 'oeqa.selftest.' + f.split('.py')[0] + if module not in modules_list: + modules_list.append(module) + return modules_list + + +def get_tests(exclusive_modules=[], include_hidden=False): + test_modules = list() + for x in exclusive_modules: + test_modules.append('oeqa.selftest.' + x) + if not test_modules: + inc_hidden = include_hidden + test_modules = get_tests_modules(inc_hidden) + + return test_modules + + +class Tc: + def __init__(self, tcname, tcclass, tcmodule, tcid=None, tctag=None): + self.tcname = tcname + self.tcclass = tcclass + self.tcmodule = tcmodule + self.tcid = tcid + # A test case can have multiple tags (as tuples) otherwise str will suffice + self.tctag = tctag + self.fullpath = '.'.join(['oeqa', 'selftest', tcmodule, tcclass, tcname]) + + +def get_tests_from_module(tmod): + tlist = [] + prefix = 'oeqa.selftest.' + + try: + import importlib + modlib = importlib.import_module(tmod) + for mod in list(vars(modlib).values()): + if isinstance(mod, type(oeSelfTest)) and issubclass(mod, oeSelfTest) and mod is not oeSelfTest: + for test in dir(mod): + if test.startswith('test_') and hasattr(vars(mod)[test], '__call__'): + # Get test case id and feature tag + # NOTE: if testcase decorator or feature tag not set will throw error + try: + tid = vars(mod)[test].test_case + except: + print('DEBUG: tc id missing for ' + str(test)) + tid = None + try: + ttag = vars(mod)[test].tag__feature + except: + # print('DEBUG: feature tag missing for ' + str(test)) + ttag = None + + # NOTE: for some reason lstrip() doesn't work for mod.__module__ + tlist.append(Tc(test, mod.__name__, mod.__module__.replace(prefix, ''), tid, ttag)) + except: + pass + + return tlist + + +def get_all_tests(): + # Get all the test modules (except the hidden ones) + testlist = [] + tests_modules = get_tests_modules() + # Get all the tests from modules + for tmod in sorted(tests_modules): + testlist += get_tests_from_module(tmod) + return testlist + + +def get_testsuite_by(criteria, keyword): + # Get a testsuite based on 'keyword' + # criteria: name, class, module, id, tag + # keyword: a list of tests, classes, modules, ids, tags + + ts = [] + all_tests = get_all_tests() + + def get_matches(values): + # Get an item and return the ones that match with keyword(s) + # values: the list of items (names, modules, classes...) + result = [] + remaining = values[:] + for key in keyword: + found = False + if key in remaining: + # Regular matching of exact item + result.append(key) + remaining.remove(key) + found = True + else: + # Wildcard matching + pattern = re.compile(fnmatch.translate(r"%s" % key)) + added = [x for x in remaining if pattern.match(x)] + if added: + result.extend(added) + remaining = [x for x in remaining if x not in added] + found = True + if not found: + log.error("Failed to find test: %s" % key) + + return result + + if criteria == 'name': + names = get_matches([ tc.tcname for tc in all_tests ]) + ts = [ tc for tc in all_tests if tc.tcname in names ] + + elif criteria == 'class': + classes = get_matches([ tc.tcclass for tc in all_tests ]) + ts = [ tc for tc in all_tests if tc.tcclass in classes ] + + elif criteria == 'module': + modules = get_matches([ tc.tcmodule for tc in all_tests ]) + ts = [ tc for tc in all_tests if tc.tcmodule in modules ] + + elif criteria == 'id': + ids = get_matches([ str(tc.tcid) for tc in all_tests ]) + ts = [ tc for tc in all_tests if str(tc.tcid) in ids ] + + elif criteria == 'tag': + values = set() + for tc in all_tests: + # tc can have multiple tags (as tuple) otherwise str will suffice + if isinstance(tc.tctag, tuple): + values |= { str(tag) for tag in tc.tctag } + else: + values.add(str(tc.tctag)) + + tags = get_matches(list(values)) + + for tc in all_tests: + for tag in tags: + if isinstance(tc.tctag, tuple) and tag in tc.tctag: + ts.append(tc) + elif tag == tc.tctag: + ts.append(tc) + + # Remove duplicates from the list + ts = list(set(ts)) + + return ts + + +def list_testsuite_by(criteria, keyword): + # Get a testsuite based on 'keyword' + # criteria: name, class, module, id, tag + # keyword: a list of tests, classes, modules, ids, tags + def tc_key(t): + if t[0] is None: + return (0,) + t[1:] + return t + # tcid may be None if no ID was assigned, in which case sorted() will throw + # a TypeError as Python 3 does not allow comparison (<,<=,>=,>) of + # heterogeneous types, handle this by using a custom key generator + ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) \ + for tc in get_testsuite_by(criteria, keyword) ], key=tc_key) + print('_' * 150) + for t in ts: + if isinstance(t[1], (tuple, list)): + print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t[0], ', '.join(t[1]), t[2], t[3], t[4])) + else: + print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % t) + print('_' * 150) + print('Filtering by:\t %s' % criteria) + print('Looking for:\t %s' % ', '.join(str(x) for x in keyword)) + print('Total found:\t %s' % len(ts)) + + +def list_tests(): + # List all available oe-selftest tests + + ts = get_all_tests() + + print('%-4s\t%-10s\t%-50s' % ('id', 'tag', 'test')) + print('_' * 80) + for t in ts: + if isinstance(t.tctag, (tuple, list)): + print('%-4s\t%-10s\t%-50s' % (t.tcid, ', '.join(t.tctag), '.'.join([t.tcmodule, t.tcclass, t.tcname]))) + else: + print('%-4s\t%-10s\t%-50s' % (t.tcid, t.tctag, '.'.join([t.tcmodule, t.tcclass, t.tcname]))) + print('_' * 80) + print('Total found:\t %s' % len(ts)) + +def list_tags(): + # Get all tags set to test cases + # This is useful when setting tags to test cases + # The list of tags should be kept as minimal as possible + tags = set() + all_tests = get_all_tests() + + for tc in all_tests: + if isinstance(tc.tctag, (tuple, list)): + tags.update(set(tc.tctag)) + else: + tags.add(tc.tctag) + + print('Tags:\t%s' % ', '.join(str(x) for x in tags)) + +def coverage_setup(coverage_source, coverage_include, coverage_omit): + """ Set up the coverage measurement for the testcases to be run """ + import datetime + import subprocess + global builddir + pokydir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + curcommit= subprocess.check_output(["git", "--git-dir", os.path.join(pokydir, ".git"), "rev-parse", "HEAD"]).decode('utf-8') + coveragerc = "%s/.coveragerc" % builddir + data_file = "%s/.coverage." % builddir + data_file += datetime.datetime.now().strftime('%Y%m%dT%H%M%S') + if os.path.isfile(data_file): + os.remove(data_file) + with open(coveragerc, 'w') as cps: + cps.write("# Generated with command '%s'\n" % " ".join(sys.argv)) + cps.write("# HEAD commit %s\n" % curcommit.strip()) + cps.write("[run]\n") + cps.write("data_file = %s\n" % data_file) + cps.write("branch = True\n") + # Measure just BBLAYERS, scripts and bitbake folders + cps.write("source = \n") + if coverage_source: + for directory in coverage_source: + if not os.path.isdir(directory): + log.warn("Directory %s is not valid.", directory) + cps.write(" %s\n" % directory) + else: + for layer in get_bb_var('BBLAYERS').split(): + cps.write(" %s\n" % layer) + cps.write(" %s\n" % os.path.dirname(os.path.realpath(__file__))) + cps.write(" %s\n" % os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))),'bitbake')) + + if coverage_include: + cps.write("include = \n") + for pattern in coverage_include: + cps.write(" %s\n" % pattern) + if coverage_omit: + cps.write("omit = \n") + for pattern in coverage_omit: + cps.write(" %s\n" % pattern) + + return coveragerc + +def coverage_report(): + """ Loads the coverage data gathered and reports it back """ + try: + # Coverage4 uses coverage.Coverage + from coverage import Coverage + except: + # Coverage under version 4 uses coverage.coverage + from coverage import coverage as Coverage + + import io as StringIO + from coverage.misc import CoverageException + + cov_output = StringIO.StringIO() + # Creating the coverage data with the setting from the configuration file + cov = Coverage(config_file = os.environ.get('COVERAGE_PROCESS_START')) + try: + # Load data from the data file specified in the configuration + cov.load() + # Store report data in a StringIO variable + cov.report(file = cov_output, show_missing=False) + log.info("\n%s" % cov_output.getvalue()) + except CoverageException as e: + # Show problems with the reporting. Since Coverage4 not finding any data to report raises an exception + log.warn("%s" % str(e)) + finally: + cov_output.close() + + +def main(): + parser = get_args_parser() + args = parser.parse_args() + + # Add <layer>/lib to sys.path, so layers can add selftests + log.info("Running bitbake -e to get BBPATH") + bbpath = get_bb_var('BBPATH').split(':') + layer_libdirs = [p for p in (os.path.join(l, 'lib') for l in bbpath) if os.path.exists(p)] + sys.path.extend(layer_libdirs) + imp.reload(oeqa.selftest) + + # act like bitbake and enforce en_US.UTF-8 locale + os.environ["LC_ALL"] = "en_US.UTF-8" + + if args.run_tests_by and len(args.run_tests_by) >= 2: + valid_options = ['name', 'class', 'module', 'id', 'tag'] + if args.run_tests_by[0] not in valid_options: + print('--run-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.run_tests_by[0]) + return 1 + else: + criteria = args.run_tests_by[0] + keyword = args.run_tests_by[1:] + ts = sorted([ tc.fullpath for tc in get_testsuite_by(criteria, keyword) ]) + if not ts: + return 1 + + if args.list_tests_by and len(args.list_tests_by) >= 2: + valid_options = ['name', 'class', 'module', 'id', 'tag'] + if args.list_tests_by[0] not in valid_options: + print('--list-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.list_tests_by[0]) + return 1 + else: + criteria = args.list_tests_by[0] + keyword = args.list_tests_by[1:] + list_testsuite_by(criteria, keyword) + + if args.list_tests: + list_tests() + + if args.list_tags: + list_tags() + + if args.list_allclasses: + args.list_modules = True + + if args.list_modules: + log.info('Listing all available test modules:') + testslist = get_tests(include_hidden=True) + for test in testslist: + module = test.split('oeqa.selftest.')[-1] + info = '' + if module.startswith('_'): + info = ' (hidden)' + print(module + info) + if args.list_allclasses: + try: + import importlib + modlib = importlib.import_module(test) + for v in vars(modlib): + t = vars(modlib)[v] + if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest: + print(" --", v) + for method in dir(t): + if method.startswith("test_") and isinstance(vars(t)[method], collections.Callable): + print(" -- --", method) + + except (AttributeError, ImportError) as e: + print(e) + pass + + if args.run_tests or args.run_all_tests or args.run_tests_by: + if not preflight_check(): + return 1 + + if args.run_tests_by: + testslist = ts + else: + testslist = get_tests(exclusive_modules=(args.run_tests or []), include_hidden=False) + + suite = unittest.TestSuite() + loader = unittest.TestLoader() + loader.sortTestMethodsUsing = None + runner = TestRunner(verbosity=2, + resultclass=buildResultClass(args)) + # we need to do this here, otherwise just loading the tests + # will take 2 minutes (bitbake -e calls) + oeSelfTest.testlayer_path = get_test_layer() + for test in testslist: + log.info("Loading tests from: %s" % test) + try: + suite.addTests(loader.loadTestsFromName(test)) + except AttributeError as e: + log.error("Failed to import %s" % test) + log.error(e) + return 1 + add_include() + + if args.machine: + # Custom machine sets only weak default values (??=) for MACHINE in machine.inc + # This let test cases that require a specific MACHINE to be able to override it, using (?= or =) + log.info('Custom machine mode enabled. MACHINE set to %s' % args.machine) + if args.machine == 'random': + os.environ['CUSTOMMACHINE'] = 'random' + result = runner.run(suite) + else: # all + machines = get_available_machines() + for m in machines: + log.info('Run tests with custom MACHINE set to: %s' % m) + os.environ['CUSTOMMACHINE'] = m + result = runner.run(suite) + else: + result = runner.run(suite) + + log.info("Finished") + + if args.repository: + import git + # Commit tests results to repository + metadata = metadata_from_bb() + git_dir = os.path.join(os.getcwd(), 'selftest') + if not os.path.isdir(git_dir): + os.mkdir(git_dir) + + log.debug('Checking for git repository in %s' % git_dir) + try: + repo = git.Repo(git_dir) + except git.exc.InvalidGitRepositoryError: + log.debug("Couldn't find git repository %s; " + "cloning from %s" % (git_dir, args.repository)) + repo = git.Repo.clone_from(args.repository, git_dir) + + r_branches = repo.git.branch(r=True) + r_branches = set(r_branches.replace('origin/', '').split()) + l_branches = {str(branch) for branch in repo.branches} + branch = '%s/%s/%s' % (metadata['hostname'], + metadata['layers']['meta'].get('branch', '(nogit)'), + metadata['config']['MACHINE']) + + if branch in l_branches: + log.debug('Found branch in local repository, checking out') + repo.git.checkout(branch) + elif branch in r_branches: + log.debug('Found branch in remote repository, checking' + ' out and pulling') + repo.git.checkout(branch) + repo.git.pull() + else: + log.debug('New branch %s' % branch) + repo.git.checkout('master') + repo.git.checkout(b=branch) + + cleanResultsDir(repo) + xml_dir = os.path.join(os.getcwd(), log_prefix) + copyResultFiles(xml_dir, git_dir, repo) + metadata_file = os.path.join(git_dir, 'metadata.xml') + write_metadata_file(metadata_file, metadata) + repo.index.add([metadata_file]) + repo.index.write() + + # Get information for commit message + layer_info = '' + for layer, values in metadata['layers'].items(): + layer_info = '%s%-17s = %s:%s\n' % (layer_info, layer, + values.get('branch', '(nogit)'), values.get('commit', '0'*40)) + msg = 'Selftest for build %s of %s for machine %s on %s\n\n%s' % ( + log_prefix[12:], metadata['distro']['pretty_name'], + metadata['config']['MACHINE'], metadata['hostname'], layer_info) + + log.debug('Commiting results to local repository') + repo.index.commit(msg) + if not repo.is_dirty(): + try: + if branch in r_branches: + log.debug('Pushing changes to remote repository') + repo.git.push() + else: + log.debug('Pushing changes to remote repository ' + 'creating new branch') + repo.git.push('-u', 'origin', branch) + except GitCommandError: + log.error('Falied to push to remote repository') + return 1 + else: + log.error('Local repository is dirty, not pushing commits') + + if result.wasSuccessful(): + return 0 + else: + return 1 + +def buildResultClass(args): + """Build a Result Class to use in the testcase execution""" + import site + + class StampedResult(TestResult): + """ + Custom TestResult that prints the time when a test starts. As oe-selftest + can take a long time (ie a few hours) to run, timestamps help us understand + what tests are taking a long time to execute. + If coverage is required, this class executes the coverage setup and reporting. + """ + def startTest(self, test): + import time + self.stream.write(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + " - ") + super(StampedResult, self).startTest(test) + + def startTestRun(self): + """ Setup coverage before running any testcase """ + + # variable holding the coverage configuration file allowing subprocess to be measured + self.coveragepth = None + + # indicates the system if coverage is currently installed + self.coverage_installed = True + + if args.coverage or args.coverage_source or args.coverage_include or args.coverage_omit: + try: + # check if user can do coverage + import coverage + except: + log.warn("python coverage is not installed. More info on https://pypi.python.org/pypi/coverage") + self.coverage_installed = False + + if self.coverage_installed: + log.info("Coverage is enabled") + + major_version = int(coverage.version.__version__[0]) + if major_version < 4: + log.error("python coverage %s installed. Require version 4 or greater." % coverage.version.__version__) + self.stop() + # In case the user has not set the variable COVERAGE_PROCESS_START, + # create a default one and export it. The COVERAGE_PROCESS_START + # value indicates where the coverage configuration file resides + # More info on https://pypi.python.org/pypi/coverage + if not os.environ.get('COVERAGE_PROCESS_START'): + os.environ['COVERAGE_PROCESS_START'] = coverage_setup(args.coverage_source, args.coverage_include, args.coverage_omit) + + # Use default site.USER_SITE and write corresponding config file + site.ENABLE_USER_SITE = True + if not os.path.exists(site.USER_SITE): + os.makedirs(site.USER_SITE) + self.coveragepth = os.path.join(site.USER_SITE, "coverage.pth") + with open(self.coveragepth, 'w') as cps: + cps.write('import sys,site; sys.path.extend(site.getsitepackages()); import coverage; coverage.process_startup();') + + def stopTestRun(self): + """ Report coverage data after the testcases are run """ + + if args.coverage or args.coverage_source or args.coverage_include or args.coverage_omit: + if self.coverage_installed: + with open(os.environ['COVERAGE_PROCESS_START']) as ccf: + log.info("Coverage configuration file (%s)" % os.environ.get('COVERAGE_PROCESS_START')) + log.info("===========================") + log.info("\n%s" % "".join(ccf.readlines())) + + log.info("Coverage Report") + log.info("===============") + try: + coverage_report() + finally: + # remove the pth file + try: + os.remove(self.coveragepth) + except OSError: + log.warn("Expected temporal file from coverage is missing, ignoring removal.") + + return StampedResult + +def cleanResultsDir(repo): + """ Remove result files from directory """ + + xml_files = [] + directory = repo.working_tree_dir + for f in os.listdir(directory): + path = os.path.join(directory, f) + if os.path.isfile(path) and path.endswith('.xml'): + xml_files.append(f) + repo.index.remove(xml_files, working_tree=True) + +def copyResultFiles(src, dst, repo): + """ Copy result files from src to dst removing the time stamp. """ + + import shutil + + re_time = re.compile("-[0-9]+") + file_list = [] + + for root, subdirs, files in os.walk(src): + tmp_dir = root.replace(src, '').lstrip('/') + for s in subdirs: + os.mkdir(os.path.join(dst, tmp_dir, s)) + for f in files: + file_name = os.path.join(dst, tmp_dir, re_time.sub("", f)) + shutil.copy2(os.path.join(root, f), file_name) + file_list.append(file_name) + repo.index.add(file_list) + +class TestRunner(_TestRunner): + """Test runner class aware of exporting tests.""" + def __init__(self, *args, **kwargs): + try: + exportdir = os.path.join(os.getcwd(), log_prefix) + kwargsx = dict(**kwargs) + # argument specific to XMLTestRunner, if adding a new runner then + # also add logic to use other runner's args. + kwargsx['output'] = exportdir + kwargsx['descriptions'] = False + # done for the case where telling the runner where to export + super(TestRunner, self).__init__(*args, **kwargsx) + except TypeError: + log.info("test runner init'ed like unittest") + super(TestRunner, self).__init__(*args, **kwargs) + +if __name__ == "__main__": + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc() + finally: + remove_include() + remove_inc_files() + sys.exit(ret) diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir index a869fdc7c0..ef495517aa 100755 --- a/scripts/oe-setup-builddir +++ b/scripts/oe-setup-builddir @@ -23,94 +23,116 @@ if [ -z "$BUILDDIR" ]; then exit 1 fi -mkdir -p $BUILDDIR/conf +if [ "$1" = '--help' -o "$1" = '-h' ]; then + echo 'Usage: oe-setup-builddir' + echo '' + echo "OpenEmbedded setup-builddir - setup build directory $BUILDDIR" + echo '' + exit 2 +fi + +mkdir -p "$BUILDDIR/conf" -if ! (test -d "$BUILDDIR"); then +if [ ! -d "$BUILDDIR" ]; then echo >&2 "Error: The builddir ($BUILDDIR) does not exist!" exit 1 fi -if ! (test -w "$BUILDDIR"); then +if [ ! -w "$BUILDDIR" ]; then echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build" exit 1 fi +# Attempting removal of sticky,setuid bits from BUILDDIR, BUILDDIR/conf +chmod -st "$BUILDDIR" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR" +chmod -st "$BUILDDIR/conf" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR/conf" + cd "$BUILDDIR" -TEMPLATECONF=${TEMPLATECONF:-meta/conf} +if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then + TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg") +fi + +. $OEROOT/.templateconf + +if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then + echo "$TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg" +fi # # $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf # -if [ "x" != "x$TEMPLATECONF" ]; then - if ! (test -d "$TEMPLATECONF"); then - # Allow TEMPLATECONF=meta-xyz/conf as a shortcut - if [ -d "$OEROOT/$TEMPLATECONF" ]; then - TEMPLATECONF="$OEROOT/$TEMPLATECONF" - fi - if ! (test -d "$TEMPLATECONF"); then - echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf" - return - fi +if [ -n "$TEMPLATECONF" ]; then + if [ ! -d "$TEMPLATECONF" ]; then + # Allow TEMPLATECONF=meta-xyz/conf as a shortcut + if [ -d "$OEROOT/$TEMPLATECONF" ]; then + TEMPLATECONF="$OEROOT/$TEMPLATECONF" + fi + if [ ! -d "$TEMPLATECONF" ]; then + echo >&2 "Error: TEMPLATECONF value points to nonexistent directory '$TEMPLATECONF'" + exit 1 + fi fi OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample" OECORELOCALCONF="$TEMPLATECONF/local.conf.sample" OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt" fi -if [ "x" = "x$OECORELOCALCONF" ]; then +unset SHOWYPDOC +if [ -z "$OECORELOCALCONF" ]; then OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample" fi -if ! (test -r "$BUILDDIR/conf/local.conf"); then -cat <<EOM +if [ ! -r "$BUILDDIR/conf/local.conf" ]; then + cat <<EOM You had no conf/local.conf file. This configuration file has therefore been -created for you with some default values. You may wish to edit it to use a -different MACHINE (target hardware) or enable parallel build options to take -advantage of multiple cores for example. See the file for more information as -common configuration options are commented. - -The Yocto Project has extensive documentation about OE including a reference manual -which can be found at: - http://yoctoproject.org/documentation - -For more information about OpenEmbedded see their website: - http://www.openembedded.org/ +created for you with some default values. You may wish to edit it to, for +example, select a different MACHINE (target hardware). See conf/local.conf +for more information as common configuration options are commented. EOM - cp -f $OECORELOCALCONF $BUILDDIR/conf/local.conf + cp -f $OECORELOCALCONF "$BUILDDIR/conf/local.conf" + SHOWYPDOC=yes fi -if [ "x" = "x$OECORELAYERCONF" ]; then +if [ -z "$OECORELAYERCONF" ]; then OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample" fi -if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then -cat <<EOM -You had no conf/bblayers.conf file. The configuration file has been created for -you with some default values. To add additional metadata layers into your -configuration please add entries to this file. - -The Yocto Project has extensive documentation about OE including a reference manual -which can be found at: - http://yoctoproject.org/documentation - -For more information about OpenEmbedded see their website: - http://www.openembedded.org/ - +if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then + cat <<EOM +You had no conf/bblayers.conf file. This configuration file has therefore been +created for you with some default values. To add additional metadata layers +into your configuration please add entries to conf/bblayers.conf. EOM # Put the abosolute path to the layers in bblayers.conf so we can run # bitbake without the init script after the first run - sed "s|##OEROOT##|$OEROOT|g" $OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf # ##COREBASE## is deprecated as it's meaning was inconsistent, but continue # to replace it for compatibility. - sed -i -e "s|##COREBASE##|$OEROOT|g" $BUILDDIR/conf/bblayers.conf + sed -e "s|##OEROOT##|$OEROOT|g" \ + -e "s|##COREBASE##|$OEROOT|g" \ + $OECORELAYERCONF > "$BUILDDIR/conf/bblayers.conf" + SHOWYPDOC=yes fi # Prevent disturbing a new GIT clone in same console unset OECORELOCALCONF unset OECORELAYERCONF +# Ending the first-time run message. Show the YP Documentation banner. +if [ ! -z "$SHOWYPDOC" ]; then + cat <<EOM +The Yocto Project has extensive documentation about OE including a reference +manual which can be found at: + http://yoctoproject.org/documentation + +For more information about OpenEmbedded see their website: + http://www.openembedded.org/ + +EOM +# unset SHOWYPDOC +fi + cat <<EOM ### Shell environment set up for builds. ### @@ -118,7 +140,7 @@ cat <<EOM You can now run 'bitbake <target>' EOM -if [ "x" = "x$OECORENOTESCONF" ]; then +if [ -z "$OECORENOTESCONF" ]; then OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt" fi [ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF diff --git a/scripts/oe-setup-rpmrepo b/scripts/oe-setup-rpmrepo index ea885f6325..df1c61435c 100755 --- a/scripts/oe-setup-rpmrepo +++ b/scripts/oe-setup-rpmrepo @@ -23,16 +23,6 @@ # Instead, use OE_TMPDIR for passing this in externally. TMPDIR="$OE_TMPDIR" -function usage() { - echo "Usage: $0 <rpm-dir>" - echo " <rpm-dir>: default is $TMPDIR/deploy/rpm" -} - -if [ $# -gt 1 ]; then - usage - exit 1 -fi - setup_tmpdir() { if [ -z "$TMPDIR" ]; then # Try to get TMPDIR from bitbake @@ -53,6 +43,23 @@ setup_tmpdir() { fi } +setup_tmpdir + +function usage() { + echo 'Usage: oe-setup-rpmrepo rpm-dir' + echo '' + echo 'OpenEmbedded setup-rpmrepo - setup rpm repository' + echo '' + echo 'arguments:' + echo " rpm-dir rpm repo directory, default is $TMPDIR/deploy/rpm" + echo '' +} + +if [ $# -gt 1 -o "$1" = '--help' -o "$1" = '-h' ]; then + usage + exit 2 +fi + setup_sysroot() { # Toolchain installs set up $OECORE_NATIVE_SYSROOT in their # environment script. If that variable isn't set, we're @@ -68,7 +75,6 @@ setup_sysroot() { fi } -setup_tmpdir setup_sysroot @@ -83,13 +89,14 @@ if [ ! -d "$RPM_DIR" ]; then exit 1 fi -CREATEREPO=$OECORE_NATIVE_SYSROOT/usr/bin/createrepo +CREATEREPO=$OECORE_NATIVE_SYSROOT/usr/bin/createrepo_c if [ ! -e "$CREATEREPO" ]; then echo "Error: can't find createrepo binary" echo "please run bitbake createrepo-native first" exit 1 fi +export PATH=${PATH}:${OECORE_NATIVE_SYSROOT}/usr/bin $CREATEREPO "$RPM_DIR" diff --git a/scripts/oe-test b/scripts/oe-test new file mode 100755 index 0000000000..a1d282db33 --- /dev/null +++ b/scripts/oe-test @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 + +# OpenEmbedded test tool +# +# Copyright (C) 2016 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import os +import sys +import argparse +import importlib +import logging + +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import argparse_oe +import scriptutils + +# oe-test is used for testexport and it doesn't have oe lib +# so we just skip adding these libraries (not used in testexport) +try: + import scriptpath + scriptpath.add_oe_lib_path() +except ImportError: + pass + +from oeqa.core.context import OETestContextExecutor + +logger = scriptutils.logger_create('oe-test') + +def _load_test_components(logger): + components = {} + + for path in sys.path: + base_dir = os.path.join(path, 'oeqa') + if os.path.exists(base_dir) and os.path.isdir(base_dir): + for file in os.listdir(base_dir): + comp_name = file + comp_context = os.path.join(base_dir, file, 'context.py') + if os.path.exists(comp_context): + comp_plugin = importlib.import_module('oeqa.%s.%s' % \ + (comp_name, 'context')) + try: + if not issubclass(comp_plugin._executor_class, + OETestContextExecutor): + raise TypeError("Component %s in %s, _executor_class "\ + "isn't derived from OETestContextExecutor."\ + % (comp_name, comp_context)) + + components[comp_name] = comp_plugin._executor_class() + except AttributeError: + raise AttributeError("Component %s in %s don't have "\ + "_executor_class defined." % (comp_name, comp_context)) + + return components + +def main(): + parser = argparse_oe.ArgumentParser(description="OpenEmbedded test tool", + add_help=False, + epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') + parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') + global_args, unparsed_args = parser.parse_known_args() + + # Help is added here rather than via add_help=True, as we don't want it to + # be handled by parse_known_args() + parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, + help='show this help message and exit') + + if global_args.debug: + logger.setLevel(logging.DEBUG) + elif global_args.quiet: + logger.setLevel(logging.ERROR) + + components = _load_test_components(logger) + + subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>') + subparsers.add_subparser_group('components', 'Test components') + subparsers.required = True + for comp_name in sorted(components.keys()): + comp = components[comp_name] + comp.register_commands(logger, subparsers) + + try: + args = parser.parse_args(unparsed_args, namespace=global_args) + results = args.func(logger, args) + ret = 0 if results.wasSuccessful() else 1 + except SystemExit as err: + if err.code != 0: + raise err + ret = err.code + except argparse_oe.ArgumentUsageError as ae: + parser.error_subcommand(ae.message, ae.subcommand) + + return ret + +if __name__ == '__main__': + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc() + sys.exit(ret) diff --git a/scripts/oe-trim-schemas b/scripts/oe-trim-schemas index 29fb3a1b67..7c199ef1df 100755 --- a/scripts/oe-trim-schemas +++ b/scripts/oe-trim-schemas @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 import sys try: @@ -18,6 +18,15 @@ def children (elem, name=None): l = [e for e in l if e.tag == name] return l +if len(sys.argv) < 2 or sys.argv[1] in ('-h', '--help'): + print('oe-trim-schemas: error: the following arguments are required: schema\n' + 'Usage: oe-trim-schemas schema\n\n' + 'OpenEmbedded trim schemas - remove unneeded schema locale translations\n' + ' from gconf schema files\n\n' + 'arguments:\n' + ' schema gconf schema file to trim\n') + sys.exit(2) + xml = etree.parse(sys.argv[1]) for schema in child(xml.getroot(), "schemalist").getchildren(): diff --git a/scripts/oepydevshell-internal.py b/scripts/oepydevshell-internal.py new file mode 100755 index 0000000000..04621ae8a1 --- /dev/null +++ b/scripts/oepydevshell-internal.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 + +import os +import sys +import time +import select +import fcntl +import termios +import readline +import signal + +def nonblockingfd(fd): + fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK) + +def echonocbreak(fd): + old = termios.tcgetattr(fd) + old[3] = old[3] | termios.ECHO | termios.ICANON + termios.tcsetattr(fd, termios.TCSADRAIN, old) + +def cbreaknoecho(fd): + old = termios.tcgetattr(fd) + old[3] = old[3] &~ termios.ECHO &~ termios.ICANON + termios.tcsetattr(fd, termios.TCSADRAIN, old) + +if len(sys.argv) != 3 or sys.argv[1] in ('-h', '--help'): + print('oepydevshell-internal.py: error: the following arguments are required: pty, pid\n' + 'Usage: oepydevshell-internal.py pty pid\n\n' + 'OpenEmbedded oepydevshell-internal.py - internal script called from meta/classes/devshell.bbclass\n\n' + 'arguments:\n' + ' pty pty device name\n' + ' pid parent process id\n\n' + 'options:\n' + ' -h, --help show this help message and exit\n') + sys.exit(2) + +pty = open(sys.argv[1], "w+b", 0) +parent = int(sys.argv[2]) + +nonblockingfd(pty) +nonblockingfd(sys.stdin) + + +histfile = os.path.expanduser("~/.oedevpyshell-history") +readline.parse_and_bind("tab: complete") +try: + readline.read_history_file(histfile) +except IOError: + pass + +try: + + i = "" + o = "" + # Need cbreak/noecho whilst in select so we trigger on any keypress + cbreaknoecho(sys.stdin.fileno()) + # Send our PID to the other end so they can kill us. + pty.write(str(os.getpid()).encode('utf-8') + b"\n") + while True: + try: + writers = [] + if i: + writers.append(sys.stdout) + (ready, _, _) = select.select([pty, sys.stdin], writers , [], 0) + try: + if pty in ready: + i = i + pty.read().decode('utf-8') + if i: + # Write a page at a time to avoid overflowing output + # d.keys() is a good way to do that + sys.stdout.write(i[:4096]) + sys.stdout.flush() + i = i[4096:] + if sys.stdin in ready: + echonocbreak(sys.stdin.fileno()) + o = input().encode('utf-8') + cbreaknoecho(sys.stdin.fileno()) + pty.write(o + b"\n") + except (IOError, OSError) as e: + if e.errno == 11: + continue + if e.errno == 5: + sys.exit(0) + raise + except EOFError: + sys.exit(0) + except KeyboardInterrupt: + os.kill(parent, signal.SIGINT) + +except SystemExit: + pass +except Exception as e: + import traceback + print("Exception in oepydehshell-internal: " + str(e)) + traceback.print_exc() + time.sleep(5) +finally: + readline.write_history_file(histfile) diff --git a/scripts/opkg-query-helper.py b/scripts/opkg-query-helper.py index fa6c44fa8b..ce89491f60 100755 --- a/scripts/opkg-query-helper.py +++ b/scripts/opkg-query-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # OpenEmbedded opkg query helper utility # @@ -28,6 +28,7 @@ import re archmode = False filemode = False +vermode = False args = [] for arg in sys.argv[1:]: @@ -35,6 +36,8 @@ for arg in sys.argv[1:]: archmode = True elif arg == '-f': filemode = True + elif arg == '-v': + vermode = True else: args.append(arg) @@ -60,6 +63,12 @@ for line in fileinput.input(args): elif line.startswith("Architecture:"): arch = line.split(": ")[1] print("%s %s_%s_%s.ipk %s" % (pkg,pkg,ver,arch,arch)) + elif vermode: + if line.startswith("Version:"): + ver = line.split(": ")[1] + elif line.startswith("Architecture:"): + arch = line.split(": ")[1] + print("%s %s %s" % (pkg,arch,ver)) else: if line.startswith("Depends:"): depval = line.split(": ")[1] diff --git a/scripts/postinst-intercepts/postinst_intercept b/scripts/postinst-intercepts/postinst_intercept index 27c256834c..b18e806d43 100755 --- a/scripts/postinst-intercepts/postinst_intercept +++ b/scripts/postinst-intercepts/postinst_intercept @@ -41,14 +41,14 @@ fi chmod +x "$intercept_script" -pkgs_line="$(cat $intercept_script|grep "##PKGS:")" +pkgs_line=$(grep "##PKGS:" $intercept_script) if [ -n "$pkgs_line" ]; then # line exists, add this package to the list only if it's not already there if [ -z "$(echo "$pkgs_line" | grep " $package_name ")" ]; then sed -i -e "s/##PKGS:.*/\0${package_name} /" $intercept_script fi else - for var in $@; do + for var in "$@"; do sed -i -e "\%^#\!/bin/.*sh%a $var" $intercept_script done echo "##PKGS: ${package_name} " >> $intercept_script diff --git a/scripts/postinst-intercepts/update_font_cache b/scripts/postinst-intercepts/update_font_cache index afc93d80a5..bf65e19a41 100644 --- a/scripts/postinst-intercepts/update_font_cache +++ b/scripts/postinst-intercepts/update_font_cache @@ -1,6 +1,7 @@ #!/bin/sh -PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D/${libdir}:$D/${base_libdir}\ - $D${bindir}/fc-cache --sysroot=$D >/dev/null 2>&1 - +set -e +PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D/${libdir}:$D/${base_libdir} \ + -E ${fontconfigcacheenv} $D${bindir}/fc-cache --sysroot=$D --system-only ${fontconfigcacheparams} +chown -R root:root $D${fontconfigcachedir} diff --git a/scripts/postinst-intercepts/update_gio_module_cache b/scripts/postinst-intercepts/update_gio_module_cache new file mode 100644 index 0000000000..fc3f9d0d6c --- /dev/null +++ b/scripts/postinst-intercepts/update_gio_module_cache @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D${libdir}:$D${base_libdir} \ + $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/ + +[ ! -e $D${libdir}/gio/modules/giomodule.cache ] || + chown root:root $D${libdir}/gio/modules/giomodule.cache diff --git a/scripts/postinst-intercepts/update_icon_cache b/scripts/postinst-intercepts/update_icon_cache index 8e17a6ac0c..9cf2a72a0c 100644 --- a/scripts/postinst-intercepts/update_icon_cache +++ b/scripts/postinst-intercepts/update_icon_cache @@ -1,8 +1,9 @@ #!/bin/sh set -e + # update native pixbuf loaders -gdk-pixbuf-query-loaders --update-cache +$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache for icondir in $D/usr/share/icons/*/ ; do if [ -d $icondir ] ; then diff --git a/scripts/postinst-intercepts/update_pixbuf_cache b/scripts/postinst-intercepts/update_pixbuf_cache index bd94fe88dd..5d44075fb4 100644 --- a/scripts/postinst-intercepts/update_pixbuf_cache +++ b/scripts/postinst-intercepts/update_pixbuf_cache @@ -1,10 +1,11 @@ #!/bin/sh +set -e + export GDK_PIXBUF_MODULEDIR=$D${libdir}/gdk-pixbuf-2.0/2.10.0/loaders +export GDK_PIXBUF_FATAL_LOADER=1 PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D/${libdir}:$D/${base_libdir}\ - $D${bindir}/gdk-pixbuf-query-loaders \ - >$GDK_PIXBUF_MODULEDIR/../loaders.cache 2>/dev/null && \ + $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \ + >$GDK_PIXBUF_MODULEDIR/../loaders.cache && \ sed -i -e "s:$D::g" $GDK_PIXBUF_MODULEDIR/../loaders.cache - - diff --git a/scripts/pybootchartgui/AUTHORS b/scripts/pybootchartgui/AUTHORS index 45bd1ac823..672b7e9520 100644 --- a/scripts/pybootchartgui/AUTHORS +++ b/scripts/pybootchartgui/AUTHORS @@ -1,11 +1,11 @@ +Michael Meeks <michael.meeks@novell.com> Anders Norgaard <anders.norgaard@gmail.com> +Scott James Remnant <scott@ubuntu.com> Henning Niss <henningniss@gmail.com> - - +Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> Contributors: -Brian Ewins - + Brian Ewins Based on work by: -Ziga Mahkovec + Ziga Mahkovec diff --git a/scripts/pybootchartgui/COPYING b/scripts/pybootchartgui/COPYING index 94a9ed024d..ed87acf948 100644 --- a/scripts/pybootchartgui/COPYING +++ b/scripts/pybootchartgui/COPYING @@ -1,626 +1,285 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to this License. - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -628,15 +287,15 @@ free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least +convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> - This program is free software: you can redistribute it and/or modify + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -645,30 +304,37 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Also add information on how to contact you by electronic and paper mail. - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/scripts/pybootchartgui/MAINTAINERS b/scripts/pybootchartgui/MAINTAINERS new file mode 100644 index 0000000000..c65e1315f1 --- /dev/null +++ b/scripts/pybootchartgui/MAINTAINERS @@ -0,0 +1,3 @@ +Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> +Michael Meeks <michael.meeks@novell.com> +Harald Hoyer <harald@redhat.com> diff --git a/scripts/pybootchartgui/NEWS b/scripts/pybootchartgui/NEWS new file mode 100644 index 0000000000..7c5b2fc3a1 --- /dev/null +++ b/scripts/pybootchartgui/NEWS @@ -0,0 +1,204 @@ +bootchart2 0.14.5: + + pybootchartgui (Riccardo) + + Fix tests with python3 + + Fix parsing of files with non-ascii bytes + + Robustness fixes to taskstats and meminfo parsing + + More python3 fixes + +bootchart2 0.14.4: + + bootchartd + + Add relevant EXIT_PROC for GNOME3, XFCE4, openbox + (Justin Lecher, Ben Eills) + + pybootchartgui (Riccardo) + + Fix some issues in --crop-after and --annotate + + Fix pybootchartgui process_tree tests + + More python3 fixes + +bootchart2 0.14.2: + + pybootchartgui + + Fix some crashes in parsing.py (Jakub Czaplicki, Riccardo) + + speedup a bit meminfo parsing (Riccardo) + + Fix indentation for python3.2 (Riccardo) + +bootchart2 0.14.1: + + bootchartd + + Expect dmesg only if started as init (Henry Yei) + + look for bootchart_init in the environment (Henry Gebhardt) + + pybootchartgui + + Fixup some tests (Riccardo) + + Support hp smart arrays block devices (Anders Norgaard, + Brian Murray) + + Fixes for -t, -o and -f options (Mladen Kuntner, Harald, Riccardo) + +bootchart2 0.14.0: + + bootchartd + + Add ability to define custom commands + (Lucian Muresan, Peter Hjalmarsson) + + collector + + fix tmpfs mount leakage (Peter Hjalmarsson) + + pybootchartgui + + render cumulative I/O time chart (Sankar P) + + python3 compatibility fixes (Riccardo) + + Misc (Michael) + + remove confusing, obsolete setup.py + + install docs to /usr/share/ + + lot of fixes for easier packaging (Peter Hjalmarsson) + + add bootchart2, bootchartd and pybootchartgui manpages + (Francesca Ciceri, David Paleino) + +bootchart2 0.12.6: + + bootchartd + + better check for initrd (Riccardo Magliocchetti) + + code cleanup (Riccardo) + + make the list of processes we are waiting for editable + in config file by EXIT_PROC (Riccardo) + + fix parsing of cmdline for alternative init system (Riccardo) + + fixed calling init in initramfs (Harald) + + exit 0 for start, if the collector is already running (Harald) + + collector + + try harder with taskstats (Michael) + + plug some small leaks (Riccardo) + + fix missing PROC_EVENTS detection (Harald) + + pybootchartgui (Michael) + + add kernel bootchart tab to interactive gui + + report bootchart version in cli interface + + improve rendering performance + + GUI improvements + + lot of cleanups + + Makefile + + do not python compile if NO_PYTHON_COMPILE is set (Harald) + + systemd service files + + added them and install (Harald, Wulf C. Krueger) + +bootchart2 0.12.5: + + administrative snafu version; pull before pushing... + +bootchart2 0.12.4: + + bootchartd + + reduce overhead caused by pidof (Riccardo Magliocchetti) + + collector + + attempt to retry ptrace to avoid bogus ENOSYS (Michael) + + add meminfo polling (Dave Martin) + + pybootchartgui + + handle dmesg timestamps with big delta (Riccardo) + + avoid divide by zero when rendering I/O utilization (Riccardo) + + add process grouping in the cumulative chart (Riccardo) + + fix cpu time calculation in cumulative chart (Riccardo) + + get i/o statistics for flash based devices (Riccardo) + + prettier coloring for the cumulative graphs (Michael) + + fix interactive CPU rendering (Michael) + + render memory usage graph (Dave Martin) + +bootchart2 0.12.3 + + collector + + pclose after popen (Riccardo Magliocchetti (xrmx)) + + fix buffer overflow (xrmx) + + count 'processor:' in /proc/cpuinfo for ARM (Michael) + + get model name from that line too for ARM (xrmx) + + store /proc/cpuinfo in the boot-chart archive (xrmx) + + try harder to detect missing TASKSTATS (Michael) + + sanity-check invalid domain names (Michael) + + detect missing PROC_EVENTS more reliably (Michael) + + README fixes (xrmx, Michael) + + pybootchartgui + + make num_cpu parsing robust (Michael) + +bootchart2 0.12.2 + + fix pthread compile / linking bug + +bootchart2 0.12.1 + + pybootchartgui + + pylint cleanup + + handle empty traces more elegantly + + add '-t' / '--boot-time' argument (Matthew Bauer) + + collector + + now GPLv2 + + add rdinit support for very early initrd tracing + + cleanup / re-factor code into separate modules + + re-factor arg parsing, and parse remote process args + + handle missing bootchartd.conf cleanly + + move much of bootchartd from shell -> C + + drop dmesg and uname usage + + avoid rpm/dpkg with native version reporting + +bootchart2 0.12.0 (Michael Meeks) + + collector + + use netlink PROC_EVENTS to generate parentage data + + finally kills any need for 'acct' et. al. + + also removes need to poll /proc => faster + + cleanup code to K&R, 8 stop tabs. + + pybootchartgui + + consume thread parentage data + +bootchart2 0.11.4 (Michael Meeks) + + collector + + if run inside an initrd detect when /dev is writable + and remount ourselves into that. + + overflow buffers more elegantly in extremis + + dump full process path and command-line args + + calm down debugging output + + pybootchartgui + + can render logs in a directory again + + has a 'show more' option to show command-lines + +bootchart2 0.11.3 (Michael Meeks) + + add $$ display to the bootchart header + + process command-line bits + + fix collection code, and rename stream to match + + enable parsing, add check button to UI, and --show-all + command-line option + + fix parsing of directories full of files. + +bootchart2 0.11.2 (Michael Meeks) + + fix initrd sanity check to use the right proc path + + don't return a bogus error value when dumping state + + add -c to aid manual console debugging + +bootchart2 0.11.1 (Michael Meeks) + + even simpler initrd setup + + create a single directory: /lib/bootchart/tmpfs + +bootchart2 0.11 (Michael Meeks) + + bootchartd + + far, far simpler, less shell, more robustness etc. + + bootchart-collector + + remove the -p argument - we always mount proc + + requires /lib/bootchart (make install-chroot) to + be present (also in the initrd) [ with a kmsg + node included ] + + add a --probe-running mode + + ptrace re-write + + gives -much- better early-boot-time resolution + + unconditional chroot /lib/bootchart/chroot + + we mount proc there ourselves + + log extraction requires no common file-system view + + +bootchart2 0.10.1 (Kel Modderman) + + collector arg -m should mount /proc + + remove bogus vcsid code + + split collector install in Makefile + + remove bogus debug code + + accept process names containing spaces + +bootchart2 0.10.0 + + rendering (Anders Norgaard) + + fix for unknown exceptions + + interactive UI (Michael) + + much faster rendering by manual clipping + + horizontal scaling + + remove annoying page-up/down bindings + + initrd portability & fixes (Federic Crozat) + + port to Mandriva + + improved process waiting + + inittab commenting fix + + improved initrd detection / jail tagging + + fix for un-detectable accton behaviour change + + implement a built-in usleep to help initrd deps (Michael) + +bootchart2 0.0.9 + + fix initrd bug + +bootchart2 0.0.8 + + add a filename string to the window title in interactive mode + + add a NEWS file diff --git a/scripts/pybootchartgui/README b/scripts/pybootchartgui/README.pybootchart index 1b97c442f3..8642e64679 100644 --- a/scripts/pybootchartgui/README +++ b/scripts/pybootchartgui/README.pybootchart @@ -1,13 +1,14 @@ PYBOOTCHARTGUI ---------------- -pybootchartgui is a tool for visualization and analysis of the -GNU/Linux boot process. It renders the output of the boot-logger tool -bootchart (see http://www.bootchart.org/) to either the screen or -files of various formats. Bootchart collects information about the -processes, their dependencies, and resource consumption during boot of -a GNU/Linux system. The pybootchartgui tools visualizes the process -tree and overall resource utilization. +pybootchartgui is a tool (now included as part of bootchart2) for +visualization and analysis of the GNU/Linux boot process. It renders +the output of the boot-logger tool bootchart (see +http://www.bootchart.org/) to either the screen or files of various +formats. Bootchart collects information about the processes, their +dependencies, and resource consumption during boot of a GNU/Linux +system. The pybootchartgui tools visualizes the process tree and +overall resource utilization. pybootchartgui is a port of the visualization part of bootchart from Java to Python and Cairo. @@ -32,5 +33,5 @@ To get help for pybootchartgui, run $ pybootchartgui --help - -http://code.google.com/p/pybootchartgui/ +This code was originally hosted at: + http://code.google.com/p/pybootchartgui/ diff --git a/scripts/pybootchartgui/pybootchartgui.py b/scripts/pybootchartgui/pybootchartgui.py index f301027805..7ce1a5be40 100755 --- a/scripts/pybootchartgui/pybootchartgui.py +++ b/scripts/pybootchartgui/pybootchartgui.py @@ -1,4 +1,20 @@ -#!/usr/bin/python +#!/usr/bin/env python +# +# This file is part of pybootchartgui. + +# pybootchartgui is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# pybootchartgui is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. + import sys from pybootchartgui.main import main diff --git a/scripts/pybootchartgui/pybootchartgui/batch.py b/scripts/pybootchartgui/pybootchartgui/batch.py index 3c1dbf8416..05c714e95e 100644 --- a/scripts/pybootchartgui/pybootchartgui/batch.py +++ b/scripts/pybootchartgui/pybootchartgui/batch.py @@ -1,23 +1,46 @@ -import cairo +# This file is part of pybootchartgui. + +# pybootchartgui is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# pybootchartgui is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. -import draw +# You should have received a copy of the GNU General Public License +# along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. -def render(res, format, filename): +import cairo +from . import draw +from .draw import RenderOptions + +def render(writer, trace, app_options, filename): handlers = { - "png": (lambda w,h: cairo.ImageSurface(cairo.FORMAT_ARGB32,w,h), lambda sfc: sfc.write_to_png(filename)), - "pdf": (lambda w,h: cairo.PDFSurface(filename, w, h), lambda sfc: 0), - "svg": (lambda w,h: cairo.SVGSurface(filename, w, h), lambda sfc: 0) + "png": (lambda w, h: cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h), \ + lambda sfc: sfc.write_to_png(filename)), + "pdf": (lambda w, h: cairo.PDFSurface(filename, w, h), lambda sfc: 0), + "svg": (lambda w, h: cairo.SVGSurface(filename, w, h), lambda sfc: 0) } - if not(handlers.has_key(format)): - print "Unknown format '%s'." % format + if app_options.format is None: + fmt = filename.rsplit('.', 1)[1] + else: + fmt = app_options.format + + if not (fmt in handlers): + writer.error ("Unknown format '%s'." % fmt) return 10 - make_surface, write_surface = handlers[format] - w,h = draw.extents(res) - w = max(w, draw.MIN_IMG_W) - surface = make_surface(w,h) - ctx = cairo.Context(surface) - draw.render(ctx, res) - write_surface(surface) + make_surface, write_surface = handlers[fmt] + options = RenderOptions (app_options) + (w, h) = draw.extents (options, 1.0, trace) + w = max (w, draw.MIN_IMG_W) + surface = make_surface (w, h) + ctx = cairo.Context (surface) + draw.render (ctx, options, 1.0, trace) + write_surface (surface) + writer.status ("bootchart written to '%s'" % filename) diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py index 1b872de75e..201ce4577f 100644 --- a/scripts/pybootchartgui/pybootchartgui/draw.py +++ b/scripts/pybootchartgui/pybootchartgui/draw.py @@ -1,6 +1,40 @@ +# This file is part of pybootchartgui. + +# pybootchartgui is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# pybootchartgui is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. + + import cairo import math import re +import random +import colorsys +from operator import itemgetter + +class RenderOptions: + + def __init__(self, app_options): + # should we render a cumulative CPU time chart + self.cumulative = True + self.charts = True + self.kernel_only = False + self.app_options = app_options + + def proc_tree (self, trace): + if self.kernel_only: + return trace.kernel_tree + else: + return trace.proc_tree # Process tree background color. BACK_COLOR = (1.0, 1.0, 1.0, 1.0) @@ -12,11 +46,13 @@ BORDER_COLOR = (0.63, 0.63, 0.63, 1.0) TICK_COLOR = (0.92, 0.92, 0.92, 1.0) # 5-second tick line color. TICK_COLOR_BOLD = (0.86, 0.86, 0.86, 1.0) +# Annotation colour +ANNOTATION_COLOR = (0.63, 0.0, 0.0, 0.5) # Text color. TEXT_COLOR = (0.0, 0.0, 0.0, 1.0) # Font family -FONT_NAME = "Bitstream Vera Sans" +FONT_NAME = "Bitstream Vera Sans" # Title text font. TITLE_FONT_SIZE = 18 # Default text font. @@ -25,7 +61,7 @@ TEXT_FONT_SIZE = 12 AXIS_FONT_SIZE = 11 # Legend font. LEGEND_FONT_SIZE = 12 - + # CPU load chart color. CPU_COLOR = (0.40, 0.55, 0.70, 1.0) # IO wait chart color. @@ -34,11 +70,19 @@ IO_COLOR = (0.76, 0.48, 0.48, 0.5) DISK_TPUT_COLOR = (0.20, 0.71, 0.20, 1.0) # CPU load chart color. FILE_OPEN_COLOR = (0.20, 0.71, 0.71, 1.0) - +# Mem cached color +MEM_CACHED_COLOR = CPU_COLOR +# Mem used color +MEM_USED_COLOR = IO_COLOR +# Buffers color +MEM_BUFFERS_COLOR = (0.4, 0.4, 0.4, 0.3) +# Swap color +MEM_SWAP_COLOR = DISK_TPUT_COLOR + # Process border color. PROC_BORDER_COLOR = (0.71, 0.71, 0.71, 1.0) - -PROC_COLOR_D = (0.76, 0.48, 0.48, 0.125) +# Waiting process color. +PROC_COLOR_D = (0.76, 0.48, 0.48, 0.5) # Running process color. PROC_COLOR_R = CPU_COLOR # Sleeping process color. @@ -62,8 +106,8 @@ SIG_COLOR = (0.0, 0.0, 0.0, 0.3125) # Signature font. SIG_FONT_SIZE = 14 # Signature text. -SIGNATURE = "http://code.google.com/p/pybootchartgui" - +SIGNATURE = "http://github.com/mmeeks/bootchart" + # Process dependency line color. DEP_COLOR = (0.75, 0.75, 0.75, 1.0) # Process dependency line stroke. @@ -72,16 +116,32 @@ DEP_STROKE = 1.0 # Process description date format. DESC_TIME_FORMAT = "mm:ss.SSS" +# Cumulative coloring bits +HSV_MAX_MOD = 31 +HSV_STEP = 7 + # Configure task color TASK_COLOR_CONFIGURE = (1.0, 1.0, 0.00, 1.0) # Compile task color. TASK_COLOR_COMPILE = (0.0, 1.00, 0.00, 1.0) # Install task color TASK_COLOR_INSTALL = (1.0, 0.00, 1.00, 1.0) -# Package task color -TASK_COLOR_PACKAGE = (0.0, 1.00, 1.00, 1.0) # Sysroot task color TASK_COLOR_SYSROOT = (0.0, 0.00, 1.00, 1.0) +# Package task color +TASK_COLOR_PACKAGE = (0.0, 1.00, 1.00, 1.0) +# Package Write RPM/DEB/IPK task color +TASK_COLOR_PACKAGE_WRITE = (0.0, 0.50, 0.50, 1.0) + +# Distinct colors used for different disk volumnes. +# If we have more volumns, colors get re-used. +VOLUME_COLORS = [ + (1.0, 1.0, 0.00, 1.0), + (0.0, 1.00, 0.00, 1.0), + (1.0, 0.00, 1.00, 1.0), + (0.0, 0.00, 1.00, 1.0), + (0.0, 1.00, 1.00, 1.0), +] # Process states STATE_UNDEFINED = 0 @@ -91,69 +151,79 @@ STATE_WAITING = 3 STATE_STOPPED = 4 STATE_ZOMBIE = 5 -STATE_COLORS = [(0,0,0,0), PROC_COLOR_R, PROC_COLOR_S, PROC_COLOR_D, PROC_COLOR_T, PROC_COLOR_Z, PROC_COLOR_X, PROC_COLOR_W] +STATE_COLORS = [(0, 0, 0, 0), PROC_COLOR_R, PROC_COLOR_S, PROC_COLOR_D, \ + PROC_COLOR_T, PROC_COLOR_Z, PROC_COLOR_X, PROC_COLOR_W] + +# CumulativeStats Types +STAT_TYPE_CPU = 0 +STAT_TYPE_IO = 1 # Convert ps process state to an int def get_proc_state(flag): - return "RSDTZXW".index(flag) + 1 - + return "RSDTZXW".find(flag) + 1 def draw_text(ctx, text, color, x, y): ctx.set_source_rgba(*color) ctx.move_to(x, y) ctx.show_text(text) - - + def draw_fill_rect(ctx, color, rect): ctx.set_source_rgba(*color) ctx.rectangle(*rect) ctx.fill() - def draw_rect(ctx, color, rect): ctx.set_source_rgba(*color) ctx.rectangle(*rect) ctx.stroke() - - + def draw_legend_box(ctx, label, fill_color, x, y, s): draw_fill_rect(ctx, fill_color, (x, y - s, s, s)) draw_rect(ctx, PROC_BORDER_COLOR, (x, y - s, s, s)) draw_text(ctx, label, TEXT_COLOR, x + s + 5, y) - - + def draw_legend_line(ctx, label, fill_color, x, y, s): - draw_fill_rect(ctx, fill_color, (x, y - s/2, s + 1, 3)) + draw_fill_rect(ctx, fill_color, (x, y - s/2, s + 1, 3)) ctx.arc(x + (s + 1)/2.0, y - (s - 3)/2.0, 2.5, 0, 2.0 * math.pi) ctx.fill() draw_text(ctx, label, TEXT_COLOR, x + s + 5, y) - def draw_label_in_box(ctx, color, label, x, y, w, maxx): label_w = ctx.text_extents(label)[2] label_x = x + w / 2 - label_w / 2 - if label_w + 10 > w: - label_x = x + w + 5 - if label_x + label_w > maxx: - label_x = x - label_w - 5 + if label_w + 10 > w: + label_x = x + w + 5 + if label_x + label_w > maxx: + label_x = x - label_w - 5 draw_text(ctx, label, color, label_x, y) - -def draw_5sec_labels(ctx, rect, sec_w): - ctx.set_font_size(AXIS_FONT_SIZE) +def draw_sec_labels(ctx, options, rect, sec_w, nsecs): + ctx.set_font_size(AXIS_FONT_SIZE) + prev_x = 0 for i in range(0, rect[2] + 1, sec_w): - if ((i / sec_w) % 30 == 0) : - label = "%ds" % (i / sec_w) + if ((i / sec_w) % nsecs == 0) : + if options.app_options.as_minutes : + label = "%.1f" % (i / sec_w / 60.0) + else : + label = "%d" % (i / sec_w) label_w = ctx.text_extents(label)[2] - draw_text(ctx, label, TEXT_COLOR, rect[0] + i - label_w/2, rect[1] - 2) - + x = rect[0] + i - label_w/2 + if x >= prev_x: + draw_text(ctx, label, TEXT_COLOR, x, rect[1] - 2) + prev_x = x + label_w def draw_box_ticks(ctx, rect, sec_w): draw_rect(ctx, BORDER_COLOR, tuple(rect)) - + ctx.set_line_cap(cairo.LINE_CAP_SQUARE) for i in range(sec_w, rect[2] + 1, sec_w): + if ((i / sec_w) % 10 == 0) : + ctx.set_line_width(1.5) + elif sec_w < 5 : + continue + else : + ctx.set_line_width(1.0) if ((i / sec_w) % 30 == 0) : ctx.set_source_rgba(*TICK_COLOR_BOLD) else : @@ -161,139 +231,298 @@ def draw_box_ticks(ctx, rect, sec_w): ctx.move_to(rect[0] + i, rect[1] + 1) ctx.line_to(rect[0] + i, rect[1] + rect[3] - 1) ctx.stroke() + ctx.set_line_width(1.0) ctx.set_line_cap(cairo.LINE_CAP_BUTT) -def draw_chart(ctx, color, fill, chart_bounds, data, proc_tree): +def draw_annotations(ctx, proc_tree, times, rect): + ctx.set_line_cap(cairo.LINE_CAP_SQUARE) + ctx.set_source_rgba(*ANNOTATION_COLOR) + ctx.set_dash([4, 4]) + + for time in times: + if time is not None: + x = ((time - proc_tree.start_time) * rect[2] / proc_tree.duration) + + ctx.move_to(rect[0] + x, rect[1] + 1) + ctx.line_to(rect[0] + x, rect[1] + rect[3] - 1) + ctx.stroke() + + ctx.set_line_cap(cairo.LINE_CAP_BUTT) + ctx.set_dash([]) + +def draw_chart(ctx, color, fill, chart_bounds, data, proc_tree, data_range): ctx.set_line_width(0.5) x_shift = proc_tree.start_time - x_scale = proc_tree.duration - - def transform_point_coords(point, x_base, y_base, xscale, yscale, x_trans, y_trans): + + def transform_point_coords(point, x_base, y_base, \ + xscale, yscale, x_trans, y_trans): x = (point[0] - x_base) * xscale + x_trans - y = (point[1] - y_base) * -yscale + y_trans + bar_h + y = (point[1] - y_base) * -yscale + y_trans + chart_bounds[3] return x, y - xscale = float(chart_bounds[2]) / max(x for (x,y) in data) - yscale = float(chart_bounds[3]) / max(y for (x,y) in data) - - first = transform_point_coords(data[0], x_shift, 0, xscale, yscale, chart_bounds[0], chart_bounds[1]) - last = transform_point_coords(data[-1], x_shift, 0, xscale, yscale, chart_bounds[0], chart_bounds[1]) - + max_x = max (x for (x, y) in data) + max_y = max (y for (x, y) in data) + # avoid divide by zero + if max_y == 0: + max_y = 1.0 + xscale = float (chart_bounds[2]) / (max_x - x_shift) + # If data_range is given, scale the chart so that the value range in + # data_range matches the chart bounds exactly. + # Otherwise, scale so that the actual data matches the chart bounds. + if data_range: + yscale = float(chart_bounds[3]) / (data_range[1] - data_range[0]) + ybase = data_range[0] + else: + yscale = float(chart_bounds[3]) / max_y + ybase = 0 + + first = transform_point_coords (data[0], x_shift, ybase, xscale, yscale, \ + chart_bounds[0], chart_bounds[1]) + last = transform_point_coords (data[-1], x_shift, ybase, xscale, yscale, \ + chart_bounds[0], chart_bounds[1]) + ctx.set_source_rgba(*color) ctx.move_to(*first) for point in data: - x, y = transform_point_coords(point, x_shift, 0, xscale, yscale, chart_bounds[0], chart_bounds[1]) + x, y = transform_point_coords (point, x_shift, ybase, xscale, yscale, \ + chart_bounds[0], chart_bounds[1]) ctx.line_to(x, y) if fill: ctx.stroke_preserve() - ctx.line_to(last[0], chart_bounds[1]+bar_h) - ctx.line_to(first[0], chart_bounds[1]+bar_h) + ctx.line_to(last[0], chart_bounds[1]+chart_bounds[3]) + ctx.line_to(first[0], chart_bounds[1]+chart_bounds[3]) ctx.line_to(first[0], first[1]) ctx.fill() else: ctx.stroke() ctx.set_line_width(1.0) -header_h = 280 bar_h = 55 +meminfo_bar_h = 2 * bar_h +header_h = 60 # offsets -off_x, off_y = 10, 10 -sec_w = 1 # the width of a second +off_x, off_y = 220, 10 +sec_w_base = 1 # the width of a second proc_h = 16 # the height of a process leg_s = 10 MIN_IMG_W = 800 +CUML_HEIGHT = 2000 # Increased value to accomodate CPU and I/O Graphs +OPTIONS = None + +def extents(options, xscale, trace): + start = min(trace.start.keys()) + end = start + + processes = 0 + for proc in trace.processes: + if not options.app_options.show_all and \ + trace.processes[proc][1] - trace.processes[proc][0] < options.app_options.mintime: + continue + + if trace.processes[proc][1] > end: + end = trace.processes[proc][1] + processes += 1 + + if trace.min is not None and trace.max is not None: + start = trace.min + end = trace.max + + w = int ((end - start) * sec_w_base * xscale) + 2 * off_x + h = proc_h * processes + header_h + 2 * off_y + + if options.charts: + if trace.cpu_stats: + h += 30 + bar_h + if trace.disk_stats: + h += 30 + bar_h + if trace.monitor_disk: + h += 30 + bar_h + if trace.mem_stats: + h += meminfo_bar_h + + return (w, h) + +def clip_visible(clip, rect): + xmax = max (clip[0], rect[0]) + ymax = max (clip[1], rect[1]) + xmin = min (clip[0] + clip[2], rect[0] + rect[2]) + ymin = min (clip[1] + clip[3], rect[1] + rect[3]) + return (xmin > xmax and ymin > ymax) + +def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): + proc_tree = options.proc_tree(trace) - -def extents(res): - start = min(res.start.keys()) - end = max(res.end.keys()) - - w = ((end - start) * sec_w) + 2*off_x - h = proc_h * len(res.processes) + header_h + 2*off_y - - return (w,h) - -# -# Render the chart. -# -def render(ctx, res): - (w, h) = extents(res) - - ctx.set_line_width(1.0) - ctx.select_font_face(FONT_NAME) - draw_fill_rect(ctx, WHITE, (0, 0, max(w, MIN_IMG_W), h)) - w -= 2*off_x - # draw the title and headers - #curr_y = draw_header(ctx, headers, off_x, proc_tree.duration) - curr_y = 0 - # render bar legend - ctx.set_font_size(LEGEND_FONT_SIZE) - - #print "w, h %s %s" % (w, h) - - #draw_legend_box(ctx, "CPU (user+sys)", CPU_COLOR, off_x, curr_y+20, leg_s) - #draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120, curr_y+20, leg_s) - - # render I/O wait - #chart_rect = (off_x, curr_y+30, w, bar_h) - #draw_box_ticks(ctx, chart_rect, sec_w) - #draw_chart(ctx, IO_COLOR, True, chart_rect, [(sample.time, sample.user + sample.sys + sample.io) for sample in cpu_stats], proc_tree) - # render CPU load - #draw_chart(ctx, CPU_COLOR, True, chart_rect, [(sample.time, sample.user + sample.sys) for sample in cpu_stats], proc_tree) - - #curr_y = curr_y + 30 + bar_h + if trace.cpu_stats: + ctx.set_font_size(LEGEND_FONT_SIZE) + + draw_legend_box(ctx, "CPU (user+sys)", CPU_COLOR, off_x, curr_y+20, leg_s) + draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120, curr_y+20, leg_s) + + # render I/O wait + chart_rect = (off_x, curr_y+30, w, bar_h) + if clip_visible (clip, chart_rect): + draw_box_ticks (ctx, chart_rect, sec_w) + draw_annotations (ctx, proc_tree, trace.times, chart_rect) + draw_chart (ctx, IO_COLOR, True, chart_rect, \ + [(sample.time, sample.user + sample.sys + sample.io) for sample in trace.cpu_stats], \ + proc_tree, None) + # render CPU load + draw_chart (ctx, CPU_COLOR, True, chart_rect, \ + [(sample.time, sample.user + sample.sys) for sample in trace.cpu_stats], \ + proc_tree, None) + + curr_y = curr_y + 30 + bar_h # render second chart - #draw_legend_line(ctx, "Disk throughput", DISK_TPUT_COLOR, off_x, curr_y+20, leg_s) - #draw_legend_box(ctx, "Disk utilization", IO_COLOR, off_x + 120, curr_y+20, leg_s) - - # render I/O utilization - #chart_rect = (off_x, curr_y+30, w, bar_h) - #draw_box_ticks(ctx, chart_rect, sec_w) - #draw_chart(ctx, IO_COLOR, True, chart_rect, [(sample.time, sample.util) for sample in disk_stats], proc_tree) - - # render disk throughput - #max_sample = max(disk_stats, key=lambda s: s.tput) - #draw_chart(ctx, DISK_TPUT_COLOR, False, chart_rect, [(sample.time, sample.tput) for sample in disk_stats], proc_tree) - - #pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration) - pos_x = off_x - - shift_x, shift_y = -20, 20 - if (pos_x < off_x + 245): - shift_x, shift_y = 5, 40 - - #label = "%dMB/s" % round((max_sample.tput) / 1024.0) - #draw_text(ctx, label, DISK_TPUT_COLOR, pos_x + shift_x, curr_y + shift_y) - - - - chart_rect = [off_x, curr_y+60, w, h - 2 * off_y - (curr_y+60) + proc_h] - - draw_legend_box(ctx, "Configure", TASK_COLOR_CONFIGURE, off_x , curr_y + 45, leg_s) - draw_legend_box(ctx, "Compile", TASK_COLOR_COMPILE, off_x+120, curr_y + 45, leg_s) - draw_legend_box(ctx, "Install", TASK_COLOR_INSTALL, off_x+240, curr_y + 45, leg_s) - draw_legend_box(ctx, "Package", TASK_COLOR_PACKAGE, off_x+360, curr_y + 45, leg_s) - draw_legend_box(ctx, "Populate Sysroot", TASK_COLOR_SYSROOT, off_x+480, curr_y + 45, leg_s) - + if trace.disk_stats: + draw_legend_line(ctx, "Disk throughput", DISK_TPUT_COLOR, off_x, curr_y+20, leg_s) + draw_legend_box(ctx, "Disk utilization", IO_COLOR, off_x + 120, curr_y+20, leg_s) + + # render I/O utilization + chart_rect = (off_x, curr_y+30, w, bar_h) + if clip_visible (clip, chart_rect): + draw_box_ticks (ctx, chart_rect, sec_w) + draw_annotations (ctx, proc_tree, trace.times, chart_rect) + draw_chart (ctx, IO_COLOR, True, chart_rect, \ + [(sample.time, sample.util) for sample in trace.disk_stats], \ + proc_tree, None) + + # render disk throughput + max_sample = max (trace.disk_stats, key = lambda s: s.tput) + if clip_visible (clip, chart_rect): + draw_chart (ctx, DISK_TPUT_COLOR, False, chart_rect, \ + [(sample.time, sample.tput) for sample in trace.disk_stats], \ + proc_tree, None) + + pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration) + + shift_x, shift_y = -20, 20 + if (pos_x < off_x + 245): + shift_x, shift_y = 5, 40 + + label = "%dMB/s" % round ((max_sample.tput) / 1024.0) + draw_text (ctx, label, DISK_TPUT_COLOR, pos_x + shift_x, curr_y + shift_y) + + curr_y = curr_y + 30 + bar_h + + # render disk space usage + # + # Draws the amount of disk space used on each volume relative to the + # lowest recorded amount. The graphs for each volume are stacked above + # each other so that total disk usage is visible. + if trace.monitor_disk: + ctx.set_font_size(LEGEND_FONT_SIZE) + # Determine set of volumes for which we have + # information and the minimal amount of used disk + # space for each. Currently samples are allowed to + # not have a values for all volumes; drawing could be + # made more efficient if that wasn't the case. + volumes = set() + min_used = {} + for sample in trace.monitor_disk: + for volume, used in sample.records.items(): + volumes.add(volume) + if volume not in min_used or min_used[volume] > used: + min_used[volume] = used + volumes = sorted(list(volumes)) + disk_scale = 0 + for i, volume in enumerate(volumes): + volume_scale = max([sample.records[volume] - min_used[volume] + for sample in trace.monitor_disk + if volume in sample.records]) + # Does not take length of volume name into account, but fixed offset + # works okay in practice. + draw_legend_box(ctx, '%s (max: %u MiB)' % (volume, volume_scale / 1024 / 1024), + VOLUME_COLORS[i % len(VOLUME_COLORS)], + off_x + i * 250, curr_y+20, leg_s) + disk_scale += volume_scale + + # render used amount of disk space + chart_rect = (off_x, curr_y+30, w, bar_h) + if clip_visible (clip, chart_rect): + draw_box_ticks (ctx, chart_rect, sec_w) + draw_annotations (ctx, proc_tree, trace.times, chart_rect) + for i in range(len(volumes), 0, -1): + draw_chart (ctx, VOLUME_COLORS[(i - 1) % len(VOLUME_COLORS)], True, chart_rect, \ + [(sample.time, + # Sum up used space of all volumes including the current one + # so that the graphs appear as stacked on top of each other. + reduce(lambda x,y: x+y, + [sample.records[volume] - min_used[volume] + for volume in volumes[0:i] + if volume in sample.records], + 0)) + for sample in trace.monitor_disk], \ + proc_tree, [0, disk_scale]) + + curr_y = curr_y + 30 + bar_h + + # render mem usage + chart_rect = (off_x, curr_y+30, w, meminfo_bar_h) + mem_stats = trace.mem_stats + if mem_stats and clip_visible (clip, chart_rect): + mem_scale = max(sample.buffers for sample in mem_stats) + draw_legend_box(ctx, "Mem cached (scale: %u MiB)" % (float(mem_scale) / 1024), MEM_CACHED_COLOR, off_x, curr_y+20, leg_s) + draw_legend_box(ctx, "Used", MEM_USED_COLOR, off_x + 240, curr_y+20, leg_s) + draw_legend_box(ctx, "Buffers", MEM_BUFFERS_COLOR, off_x + 360, curr_y+20, leg_s) + draw_legend_line(ctx, "Swap (scale: %u MiB)" % max([(sample.swap)/1024 for sample in mem_stats]), \ + MEM_SWAP_COLOR, off_x + 480, curr_y+20, leg_s) + draw_box_ticks(ctx, chart_rect, sec_w) + draw_annotations(ctx, proc_tree, trace.times, chart_rect) + draw_chart(ctx, MEM_BUFFERS_COLOR, True, chart_rect, \ + [(sample.time, sample.buffers) for sample in trace.mem_stats], \ + proc_tree, [0, mem_scale]) + draw_chart(ctx, MEM_USED_COLOR, True, chart_rect, \ + [(sample.time, sample.used) for sample in mem_stats], \ + proc_tree, [0, mem_scale]) + draw_chart(ctx, MEM_CACHED_COLOR, True, chart_rect, \ + [(sample.time, sample.cached) for sample in mem_stats], \ + proc_tree, [0, mem_scale]) + draw_chart(ctx, MEM_SWAP_COLOR, False, chart_rect, \ + [(sample.time, float(sample.swap)) for sample in mem_stats], \ + proc_tree, None) + + curr_y = curr_y + meminfo_bar_h + + return curr_y + +def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w): + chart_rect = [off_x, curr_y+header_h, w, h - 2 * off_y - header_h - leg_s + proc_h] + + draw_legend_box (ctx, "Configure", \ + TASK_COLOR_CONFIGURE, off_x , curr_y + 45, leg_s) + draw_legend_box (ctx, "Compile", \ + TASK_COLOR_COMPILE, off_x+120, curr_y + 45, leg_s) + draw_legend_box (ctx, "Install", \ + TASK_COLOR_INSTALL, off_x+240, curr_y + 45, leg_s) + draw_legend_box (ctx, "Populate Sysroot", \ + TASK_COLOR_SYSROOT, off_x+360, curr_y + 45, leg_s) + draw_legend_box (ctx, "Package", \ + TASK_COLOR_PACKAGE, off_x+480, curr_y + 45, leg_s) + draw_legend_box (ctx, "Package Write", + TASK_COLOR_PACKAGE_WRITE, off_x+600, curr_y + 45, leg_s) + ctx.set_font_size(PROC_TEXT_FONT_SIZE) - + draw_box_ticks(ctx, chart_rect, sec_w) - draw_5sec_labels(ctx, chart_rect, sec_w) + draw_sec_labels(ctx, options, chart_rect, sec_w, 30) - y = curr_y+60 + y = curr_y+header_h - offset = min(res.start.keys()) - for s in sorted(res.start.keys()): - for val in sorted(res.start[s]): + offset = trace.min or min(trace.start.keys()) + for s in sorted(trace.start.keys()): + for val in sorted(trace.start[s]): + if not options.app_options.show_all and \ + trace.processes[val][1] - s < options.app_options.mintime: + continue task = val.split(":")[1] #print val - #print res.processes[val][1] + #print trace.processes[val][1] #print s - x = (s - offset) * sec_w - w = ((res.processes[val][1] - s) * sec_w) + x = chart_rect[0] + (s - offset) * sec_w + w = ((trace.processes[val][1] - s) * sec_w) #print "proc at %s %s %s %s" % (x, y, w, proc_h) col = None @@ -303,107 +532,437 @@ def render(ctx, res): col = TASK_COLOR_CONFIGURE elif task == "do_install": col = TASK_COLOR_INSTALL - elif task == "do_package": - col = TASK_COLOR_PACKAGE elif task == "do_populate_sysroot": col = TASK_COLOR_SYSROOT + elif task == "do_package": + col = TASK_COLOR_PACKAGE + elif task == "do_package_write_rpm" or \ + task == "do_package_write_deb" or \ + task == "do_package_write_ipk": + col = TASK_COLOR_PACKAGE_WRITE + else: + col = WHITE - draw_rect(ctx, PROC_BORDER_COLOR, (x, y, w, proc_h)) if col: draw_fill_rect(ctx, col, (x, y, w, proc_h)) + draw_rect(ctx, PROC_BORDER_COLOR, (x, y, w, proc_h)) draw_label_in_box(ctx, PROC_TEXT_COLOR, val, x, y + proc_h - 4, w, proc_h) y = y + proc_h + return curr_y + +# +# Render the chart. +# +def render(ctx, options, xscale, trace): + (w, h) = extents (options, xscale, trace) + global OPTIONS + OPTIONS = options.app_options + + # x, y, w, h + clip = ctx.clip_extents() + + sec_w = int (xscale * sec_w_base) + ctx.set_line_width(1.0) + ctx.select_font_face(FONT_NAME) + draw_fill_rect(ctx, WHITE, (0, 0, max(w, MIN_IMG_W), h)) + w -= 2*off_x + curr_y = off_y; + + if options.charts: + curr_y = render_charts (ctx, options, clip, trace, curr_y, w, h, sec_w) + + curr_y = render_processes_chart (ctx, options, trace, curr_y, w, h, sec_w) + + return + + proc_tree = options.proc_tree (trace) + + # draw the title and headers + if proc_tree.idle: + duration = proc_tree.idle + else: + duration = proc_tree.duration + + if not options.kernel_only: + curr_y = draw_header (ctx, trace.headers, duration) + else: + curr_y = off_y; + # draw process boxes - #draw_process_bar_chart(ctx, proc_tree, curr_y + bar_h, w, h) + proc_height = h + if proc_tree.taskstats and options.cumulative: + proc_height -= CUML_HEIGHT - ctx.set_font_size(SIG_FONT_SIZE) - draw_text(ctx, SIGNATURE, SIG_COLOR, off_x + 5, h - off_y - 5) + draw_process_bar_chart(ctx, clip, options, proc_tree, trace.times, + curr_y, w, proc_height, sec_w) -def draw_process_bar_chart(ctx, proc_tree, curr_y, w, h): + curr_y = proc_height + ctx.set_font_size(SIG_FONT_SIZE) + draw_text(ctx, SIGNATURE, SIG_COLOR, off_x + 5, proc_height - 8) + + # draw a cumulative CPU-time-per-process graph + if proc_tree.taskstats and options.cumulative: + cuml_rect = (off_x, curr_y + off_y, w, CUML_HEIGHT/2 - off_y * 2) + if clip_visible (clip, cuml_rect): + draw_cuml_graph(ctx, proc_tree, cuml_rect, duration, sec_w, STAT_TYPE_CPU) + + # draw a cumulative I/O-time-per-process graph + if proc_tree.taskstats and options.cumulative: + cuml_rect = (off_x, curr_y + off_y * 100, w, CUML_HEIGHT/2 - off_y * 2) + if clip_visible (clip, cuml_rect): + draw_cuml_graph(ctx, proc_tree, cuml_rect, duration, sec_w, STAT_TYPE_IO) + +def draw_process_bar_chart(ctx, clip, options, proc_tree, times, curr_y, w, h, sec_w): + header_size = 0 + if not options.kernel_only: + draw_legend_box (ctx, "Running (%cpu)", + PROC_COLOR_R, off_x , curr_y + 45, leg_s) + draw_legend_box (ctx, "Unint.sleep (I/O)", + PROC_COLOR_D, off_x+120, curr_y + 45, leg_s) + draw_legend_box (ctx, "Sleeping", + PROC_COLOR_S, off_x+240, curr_y + 45, leg_s) + draw_legend_box (ctx, "Zombie", + PROC_COLOR_Z, off_x+360, curr_y + 45, leg_s) + header_size = 45 + + chart_rect = [off_x, curr_y + header_size + 15, + w, h - 2 * off_y - (curr_y + header_size + 15) + proc_h] + ctx.set_font_size (PROC_TEXT_FONT_SIZE) + + draw_box_ticks (ctx, chart_rect, sec_w) + if sec_w > 100: + nsec = 1 + else: + nsec = 5 + draw_sec_labels (ctx, options, chart_rect, sec_w, nsec) + draw_annotations (ctx, proc_tree, times, chart_rect) - for root in proc_tree.process_tree: - draw_processes_recursively(ctx, root, proc_tree, y, proc_h, chart_rect) - y = y + proc_h * proc_tree.num_nodes([root]) + y = curr_y + 60 + for root in proc_tree.process_tree: + draw_processes_recursively(ctx, root, proc_tree, y, proc_h, chart_rect, clip) + y = y + proc_h * proc_tree.num_nodes([root]) -def draw_header(ctx, headers, off_x, duration): - dur = duration / 100.0 +def draw_header (ctx, headers, duration): toshow = [ ('system.uname', 'uname', lambda s: s), ('system.release', 'release', lambda s: s), ('system.cpu', 'CPU', lambda s: re.sub('model name\s*:\s*', '', s, 1)), ('system.kernel.options', 'kernel options', lambda s: s), - ('pseudo.header', 'time', lambda s: '%02d:%05.2f' % (math.floor(dur/60), dur - 60 * math.floor(dur/60))) ] header_y = ctx.font_extents()[2] + 10 ctx.set_font_size(TITLE_FONT_SIZE) draw_text(ctx, headers['title'], TEXT_COLOR, off_x, header_y) ctx.set_font_size(TEXT_FONT_SIZE) - + for (headerkey, headertitle, mangle) in toshow: header_y += ctx.font_extents()[2] - txt = headertitle + ': ' + mangle(headers.get(headerkey)) + if headerkey in headers: + value = headers.get(headerkey) + else: + value = "" + txt = headertitle + ': ' + mangle(value) draw_text(ctx, txt, TEXT_COLOR, off_x, header_y) + dur = duration / 100.0 + txt = 'time : %02d:%05.2f' % (math.floor(dur/60), dur - 60 * math.floor(dur/60)) + if headers.get('system.maxpid') is not None: + txt = txt + ' max pid: %s' % (headers.get('system.maxpid')) + + header_y += ctx.font_extents()[2] + draw_text (ctx, txt, TEXT_COLOR, off_x, header_y) + return header_y -def draw_processes_recursively(ctx, proc, proc_tree, y, proc_h, rect) : +def draw_processes_recursively(ctx, proc, proc_tree, y, proc_h, rect, clip) : x = rect[0] + ((proc.start_time - proc_tree.start_time) * rect[2] / proc_tree.duration) w = ((proc.duration) * rect[2] / proc_tree.duration) - draw_process_activity_colors(ctx, proc, proc_tree, x, y, w, proc_h, rect) + draw_process_activity_colors(ctx, proc, proc_tree, x, y, w, proc_h, rect, clip) draw_rect(ctx, PROC_BORDER_COLOR, (x, y, w, proc_h)) - draw_label_in_box(ctx, PROC_TEXT_COLOR, proc.cmd, x, y + proc_h - 4, w, rect[0] + rect[2]) + ipid = int(proc.pid) + if not OPTIONS.show_all: + cmdString = proc.cmd + else: + cmdString = '' + if (OPTIONS.show_pid or OPTIONS.show_all) and ipid is not 0: + cmdString = cmdString + " [" + str(ipid // 1000) + "]" + if OPTIONS.show_all: + if proc.args: + cmdString = cmdString + " '" + "' '".join(proc.args) + "'" + else: + cmdString = cmdString + " " + proc.exe + + draw_label_in_box(ctx, PROC_TEXT_COLOR, cmdString, x, y + proc_h - 4, w, rect[0] + rect[2]) next_y = y + proc_h for child in proc.child_list: - child_x, child_y = draw_processes_recursively(ctx, child, proc_tree, next_y, proc_h, rect) + if next_y > clip[1] + clip[3]: + break + child_x, child_y = draw_processes_recursively(ctx, child, proc_tree, next_y, proc_h, rect, clip) draw_process_connecting_lines(ctx, x, y, child_x, child_y, proc_h) next_y = next_y + proc_h * proc_tree.num_nodes([child]) - + return x, y -def draw_process_activity_colors(ctx, proc, proc_tree, x, y, w, proc_h, rect): +def draw_process_activity_colors(ctx, proc, proc_tree, x, y, w, proc_h, rect, clip): + + if y > clip[1] + clip[3] or y + proc_h + 2 < clip[1]: + return + draw_fill_rect(ctx, PROC_COLOR_S, (x, y, w, proc_h)) last_tx = -1 - for sample in proc.samples : + for sample in proc.samples : tx = rect[0] + round(((sample.time - proc_tree.start_time) * rect[2] / proc_tree.duration)) + + # samples are sorted chronologically + if tx < clip[0]: + continue + if tx > clip[0] + clip[2]: + break + tw = round(proc_tree.sample_period * rect[2] / float(proc_tree.duration)) if last_tx != -1 and abs(last_tx - tx) <= tw: tw -= last_tx - tx tx = last_tx - + tw = max (tw, 1) # nice to see at least something + last_tx = tx + tw state = get_proc_state( sample.state ) - color = STATE_COLORS[state] + color = STATE_COLORS[state] if state == STATE_RUNNING: - alpha = sample.cpu_sample.user + sample.cpu_sample.sys + alpha = min (sample.cpu_sample.user + sample.cpu_sample.sys, 1.0) color = tuple(list(PROC_COLOR_R[0:3]) + [alpha]) +# print "render time %d [ tx %d tw %d ], sample state %s color %s alpha %g" % (sample.time, tx, tw, state, color, alpha) elif state == STATE_SLEEPING: continue draw_fill_rect(ctx, color, (tx, y, tw, proc_h)) - def draw_process_connecting_lines(ctx, px, py, x, y, proc_h): ctx.set_source_rgba(*DEP_COLOR) - ctx.set_dash([2,2]) + ctx.set_dash([2, 2]) if abs(px - x) < 3: dep_off_x = 3 dep_off_y = proc_h / 4 ctx.move_to(x, y + proc_h / 2) ctx.line_to(px - dep_off_x, y + proc_h / 2) ctx.line_to(px - dep_off_x, py - dep_off_y) - ctx.line_to(px, py - dep_off_y) + ctx.line_to(px, py - dep_off_y) else: ctx.move_to(x, y + proc_h / 2) ctx.line_to(px, y + proc_h / 2) ctx.line_to(px, py) ctx.stroke() - ctx.set_dash([]) + ctx.set_dash([]) + +# elide the bootchart collector - it is quite distorting +def elide_bootchart(proc): + return proc.cmd == 'bootchartd' or proc.cmd == 'bootchart-colle' + +class CumlSample: + def __init__(self, proc): + self.cmd = proc.cmd + self.samples = [] + self.merge_samples (proc) + self.color = None + + def merge_samples(self, proc): + self.samples.extend (proc.samples) + self.samples.sort (key = lambda p: p.time) + + def next(self): + global palette_idx + palette_idx += HSV_STEP + return palette_idx + + def get_color(self): + if self.color is None: + i = self.next() % HSV_MAX_MOD + h = 0.0 + if i is not 0: + h = (1.0 * i) / HSV_MAX_MOD + s = 0.5 + v = 1.0 + c = colorsys.hsv_to_rgb (h, s, v) + self.color = (c[0], c[1], c[2], 1.0) + return self.color + + +def draw_cuml_graph(ctx, proc_tree, chart_bounds, duration, sec_w, stat_type): + global palette_idx + palette_idx = 0 + + time_hash = {} + total_time = 0.0 + m_proc_list = {} + + if stat_type is STAT_TYPE_CPU: + sample_value = 'cpu' + else: + sample_value = 'io' + for proc in proc_tree.process_list: + if elide_bootchart(proc): + continue + + for sample in proc.samples: + total_time += getattr(sample.cpu_sample, sample_value) + if not sample.time in time_hash: + time_hash[sample.time] = 1 + + # merge pids with the same cmd + if not proc.cmd in m_proc_list: + m_proc_list[proc.cmd] = CumlSample (proc) + continue + s = m_proc_list[proc.cmd] + s.merge_samples (proc) + + # all the sample times + times = sorted(time_hash) + if len (times) < 2: + print("degenerate boot chart") + return + + pix_per_ns = chart_bounds[3] / total_time +# print "total time: %g pix-per-ns %g" % (total_time, pix_per_ns) + + # FIXME: we have duplicates in the process list too [!] - why !? + + # Render bottom up, left to right + below = {} + for time in times: + below[time] = chart_bounds[1] + chart_bounds[3] + + # same colors each time we render + random.seed (0) + + ctx.set_line_width(1) + + legends = [] + labels = [] + + # render each pid in order + for cs in m_proc_list.values(): + row = {} + cuml = 0.0 + + # print "pid : %s -> %g samples %d" % (proc.cmd, cuml, len (cs.samples)) + for sample in cs.samples: + cuml += getattr(sample.cpu_sample, sample_value) + row[sample.time] = cuml + + process_total_time = cuml + + # hide really tiny processes + if cuml * pix_per_ns <= 2: + continue + + last_time = times[0] + y = last_below = below[last_time] + last_cuml = cuml = 0.0 + + ctx.set_source_rgba(*cs.get_color()) + for time in times: + render_seg = False + + # did the underlying trend increase ? + if below[time] != last_below: + last_below = below[last_time] + last_cuml = cuml + render_seg = True + + # did we move up a pixel increase ? + if time in row: + nc = round (row[time] * pix_per_ns) + if nc != cuml: + last_cuml = cuml + cuml = nc + render_seg = True + +# if last_cuml > cuml: +# assert fail ... - un-sorted process samples + + # draw the trailing rectangle from the last time to + # before now, at the height of the last segment. + if render_seg: + w = math.ceil ((time - last_time) * chart_bounds[2] / proc_tree.duration) + 1 + x = chart_bounds[0] + round((last_time - proc_tree.start_time) * chart_bounds[2] / proc_tree.duration) + ctx.rectangle (x, below[last_time] - last_cuml, w, last_cuml) + ctx.fill() +# ctx.stroke() + last_time = time + y = below [time] - cuml + + row[time] = y + + # render the last segment + x = chart_bounds[0] + round((last_time - proc_tree.start_time) * chart_bounds[2] / proc_tree.duration) + y = below[last_time] - cuml + ctx.rectangle (x, y, chart_bounds[2] - x, cuml) + ctx.fill() +# ctx.stroke() + + # render legend if it will fit + if cuml > 8: + label = cs.cmd + extnts = ctx.text_extents(label) + label_w = extnts[2] + label_h = extnts[3] +# print "Text extents %g by %g" % (label_w, label_h) + labels.append((label, + chart_bounds[0] + chart_bounds[2] - label_w - off_x * 2, + y + (cuml + label_h) / 2)) + if cs in legends: + print("ARGH - duplicate process in list !") + + legends.append ((cs, process_total_time)) + + below = row + + # render grid-lines over the top + draw_box_ticks(ctx, chart_bounds, sec_w) + + # render labels + for l in labels: + draw_text(ctx, l[0], TEXT_COLOR, l[1], l[2]) + + # Render legends + font_height = 20 + label_width = 300 + LEGENDS_PER_COL = 15 + LEGENDS_TOTAL = 45 + ctx.set_font_size (TITLE_FONT_SIZE) + dur_secs = duration / 100 + cpu_secs = total_time / 1000000000 + + # misleading - with multiple CPUs ... +# idle = ((dur_secs - cpu_secs) / dur_secs) * 100.0 + if stat_type is STAT_TYPE_CPU: + label = "Cumulative CPU usage, by process; total CPU: " \ + " %.5g(s) time: %.3g(s)" % (cpu_secs, dur_secs) + else: + label = "Cumulative I/O usage, by process; total I/O: " \ + " %.5g(s) time: %.3g(s)" % (cpu_secs, dur_secs) + + draw_text(ctx, label, TEXT_COLOR, chart_bounds[0] + off_x, + chart_bounds[1] + font_height) + + i = 0 + legends = sorted(legends, key=itemgetter(1), reverse=True) + ctx.set_font_size(TEXT_FONT_SIZE) + for t in legends: + cs = t[0] + time = t[1] + x = chart_bounds[0] + off_x + int (i/LEGENDS_PER_COL) * label_width + y = chart_bounds[1] + font_height * ((i % LEGENDS_PER_COL) + 2) + str = "%s - %.0f(ms) (%2.2f%%)" % (cs.cmd, time/1000000, (time/total_time) * 100.0) + draw_legend_box(ctx, str, cs.color, x, y, leg_s) + i = i + 1 + if i >= LEGENDS_TOTAL: + break diff --git a/scripts/pybootchartgui/pybootchartgui/gui.py b/scripts/pybootchartgui/pybootchartgui/gui.py index 310c3d1bcc..7fedd232df 100644 --- a/scripts/pybootchartgui/pybootchartgui/gui.py +++ b/scripts/pybootchartgui/pybootchartgui/gui.py @@ -1,273 +1,350 @@ +# This file is part of pybootchartgui. + +# pybootchartgui is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# pybootchartgui is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. + import gobject import gtk import gtk.gdk import gtk.keysyms - -import draw +from . import draw +from .draw import RenderOptions class PyBootchartWidget(gtk.DrawingArea): - __gsignals__ = { - 'expose-event': 'override', - 'clicked' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_STRING, gtk.gdk.Event)), - 'position-changed' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_INT, gobject.TYPE_INT)), - 'set-scroll-adjustments' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gtk.Adjustment, gtk.Adjustment)) - } - - def __init__(self, res): - gtk.DrawingArea.__init__(self) - - self.res = res - - self.set_flags(gtk.CAN_FOCUS) - - self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK) - self.connect("button-press-event", self.on_area_button_press) - self.connect("button-release-event", self.on_area_button_release) - self.add_events(gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.BUTTON_RELEASE_MASK) - self.connect("motion-notify-event", self.on_area_motion_notify) - self.connect("scroll-event", self.on_area_scroll_event) - self.connect('key-press-event', self.on_key_press_event) - - self.connect('set-scroll-adjustments', self.on_set_scroll_adjustments) - self.connect("size-allocate", self.on_allocation_size_changed) - self.connect("position-changed", self.on_position_changed) - - self.zoom_ratio = 1.0 - self.x, self.y = 0.0, 0.0 - - self.chart_width, self.chart_height = draw.extents(res) - self.hadj = None - self.vadj = None - - def do_expose_event(self, event): - cr = self.window.cairo_create() - - # set a clip region for the expose event - cr.rectangle( - event.area.x, event.area.y, - event.area.width, event.area.height - ) - cr.clip() - self.draw(cr, self.get_allocation()) - return False - - def draw(self, cr, rect): - cr.set_source_rgba(1.0, 1.0, 1.0, 1.0) - cr.paint() - cr.scale(self.zoom_ratio, self.zoom_ratio) - cr.translate(-self.x, -self.y) - draw.render(cr, self.res) - - def position_changed(self): - self.emit("position-changed", self.x, self.y) - - ZOOM_INCREMENT = 1.25 - - def zoom_image(self, zoom_ratio): - self.zoom_ratio = zoom_ratio - self._set_scroll_adjustments(self.hadj, self.vadj) - self.queue_draw() - - def zoom_to_rect(self, rect): - zoom_ratio = float(rect.width)/float(self.chart_width) - self.zoom_image(zoom_ratio) - self.x = 0 - self.position_changed() - - def on_zoom_in(self, action): - self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT) - - def on_zoom_out(self, action): - self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT) - - def on_zoom_fit(self, action): - self.zoom_to_rect(self.get_allocation()) - - def on_zoom_100(self, action): - self.zoom_image(1.0) - - POS_INCREMENT = 100 - - def on_key_press_event(self, widget, event): - if event.keyval == gtk.keysyms.Left: - self.x -= self.POS_INCREMENT/self.zoom_ratio - elif event.keyval == gtk.keysyms.Right: - self.x += self.POS_INCREMENT/self.zoom_ratio - elif event.keyval == gtk.keysyms.Up: - self.y -= self.POS_INCREMENT/self.zoom_ratio - elif event.keyval == gtk.keysyms.Down: - self.y += self.POS_INCREMENT/self.zoom_ratio - elif event.keyval == gtk.keysyms.Page_Up: - self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT) - elif event.keyval == gtk.keysyms.Page_Down: - self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT) - else: - return False - self.queue_draw() - self.position_changed() + __gsignals__ = { + 'expose-event': 'override', + 'clicked' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_STRING, gtk.gdk.Event)), + 'position-changed' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_INT, gobject.TYPE_INT)), + 'set-scroll-adjustments' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gtk.Adjustment, gtk.Adjustment)) + } + + def __init__(self, trace, options, xscale): + gtk.DrawingArea.__init__(self) + + self.trace = trace + self.options = options + + self.set_flags(gtk.CAN_FOCUS) + + self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK) + self.connect("button-press-event", self.on_area_button_press) + self.connect("button-release-event", self.on_area_button_release) + self.add_events(gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.BUTTON_RELEASE_MASK) + self.connect("motion-notify-event", self.on_area_motion_notify) + self.connect("scroll-event", self.on_area_scroll_event) + self.connect('key-press-event', self.on_key_press_event) + + self.connect('set-scroll-adjustments', self.on_set_scroll_adjustments) + self.connect("size-allocate", self.on_allocation_size_changed) + self.connect("position-changed", self.on_position_changed) + + self.zoom_ratio = 1.0 + self.xscale = xscale + self.x, self.y = 0.0, 0.0 + + self.chart_width, self.chart_height = draw.extents(self.options, self.xscale, self.trace) + self.hadj = None + self.vadj = None + self.hadj_changed_signal_id = None + self.vadj_changed_signal_id = None + + def do_expose_event(self, event): + cr = self.window.cairo_create() + + # set a clip region for the expose event + cr.rectangle( + event.area.x, event.area.y, + event.area.width, event.area.height + ) + cr.clip() + self.draw(cr, self.get_allocation()) + return False + + def draw(self, cr, rect): + cr.set_source_rgba(1.0, 1.0, 1.0, 1.0) + cr.paint() + cr.scale(self.zoom_ratio, self.zoom_ratio) + cr.translate(-self.x, -self.y) + draw.render(cr, self.options, self.xscale, self.trace) + + def position_changed(self): + self.emit("position-changed", self.x, self.y) + + ZOOM_INCREMENT = 1.25 + + def zoom_image (self, zoom_ratio): + self.zoom_ratio = zoom_ratio + self._set_scroll_adjustments (self.hadj, self.vadj) + self.queue_draw() + + def zoom_to_rect (self, rect): + zoom_ratio = float(rect.width)/float(self.chart_width) + self.zoom_image(zoom_ratio) + self.x = 0 + self.position_changed() + + def set_xscale(self, xscale): + old_mid_x = self.x + self.hadj.page_size / 2 + self.xscale = xscale + self.chart_width, self.chart_height = draw.extents(self.options, self.xscale, self.trace) + new_x = old_mid_x + self.zoom_image (self.zoom_ratio) + + def on_expand(self, action): + self.set_xscale (int(self.xscale * 1.5 + 0.5)) + + def on_contract(self, action): + self.set_xscale (max(int(self.xscale / 1.5), 1)) + + def on_zoom_in(self, action): + self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT) + + def on_zoom_out(self, action): + self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT) + + def on_zoom_fit(self, action): + self.zoom_to_rect(self.get_allocation()) + + def on_zoom_100(self, action): + self.zoom_image(1.0) + self.set_xscale(1.0) + + def show_toggled(self, button): + self.options.app_options.show_all = button.get_property ('active') + self.chart_width, self.chart_height = draw.extents(self.options, self.xscale, self.trace) + self._set_scroll_adjustments(self.hadj, self.vadj) + self.queue_draw() + + POS_INCREMENT = 100 + + def on_key_press_event(self, widget, event): + if event.keyval == gtk.keysyms.Left: + self.x -= self.POS_INCREMENT/self.zoom_ratio + elif event.keyval == gtk.keysyms.Right: + self.x += self.POS_INCREMENT/self.zoom_ratio + elif event.keyval == gtk.keysyms.Up: + self.y -= self.POS_INCREMENT/self.zoom_ratio + elif event.keyval == gtk.keysyms.Down: + self.y += self.POS_INCREMENT/self.zoom_ratio + else: + return False + self.queue_draw() + self.position_changed() + return True + + def on_area_button_press(self, area, event): + if event.button == 2 or event.button == 1: + area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR)) + self.prevmousex = event.x + self.prevmousey = event.y + if event.type not in (gtk.gdk.BUTTON_PRESS, gtk.gdk.BUTTON_RELEASE): + return False + return False + + def on_area_button_release(self, area, event): + if event.button == 2 or event.button == 1: + area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.ARROW)) + self.prevmousex = None + self.prevmousey = None + return True + return False + + def on_area_scroll_event(self, area, event): + if event.state & gtk.gdk.CONTROL_MASK: + if event.direction == gtk.gdk.SCROLL_UP: + self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT) return True - - def on_area_button_press(self, area, event): - if event.button == 2 or event.button == 1: - area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR)) - self.prevmousex = event.x - self.prevmousey = event.y - if event.type not in (gtk.gdk.BUTTON_PRESS, gtk.gdk.BUTTON_RELEASE): - return False - return False - - def on_area_button_release(self, area, event): - if event.button == 2 or event.button == 1: - area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.ARROW)) - self.prevmousex = None - self.prevmousey = None - return True - return False - - def on_area_scroll_event(self, area, event): - if event.direction == gtk.gdk.SCROLL_UP: - self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT) - return True - if event.direction == gtk.gdk.SCROLL_DOWN: - self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT) - return True - return False - - def on_area_motion_notify(self, area, event): - state = event.state - if state & gtk.gdk.BUTTON2_MASK or state & gtk.gdk.BUTTON1_MASK: - x, y = int(event.x), int(event.y) - # pan the image - self.x += (self.prevmousex - x)/self.zoom_ratio - self.y += (self.prevmousey - y)/self.zoom_ratio - self.queue_draw() - self.prevmousex = x - self.prevmousey = y - self.position_changed() + if event.direction == gtk.gdk.SCROLL_DOWN: + self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT) return True - - def on_set_scroll_adjustments(self, area, hadj, vadj): - self._set_scroll_adjustments(hadj, vadj) - - def on_allocation_size_changed(self, widget, allocation): - self.hadj.page_size = allocation.width - self.hadj.page_increment = allocation.width * 0.9 - self.vadj.page_size = allocation.height - self.vadj.page_increment = allocation.height * 0.9 - - def _set_scroll_adjustments(self, hadj, vadj): - if hadj == None: - hadj = gtk.Adjustment(0.0, 0.0, 0.0, 0.0, 0.0, 0.0) - if vadj == None: - vadj = gtk.Adjustment(0.0, 0.0, 0.0, 0.0, 0.0, 0.0) - - if self.hadj != None and hadj != self.hadj: - self.hadj.disconnect(self.hadj_changed_signal_id) - if self.vadj != None and vadj != self.vadj: - self.vadj.disconnect(self.vadj_changed_signal_id) - - if hadj != None: - self.hadj = hadj - self._set_adj_upper(self.hadj, self.zoom_ratio * self.chart_width) - self.hadj_changed_signal_id = self.hadj.connect('value-changed', self.on_adjustments_changed) - - if vadj != None: - self.vadj = vadj - self._set_adj_upper(self.vadj, self.zoom_ratio * self.chart_height) - self.vadj_changed_signal_id = self.vadj.connect('value-changed', self.on_adjustments_changed) - - def _set_adj_upper(self, adj, upper): - changed = False - value_changed = False - - if adj.upper != upper: - adj.upper = upper - changed = True - - max_value = max(0.0, upper - adj.page_size) - if adj.value > max_value: - adj.value = max_value - value_changed = True - - if changed: - adj.changed() - if value_changed: - adj.value_changed() - - def on_adjustments_changed(self, adj): - self.x = self.hadj.value / self.zoom_ratio - self.y = self.vadj.value / self.zoom_ratio - self.queue_draw() - - def on_position_changed(self, widget, x, y): - self.hadj.value = x * self.zoom_ratio - self.vadj.value = y * self.zoom_ratio + return False + + def on_area_motion_notify(self, area, event): + state = event.state + if state & gtk.gdk.BUTTON2_MASK or state & gtk.gdk.BUTTON1_MASK: + x, y = int(event.x), int(event.y) + # pan the image + self.x += (self.prevmousex - x)/self.zoom_ratio + self.y += (self.prevmousey - y)/self.zoom_ratio + self.queue_draw() + self.prevmousex = x + self.prevmousey = y + self.position_changed() + return True + + def on_set_scroll_adjustments(self, area, hadj, vadj): + self._set_scroll_adjustments (hadj, vadj) + + def on_allocation_size_changed(self, widget, allocation): + self.hadj.page_size = allocation.width + self.hadj.page_increment = allocation.width * 0.9 + self.vadj.page_size = allocation.height + self.vadj.page_increment = allocation.height * 0.9 + + def _set_adj_upper(self, adj, upper): + changed = False + value_changed = False + + if adj.upper != upper: + adj.upper = upper + changed = True + + max_value = max(0.0, upper - adj.page_size) + if adj.value > max_value: + adj.value = max_value + value_changed = True + + if changed: + adj.changed() + if value_changed: + adj.value_changed() + + def _set_scroll_adjustments(self, hadj, vadj): + if hadj == None: + hadj = gtk.Adjustment(0.0, 0.0, 0.0, 0.0, 0.0, 0.0) + if vadj == None: + vadj = gtk.Adjustment(0.0, 0.0, 0.0, 0.0, 0.0, 0.0) + + if self.hadj_changed_signal_id != None and \ + self.hadj != None and hadj != self.hadj: + self.hadj.disconnect (self.hadj_changed_signal_id) + if self.vadj_changed_signal_id != None and \ + self.vadj != None and vadj != self.vadj: + self.vadj.disconnect (self.vadj_changed_signal_id) + + if hadj != None: + self.hadj = hadj + self._set_adj_upper (self.hadj, self.zoom_ratio * self.chart_width) + self.hadj_changed_signal_id = self.hadj.connect('value-changed', self.on_adjustments_changed) + + if vadj != None: + self.vadj = vadj + self._set_adj_upper (self.vadj, self.zoom_ratio * self.chart_height) + self.vadj_changed_signal_id = self.vadj.connect('value-changed', self.on_adjustments_changed) + + def on_adjustments_changed(self, adj): + self.x = self.hadj.value / self.zoom_ratio + self.y = self.vadj.value / self.zoom_ratio + self.queue_draw() + + def on_position_changed(self, widget, x, y): + self.hadj.value = x * self.zoom_ratio + self.vadj.value = y * self.zoom_ratio PyBootchartWidget.set_set_scroll_adjustments_signal('set-scroll-adjustments') +class PyBootchartShell(gtk.VBox): + ui = ''' + <ui> + <toolbar name="ToolBar"> + <toolitem action="Expand"/> + <toolitem action="Contract"/> + <separator/> + <toolitem action="ZoomIn"/> + <toolitem action="ZoomOut"/> + <toolitem action="ZoomFit"/> + <toolitem action="Zoom100"/> + </toolbar> + </ui> + ''' + def __init__(self, window, trace, options, xscale): + gtk.VBox.__init__(self) + + self.widget = PyBootchartWidget(trace, options, xscale) + + # Create a UIManager instance + uimanager = self.uimanager = gtk.UIManager() + + # Add the accelerator group to the toplevel window + accelgroup = uimanager.get_accel_group() + window.add_accel_group(accelgroup) + + # Create an ActionGroup + actiongroup = gtk.ActionGroup('Actions') + self.actiongroup = actiongroup + + # Create actions + actiongroup.add_actions(( + ('Expand', gtk.STOCK_ADD, None, None, None, self.widget.on_expand), + ('Contract', gtk.STOCK_REMOVE, None, None, None, self.widget.on_contract), + ('ZoomIn', gtk.STOCK_ZOOM_IN, None, None, None, self.widget.on_zoom_in), + ('ZoomOut', gtk.STOCK_ZOOM_OUT, None, None, None, self.widget.on_zoom_out), + ('ZoomFit', gtk.STOCK_ZOOM_FIT, 'Fit Width', None, None, self.widget.on_zoom_fit), + ('Zoom100', gtk.STOCK_ZOOM_100, None, None, None, self.widget.on_zoom_100), + )) + + # Add the actiongroup to the uimanager + uimanager.insert_action_group(actiongroup, 0) + + # Add a UI description + uimanager.add_ui_from_string(self.ui) + + # Scrolled window + scrolled = gtk.ScrolledWindow() + scrolled.add(self.widget) + + # toolbar / h-box + hbox = gtk.HBox(False, 8) + + # Create a Toolbar + toolbar = uimanager.get_widget('/ToolBar') + hbox.pack_start(toolbar, True, True) + + if not options.kernel_only: + # Misc. options + button = gtk.CheckButton("Show more") + button.connect ('toggled', self.widget.show_toggled) + button.set_active(options.app_options.show_all) + hbox.pack_start (button, False, True) + + self.pack_start(hbox, False) + self.pack_start(scrolled) + self.show_all() + + def grab_focus(self, window): + window.set_focus(self.widget) + + class PyBootchartWindow(gtk.Window): - ui = ''' - <ui> - <toolbar name="ToolBar"> - <toolitem action="ZoomIn"/> - <toolitem action="ZoomOut"/> - <toolitem action="ZoomFit"/> - <toolitem action="Zoom100"/> - </toolbar> - </ui> - ''' - - def __init__(self, res): - gtk.Window.__init__(self) - - window = self - window.set_title('Bootchart') - window.set_default_size(512, 512) - vbox = gtk.VBox() - window.add(vbox) - - self.widget = PyBootchartWidget(res) - - # Create a UIManager instance - uimanager = self.uimanager = gtk.UIManager() - - # Add the accelerator group to the toplevel window - accelgroup = uimanager.get_accel_group() - window.add_accel_group(accelgroup) - - # Create an ActionGroup - actiongroup = gtk.ActionGroup('Actions') - self.actiongroup = actiongroup - - # Create actions - actiongroup.add_actions(( - ('ZoomIn', gtk.STOCK_ZOOM_IN, None, None, None, self.widget.on_zoom_in), - ('ZoomOut', gtk.STOCK_ZOOM_OUT, None, None, None, self.widget.on_zoom_out), - ('ZoomFit', gtk.STOCK_ZOOM_FIT, 'Fit Width', None, None, self.widget.on_zoom_fit), - ('Zoom100', gtk.STOCK_ZOOM_100, None, None, None, self.widget.on_zoom_100), - )) - - # Add the actiongroup to the uimanager - uimanager.insert_action_group(actiongroup, 0) - - # Add a UI description - uimanager.add_ui_from_string(self.ui) - - # Scrolled window - scrolled = gtk.ScrolledWindow() - scrolled.add(self.widget) - - # Create a Toolbar - toolbar = uimanager.get_widget('/ToolBar') - vbox.pack_start(toolbar, False) - vbox.pack_start(scrolled) - - self.set_focus(self.widget) - - self.show_all() - -def show(res): - win = PyBootchartWindow(res) - win.connect('destroy', gtk.main_quit) - gtk.main() + def __init__(self, trace, app_options): + gtk.Window.__init__(self) + + window = self + window.set_title("Bootchart %s" % trace.filename) + window.set_default_size(750, 550) + + tab_page = gtk.Notebook() + tab_page.show() + window.add(tab_page) + + full_opts = RenderOptions(app_options) + full_tree = PyBootchartShell(window, trace, full_opts, 1.0) + tab_page.append_page (full_tree, gtk.Label("Full tree")) + + if trace.kernel is not None and len (trace.kernel) > 2: + kernel_opts = RenderOptions(app_options) + kernel_opts.cumulative = False + kernel_opts.charts = False + kernel_opts.kernel_only = True + kernel_tree = PyBootchartShell(window, trace, kernel_opts, 5.0) + tab_page.append_page (kernel_tree, gtk.Label("Kernel boot")) + + full_tree.grab_focus(self) + self.show() + + +def show(trace, options): + win = PyBootchartWindow(trace, options) + win.connect('destroy', gtk.main_quit) + gtk.main() diff --git a/scripts/pybootchartgui/pybootchartgui/main.py b/scripts/pybootchartgui/pybootchartgui/main.py index e22636c23e..b45ae0a3d2 100644..120000 --- a/scripts/pybootchartgui/pybootchartgui/main.py +++ b/scripts/pybootchartgui/pybootchartgui/main.py @@ -1,78 +1 @@ -import sys -import os -import optparse - -import parsing -import gui -import batch - -def _mk_options_parser(): - """Make an options parser.""" - usage = "%prog [options] /path/to/tmp/buildstats/<recipe-machine>/<BUILDNAME>/" - version = "%prog v1.0.0" - parser = optparse.OptionParser(usage, version=version) - parser.add_option("-i", "--interactive", action="store_true", dest="interactive", default=False, - help="start in active mode") - parser.add_option("-f", "--format", dest="format", default="svg", choices=["svg", "pdf", "png"], - help="image format: svg, pdf, png, [default: %default]") - parser.add_option("-o", "--output", dest="output", metavar="PATH", default=None, - help="output path (file or directory) where charts are stored") - parser.add_option("-s", "--split", dest="num", type=int, default=1, - help="split the output chart into <NUM> charts, only works with \"-o PATH\"") - parser.add_option("-m", "--mintime", dest="mintime", type=int, default=8, - help="only tasks longer than this time will be displayed") - parser.add_option("-n", "--no-prune", action="store_false", dest="prune", default=True, - help="do not prune the process tree") - parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, - help="suppress informational messages") - parser.add_option("--very-quiet", action="store_true", dest="veryquiet", default=False, - help="suppress all messages except errors") - parser.add_option("--verbose", action="store_true", dest="verbose", default=False, - help="print all messages") - return parser - -def _get_filename(path): - """Construct a usable filename for outputs""" - dir = "." - file = "bootchart" - if os.path.isdir(path): - dir = path - elif path != None: - file = path - return os.path.join(dir, file) - -def main(argv=None): - try: - if argv is None: - argv = sys.argv[1:] - - parser = _mk_options_parser() - options, args = parser.parse_args(argv) - - if len(args) == 0: - parser.error("insufficient arguments, expected at least one path.") - return 2 - - res = parsing.parse(args, options.prune, options.mintime) - if options.interactive or options.output == None: - gui.show(res) - else: - filename = _get_filename(options.output) - res_list = parsing.split_res(res, options.num) - n = 1 - for r in res_list: - if len(res_list) == 1: - f = filename + "." + options.format - else: - f = filename + "_" + str(n) + "." + options.format - n = n + 1 - batch.render(r, options.format, f) - print "bootchart written to", f - return 0 - except parsing.ParseError, ex: - print("Parse error: %s" % ex) - return 2 - - -if __name__ == '__main__': - sys.exit(main()) +main.py.in
\ No newline at end of file diff --git a/scripts/pybootchartgui/pybootchartgui/main.py.in b/scripts/pybootchartgui/pybootchartgui/main.py.in new file mode 100644 index 0000000000..a954b125da --- /dev/null +++ b/scripts/pybootchartgui/pybootchartgui/main.py.in @@ -0,0 +1,183 @@ +# +# *********************************************************************** +# Warning: This file is auto-generated from main.py.in - edit it there. +# *********************************************************************** +# +# pybootchartgui is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# pybootchartgui is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. + +import sys +import os +import optparse + +from . import parsing +from . import batch + +def _mk_options_parser(): + """Make an options parser.""" + usage = "%prog [options] /path/to/tmp/buildstats/<recipe-machine>/<BUILDNAME>/" + version = "%prog v1.0.0" + parser = optparse.OptionParser(usage, version=version) + parser.add_option("-i", "--interactive", action="store_true", dest="interactive", default=False, + help="start in active mode") + parser.add_option("-f", "--format", dest="format", default="png", choices=["png", "svg", "pdf"], + help="image format (png, svg, pdf); default format png") + parser.add_option("-o", "--output", dest="output", metavar="PATH", default=None, + help="output path (file or directory) where charts are stored") + parser.add_option("-s", "--split", dest="num", type=int, default=1, + help="split the output chart into <NUM> charts, only works with \"-o PATH\"") + parser.add_option("-m", "--mintime", dest="mintime", type=int, default=8, + help="only tasks longer than this time will be displayed") + parser.add_option("-M", "--minutes", action="store_true", dest="as_minutes", default=False, + help="display time in minutes instead of seconds") +# parser.add_option("-n", "--no-prune", action="store_false", dest="prune", default=True, +# help="do not prune the process tree") + parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, + help="suppress informational messages") +# parser.add_option("-t", "--boot-time", action="store_true", dest="boottime", default=False, +# help="only display the boot time of the boot in text format (stdout)") + parser.add_option("--very-quiet", action="store_true", dest="veryquiet", default=False, + help="suppress all messages except errors") + parser.add_option("--verbose", action="store_true", dest="verbose", default=False, + help="print all messages") +# parser.add_option("--profile", action="store_true", dest="profile", default=False, +# help="profile rendering of chart (only useful when in batch mode indicated by -f)") +# parser.add_option("--show-pid", action="store_true", dest="show_pid", default=False, +# help="show process ids in the bootchart as 'processname [pid]'") + parser.add_option("--show-all", action="store_true", dest="show_all", default=False, + help="show all processes in the chart") +# parser.add_option("--crop-after", dest="crop_after", metavar="PROCESS", default=None, +# help="crop chart when idle after PROCESS is started") +# parser.add_option("--annotate", action="append", dest="annotate", metavar="PROCESS", default=None, +# help="annotate position where PROCESS is started; can be specified multiple times. " + +# "To create a single annotation when any one of a set of processes is started, use commas to separate the names") +# parser.add_option("--annotate-file", dest="annotate_file", metavar="FILENAME", default=None, +# help="filename to write annotation points to") + parser.add_option("-T", "--full-time", action="store_true", dest="full_time", default=False, + help="display the full time regardless of which processes are currently shown") + return parser + +class Writer: + def __init__(self, write, options): + self.write = write + self.options = options + + def error(self, msg): + self.write(msg) + + def warn(self, msg): + if not self.options.quiet: + self.write(msg) + + def info(self, msg): + if self.options.verbose: + self.write(msg) + + def status(self, msg): + if not self.options.quiet: + self.write(msg) + +def _mk_writer(options): + def write(s): + print(s) + return Writer(write, options) + +def _get_filename(path): + """Construct a usable filename for outputs""" + dname = "." + fname = "bootchart" + if path != None: + if os.path.isdir(path): + dname = path + else: + fname = path + return os.path.join(dname, fname) + +def main(argv=None): + try: + if argv is None: + argv = sys.argv[1:] + + parser = _mk_options_parser() + options, args = parser.parse_args(argv) + + # Default values for disabled options + options.prune = True + options.boottime = False + options.profile = False + options.show_pid = False + options.crop_after = None + options.annotate = None + options.annotate_file = None + + writer = _mk_writer(options) + + if len(args) == 0: + print("No path given, trying /var/log/bootchart.tgz") + args = [ "/var/log/bootchart.tgz" ] + + res = parsing.Trace(writer, args, options) + + if options.interactive or options.output == None: + from . import gui + gui.show(res, options) + elif options.boottime: + import math + proc_tree = res.proc_tree + if proc_tree.idle: + duration = proc_tree.idle + else: + duration = proc_tree.duration + dur = duration / 100.0 + print('%02d:%05.2f' % (math.floor(dur/60), dur - 60 * math.floor(dur/60))) + else: + if options.annotate_file: + f = open (options.annotate_file, "w") + try: + for time in res[4]: + if time is not None: + # output as ms + f.write(time * 10) + finally: + f.close() + filename = _get_filename(options.output) + res_list = parsing.split_res(res, options) + n = 1 + width = len(str(len(res_list))) + s = "_%%0%dd." % width + for r in res_list: + if len(res_list) == 1: + f = filename + "." + options.format + else: + f = filename + s % n + options.format + n = n + 1 + def render(): + batch.render(writer, r, options, f) + if options.profile: + import cProfile + import pstats + profile = '%s.prof' % os.path.splitext(filename)[0] + cProfile.runctx('render()', globals(), locals(), profile) + p = pstats.Stats(profile) + p.strip_dirs().sort_stats('time').print_stats(20) + else: + render() + + return 0 + except parsing.ParseError as ex: + print(("Parse error: %s" % ex)) + return 2 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py index 6343fd5a7b..bcfb2da569 100644 --- a/scripts/pybootchartgui/pybootchartgui/parsing.py +++ b/scripts/pybootchartgui/pybootchartgui/parsing.py @@ -1,178 +1,697 @@ -from __future__ import with_statement +# This file is part of pybootchartgui. + +# pybootchartgui is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# pybootchartgui is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. import os import string import re +import sys import tarfile +from time import clock from collections import defaultdict +from functools import reduce + +from .samples import * +from .process_tree import ProcessTree + +if sys.version_info >= (3, 0): + long = int + +# Parsing produces as its end result a 'Trace' + +class Trace: + def __init__(self, writer, paths, options): + self.processes = {} + self.start = {} + self.end = {} + self.min = None + self.max = None + self.headers = None + self.disk_stats = [] + self.ps_stats = None + self.taskstats = None + self.cpu_stats = [] + self.cmdline = None + self.kernel = None + self.kernel_tree = None + self.filename = None + self.parent_map = None + self.mem_stats = [] + self.monitor_disk = None + self.times = [] # Always empty, but expected by draw.py when drawing system charts. + + if len(paths): + parse_paths (writer, self, paths) + if not self.valid(): + raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths)) + + if options.full_time: + self.min = min(self.start.keys()) + self.max = max(self.end.keys()) + + + # Rendering system charts depends on start and end + # time. Provide them where the original drawing code expects + # them, i.e. in proc_tree. + class BitbakeProcessTree: + def __init__(self, start_time, end_time): + self.start_time = start_time + self.end_time = end_time + self.duration = self.end_time - self.start_time + self.proc_tree = BitbakeProcessTree(min(self.start.keys()), + max(self.end.keys())) + + + return + + # Turn that parsed information into something more useful + # link processes into a tree of pointers, calculate statistics + self.compile(writer) + + # Crop the chart to the end of the first idle period after the given + # process + if options.crop_after: + idle = self.crop (writer, options.crop_after) + else: + idle = None + + # Annotate other times as the first start point of given process lists + self.times = [ idle ] + if options.annotate: + for procnames in options.annotate: + names = [x[:15] for x in procnames.split(",")] + for proc in self.ps_stats.process_map.values(): + if proc.cmd in names: + self.times.append(proc.start_time) + break + else: + self.times.append(None) + + self.proc_tree = ProcessTree(writer, self.kernel, self.ps_stats, + self.ps_stats.sample_period, + self.headers.get("profile.process"), + options.prune, idle, self.taskstats, + self.parent_map is not None) + + if self.kernel is not None: + self.kernel_tree = ProcessTree(writer, self.kernel, None, 0, + self.headers.get("profile.process"), + False, None, None, True) + + def valid(self): + return len(self.processes) != 0 + return self.headers != None and self.disk_stats != None and \ + self.ps_stats != None and self.cpu_stats != None + + def add_process(self, process, start, end): + self.processes[process] = [start, end] + if start not in self.start: + self.start[start] = [] + if process not in self.start[start]: + self.start[start].append(process) + if end not in self.end: + self.end[end] = [] + if process not in self.end[end]: + self.end[end].append(process) + + def compile(self, writer): + + def find_parent_id_for(pid): + if pid is 0: + return 0 + ppid = self.parent_map.get(pid) + if ppid: + # many of these double forks are so short lived + # that we have no samples, or process info for them + # so climb the parent hierarcy to find one + if int (ppid * 1000) not in self.ps_stats.process_map: +# print "Pid '%d' short lived with no process" % ppid + ppid = find_parent_id_for (ppid) +# else: +# print "Pid '%d' has an entry" % ppid + else: +# print "Pid '%d' missing from pid map" % pid + return 0 + return ppid + + # merge in the cmdline data + if self.cmdline is not None: + for proc in self.ps_stats.process_map.values(): + rpid = int (proc.pid // 1000) + if rpid in self.cmdline: + cmd = self.cmdline[rpid] + proc.exe = cmd['exe'] + proc.args = cmd['args'] +# else: +# print "proc %d '%s' not in cmdline" % (rpid, proc.exe) + + # re-parent any stray orphans if we can + if self.parent_map is not None: + for process in self.ps_stats.process_map.values(): + ppid = find_parent_id_for (int(process.pid // 1000)) + if ppid: + process.ppid = ppid * 1000 + + # stitch the tree together with pointers + for process in self.ps_stats.process_map.values(): + process.set_parent (self.ps_stats.process_map) + + # count on fingers variously + for process in self.ps_stats.process_map.values(): + process.calc_stats (self.ps_stats.sample_period) + + def crop(self, writer, crop_after): + + def is_idle_at(util, start, j): + k = j + 1 + while k < len(util) and util[k][0] < start + 300: + k += 1 + k = min(k, len(util)-1) + + if util[j][1] >= 0.25: + return False + + avgload = sum(u[1] for u in util[j:k+1]) / (k-j+1) + if avgload < 0.25: + return True + else: + return False + def is_idle(util, start): + for j in range(0, len(util)): + if util[j][0] < start: + continue + return is_idle_at(util, start, j) + else: + return False + + names = [x[:15] for x in crop_after.split(",")] + for proc in self.ps_stats.process_map.values(): + if proc.cmd in names or proc.exe in names: + writer.info("selected proc '%s' from list (start %d)" + % (proc.cmd, proc.start_time)) + break + if proc is None: + writer.warn("no selected crop proc '%s' in list" % crop_after) + + + cpu_util = [(sample.time, sample.user + sample.sys + sample.io) for sample in self.cpu_stats] + disk_util = [(sample.time, sample.util) for sample in self.disk_stats] + + idle = None + for i in range(0, len(cpu_util)): + if cpu_util[i][0] < proc.start_time: + continue + if is_idle_at(cpu_util, cpu_util[i][0], i) \ + and is_idle(disk_util, cpu_util[i][0]): + idle = cpu_util[i][0] + break + + if idle is None: + writer.warn ("not idle after proc '%s'" % crop_after) + return None + + crop_at = idle + 300 + writer.info ("cropping at time %d" % crop_at) + while len (self.cpu_stats) \ + and self.cpu_stats[-1].time > crop_at: + self.cpu_stats.pop() + while len (self.disk_stats) \ + and self.disk_stats[-1].time > crop_at: + self.disk_stats.pop() + + self.ps_stats.end_time = crop_at + + cropped_map = {} + for key, value in self.ps_stats.process_map.items(): + if (value.start_time <= crop_at): + cropped_map[key] = value + + for proc in cropped_map.values(): + proc.duration = min (proc.duration, crop_at - proc.start_time) + while len (proc.samples) \ + and proc.samples[-1].time > crop_at: + proc.samples.pop() + + self.ps_stats.process_map = cropped_map + + return idle + -from samples import * -from process_tree import ProcessTree class ParseError(Exception): - """Represents errors during parse of the bootchart.""" - def __init__(self, value): - self.value = value + """Represents errors during parse of the bootchart.""" + def __init__(self, value): + self.value = value - def __str__(self): - return self.value + def __str__(self): + return self.value def _parse_headers(file): - """Parses the headers of the bootchart.""" - def parse((headers,last), line): - if '=' in line: last,value = map(string.strip, line.split('=', 1)) - else: value = line.strip() - headers[last] += value - return headers,last - return reduce(parse, file.read().split('\n'), (defaultdict(str),''))[0] + """Parses the headers of the bootchart.""" + def parse(acc, line): + (headers, last) = acc + if '=' in line: + last, value = map (lambda x: x.strip(), line.split('=', 1)) + else: + value = line.strip() + headers[last] += value + return headers, last + return reduce(parse, file.read().decode('utf-8').split('\n'), (defaultdict(str),''))[0] def _parse_timed_blocks(file): - """Parses (ie., splits) a file into so-called timed-blocks. A - timed-block consists of a timestamp on a line by itself followed - by zero or more lines of data for that point in time.""" - def parse(block): - lines = block.split('\n') - if not lines: - raise ParseError('expected a timed-block consisting a timestamp followed by data lines') - try: - return (int(lines[0]), lines[1:]) - except ValueError: - raise ParseError("expected a timed-block, but timestamp '%s' is not an integer" % lines[0]) - blocks = file.read().split('\n\n') - return [parse(block) for block in blocks if block.strip()] - -def _parse_proc_ps_log(file): - """ - * See proc(5) for details. - * - * {pid, comm, state, ppid, pgrp, session, tty_nr, tpgid, flags, minflt, cminflt, majflt, cmajflt, utime, stime, - * cutime, cstime, priority, nice, 0, itrealvalue, starttime, vsize, rss, rlim, startcode, endcode, startstack, - * kstkesp, kstkeip} - """ - processMap = {} - ltime = 0 - timed_blocks = _parse_timed_blocks(file) - for time, lines in timed_blocks: - for line in lines: - tokens = line.split(' ') - - offset = [index for index, token in enumerate(tokens[1:]) if token.endswith(')')][0] - pid, cmd, state, ppid = int(tokens[0]), ' '.join(tokens[1:2+offset]), tokens[2+offset], int(tokens[3+offset]) - userCpu, sysCpu, stime= int(tokens[13+offset]), int(tokens[14+offset]), int(tokens[21+offset]) - - if processMap.has_key(pid): - process = processMap[pid] - process.cmd = cmd.replace('(', '').replace(')', '') # why rename after latest name?? - else: - process = Process(pid, cmd, ppid, min(time, stime)) - processMap[pid] = process - - if process.last_user_cpu_time is not None and process.last_sys_cpu_time is not None and ltime is not None: - userCpuLoad, sysCpuLoad = process.calc_load(userCpu, sysCpu, time - ltime) - cpuSample = CPUSample('null', userCpuLoad, sysCpuLoad, 0.0) - process.samples.append(ProcessSample(time, state, cpuSample)) - - process.last_user_cpu_time = userCpu - process.last_sys_cpu_time = sysCpu - ltime = time - - startTime = timed_blocks[0][0] - avgSampleLength = (ltime - startTime)/(len(timed_blocks)-1) - - for process in processMap.values(): - process.set_parent(processMap) - - for process in processMap.values(): - process.calc_stats(avgSampleLength) - - return ProcessStats(processMap.values(), avgSampleLength, startTime, ltime) - + """Parses (ie., splits) a file into so-called timed-blocks. A + timed-block consists of a timestamp on a line by itself followed + by zero or more lines of data for that point in time.""" + def parse(block): + lines = block.split('\n') + if not lines: + raise ParseError('expected a timed-block consisting a timestamp followed by data lines') + try: + return (int(lines[0]), lines[1:]) + except ValueError: + raise ParseError("expected a timed-block, but timestamp '%s' is not an integer" % lines[0]) + blocks = file.read().decode('utf-8').split('\n\n') + return [parse(block) for block in blocks if block.strip() and not block.endswith(' not running\n')] + +def _parse_proc_ps_log(writer, file): + """ + * See proc(5) for details. + * + * {pid, comm, state, ppid, pgrp, session, tty_nr, tpgid, flags, minflt, cminflt, majflt, cmajflt, utime, stime, + * cutime, cstime, priority, nice, 0, itrealvalue, starttime, vsize, rss, rlim, startcode, endcode, startstack, + * kstkesp, kstkeip} + """ + processMap = {} + ltime = 0 + timed_blocks = _parse_timed_blocks(file) + for time, lines in timed_blocks: + for line in lines: + if not line: continue + tokens = line.split(' ') + if len(tokens) < 21: + continue + + offset = [index for index, token in enumerate(tokens[1:]) if token[-1] == ')'][0] + pid, cmd, state, ppid = int(tokens[0]), ' '.join(tokens[1:2+offset]), tokens[2+offset], int(tokens[3+offset]) + userCpu, sysCpu, stime = int(tokens[13+offset]), int(tokens[14+offset]), int(tokens[21+offset]) + + # magic fixed point-ness ... + pid *= 1000 + ppid *= 1000 + if pid in processMap: + process = processMap[pid] + process.cmd = cmd.strip('()') # why rename after latest name?? + else: + process = Process(writer, pid, cmd.strip('()'), ppid, min(time, stime)) + processMap[pid] = process + + if process.last_user_cpu_time is not None and process.last_sys_cpu_time is not None and ltime is not None: + userCpuLoad, sysCpuLoad = process.calc_load(userCpu, sysCpu, max(1, time - ltime)) + cpuSample = CPUSample('null', userCpuLoad, sysCpuLoad, 0.0) + process.samples.append(ProcessSample(time, state, cpuSample)) + + process.last_user_cpu_time = userCpu + process.last_sys_cpu_time = sysCpu + ltime = time + + if len (timed_blocks) < 2: + return None + + startTime = timed_blocks[0][0] + avgSampleLength = (ltime - startTime)/(len (timed_blocks) - 1) + + return ProcessStats (writer, processMap, len (timed_blocks), avgSampleLength, startTime, ltime) + +def _parse_taskstats_log(writer, file): + """ + * See bootchart-collector.c for details. + * + * { pid, ppid, comm, cpu_run_real_total, blkio_delay_total, swapin_delay_total } + * + """ + processMap = {} + pidRewrites = {} + ltime = None + timed_blocks = _parse_timed_blocks(file) + for time, lines in timed_blocks: + # we have no 'stime' from taskstats, so prep 'init' + if ltime is None: + process = Process(writer, 1, '[init]', 0, 0) + processMap[1000] = process + ltime = time +# continue + for line in lines: + if not line: continue + tokens = line.split(' ') + if len(tokens) != 6: + continue + + opid, ppid, cmd = int(tokens[0]), int(tokens[1]), tokens[2] + cpu_ns, blkio_delay_ns, swapin_delay_ns = long(tokens[-3]), long(tokens[-2]), long(tokens[-1]), + + # make space for trees of pids + opid *= 1000 + ppid *= 1000 + + # when the process name changes, we re-write the pid. + if opid in pidRewrites: + pid = pidRewrites[opid] + else: + pid = opid + + cmd = cmd.strip('(').strip(')') + if pid in processMap: + process = processMap[pid] + if process.cmd != cmd: + pid += 1 + pidRewrites[opid] = pid +# print "process mutation ! '%s' vs '%s' pid %s -> pid %s\n" % (process.cmd, cmd, opid, pid) + process = process.split (writer, pid, cmd, ppid, time) + processMap[pid] = process + else: + process.cmd = cmd; + else: + process = Process(writer, pid, cmd, ppid, time) + processMap[pid] = process + + delta_cpu_ns = (float) (cpu_ns - process.last_cpu_ns) + delta_blkio_delay_ns = (float) (blkio_delay_ns - process.last_blkio_delay_ns) + delta_swapin_delay_ns = (float) (swapin_delay_ns - process.last_swapin_delay_ns) + + # make up some state data ... + if delta_cpu_ns > 0: + state = "R" + elif delta_blkio_delay_ns + delta_swapin_delay_ns > 0: + state = "D" + else: + state = "S" + + # retain the ns timing information into a CPUSample - that tries + # with the old-style to be a %age of CPU used in this time-slice. + if delta_cpu_ns + delta_blkio_delay_ns + delta_swapin_delay_ns > 0: +# print "proc %s cpu_ns %g delta_cpu %g" % (cmd, cpu_ns, delta_cpu_ns) + cpuSample = CPUSample('null', delta_cpu_ns, 0.0, + delta_blkio_delay_ns, + delta_swapin_delay_ns) + process.samples.append(ProcessSample(time, state, cpuSample)) + + process.last_cpu_ns = cpu_ns + process.last_blkio_delay_ns = blkio_delay_ns + process.last_swapin_delay_ns = swapin_delay_ns + ltime = time + + if len (timed_blocks) < 2: + return None + + startTime = timed_blocks[0][0] + avgSampleLength = (ltime - startTime)/(len(timed_blocks)-1) + + return ProcessStats (writer, processMap, len (timed_blocks), avgSampleLength, startTime, ltime) + def _parse_proc_stat_log(file): - samples = [] - ltimes = None - for time, lines in _parse_timed_blocks(file): - # CPU times {user, nice, system, idle, io_wait, irq, softirq} - tokens = lines[0].split(); - times = [ int(token) for token in tokens[1:] ] - if ltimes: - user = float((times[0] + times[1]) - (ltimes[0] + ltimes[1])) - system = float((times[2] + times[5] + times[6]) - (ltimes[2] + ltimes[5] + ltimes[6])) - idle = float(times[3] - ltimes[3]) - iowait = float(times[4] - ltimes[4]) - - aSum = max(user + system + idle + iowait, 1) - samples.append( CPUSample(time, user/aSum, system/aSum, iowait/aSum) ) - - ltimes = times - # skip the rest of statistics lines - return samples - - -def _parse_proc_disk_stat_log(file, numCpu): - """ - Parse file for disk stats, but only look at the whole disks, eg. sda, - not sda1, sda2 etc. The format of relevant lines should be: - {major minor name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq} - """ - DISK_REGEX = 'hd.$|sd.$' - - def is_relevant_line(line): - return len(line.split()) == 14 and re.match(DISK_REGEX, line.split()[2]) - - disk_stat_samples = [] - - for time, lines in _parse_timed_blocks(file): - sample = DiskStatSample(time) - relevant_tokens = [line.split() for line in lines if is_relevant_line(line)] - - for tokens in relevant_tokens: - disk, rsect, wsect, use = tokens[2], int(tokens[5]), int(tokens[9]), int(tokens[12]) - sample.add_diskdata([rsect, wsect, use]) - - disk_stat_samples.append(sample) - - disk_stats = [] - for sample1, sample2 in zip(disk_stat_samples[:-1], disk_stat_samples[1:]): - interval = sample1.time - sample2.time - sums = [ a - b for a, b in zip(sample1.diskdata, sample2.diskdata) ] - readTput = sums[0] / 2.0 * 100.0 / interval - writeTput = sums[1] / 2.0 * 100.0 / interval - util = float( sums[2] ) / 10 / interval / numCpu - util = max(0.0, min(1.0, util)) - disk_stats.append(DiskSample(sample2.time, readTput, writeTput, util)) - - return disk_stats - - -def get_num_cpus(headers): - """Get the number of CPUs from the system.cpu header property. As the - CPU utilization graphs are relative, the number of CPUs currently makes - no difference.""" - if headers is None: - return 1 - cpu_model = headers.get("system.cpu") - if cpu_model is None: - return 1 - mat = re.match(".*\\((\\d+)\\)", cpu_model) - if mat is None: - return 1 - return int(mat.group(1)) + samples = [] + ltimes = None + for time, lines in _parse_timed_blocks(file): + # skip emtpy lines + if not lines: + continue + # CPU times {user, nice, system, idle, io_wait, irq, softirq} + tokens = lines[0].split() + times = [ int(token) for token in tokens[1:] ] + if ltimes: + user = float((times[0] + times[1]) - (ltimes[0] + ltimes[1])) + system = float((times[2] + times[5] + times[6]) - (ltimes[2] + ltimes[5] + ltimes[6])) + idle = float(times[3] - ltimes[3]) + iowait = float(times[4] - ltimes[4]) -class ParserState: - def __init__(self): - self.processes = {} - self.start = {} - self.end = {} + aSum = max(user + system + idle + iowait, 1) + samples.append( CPUSample(time, user/aSum, system/aSum, iowait/aSum) ) - def valid(self): - return len(self.processes) != 0 + ltimes = times + # skip the rest of statistics lines + return samples + +def _parse_reduced_log(file, sample_class): + samples = [] + for time, lines in _parse_timed_blocks(file): + samples.append(sample_class(time, *[float(x) for x in lines[0].split()])) + return samples + +def _parse_proc_disk_stat_log(file): + """ + Parse file for disk stats, but only look at the whole device, eg. sda, + not sda1, sda2 etc. The format of relevant lines should be: + {major minor name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq} + """ + disk_regex_re = re.compile ('^([hsv]d.|mtdblock\d|mmcblk\d|cciss/c\d+d\d+.*)$') + + # this gets called an awful lot. + def is_relevant_line(linetokens): + if len(linetokens) != 14: + return False + disk = linetokens[2] + return disk_regex_re.match(disk) + + disk_stat_samples = [] + + for time, lines in _parse_timed_blocks(file): + sample = DiskStatSample(time) + relevant_tokens = [linetokens for linetokens in map (lambda x: x.split(),lines) if is_relevant_line(linetokens)] + + for tokens in relevant_tokens: + disk, rsect, wsect, use = tokens[2], int(tokens[5]), int(tokens[9]), int(tokens[12]) + sample.add_diskdata([rsect, wsect, use]) + + disk_stat_samples.append(sample) + + disk_stats = [] + for sample1, sample2 in zip(disk_stat_samples[:-1], disk_stat_samples[1:]): + interval = sample1.time - sample2.time + if interval == 0: + interval = 1 + sums = [ a - b for a, b in zip(sample1.diskdata, sample2.diskdata) ] + readTput = sums[0] / 2.0 * 100.0 / interval + writeTput = sums[1] / 2.0 * 100.0 / interval + util = float( sums[2] ) / 10 / interval + util = max(0.0, min(1.0, util)) + disk_stats.append(DiskSample(sample2.time, readTput, writeTput, util)) + + return disk_stats + +def _parse_reduced_proc_meminfo_log(file): + """ + Parse file for global memory statistics with + 'MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree' values + (in that order) directly stored on one line. + """ + used_values = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree',) + + mem_stats = [] + for time, lines in _parse_timed_blocks(file): + sample = MemSample(time) + for name, value in zip(used_values, lines[0].split()): + sample.add_value(name, int(value)) + + if sample.valid(): + mem_stats.append(DrawMemSample(sample)) + + return mem_stats + +def _parse_proc_meminfo_log(file): + """ + Parse file for global memory statistics. + The format of relevant lines should be: ^key: value( unit)? + """ + used_values = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree',) + + mem_stats = [] + meminfo_re = re.compile(r'([^ \t:]+):\s*(\d+).*') + + for time, lines in _parse_timed_blocks(file): + sample = MemSample(time) + + for line in lines: + match = meminfo_re.match(line) + if not match: + raise ParseError("Invalid meminfo line \"%s\"" % line) + sample.add_value(match.group(1), int(match.group(2))) + + if sample.valid(): + mem_stats.append(DrawMemSample(sample)) + + return mem_stats + +def _parse_monitor_disk_log(file): + """ + Parse file with information about amount of diskspace used. + The format of relevant lines should be: ^volume path: number-of-bytes? + """ + disk_stats = [] + diskinfo_re = re.compile(r'^(.+):\s*(\d+)$') + + for time, lines in _parse_timed_blocks(file): + sample = DiskSpaceSample(time) + for line in lines: + match = diskinfo_re.match(line) + if not match: + raise ParseError("Invalid monitor_disk line \"%s\"" % line) + sample.add_value(match.group(1), int(match.group(2))) -_relevant_files = set(["header", "proc_diskstats.log", "proc_ps.log", "proc_stat.log"]) + if sample.valid(): + disk_stats.append(sample) -def _do_parse(state, filename, file, mintime): - #print filename - #writer.status("parsing '%s'" % filename) + return disk_stats + + +# if we boot the kernel with: initcall_debug printk.time=1 we can +# get all manner of interesting data from the dmesg output +# We turn this into a pseudo-process tree: each event is +# characterised by a +# we don't try to detect a "kernel finished" state - since the kernel +# continues to do interesting things after init is called. +# +# sample input: +# [ 0.000000] ACPI: FACP 3f4fc000 000F4 (v04 INTEL Napa 00000001 MSFT 01000013) +# ... +# [ 0.039993] calling migration_init+0x0/0x6b @ 1 +# [ 0.039993] initcall migration_init+0x0/0x6b returned 1 after 0 usecs +def _parse_dmesg(writer, file): + timestamp_re = re.compile ("^\[\s*(\d+\.\d+)\s*]\s+(.*)$") + split_re = re.compile ("^(\S+)\s+([\S\+_-]+) (.*)$") + processMap = {} + idx = 0 + inc = 1.0 / 1000000 + kernel = Process(writer, idx, "k-boot", 0, 0.1) + processMap['k-boot'] = kernel + base_ts = False + max_ts = 0 + for line in file.read().decode('utf-8').split('\n'): + t = timestamp_re.match (line) + if t is None: +# print "duff timestamp " + line + continue + + time_ms = float (t.group(1)) * 1000 + # looks like we may have a huge diff after the clock + # has been set up. This could lead to huge graph: + # so huge we will be killed by the OOM. + # So instead of using the plain timestamp we will + # use a delta to first one and skip the first one + # for convenience + if max_ts == 0 and not base_ts and time_ms > 1000: + base_ts = time_ms + continue + max_ts = max(time_ms, max_ts) + if base_ts: +# print "fscked clock: used %f instead of %f" % (time_ms - base_ts, time_ms) + time_ms -= base_ts + m = split_re.match (t.group(2)) + + if m is None: + continue +# print "match: '%s'" % (m.group(1)) + type = m.group(1) + func = m.group(2) + rest = m.group(3) + + if t.group(2).startswith ('Write protecting the') or \ + t.group(2).startswith ('Freeing unused kernel memory'): + kernel.duration = time_ms / 10 + continue + +# print "foo: '%s' '%s' '%s'" % (type, func, rest) + if type == "calling": + ppid = kernel.pid + p = re.match ("\@ (\d+)", rest) + if p is not None: + ppid = float (p.group(1)) // 1000 +# print "match: '%s' ('%g') at '%s'" % (func, ppid, time_ms) + name = func.split ('+', 1) [0] + idx += inc + processMap[func] = Process(writer, ppid + idx, name, ppid, time_ms / 10) + elif type == "initcall": +# print "finished: '%s' at '%s'" % (func, time_ms) + if func in processMap: + process = processMap[func] + process.duration = (time_ms / 10) - process.start_time + else: + print("corrupted init call for %s" % (func)) + + elif type == "async_waiting" or type == "async_continuing": + continue # ignore + + return processMap.values() + +# +# Parse binary pacct accounting file output if we have one +# cf. /usr/include/linux/acct.h +# +def _parse_pacct(writer, file): + # read LE int32 + def _read_le_int32(file): + byts = file.read(4) + return (ord(byts[0])) | (ord(byts[1]) << 8) | \ + (ord(byts[2]) << 16) | (ord(byts[3]) << 24) + + parent_map = {} + parent_map[0] = 0 + while file.read(1) != "": # ignore flags + ver = file.read(1) + if ord(ver) < 3: + print("Invalid version 0x%x" % (ord(ver))) + return None + + file.seek (14, 1) # user, group etc. + pid = _read_le_int32 (file) + ppid = _read_le_int32 (file) +# print "Parent of %d is %d" % (pid, ppid) + parent_map[pid] = ppid + file.seek (4 + 4 + 16, 1) # timings + file.seek (16, 1) # acct_comm + return parent_map + +def _parse_paternity_log(writer, file): + parent_map = {} + parent_map[0] = 0 + for line in file.read().decode('utf-8').split('\n'): + if not line: + continue + elems = line.split(' ') # <Child> <Parent> + if len (elems) >= 2: +# print "paternity of %d is %d" % (int(elems[0]), int(elems[1])) + parent_map[int(elems[0])] = int(elems[1]) + else: + print("Odd paternity line '%s'" % (line)) + return parent_map + +def _parse_cmdline_log(writer, file): + cmdLines = {} + for block in file.read().decode('utf-8').split('\n\n'): + lines = block.split('\n') + if len (lines) >= 3: +# print "Lines '%s'" % (lines[0]) + pid = int (lines[0]) + values = {} + values['exe'] = lines[1].lstrip(':') + args = lines[2].lstrip(':').split('\0') + args.pop() + values['args'] = args + cmdLines[pid] = values + return cmdLines + +def _parse_bitbake_buildstats(writer, state, filename, file): paths = filename.split("/") task = paths[-1] pn = paths[-2] @@ -183,63 +702,97 @@ def _do_parse(state, filename, file, mintime): start = int(float(line.split()[-1])) elif line.startswith("Ended:"): end = int(float(line.split()[-1])) - if start and end and (end - start) >= mintime: - k = pn + ":" + task - state.processes[pn + ":" + task] = [start, end] - if start not in state.start: - state.start[start] = [] - if k not in state.start[start]: - state.start[start].append(pn + ":" + task) - if end not in state.end: - state.end[end] = [] - if k not in state.end[end]: - state.end[end].append(pn + ":" + task) + if start and end: + state.add_process(pn + ":" + task, start, end) + +def get_num_cpus(headers): + """Get the number of CPUs from the system.cpu header property. As the + CPU utilization graphs are relative, the number of CPUs currently makes + no difference.""" + if headers is None: + return 1 + if headers.get("system.cpu.num"): + return max (int (headers.get("system.cpu.num")), 1) + cpu_model = headers.get("system.cpu") + if cpu_model is None: + return 1 + mat = re.match(".*\\((\\d+)\\)", cpu_model) + if mat is None: + return 1 + return max (int(mat.group(1)), 1) + +def _do_parse(writer, state, filename, file): + writer.info("parsing '%s'" % filename) + t1 = clock() + name = os.path.basename(filename) + if name == "proc_diskstats.log": + state.disk_stats = _parse_proc_disk_stat_log(file) + elif name == "reduced_proc_diskstats.log": + state.disk_stats = _parse_reduced_log(file, DiskSample) + elif name == "proc_stat.log": + state.cpu_stats = _parse_proc_stat_log(file) + elif name == "reduced_proc_stat.log": + state.cpu_stats = _parse_reduced_log(file, CPUSample) + elif name == "proc_meminfo.log": + state.mem_stats = _parse_proc_meminfo_log(file) + elif name == "reduced_proc_meminfo.log": + state.mem_stats = _parse_reduced_proc_meminfo_log(file) + elif name == "cmdline2.log": + state.cmdline = _parse_cmdline_log(writer, file) + elif name == "monitor_disk.log": + state.monitor_disk = _parse_monitor_disk_log(file) + elif not filename.endswith('.log'): + _parse_bitbake_buildstats(writer, state, filename, file) + t2 = clock() + writer.info(" %s seconds" % str(t2-t1)) return state -def parse_file(state, filename, mintime): +def parse_file(writer, state, filename): + if state.filename is None: + state.filename = filename basename = os.path.basename(filename) with open(filename, "rb") as file: - return _do_parse(state, filename, file, mintime) + return _do_parse(writer, state, filename, file) -def parse_paths(state, paths, mintime): +def parse_paths(writer, state, paths): for path in paths: - root,extension = os.path.splitext(path) + if state.filename is None: + state.filename = path + root, extension = os.path.splitext(path) if not(os.path.exists(path)): - print "warning: path '%s' does not exist, ignoring." % path + writer.warn("warning: path '%s' does not exist, ignoring." % path) continue + #state.filename = path if os.path.isdir(path): - files = [ f for f in [os.path.join(path, f) for f in os.listdir(path)] ] - files.sort() - state = parse_paths(state, files, mintime) - elif extension in [".tar", ".tgz", ".tar.gz"]: + files = sorted([os.path.join(path, f) for f in os.listdir(path)]) + state = parse_paths(writer, state, files) + elif extension in [".tar", ".tgz", ".gz"]: + if extension == ".gz": + root, extension = os.path.splitext(root) + if extension != ".tar": + writer.warn("warning: can only handle zipped tar files, not zipped '%s'-files; ignoring" % extension) + continue tf = None try: + writer.status("parsing '%s'" % path) tf = tarfile.open(path, 'r:*') for name in tf.getnames(): - state = _do_parse(state, name, tf.extractfile(name)) - except tarfile.ReadError, error: + state = _do_parse(writer, state, name, tf.extractfile(name)) + except tarfile.ReadError as error: raise ParseError("error: could not read tarfile '%s': %s." % (path, error)) finally: if tf != None: tf.close() else: - state = parse_file(state, path, mintime) - return state - -def parse(paths, prune, mintime): - state = parse_paths(ParserState(), paths, mintime) - if not state.valid(): - raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths)) - #monitored_app = state.headers.get("profile.process") - #proc_tree = ProcessTree(state.ps_stats, monitored_app, prune) + state = parse_file(writer, state, path) return state -def split_res(res, n): +def split_res(res, options): """ Split the res into n pieces """ res_list = [] - if n > 1: + if options.num > 1: s_list = sorted(res.start.keys()) - frag_size = len(s_list) / float(n) + frag_size = len(s_list) / float(options.num) # Need the top value if frag_size > int(frag_size): frag_size = int(frag_size + 1) @@ -249,24 +802,15 @@ def split_res(res, n): start = 0 end = frag_size while start < end: - state = ParserState() + state = Trace(None, [], None) + if options.full_time: + state.min = min(res.start.keys()) + state.max = max(res.end.keys()) for i in range(start, end): - # Add these lines for reference - #state.processes[pn + ":" + task] = [start, end] - #state.start[start] = pn + ":" + task - #state.end[end] = pn + ":" + task + # Add this line for reference + #state.add_process(pn + ":" + task, start, end) for p in res.start[s_list[i]]: - s = s_list[i] - e = res.processes[p][1] - state.processes[p] = [s, e] - if s not in state.start: - state.start[s] = [] - if p not in state.start[s]: - state.start[s].append(p) - if e not in state.end: - state.end[e] = [] - if p not in state.end[e]: - state.end[e].append(p) + state.add_process(p, s_list[i], res.processes[p][1]) start = end end = end + frag_size if end > len(s_list): diff --git a/scripts/pybootchartgui/pybootchartgui/process_tree.py b/scripts/pybootchartgui/pybootchartgui/process_tree.py index bde29ebda8..cf88110b1c 100644 --- a/scripts/pybootchartgui/pybootchartgui/process_tree.py +++ b/scripts/pybootchartgui/pybootchartgui/process_tree.py @@ -1,3 +1,18 @@ +# This file is part of pybootchartgui. + +# pybootchartgui is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# pybootchartgui is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. + class ProcessTree: """ProcessTree encapsulates a process tree. The tree is built from log files retrieved during the boot process. When building the process tree, it is @@ -19,55 +34,61 @@ class ProcessTree: are merged together. """ - LOGGER_PROC = 'bootchartd' + LOGGER_PROC = 'bootchart-colle' EXPLODER_PROCESSES = set(['hwup']) - def __init__(self, psstats, monitoredApp, prune, for_testing = False): + def __init__(self, writer, kernel, psstats, sample_period, + monitoredApp, prune, idle, taskstats, + accurate_parentage, for_testing = False): + self.writer = writer self.process_tree = [] - self.psstats = psstats - self.process_list = sorted(psstats.process_list, key = lambda p: p.pid) - self.sample_period = psstats.sample_period - - self.build() - self.update_ppids_for_daemons(self.process_list) + self.taskstats = taskstats + if psstats is None: + process_list = kernel + elif kernel is None: + process_list = psstats.process_map.values() + else: + process_list = list(kernel) + list(psstats.process_map.values()) + self.process_list = sorted(process_list, key = lambda p: p.pid) + self.sample_period = sample_period + + self.build() + if not accurate_parentage: + self.update_ppids_for_daemons(self.process_list) self.start_time = self.get_start_time(self.process_tree) self.end_time = self.get_end_time(self.process_tree) self.duration = self.end_time - self.start_time + self.idle = idle if for_testing: return - # print 'proc_tree before prune: num_proc=%i, duration=%i' % (self.num_nodes(self.process_list), self.duration) - - removed = self.merge_logger(self.process_tree, self.LOGGER_PROC, monitoredApp, False) - print "Merged %i logger processes" % removed + removed = self.merge_logger(self.process_tree, self.LOGGER_PROC, monitoredApp, False) + writer.status("merged %i logger processes" % removed) - if prune: - removed = self.prune(self.process_tree, None) - print "Pruned %i processes" % removed - removed = self.merge_exploders(self.process_tree, self.EXPLODER_PROCESSES) - print "Pruned %i exploders" % removed - removed = self.merge_siblings(self.process_tree) - print "Pruned %i threads" % removed - removed = self.merge_runs(self.process_tree) - print "Pruned %i runs" % removed + if prune: + p_processes = self.prune(self.process_tree, None) + p_exploders = self.merge_exploders(self.process_tree, self.EXPLODER_PROCESSES) + p_threads = self.merge_siblings(self.process_tree) + p_runs = self.merge_runs(self.process_tree) + writer.status("pruned %i process, %i exploders, %i threads, and %i runs" % (p_processes, p_exploders, p_threads, p_runs)) self.sort(self.process_tree) - self.start_time = self.get_start_time(self.process_tree) + self.start_time = self.get_start_time(self.process_tree) self.end_time = self.get_end_time(self.process_tree) - self.duration = self.end_time - self.start_time + self.duration = self.end_time - self.start_time - self.num_proc = self.num_nodes(self.process_tree) + self.num_proc = self.num_nodes(self.process_tree) def build(self): """Build the process tree from the list of top samples.""" self.process_tree = [] - for proc in self.process_list: + for proc in self.process_list: if not proc.parent: self.process_tree.append(proc) - else: + else: proc.parent.child_list.append(proc) def sort(self, process_subtree): @@ -85,11 +106,11 @@ class ProcessTree: def get_start_time(self, process_subtree): """Returns the start time of the process subtree. This is the start - time of the earliest process. + time of the earliest process. """ if not process_subtree: - return 100000000; + return 100000000 return min( [min(proc.start_time, self.get_start_time(proc.child_list)) for proc in process_subtree] ) def get_end_time(self, process_subtree): @@ -98,13 +119,13 @@ class ProcessTree: """ if not process_subtree: - return -100000000; + return -100000000 return max( [max(proc.start_time + proc.duration, self.get_end_time(proc.child_list)) for proc in process_subtree] ) def get_max_pid(self, process_subtree): """Returns the max PID found in the process tree.""" if not process_subtree: - return -100000000; + return -100000000 return max( [max(proc.pid, self.get_max_pid(proc.child_list)) for proc in process_subtree] ) def update_ppids_for_daemons(self, process_list): @@ -118,29 +139,29 @@ class ProcessTree: rcendpid = -1 rcproc = None for p in process_list: - if p.cmd == "rc" and p.ppid == 1: + if p.cmd == "rc" and p.ppid // 1000 == 1: rcproc = p rcstartpid = p.pid rcendpid = self.get_max_pid(p.child_list) if rcstartpid != -1 and rcendpid != -1: for p in process_list: - if p.pid > rcstartpid and p.pid < rcendpid and p.ppid == 1: + if p.pid > rcstartpid and p.pid < rcendpid and p.ppid // 1000 == 1: p.ppid = rcstartpid p.parent = rcproc for p in process_list: p.child_list = [] self.build() - + def prune(self, process_subtree, parent): """Prunes the process tree by removing idle processes and processes - that only live for the duration of a single top sample. Sibling - processes with the same command line (i.e. threads) are merged - together. This filters out sleepy background processes, short-lived - processes and bootcharts' analysis tools. + that only live for the duration of a single top sample. Sibling + processes with the same command line (i.e. threads) are merged + together. This filters out sleepy background processes, short-lived + processes and bootcharts' analysis tools. """ def is_idle_background_process_without_children(p): process_end = p.start_time + p.duration - return not p.active and \ + return not p.active and \ process_end >= self.start_time + self.duration and \ p.start_time > self.start_time and \ p.duration > 0.9 * self.duration and \ @@ -175,8 +196,8 @@ class ProcessTree: def merge_logger(self, process_subtree, logger_proc, monitored_app, app_tree): """Merges the logger's process subtree. The logger will typically - spawn lots of sleep and cat processes, thus polluting the - process tree. + spawn lots of sleep and cat processes, thus polluting the + process tree. """ num_removed = 0 @@ -185,7 +206,7 @@ class ProcessTree: if logger_proc == p.cmd and not app_tree: is_app_tree = True num_removed += self.merge_logger(p.child_list, logger_proc, monitored_app, is_app_tree) - # don't remove the logger itself + # don't remove the logger itself continue if app_tree and monitored_app != None and monitored_app == p.cmd: @@ -193,7 +214,7 @@ class ProcessTree: if is_app_tree: for child in p.child_list: - self.__merge_processes(p, child) + self.merge_processes(p, child) num_removed += 1 p.child_list = [] else: @@ -202,7 +223,7 @@ class ProcessTree: def merge_exploders(self, process_subtree, processes): """Merges specific process subtrees (used for processes which usually - spawn huge meaningless process trees). + spawn huge meaningless process trees). """ num_removed = 0 @@ -210,7 +231,7 @@ class ProcessTree: if processes in processes and len(p.child_list) > 0: subtreemap = self.getProcessMap(p.child_list) for child in subtreemap.values(): - self.__merge_processes(p, child) + self.merge_processes(p, child) num_removed += len(subtreemap) p.child_list = [] p.cmd += " (+)" @@ -218,10 +239,10 @@ class ProcessTree: num_removed += self.merge_exploders(p.child_list, processes) return num_removed - def merge_siblings(self,process_subtree): + def merge_siblings(self, process_subtree): """Merges thread processes. Sibling processes with the same command - line are merged together. - + line are merged together. + """ num_removed = 0 idx = 0 @@ -233,7 +254,7 @@ class ProcessTree: idx -= 1 num_removed += 1 p.child_list.extend(nextp.child_list) - self.__merge_processes(p, nextp) + self.merge_processes(p, nextp) num_removed += self.merge_siblings(p.child_list) idx += 1 if len(process_subtree) > 0: @@ -243,7 +264,7 @@ class ProcessTree: def merge_runs(self, process_subtree): """Merges process runs. Single child processes which share the same - command line with the parent are merged. + command line with the parent are merged. """ num_removed = 0 @@ -253,16 +274,17 @@ class ProcessTree: if len(p.child_list) == 1 and p.child_list[0].cmd == p.cmd: child = p.child_list[0] p.child_list = list(child.child_list) - self.__merge_processes(p, child) + self.merge_processes(p, child) num_removed += 1 continue num_removed += self.merge_runs(p.child_list) idx += 1 return num_removed - def __merge_processes(self, p1, p2): - """Merges two process samples.""" + def merge_processes(self, p1, p2): + """Merges two process' samples.""" p1.samples.extend(p2.samples) + p1.samples.sort( key = lambda p: p.time ) p1time = p1.start_time p2time = p2.start_time p1.start_time = min(p1time, p2time) diff --git a/scripts/pybootchartgui/pybootchartgui/samples.py b/scripts/pybootchartgui/pybootchartgui/samples.py index c94b30d032..9fc309b3ab 100644 --- a/scripts/pybootchartgui/pybootchartgui/samples.py +++ b/scripts/pybootchartgui/pybootchartgui/samples.py @@ -1,93 +1,178 @@ +# This file is part of pybootchartgui. + +# pybootchartgui is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# pybootchartgui is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. + + class DiskStatSample: - def __init__(self, time): - self.time = time - self.diskdata = [0, 0, 0] - def add_diskdata(self, new_diskdata): - self.diskdata = [ a + b for a, b in zip(self.diskdata, new_diskdata) ] + def __init__(self, time): + self.time = time + self.diskdata = [0, 0, 0] + def add_diskdata(self, new_diskdata): + self.diskdata = [ a + b for a, b in zip(self.diskdata, new_diskdata) ] class CPUSample: - def __init__(self, time, user, sys, io): - self.time = time - self.user = user - self.sys = sys - self.io = io - - def __str__(self): - return str(self.time) + "\t" + str(self.user) + "\t" + str(self.sys) + "\t" + str(self.io); - + def __init__(self, time, user, sys, io = 0.0, swap = 0.0): + self.time = time + self.user = user + self.sys = sys + self.io = io + self.swap = swap + + @property + def cpu(self): + return self.user + self.sys + + def __str__(self): + return str(self.time) + "\t" + str(self.user) + "\t" + \ + str(self.sys) + "\t" + str(self.io) + "\t" + str (self.swap) + +class MemSample: + used_values = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree',) + + def __init__(self, time): + self.time = time + self.records = {} + + def add_value(self, name, value): + if name in MemSample.used_values: + self.records[name] = value + + def valid(self): + keys = self.records.keys() + # discard incomplete samples + return [v for v in MemSample.used_values if v not in keys] == [] + +class DrawMemSample: + """ + Condensed version of a MemSample with exactly the values used by the drawing code. + Initialized either from a valid MemSample or + a tuple/list of buffer/used/cached/swap values. + """ + def __init__(self, mem_sample): + self.time = mem_sample.time + if isinstance(mem_sample, MemSample): + self.buffers = mem_sample.records['MemTotal'] - mem_sample.records['MemFree'] + self.used = mem_sample.records['MemTotal'] - mem_sample.records['MemFree'] - mem_sample.records['Buffers'] + self.cached = mem_sample.records['Cached'] + self.swap = mem_sample.records['SwapTotal'] - mem_sample.records['SwapFree'] + else: + self.buffers, self.used, self.cached, self.swap = mem_sample + +class DiskSpaceSample: + def __init__(self, time): + self.time = time + self.records = {} + + def add_value(self, name, value): + self.records[name] = value + + def valid(self): + return bool(self.records) + class ProcessSample: - def __init__(self, time, state, cpu_sample): - self.time = time - self.state = state - self.cpu_sample = cpu_sample - - def __str__(self): - return str(self.time) + "\t" + str(self.state) + "\t" + str(self.cpu_sample); + def __init__(self, time, state, cpu_sample): + self.time = time + self.state = state + self.cpu_sample = cpu_sample + + def __str__(self): + return str(self.time) + "\t" + str(self.state) + "\t" + str(self.cpu_sample) class ProcessStats: - def __init__(self, process_list, sample_period, start_time, end_time): - self.process_list = process_list - self.sample_period = sample_period - self.start_time = start_time - self.end_time = end_time - -class Process: - def __init__(self, pid, cmd, ppid, start_time): - self.pid = pid - self.cmd = cmd.strip('(').strip(')') - self.ppid = ppid - self.start_time = start_time - self.samples = [] - self.parent = None - self.child_list = [] - - self.duration = 0 - self.active = None - - self.last_user_cpu_time = None - self.last_sys_cpu_time = None - - def __str__(self): - return " ".join([str(self.pid), self.cmd, str(self.ppid), '[ ' + str(len(self.samples)) + ' samples ]' ]) - - def calc_stats(self, samplePeriod): - if self.samples: - firstSample = self.samples[0] - lastSample = self.samples[-1] - self.start_time = min(firstSample.time, self.start_time) - self.duration = lastSample.time - self.start_time + samplePeriod - - activeCount = sum( [1 for sample in self.samples if sample.cpu_sample and sample.cpu_sample.sys + sample.cpu_sample.user + sample.cpu_sample.io > 0.0] ) - activeCount = activeCount + sum( [1 for sample in self.samples if sample.state == 'D'] ) - self.active = (activeCount>2) - - def calc_load(self, userCpu, sysCpu, interval): - - userCpuLoad = float(userCpu - self.last_user_cpu_time) / interval - sysCpuLoad = float(sysCpu - self.last_sys_cpu_time) / interval - cpuLoad = userCpuLoad + sysCpuLoad - # normalize - if cpuLoad > 1.0: - userCpuLoad = userCpuLoad / cpuLoad; - sysCpuLoad = sysCpuLoad / cpuLoad; - return (userCpuLoad, sysCpuLoad) - - def set_parent(self, processMap): - if self.ppid != None: - self.parent = processMap.get(self.ppid) - if self.parent == None and self.pid > 1: - print "warning: no parent for pid '%i' with ppid '%i'" % (self.pid,self.ppid) - def get_end_time(self): - return self.start_time + self.duration + def __init__(self, writer, process_map, sample_count, sample_period, start_time, end_time): + self.process_map = process_map + self.sample_count = sample_count + self.sample_period = sample_period + self.start_time = start_time + self.end_time = end_time + writer.info ("%d samples, avg. sample length %f" % (self.sample_count, self.sample_period)) + writer.info ("process list size: %d" % len (self.process_map.values())) -class DiskSample: - def __init__(self, time, read, write, util): - self.time = time - self.read = read - self.write = write - self.util = util - self.tput = read + write +class Process: + def __init__(self, writer, pid, cmd, ppid, start_time): + self.writer = writer + self.pid = pid + self.cmd = cmd + self.exe = cmd + self.args = [] + self.ppid = ppid + self.start_time = start_time + self.duration = 0 + self.samples = [] + self.parent = None + self.child_list = [] + + self.active = None + self.last_user_cpu_time = None + self.last_sys_cpu_time = None + + self.last_cpu_ns = 0 + self.last_blkio_delay_ns = 0 + self.last_swapin_delay_ns = 0 + + # split this process' run - triggered by a name change + def split(self, writer, pid, cmd, ppid, start_time): + split = Process (writer, pid, cmd, ppid, start_time) + + split.last_cpu_ns = self.last_cpu_ns + split.last_blkio_delay_ns = self.last_blkio_delay_ns + split.last_swapin_delay_ns = self.last_swapin_delay_ns + + return split - def __str__(self): - return "\t".join([str(self.time), str(self.read), str(self.write), str(self.util)]) + def __str__(self): + return " ".join([str(self.pid), self.cmd, str(self.ppid), '[ ' + str(len(self.samples)) + ' samples ]' ]) + + def calc_stats(self, samplePeriod): + if self.samples: + firstSample = self.samples[0] + lastSample = self.samples[-1] + self.start_time = min(firstSample.time, self.start_time) + self.duration = lastSample.time - self.start_time + samplePeriod + + activeCount = sum( [1 for sample in self.samples if sample.cpu_sample and sample.cpu_sample.sys + sample.cpu_sample.user + sample.cpu_sample.io > 0.0] ) + activeCount = activeCount + sum( [1 for sample in self.samples if sample.state == 'D'] ) + self.active = (activeCount>2) + + def calc_load(self, userCpu, sysCpu, interval): + userCpuLoad = float(userCpu - self.last_user_cpu_time) / interval + sysCpuLoad = float(sysCpu - self.last_sys_cpu_time) / interval + cpuLoad = userCpuLoad + sysCpuLoad + # normalize + if cpuLoad > 1.0: + userCpuLoad = userCpuLoad / cpuLoad + sysCpuLoad = sysCpuLoad / cpuLoad + return (userCpuLoad, sysCpuLoad) + + def set_parent(self, processMap): + if self.ppid != None: + self.parent = processMap.get (self.ppid) + if self.parent == None and self.pid // 1000 > 1 and \ + not (self.ppid == 2000 or self.pid == 2000): # kernel threads: ppid=2 + self.writer.warn("Missing CONFIG_PROC_EVENTS: no parent for pid '%i' ('%s') with ppid '%i'" \ + % (self.pid,self.cmd,self.ppid)) + + def get_end_time(self): + return self.start_time + self.duration + +class DiskSample: + def __init__(self, time, read, write, util): + self.time = time + self.read = read + self.write = write + self.util = util + self.tput = read + write + def __str__(self): + return "\t".join([str(self.time), str(self.read), str(self.write), str(self.util)]) diff --git a/scripts/pybootchartgui/pybootchartgui/tests/parser_test.py b/scripts/pybootchartgui/pybootchartgui/tests/parser_test.py index 574c2c7a2b..00fb3bf797 100644 --- a/scripts/pybootchartgui/pybootchartgui/tests/parser_test.py +++ b/scripts/pybootchartgui/pybootchartgui/tests/parser_test.py @@ -4,90 +4,102 @@ import unittest sys.path.insert(0, os.getcwd()) -import parsing +import pybootchartgui.parsing as parsing +import pybootchartgui.main as main debug = False def floatEq(f1, f2): return math.fabs(f1-f2) < 0.00001 +bootchart_dir = os.path.join(os.path.dirname(sys.argv[0]), '../../examples/1/') +parser = main._mk_options_parser() +options, args = parser.parse_args(['--q', bootchart_dir]) +writer = main._mk_writer(options) + class TestBCParser(unittest.TestCase): def setUp(self): self.name = "My first unittest" - self.rootdir = '../examples/1' + self.rootdir = bootchart_dir def mk_fname(self,f): return os.path.join(self.rootdir, f) def testParseHeader(self): - state = parsing.parse_file(parsing.ParserState(), self.mk_fname('header')) + trace = parsing.Trace(writer, args, options) + state = parsing.parse_file(writer, trace, self.mk_fname('header')) self.assertEqual(6, len(state.headers)) self.assertEqual(2, parsing.get_num_cpus(state.headers)) def test_parseTimedBlocks(self): - state = parsing.parse_file(parsing.ParserState(), self.mk_fname('proc_diskstats.log')) + trace = parsing.Trace(writer, args, options) + state = parsing.parse_file(writer, trace, self.mk_fname('proc_diskstats.log')) self.assertEqual(141, len(state.disk_stats)) def testParseProcPsLog(self): - state = parsing.parse_file(parsing.ParserState(), self.mk_fname('proc_ps.log')) + trace = parsing.Trace(writer, args, options) + state = parsing.parse_file(writer, trace, self.mk_fname('proc_ps.log')) samples = state.ps_stats - processes = samples.process_list - sorted_processes = sorted(processes, key=lambda p: p.pid ) - - for index, line in enumerate(open(self.mk_fname('extract2.proc_ps.log'))): + processes = samples.process_map + sorted_processes = [processes[k] for k in sorted(processes.keys())] + + ps_data = open(self.mk_fname('extract2.proc_ps.log')) + for index, line in enumerate(ps_data): tokens = line.split(); process = sorted_processes[index] - if debug: - print tokens[0:4] - print process.pid, process.cmd, process.ppid, len(process.samples) - print '-------------------' - - self.assertEqual(tokens[0], str(process.pid)) + if debug: + print(tokens[0:4]) + print(process.pid / 1000, process.cmd, process.ppid, len(process.samples)) + print('-------------------') + + self.assertEqual(tokens[0], str(process.pid // 1000)) self.assertEqual(tokens[1], str(process.cmd)) - self.assertEqual(tokens[2], str(process.ppid)) + self.assertEqual(tokens[2], str(process.ppid // 1000)) self.assertEqual(tokens[3], str(len(process.samples))) - + ps_data.close() def testparseProcDiskStatLog(self): - state_with_headers = parsing.parse_file(parsing.ParserState(), self.mk_fname('header')) + trace = parsing.Trace(writer, args, options) + state_with_headers = parsing.parse_file(writer, trace, self.mk_fname('header')) state_with_headers.headers['system.cpu'] = 'xxx (2)' - samples = parsing.parse_file(state_with_headers, self.mk_fname('proc_diskstats.log')).disk_stats + samples = parsing.parse_file(writer, state_with_headers, self.mk_fname('proc_diskstats.log')).disk_stats self.assertEqual(141, len(samples)) - - for index, line in enumerate(open(self.mk_fname('extract.proc_diskstats.log'))): + + diskstats_data = open(self.mk_fname('extract.proc_diskstats.log')) + for index, line in enumerate(diskstats_data): tokens = line.split('\t') sample = samples[index] if debug: - print line.rstrip(), - print sample - print '-------------------' + print(line.rstrip()) + print(sample) + print('-------------------') self.assertEqual(tokens[0], str(sample.time)) self.assert_(floatEq(float(tokens[1]), sample.read)) self.assert_(floatEq(float(tokens[2]), sample.write)) self.assert_(floatEq(float(tokens[3]), sample.util)) + diskstats_data.close() def testparseProcStatLog(self): - samples = parsing.parse_file(parsing.ParserState(), self.mk_fname('proc_stat.log')).cpu_stats + trace = parsing.Trace(writer, args, options) + samples = parsing.parse_file(writer, trace, self.mk_fname('proc_stat.log')).cpu_stats self.assertEqual(141, len(samples)) - - for index, line in enumerate(open(self.mk_fname('extract.proc_stat.log'))): + + stat_data = open(self.mk_fname('extract.proc_stat.log')) + for index, line in enumerate(stat_data): tokens = line.split('\t') sample = samples[index] if debug: - print line.rstrip() - print sample - print '-------------------' + print(line.rstrip()) + print(sample) + print('-------------------') self.assert_(floatEq(float(tokens[0]), sample.time)) self.assert_(floatEq(float(tokens[1]), sample.user)) self.assert_(floatEq(float(tokens[2]), sample.sys)) self.assert_(floatEq(float(tokens[3]), sample.io)) - - def testParseLogDir(self): - res = parsing.parse([self.rootdir], False) - self.assertEqual(4, len(res)) - + stat_data.close() + if __name__ == '__main__': unittest.main() diff --git a/scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py b/scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py index 971e125eab..6f46a1c03d 100644 --- a/scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py +++ b/scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py @@ -4,16 +4,28 @@ import unittest sys.path.insert(0, os.getcwd()) -import parsing -import process_tree +import pybootchartgui.parsing as parsing +import pybootchartgui.process_tree as process_tree +import pybootchartgui.main as main + +if sys.version_info >= (3, 0): + long = int class TestProcessTree(unittest.TestCase): def setUp(self): - self.name = "Process tree unittest" - self.rootdir = '../examples/1' - self.ps_stats = parsing.parse_file(parsing.ParserState(), self.mk_fname('proc_ps.log')).ps_stats - self.processtree = process_tree.ProcessTree(self.ps_stats, None, False, for_testing = True) + self.name = "Process tree unittest" + self.rootdir = os.path.join(os.path.dirname(sys.argv[0]), '../../examples/1/') + + parser = main._mk_options_parser() + options, args = parser.parse_args(['--q', self.rootdir]) + writer = main._mk_writer(options) + trace = parsing.Trace(writer, args, options) + + parsing.parse_file(writer, trace, self.mk_fname('proc_ps.log')) + trace.compile(writer) + self.processtree = process_tree.ProcessTree(writer, None, trace.ps_stats, \ + trace.ps_stats.sample_period, None, options.prune, None, None, False, for_testing = True) def mk_fname(self,f): return os.path.join(self.rootdir, f) @@ -26,14 +38,16 @@ class TestProcessTree(unittest.TestCase): return flattened def checkAgainstJavaExtract(self, filename, process_tree): - for expected, actual in zip(open(filename), self.flatten(process_tree)): + test_data = open(filename) + for expected, actual in zip(test_data, self.flatten(process_tree)): tokens = expected.split('\t') - self.assertEqual(int(tokens[0]), actual.pid) + self.assertEqual(int(tokens[0]), actual.pid // 1000) self.assertEqual(tokens[1], actual.cmd) self.assertEqual(long(tokens[2]), 10 * actual.start_time) self.assert_(long(tokens[3]) - 10 * actual.duration < 5, "duration") self.assertEqual(int(tokens[4]), len(actual.child_list)) self.assertEqual(int(tokens[5]), len(actual.samples)) + test_data.close() def testBuild(self): process_tree = self.processtree.process_tree diff --git a/scripts/pythondeps b/scripts/pythondeps new file mode 100755 index 0000000000..590b9769e7 --- /dev/null +++ b/scripts/pythondeps @@ -0,0 +1,250 @@ +#!/usr/bin/env python3 +# +# Determine dependencies of python scripts or available python modules in a search path. +# +# Given the -d argument and a filename/filenames, returns the modules imported by those files. +# Given the -d argument and a directory/directories, recurses to find all +# python packages and modules, returns the modules imported by these. +# Given the -p argument and a path or paths, scans that path for available python modules/packages. + +import argparse +import ast +import imp +import logging +import os.path +import sys + + +logger = logging.getLogger('pythondeps') + +suffixes = [] +for triple in imp.get_suffixes(): + suffixes.append(triple[0]) + + +class PythonDepError(Exception): + pass + + +class DependError(PythonDepError): + def __init__(self, path, error): + self.path = path + self.error = error + PythonDepError.__init__(self, error) + + def __str__(self): + return "Failure determining dependencies of {}: {}".format(self.path, self.error) + + +class ImportVisitor(ast.NodeVisitor): + def __init__(self): + self.imports = set() + self.importsfrom = [] + + def visit_Import(self, node): + for alias in node.names: + self.imports.add(alias.name) + + def visit_ImportFrom(self, node): + self.importsfrom.append((node.module, [a.name for a in node.names], node.level)) + + +def walk_up(path): + while path: + yield path + path, _, _ = path.rpartition(os.sep) + + +def get_provides(path): + path = os.path.realpath(path) + + def get_fn_name(fn): + for suffix in suffixes: + if fn.endswith(suffix): + return fn[:-len(suffix)] + + isdir = os.path.isdir(path) + if isdir: + pkg_path = path + walk_path = path + else: + pkg_path = get_fn_name(path) + if pkg_path is None: + return + walk_path = os.path.dirname(path) + + for curpath in walk_up(walk_path): + if not os.path.exists(os.path.join(curpath, '__init__.py')): + libdir = curpath + break + else: + libdir = '' + + package_relpath = pkg_path[len(libdir)+1:] + package = '.'.join(package_relpath.split(os.sep)) + if not isdir: + yield package, path + else: + if os.path.exists(os.path.join(path, '__init__.py')): + yield package, path + + for dirpath, dirnames, filenames in os.walk(path): + relpath = dirpath[len(path)+1:] + if relpath: + if '__init__.py' not in filenames: + dirnames[:] = [] + continue + else: + context = '.'.join(relpath.split(os.sep)) + if package: + context = package + '.' + context + yield context, dirpath + else: + context = package + + for fn in filenames: + adjusted_fn = get_fn_name(fn) + if not adjusted_fn or adjusted_fn == '__init__': + continue + + fullfn = os.path.join(dirpath, fn) + if context: + yield context + '.' + adjusted_fn, fullfn + else: + yield adjusted_fn, fullfn + + +def get_code_depends(code_string, path=None, provide=None, ispkg=False): + try: + code = ast.parse(code_string, path) + except TypeError as exc: + raise DependError(path, exc) + except SyntaxError as exc: + raise DependError(path, exc) + + visitor = ImportVisitor() + visitor.visit(code) + for builtin_module in sys.builtin_module_names: + if builtin_module in visitor.imports: + visitor.imports.remove(builtin_module) + + if provide: + provide_elements = provide.split('.') + if ispkg: + provide_elements.append("__self__") + context = '.'.join(provide_elements[:-1]) + package_path = os.path.dirname(path) + else: + context = None + package_path = None + + levelzero_importsfrom = (module for module, names, level in visitor.importsfrom + if level == 0) + for module in visitor.imports | set(levelzero_importsfrom): + if context and path: + module_basepath = os.path.join(package_path, module.replace('.', '/')) + if os.path.exists(module_basepath): + # Implicit relative import + yield context + '.' + module, path + continue + + for suffix in suffixes: + if os.path.exists(module_basepath + suffix): + # Implicit relative import + yield context + '.' + module, path + break + else: + yield module, path + else: + yield module, path + + for module, names, level in visitor.importsfrom: + if level == 0: + continue + elif not provide: + raise DependError("Error: ImportFrom non-zero level outside of a package: {0}".format((module, names, level)), path) + elif level > len(provide_elements): + raise DependError("Error: ImportFrom level exceeds package depth: {0}".format((module, names, level)), path) + else: + context = '.'.join(provide_elements[:-level]) + if module: + if context: + yield context + '.' + module, path + else: + yield module, path + + +def get_file_depends(path): + try: + code_string = open(path, 'r').read() + except (OSError, IOError) as exc: + raise DependError(path, exc) + + return get_code_depends(code_string, path) + + +def get_depends_recursive(directory): + directory = os.path.realpath(directory) + + provides = dict((v, k) for k, v in get_provides(directory)) + for filename, provide in provides.items(): + if os.path.isdir(filename): + filename = os.path.join(filename, '__init__.py') + ispkg = True + elif not filename.endswith('.py'): + continue + else: + ispkg = False + + with open(filename, 'r') as f: + source = f.read() + + depends = get_code_depends(source, filename, provide, ispkg) + for depend, by in depends: + yield depend, by + + +def get_depends(path): + if os.path.isdir(path): + return get_depends_recursive(path) + else: + return get_file_depends(path) + + +def main(): + logging.basicConfig() + + parser = argparse.ArgumentParser(description='Determine dependencies and provided packages for python scripts/modules') + parser.add_argument('path', nargs='+', help='full path to content to be processed') + group = parser.add_mutually_exclusive_group() + group.add_argument('-p', '--provides', action='store_true', + help='given a path, display the provided python modules') + group.add_argument('-d', '--depends', action='store_true', + help='given a filename, display the imported python modules') + + args = parser.parse_args() + if args.provides: + modules = set() + for path in args.path: + for provide, fn in get_provides(path): + modules.add(provide) + + for module in sorted(modules): + print(module) + elif args.depends: + for path in args.path: + try: + modules = get_depends(path) + except PythonDepError as exc: + logger.error(str(exc)) + sys.exit(1) + + for module, imp_by in modules: + print("{}\t{}".format(module, imp_by)) + else: + parser.print_help() + sys.exit(2) + + +if __name__ == '__main__': + main() diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib deleted file mode 100755 index adcdf6bfef..0000000000 --- a/scripts/qemuimage-testlib +++ /dev/null @@ -1,760 +0,0 @@ -#!/bin/bash -# Common function for test -# Expect should be installed for SSH Testing -# To execute `runqemu`, NOPASSWD needs to be set in /etc/sudoers for user -# For example, for user "builder", /etc/sudoers can be like following: -# ######### -# #Members of the admin group may gain root privileges -# %builder ALL=(ALL) NOPASSWD: NOPASSWD: ALL -# ######### -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -# The folder to hold all scripts running on targets -TOOLS="$COREBASE/scripts/qemuimage-tests/tools" - -# The folder to hold all projects for toolchain testing -TOOLCHAIN_PROJECTS="$COREBASE/scripts/qemuimage-tests/toolchain_projects" - -# Test Directory on target for testing -TARGET_TEST_DIR="/tmp/test" - -# Global variables for process id -XTERMPID=0 -QEMUPID=0 - -# Global variable for target ip address -TARGET_IPADDR=0 - -# Global variable for test project version during toolchain test -# Version of cvs is 1.12.13 -# Version of iptables is 1.4.11 -# Version of sudoku-savant is 1.3 -PROJECT_PV=0 - -# Global variable for test project download URL during toolchain test -# URL of cvs is http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2 -# URL of iptables is http://netfilter.org/projects/iptables/files/iptables-1.4.11.tar.bz2 -# URL of sudoku-savant is http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2 -PROJECT_DOWNLOAD_URL=0 - -# SDK folder to hold toolchain tarball -TOOLCHAIN_DIR="${DEPLOY_DIR}/sdk" - -# Toolchain test folder to hold extracted toolchain tarball -TOOLCHAIN_TEST="/opt" - -# common function for information print -Test_Error() -{ - echo -e "\tTest_Error: $*" -} - -Test_Info() -{ - echo -e "\tTest_Info: $*" -} - -# function to update target ip address -# $1 is the process id of the process, which starts the qemu target -# $2 is the ip address of the target -Test_Update_IPSAVE() -{ - local pid=$1 - local ip_addr=$2 - - if [ "$TEST_SERIALIZE" -eq 1 -a "$pid" != "0" -a "$pid" != "" -a "$ip_addr" != "" -a "$ip_addr" != "" ]; then - echo "Saving $pid $ip_addr to $TARGET_IPSAVE" - echo "$pid $ip_addr" > $TARGET_IPSAVE - fi -} - -# function to copy files from host into target -# $1 is the ip address of target -# $2 is the files, which need to be copied into target -# $3 is the path on target, where files are copied into -Test_SCP() -{ - local ip_addr=$1 - local src=$2 - local des=$3 - local time_out=60 - local ret=0 - - # We use expect to interactive with target by ssh - local exp_cmd=`cat << EOF -eval spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$src" root@$ip_addr:"$des" -set timeout $time_out -expect { - "*assword:" { send "\r"; exp_continue} - "*(yes/no)?" { send "yes\r"; exp_continue } - eof { exit [ lindex [wait] 3 ] } -} -EOF` - - expect=`which expect` - if [ ! -x "$expect" ]; then - Test_Error "ERROR: Please install expect" - return 1 - fi - - expect -c "$exp_cmd" - ret=$? - return $ret -} - -# function to copy files from target to host -# $1 is the ip address of target -# $2 is the files, which need to be copied into target -# $3 is the path on target, where files are copied into -Test_SCP_From() -{ - local ip_addr=$1 - local src=$2 - local des=$3 - local time_out=60 - local ret=0 - - # We use expect to interactive with target by ssh - local exp_cmd=`cat << EOF -eval spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$ip_addr:"$src" "$des" -set timeout $time_out -expect { - "*assword:" { send "\r"; exp_continue} - "*(yes/no)?" { send "yes\r"; exp_continue } - eof { exit [ lindex [wait] 3 ] } -} -EOF` - - expect=`which expect` - if [ ! -x "$expect" ]; then - Test_Error "ERROR: Please install expect" - return 1 - fi - - expect -c "$exp_cmd" - ret=$? - return $ret -} - -# function to run command in $ip_addr via ssh -Test_SSH() -{ - local ip_addr="$1" - local command="$2" - - if [ $# -eq 3 ]; then - local time_out=$3 - else - local time_out=60 - fi - - local ret=0 - local exp_cmd=`cat << EOF -eval spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$ip_addr "$command" -set timeout $time_out -expect { - "*assword:" { send "\r"; exp_continue} - "*(yes/no)?" { send "yes\r"; exp_continue } - eof { exit [ lindex [wait] 3 ] } -} -EOF` - - expect=`which expect` - if [ ! -x "$expect" ]; then - Test_Error "ERROR: Please install expect" - return 1 - fi - - expect -c "$exp_cmd" - ret=$? - return $ret -} - -# function to check if ssh is up in $ip_addr -Test_SSH_UP() -{ - local ip_addr=$1 - local timeout=$2 - local interval=0 - - # If TEST_SERIALIZE is set, use existing running qemu for testing - if [ ${TEST_SERIALIZE} -eq 1 -a -e ${TARGET_IPSAVE} ]; then - timeout=50 - fi - - while [ ${interval} -lt ${timeout} ] - do - Test_SSH ${ip_addr} "hostname" - if [ $? -ne 0 ]; then - interval=`expr $interval + 10` - sleep 10 - else - Test_Info "We can ssh on ${ip_addr} within ${interval} seconds" - return 0 - fi - - done - - Test_Info "We can not ssh on ${ip_addr} in ${timeout} seconds" - return 1 -} - -# function to prepare target test environment -# $1 is the ip address of target system -# $2 is the files, which needs to be copied into target -Test_Target_Pre() -{ - local ip_addr=$1 - local testscript=$2 - - # Create a pre-defined folder for test scripts - Test_SSH $ip_addr "mkdir -p $TARGET_TEST_DIR" - if [ $? -eq 0 ]; then - # Copy test scripts into target - Test_SCP $ip_addr $testscript $TARGET_TEST_DIR && return 0 - else - Test_Error "Fail to create $TARGET_TEST_DIR on target" - return 1 - fi - - return 1 -} - -# function to record test result in $TEST_RESULT/testresult.log -Test_Print_Result() -{ - local PASS=0 - local FAIL=0 - local NORESULT=0 - if [ $2 -eq 0 ]; then - PASS=1 - elif [ $2 -eq 1 ]; then - FAIL=1 - else - NORESULT=1 - fi - - # Format the output of the test result - echo -e "$1 $PASS $FAIL $NORESULT" | awk '{printf("\t"); for(i=1;i<=NF;i++) printf("%-15s",$i); printf("\n");}' >> $TEST_RESULT/testresult.log -} - -# Test_Kill_Qemu to kill child pid with parent pid given -# $1 is qemu process id, which needs to be killed -Test_Kill_Qemu() -{ - local index=0 - local total=0 - local k=0 - - # When TEST_SERIALIZE is set, qemu process will not be - # killed until all the cases are finished - if [ ${TEST_SERIALIZE} -eq 1 -a -e ${TEST_STATUS} ]; then - index=`sed -n 2p ${TEST_STATUS} | awk '{print $3}'` - total=`sed -n 2p ${TEST_STATUS} | awk '{print $4}'` - if [ ${index} != ${total} ]; then - Test_Info "Do not kill the qemu process and use it for later testing (step $index of $total)" - Test_Update_IPSAVE $XTERMPID $TARGET_IPADDR - else - k=1 - fi - else - k=1 - fi - - if [ $k -eq 1 ]; then - if [ "$QEMUPID" != "0" -a "$QEMUPID" != "" ]; then - running=`ps -wwfp $QEMUPID` - if [ $? -eq 0 ]; then - echo "killing $QEMUPID" - kill $QEMUPID - fi - fi - if [ "$XTERMPID" != "0" -a "$XTERMPID" != "" ]; then - running=`ps -wwfp $XTERMPID` - if [ $? -eq 0 ]; then - echo "killing $XTERMPID" - kill $XTERMPID - fi - fi - fi - - return -} - -# function to check if network is up -Test_Check_IP_UP() -{ - ping -c1 $1 1> /dev/null - if [ $? -ne 0 ]; then - Test_Info "IP $1 is not up" - return 1 - else - Test_Info "IP $1 is up" - return 0 - fi -} - -# function to find kernel/rootfs image -Test_Find_Image() -{ - where="" - kernel="" - arch="" - target="" - extension="" - rootfs="" - - while getopts "l:k:a:t:e:" Option - do - case $Option in - l) where="$OPTARG" - ;; - k) kernel="$OPTARG" - ;; - a) arch="$OPTARG" - ;; - t) target="$OPTARG" - ;; - e) extension="$OPTARG" - ;; - *) echo "invalid option: -$Option" && return 1 - ;; - esac - done - - if [ ! -z $kernel ]; then - if [ -L ${where}/${kernel}-${arch}.${extension} ]; then - echo ${where}/${kernel}-${arch}.${extension} - return 0 - else - for i in `dir ${where}` - do - # Exclude qemux86-64 when target is qemux86 - echo $i | grep "${kernel}.*${arch}.*\.${extension}" | grep -qv "${kernel}.*${arch}-64.*\.${extension}" - if [ $? -eq 0 ]; then - echo ${where}/${i} - return 0 - fi - done - return 1 - fi - fi - - if [ ! -z $target ]; then - if [ -L ${where}/${target}-${arch}.${extension} ]; then - rootfs=`readlink -f ${where}/${target}-${arch}.${extension}` - echo ${rootfs} - return 0 - else - for i in `dir ${where}` - do - # Exclude qemux86-64 when target is qemux86 - echo $i | grep "${target}-${arch}.*\.${extension}" | grep -qv "${target}-${arch}-64.*\.${extension}" - if [ $? -eq 0 ]; then - echo ${where}/${i} - return 0 - fi - done - return 1 - fi - fi - return 1 -} - -# function to parse IP address of target -# $1 is the pid of qemu startup process -Test_Fetch_Target_IP() -{ - local opid=$1 - local ip_addr=0 - - if [ "$opid" = "0" -o "$opid" = "" ]; then - echo "" - return - fi - - # Check if $1 pid exists and contains ipaddr of target - ip_addr=`ps -wwfp $opid | grep -o "192\.168\.7\.[0-9]*::" | awk -F":" '{print $1}'` - - echo $ip_addr - - return -} - -# function to check if qemu and its network -Test_Create_Qemu() -{ - local timeout=$1 - shift - local extraargs="$@" - local up_time=0 - - RUNQEMU=`which runqemu` - if [ $? -ne 0 ]; then - Test_Error "Can not find runqemu in \$PATH, return fail" - return 1 - fi - - if [ "$QEMUARCH" = "qemux86" -o "$QEMUARCH" = "qemux86-64" ]; then - KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH} -e "bin") - elif [ "$QEMUARCH" = "qemuarm" -o "$QEMUARCH" = "spitz" -o "$QEMUARCH" = "borzoi" -o "$QEMUARCH" = "akita" -o "$QEMUARCH" = "nokia800" ]; then - KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k zImage -a ${QEMUARCH}) - elif [ "$QEMUARCH" = "qemumips" -o "$QEMUARCH" = "qemuppc" ]; then - KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH} -e "bin") - fi - - # If there is no kernel image found, return failed directly - if [ $? -eq 1 ]; then - Test_Info "No kernel image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check" - return 1 - fi - - Test_Info "rootfs image extension selected: $ROOTFS_EXT" - ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH} -e "$ROOTFS_EXT") - - # If there is no rootfs image found, return failed directly - if [ $? -eq 1 ]; then - Test_Info "No ${QEMUTARGET} rootfs image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check" - return 1 - fi - - TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.${ROOTFS_EXT}" - - CP=`which cp` - - # When TEST_SERIALIZE is set, we use the existing image under tmp folder - if [ ${TEST_SERIALIZE} -eq 1 -a -e "$TARGET_IPSAVE" ]; then - # If TARGET_IPSAVE exists, check PID of the qemu process from it - XTERMPID=`awk '{print $1}' $TARGET_IPSAVE` - timeout=50 - else - rm -rf $TEST_ROOTFS_IMAGE - echo "Copying rootfs $ROOTFS_IMAGE to $TEST_ROOTFS_IMAGE" - $CP $ROOTFS_IMAGE $TEST_ROOTFS_IMAGE - if [ $? -ne 0 ]; then - Test_Info "Image ${ROOTFS_IMAGE} copy to ${TEST_ROOTFS_IMAGE} failed, return fail" - return 1 - fi - - export MACHINE=$QEMUARCH - - # Create Qemu in localhost VNC Port 1 - echo "Running xterm -display ${DISPLAY} -e 'OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} ${extraargs} 2>&1 | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60' &" - xterm -display ${DISPLAY} -e "OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} ${extraargs} 2>&1 | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60" & - - # Get the pid of the xterm processor, which will be used in Test_Kill_Qemu - XTERMPID=$! - echo "XTERMPID is $XTERMPID" - # When starting, qemu can reexecute itself and change PID so wait a short while for things to settle - sleep 5 - fi - - while [ ${up_time} -lt 30 ] - do - QEMUPID=`qemuimage-testlib-pythonhelper --findqemu $XTERMPID 2>/dev/null` - if [ $? -ne 0 ]; then - Test_Info "Wait for qemu up..." - up_time=`expr $up_time + 5` - sleep 5 - else - Test_Info "Begin to check if qemu network is up" - echo "QEMUPID is $QEMUPID" - break - fi - done - - if [ ${up_time} == 30 ]; then - Test_Info "No qemu process appeared to start, exiting" - ps axww -O ppid - Test_Info "Process list dumped for debugging purposes" - Test_Info "runqemu output log:" - cat ${RUNQEMU_LOGFILE} - echo - return 1 - fi - - up_time=0 - # Parse IP address of target from the qemu command line - TARGET_IPADDR=`Test_Fetch_Target_IP $QEMUPID` - echo "Target IP is ${TARGET_IPADDR}" - if [ "${TARGET_IPADDR}" = "" -o "${TARGET_IPADDR}" = "0" ]; then - Test_Info "There is no qemu process or qemu ip address found, return failed" - ps -wwf - ps axww -O ppid - Test_Info "runqemu output log:" - cat ${RUNQEMU_LOGFILE} - echo - return 1 - fi - - while [ ${up_time} -lt ${timeout} ] - do - Test_Check_IP_UP ${TARGET_IPADDR} - if [ $? -eq 0 ]; then - Test_Info "Qemu Network is up, ping with ${TARGET_IPADDR} is OK within ${up_time} seconds" - return 0 - else - Test_Info "Wait for Qemu Network up" - up_time=`expr $up_time + 5` - sleep 5 - fi - done - - Test_Info "Process list dumped for debugging purposes:" - ps axww -O ppid - Test_Info "runqemu output log:" - cat ${RUNQEMU_LOGFILE} - Test_Info "Qemu or its network is not up in ${timeout} seconds" - Test_Update_IPSAVE $XTERMPID $TARGET_IPADDR - return 1 -} - -# Function to prepare test project for toolchain test -# $1 is the folder holding test project file -# $2 is the test project name -Test_Project_Prepare() -{ - local toolchain_dir=$1 - - if [ ! -d ${toolchain_dir} ]; then - mkdir -p ${toolchain_dir} - if [ $? -ne 0 ]; then - ret=$? - Test_Info "Create ${toolchain_dir} fail, return" - return $ret - fi - fi - - # Download test project tarball if it does not exist - if [ ! -f ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} ]; then - wget -c -t 5 $PROJECT_DOWNLOAD_URL -O ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} - if [ $? -ne 0 ]; then - ret=$? - Test_Info "Fail to download ${2}-${PROJECT_PV}.${suffix} from $PROJECT_DOWNLOAD_URL" - rm -rf ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} - return $ret - fi - fi - - # Extract the test project into ${TEST_TMP} - tar jxf ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} -C ${TEST_TMP} - if [ $? -ne 0 ]; then - ret=$? - Test_Info "Fail to extract ${2}-${PROJECT_PV}.${suffix} into ${TEST_TMP}" - return $ret - fi - Test_Info "Extract ${2}-${PROJECT_PV}.${suffix} into ${TEST_TMP} successfully" - return 0 -} - -# Function to prepare toolchain environment -# $1 is toolchain directory to hold toolchain tarball -# $2 is prefix name for toolchain tarball -Test_Toolchain_Prepare() -{ - local toolchain_dir=$1 - local sdk_name=$2 - local ret=1 - - if [ ! -d ${toolchain_dir} ]; then - Test_Info "No directory ${toolchain_dir}, which holds toolchain tarballs" - return 1 - fi - - # Check if there is any toolchain tarball under $toolchain_dir with prefix $sdk_name - for i in `dir ${toolchain_dir}` - do - echo $i | grep "${sdk_name}-toolchain-gmae" - if [ $? -eq 0 ]; then - rm -rf ${TEST_TMP}/opt - tar jxf ${toolchain_dir}/${i} -C ${TEST_TMP} - ret=$? - break - fi - done - - if [ $ret -eq 0 ]; then - Test_Info "Check if /opt is accessible for non-root user" - - # Check if the non-root test user has write access of $TOOLCHAIN_TEST - if [ -d ${TOOLCHAIN_TEST} ]; then - touch ${TOOLCHAIN_TEST} - if [ $? -ne 0 ]; then - Test_Info "Has no right to modify folder $TOOLCHAIN_TEST, pls. chown it to test user" - return 2 - fi - else - mkdir -p ${TOOLCHAIN_TEST} - if [ $? -ne 0 ]; then - Test_Info "Has no right to create folder $TOOLCHAIN_TEST, pls. create it and chown it to test user" - return 2 - fi - fi - - # If there is a toolchain folder under $TOOLCHAIN_TEST, let's remove it - if [ -d ${TOOLCHAIN_TEST}/poky ]; then - rm -rf ${TOOLCHAIN_TEST}/poky - fi - - # Copy toolchain into $TOOLCHAIN_TEST - cp -r ${TEST_TMP}/opt/poky ${TOOLCHAIN_TEST} - ret=$? - - if [ $ret -eq 0 ]; then - Test_Info "Successfully copy toolchain into $TOOLCHAIN_TEST" - return $ret - else - Test_Info "Meet error when copy toolchain into $TOOLCHAIN_TEST" - return $ret - fi - else - Test_Info "No tarball named ${sdk_name}-toolchain-gmae under ${toolchain_dir}" - return $ret - fi -} - -# Function to execute command and exit if run out of time -# $1 is timeout value -# $2 is the command to be executed -Test_Time_Out() -{ - local timeout=$1 - shift - local command=$* - local date=0 - local tmp=`mktemp` - local ret=1 - local pid=0 - local ppid=0 - local i=0 - declare local pid_l - - # Run command in background - ($command; echo $? > $tmp) & - pid=$! - while ps -e -o pid | grep -qw $pid; do - if [ $date -ge $timeout ]; then - Test_Info "$timeout Timeout when running command $command" - rm -rf $tmp - - # Find all child processes of pid and kill them - ppid=$pid - ps -f --ppid $ppid - ret=$? - - while [ $ret -eq 0 ] - do - # If yes, get the child pid and check if the child pid has other child pid - # Continue the while loop until there is no child pid found - pid_l[$i]=`ps -f --ppid $ppid | awk '{if ($2 != "PID") print $2}'` - ppid=${pid_l[$i]} - i=$((i+1)) - ps -f --ppid $ppid - ret=$? - done - - # Kill these children pids from the last one - while [ $i -ne 0 ] - do - i=$((i-1)) - kill ${pid_l[$i]} - sleep 2 - done - - # Kill the parent id - kill $pid - return 1 - fi - sleep 5 - date=`expr $date + 5` - done - ret=`cat $tmp` - rm -rf $tmp - return $ret -} - -# Function to test toolchain -# $1 is test project name -# $2 is the timeout value -Test_Toolchain() -{ - local test_project=$1 - local timeout=$2 - local ret=1 - local suffix="tar.bz2" - local env_setup="" - local pro_install="${TEST_TMP}/pro_install" - - # Set value for PROJECT_PV and PROJECT_DOWNLOAD_URL accordingly - if [ $test_project == "cvs" ]; then - PROJECT_PV=1.12.13 - PROJECT_DOWNLOAD_URL="http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2" - elif [ $test_project == "iptables" ]; then - PROJECT_PV=1.4.11 - PROJECT_DOWNLOAD_URL="http://netfilter.org/projects/iptables/files/iptables-1.4.11.tar.bz2" - elif [ $test_project == "sudoku-savant" ]; then - PROJECT_PV=1.3 - PROJECT_DOWNLOAD_URL="http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2" - else - Test_Info "Unknown test project name $test_project" - return 1 - fi - - # Download test project and extract it - Test_Project_Prepare $TOOLCHAIN_PROJECTS $test_project - if [ $? -ne 0 ]; then - Test_Info "Prepare test project file failed" - return 1 - fi - - # Extract toolchain tarball into ${TEST_TMP} - Test_Toolchain_Prepare $TOOLCHAIN_DIR $SDK_NAME - ret=$? - if [ $ret -ne 0 ]; then - Test_Info "Prepare toolchain test environment failed" - return $ret - fi - - if [ ! -d ${pro_install} ]; then - mkdir -p ${pro_install} - fi - - # Begin to build test project in toolchain environment - env_setup=`find ${TOOLCHAIN_TEST}/poky -name "environment-setup*"` - - source $env_setup - - if [ $test_project == "cvs" -o $test_project == "iptables" ]; then - cd ${TEST_TMP}/${test_project}-${PROJECT_PV} - Test_Time_Out $timeout ./configure ${CONFIGURE_FLAGS} || { Test_Info "configure failed with $test_project"; return 1; } - Test_Time_Out $timeout make -j4 || { Test_Info "make failed with $test_project"; return 1; } - Test_Time_Out $timeout make install DESTDIR=${pro_install} || { Test_Info "make failed with $test_project"; return 1; } - cd - - ret=0 - elif [ $test_project == "sudoku-savant" ]; then - cd ${TEST_TMP}/${test_project}-${PROJECT_PV} - Test_Time_Out $timeout ./configure ${CONFIGURE_FLAGS} || { Test_Info "configure failed with $test_project"; return 1; } - Test_Time_Out $timeout make -j4 || { Test_Info "make failed with $test_project"; return 1; } - cd - - ret=0 - else - Test_Info "Unknown test project $test_project" - ret=1 - fi - - return $ret -} - -Test_Display_Syslog() -{ - local tmplog=`mktemp` - Test_SCP_From ${TARGET_IPADDR} /var/log/messages $tmplog - echo "System logs:" - cat $tmplog - rm -f $tmplog -} diff --git a/scripts/qemuimage-testlib-pythonhelper b/scripts/qemuimage-testlib-pythonhelper deleted file mode 100755 index 6435dd8f18..0000000000 --- a/scripts/qemuimage-testlib-pythonhelper +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python - -import optparse -import subprocess -import sys -import os - -parser = optparse.OptionParser( - usage = """ - %prog [options] -""") - -parser.add_option("-q", "--findqemu", - help = "find a qemu beneath the process <pid>", - action="store", dest="findqemu") - -options, args = parser.parse_args(sys.argv) - -if options.findqemu: - # - # Walk the process tree from the process specified looking for a qemu-system. Return its pid. - # - ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,command'], stdout=subprocess.PIPE).communicate()[0] - processes = ps.split('\n') - nfields = len(processes[0].split()) - 1 - pids = {} - commands = {} - for row in processes[1:]: - data = row.split(None, nfields) - if len(data) != 3: - continue - if data[1] not in pids: - pids[data[1]] = [] - pids[data[1]].append(data[0]) - commands[data[0]] = data[2] - - if options.findqemu not in pids: - sys.stderr.write("No children found matching %s" % options.findqemu) - sys.exit(1) - - parents = [] - newparents = pids[options.findqemu] - while newparents: - next = [] - for p in newparents: - if p in pids: - for n in pids[p]: - if n not in parents and n not in next: - next.append(n) - - if p not in parents: - parents.append(p) - newparents = next - #print "Children matching %s:" % str(parents) - for p in parents: - # Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx" - # Also, old versions of ldd (2.11) run "LD_XXXX qemu-system-xxxx" - basecmd = commands[p].split()[0] - basecmd = os.path.basename(basecmd) - if "qemu-system" in basecmd and "192.168" in commands[p]: - print p - sys.exit(0) - sys.exit(1) -else: - parser.print_help() - diff --git a/scripts/qemuimage-tests/sanity/boot b/scripts/qemuimage-tests/sanity/boot deleted file mode 100755 index 5a8c01c9ac..0000000000 --- a/scripts/qemuimage-tests/sanity/boot +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# Boot Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if qemu and qemu network is up. -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -if [ $? -eq 0 ]; then - Test_Info "Boot Test PASS" - Test_Kill_Qemu - Test_Print_Result "Boot" 0 - exit 0 -else - Test_Info "Boot Test FAIL" - Test_Kill_Qemu - Test_Print_Result "Boot" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/sanity/compiler b/scripts/qemuimage-tests/sanity/compiler deleted file mode 100755 index ef0700732d..0000000000 --- a/scripts/qemuimage-tests/sanity/compiler +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# Compiler Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if gcc/g++/make command can work in target. -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ]; then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if gcc/g++/make can work in target -if [ $RET -eq 0 -a -f $TOOLS/compiler_test.sh ]; then - # Copy compiler_test.sh into target - Test_Target_Pre ${TARGET_IPADDR} $TOOLS/compiler_test.sh - if [ $? -eq 0 ]; then - # Run compiler_test.sh to check if gcc/g++/make can work in target - Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/compiler_test.sh" - RET=$? - else - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "Compiler Test PASS" - Test_Kill_Qemu - Test_Print_Result "compiler" 0 - exit 0 -else - Test_Info "Compiler FAIL, Pls. check above error log" - Test_Kill_Qemu - Test_Print_Result "compiler" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/sanity/connman b/scripts/qemuimage-tests/sanity/connman deleted file mode 100755 index b3332012fa..0000000000 --- a/scripts/qemuimage-tests/sanity/connman +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# Conmman Check Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if connman can work in target. -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ]; then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if connman can work in target -if [ $RET -eq 0 -a -f $TOOLS/connman_test.sh ]; then - # Copy connman_test.sh into target - Test_Target_Pre ${TARGET_IPADDR} $TOOLS/connman_test.sh - if [ $? -eq 0 ]; then - # Run connman_test.sh to check if connman can work in target - Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/connman_test.sh" - RET=$? - else - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "Connman Test PASS" - Test_Kill_Qemu - Test_Print_Result "connman" 0 - exit 0 -else - Test_Info "Connman Test FAIL, Pls. check above error log" - Test_Display_Syslog - Test_Kill_Qemu - Test_Print_Result "connman" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/sanity/dmesg b/scripts/qemuimage-tests/sanity/dmesg deleted file mode 100755 index aed29e05eb..0000000000 --- a/scripts/qemuimage-tests/sanity/dmesg +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# Dmesg Check Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if there is any error log in dmesg. -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ]; then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if there is any error log in dmesg -if [ $RET -eq 0 -a -f $TOOLS/dmesg.sh ]; then - # Copy dmesg.sh into target - Test_Target_Pre ${TARGET_IPADDR} $TOOLS/dmesg.sh - if [ $? -eq 0 ]; then - # Run dmesg.sh to check if there is any error message with command dmesg - Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/dmesg.sh" - RET=$? - else - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "Dmesg Test PASS" - Test_Kill_Qemu - Test_Print_Result "dmesg" 0 - exit 0 -else - Test_Info "Dmesg Test FAIL, Pls. check above error log" - Test_Kill_Qemu - Test_Print_Result "dmesg" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/sanity/rpm_query b/scripts/qemuimage-tests/sanity/rpm_query deleted file mode 100755 index dd652bd998..0000000000 --- a/scripts/qemuimage-tests/sanity/rpm_query +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# RPM Check Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if rpm command can work in target. -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ]; then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if rpm query can work in target -if [ $RET -eq 0 -a -f $TOOLS/rpm_test.sh ]; then - # Copy rpm_test.sh into target - Test_Target_Pre ${TARGET_IPADDR} $TOOLS/rpm_test.sh - if [ $? -eq 0 ]; then - # Run rpm_test.sh to check if rpm query can work in target - Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/rpm_test.sh -qa" - RET=$? - else - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "rpm query Test PASS" - Test_Kill_Qemu - Test_Print_Result "rpm_query" 0 - exit 0 -else - Test_Info "rpm query FAIL, Pls. check above error log" - Test_Kill_Qemu - Test_Print_Result "rpm_query" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/sanity/scp b/scripts/qemuimage-tests/sanity/scp deleted file mode 100755 index b0b693d0c8..0000000000 --- a/scripts/qemuimage-tests/sanity/scp +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# SCP Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if file can be copied into target with scp command. -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 -SPID=0 -i=0 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ]; then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if file can be copied from host into target -# For qemu target, the file is 5M -if [ $RET -eq 0 ]; then - echo $QEMUARCH | grep -q "qemu" - - if [ $? -eq 0 ]; then - dd if=/dev/zero of=${TEST_TMP}/scp_test_file bs=512k count=10 - Test_SCP ${TARGET_IPADDR} ${TEST_TMP}/scp_test_file /home/root & - SPID=$! - fi - - # Check if scp finished or not - while [ $i -lt $TIMEOUT ] - do - ps -fp $SPID > /dev/null - if [ $? -ne 0 ]; then - RET=0 - break - fi - i=$((i+5)) - sleep 5 - done - - # Kill scp process if scp is not finished in time - if [ $i -ge $TIMEOUT ]; then - RET=1 - kill $SPID - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "SCP Test PASS" - Test_Kill_Qemu - Test_Print_Result "SCP" 0 - exit 0 -else - Test_Info "SCP Test FAIL" - Test_Kill_Qemu - Test_Print_Result "SCP" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/sanity/shutdown b/scripts/qemuimage-tests/sanity/shutdown deleted file mode 100755 index c9e931c4c2..0000000000 --- a/scripts/qemuimage-tests/sanity/shutdown +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# Shutdown Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if target can shutdown -# For qemux86/x86-64, we use command "poweroff" for target shutdown -# For non-x86 targets, we use command "reboot" for target shutdown -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 - -RET=1 -i=0 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ]; then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if target can shutdown -if [ $RET -eq 0 ]; then - echo $QEMUARCH | grep -q "qemux86" - - # For qemux86/x86-64, command "poweroff" is used - # For non x86 qemu targets, command "reboot" is used because of BUG #100 - if [ $? -eq 0 ]; then - Test_SSH ${TARGET_IPADDR} "/sbin/poweroff" - else - Test_SSH ${TARGET_IPADDR} "/sbin/reboot" - fi - - # If qemu start up process ends up, it means shutdown completes - while [ $i -lt $TIMEOUT ] - do - ps -fp $QEMUPID > /dev/null 2> /dev/null - if [ $? -ne 0 ]; then - RET=0 - break - fi - i=$((i+5)) - sleep 5 - done - - if [ $i -ge $TIMEOUT ]; then - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "Shutdown Test PASS" - Test_Print_Result "shutdown" 0 - - # Remove TARGET_IPSAVE since no existing qemu running now - if [ -e ${TARGET_IPSAVE} ]; then - rm -rf ${TARGET_IPSAVE} - fi - exit 0 -else - Test_Info "Shutdown Test FAIL" - Test_Kill_Qemu - Test_Print_Result "shutdown" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/sanity/smart_help b/scripts/qemuimage-tests/sanity/smart_help deleted file mode 100755 index 0eeac26493..0000000000 --- a/scripts/qemuimage-tests/sanity/smart_help +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# Smart Check Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if smart command can work in target. -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ]; then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if smart --help can work in target -if [ $RET -eq 0 -a -f $TOOLS/smart_test.sh ]; then - # Copy smart_test.sh into target - Test_Target_Pre ${TARGET_IPADDR} $TOOLS/smart_test.sh - if [ $? -eq 0 ]; then - # Run smart_test.sh to check if smart --help can work in target - Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/smart_test.sh --help" - RET=$? - else - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "smart --help Test PASS" - Test_Kill_Qemu - Test_Print_Result "smart_help" 0 - exit 0 -else - Test_Info "smart --help FAIL, Pls. check above error log" - Test_Kill_Qemu - Test_Print_Result "smart_help" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/sanity/smart_query b/scripts/qemuimage-tests/sanity/smart_query deleted file mode 100755 index 779ee630b3..0000000000 --- a/scripts/qemuimage-tests/sanity/smart_query +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# Smart Check Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if smart command can work in target. -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ]; then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if smart query can work in target -if [ $RET -eq 0 -a -f $TOOLS/smart_test.sh ]; then - # Copy smart_test.sh into target - Test_Target_Pre ${TARGET_IPADDR} $TOOLS/smart_test.sh - if [ $? -eq 0 ]; then - # Run smart_test.sh to check if smart query can work in target - Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/smart_test.sh query avahi*" - RET=$? - else - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "smart query package avahi Test PASS" - Test_Kill_Qemu - Test_Print_Result "smart_query" 0 - exit 0 -else - Test_Info "smart query package avahi FAIL, Pls. check above error log" - Test_Kill_Qemu - Test_Print_Result "smart_query" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/sanity/ssh b/scripts/qemuimage-tests/sanity/ssh deleted file mode 100755 index 181296b0b5..0000000000 --- a/scripts/qemuimage-tests/sanity/ssh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# SSH Test Case for Sanity Test -# The case boot up the Qemu target with `runqemu qemuxxx`. -# Then check if ssh service in qemu is up. -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ]; then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "SSH Test PASS" - Test_Kill_Qemu - Test_Print_Result "SSH" 0 - exit 0 -else - Test_Info "SSH Test FAIL" - Test_Kill_Qemu - Test_Print_Result "SSH" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/scenario/qemuarm/core-image-lsb b/scripts/qemuimage-tests/scenario/qemuarm/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/core-image-lsb +++ /dev/null @@ -1,7 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity dmesg -sanity shutdown diff --git a/scripts/qemuimage-tests/scenario/qemuarm/core-image-minimal b/scripts/qemuimage-tests/scenario/qemuarm/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/core-image-minimal +++ /dev/null @@ -1 +0,0 @@ -sanity boot diff --git a/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato b/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato +++ /dev/null @@ -1,11 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato-sdk +++ /dev/null @@ -1,12 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity compiler -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemuarm/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemuarm/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/meta-toolchain-gmae +++ /dev/null @@ -1,3 +0,0 @@ -toolchain cvs -toolchain iptables -toolchain sudoku-savant diff --git a/scripts/qemuimage-tests/scenario/qemumips/core-image-lsb b/scripts/qemuimage-tests/scenario/qemumips/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/core-image-lsb +++ /dev/null @@ -1,7 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity dmesg -sanity shutdown diff --git a/scripts/qemuimage-tests/scenario/qemumips/core-image-minimal b/scripts/qemuimage-tests/scenario/qemumips/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/core-image-minimal +++ /dev/null @@ -1 +0,0 @@ -sanity boot diff --git a/scripts/qemuimage-tests/scenario/qemumips/core-image-sato b/scripts/qemuimage-tests/scenario/qemumips/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/core-image-sato +++ /dev/null @@ -1,11 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemumips/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemumips/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/core-image-sato-sdk +++ /dev/null @@ -1,12 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity compiler -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemumips/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemumips/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/meta-toolchain-gmae +++ /dev/null @@ -1,3 +0,0 @@ -toolchain cvs -toolchain iptables -toolchain sudoku-savant diff --git a/scripts/qemuimage-tests/scenario/qemuppc/core-image-lsb b/scripts/qemuimage-tests/scenario/qemuppc/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/core-image-lsb +++ /dev/null @@ -1,7 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity dmesg -sanity shutdown diff --git a/scripts/qemuimage-tests/scenario/qemuppc/core-image-minimal b/scripts/qemuimage-tests/scenario/qemuppc/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/core-image-minimal +++ /dev/null @@ -1 +0,0 @@ -sanity boot diff --git a/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato b/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato +++ /dev/null @@ -1,11 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato-sdk +++ /dev/null @@ -1,12 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity compiler -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemuppc/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemuppc/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/meta-toolchain-gmae +++ /dev/null @@ -1,3 +0,0 @@ -toolchain cvs -toolchain iptables -toolchain sudoku-savant diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-lsb b/scripts/qemuimage-tests/scenario/qemux86-64/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-lsb +++ /dev/null @@ -1,7 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity dmesg -sanity shutdown diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-minimal b/scripts/qemuimage-tests/scenario/qemux86-64/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-minimal +++ /dev/null @@ -1 +0,0 @@ -sanity boot diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato b/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato +++ /dev/null @@ -1,11 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato-sdk +++ /dev/null @@ -1,12 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity compiler -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemux86-64/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/meta-toolchain-gmae +++ /dev/null @@ -1,3 +0,0 @@ -toolchain cvs -toolchain iptables -toolchain sudoku-savant diff --git a/scripts/qemuimage-tests/scenario/qemux86/core-image-lsb b/scripts/qemuimage-tests/scenario/qemux86/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/core-image-lsb +++ /dev/null @@ -1,7 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity dmesg -sanity shutdown diff --git a/scripts/qemuimage-tests/scenario/qemux86/core-image-minimal b/scripts/qemuimage-tests/scenario/qemux86/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/core-image-minimal +++ /dev/null @@ -1 +0,0 @@ -sanity boot diff --git a/scripts/qemuimage-tests/scenario/qemux86/core-image-sato b/scripts/qemuimage-tests/scenario/qemux86/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/core-image-sato +++ /dev/null @@ -1,11 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemux86/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemux86/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/core-image-sato-sdk +++ /dev/null @@ -1,12 +0,0 @@ -sanity ssh -sanity scp -sanity smart_help -sanity smart_query -sanity rpm_query -sanity compiler -sanity connman -sanity dmesg -sanity shutdown -systemusage bash -systemusage df -systemusage syslog diff --git a/scripts/qemuimage-tests/scenario/qemux86/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemux86/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/meta-toolchain-gmae +++ /dev/null @@ -1,3 +0,0 @@ -toolchain cvs -toolchain iptables -toolchain sudoku-savant diff --git a/scripts/qemuimage-tests/systemusage/bash b/scripts/qemuimage-tests/systemusage/bash deleted file mode 100755 index fb9bb5cba2..0000000000 --- a/scripts/qemuimage-tests/systemusage/bash +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# on the target, check bash prompt is available or not -# boot up the qemu target with `runqemu qemuxxx`, -# then check bash. -# -# Author: veera <veerabrahmamvr@huawei.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - - - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ];then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check bash is working fine or not -if [ $RET -eq 0 -a -f $TOOLS/bash.sh ]; then - # Copy bash.sh into target - Test_Target_Pre ${TARGET_IPADDR} $TOOLS/bash.sh - if [ $? -eq 0 ]; then - # Run bash.sh to check if bash command available or not on the qemuxxx target - Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/bash.sh" - RET=$? - else - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "bash Test PASS" - Test_Kill_Qemu - Test_Print_Result "bash" 0 - exit 0 -else - Test_Info "bash Test FAIL, Pls. check above bash" - Test_Kill_Qemu - Test_Print_Result "bash" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/systemusage/df b/scripts/qemuimage-tests/systemusage/df deleted file mode 100755 index 9657b73b34..0000000000 --- a/scripts/qemuimage-tests/systemusage/df +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# df -h check test case for function test -# boot up the qemu target with `runqemu qemuxxx`, -# then check if df space is fine or not target. -# -# Author: veera <veerabrahmamvr@huawei.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - - - -#If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ];then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if disk spcae space is enough or not(using df command) -if [ $RET -eq 0 -a -f $TOOLS/df.sh ]; then - # Copy df.sh into target - Test_Target_Pre ${TARGET_IPADDR} $TOOLS/df.sh - if [ $? -eq 0 ]; then - # Run df.sh to check if df space is fine or not on the qemuxxx target - Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/df.sh" - RET=$? - else - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "df Test PASS" - Test_Kill_Qemu - Test_Print_Result "df" 0 - exit 0 -else - Test_Info "df Test FAIL, Pls. check above df" - Test_Kill_Qemu - Test_Print_Result "df" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/systemusage/syslog b/scripts/qemuimage-tests/systemusage/syslog deleted file mode 100755 index 559f7c1573..0000000000 --- a/scripts/qemuimage-tests/systemusage/syslog +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# syslog Check test Case for function test -# boot up the Qemu target with `runqemu qemuxxx`. -# then check if syslog service is working fine or not target. -# -# Author: veera <veerabrahmamvr@huawei.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=400 -RET=1 - -# Start qemu and check its network -Test_Create_Qemu ${TIMEOUT} - - - -# If qemu network is up, check ssh service in qemu -if [ $? -eq 0 ];then - Test_Info "Begin to Test SSH Service in Qemu" - Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} - RET=$? -else - RET=1 -fi - -# Check if syslog is working fine or not -if [ $RET -eq 0 -a -f $TOOLS/syslog.sh ]; then - # Copy syslog.sh into target - Test_Target_Pre ${TARGET_IPADDR} $TOOLS/syslog.sh - if [ $? -eq 0 ]; then - # Run syslog.sh to check if syslog service is working fine or not on the qemuxxx target - Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/syslog.sh" - RET=$? - else - RET=1 - fi -fi - -if [ ${RET} -eq 0 ]; then - Test_Info "syslog Test PASS" - Test_Kill_Qemu - Test_Print_Result "syslog" 0 - exit 0 -else - Test_Info "syslog Test FAIL, Pls. check above syslog" - Test_Kill_Qemu - Test_Print_Result "syslog" 1 - exit 1 -fi diff --git a/scripts/qemuimage-tests/toolchain/cvs b/scripts/qemuimage-tests/toolchain/cvs deleted file mode 100755 index 871d99110f..0000000000 --- a/scripts/qemuimage-tests/toolchain/cvs +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# CVS compile Test for toolchain test -# The case extract toolchain tarball into temp folder -# Then compile CVS with the toolchain environment -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=120 - -# Extract and test toolchain tarball -Test_Toolchain cvs ${TIMEOUT} - -if [ $? -eq 0 ]; then - Test_Info "CVS Test PASS" - Test_Print_Result "CVS" 0 - exit 0 -elif [ $? -eq 1 ]; then - Test_Info "CVS Test FAIL" - Test_Print_Result "CVS" 1 - exit 1 -else - Test_Info "Skip CVS Test due to some configuration problem" - Test_Print_Result "CVS" 2 - exit 2 -fi diff --git a/scripts/qemuimage-tests/toolchain/iptables b/scripts/qemuimage-tests/toolchain/iptables deleted file mode 100755 index af89bbe7b3..0000000000 --- a/scripts/qemuimage-tests/toolchain/iptables +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# iptables compile Test for toolchain test -# The case extract toolchain tarball into temp folder -# Then compile iptables with the toolchain environment -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=120 - -# Extract and test toolchain tarball -Test_Toolchain iptables ${TIMEOUT} - -if [ $? -eq 0 ]; then - Test_Info "iptables Test PASS" - Test_Print_Result "iptables" 0 - exit 0 -elif [ $? -eq 1 ]; then - Test_Info "iptables Test FAIL" - Test_Print_Result "iptables" 1 - exit 1 -else - Test_Info "Skip iptables Test due to some configuration problem" - Test_Print_Result "iptables" 2 - exit 2 -fi diff --git a/scripts/qemuimage-tests/toolchain/sudoku-savant b/scripts/qemuimage-tests/toolchain/sudoku-savant deleted file mode 100755 index 3d149dea27..0000000000 --- a/scripts/qemuimage-tests/toolchain/sudoku-savant +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# sudoku-savant compile Test for toolchain test -# The case extract toolchain tarball into temp folder -# Then compile sudoku-savant with the toolchain environment -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# -. $COREBASE/scripts/qemuimage-testlib - -TIMEOUT=240 - -# Extract and test toolchain tarball -Test_Toolchain sudoku-savant ${TIMEOUT} - -if [ $? -eq 0 ]; then - Test_Info "sudoku-savant Test PASS" - Test_Print_Result "sudoku-savant" 0 - exit 0 -elif [ $? -eq 1 ]; then - Test_Info "sudoku-savant Test FAIL" - Test_Print_Result "sudoku-savant" 1 - exit 1 -else - Test_Info "Skip sudoku-savant Test due to some configuration problem" - Test_Print_Result "sudoku-savant" 2 - exit 2 -fi diff --git a/scripts/qemuimage-tests/tools/bash.sh b/scripts/qemuimage-tests/tools/bash.sh deleted file mode 100644 index f6958f0e7e..0000000000 --- a/scripts/qemuimage-tests/tools/bash.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# bash test script running in qemu -# -# Author: veera <veerabrahmamvr@huawei.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -which bash -if [ $? -eq 0 ]; then - echo "QEMU: bash is exist in the target by default" - exit 0 -else - echo "QEMU: No bash command in the qemu target" - exit 1 -fi diff --git a/scripts/qemuimage-tests/tools/compiler_test.sh b/scripts/qemuimage-tests/tools/compiler_test.sh deleted file mode 100644 index 9c30d6d78b..0000000000 --- a/scripts/qemuimage-tests/tools/compiler_test.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash -# compiler test script running in target -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -# Prepare test folder for compiler test -COMPILE_FOLDER="/opt/test/compile_test" -TEST_FILE="$COMPILE_FOLDER/compile_test.c" -EXECUTE_FILE="$COMPILE_FOLDER/compile_test" -TEST_MAKEFILE="$COMPILE_FOLDER/makefile" -TEST_LIST="gcc g++ make" - -if [ ! -d $COMPILE_FOLDER ]; then - mkdir -p $COMPILE_FOLDER -fi - -Target_Info() -{ - echo -e "\tTARGET: $*" -} - -Target_Err() -{ - echo -e "\tTARGET: ##### Error Log #####" - $@ - echo -e "\tTARGET: ##### End #####" -} - -# Function to generate a c test file for compiler testing -Gen_File() -{ - temp=`mktemp` - - # Generate c/c++ test file for compiler testing - echo "#include <stdio.h>" >> $temp - echo "#include <math.h>" >> $temp - echo "" >> $temp - echo "double" >> $temp - echo "convert(long long l)" >> $temp - echo "{" >> $temp - echo " return (double)l; // or double(l)" >> $temp - echo "}" >> $temp - echo "" >> $temp - echo "int" >> $temp - echo "main(int argc, char * argv[])" >> $temp - echo "{" >> $temp - echo " long long l = 10;" >> $temp - echo " double f;" >> $temp - echo "" >> $temp - echo " f = convert(l);" >> $temp - echo " printf(\"convert: %lld => %f\n\", l, f);" >> $temp - echo "" >> $temp - echo " f = 1234.67;" >> $temp - echo " printf(\"floorf(%f) = %f\n\", f, floorf(f));" >> $temp - echo " return 0;" >> $temp - echo "}" >> $temp - echo $temp -} - -# Function to generate a makefile for compiler testing -Gen_Makefile() -{ - temp=`mktemp` - basename=`basename $EXECUTE_FILE` - - echo -e "$basename: $basename.o" >> $temp - echo -e "\tgcc -o $basename $basename.o -lm" >> $temp - echo -e "$basename.o: $basename.c" >> $temp - echo -e "\tgcc -c $basename.c" >> $temp - - echo $temp -} - -# Generate a c test file for compiler testing -test_file=`Gen_File` - -MOVE=`which mv` -$MOVE $test_file $TEST_FILE - -# Begin compiler test in target -for cmd in $TEST_LIST -do - which $cmd - if [ $? -ne 0 ]; then - Target_Info "No $cmd command found" - exit 1 - fi - - if [ "$cmd" == "make" ]; then - rm -rf $EXECUTE_FILE - - # For makefile test, we need to generate a makefile and run with a c file - makefile=`Gen_Makefile` - $MOVE $makefile $TEST_MAKEFILE - - cd `dirname $TEST_MAKEFILE` - make - - if [ $? -ne 0 ]; then - Target_Info "$cmd running with error, Pls. check error in following" - Target_Err make - exit 1 - fi - else - rm -rf $EXECUTE_FILE - - # For gcc/g++, we compile a c test file and check the output - $cmd $TEST_FILE -o $EXECUTE_FILE -lm - - if [ $? -ne 0 ]; then - Target_Info "$cmd running with error, Pls. check error in following" - Target_Err $cmd $TEST_FILE -o $EXECUTE_FILE -lm - exit 1 - fi - fi - - # Check if the binary file generated by $cmd can work without error - if [ -f $EXECUTE_FILE ]; then - $EXECUTE_FILE - if [ $? -ne 0 ]; then - Target_Info "$EXECUTE_FILE running with error, Pls. check error in following" - Target_Err $EXECUTE_FILE - exit 1 - else - Target_Info "$cmd can work without problem in target" - fi - else - Target_Info "No executalbe file $EXECUTE_FILE found, Pls. check the error log" - exit 1 - fi -done - -exit 0 diff --git a/scripts/qemuimage-tests/tools/connman_test.sh b/scripts/qemuimage-tests/tools/connman_test.sh deleted file mode 100644 index 4c1e2f558e..0000000000 --- a/scripts/qemuimage-tests/tools/connman_test.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# connman test script running in target -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -Target_Info() -{ - echo -e "\tTARGET: $*" -} - -Target_Err() -{ - echo -e "\tTARGET: connman has issue when running, Pls. check the error log" - echo -e "\tTARGET: ##### Error Log #####" - $1 - echo -e "\tTARGET: ##### End #####" -} - -# Check if ps comes from Procps or busybox first -ls -l `which ps` | grep -q "busybox" -RET=$? - -if [ $RET -eq 0 ]; then - PS="ps" -else - PS="ps -ef" -fi - -# Check if connmand is in target -if [ ! -f /usr/sbin/connmand ]; then - Target_Info "No connmand command found" - exit 1 -fi - -# Check if connmand is running in background -if [ $RET -eq 0 ]; then - count=`ps | awk '{print $5}' | grep -c connmand` -else - count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` -fi - -if [ $count -ne 1 ]; then - Target_Info "connmand has issue when running in background, Pls, check the output of ps" - ${PS} - exit 1 -fi - -# Check if there is always only one connmand running in background -if [ connmand > /dev/null 2>&1 ]; then - Target_Info "connmand command run without problem" - - if [ $RET -eq 0 ]; then - count=`ps | awk '{print $5}' | grep -c connmand` - else - count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` - fi - - if [ $count -ne 1 ]; then - Target_Info "There are more than one connmand running in background, Pls, check the output of ps" - ${PS} | grep connmand - exit 1 - else - Target_Info "There is always one connmand running in background, test pass" - exit 0 - fi -else - Target_Err connmand - exit 1 -fi - -exit 0 diff --git a/scripts/qemuimage-tests/tools/df.sh b/scripts/qemuimage-tests/tools/df.sh deleted file mode 100644 index 280c08e031..0000000000 --- a/scripts/qemuimage-tests/tools/df.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# df test script to check enough disk space for qemu target -# -# Author: veera <veerabrahmamvr@huawei.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -#taking the size of the each partition -array_list=(`df -P | tr -s " " | cut -d " " -f4`) -#Total size of the array -array_size=`echo ${#array_list[@]}` -loop_val=1 -#while loop to check the size of partitions are less than 5MB -while [ $loop_val -lt $array_size ] -do - #taking each value from the array to check the size - value=`echo ${array_list[$loop_val]}` - if [[ $value -gt 5120 ]];then - loop_val=`expr $loop_val + 1` - else - echo "QEMU: df : disk space is not enough" - exit 1 - fi -done -exit 0 diff --git a/scripts/qemuimage-tests/tools/dmesg.sh b/scripts/qemuimage-tests/tools/dmesg.sh deleted file mode 100644 index f0c93181bd..0000000000 --- a/scripts/qemuimage-tests/tools/dmesg.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Dmesg test script running in QEMU -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -which dmesg -if [ $? -ne 0 ]; then - echo "QEMU: No dmesg command found" - exit 1 -fi - -# For now, ignore mmci-pl18x errors on qemuarm which appeared -# from the 3.8 kernel and are harmless -dmesg | grep -v mmci-pl18x | grep -iq "error" -if [ $? -eq 0 ]; then - echo "QEMU: There is some error log in dmesg:" - echo "QEMU: ##### Error Log ######" - dmesg | grep -i "error" - echo "QEMU: ##### End ######" - exit 1 -else - echo "QEMU: No error log in dmesg" - exit 0 -fi diff --git a/scripts/qemuimage-tests/tools/rpm_test.sh b/scripts/qemuimage-tests/tools/rpm_test.sh deleted file mode 100644 index 6e6f9112ca..0000000000 --- a/scripts/qemuimage-tests/tools/rpm_test.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# rpm test script running in target -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -Target_Info() -{ - echo -e "\tTARGET: $*" -} - -Target_Err() -{ - echo -e "\tTARGET: rpm command has issue when running, Pls. check the error log" - echo -e "\tTARGET: ##### Error Log #####" - $1 - echo -e "\tTARGET: ##### End #####" -} - -which rpm -if [ $? -ne 0 ]; then - Target_Info "No rpm command found" - exit 1 -fi - -if [ rpm > /dev/null 2>&1 ]; then - Target_Info "rpm command run without problem" -else - Target_Err rpm - exit 1 -fi - -# run rpm with specific command parsed to rpm_test.sh -rpm $* > /dev/null 2>&1 - -if [ $? -eq 0 ]; then - Target_Info "rpm $* work without problem" - exit 0 -else - Target_Err rpm $* - exit 1 -fi diff --git a/scripts/qemuimage-tests/tools/smart_test.sh b/scripts/qemuimage-tests/tools/smart_test.sh deleted file mode 100644 index f278a25e2b..0000000000 --- a/scripts/qemuimage-tests/tools/smart_test.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# smart test script running in target -# -# Author: Jiajun Xu <jiajun.xu@intel.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -Target_Info() -{ - echo -e "\tTARGET: $*" -} - -Target_Err() -{ - echo -e "\tTARGET: smart command has issue when running, Pls. check the error log" - echo -e "\tTARGET: ##### Error Log #####" - $1 - echo -e "\tTARGET: ##### End #####" -} - -which smart -if [ $? -ne 0 ]; then - Target_Info "No smart command found" - exit 1 -fi - -if [ smart > /dev/null 2>&1 ]; then - Target_Info "smart command run without problem" -else - Target_Err smart - exit 1 -fi - -# run smart with specific command parsed to smart_test.sh -smart $* > /dev/null 2>&1 - -if [ $? -eq 0 ]; then - Target_Info "smart $* work without problem" - exit 0 -else - Target_Err "smart $*" - exit 1 -fi diff --git a/scripts/qemuimage-tests/tools/syslog.sh b/scripts/qemuimage-tests/tools/syslog.sh deleted file mode 100644 index 9154da3b85..0000000000 --- a/scripts/qemuimage-tests/tools/syslog.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# syslog test script running in qemu -# -# Author: veera <veerabrahmamvr@huawei.com> -# -# This file is licensed under the GNU General Public License, -# Version 2. -# - -ps aux | grep -w syslogd | grep -v grep -if [ $? -eq 0 ]; then - echo "QEMU: syslogd is running by default" - exit 0 -else - echo "QEMU: syslogd is not running" - exit 1 -fi diff --git a/scripts/recipetool b/scripts/recipetool new file mode 100755 index 0000000000..3765ec7cf9 --- /dev/null +++ b/scripts/recipetool @@ -0,0 +1,126 @@ +#!/usr/bin/env python3 + +# Recipe creation tool +# +# Copyright (C) 2014 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import sys +import os +import argparse +import glob +import logging + +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptutils +import argparse_oe +logger = scriptutils.logger_create('recipetool') + +plugins = [] + +def tinfoil_init(parserecipes): + import bb.tinfoil + import logging + tinfoil = bb.tinfoil.Tinfoil(tracking=True) + tinfoil.prepare(not parserecipes) + tinfoil.logger.setLevel(logger.getEffectiveLevel()) + return tinfoil + +def main(): + + if not os.environ.get('BUILDDIR', ''): + logger.error("This script can only be run after initialising the build environment (e.g. by using oe-init-build-env)") + sys.exit(1) + + parser = argparse_oe.ArgumentParser(description="OpenEmbedded recipe tool", + add_help=False, + epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') + parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') + parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') + + global_args, unparsed_args = parser.parse_known_args() + + # Help is added here rather than via add_help=True, as we don't want it to + # be handled by parse_known_args() + parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, + help='show this help message and exit') + subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') + subparsers.required = True + + if global_args.debug: + logger.setLevel(logging.DEBUG) + elif global_args.quiet: + logger.setLevel(logging.ERROR) + + import scriptpath + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + sys.exit(1) + logger.debug('Found bitbake path: %s' % bitbakepath) + scriptpath.add_oe_lib_path() + + scriptutils.logger_setup_color(logger, global_args.color) + + tinfoil = tinfoil_init(False) + try: + for path in (tinfoil.config_data.getVar('BBPATH').split(':') + + [scripts_path]): + pluginpath = os.path.join(path, 'lib', 'recipetool') + scriptutils.load_plugins(logger, plugins, pluginpath) + + registered = False + for plugin in plugins: + if hasattr(plugin, 'register_commands'): + registered = True + plugin.register_commands(subparsers) + elif hasattr(plugin, 'register_command'): + # Legacy function name + registered = True + plugin.register_command(subparsers) + if hasattr(plugin, 'tinfoil_init'): + plugin.tinfoil_init(tinfoil) + + if not registered: + logger.error("No commands registered - missing plugins?") + sys.exit(1) + + args = parser.parse_args(unparsed_args, namespace=global_args) + + try: + if getattr(args, 'parserecipes', False): + tinfoil.config_data.disableTracking() + tinfoil.parseRecipes() + tinfoil.config_data.enableTracking() + ret = args.func(args) + except bb.BBHandledException: + ret = 1 + finally: + tinfoil.shutdown() + + return ret + + +if __name__ == "__main__": + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc() + sys.exit(ret) diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py index 1d7bbb3849..c752fa2c61 100755 --- a/scripts/relocate_sdk.py +++ b/scripts/relocate_sdk.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2012 Intel Corporation # @@ -31,7 +31,14 @@ import os import re import errno -old_prefix = re.compile("##DEFAULT_INSTALL_DIR##") +if sys.version < '3': + def b(x): + return x +else: + def b(x): + return x.encode(sys.getfilesystemencoding()) + +old_prefix = re.compile(b("##DEFAULT_INSTALL_DIR##")) def get_arch(): f.seek(0) @@ -92,17 +99,22 @@ def change_interpreter(elf_file_name): # External SDKs with mixed pre-compiled binaries should not get # relocated so look for some variant of /lib fname = f.read(11) - if fname.startswith("/lib/") or fname.startswith("/lib64/") or fname.startswith("/lib32/") or fname.startswith("/usr/lib32/") or fname.startswith("/usr/lib32/") or fname.startswith("/usr/lib64/"): + if fname.startswith(b("/lib/")) or fname.startswith(b("/lib64/")) or \ + fname.startswith(b("/lib32/")) or fname.startswith(b("/usr/lib32/")) or \ + fname.startswith(b("/usr/lib32/")) or fname.startswith(b("/usr/lib64/")): + break + if p_filesz == 0: break if (len(new_dl_path) >= p_filesz): - print "ERROR: could not relocate %s, interp size = %i and %i is needed." % (elf_file_name, p_memsz, len(new_dl_path) + 1) + print("ERROR: could not relocate %s, interp size = %i and %i is needed." \ + % (elf_file_name, p_memsz, len(new_dl_path) + 1)) break - dl_path = new_dl_path + "\0" * (p_filesz - len(new_dl_path)) + dl_path = new_dl_path + b("\0") * (p_filesz - len(new_dl_path)) f.seek(p_offset) f.write(dl_path) break -def change_dl_sysdirs(): +def change_dl_sysdirs(elf_file_name): if arch == 32: sh_fmt = "<IIIIIIIIII" else: @@ -129,40 +141,61 @@ def change_dl_sysdirs(): sh_name, sh_type, sh_flags, sh_addr, sh_offset, sh_size, sh_link,\ sh_info, sh_addralign, sh_entsize = struct.unpack(sh_fmt, sh_hdr) - name = sh_strtab[sh_name:sh_strtab.find("\0", sh_name)] + name = sh_strtab[sh_name:sh_strtab.find(b("\0"), sh_name)] """ look only into SHT_PROGBITS sections """ if sh_type == 1: f.seek(sh_offset) """ default library paths cannot be changed on the fly because """ """ the string lengths have to be changed too. """ - if name == ".sysdirs": + if name == b(".sysdirs"): sysdirs = f.read(sh_size) sysdirs_off = sh_offset sysdirs_sect_size = sh_size - elif name == ".sysdirslen": + elif name == b(".sysdirslen"): sysdirslen = f.read(sh_size) sysdirslen_off = sh_offset - elif name == ".ldsocache": + elif name == b(".ldsocache"): ldsocache_path = f.read(sh_size) new_ldsocache_path = old_prefix.sub(new_prefix, ldsocache_path) + new_ldsocache_path = new_ldsocache_path.rstrip(b("\0")) + if (len(new_ldsocache_path) >= sh_size): + print("ERROR: could not relocate %s, .ldsocache section size = %i and %i is needed." \ + % (elf_file_name, sh_size, len(new_ldsocache_path))) + sys.exit(-1) # pad with zeros - new_ldsocache_path += "\0" * (sh_size - len(new_ldsocache_path)) + new_ldsocache_path += b("\0") * (sh_size - len(new_ldsocache_path)) # write it back f.seek(sh_offset) f.write(new_ldsocache_path) - + elif name == b(".gccrelocprefix"): + offset = 0 + while (offset + 4096) <= sh_size: + path = f.read(4096) + new_path = old_prefix.sub(new_prefix, path) + new_path = new_path.rstrip(b("\0")) + if (len(new_path) >= 4096): + print("ERROR: could not relocate %s, max path size = 4096 and %i is needed." \ + % (elf_file_name, len(new_path))) + sys.exit(-1) + # pad with zeros + new_path += b("\0") * (4096 - len(new_path)) + #print "Changing %s to %s at %s" % (str(path), str(new_path), str(offset)) + # write it back + f.seek(sh_offset + offset) + f.write(new_path) + offset = offset + 4096 if sysdirs != "" and sysdirslen != "": - paths = sysdirs.split("\0") - sysdirs = "" - sysdirslen = "" + paths = sysdirs.split(b("\0")) + sysdirs = b("") + sysdirslen = b("") for path in paths: """ exit the loop when we encounter first empty string """ - if path == "": + if path == b(""): break new_path = old_prefix.sub(new_prefix, path) - sysdirs += new_path + "\0" + sysdirs += new_path + b("\0") if arch == 32: sysdirslen += struct.pack("<L", len(new_path)) @@ -170,7 +203,7 @@ def change_dl_sysdirs(): sysdirslen += struct.pack("<Q", len(new_path)) """ pad with zeros """ - sysdirs += "\0" * (sysdirs_sect_size - len(sysdirs)) + sysdirs += b("\0") * (sysdirs_sect_size - len(sysdirs)) """ write the sections back """ f.seek(sysdirs_off) @@ -178,13 +211,19 @@ def change_dl_sysdirs(): f.seek(sysdirslen_off) f.write(sysdirslen) - # MAIN if len(sys.argv) < 4: sys.exit(-1) -new_prefix = sys.argv[1] -new_dl_path = sys.argv[2] +# In python > 3, strings may also contain Unicode characters. So, convert +# them to bytes +if sys.version_info < (3,): + new_prefix = sys.argv[1] + new_dl_path = sys.argv[2] +else: + new_prefix = sys.argv[1].encode() + new_dl_path = sys.argv[2].encode() + executables_list = sys.argv[3:] for e in executables_list: @@ -196,7 +235,8 @@ for e in executables_list: try: f = open(e, "r+b") - except IOError, ioex: + except IOError: + exctype, ioex = sys.exc_info()[:2] if ioex.errno == errno.ETXTBSY: print("Could not open %s. File used by another process.\nPlease "\ "make sure you exit all processes that might use any SDK "\ @@ -205,11 +245,14 @@ for e in executables_list: print("Could not open %s: %s(%d)" % (e, ioex.strerror, ioex.errno)) sys.exit(-1) - arch = get_arch() - if arch: - parse_elf_header() - change_interpreter(e) - change_dl_sysdirs() + # Save old size and do a size check at the end. Just a safety measure. + old_size = os.path.getsize(e) + if old_size >= 64: + arch = get_arch() + if arch: + parse_elf_header() + change_interpreter(e) + change_dl_sysdirs(e) """ change permissions back """ if perms: @@ -217,3 +260,7 @@ for e in executables_list: f.close() + if old_size != os.path.getsize(e): + print("New file size for %s is different. Looks like a relocation error!", e) + sys.exit(-1) + diff --git a/scripts/rpm2cpio.sh b/scripts/rpm2cpio.sh index 5df8c0f705..cf23472ba9 100755 --- a/scripts/rpm2cpio.sh +++ b/scripts/rpm2cpio.sh @@ -1,53 +1,55 @@ -#!/bin/sh - -# This comes from the RPM5 5.4.0 distribution. - -pkg=$1 -if [ "$pkg" = "" -o ! -e "$pkg" ]; then - echo "no package supplied" 1>&2 - exit 1 -fi - -leadsize=96 -o=`expr $leadsize + 8` -set `od -j $o -N 8 -t u1 $pkg` -il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5` -dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9` -# echo "sig il: $il dl: $dl" - -sigsize=`expr 8 + 16 \* $il + $dl` -o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8` -set `od -j $o -N 8 -t u1 $pkg` -il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5` -dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9` -# echo "hdr il: $il dl: $dl" - -hdrsize=`expr 8 + 16 \* $il + $dl` -o=`expr $o + $hdrsize` -EXTRACTOR="dd if=$pkg ibs=$o skip=1" - -COMPRESSION=`($EXTRACTOR |file -) 2>/dev/null` -if echo $COMPRESSION |grep -iq gzip; then - DECOMPRESSOR=gunzip -elif echo $COMPRESSION |grep -iq bzip2; then - DECOMPRESSOR=bunzip2 -elif echo $COMPRESSION |grep -iq xz; then - DECOMPRESSOR=unxz -elif echo $COMPRESSION |grep -iq cpio; then - DECOMPRESSOR=cat -else - # Most versions of file don't support LZMA, therefore we assume - # anything not detected is LZMA - DECOMPRESSOR=`which unlzma 2>/dev/null` - case "$DECOMPRESSOR" in - /* ) ;; - * ) DECOMPRESSOR=`which lzmash 2>/dev/null` - case "$DECOMPRESSOR" in - /* ) DECOMPRESSOR="lzmash -d -c" ;; - * ) DECOMPRESSOR=cat ;; - esac - ;; - esac -fi - -$EXTRACTOR 2>/dev/null | $DECOMPRESSOR +#!/bin/sh -efu + +# This file comes from rpm 4.x distribution + +fatal() { + echo "$*" >&2 + exit 1 +} + +pkg="$1" +[ -n "$pkg" -a -e "$pkg" ] || + fatal "No package supplied" + +_dd() { + local o="$1"; shift + dd if="$pkg" skip="$o" iflag=skip_bytes status=none $* +} + +calcsize() { + offset=$(($1 + 8)) + + local i b b0 b1 b2 b3 b4 b5 b6 b7 + + i=0 + while [ $i -lt 8 ]; do + b="$(_dd $(($offset + $i)) bs=1 count=1)" + [ -z "$b" ] && + b="0" || + b="$(exec printf '%u\n' "'$b")" + eval "b$i=\$b" + i=$(($i + 1)) + done + + rsize=$((8 + ((($b0 << 24) + ($b1 << 16) + ($b2 << 8) + $b3) << 4) + ($b4 << 24) + ($b5 << 16) + ($b6 << 8) + $b7)) + offset=$(($offset + $rsize)) +} + +case "$(_dd 0 bs=8 count=1)" in + "$(printf '\355\253\356\333')"*) ;; # '\xed\xab\xee\xdb' + *) fatal "File doesn't look like rpm: $pkg" ;; +esac + +calcsize 96 +sigsize=$rsize + +calcsize $(($offset + (8 - ($sigsize % 8)) % 8)) +hdrsize=$rsize + +case "$(_dd $offset bs=3 count=1)" in + "$(printf '\102\132')"*) _dd $offset | bunzip2 ;; # '\x42\x5a' + "$(printf '\037\213')"*) _dd $offset | gunzip ;; # '\x1f\x8b' + "$(printf '\375\067')"*) _dd $offset | xzcat ;; # '\xfd\x37' + "$(printf '\135\000')"*) _dd $offset | unlzma ;; # '\x5d\x00' + *) fatal "Unrecognized rpm file: $pkg" ;; +esac diff --git a/scripts/runqemu b/scripts/runqemu index 04dc3b0571..f0ddeea1bf 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -1,8 +1,9 @@ -#!/bin/bash -# +#!/usr/bin/env python3 + # Handle running OE images standalone with QEMU # # Copyright (C) 2006-2011 Linux Foundation +# Copyright (c) 2016 Wind River Systems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -17,451 +18,1229 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -usage() { - MYNAME=`basename $0` - echo "" - echo "Usage: you can run this script with any valid combination" - echo "of the following options (in any order):" - echo " QEMUARCH - the qemu machine architecture to use" - echo " KERNEL - the kernel image file to use" - echo " ROOTFS - the rootfs image file or nfsroot directory to use" - echo " MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)" - echo " RAMFS - boot a ramfs-based image" - echo " ISO - boot an ISO image" - echo " VM - boot a vmdk image" - echo " Simplified QEMU command-line options can be passed with:" - echo " nographic - disables video console" - echo " serial - enables a serial console on /dev/ttyS0" - echo " kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)" - echo " publicvnc - enable a VNC server open to all hosts" - echo " qemuparams=\"xyz\" - specify custom parameters to QEMU" - echo " bootparams=\"xyz\" - specify custom kernel parameters during boot" - echo "" - echo "Examples:" - echo " $MYNAME qemuarm" - echo " $MYNAME qemux86-64 core-image-sato ext3" - echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" - echo " $MYNAME qemux86 ramfs" - echo " $MYNAME qemux86 iso" - echo " $MYNAME qemux86 qemuparams=\"-m 256\"" - echo " $MYNAME qemux86 bootparams=\"psplash=false\"" - echo " $MYNAME path/to/<image>-<machine>.vmdk" - exit 1 -} - -if [ "x$1" = "x" ]; then - usage -fi - -error() { - echo "Error: "$* - usage -} - -MACHINE=${MACHINE:=""} -KERNEL=${KERNEL:=""} -ROOTFS=${ROOTFS:=""} -VM=${VM:=""} -FSTYPE="" -LAZY_ROOTFS="" -SCRIPT_QEMU_OPT="" -SCRIPT_QEMU_EXTRA_OPT="" -SCRIPT_KERNEL_OPT="" -SERIALSTDIO="" - -# Determine whether the file is a kernel or QEMU image, and set the -# appropriate variables -process_filename() { - filename=$1 - - # Extract the filename extension - EXT=`echo $filename | awk -F . '{ print \$NF }'` - case /$EXT/ in - /bin/) - # A file ending in .bin is a kernel - [ -z "$KERNEL" ] && KERNEL=$filename || \ - error "conflicting KERNEL args [$KERNEL] and [$filename]" - ;; - /ext[234]/|/jffs2/|/btrfs/) - # A file ending in a supportted fs type is a rootfs image - if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then - FSTYPE=$EXT - ROOTFS=$filename - else - error "conflicting FSTYPE types [$FSTYPE] and [$EXT]" - fi - ;; - /vmdk/) - FSTYPE=$EXT - VM=$filename - ;; - *) - error "unknown file arg [$filename]" - ;; - esac -} - -# Parse command line args without requiring specific ordering. It's a -# bit more complex, but offers a great user experience. -KVM_ENABLED="no" -while true; do - arg=${1} - case "$arg" in - "qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemumipsel" | \ - "qemumips64" | "qemush4" | "qemuppc" | "qemumicroblaze" | "qemuzynq") - [ -z "$MACHINE" ] && MACHINE=$arg || \ - error "conflicting MACHINE types [$MACHINE] and [$arg]" - ;; - "ext2" | "ext3" | "ext4" | "jffs2" | "nfs" | "btrfs") - [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ] && FSTYPE=$arg || \ - error "conflicting FSTYPE types [$FSTYPE] and [$arg]" - ;; - *-image*) - [ -z "$ROOTFS" ] || \ - error "conflicting ROOTFS args [$ROOTFS] and [$arg]" - if [ -f "$arg" ]; then - process_filename $arg - elif [ -d "$arg" ]; then - # Handle the case where the nfsroot dir has -image- - # in the pathname - echo "Assuming $arg is an nfs rootfs" - FSTYPE=nfs - ROOTFS=$arg - else - ROOTFS=$arg - LAZY_ROOTFS="true" - fi - ;; - "ramfs") - FSTYPE=cpio.gz - RAMFS=true - ;; - "iso") - FSTYPE=iso - ISOFS=true - ;; - "nographic") - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic" - SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0" - ;; - "serial") - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio" - SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0" - SERIALSTDIO="1" - ;; - "qemuparams="*) - SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}" - - # Warn user if they try to specify serial or kvm options - # to use simplified options instead - serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'` - kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'` - [ ! -z "$serial_option" -o ! -z "$kvm_option" ] && \ - echo "Please use simplified serial or kvm options instead" - ;; - "bootparams="*) - SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}" - ;; - "audio") - if [ "x$MACHINE" = "xqemux86" -o "x$MACHINE" = "xqemux86-64" ]; then - echo "Enabling audio in qemu." - echo "Please install snd_intel8x0 or snd_ens1370 driver in linux guest." - QEMU_AUDIO_DRV="alsa" - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370" - fi - ;; - "kvm") - KVM_ENABLED="yes" - KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1` - ;; - "slirp") - SLIRP_ENABLED="yes" - ;; - "publicvnc") - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -vnc 0.0.0.0:0" - ;; - "") break ;; - *) - # A directory name is an nfs rootfs - if [ -d "$arg" ]; then - echo "Assuming $arg is an nfs rootfs" - if [ -z "$FSTYPE" -o "$FSTYPE" = "nfs" ]; then - FSTYPE=nfs - else - error "conflicting FSTYPE types [$arg] and nfs" - fi - - if [ -z "$ROOTFS" ]; then - ROOTFS=$arg - else - error "conflicting ROOTFS args [$ROOTFS] and [$arg]" - fi - elif [ -f "$arg" ]; then - process_filename $arg - else - error "unable to classify arg [$arg]" - fi - ;; - esac - shift -done - -if [ ! -c /dev/net/tun ] ; then - echo "TUN control device /dev/net/tun is unavailable; you may need to enable TUN (e.g. sudo modprobe tun)" - exit 1 -elif [ ! -w /dev/net/tun ] ; then - echo "TUN control device /dev/net/tun is not writable, please fix (e.g. sudo chmod 666 /dev/net/tun)" - exit 1 -fi - -# Report errors for missing combinations of options -if [ -z "$MACHINE" -a -z "$KERNEL" -a -z "$VM" ]; then - error "you must specify at least a MACHINE, VM, or KERNEL argument" -fi -if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then - error "NFS booting without an explicit ROOTFS path is not yet supported" -fi - -if [ -z "$MACHINE" ]; then - if [ "x$FSTYPE" = "xvmdk" ]; then - MACHINE=`basename $VM | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'` - if [ -z "$MACHINE" ]; then - error "Unable to set MACHINE from vmdk filename [$VM]" - fi - echo "Set MACHINE to [$MACHINE] based on vmdk [$VM]" - else - MACHINE=`basename $KERNEL | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'` - if [ -z "$MACHINE" ]; then - error "Unable to set MACHINE from kernel filename [$KERNEL]" - fi - echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]" - fi -fi - -YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" -YOCTO_PARAVIRT_KVM_WIKI="https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM" -# Detect KVM configuration -if [ "x$KVM_ENABLED" = "xyes" ]; then - if [ -z "$KVM_CAPABLE" ]; then - echo "You are trying to enable KVM on a cpu without VT support." - echo "Remove kvm from the command-line, or refer" - echo "$YOCTO_KVM_WIKI"; - exit 1; - fi - if [ "x$MACHINE" != "xqemux86" -a "x$MACHINE" != "xqemux86-64" ]; then - echo "KVM only support x86 & x86-64. Remove kvm from the command-line"; - exit 1; - fi - if [ ! -e /dev/kvm ]; then - echo "Missing KVM device. Have you inserted kvm modules?" - echo "For further help see:" - echo "$YOCTO_KVM_WIKI"; - exit 1; - fi - if [ ! -e /dev/vhost-net ]; then - echo "Missing virtio net device. Have you inserted vhost-net module?" - echo "For further help see:" - echo "$YOCTO_PARAVIRT_KVM_WIKI"; - exit 1; - fi - if [ -w /dev/kvm -a -r /dev/kvm ]; then - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host" - KVM_ACTIVE="yes" - else - echo "You have no rights on /dev/kvm." - echo "Please change the ownership of this file as described at:" - echo "$YOCTO_KVM_WIKI"; - exit 1; - fi - if [ ! -w /dev/vhost-net -o ! -r /dev/vhost-net ]; then - echo "You have no rights on /dev/vhost-net." - echo "Please change the ownership of this file as described at:" - echo "$YOCTO_PARAVIRT_KVM_WIKI"; - exit 1; - fi -fi - -machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'` -# MACHINE is now set for all cases - -# Defaults used when these vars need to be inferred -QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin -QEMUX86_DEFAULT_FSTYPE=ext3 - -QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin -QEMUX86_64_DEFAULT_FSTYPE=ext3 - -QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin -QEMUARM_DEFAULT_FSTYPE=ext3 - -QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin -QEMUMIPS_DEFAULT_FSTYPE=ext3 - -QEMUMIPSEL_DEFAULT_KERNEL=vmlinux-qemumipsel.bin -QEMUMIPSEL_DEFAULT_FSTYPE=ext3 - -QEMUMIPS64_DEFAULT_KERNEL=vmlinux-qemumips64.bin -QEMUMIPS64_DEFAULT_FSTYPE=ext3 - -QEMUSH4_DEFAULT_KERNEL=vmlinux-qemumips.bin -QEMUSH4_DEFAULT_FSTYPE=ext3 - -QEMUPPC_DEFAULT_KERNEL=vmlinux-qemuppc.bin -QEMUPPC_DEFAULT_FSTYPE=ext3 - -QEMUMICROBLAZE_DEFAULT_KERNEL=linux.bin.ub -QEMUMICROBLAZE_DEFAULT_FSTYPE=cpio - -QEMUZYNQ_DEFAULT_KERNEL=uImage -QEMUZYNQ_DEFAULT_FSTYPE=cpio - -AKITA_DEFAULT_KERNEL=zImage-akita.bin -AKITA_DEFAULT_FSTYPE=jffs2 - -SPITZ_DEFAULT_KERNEL=zImage-spitz.bin -SPITZ_DEFAULT_FSTYPE=ext3 - -setup_tmpdir() { - if [ -z "$OE_TMPDIR" ]; then - # Try to get OE_TMPDIR from bitbake - type -P bitbake &>/dev/null || { - echo "In order for this script to dynamically infer paths"; - echo "to kernels or filesystem images, you either need"; - echo "bitbake in your PATH or to source oe-init-build-env"; - echo "before running this script" >&2; - exit 1; } - - # We have bitbake in PATH, get OE_TMPDIR from bitbake - OE_TMPDIR=`MACHINE=$MACHINE bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` - if [ -z "$OE_TMPDIR" ]; then - # Check for errors from bitbake that the user needs to know about - BITBAKE_OUTPUT=`bitbake -e | wc -l` - if [ "$BITBAKE_OUTPUT" -eq "0" ]; then - echo "Error: this script needs to be run from your build directory," - echo "or you need to explicitly set OE_TMPDIR in your environment" - else - echo "There was an error running bitbake to determine TMPDIR" - echo "Here is the output from 'bitbake -e':" - bitbake -e - fi - exit 1 - fi - fi -} - -setup_sysroot() { - # Toolchain installs set up $OECORE_NATIVE_SYSROOT in their - # environment script. If that variable isn't set, we're - # either in an in-tree build scenario or the environment - # script wasn't source'd. - if [ -z "$OECORE_NATIVE_SYSROOT" ]; then - setup_tmpdir - BUILD_ARCH=`uname -m` - BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` - BUILD_SYS="$BUILD_ARCH-$BUILD_OS" - - OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS - fi -} - -# Locate a rootfs image to boot which matches our expected -# machine and fstype. -findimage() { - where=$1 - machine=$2 - extension=$3 - - # Sort rootfs candidates by modification time - the most - # recently created one is the one we most likely want to boot. - filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs` - for name in $filenames; do - case $name in - *core-image-sato* | \ - *core-image-lsb* | \ - *core-image-basic* | \ - *core-image-minimal* ) - ROOTFS=$name +import os +import sys +import logging +import subprocess +import re +import fcntl +import shutil +import glob +import configparser + +class OEPathError(Exception): + """Custom Exception to give better guidance on missing binaries""" + def __init__(self, message): + self.message = "In order for this script to dynamically infer paths\n \ +kernels or filesystem images, you either need bitbake in your PATH\n \ +or to source oe-init-build-env before running this script.\n\n \ +Dynamic path inference can be avoided by passing a *.qemuboot.conf to\n \ +runqemu, i.e. `runqemu /path/to/my-image-name.qemuboot.conf`\n\n %s" % message + + +def create_logger(): + logger = logging.getLogger('runqemu') + logger.setLevel(logging.INFO) + + # create console handler and set level to debug + ch = logging.StreamHandler() + ch.setLevel(logging.INFO) + + # create formatter + formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s') + + # add formatter to ch + ch.setFormatter(formatter) + + # add ch to logger + logger.addHandler(ch) + + return logger + +logger = create_logger() + +def print_usage(): + print(""" +Usage: you can run this script with any valid combination +of the following environment variables (in any order): + KERNEL - the kernel image file to use + ROOTFS - the rootfs image file or nfsroot directory to use + MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified) + Simplified QEMU command-line options can be passed with: + nographic - disable video console + serial - enable a serial console on /dev/ttyS0 + slirp - enable user networking, no root privileges is required + kvm - enable KVM when running x86/x86_64 (VT-capable CPU required) + kvm-vhost - enable KVM with vhost when running x86/x86_64 (VT-capable CPU required) + publicvnc - enable a VNC server open to all hosts + audio - enable audio + [*/]ovmf* - OVMF firmware file or base name for booting with UEFI + tcpserial=<port> - specify tcp serial port number + biosdir=<dir> - specify custom bios dir + biosfilename=<filename> - specify bios filename + qemuparams=<xyz> - specify custom parameters to QEMU + bootparams=<xyz> - specify custom kernel parameters during boot + help, -h, --help: print this text + +Examples: + runqemu + runqemu qemuarm + runqemu tmp/deploy/images/qemuarm + runqemu tmp/deploy/images/qemux86/<qemuboot.conf> + runqemu qemux86-64 core-image-sato ext4 + runqemu qemux86-64 wic-image-minimal wic + runqemu path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial + runqemu qemux86 iso/hddimg/vmdk/qcow2/vdi/ramfs/cpio.gz... + runqemu qemux86 qemuparams="-m 256" + runqemu qemux86 bootparams="psplash=false" + runqemu path/to/<image>-<machine>.vmdk + runqemu path/to/<image>-<machine>.wic +""") + +def check_tun(): + """Check /dev/net/tun""" + dev_tun = '/dev/net/tun' + if not os.path.exists(dev_tun): + raise Exception("TUN control device %s is unavailable; you may need to enable TUN (e.g. sudo modprobe tun)" % dev_tun) + + if not os.access(dev_tun, os.W_OK): + raise Exception("TUN control device %s is not writable, please fix (e.g. sudo chmod 666 %s)" % (dev_tun, dev_tun)) + +def check_libgl(qemu_bin): + cmd = 'ldd %s' % qemu_bin + logger.info('Running %s...' % cmd) + need_gl = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8') + if re.search('libGLU', need_gl): + # We can't run without a libGL.so + libgl = False + check_files = (('/usr/lib/libGL.so', '/usr/lib/libGLU.so'), \ + ('/usr/lib64/libGL.so', '/usr/lib64/libGLU.so'), \ + ('/usr/lib/*-linux-gnu/libGL.so', '/usr/lib/*-linux-gnu/libGLU.so')) + + for (f1, f2) in check_files: + if re.search('\*', f1): + for g1 in glob.glob(f1): + if libgl: + break + if os.path.exists(g1): + for g2 in glob.glob(f2): + if os.path.exists(g2): + libgl = True + break + if libgl: + break + else: + if os.path.exists(f1) and os.path.exists(f2): + libgl = True + break + if not libgl: + logger.error("You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator.") + logger.error("Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev.") + logger.error("Fedora package names are: mesa-libGL-devel mesa-libGLU-devel.") + raise Exception('%s requires libGLU, but not found' % qemu_bin) + +def get_first_file(cmds): + """Return first file found in wildcard cmds""" + for cmd in cmds: + all_files = glob.glob(cmd) + if all_files: + for f in all_files: + if not os.path.isdir(f): + return f + return '' + +def check_free_port(host, port): + """ Check whether the port is free or not """ + import socket + from contextlib import closing + + with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: + if sock.connect_ex((host, port)) == 0: + # Port is open, so not free + return False + else: + # Port is not open, so free + return True + +class BaseConfig(object): + def __init__(self): + # The self.d saved vars from self.set(), part of them are from qemuboot.conf + self.d = {'QB_KERNEL_ROOT': '/dev/vda'} + + # Supported env vars, add it here if a var can be got from env, + # and don't use os.getenv in the code. + self.env_vars = ('MACHINE', + 'ROOTFS', + 'KERNEL', + 'DEPLOY_DIR_IMAGE', + 'OE_TMPDIR', + 'OECORE_NATIVE_SYSROOT', + ) + + self.qemu_opt = '' + self.qemu_opt_script = '' + self.clean_nfs_dir = False + self.nfs_server = '' + self.rootfs = '' + # File name(s) of a OVMF firmware file or variable store, + # to be added with -drive if=pflash. + # Found in the same places as the rootfs, with or without one of + # these suffices: qcow2, bin. + # Setting one also adds "-vga std" because that is all that + # OVMF supports. + self.ovmf_bios = [] + self.qemuboot = '' + self.qbconfload = False + self.kernel = '' + self.kernel_cmdline = '' + self.kernel_cmdline_script = '' + self.bootparams = '' + self.dtb = '' + self.fstype = '' + self.kvm_enabled = False + self.vhost_enabled = False + self.slirp_enabled = False + self.nfs_instance = 0 + self.nfs_running = False + self.serialstdio = False + self.cleantap = False + self.saved_stty = '' + self.audio_enabled = False + self.tcpserial_portnum = '' + self.custombiosdir = '' + self.lock = '' + self.lock_descriptor = '' + self.bitbake_e = '' + self.snapshot = False + self.fstypes = ('ext2', 'ext3', 'ext4', 'jffs2', 'nfs', 'btrfs', 'cpio.gz', 'cpio', 'ramfs') + self.vmtypes = ('hddimg', 'hdddirect', 'wic', 'vmdk', 'qcow2', 'vdi', 'iso') + self.network_device = "-device e1000,netdev=net0,mac=@MAC@" + # Use different mac section for tap and slirp to avoid + # conflicts, e.g., when one is running with tap, the other is + # running with slirp. + # The last section is dynamic, which is for avoiding conflicts, + # when multiple qemus are running, e.g., when multiple tap or + # slirp qemus are running. + self.mac_tap = "52:54:00:12:34:" + self.mac_slirp = "52:54:00:12:35:" + + def acquire_lock(self): + logger.info("Acquiring lockfile %s..." % self.lock) + try: + self.lock_descriptor = open(self.lock, 'w') + fcntl.flock(self.lock_descriptor, fcntl.LOCK_EX|fcntl.LOCK_NB) + except Exception as e: + logger.info("Acquiring lockfile %s failed: %s" % (self.lock, e)) + if self.lock_descriptor: + self.lock_descriptor.close() + return False + return True + + def release_lock(self): + fcntl.flock(self.lock_descriptor, fcntl.LOCK_UN) + self.lock_descriptor.close() + os.remove(self.lock) + + def get(self, key): + if key in self.d: + return self.d.get(key) + elif os.getenv(key): + return os.getenv(key) + else: + return '' + + def set(self, key, value): + self.d[key] = value + + def is_deploy_dir_image(self, p): + if os.path.isdir(p): + if not re.search('.qemuboot.conf$', '\n'.join(os.listdir(p)), re.M): + logger.info("Can't find required *.qemuboot.conf in %s" % p) + return False + if not any(map(lambda name: '-image-' in name, os.listdir(p))): + logger.info("Can't find *-image-* in %s" % p) + return False + return True + else: + return False + + def check_arg_fstype(self, fst): + """Check and set FSTYPE""" + if fst not in self.fstypes + self.vmtypes: + logger.warn("Maybe unsupported FSTYPE: %s" % fst) + if not self.fstype or self.fstype == fst: + if fst == 'ramfs': + fst = 'cpio.gz' + self.fstype = fst + else: + raise Exception("Conflicting: FSTYPE %s and %s" % (self.fstype, fst)) + + def set_machine_deploy_dir(self, machine, deploy_dir_image): + """Set MACHINE and DEPLOY_DIR_IMAGE""" + logger.info('MACHINE: %s' % machine) + self.set("MACHINE", machine) + logger.info('DEPLOY_DIR_IMAGE: %s' % deploy_dir_image) + self.set("DEPLOY_DIR_IMAGE", deploy_dir_image) + + def check_arg_nfs(self, p): + if os.path.isdir(p): + self.rootfs = p + else: + m = re.match('(.*):(.*)', p) + self.nfs_server = m.group(1) + self.rootfs = m.group(2) + self.check_arg_fstype('nfs') + + def check_arg_path(self, p): + """ + - Check whether it is <image>.qemuboot.conf or contains <image>.qemuboot.conf + - Check whether is a kernel file + - Check whether is a image file + - Check whether it is a nfs dir + - Check whether it is a OVMF flash file + """ + if p.endswith('.qemuboot.conf'): + self.qemuboot = p + self.qbconfload = True + elif re.search('\.bin$', p) or re.search('bzImage', p) or \ + re.search('zImage', p) or re.search('vmlinux', p) or \ + re.search('fitImage', p) or re.search('uImage', p): + self.kernel = p + elif os.path.exists(p) and (not os.path.isdir(p)) and '-image-' in os.path.basename(p): + self.rootfs = p + # Check filename against self.fstypes can hanlde <file>.cpio.gz, + # otherwise, its type would be "gz", which is incorrect. + fst = "" + for t in self.fstypes: + if p.endswith(t): + fst = t + break + if not fst: + m = re.search('.*\.(.*)$', self.rootfs) + if m: + fst = m.group(1) + if fst: + self.check_arg_fstype(fst) + qb = re.sub('\.' + fst + "$", '', self.rootfs) + qb = '%s%s' % (re.sub('\.rootfs$', '', qb), '.qemuboot.conf') + if os.path.exists(qb): + self.qemuboot = qb + self.qbconfload = True + else: + logger.warn("%s doesn't exist" % qb) + else: + raise Exception("Can't find FSTYPE from: %s" % p) + + elif os.path.isdir(p) or re.search(':', p) and re.search('/', p): + if self.is_deploy_dir_image(p): + logger.info('DEPLOY_DIR_IMAGE: %s' % p) + self.set("DEPLOY_DIR_IMAGE", p) + else: + logger.info("Assuming %s is an nfs rootfs" % p) + self.check_arg_nfs(p) + elif os.path.basename(p).startswith('ovmf'): + self.ovmf_bios.append(p) + else: + raise Exception("Unknown path arg %s" % p) + + def check_arg_machine(self, arg): + """Check whether it is a machine""" + if self.get('MACHINE') == arg: + return + elif self.get('MACHINE') and self.get('MACHINE') != arg: + raise Exception("Maybe conflicted MACHINE: %s vs %s" % (self.get('MACHINE'), arg)) + elif re.search('/', arg): + raise Exception("Unknown arg: %s" % arg) + + logger.info('Assuming MACHINE = %s' % arg) + + # if we're running under testimage, or similarly as a child + # of an existing bitbake invocation, we can't invoke bitbake + # to validate the MACHINE setting and must assume it's correct... + # FIXME: testimage.bbclass exports these two variables into env, + # are there other scenarios in which we need to support being + # invoked by bitbake? + deploy = self.get('DEPLOY_DIR_IMAGE') + bbchild = deploy and self.get('OE_TMPDIR') + if bbchild: + self.set_machine_deploy_dir(arg, deploy) + return + # also check whether we're running under a sourced toolchain + # environment file + if self.get('OECORE_NATIVE_SYSROOT'): + self.set("MACHINE", arg) + return + + cmd = 'MACHINE=%s bitbake -e' % arg + logger.info('Running %s...' % cmd) + self.bitbake_e = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8') + # bitbake -e doesn't report invalid MACHINE as an error, so + # let's check DEPLOY_DIR_IMAGE to make sure that it is a valid + # MACHINE. + s = re.search('^DEPLOY_DIR_IMAGE="(.*)"', self.bitbake_e, re.M) + if s: + deploy_dir_image = s.group(1) + else: + raise Exception("bitbake -e %s" % self.bitbake_e) + if self.is_deploy_dir_image(deploy_dir_image): + self.set_machine_deploy_dir(arg, deploy_dir_image) + else: + logger.error("%s not a directory valid DEPLOY_DIR_IMAGE" % deploy_dir_image) + self.set("MACHINE", arg) + + def check_args(self): + unknown_arg = "" + for arg in sys.argv[1:]: + if arg in self.fstypes + self.vmtypes: + self.check_arg_fstype(arg) + elif arg == 'nographic': + self.qemu_opt_script += ' -nographic' + self.kernel_cmdline_script += ' console=ttyS0' + elif arg == 'serial': + self.kernel_cmdline_script += ' console=ttyS0' + self.serialstdio = True + elif arg == 'audio': + logger.info("Enabling audio in qemu") + logger.info("Please install sound drivers in linux host") + self.audio_enabled = True + elif arg == 'kvm': + self.kvm_enabled = True + elif arg == 'kvm-vhost': + self.vhost_enabled = True + elif arg == 'slirp': + self.slirp_enabled = True + elif arg == 'snapshot': + self.snapshot = True + elif arg == 'publicvnc': + self.qemu_opt_script += ' -vnc :0' + elif arg.startswith('tcpserial='): + self.tcpserial_portnum = arg[len('tcpserial='):] + elif arg.startswith('biosdir='): + self.custombiosdir = arg[len('biosdir='):] + elif arg.startswith('biosfilename='): + self.qemu_opt_script += ' -bios %s' % arg[len('biosfilename='):] + elif arg.startswith('qemuparams='): + self.qemu_opt_script += ' %s' % arg[len('qemuparams='):] + elif arg.startswith('bootparams='): + self.bootparams = arg[len('bootparams='):] + elif os.path.exists(arg) or (re.search(':', arg) and re.search('/', arg)): + self.check_arg_path(os.path.abspath(arg)) + elif re.search(r'-image-|-image$', arg): + # Lazy rootfs + self.rootfs = arg + elif arg.startswith('ovmf'): + self.ovmf_bios.append(arg) + else: + # At last, assume it is the MACHINE + if (not unknown_arg) or unknown_arg == arg: + unknown_arg = arg + else: + raise Exception("Can't handle two unknown args: %s %s" % (unknown_arg, arg)) + # Check to make sure it is a valid machine + if unknown_arg: + if self.get('MACHINE') == unknown_arg: + return + if self.get('DEPLOY_DIR_IMAGE'): + machine = os.path.basename(self.get('DEPLOY_DIR_IMAGE')) + if unknown_arg == machine: + self.set("MACHINE", machine) + return + + self.check_arg_machine(unknown_arg) + + if not self.get('DEPLOY_DIR_IMAGE'): + self.load_bitbake_env() + s = re.search('^DEPLOY_DIR_IMAGE="(.*)"', self.bitbake_e, re.M) + if s: + self.set("DEPLOY_DIR_IMAGE", s.group(1)) + + def check_kvm(self): + """Check kvm and kvm-host""" + if not (self.kvm_enabled or self.vhost_enabled): + self.qemu_opt_script += ' %s %s' % (self.get('QB_MACHINE'), self.get('QB_CPU')) + return + + if not self.get('QB_CPU_KVM'): + raise Exception("QB_CPU_KVM is NULL, this board doesn't support kvm") + + self.qemu_opt_script += ' %s %s' % (self.get('QB_MACHINE'), self.get('QB_CPU_KVM')) + yocto_kvm_wiki = "https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" + yocto_paravirt_kvm_wiki = "https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM" + dev_kvm = '/dev/kvm' + dev_vhost = '/dev/vhost-net' + with open('/proc/cpuinfo', 'r') as f: + kvm_cap = re.search('vmx|svm', "".join(f.readlines())) + if not kvm_cap: + logger.error("You are trying to enable KVM on a cpu without VT support.") + logger.error("Remove kvm from the command-line, or refer:") + raise Exception(yocto_kvm_wiki) + + if not os.path.exists(dev_kvm): + logger.error("Missing KVM device. Have you inserted kvm modules?") + logger.error("For further help see:") + raise Exception(yocto_kvm_wiki) + + if os.access(dev_kvm, os.W_OK|os.R_OK): + self.qemu_opt_script += ' -enable-kvm' + else: + logger.error("You have no read or write permission on /dev/kvm.") + logger.error("Please change the ownership of this file as described at:") + raise Exception(yocto_kvm_wiki) + + if self.vhost_enabled: + if not os.path.exists(dev_vhost): + logger.error("Missing virtio net device. Have you inserted vhost-net module?") + logger.error("For further help see:") + raise Exception(yocto_paravirt_kvm_wiki) + + if not os.access(dev_kvm, os.W_OK|os.R_OK): + logger.error("You have no read or write permission on /dev/vhost-net.") + logger.error("Please change the ownership of this file as described at:") + raise Exception(yocto_kvm_wiki) + + def check_fstype(self): + """Check and setup FSTYPE""" + if not self.fstype: + fstype = self.get('QB_DEFAULT_FSTYPE') + if fstype: + self.fstype = fstype + else: + raise Exception("FSTYPE is NULL!") + + def check_rootfs(self): + """Check and set rootfs""" + + if self.fstype == "none": + return + + if self.get('ROOTFS'): + if not self.rootfs: + self.rootfs = self.get('ROOTFS') + elif self.get('ROOTFS') != self.rootfs: + raise Exception("Maybe conflicted ROOTFS: %s vs %s" % (self.get('ROOTFS'), self.rootfs)) + + if self.fstype == 'nfs': + return + + if self.rootfs and not os.path.exists(self.rootfs): + # Lazy rootfs + self.rootfs = "%s/%s-%s.%s" % (self.get('DEPLOY_DIR_IMAGE'), + self.rootfs, self.get('MACHINE'), + self.fstype) + elif not self.rootfs: + cmd_name = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_NAME'), self.fstype) + cmd_link = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME'), self.fstype) + cmds = (cmd_name, cmd_link) + self.rootfs = get_first_file(cmds) + if not self.rootfs: + raise Exception("Failed to find rootfs: %s or %s" % cmds) + + if not os.path.exists(self.rootfs): + raise Exception("Can't find rootfs: %s" % self.rootfs) + + def check_ovmf(self): + """Check and set full path for OVMF firmware and variable file(s).""" + + for index, ovmf in enumerate(self.ovmf_bios): + if os.path.exists(ovmf): + continue + for suffix in ('qcow2', 'bin'): + path = '%s/%s.%s' % (self.get('DEPLOY_DIR_IMAGE'), ovmf, suffix) + if os.path.exists(path): + self.ovmf_bios[index] = path + break + else: + raise Exception("Can't find OVMF firmware: %s" % ovmf) + + def check_kernel(self): + """Check and set kernel, dtb""" + # The vm image doesn't need a kernel + if self.fstype in self.vmtypes: + return + + # QB_DEFAULT_KERNEL is always a full file path + kernel_name = os.path.basename(self.get('QB_DEFAULT_KERNEL')) + + # The user didn't want a kernel to be loaded + if kernel_name == "none": + return + + deploy_dir_image = self.get('DEPLOY_DIR_IMAGE') + if not self.kernel: + kernel_match_name = "%s/%s" % (deploy_dir_image, kernel_name) + kernel_match_link = "%s/%s" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE')) + kernel_startswith = "%s/%s*" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE')) + cmds = (kernel_match_name, kernel_match_link, kernel_startswith) + self.kernel = get_first_file(cmds) + if not self.kernel: + raise Exception('KERNEL not found: %s, %s or %s' % cmds) + + if not os.path.exists(self.kernel): + raise Exception("KERNEL %s not found" % self.kernel) + + dtb = self.get('QB_DTB') + if dtb: + cmd_match = "%s/%s" % (deploy_dir_image, dtb) + cmd_startswith = "%s/%s*" % (deploy_dir_image, dtb) + cmd_wild = "%s/*.dtb" % deploy_dir_image + cmds = (cmd_match, cmd_startswith, cmd_wild) + self.dtb = get_first_file(cmds) + if not os.path.exists(self.dtb): + raise Exception('DTB not found: %s, %s or %s' % cmds) + + def check_biosdir(self): + """Check custombiosdir""" + if not self.custombiosdir: + return + + biosdir = "" + biosdir_native = "%s/%s" % (self.get('STAGING_DIR_NATIVE'), self.custombiosdir) + biosdir_host = "%s/%s" % (self.get('STAGING_DIR_HOST'), self.custombiosdir) + for i in (self.custombiosdir, biosdir_native, biosdir_host): + if os.path.isdir(i): + biosdir = i + break + + if biosdir: + logger.info("Assuming biosdir is: %s" % biosdir) + self.qemu_opt_script += ' -L %s' % biosdir + else: + logger.error("Custom BIOS directory not found. Tried: %s, %s, and %s" % (self.custombiosdir, biosdir_native, biosdir_host)) + raise Exception("Invalid custombiosdir: %s" % self.custombiosdir) + + def check_mem(self): + s = re.search('-m +([0-9]+)', self.qemu_opt_script) + if s: + self.set('QB_MEM', '-m %s' % s.group(1)) + elif not self.get('QB_MEM'): + logger.info('QB_MEM is not set, use 512M by default') + self.set('QB_MEM', '-m 512') + + self.kernel_cmdline_script += ' mem=%s' % self.get('QB_MEM').replace('-m','').strip() + 'M' + self.qemu_opt_script += ' %s' % self.get('QB_MEM') + + def check_tcpserial(self): + if self.tcpserial_portnum: + if self.get('QB_TCPSERIAL_OPT'): + self.qemu_opt_script += ' ' + self.get('QB_TCPSERIAL_OPT').replace('@PORT@', self.tcpserial_portnum) + else: + self.qemu_opt_script += ' -serial tcp:127.0.0.1:%s' % self.tcpserial_portnum + + def check_and_set(self): + """Check configs sanity and set when needed""" + self.validate_paths() + if not self.slirp_enabled: + check_tun() + # Check audio + if self.audio_enabled: + if not self.get('QB_AUDIO_DRV'): + raise Exception("QB_AUDIO_DRV is NULL, this board doesn't support audio") + if not self.get('QB_AUDIO_OPT'): + logger.warn('QB_AUDIO_OPT is NULL, you may need define it to make audio work') + else: + self.qemu_opt_script += ' %s' % self.get('QB_AUDIO_OPT') + os.putenv('QEMU_AUDIO_DRV', self.get('QB_AUDIO_DRV')) + else: + os.putenv('QEMU_AUDIO_DRV', 'none') + + self.check_kvm() + self.check_fstype() + self.check_rootfs() + self.check_ovmf() + self.check_kernel() + self.check_biosdir() + self.check_mem() + self.check_tcpserial() + + def read_qemuboot(self): + if not self.qemuboot: + if self.get('DEPLOY_DIR_IMAGE'): + deploy_dir_image = self.get('DEPLOY_DIR_IMAGE') + else: + logger.info("Can't find qemuboot conf file, DEPLOY_DIR_IMAGE is NULL!") + return + + if self.rootfs and not os.path.exists(self.rootfs): + # Lazy rootfs + machine = self.get('MACHINE') + if not machine: + machine = os.path.basename(deploy_dir_image) + self.qemuboot = "%s/%s-%s.qemuboot.conf" % (deploy_dir_image, + self.rootfs, machine) + else: + cmd = 'ls -t %s/*.qemuboot.conf' % deploy_dir_image + logger.info('Running %s...' % cmd) + qbs = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8') + if qbs: + for qb in qbs.split(): + # Don't use initramfs when other choices unless fstype is ramfs + if '-initramfs-' in os.path.basename(qb) and self.fstype != 'cpio.gz': + continue + self.qemuboot = qb + break + if not self.qemuboot: + # Use the first one when no choice + self.qemuboot = qbs.split()[0] + self.qbconfload = True + + if not self.qemuboot: + # If we haven't found a .qemuboot.conf at this point it probably + # doesn't exist, continue without return - ;; - esac - done - - echo "Couldn't find a $machine rootfs image in $where." - exit 1 -} - -if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then - # Extract the filename extension - EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'` - if [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \ - "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" -o \ - "x$EXT" = "xext4" ]; then - FSTYPE=$EXT - else - echo "Note: Unable to determine filesystem extension for $ROOTFS" - echo "We will use the default FSTYPE for $MACHINE" - # ...which is done further below... - fi -fi - -if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then - setup_tmpdir - eval kernel_file=\$${machine2}_DEFAULT_KERNEL - KERNEL=$OE_TMPDIR/deploy/images/$kernel_file - - if [ -z "$KERNEL" ]; then - error "Unable to determine default kernel for MACHINE [$MACHINE]" - fi -fi -# KERNEL is now set for all cases - -if [ -z "$FSTYPE" ]; then - eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE - - if [ -z "$FSTYPE" ]; then - error "Unable to determine default fstype for MACHINE [$MACHINE]" - fi -fi - -# FSTYPE is now set for all cases - -# Handle cases where a ROOTFS type is given instead of a filename, e.g. -# core-image-sato -if [ "$LAZY_ROOTFS" = "true" ]; then - setup_tmpdir - echo "Assuming $ROOTFS really means $OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE" - ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE -fi - -if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then - setup_tmpdir - T=$OE_TMPDIR/deploy/images - eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS - findimage $T $MACHINE $FSTYPE - - if [ -z "$ROOTFS" ]; then - error "Unable to determine default rootfs for MACHINE [$MACHINE]" - fi -fi -# ROOTFS is now set for all cases - -echo "" -echo "Continuing with the following parameters:" -if [ "x$FSTYPE" != "xvmdk" ]; then - echo "KERNEL: [$KERNEL]" - echo "ROOTFS: [$ROOTFS]" -else - echo "VMDK: [$VM]" -fi -echo "FSTYPE: [$FSTYPE]" - -setup_sysroot -# OECORE_NATIVE_SYSROOT is now set for all cases - -INTERNAL_SCRIPT="$0-internal" -if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then -INTERNAL_SCRIPT=`which runqemu-internal` -fi - -. $INTERNAL_SCRIPT -exit $? + + if not os.path.exists(self.qemuboot): + raise Exception("Failed to find %s (wrong image name or BSP does not support running under qemu?)." % self.qemuboot) + + logger.info('CONFFILE: %s' % self.qemuboot) + + cf = configparser.ConfigParser() + cf.read(self.qemuboot) + for k, v in cf.items('config_bsp'): + k_upper = k.upper() + self.set(k_upper, v) + + def validate_paths(self): + """Ensure all relevant path variables are set""" + # When we're started with a *.qemuboot.conf arg assume that image + # artefacts are relative to that file, rather than in whatever + # directory DEPLOY_DIR_IMAGE in the conf file points to. + if self.qbconfload: + imgdir = os.path.realpath(os.path.dirname(self.qemuboot)) + if imgdir != os.path.realpath(self.get('DEPLOY_DIR_IMAGE')): + logger.info('Setting DEPLOY_DIR_IMAGE to folder containing %s (%s)' % (self.qemuboot, imgdir)) + self.set('DEPLOY_DIR_IMAGE', imgdir) + + # If the STAGING_*_NATIVE directories from the config file don't exist + # and we're in a sourced OE build directory try to extract the paths + # from `bitbake -e` + havenative = os.path.exists(self.get('STAGING_DIR_NATIVE')) and \ + os.path.exists(self.get('STAGING_BINDIR_NATIVE')) + + if not havenative: + if not self.bitbake_e: + self.load_bitbake_env() + + if self.bitbake_e: + native_vars = ['STAGING_DIR_NATIVE'] + for nv in native_vars: + s = re.search('^%s="(.*)"' % nv, self.bitbake_e, re.M) + if s and s.group(1) != self.get(nv): + logger.info('Overriding conf file setting of %s to %s from Bitbake environment' % (nv, s.group(1))) + self.set(nv, s.group(1)) + else: + # when we're invoked from a running bitbake instance we won't + # be able to call `bitbake -e`, then try: + # - get OE_TMPDIR from environment and guess paths based on it + # - get OECORE_NATIVE_SYSROOT from environment (for sdk) + tmpdir = self.get('OE_TMPDIR') + oecore_native_sysroot = self.get('OECORE_NATIVE_SYSROOT') + if tmpdir: + logger.info('Setting STAGING_DIR_NATIVE and STAGING_BINDIR_NATIVE relative to OE_TMPDIR (%s)' % tmpdir) + hostos, _, _, _, machine = os.uname() + buildsys = '%s-%s' % (machine, hostos.lower()) + staging_dir_native = '%s/sysroots/%s' % (tmpdir, buildsys) + self.set('STAGING_DIR_NATIVE', staging_dir_native) + elif oecore_native_sysroot: + logger.info('Setting STAGING_DIR_NATIVE to OECORE_NATIVE_SYSROOT (%s)' % oecore_native_sysroot) + self.set('STAGING_DIR_NATIVE', oecore_native_sysroot) + if self.get('STAGING_DIR_NATIVE'): + # we have to assume that STAGING_BINDIR_NATIVE is at usr/bin + staging_bindir_native = '%s/usr/bin' % self.get('STAGING_DIR_NATIVE') + logger.info('Setting STAGING_BINDIR_NATIVE to %s' % staging_bindir_native) + self.set('STAGING_BINDIR_NATIVE', '%s/usr/bin' % self.get('STAGING_DIR_NATIVE')) + + def print_config(self): + logger.info('Continuing with the following parameters:\n') + if not self.fstype in self.vmtypes: + print('KERNEL: [%s]' % self.kernel) + if self.dtb: + print('DTB: [%s]' % self.dtb) + print('MACHINE: [%s]' % self.get('MACHINE')) + print('FSTYPE: [%s]' % self.fstype) + if self.fstype == 'nfs': + print('NFS_DIR: [%s]' % self.rootfs) + else: + print('ROOTFS: [%s]' % self.rootfs) + if self.ovmf_bios: + print('OVMF: %s' % self.ovmf_bios) + print('CONFFILE: [%s]' % self.qemuboot) + print('') + + def setup_nfs(self): + if not self.nfs_server: + if self.slirp_enabled: + self.nfs_server = '10.0.2.2' + else: + self.nfs_server = '192.168.7.1' + + # Figure out a new nfs_instance to allow multiple qemus running. + # CentOS 7.1's ps doesn't print full command line without "ww" + # when invoke by subprocess.Popen(). + cmd = "ps auxww" + ps = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8') + pattern = '/bin/unfsd .* -i .*\.pid -e .*/exports([0-9]+) ' + all_instances = re.findall(pattern, ps, re.M) + if all_instances: + all_instances.sort(key=int) + self.nfs_instance = int(all_instances.pop()) + 1 + + mountd_rpcport = 21111 + self.nfs_instance + nfsd_rpcport = 11111 + self.nfs_instance + nfsd_port = 3049 + 2 * self.nfs_instance + mountd_port = 3048 + 2 * self.nfs_instance + + # Export vars for runqemu-export-rootfs + export_dict = { + 'NFS_INSTANCE': self.nfs_instance, + 'MOUNTD_RPCPORT': mountd_rpcport, + 'NFSD_RPCPORT': nfsd_rpcport, + 'NFSD_PORT': nfsd_port, + 'MOUNTD_PORT': mountd_port, + } + for k, v in export_dict.items(): + # Use '%s' since they are integers + os.putenv(k, '%s' % v) + + self.unfs_opts="nfsvers=3,port=%s,mountprog=%s,nfsprog=%s,udp,mountport=%s" % (nfsd_port, mountd_rpcport, nfsd_rpcport, mountd_port) + + # Extract .tar.bz2 or .tar.bz if no nfs dir + if not (self.rootfs and os.path.isdir(self.rootfs)): + src_prefix = '%s/%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME')) + dest = "%s-nfsroot" % src_prefix + if os.path.exists('%s.pseudo_state' % dest): + logger.info('Use %s as NFS_DIR' % dest) + self.rootfs = dest + else: + src = "" + src1 = '%s.tar.bz2' % src_prefix + src2 = '%s.tar.gz' % src_prefix + if os.path.exists(src1): + src = src1 + elif os.path.exists(src2): + src = src2 + if not src: + raise Exception("No NFS_DIR is set, and can't find %s or %s to extract" % (src1, src2)) + logger.info('NFS_DIR not found, extracting %s to %s' % (src, dest)) + cmd = 'runqemu-extract-sdk %s %s' % (src, dest) + logger.info('Running %s...' % cmd) + if subprocess.call(cmd, shell=True) != 0: + raise Exception('Failed to run %s' % cmd) + self.clean_nfs_dir = True + self.rootfs = dest + + # Start the userspace NFS server + cmd = 'runqemu-export-rootfs start %s' % self.rootfs + logger.info('Running %s...' % cmd) + if subprocess.call(cmd, shell=True) != 0: + raise Exception('Failed to run %s' % cmd) + + self.nfs_running = True + + def setup_slirp(self): + """Setup user networking""" + + if self.fstype == 'nfs': + self.setup_nfs() + self.kernel_cmdline_script += ' ip=dhcp' + # Port mapping + hostfwd = ",hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23" + qb_slirp_opt_default = "-netdev user,id=net0%s" % hostfwd + qb_slirp_opt = self.get('QB_SLIRP_OPT') or qb_slirp_opt_default + # Figure out the port + ports = re.findall('hostfwd=[^-]*:([0-9]+)-[^,-]*', qb_slirp_opt) + ports = [int(i) for i in ports] + mac = 2 + # Find a free port to avoid conflicts + for p in ports[:]: + p_new = p + while not check_free_port('localhost', p_new): + p_new += 1 + mac += 1 + while p_new in ports: + p_new += 1 + mac += 1 + if p != p_new: + ports.append(p_new) + qb_slirp_opt = re.sub(':%s-' % p, ':%s-' % p_new, qb_slirp_opt) + logger.info("Port forward changed: %s -> %s" % (p, p_new)) + mac = "%s%02x" % (self.mac_slirp, mac) + self.set('NETWORK_CMD', '%s %s' % (self.network_device.replace('@MAC@', mac), qb_slirp_opt)) + # Print out port foward + hostfwd = re.findall('(hostfwd=[^,]*)', qb_slirp_opt) + if hostfwd: + logger.info('Port forward: %s' % ' '.join(hostfwd)) + + def setup_tap(self): + """Setup tap""" + + # This file is created when runqemu-gen-tapdevs creates a bank of tap + # devices, indicating that the user should not bring up new ones using + # sudo. + nosudo_flag = '/etc/runqemu-nosudo' + self.qemuifup = shutil.which('runqemu-ifup') + self.qemuifdown = shutil.which('runqemu-ifdown') + ip = shutil.which('ip') + lockdir = "/tmp/qemu-tap-locks" + + if not (self.qemuifup and self.qemuifdown and ip): + raise OEPathError("runqemu-ifup, runqemu-ifdown or ip not found") + + if not os.path.exists(lockdir): + # There might be a race issue when multi runqemu processess are + # running at the same time. + try: + os.mkdir(lockdir) + except FileExistsError: + pass + + cmd = '%s link' % ip + logger.info('Running %s...' % cmd) + ip_link = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8') + # Matches line like: 6: tap0: <foo> + possibles = re.findall('^[1-9]+: +(tap[0-9]+): <.*', ip_link, re.M) + tap = "" + for p in possibles: + lockfile = os.path.join(lockdir, p) + if os.path.exists('%s.skip' % lockfile): + logger.info('Found %s.skip, skipping %s' % (lockfile, p)) + continue + self.lock = lockfile + '.lock' + if self.acquire_lock(): + tap = p + logger.info("Using preconfigured tap device %s" % tap) + logger.info("If this is not intended, touch %s.skip to make runqemu skip %s." %(lockfile, tap)) + break + + if not tap: + if os.path.exists(nosudo_flag): + logger.error("Error: There are no available tap devices to use for networking,") + logger.error("and I see %s exists, so I am not going to try creating" % nosudo_flag) + raise Exception("a new one with sudo.") + + gid = os.getgid() + uid = os.getuid() + logger.info("Setting up tap interface under sudo") + cmd = 'sudo %s %s %s %s' % (self.qemuifup, uid, gid, self.bindir_native) + tap = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8').rstrip('\n') + lockfile = os.path.join(lockdir, tap) + self.lock = lockfile + '.lock' + self.acquire_lock() + self.cleantap = True + logger.info('Created tap: %s' % tap) + + if not tap: + logger.error("Failed to setup tap device. Run runqemu-gen-tapdevs to manually create.") + return 1 + self.tap = tap + tapnum = int(tap[3:]) + gateway = tapnum * 2 + 1 + client = gateway + 1 + if self.fstype == 'nfs': + self.setup_nfs() + netconf = "192.168.7.%s::192.168.7.%s:255.255.255.0" % (client, gateway) + logger.info("Network configuration: %s", netconf) + self.kernel_cmdline_script += " ip=%s" % netconf + mac = "%s%02x" % (self.mac_tap, client) + qb_tap_opt = self.get('QB_TAP_OPT') + if qb_tap_opt: + qemu_tap_opt = qb_tap_opt.replace('@TAP@', tap) + else: + qemu_tap_opt = "-netdev tap,id=net0,ifname=%s,script=no,downscript=no" % (self.tap) + + if self.vhost_enabled: + qemu_tap_opt += ',vhost=on' + + self.set('NETWORK_CMD', '%s %s' % (self.network_device.replace('@MAC@', mac), qemu_tap_opt)) + + def setup_network(self): + if self.get('QB_NET') == 'none': + return + cmd = "stty -g" + self.saved_stty = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8') + self.network_device = self.get('QB_NETWORK_DEVICE') or self.network_device + if self.slirp_enabled: + self.setup_slirp() + else: + self.setup_tap() + + def setup_rootfs(self): + if self.get('QB_ROOTFS') == 'none': + return + rootfs_format = self.fstype if self.fstype in ('vmdk', 'qcow2', 'vdi') else 'raw' + + qb_rootfs_opt = self.get('QB_ROOTFS_OPT') + if qb_rootfs_opt: + self.rootfs_options = qb_rootfs_opt.replace('@ROOTFS@', self.rootfs) + else: + self.rootfs_options = '-drive file=%s,if=virtio,format=%s' % (self.rootfs, rootfs_format) + + if self.fstype in ('cpio.gz', 'cpio'): + self.kernel_cmdline = 'root=/dev/ram0 rw debugshell' + self.rootfs_options = '-initrd %s' % self.rootfs + else: + vm_drive = '' + if self.fstype in self.vmtypes: + if self.fstype == 'iso': + vm_drive = '-cdrom %s' % self.rootfs + elif self.get('QB_DRIVE_TYPE'): + drive_type = self.get('QB_DRIVE_TYPE') + if drive_type.startswith("/dev/sd"): + logger.info('Using scsi drive') + vm_drive = '-drive if=none,id=hd,file=%s,format=%s -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd' \ + % (self.rootfs, rootfs_format) + elif drive_type.startswith("/dev/hd"): + logger.info('Using ide drive') + vm_drive = "%s,format=%s" % (self.rootfs, rootfs_format) + else: + # virtio might have been selected explicitly (just use it), or + # is used as fallback (then warn about that). + if not drive_type.startswith("/dev/vd"): + logger.warn("Unknown QB_DRIVE_TYPE: %s" % drive_type) + logger.warn("Failed to figure out drive type, consider define or fix QB_DRIVE_TYPE") + logger.warn('Trying to use virtio block drive') + vm_drive = '-drive if=virtio,file=%s,format=%s' % (self.rootfs, rootfs_format) + + # All branches above set vm_drive. + self.rootfs_options = '%s -no-reboot' % vm_drive + self.kernel_cmdline = 'root=%s rw highres=off' % (self.get('QB_KERNEL_ROOT')) + + if self.fstype == 'nfs': + self.rootfs_options = '' + k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server, self.rootfs, self.unfs_opts) + self.kernel_cmdline = 'root=%s rw highres=off' % k_root + + if self.fstype == 'none': + self.rootfs_options = '' + + self.set('ROOTFS_OPTIONS', self.rootfs_options) + + def guess_qb_system(self): + """attempt to determine the appropriate qemu-system binary""" + mach = self.get('MACHINE') + if not mach: + search = '.*(qemux86-64|qemux86|qemuarm64|qemuarm|qemumips64|qemumips64el|qemumipsel|qemumips|qemuppc).*' + if self.rootfs: + match = re.match(search, self.rootfs) + if match: + mach = match.group(1) + elif self.kernel: + match = re.match(search, self.kernel) + if match: + mach = match.group(1) + + if not mach: + return None + + if mach == 'qemuarm': + qbsys = 'arm' + elif mach == 'qemuarm64': + qbsys = 'aarch64' + elif mach == 'qemux86': + qbsys = 'i386' + elif mach == 'qemux86-64': + qbsys = 'x86_64' + elif mach == 'qemuppc': + qbsys = 'ppc' + elif mach == 'qemumips': + qbsys = 'mips' + elif mach == 'qemumips64': + qbsys = 'mips64' + elif mach == 'qemumipsel': + qbsys = 'mipsel' + elif mach == 'qemumips64el': + qbsys = 'mips64el' + + return 'qemu-system-%s' % qbsys + + def setup_final(self): + qemu_system = self.get('QB_SYSTEM_NAME') + if not qemu_system: + qemu_system = self.guess_qb_system() + if not qemu_system: + raise Exception("Failed to boot, QB_SYSTEM_NAME is NULL!") + + qemu_bin = '%s/%s' % (self.bindir_native, qemu_system) + + # It is possible to have qemu-native in ASSUME_PROVIDED, and it won't + # find QEMU in sysroot, it needs to use host's qemu. + if not os.path.exists(qemu_bin): + logger.info("QEMU binary not found in %s, trying host's QEMU" % qemu_bin) + for path in (os.environ['PATH'] or '').split(':'): + qemu_bin_tmp = os.path.join(path, qemu_system) + logger.info("Trying: %s" % qemu_bin_tmp) + if os.path.exists(qemu_bin_tmp): + qemu_bin = qemu_bin_tmp + if not os.path.isabs(qemu_bin): + qemu_bin = os.path.abspath(qemu_bin) + logger.info("Using host's QEMU: %s" % qemu_bin) + break + + if not os.access(qemu_bin, os.X_OK): + raise OEPathError("No QEMU binary '%s' could be found" % qemu_bin) + + check_libgl(qemu_bin) + + self.qemu_opt = "%s %s %s %s" % (qemu_bin, self.get('NETWORK_CMD'), self.get('ROOTFS_OPTIONS'), self.get('QB_OPT_APPEND')) + + for ovmf in self.ovmf_bios: + format = ovmf.rsplit('.', 1)[-1] + self.qemu_opt += ' -drive if=pflash,format=%s,file=%s' % (format, ovmf) + if self.ovmf_bios: + # OVMF only supports normal VGA, i.e. we need to override a -vga vmware + # that gets added for example for normal qemux86. + self.qemu_opt += ' -vga std' + + self.qemu_opt += ' ' + self.qemu_opt_script + + if self.snapshot: + self.qemu_opt += " -snapshot" + + if self.serialstdio: + logger.info("Interrupt character is '^]'") + cmd = "stty intr ^]" + subprocess.call(cmd, shell=True) + + first_serial = "" + if not re.search("-nographic", self.qemu_opt): + first_serial = "-serial mon:vc" + # We always want a ttyS1. Since qemu by default adds a serial + # port when nodefaults is not specified, it seems that all that + # would be needed is to make sure a "-serial" is there. However, + # it appears that when "-serial" is specified, it ignores the + # default serial port that is normally added. So here we make + # sure to add two -serial if there are none. And only one if + # there is one -serial already. + serial_num = len(re.findall("-serial", self.qemu_opt)) + if serial_num == 0: + self.qemu_opt += " %s %s" % (first_serial, self.get("QB_SERIAL_OPT")) + elif serial_num == 1: + self.qemu_opt += " %s" % self.get("QB_SERIAL_OPT") + + # We always wants ttyS0 and ttyS1 in qemu machines (see SERIAL_CONSOLES), + # if not serial or serialtcp options was specified only ttyS0 is created + # and sysvinit shows an error trying to enable ttyS1: + # INIT: Id "S1" respawning too fast: disabled for 5 minutes + serial_num = len(re.findall("-serial", self.qemu_opt)) + if serial_num == 0: + if re.search("-nographic", self.qemu_opt): + self.qemu_opt += " -serial mon:stdio -serial null" + else: + self.qemu_opt += " -serial mon:vc -serial null" + + def start_qemu(self): + if self.kernel: + kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel, self.kernel_cmdline, + self.kernel_cmdline_script, self.get('QB_KERNEL_CMDLINE_APPEND'), + self.bootparams) + if self.dtb: + kernel_opts += " -dtb %s" % self.dtb + else: + kernel_opts = "" + cmd = "%s %s" % (self.qemu_opt, kernel_opts) + logger.info('Running %s' % cmd) + if subprocess.call(cmd, shell=True) != 0: + raise Exception('Failed to run %s' % cmd) + + def cleanup(self): + if self.cleantap: + cmd = 'sudo %s %s %s' % (self.qemuifdown, self.tap, self.bindir_native) + logger.info('Running %s' % cmd) + subprocess.call(cmd, shell=True) + if self.lock_descriptor: + logger.info("Releasing lockfile for tap device '%s'" % self.tap) + self.release_lock() + + if self.nfs_running: + logger.info("Shutting down the userspace NFS server...") + cmd = "runqemu-export-rootfs stop %s" % self.rootfs + logger.info('Running %s' % cmd) + subprocess.call(cmd, shell=True) + + if self.saved_stty: + cmd = "stty %s" % self.saved_stty + subprocess.call(cmd, shell=True) + + if self.clean_nfs_dir: + logger.info('Removing %s' % self.rootfs) + shutil.rmtree(self.rootfs) + shutil.rmtree('%s.pseudo_state' % self.rootfs) + + def load_bitbake_env(self, mach=None): + if self.bitbake_e: + return + + bitbake = shutil.which('bitbake') + if not bitbake: + return + + if not mach: + mach = self.get('MACHINE') + + if mach: + cmd = 'MACHINE=%s bitbake -e' % mach + else: + cmd = 'bitbake -e' + + logger.info('Running %s...' % cmd) + try: + self.bitbake_e = subprocess.check_output(cmd, shell=True).decode('utf-8') + except subprocess.CalledProcessError as err: + self.bitbake_e = '' + logger.warn("Couldn't run 'bitbake -e' to gather environment information:\n%s" % err.output.decode('utf-8')) + + @property + def bindir_native(self): + result = self.get('STAGING_BINDIR_NATIVE') + if result and os.path.exists(result): + return result + + cmd = 'bitbake qemu-helper-native -e' + logger.info('Running %s...' % cmd) + out = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + out = out.stdout.read().decode('utf-8') + + match = re.search('^STAGING_BINDIR_NATIVE="(.*)"', out, re.M) + if match: + result = match.group(1) + if os.path.exists(result): + self.set('STAGING_BINDIR_NATIVE', result) + return result + raise Exception("Native sysroot directory %s doesn't exist" % result) + else: + raise Exception("Can't find STAGING_BINDIR_NATIVE in '%s' output" % cmd) + + +def main(): + if "help" in sys.argv or '-h' in sys.argv or '--help' in sys.argv: + print_usage() + return 0 + config = BaseConfig() + try: + config.check_args() + except Exception as esc: + logger.error(esc) + logger.error("Try 'runqemu help' on how to use it") + return 1 + config.read_qemuboot() + config.check_and_set() + config.print_config() + try: + config.setup_network() + config.setup_rootfs() + config.setup_final() + config.start_qemu() + finally: + config.cleanup() + return 0 + +if __name__ == "__main__": + try: + ret = main() + except OEPathError as err: + ret = 1 + logger.error(err.message) + except Exception as esc: + ret = 1 + import traceback + traceback.print_exc() + sys.exit(ret) diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs index bbdaf5ba0f..c7992d8223 100755 --- a/scripts/runqemu-export-rootfs +++ b/scripts/runqemu-export-rootfs @@ -44,10 +44,10 @@ if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then echo "Did you forget to source your build environment setup script?" exit 1 fi -. $SYSROOT_SETUP_SCRIPT +. $SYSROOT_SETUP_SCRIPT meta-ide-support -if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd" ]; then - echo "Error: Unable to find rpc.mountd binary in $OECORE_NATIVE_SYSROOT/usr/sbin/" +if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/unfsd" ]; then + echo "Error: Unable to find unfsd binary in $OECORE_NATIVE_SYSROOT/usr/bin/" if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then echo "Have you run 'bitbake meta-ide-support'?" @@ -78,24 +78,17 @@ if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then fi # rpc.mountd RPC port -NFS_MOUNTPROG=$[ 21111 + $NFS_INSTANCE ] +MOUNTD_RPCPORT=${MOUNTD_RPCPORT:=$[ 21111 + $NFS_INSTANCE ]} # rpc.nfsd RPC port -NFS_NFSPROG=$[ 11111 + $NFS_INSTANCE ] -# NFS port number -NFS_PORT=$[ 3049 + 2 * $NFS_INSTANCE ] +NFSD_RPCPORT=${NFSD_RPCPORT:=$[ 11111 + $NFS_INSTANCE ]} +# NFS server port number +NFSD_PORT=${NFSD_PORT:=$[ 3049 + 2 * $NFS_INSTANCE ]} # mountd port number -MOUNT_PORT=$[ 3048 + 2 * $NFS_INSTANCE ] +MOUNTD_PORT=${MOUNTD_PORT:=$[ 3048 + 2 * $NFS_INSTANCE ]} ## For debugging you would additionally add ## --debug all -MOUNTD_OPTS="--allow-non-root --mount-pid $MOUNTPID -f $EXPORTS --rmtab $RMTAB --prog $NFS_MOUNTPROG -r -P $MOUNT_PORT" -NFSD_OPTS="--allow-non-root --nfs-pid $NFSPID -f $EXPORTS --prog $NFS_NFSPROG -P $NFS_PORT -r" - -# Setup the exports file -if [ "$1" = "start" ]; then - echo "Creating exports file..." - echo "$NFS_EXPORT_DIR (rw,async,no_root_squash,no_all_squash,insecure)" > $EXPORTS -fi +UNFSD_OPTS="-p -N -i $NFSPID -e $EXPORTS -x $NFSD_RPCPORT -n $NFSD_PORT -y $MOUNTD_RPCPORT -m $MOUNTD_PORT" # See how we were called. case "$1" in @@ -115,53 +108,21 @@ case "$1" in exit 1 fi - echo "Starting User Mode rpc.mountd" - echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS" - $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS - if [ ! $? = 0 ]; then - echo "=====================" - echo "Error starting MOUNTD" - echo "=====================" - if [ ! "x$RPCBIND_RUNNING" = "x" ] ; then - echo " If you see an error above that says:" - echo " RPC: Authentication error; why = Client credential too weak" - echo " You need to add the -i option when running rpcbind" - echo "===============================================" - echo "For recent Fedora/RedHat hosts:" - echo "Add RPCBIND_ARGS=-i to /etc/sysconfig/rpcbind" - echo " or" - echo "Add RPCBIND_OPTIONS=-i to /etc/sysconfig/rpcbind" - echo "Then run as root: /etc/init.d/rpcbind restart" - echo "===============================================" - echo "For recent Debian/Ubuntu hosts:" - echo "Add OPTIONS=\"-i -w\" to /etc/default/rpcbind" - echo "sudo service portmap restart" - fi - - exit 1 - fi + echo "Creating exports file..." + echo "$NFS_EXPORT_DIR (rw,no_root_squash,no_all_squash,insecure)" > $EXPORTS echo "Starting User Mode nfsd" - echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS" - $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS + echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS" + $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS if [ ! $? = 0 ]; then echo "Error starting nfsd" exit 1 fi # Check to make sure everything started ok. - if [ ! -f $MOUNTPID ]; then - echo "rpc.mountd did not start correctly" - exit 1 - fi if [ ! -f $NFSPID ]; then echo "rpc.nfsd did not start correctly" exit 1 fi - ps -fp `cat $MOUNTPID` > /dev/null 2> /dev/null - if [ ! $? = 0 ]; then - echo "rpc.mountd did not start correctly" - exit 1 - fi ps -fp `cat $NFSPID` > /dev/null 2> /dev/null if [ ! $? = 0 ]; then echo "rpc.nfsd did not start correctly" @@ -169,16 +130,9 @@ case "$1" in fi echo " " echo "On your target please remember to add the following options for NFS" - echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=2,mountprog=$NFS_MOUNTPROG,nfsprog=$NFS_NFSPROG,udp" + echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT" ;; stop) - if [ -f "$MOUNTPID" ]; then - echo "Stopping rpc.mountd" - kill `cat $MOUNTPID` - rm -f $MOUNTPID - else - echo "No PID file, not stopping rpc.mountd" - fi if [ -f "$NFSPID" ]; then echo "Stopping rpc.nfsd" kill `cat $NFSPID` diff --git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk index 509af66216..2a0dd50e0e 100755 --- a/scripts/runqemu-extract-sdk +++ b/scripts/runqemu-extract-sdk @@ -35,7 +35,7 @@ if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then echo "Did you forget to source your build system environment setup script?" exit 1 fi -. $SYSROOT_SETUP_SCRIPT +. $SYSROOT_SETUP_SCRIPT meta-ide-support PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr" ROOTFS_TARBALL=$1 @@ -49,18 +49,18 @@ fi # Convert SDK_ROOTFS_DIR to a full pathname if [[ ${SDK_ROOTFS_DIR:0:1} != "/" ]]; then - SDK_ROOTFS_DIR=$(pwd)/$SDK_ROOTFS_DIR + SDK_ROOTFS_DIR=$(readlink -f $(pwd)/$SDK_ROOTFS_DIR) fi TAR_OPTS="" if [[ "$ROOTFS_TARBALL" =~ tar\.bz2$ ]]; then - TAR_OPTS="-xjf" + TAR_OPTS="--numeric-owner -xjf" fi if [[ "$ROOTFS_TARBALL" =~ tar\.gz$ ]]; then - TAR_OPTS="-xzf" + TAR_OPTS="--numeric-owner -xzf" fi if [[ "$ROOTFS_TARBALL" =~ \.tar$ ]]; then - TAR_OPTS="-xf" + TAR_OPTS="--numeric-owner -xf" fi if [ -z "$TAR_OPTS" ]; then echo "Error: Unable to determine sdk tarball format" @@ -74,6 +74,7 @@ if [ ! -d "$SDK_ROOTFS_DIR" ]; then fi pseudo_state_dir="$SDK_ROOTFS_DIR/../$(basename "$SDK_ROOTFS_DIR").pseudo_state" +pseudo_state_dir="$(readlink -f $pseudo_state_dir)" if [ -e "$pseudo_state_dir" ]; then echo "Error: $pseudo_state_dir already exists!" diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs index d3b27be291..11de318c1a 100755 --- a/scripts/runqemu-gen-tapdevs +++ b/scripts/runqemu-gen-tapdevs @@ -23,11 +23,13 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. usage() { - echo "Usage: sudo $0 <uid> <gid> <num> <native-sysroot-basedir>" + echo "Usage: sudo $0 <uid> <gid> <num> <staging_bindir_native>" echo "Where <uid> is the numeric user id the tap devices will be owned by" echo "Where <gid> is the numeric group id the tap devices will be owned by" echo "<num> is the number of tap devices to create (0 to remove all)" echo "<native-sysroot-basedir> is the path to the build system's native sysroot" + echo "e.g. $ bitbake qemu-helper-native" + echo "$ sudo $0 1000 1000 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin" exit 1 } @@ -44,9 +46,9 @@ fi TUID=$1 GID=$2 COUNT=$3 -SYSROOT=$4 +STAGING_BINDIR_NATIVE=$4 -TUNCTL=$SYSROOT/usr/bin/tunctl +TUNCTL=$STAGING_BINDIR_NATIVE/tunctl if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then echo "Error: $TUNCTL is not an executable" usage @@ -69,23 +71,38 @@ if [ ! -x "$IFCONFIG" ]; then exit 1 fi -# Ensure we start with a clean slate -for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do - echo "Note: Destroying pre-existing tap interface $tap..." - $TUNCTL -d $tap -done +if [ $COUNT -ge 0 ]; then + # Ensure we start with a clean slate + for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do + echo "Note: Destroying pre-existing tap interface $tap..." + $TUNCTL -d $tap + done + rm -f /etc/runqemu-nosudo +else + echo "Error: Incorrect count: $COUNT" + exit 1 +fi -echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." -for ((index=0; index < $COUNT; index++)); do - echo "Creating tap$index" - ifup=`$RUNQEMU_IFUP $TUID $GID $SYSROOT 2>&1` - if [ $? -ne 0 ]; then - echo "Error running tunctl: $ifup" - exit 1 - fi -done +if [ $COUNT -gt 0 ]; then + echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." + for ((index=0; index < $COUNT; index++)); do + echo "Creating tap$index" + ifup=`$RUNQEMU_IFUP $TUID $GID $STAGING_BINDIR_NATIVE 2>&1` + if [ $? -ne 0 ]; then + echo "Error running tunctl: $ifup" + exit 1 + fi + done -# The runqemu script will check for this file, and if it exists, -# will use the existing bank of tap devices without creating -# additional ones via sudo. -touch /etc/runqemu-nosudo + echo "Note: For systems running NetworkManager, it's recommended" + echo "Note: that the tap devices be set as unmanaged in the" + echo "Note: NetworkManager.conf file. Add the following lines to" + echo "Note: /etc/NetworkManager/NetworkManager.conf" + echo "[keyfile]" + echo "unmanaged-devices=interface-name:tap*" + + # The runqemu script will check for this file, and if it exists, + # will use the existing bank of tap devices without creating + # additional ones via sudo. + touch /etc/runqemu-nosudo +fi diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown index 8b8c5a4a7a..ffbc9de442 100755 --- a/scripts/runqemu-ifdown +++ b/scripts/runqemu-ifdown @@ -41,12 +41,26 @@ if [ $# -ne 2 ]; then fi TAP=$1 -NATIVE_SYSROOT_DIR=$2 +STAGING_BINDIR_NATIVE=$2 -TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl +TUNCTL=$STAGING_BINDIR_NATIVE/tunctl if [ ! -e "$TUNCTL" ]; then - echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin', please bitbake qemu-helper-native" + echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native" exit 1 fi $TUNCTL -d $TAP + +# cleanup the remaining iptables rules +IPTABLES=`which iptables 2> /dev/null` +if [ "x$IPTABLES" = "x" ]; then + IPTABLES=/sbin/iptables +fi +if [ ! -x "$IPTABLES" ]; then + echo "$IPTABLES cannot be executed" + exit 1 +fi +n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] +dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] +$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 +$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32 diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup index b5a3db964b..59a15eaa2e 100755 --- a/scripts/runqemu-ifup +++ b/scripts/runqemu-ifup @@ -49,11 +49,11 @@ fi USERID="-u $1" GROUP="-g $2" -NATIVE_SYSROOT_DIR=$3 +STAGING_BINDIR_NATIVE=$3 -TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl +TUNCTL=$STAGING_BINDIR_NATIVE/tunctl if [ ! -x "$TUNCTL" ]; then - echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin', please bitbake qemu-helper-native" + echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native" exit 1 fi @@ -91,10 +91,25 @@ fi n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] $IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP +STATUS=$? +if [ $STATUS -ne 0 ]; then + echo "Failed to set up IP addressing on $TAP" + exit 1 +fi $IFCONFIG link set dev $TAP up +STATUS=$? +if [ $STATUS -ne 0 ]; then + echo "Failed to bring up $TAP" + exit 1 +fi dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] $IFCONFIG route add to 192.168.7.$dest dev $TAP +STATUS=$? +if [ $STATUS -ne 0 ]; then + echo "Failed to add route to 192.168.7.$dest using $TAP" + exit 1 +fi # setup NAT for tap0 interface to have internet access in QEMU $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal deleted file mode 100755 index 8a6e551abc..0000000000 --- a/scripts/runqemu-internal +++ /dev/null @@ -1,631 +0,0 @@ -#!/bin/bash -x - -# Handle running OE images under qemu -# -# Copyright (C) 2006-2011 Linux Foundation -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Call setting: -# QEMU_MEMORY (optional) - set the amount of memory in the emualted system. -# SERIAL_LOGFILE (optional) - log the serial port output to a file -# -# Image options: -# MACHINE - the machine to run -# FSTYPE - the image type to run -# KERNEL - the kernel image file to use -# ROOTFS - the disk image file to use -# - - -mem_size=-1 - -#Get rid of <> and get the contents of extra qemu running params -SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/<//' -e 's/>//'` -#if user set qemu memory, eg: -m 256 in qemu extra params, we need to do some -# validation check -mem_set=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-m[[:space:]] *[0-9]*\)'` -if [ ! -z "$mem_set" ] ; then -#Get memory setting size from user input - mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'` -else - case "$MACHINE" in - "qemux86") - mem_size=128 - ;; - "qemux86-64") - mem_size=128 - ;; - "qemuarm") - mem_size=128 - ;; - "qemumicroblaze") - mem_size=64 - ;; - "qemumips"|"qemumips64") - mem_size=128 - ;; - "qemuppc") - mem_size=128 - ;; - "qemush4") - mem_size=1024 - ;; - "qemuzynq") - mem_size=1024 - ;; - *) - mem_size=64 - ;; - esac - -fi - -# QEMU_MEMORY has 'M' appended to mem_size -QEMU_MEMORY="$mem_size"M - -# Bug 433: qemuarm cannot use > 256 MB RAM -if [ "$MACHINE" = "qemuarm" ]; then - if [ -z "$mem_size" -o $mem_size -gt 256 ]; then - echo "WARNING: qemuarm does not support > 256M of RAM." - echo "Changing QEMU_MEMORY to default of 256M." - QEMU_MEMORY="256M" - mem_size="256" - SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e "s/$mem_set/-m 256/" ` - fi -fi - -# We need to specify -m <mem_size> to overcome a bug in qemu 0.14.0 -# https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/584480 - -if [ -z "$mem_set" ] ; then - SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -m $mem_size" -fi -# This file is created when runqemu-gen-tapdevs creates a bank of tap -# devices, indicating that the user should not bring up new ones using -# sudo. -NOSUDO_FLAG="/etc/runqemu-nosudo" - -QEMUIFUP=`which runqemu-ifup 2> /dev/null` -QEMUIFDOWN=`which runqemu-ifdown 2> /dev/null` -if [ -z "$QEMUIFUP" -o ! -x "$QEMUIFUP" ]; then - echo "runqemu-ifup cannot be found or executed" - exit 1 -fi -if [ -z "$QEMUIFDOWN" -o ! -x "$QEMUIFDOWN" ]; then - echo "runqemu-ifdown cannot be found or executed" - exit 1 -fi - -NFSRUNNING="false" - -#capture original stty values -ORIG_STTY=$(stty -g) - -if [ "$SLIRP_ENABLED" = "yes" ]; then - KERNEL_NETWORK_CMD="" - QEMU_TAP_CMD="" - QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" - if [ "$KVM_ACTIVE" = "yes" ]; then - QEMU_NETWORK_CMD="" - DROOT="/dev/vda" - ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio" - else - QEMU_NETWORK_CMD="" - DROOT="/dev/hda" - ROOTFS_OPTIONS="-hda $ROOTFS" - fi - -else - acquire_lock() { - lockfile=$1 - if [ -z "$lockfile" ]; then - echo "Error: missing lockfile arg passed to acquire_lock()" - return 1 - fi - - touch $lockfile.lock - exec 8>$lockfile.lock - flock -n -x 8 - if [ $? -ne 0 ]; then - exec 8>&- - return 1 - fi - - return 0 - } - - release_lock() { - lockfile=$1 - if [ -z "$lockfile" ]; then - echo "Error: missing lockfile arg passed to release_lock()" - return 1 - fi - - rm -f $lockfile.lock - exec 8>&- - } - - LOCKDIR="/tmp/qemu-tap-locks" - if [ ! -d "$LOCKDIR" ]; then - mkdir $LOCKDIR - chmod 777 $LOCKDIR - fi - - IFCONFIG=`which ip 2> /dev/null` - if [ -z "$IFCONFIG" ]; then - IFCONFIG=/sbin/ip - fi - if [ ! -x "$IFCONFIG" ]; then - echo "$IFCONFIG cannot be executed" - exit 1 - fi - - POSSIBLE=`$IFCONFIG link | grep 'tap' | awk '{print $2}' | sed s/://` - TAP="" - LOCKFILE="" - for tap in $POSSIBLE; do - LOCKFILE="$LOCKDIR/$tap" - echo "Acquiring lockfile for $tap..." - acquire_lock $LOCKFILE - if [ $? -eq 0 ]; then - TAP=$tap - break - fi - done - - if [ "$TAP" = "" ]; then - if [ -e "$NOSUDO_FLAG" ]; then - echo "Error: There are no available tap devices to use for networking," - echo "and I see $NOSUDO_FLAG exists, so I am not going to try creating" - echo "a new one with sudo." - exit 1 - fi - - GROUPID=`id -g` - USERID=`id -u` - echo "Setting up tap interface under sudo" - # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded - # but inactive. This looks scary but is harmless - tap=`sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT 2> /dev/null` - if [ $? -ne 0 ]; then - # Re-run standalone to see verbose errors - sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT - return 1 - fi - LOCKFILE="$LOCKDIR/$tap" - echo "Acquiring lockfile for $tap..." - acquire_lock $LOCKFILE - if [ $? -eq 0 ]; then - TAP=$tap - fi - else - echo "Using preconfigured tap device '$TAP'" - fi - - cleanup() { - if [ ! -e "$NOSUDO_FLAG" ]; then - # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded - # but inactive. This looks scary but is harmless - sudo $QEMUIFDOWN $TAP $OECORE_NATIVE_SYSROOT 2> /dev/null - fi - echo "Releasing lockfile of preconfigured tap device '$TAP'" - release_lock $LOCKFILE - - if [ "$NFSRUNNING" = "true" ]; then - echo "Shutting down the userspace NFS server..." - echo "runqemu-export-rootfs stop $ROOTFS" - runqemu-export-rootfs stop $ROOTFS - fi - # If QEMU crashes or somehow tty properties are not restored - # after qemu exits, we need to run stty sane - #stty sane - - #instead of using stty sane we set the original stty values - stty ${ORIG_STTY} - - } - - - n0=$(echo $TAP | sed 's/tap//') - n1=$(($n0 * 2 + 1)) - n2=$(($n1 + 1)) - - KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0" - QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" - if [ "$KVM_ACTIVE" = "yes" ]; then - QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD,vhost=on" - DROOT="/dev/vda" - ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio" - else - QEMU_NETWORK_CMD="-net nic,vlan=0 $QEMU_TAP_CMD" - DROOT="/dev/hda" - ROOTFS_OPTIONS="-hda $ROOTFS" - fi - KERNCMDLINE="mem=$QEMU_MEMORY" - QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" - - NFS_INSTANCE=`echo $TAP | sed 's/tap//'` - export NFS_INSTANCE - - SERIALOPTS="" - if [ "x$SERIAL_LOGFILE" != "x" ]; then - SERIALOPTS="-serial file:$SERIAL_LOGFILE" - fi -fi - -case "$MACHINE" in - "qemuarm") ;; - "qemumicroblaze") ;; - "qemumips") ;; - "qemumipsel") ;; - "qemumips64") ;; - "qemush4") ;; - "qemuppc") ;; - "qemuarmv6") ;; - "qemuarmv7") ;; - "qemux86") ;; - "qemux86-64") ;; - "qemuzynq") ;; - "akita") ;; - "spitz") ;; - *) - echo "Error: Unsupported machine type $MACHINE" - return 1 - ;; -esac - -if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then - echo "Error: Kernel image file $KERNEL doesn't exist" - cleanup - return 1 -fi - -if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a ! -f "$ROOTFS" ]; then - echo "Error: Image file $ROOTFS doesn't exist" - cleanup - return 1 -fi - -if [ "$FSTYPE" = "nfs" ]; then - NFS_SERVER="192.168.7.1" - NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'` - MOUNTD_RPCPORT=$[ 21111 + $NFS_INSTANCE ] - NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ] - NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ] - MOUNTD_PORT=$[ 3048 + 2 * $NFS_INSTANCE ] - UNFS_OPTS="nfsvers=2,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,port=$NFSD_PORT,mountport=$MOUNTD_PORT" - - PSEUDO_LOCALSTATEDIR=~/.runqemu-sdk/pseudo - export PSEUDO_LOCALSTATEDIR - - # Start the userspace NFS server - echo "runqemu-export-rootfs restart $ROOTFS" - runqemu-export-rootfs restart $ROOTFS - if [ $? != 0 ]; then - cleanup - return 1 - fi - NFSRUNNING="true" -fi - -if [ "$NFS_SERVER" = "" ]; then - NFS_SERVER="192.168.7.1" - NFS_DIR=$ROOTFS -fi - -if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" ]; then - QEMU=qemu-system-arm - MACHINE_SUBTYPE=versatilepb - export QEMU_AUDIO_DRV="none" - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" - # QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer" - if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then - KERNCMDLINE="root=/dev/sda rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off" - QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS" - fi - if [ "$FSTYPE" = "nfs" ]; then - if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then - echo "Error: NFS mount point $ROOTFS doesn't exist" - cleanup - return 1 - fi - KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} --no-reboot $QEMU_UI_OPTIONS" - fi - if [ "$MACHINE" = "qemuarmv6" ]; then - QEMUOPTIONS="$QEMUOPTIONS -cpu arm1136" - fi - if [ "$MACHINE" = "qemuarmv7" ]; then - QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8" - fi -fi - -if [ "$MACHINE" = "qemux86" ]; then - QEMU=qemu-system-i386 - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware" - if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then - KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" - QEMUOPTIONS="$QEMU_NETWORK_CMD $ROOTFS_OPTIONS $QEMU_UI_OPTIONS" - fi - if [ "$FSTYPE" = "nfs" ]; then - if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then - echo "Error: NFS mount point $ROOTFS doesn't exist." - cleanup - return 1 - fi - KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" - fi - if [ "$FSTYPE" = "vmdk" ]; then - QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" - fi - # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in - # qemux86 and qemux86-64. We can use timer interrupt mode for now. - KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" -fi - -if [ "$MACHINE" = "qemux86-64" ]; then - QEMU=qemu-system-x86_64 - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware" - if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then - KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" - QEMUOPTIONS="$QEMU_NETWORK_CMD $ROOTFS_OPTIONS $QEMU_UI_OPTIONS" - fi - if [ "$FSTYPE" = "nfs" ]; then - if [ "x$ROOTFS" = "x" ]; then - ROOTFS=/srv/nfs/qemux86-64 - fi - if [ ! -d "$ROOTFS" ]; then - echo "Error: NFS mount point $ROOTFS doesn't exist." - cleanup - return 1 - fi - KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" - fi - if [ "$FSTYPE" = "vmdk" ]; then - QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" - fi - # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in - # qemux86 and qemux86-64. We can use timer interrupt mode for now. - KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" -fi - -if [ "$MACHINE" = "spitz" ]; then - QEMU=qemu-system-arm - if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then - echo $ROOTFS - ROOTFS=`readlink -f $ROOTFS` - echo $ROOTFS - if [ ! -e "$ROOTFS.qemudisk" ]; then - echo "Adding a partition table to the ext3 image for use by QEMU, please wait..." - runqemu-addptable2image $ROOTFS $ROOTFS.qemudisk - fi - QEMUOPTIONS="$QEMU_NETWORK_CMD -M spitz -hda $ROOTFS.qemudisk -portrait" - fi -fi - -if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemumips64" ]; then - case "$MACHINE" in - qemumips) QEMU=qemu-system-mips ;; - qemumipsel) QEMU=qemu-system-mipsel ;; - qemumips64) QEMU=qemu-system-mips64 ;; - esac - MACHINE_SUBTYPE=malta - QEMU_UI_OPTIONS="-vga cirrus $QEMU_UI_OPTIONS" - if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then - #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS" - fi - if [ "$FSTYPE" = "nfs" ]; then - if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then - echo "Error: NFS mount point $ROOTFS doesn't exist" - cleanup - return 1 - fi - KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" - fi -fi - -if [ "$MACHINE" = "qemuppc" ]; then - QEMU=qemu-system-ppc - MACHINE_SUBTYPE=mac99 - CPU_SUBTYPE=G4 - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" - if [ "$SLIRP_ENABLED" = "yes" ]; then - QEMU_NETWORK_CMD="" - else - QEMU_NETWORK_CMD="-net nic,model=pcnet $QEMU_TAP_CMD" - fi - if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then - KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS" - fi - if [ "$FSTYPE" = "nfs" ]; then - if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then - echo "Error: NFS mount point $ROOTFS doesn't exist" - cleanup - return 1 - fi - KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" - fi -fi - -if [ "$MACHINE" = "qemush4" ]; then - QEMU=qemu-system-sh4 - MACHINE_SUBTYPE=r2d - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" - if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then - #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - KERNCMDLINE="root=/dev/hda rw console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio" - SERIALSTDIO="1" - fi - if [ "$FSTYPE" = "nfs" ]; then - if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then - echo "Error: NFS mount point $ROOTFS doesn't exist" - cleanup - return 1 - fi - KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" - QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio" - SERIALSTDIO="1" - fi -fi - -if [ "$MACHINE" = "akita" ]; then - QEMU=qemu-system-arm - if [ "$FSTYPE" = "jffs2" ]; then - ROOTFS=`readlink -f $ROOTFS` - if [ ! -e "$ROOTFS.qemuflash" ]; then - echo "Converting raw image into flash image format for use by QEMU, please wait..." - raw2flash.akita < $ROOTFS > $ROOTFS.qemuflash - fi - QEMUOPTIONS="$QEMU_NETWORK_CMD -M akita -mtdblock $ROOTFS.qemuflash -portrait" - fi -fi - -if [ "$MACHINE" = "qemumicroblaze" ]; then - QEMU=qemu-system-microblazeel - QEMU_SYSTEM_OPTIONS="-M petalogix-ml605 -serial mon:stdio -dtb $KERNEL-$MACHINE.dtb" - if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then - KERNCMDLINE="earlyprintk root=/dev/ram rw" - QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS" - fi -fi - -if [ "$MACHINE" = "qemuzynq" ]; then - QEMU=qemu-system-arm - QEMU_SYSTEM_OPTIONS="-M xilinx-zynq-a9 -serial null -serial mon:stdio -dtb $KERNEL-$MACHINE.dtb" - # zynq serial ports are named 'ttyPS0' and 'ttyPS1', fixup the default values - SCRIPT_KERNEL_OPT=$(echo "$SCRIPT_KERNEL_OPT" | sed 's/console=ttyS/console=ttyPS/g') - if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then - KERNCMDLINE="earlyprintk root=/dev/ram rw" - QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS" - fi -fi - -if [ "x$RAMFS" = "xtrue" ]; then - QEMUOPTIONS="-initrd $ROOTFS -nographic" - KERNCMDLINE="root=/dev/ram0 debugshell" -fi - -if [ "x$ISOFS" = "xtrue" ]; then - QEMUOPTIONS="$QEMU_NETWORK_CMD -cdrom $ROOTFS $QEMU_UI_OPTIONS" -fi - -if [ "x$QEMUOPTIONS" = "x" ]; then - echo "Error: Unable to support this combination of options" - cleanup - return 1 -fi - -PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$PATH - -QEMUBIN=`which $QEMU 2> /dev/null` -if [ ! -x "$QEMUBIN" ]; then - echo "Error: No QEMU binary '$QEMU' could be found." - cleanup - return 1 -fi - -NEED_GL=`ldd $QEMUBIN/$QEMU 2>&1 | grep libGLU` -# We can't run without a libGL.so -if [ "$NEED_GL" != "" ]; then - libgl='no' - - [ -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so ] && libgl='yes' - [ -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so ] && libgl='yes' - [ -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so ] && libgl='yes' - - if [ "$libgl" != 'yes' ]; then - echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator. - Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev. - Fedora package names are: mesa-libGL-devel mesa-libGLU-devel." - return 1; - fi -fi - -do_quit() { - cleanup - return 1 -} - -trap do_quit INT TERM QUIT - -# qemu got segfault if linked with nVidia's libgl -GL_LD_PRELOAD=$LD_PRELOAD - -if ldd $QEMUBIN | grep -i nvidia &> /dev/null -then -cat << EOM -WARNING: nVidia proprietary OpenGL libraries detected. -nVidia's OpenGL libraries are known to have compatibility issues with qemu, -resulting in a segfault. Please uninstall these drivers or ensure the mesa libGL -libraries precede nvidia's via LD_PRELOAD(Already do it on Ubuntu 10). -EOM - -# Automatically use Ubuntu system's mesa libGL, other distro can add its own path -if grep -i ubuntu /etc/lsb-release &> /dev/null -then - # precede nvidia's driver on Ubuntu 10 - UBUNTU_MAIN_VERSION=`cat /etc/lsb-release |grep DISTRIB_RELEASE |cut -d= -f 2| cut -d. -f 1` - if [ "$UBUNTU_MAIN_VERSION" = "10" ]; - then - GL_PATH="" - if test -e /usr/lib/libGL.so - then - GL_PATH="/usr/lib/libGL.so" - elif test -e /usr/lib/x86_64-linux-gnu/libGL.so - then - GL_PATH="/usr/lib/x86_64-linux-gnu/libGL.so" - fi - - echo "Skip nVidia's libGL on Ubuntu 10!" - GL_LD_PRELOAD="$GL_PATH $LD_PRELOAD" - fi -fi -fi - -if [ "x$SERIALSTDIO" = "x1" ]; then - echo "Interrupt character is '^]'" - stty intr ^] -fi - -echo "Running $QEMU..." -# -no-reboot is a mandatory option - see bug #100 -if [ "$FSTYPE" = "vmdk" ]; then - echo $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT - LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT -elif [ "$FSTYPE" = "iso" ]; then - echo $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT - LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT -else - echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SLIRP_CMD $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' - LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" -fi -ret=$? -if [ "$SLIRP_ENABLED" != "yes" ]; then - cleanup -fi - -#set the original stty values before exit -stty ${ORIG_STTY} -trap - INT TERM QUIT - -return $ret diff --git a/scripts/send-error-report b/scripts/send-error-report new file mode 100755 index 0000000000..15b5e84911 --- /dev/null +++ b/scripts/send-error-report @@ -0,0 +1,200 @@ +#!/usr/bin/env python3 + +# Sends an error report (if the report-error class was enabled) to a +# remote server. +# +# Copyright (C) 2013 Intel Corporation +# Author: Andreea Proca <andreea.b.proca@intel.com> +# Author: Michael Wood <michael.g.wood@intel.com> + +import urllib.request, urllib.error +import sys +import json +import os +import subprocess +import argparse +import logging + +scripts_lib_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib') +sys.path.insert(0, scripts_lib_path) +import argparse_oe + +version = "0.3" + +log = logging.getLogger("send-error-report") +logging.basicConfig(format='%(levelname)s: %(message)s') + +def getPayloadLimit(url): + req = urllib.request.Request(url, None) + try: + response = urllib.request.urlopen(req) + except urllib.error.URLError as e: + # Use this opportunity to bail out if we can't even contact the server + log.error("Could not contact server: " + url) + log.error(e.reason) + sys.exit(1) + try: + ret = json.loads(response.read()) + max_log_size = ret.get('max_log_size', 0) + return int(max_log_size) + except: + pass + + return 0 + +def ask_for_contactdetails(): + print("Please enter your name and your email (optionally), they'll be saved in the file you send.") + username = input("Name (required): ") + email = input("E-mail (not required): ") + return username, email + +def edit_content(json_file_path): + edit = input("Review information before sending? (y/n): ") + if 'y' in edit or 'Y' in edit: + editor = os.environ.get('EDITOR', None) + if editor: + subprocess.check_call([editor, json_file_path]) + else: + log.error("Please set your EDITOR value") + sys.exit(1) + return True + return False + +def prepare_data(args): + # attempt to get the max_log_size from the server's settings + max_log_size = getPayloadLimit("http://"+args.server+"/ClientPost/JSON") + + if not os.path.isfile(args.error_file): + log.error("No data file found.") + sys.exit(1) + + home = os.path.expanduser("~") + userfile = os.path.join(home, ".oe-send-error") + + try: + with open(userfile, 'r') as userfile_fp: + if len(args.name) == 0: + args.name = userfile_fp.readline() + else: + #use empty readline to increment the fp + userfile_fp.readline() + + if len(args.email) == 0: + args.email = userfile_fp.readline() + except: + pass + + if args.assume_yes == True and len(args.name) == 0: + log.error("Name needs to be provided either via "+userfile+" or as an argument (-n).") + sys.exit(1) + + while len(args.name) <= 0 and len(args.name) < 50: + print("\nName needs to be given and must not more than 50 characters.") + args.name, args.email = ask_for_contactdetails() + + with open(userfile, 'w') as userfile_fp: + userfile_fp.write(args.name.strip() + "\n") + userfile_fp.write(args.email.strip() + "\n") + + with open(args.error_file, 'r') as json_fp: + data = json_fp.read() + + jsondata = json.loads(data) + jsondata['username'] = args.name.strip() + jsondata['email'] = args.email.strip() + jsondata['link_back'] = args.link_back.strip() + # If we got a max_log_size then use this to truncate to get the last + # max_log_size bytes from the end + if max_log_size != 0: + for fail in jsondata['failures']: + if len(fail['log']) > max_log_size: + print("Truncating log to allow for upload") + fail['log'] = fail['log'][-max_log_size:] + + data = json.dumps(jsondata, indent=4, sort_keys=True) + + # Write back the result which will contain all fields filled in and + # any post processing done on the log data + with open(args.error_file, "w") as json_fp: + if data: + json_fp.write(data) + + + if args.assume_yes == False and edit_content(args.error_file): + #We'll need to re-read the content if we edited it + with open(args.error_file, 'r') as json_fp: + data = json_fp.read() + + return data.encode('utf-8') + + +def send_data(data, args): + headers={'Content-type': 'application/json', 'User-Agent': "send-error-report/"+version} + + if args.json: + url = "http://"+args.server+"/ClientPost/JSON/" + else: + url = "http://"+args.server+"/ClientPost/" + + req = urllib.request.Request(url, data=data, headers=headers) + try: + response = urllib.request.urlopen(req) + except urllib.error.HTTPError as e: + logging.error(e.reason) + sys.exit(1) + + print(response.read()) + + +if __name__ == '__main__': + arg_parse = argparse_oe.ArgumentParser(description="This scripts will send an error report to your specified error-report-web server.") + + arg_parse.add_argument("error_file", + help="Generated error report file location", + type=str) + + arg_parse.add_argument("-y", + "--assume-yes", + help="Assume yes to all queries and do not prompt", + action="store_true") + + arg_parse.add_argument("-s", + "--server", + help="Server to send error report to", + type=str, + default="errors.yoctoproject.org") + + arg_parse.add_argument("-e", + "--email", + help="Email address to be used for contact", + type=str, + default="") + + arg_parse.add_argument("-n", + "--name", + help="Submitter name used to identify your error report", + type=str, + default="") + + arg_parse.add_argument("-l", + "--link-back", + help="A url to link back to this build from the error report server", + type=str, + default="") + + arg_parse.add_argument("-j", + "--json", + help="Return the result in json format, silences all other output", + action="store_true") + + + + args = arg_parse.parse_args() + + if (args.json == False): + print("Preparing to send errors to: "+args.server) + + data = prepare_data(args) + send_data(data, args) + + sys.exit(0) diff --git a/scripts/send-pull-request b/scripts/send-pull-request index 575549db38..883deacb07 100755 --- a/scripts/send-pull-request +++ b/scripts/send-pull-request @@ -158,11 +158,16 @@ GIT_EXTRA_CC=$(for R in $EXTRA_CC; do echo -n "--cc='$R' "; done) unset IFS # Handoff to git-send-email. It will perform the send confirmation. +# Mail threading was already handled by git-format-patch in +# create-pull-request, so we must not allow git-send-email to +# add In-Reply-To and References headers again. PATCHES=$(echo $PDIR/*.patch) if [ $AUTO_CL -eq 1 ]; then # Send the cover letter to every recipient, both specified as well as # harvested. Then remove it from the patches list. - eval "git send-email $GIT_TO $GIT_CC $GIT_EXTRA_CC --confirm=always --no-chain-reply-to --suppress-cc=all $CL" + # --no-thread is redundant here (only sending a single message) and + # merely added for the sake of consistency. + eval "git send-email $GIT_TO $GIT_CC $GIT_EXTRA_CC --confirm=always --no-thread --suppress-cc=all $CL" if [ $? -eq 1 ]; then echo "ERROR: failed to send cover-letter with automatic recipients." exit 1 @@ -172,7 +177,7 @@ fi # Send the patch to the specified recipients and, if -c was specified, those git # finds in this specific patch. -eval "git send-email $GIT_TO $GIT_EXTRA_CC --confirm=always --no-chain-reply-to $GITSOBCC $PATCHES" +eval "git send-email $GIT_TO $GIT_EXTRA_CC --confirm=always --no-thread $GITSOBCC $PATCHES" if [ $? -eq 1 ]; then echo "ERROR: failed to send patches." exit 1 diff --git a/scripts/sstate-cache-management.sh b/scripts/sstate-cache-management.sh index e2baf17d21..2ab450ab59 100755 --- a/scripts/sstate-cache-management.sh +++ b/scripts/sstate-cache-management.sh @@ -37,13 +37,19 @@ Options: Specify sstate cache directory, will use the environment variable SSTATE_CACHE_DIR if it is not specified. + --extra-archs=<arch1>,<arch2>...<archn> + Specify list of architectures which should be tested, this list + will be extended with native arch, allarch and empty arch. The + script won't be trying to generate list of available archs from + AVAILTUNES in tune files. + --extra-layer=<layer1>,<layer2>...<layern> Specify the layer which will be used for searching the archs, it will search the meta and meta-* layers in the top dir by default, and will search meta, meta-*, <layer1>, <layer2>, ...<layern> when specified. Use "," as the separator. - This is useless for --stamps-dir. + This is useless for --stamps-dir or when --extra-archs is used. -d, --remove-duplicated Remove the duplicated sstate cache files of one package, only @@ -63,17 +69,17 @@ Options: Conflicts with --remove-duplicated. -L, --follow-symlink - Rmove both the symbol link and the destination file, default: no. + Remove both the symbol link and the destination file, default: no. -y, --yes Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. -v, --verbose - explain what is being done + Explain what is being done. -D, --debug - show debug info, repeat for more debug info + Show debug info, repeat for more debug info. EOF } @@ -95,13 +101,13 @@ do_nothing () { # Read the input "y" read_confirm () { - echo -n "$total_deleted files will be removed! " + echo "$total_deleted out of $total_files files will be removed! " if [ "$confirm" != "y" ]; then - echo -n "Do you want to continue (y/n)? " + echo "Do you want to continue (y/n)? " while read confirm; do [ "$confirm" = "Y" -o "$confirm" = "y" -o "$confirm" = "n" \ -o "$confirm" = "N" ] && break - echo -n "Invalid input \"$confirm\", please input 'y' or 'n': " + echo "Invalid input \"$confirm\", please input 'y' or 'n': " done else echo @@ -166,39 +172,50 @@ remove_duplicated () { local ava_archs local arch local file_names - local sstate_list + local sstate_files_list local fn_tmp local list_suffix=`mktemp` || exit 1 - # Find out the archs in all the layers - echo -n "Figuring out the archs in the layers ... " - oe_core_dir=$(dirname $(dirname $(readlink -e $0))) - topdir=$(dirname $oe_core_dir) - tunedirs="`find $topdir/meta* ${oe_core_dir}/meta* $layers -path '*/meta*/conf/machine/include' 2>/dev/null`" - [ -n "$tunedirs" ] || echo_error "Can't find the tune directory" - all_machines="`find $topdir/meta* ${oe_core_dir}/meta* $layers -path '*/meta*/conf/machine/*' -name '*.conf' 2>/dev/null | sed -e 's/.*\///' -e 's/.conf$//'`" - all_archs=`grep -r -h "^AVAILTUNES .*=" $tunedirs | sed -e 's/.*=//' -e 's/\"//g'` - # Add the qemu and native archs - # Use the "_" to substitute "-", e.g., x86-64 to x86_64 + if [ -z "$extra_archs" ] ; then + # Find out the archs in all the layers + echo "Figuring out the archs in the layers ... " + oe_core_dir=$(dirname $(dirname $(readlink -e $0))) + topdir=$(dirname $oe_core_dir) + tunedirs="`find $topdir/meta* ${oe_core_dir}/meta* $layers -path '*/meta*/conf/machine/include' 2>/dev/null`" + [ -n "$tunedirs" ] || echo_error "Can't find the tune directory" + all_machines="`find $topdir/meta* ${oe_core_dir}/meta* $layers -path '*/meta*/conf/machine/*' -name '*.conf' 2>/dev/null | sed -e 's/.*\///' -e 's/.conf$//'`" + all_archs=`grep -r -h "^AVAILTUNES .*=" $tunedirs | sed -e 's/.*=//' -e 's/\"//g'` + fi + + # Use the "_" to substitute "-", e.g., x86-64 to x86_64, but not for extra_archs which can be something like cortexa9t2-vfp-neon # Sort to remove the duplicated ones - all_archs=$(echo $all_archs $all_machines $(uname -m) \ - | sed -e 's/-/_/g' -e 's/ /\n/g' | sort -u) + # Add allarch and builder arch (native) + builder_arch=$(uname -m) + all_archs="$(echo allarch $all_archs $all_machines $builder_arch \ + | sed -e 's/-/_/g' -e 's/ /\n/g' | sort -u) $extra_archs" echo "Done" + # Total number of files including sstate-, .siginfo and .done files + total_files=`find $cache_dir -name 'sstate*' | wc -l` # Save all the sstate files in a file - sstate_list=`mktemp` || exit 1 - find $cache_dir -name 'sstate-*.tgz' >$sstate_list + sstate_files_list=`mktemp` || exit 1 + find $cache_dir -name 'sstate:*:*:*:*:*:*:*.tgz*' >$sstate_files_list - echo -n "Figuring out the suffixes in the sstate cache dir ... " - sstate_suffixes="`sed 's/.*_\([^_]*\)\.tgz$/\1/g' $sstate_list | sort -u`" + echo "Figuring out the suffixes in the sstate cache dir ... " + sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tgz.*%\1%g' $sstate_files_list | sort -u`" echo "Done" echo "The following suffixes have been found in the cache dir:" echo $sstate_suffixes - echo -n "Figuring out the archs in the sstate cache dir ... " + echo "Figuring out the archs in the sstate cache dir ... " + # Using this SSTATE_PKGSPEC definition it's 6th colon separated field + # SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:" for arch in $all_archs; do - grep -q "\-$arch-" $sstate_list + grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tgz$" $sstate_files_list [ $? -eq 0 ] && ava_archs="$ava_archs $arch" + # ${builder_arch}_$arch used by toolchain sstate + grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:${builder_arch}_$arch:[^:]*:[^:]*\.tgz$" $sstate_files_list + [ $? -eq 0 ] && ava_archs="$ava_archs ${builder_arch}_$arch" done echo "Done" echo "The following archs have been found in the cache dir:" @@ -207,65 +224,83 @@ remove_duplicated () { # Save the file list which needs to be removed local remove_listdir=`mktemp -d` || exit 1 - for suffix in $sstate_suffixes; do + if [ "$suffix" = "populate_lic" ] ; then + echo "Skipping populate_lic, because removing duplicates doesn't work correctly for them (use --stamps-dir instead)" + continue + fi + # Total number of files including .siginfo and .done files + total_files_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz.*" $sstate_files_list | wc -l 2>/dev/null` + total_tgz_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz$" $sstate_files_list | wc -l 2>/dev/null` # Save the file list to a file, some suffix's file may not exist - grep "sstate-.*_$suffix.tgz" $sstate_list >$list_suffix 2>/dev/null - local deleted=0 - echo -n "Figuring out the sstate-xxx_$suffix.tgz ... " - # There are at list 6 dashes (-) after arch, use this to avoid the - # greedy match of sed. - file_names=`for arch in $ava_archs; do - sed -ne 's#.*/\(sstate-.*\)-'"$arch"'-.*-.*-.*-.*-.*-.*#\1#p' $list_suffix - done | sort -u` - - fn_tmp=`mktemp` || exit 1 - rm_list="$remove_listdir/sstate-xxx_$suffix" - for fn in $file_names; do - [ -z "$verbose" ] || echo "Analyzing $fn-xxx_$suffix.tgz" - for arch in $ava_archs; do - grep -h "/$fn-$arch-" $list_suffix >$fn_tmp - if [ -s $fn_tmp ] ; then - [ $debug -gt 1 ] && echo "Available files for $fn-$arch- with suffix $suffix:" && cat $fn_tmp - # Use the modification time - to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p') - [ $debug -gt 2 ] && echo "Considering to delete: $to_del" - # The sstate file which is downloaded from the SSTATE_MIRROR is - # put in SSTATE_DIR, and there is a symlink in SSTATE_DIR/??/ to - # it, so filter it out from the remove list if it should not be - # removed. - to_keep=$(ls -t $(cat $fn_tmp) | sed -n '1p') - [ $debug -gt 2 ] && echo "Considering to keep: $to_keep" - for k in $to_keep; do - if [ -L "$k" ]; then - # The symlink's destination - k_dest="`readlink -e $k`" - # Maybe it is the one in cache_dir - k_maybe="$cache_dir/${k##/*/}" - # Remove it from the remove list if they are the same. - if [ "$k_dest" = "$k_maybe" ]; then - to_del="`echo $to_del | sed 's#'\"$k_maybe\"'##g'`" + grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz.*" $sstate_files_list >$list_suffix 2>/dev/null + local deleted_tgz=0 + local deleted_files=0 + for ext in tgz tgz.siginfo tgz.done; do + echo "Figuring out the sstate:xxx_$suffix.$ext ... " + # Uniq BPNs + file_names=`for arch in $ava_archs ""; do + sed -ne "s%.*/sstate:\([^:]*\):[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.${ext}$%\1%p" $list_suffix + done | sort -u` + + fn_tmp=`mktemp` || exit 1 + rm_list="$remove_listdir/sstate:xxx_$suffix" + for fn in $file_names; do + [ -z "$verbose" ] || echo "Analyzing sstate:$fn-xxx_$suffix.${ext}" + for arch in $ava_archs ""; do + grep -h ".*/sstate:$fn:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.${ext}$" $list_suffix >$fn_tmp + if [ -s $fn_tmp ] ; then + [ $debug -gt 1 ] && echo "Available files for $fn-$arch- with suffix $suffix.${ext}:" && cat $fn_tmp + # Use the modification time + to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p') + [ $debug -gt 2 ] && echo "Considering to delete: $to_del" + # The sstate file which is downloaded from the SSTATE_MIRROR is + # put in SSTATE_DIR, and there is a symlink in SSTATE_DIR/??/ to + # it, so filter it out from the remove list if it should not be + # removed. + to_keep=$(ls -t $(cat $fn_tmp) | sed -n '1p') + [ $debug -gt 2 ] && echo "Considering to keep: $to_keep" + for k in $to_keep; do + if [ -L "$k" ]; then + # The symlink's destination + k_dest="`readlink -e $k`" + # Maybe it is the one in cache_dir + k_maybe="$cache_dir/${k##/*/}" + # Remove it from the remove list if they are the same. + if [ "$k_dest" = "$k_maybe" ]; then + to_del="`echo $to_del | sed 's#'\"$k_maybe\"'##g'`" + fi fi - fi - done - rm -f $fn_tmp - [ $debug -gt 2 ] && echo "Decided to delete: $to_del" - gen_rmlist $rm_list "$to_del" - fi + done + rm -f $fn_tmp + [ $debug -gt 2 ] && echo "Decided to delete: $to_del" + gen_rmlist $rm_list.$ext "$to_del" + fi + done done done - [ ! -s "$rm_list" ] || deleted=`cat $rm_list | wc -l` - [ -s "$rm_list" -a $debug -gt 0 ] && cat $rm_list - echo "($deleted files will be removed)" - let total_deleted=$total_deleted+$deleted + deleted_tgz=`cat $rm_list.* 2>/dev/null | grep ".tgz$" | wc -l` + deleted_files=`cat $rm_list.* 2>/dev/null | wc -l` + [ "$deleted_files" -gt 0 -a $debug -gt 0 ] && cat $rm_list.* + echo "($deleted_tgz out of $total_tgz_suffix .tgz files for $suffix suffix will be removed or $deleted_files out of $total_files_suffix when counting also .siginfo and .done files)" + let total_deleted=$total_deleted+$deleted_files done + deleted_tgz=0 + rm_old_list=$remove_listdir/sstate-old-filenames + find $cache_dir -name 'sstate-*.tgz' >$rm_old_list + [ -s "$rm_old_list" ] && deleted_tgz=`cat $rm_old_list | grep ".tgz$" | wc -l` + [ -s "$rm_old_list" ] && deleted_files=`cat $rm_old_list | wc -l` + [ -s "$rm_old_list" -a $debug -gt 0 ] && cat $rm_old_list + echo "($deleted_tgz .tgz files with old sstate-* filenames will be removed or $deleted_files when counting also .siginfo and .done files)" + let total_deleted=$total_deleted+$deleted_files + rm -f $list_suffix - rm -f $sstate_list + rm -f $sstate_files_list if [ $total_deleted -gt 0 ]; then read_confirm if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then for list in `ls $remove_listdir/`; do - echo -n "Removing $list.tgz (`cat $remove_listdir/$list | wc -w` files) ... " + echo "Removing $list.tgz (`cat $remove_listdir/$list | wc -w` files) ... " # Remove them one by one to avoid the argument list too long error for i in `cat $remove_listdir/$list`; do rm -f $verbose $i @@ -289,16 +324,23 @@ rm_by_stamps (){ local cache_list=`mktemp` || exit 1 local keep_list=`mktemp` || exit 1 local rm_list=`mktemp` || exit 1 - local suffixes local sums local all_sums - suffixes="populate_sysroot populate_lic package_write_ipk \ - package_write_rpm package_write_deb package deploy" + # Total number of files including sstate-, .siginfo and .done files + total_files=`find $cache_dir -type f -name 'sstate*' | wc -l` + # Save all the state file list to a file + find $cache_dir -type f -name 'sstate*' | sort -u -o $cache_list + + echo "Figuring out the suffixes in the sstate cache dir ... " + local sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tgz.*%\1%g' $cache_list | sort -u`" + echo "Done" + echo "The following suffixes have been found in the cache dir:" + echo $sstate_suffixes # Figure out all the md5sums in the stamps dir. - echo -n "Figuring out all the md5sums in stamps dir ... " - for i in $suffixes; do + echo "Figuring out all the md5sums in stamps dir ... " + for i in $sstate_suffixes; do # There is no "\.sigdata" but "_setcene" when it is mirrored # from the SSTATE_MIRRORS, use them to figure out the sum. sums=`find $stamps -maxdepth 3 -name "*.do_$i.*" \ @@ -309,12 +351,9 @@ rm_by_stamps (){ done echo "Done" - # Save all the state file list to a file - find $cache_dir -name 'sstate-*.tgz' | sort -u -o $cache_list - - echo -n "Figuring out the files which will be removed ... " + echo "Figuring out the files which will be removed ... " for i in $all_sums; do - grep ".*-${i}_.*" $cache_list >>$keep_list + grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:${i}_.*" $cache_list >>$keep_list done echo "Done" @@ -322,14 +361,14 @@ rm_by_stamps (){ sort -u $keep_list -o $keep_list to_del=`comm -1 -3 $keep_list $cache_list` gen_rmlist $rm_list "$to_del" - let total_deleted=(`cat $rm_list | wc -w`) + let total_deleted=`cat $rm_list | sort -u | wc -w` if [ $total_deleted -gt 0 ]; then - [ $debug -gt 0 ] && cat $rm_list + [ $debug -gt 0 ] && cat $rm_list | sort -u read_confirm if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then echo "Removing sstate cache files ... ($total_deleted files)" # Remove them one by one to avoid the argument list too long error - for i in `cat $rm_list`; do + for i in `cat $rm_list | sort -u`; do rm -f $verbose $i done echo "$total_deleted files have been removed" @@ -368,9 +407,14 @@ while [ -n "$1" ]; do fsym="y" shift ;; + --extra-archs=*) + extra_archs=`echo $1 | sed -e 's#^--extra-archs=##' -e 's#,# #g'` + [ -n "$extra_archs" ] || echo_error "Invalid extra arch parameter" + shift + ;; --extra-layer=*) extra_layers=`echo $1 | sed -e 's#^--extra-layer=##' -e 's#,# #g'` - [ -n "$extra_layers" ] || echo_error "Invalid extra layer $i" + [ -n "$extra_layers" ] || echo_error "Invalid extra layer parameter" for i in $extra_layers; do l=`readlink -e $i` if [ -d "$l" ]; then diff --git a/scripts/sstate-diff-machines.sh b/scripts/sstate-diff-machines.sh index 931f9d7c00..056aa0a04c 100755 --- a/scripts/sstate-diff-machines.sh +++ b/scripts/sstate-diff-machines.sh @@ -1,7 +1,8 @@ -#!/bin/sh +#!/bin/bash -# Used to compare sstate checksums between MACHINES -# Execute script and compare generated list.M files +# Used to compare sstate checksums between MACHINES. +# Execute script and compare generated list.M files. +# Using bash to have PIPESTATUS variable. # It's also usefull to keep older sstate checksums # to be able to find out why something is rebuilding @@ -27,6 +28,7 @@ machines= targets= default_machines="qemuarm qemux86 qemux86-64" default_targets="core-image-base" +analyze="N" usage () { cat << EOF @@ -48,6 +50,12 @@ Options: --targets=<targets> List of targets separated by space, will use the environment variable TARGETS if it is not specified. Default value is "core-image-base". + + --analyze + Show the differences between MACHINEs. It assumes: + * First 2 MACHINEs in --machines parameter have the same TUNE_PKGARCH + * Third optional MACHINE has different TUNE_PKGARCH - only native and allarch recipes are compared). + * Next MACHINEs are ignored EOF } @@ -72,6 +80,10 @@ while [ -n "$1" ]; do targets=`echo $1 | sed -e 's#^--targets="*\([^"]*\)"*#\1#'` shift ;; + --analyze) + analyze="Y" + shift + ;; --help|-h) usage exit 0 @@ -94,14 +106,67 @@ done [ -n "$targets" ] || targets=$default_targets OUTPUT=${tmpdir}/sstate-diff/`date "+%s"` +declare -i RESULT=0 for M in ${machines}; do - find ${tmpdir}/stamps/ -name \*sigdata\* | xargs rm -f + [ -d ${tmpdir}/stamps/ ] && find ${tmpdir}/stamps/ -name \*sigdata\* | xargs rm -f mkdir -p ${OUTPUT}/${M} - export MACHINE=${M}; bitbake -S ${targets} | tee -a ${OUTPUT}/${M}/log; - cp -ra ${tmpdir}/stamps/* ${OUTPUT}/${M} - find ${OUTPUT}/${M} -name \*sigdata\* | sed "s#${OUTPUT}/${M}/##g" | sort > ${OUTPUT}/${M}/list - M_UNDERSCORE=`echo ${M} | sed 's/-/_/g'` - sed "s/${M_UNDERSCORE}/MACHINE/g; s/${M}/MACHINE/g" ${OUTPUT}/${M}/list | sort > ${OUTPUT}/${M}/list.M - find ${tmpdir}/stamps/ -name \*sigdata\* | xargs rm -f + export MACHINE=${M} + bitbake -S none ${targets} 2>&1 | tee -a ${OUTPUT}/${M}/log; + RESULT+=${PIPESTATUS[0]} + if ls ${tmpdir}/stamps/* >/dev/null 2>/dev/null ; then + cp -ra ${tmpdir}/stamps/* ${OUTPUT}/${M} + find ${OUTPUT}/${M} -name \*sigdata\* | sed "s#${OUTPUT}/${M}/##g" | sort > ${OUTPUT}/${M}/list + M_UNDERSCORE=`echo ${M} | sed 's/-/_/g'` + sed "s/${M_UNDERSCORE}/MACHINE/g; s/${M}/MACHINE/g" ${OUTPUT}/${M}/list | sort > ${OUTPUT}/${M}/list.M + find ${tmpdir}/stamps/ -name \*sigdata\* | xargs rm -f + else + printf "ERROR: no sigdata files were generated for MACHINE $M in ${tmpdir}/stamps\n"; + fi done + +function compareSignatures() { + MACHINE1=$1 + MACHINE2=$2 + PATTERN="$3" + PRE_PATTERN="" + [ -n "${PATTERN}" ] || PRE_PATTERN="-v" + [ -n "${PATTERN}" ] || PATTERN="MACHINE" + for TASK in do_configure.sigdata do_populate_sysroot.sigdata do_package_write_ipk.sigdata; do + printf "\n\n === Comparing signatures for task ${TASK} between ${MACHINE1} and ${MACHINE2} ===\n" | tee -a ${OUTPUT}/signatures.${MACHINE2}.${TASK}.log + diff ${OUTPUT}/${MACHINE1}/list.M ${OUTPUT}/${MACHINE2}/list.M | grep ${PRE_PATTERN} "${PATTERN}" | grep ${TASK} > ${OUTPUT}/signatures.${MACHINE2}.${TASK} + for i in `cat ${OUTPUT}/signatures.${MACHINE2}.${TASK} | sed 's#[^/]*/\([^/]*\)/.*#\1#g' | sort -u | xargs`; do + [ -e ${OUTPUT}/${MACHINE1}/*/$i/*${TASK}* ] || echo "INFO: ${i} task ${TASK} doesn't exist in ${MACHINE1}" >&2 + [ -e ${OUTPUT}/${MACHINE1}/*/$i/*${TASK}* ] || continue + [ -e ${OUTPUT}/${MACHINE2}/*/$i/*${TASK}* ] || echo "INFO: ${i} task ${TASK} doesn't exist in ${MACHINE2}" >&2 + [ -e ${OUTPUT}/${MACHINE2}/*/$i/*${TASK}* ] || continue + printf "ERROR: $i different signature for task ${TASK} between ${MACHINE1} and ${MACHINE2}\n"; + bitbake-diffsigs ${OUTPUT}/${MACHINE1}/*/$i/*${TASK}* ${OUTPUT}/${MACHINE2}/*/$i/*${TASK}*; + echo "$i" >> ${OUTPUT}/failed-recipes.log + echo + done | tee -a ${OUTPUT}/signatures.${MACHINE2}.${TASK}.log + # don't create empty files + ERRORS=`grep "^ERROR.*" ${OUTPUT}/signatures.${MACHINE2}.${TASK}.log | wc -l` + if [ "${ERRORS}" != "0" ] ; then + echo "ERROR: ${ERRORS} errors found in ${OUTPUT}/signatures.${MACHINE2}.${TASK}.log" + RESULT+=${ERRORS} + fi + done +} + +function compareMachines() { + [ "$#" -ge 2 ] && compareSignatures $1 $2 + [ "$#" -ge 3 ] && compareSignatures $1 $3 "\(^< all\)\|\(^< x86_64-linux\)\|\(^< i586-linux\)" +} + +if [ "${analyze}" = "Y" ] ; then + compareMachines ${machines} +fi + +if [ "${RESULT}" != "0" -a -f ${OUTPUT}/failed-recipes.log ] ; then + cat ${OUTPUT}/failed-recipes.log | sort -u >${OUTPUT}/failed-recipes.log.u && mv ${OUTPUT}/failed-recipes.log.u ${OUTPUT}/failed-recipes.log + echo "ERROR: ${RESULT} issues were found in these recipes: `cat ${OUTPUT}/failed-recipes.log | xargs`" +fi + +echo "INFO: Output written in: ${OUTPUT}" +exit ${RESULT} diff --git a/scripts/sstate-sysroot-cruft.sh b/scripts/sstate-sysroot-cruft.sh index ca2316cdcc..b6166aa1b2 100755 --- a/scripts/sstate-sysroot-cruft.sh +++ b/scripts/sstate-sysroot-cruft.sh @@ -17,6 +17,15 @@ Options: --tmpdir=<tmpdir> Specify tmpdir, will use the environment variable TMPDIR if it is not specified. Something like /OE/oe-core/tmp-eglibc (no / at the end). + + --whitelist=<whitelist-file> + Text file, each line is regular expression for paths we want to ignore in resulting diff. + You can use diff file from the script output, if it contains only expected exceptions. + '#' is used as regexp delimiter, so you don't need to prefix forward slashes in paths. + ^ and $ is automatically added, so provide only the middle part. + Lines starting with '#' are ignored as comments. + All paths are relative to "sysroots" directory. + Directories don't end with forward slash. EOF } @@ -33,6 +42,11 @@ while [ -n "$1" ]; do [ -d "$tmpdir" ] || echo_error "Invalid argument to --tmpdir" shift ;; + --whitelist=*) + fwhitelist=`echo $1 | sed -e 's#^--whitelist=##' | xargs readlink -e` + [ -f "$fwhitelist" ] || echo_error "Invalid argument to --whitelist" + shift + ;; --help|-h) usage exit 0 @@ -51,28 +65,133 @@ done [ -d "$tmpdir" ] || echo_error "Invalid tmpdir \"$tmpdir\"" OUTPUT=${tmpdir}/sysroot.cruft.`date "+%s"` -WHITELIST="\/var\/pseudo\($\|\/[^\/]*$\) \/shlibs$ \.pyc$ \.pyo$" + +# top level directories +WHITELIST="[^/]*" + +# generated by base-passwd recipe +WHITELIST="${WHITELIST} \ + .*/etc/group-\? \ + .*/etc/passwd-\? \ +" +# generated by pseudo-native +WHITELIST="${WHITELIST} \ + .*/var/pseudo \ + .*/var/pseudo/[^/]* \ +" + +# generated by package.bbclass:SHLIBSDIRS = "${PKGDATA_DIR}/${MLPREFIX}shlibs" +WHITELIST="${WHITELIST} \ + .*/shlibs \ + .*/pkgdata \ +" + +# generated by python +WHITELIST="${WHITELIST} \ + .*\.pyc \ + .*\.pyo \ + .*/__pycache__ \ +" + +# generated by lua +WHITELIST="${WHITELIST} \ + .*\.luac \ +" + +# generated by sgml-common-native +WHITELIST="${WHITELIST} \ + .*/etc/sgml/sgml-docbook.bak \ +" + +# generated by php +WHITELIST="${WHITELIST} \ + .*/usr/lib/php5/php/.channels/.* \ + .*/usr/lib/php5/php/.registry/.* \ + .*/usr/lib/php5/php/.depdb \ + .*/usr/lib/php5/php/.depdblock \ + .*/usr/lib/php5/php/.filemap \ + .*/usr/lib/php5/php/.lock \ +" + +# generated by toolchain +WHITELIST="${WHITELIST} \ + [^/]*-tcbootstrap/lib \ +" + +# generated by useradd.bbclass +WHITELIST="${WHITELIST} \ + [^/]*/home \ + [^/]*/home/xuser \ + [^/]*/home/xuser/.bashrc \ + [^/]*/home/xuser/.profile \ + [^/]*/home/builder \ + [^/]*/home/builder/.bashrc \ + [^/]*/home/builder/.profile \ +" + +# generated by image.py for WIC +# introduced in oe-core commit 861ce6c5d4836df1a783be3b01d2de56117c9863 +WHITELIST="${WHITELIST} \ + [^/]*/imgdata \ + [^/]*/imgdata/[^/]*\.env \ +" + +# generated by fontcache.bbclass +WHITELIST="${WHITELIST} \ + .*/var/cache/fontconfig/ \ +" + +# created by oe.utils.write_ld_so_conf which is used from few bbclasses and recipes: +# meta/classes/image-prelink.bbclass: oe.utils.write_ld_so_conf(d) +# meta/classes/insane.bbclass: oe.utils.write_ld_so_conf(d) +# meta/classes/insane.bbclass: oe.utils.write_ld_so_conf(d) +# meta/recipes-gnome/gobject-introspection/gobject-introspection_1.48.0.bb: oe.utils.write_ld_so_conf(d) +# meta/recipes-gnome/gobject-introspection/gobject-introspection_1.48.0.bb: oe.utils.write_ld_so_conf(d) +# introduced in oe-core commit 7fd1d7e639c2ed7e0699937a5cb245c187b7c811 +# and more visible since added to gobject-introspection in 10e0c1a3a452baa05d160a92a54b2e33cf0fd061 +WHITELIST="${WHITELIST} \ + [^/]*/etc/ld.so.conf \ +" + +SYSROOTS="`readlink -f ${tmpdir}`/sysroots/" mkdir ${OUTPUT} -find ${tmpdir}/sstate-control -name \*.populate-sysroot\* -o -name \*.package\* | xargs cat | grep sysroots | \ +find ${tmpdir}/sstate-control -name \*.populate-sysroot\* -o -name \*.populate_sysroot\* -o -name \*.package\* | xargs cat | grep sysroots | \ sed 's#/$##g; s#///*#/#g' | \ # work around for paths ending with / for directories and multiplied // (e.g. paths to native sysroot) - sort > ${OUTPUT}/master.list.all -sort -u ${OUTPUT}/master.list.all > ${OUTPUT}/master.list # -u because some directories are listed for more recipes + sort | sed "s#^${SYSROOTS}##g" > ${OUTPUT}/master.list.all.txt +sort -u ${OUTPUT}/master.list.all.txt > ${OUTPUT}/master.list.txt # -u because some directories are listed for more recipes find ${tmpdir}/sysroots/ | \ - sort > ${OUTPUT}/sysroot.list + sort | sed "s#^${SYSROOTS}##g" > ${OUTPUT}/sysroot.list.txt -diff ${OUTPUT}/master.list.all ${OUTPUT}/master.list > ${OUTPUT}/duplicates -diff ${OUTPUT}/master.list ${OUTPUT}/sysroot.list > ${OUTPUT}/diff.all +diff ${OUTPUT}/master.list.all.txt ${OUTPUT}/master.list.txt > ${OUTPUT}/duplicates.txt +diff ${OUTPUT}/master.list.txt ${OUTPUT}/sysroot.list.txt > ${OUTPUT}/diff.all.txt -cp ${OUTPUT}/diff.all ${OUTPUT}/diff +grep "^> ." ${OUTPUT}/diff.all.txt | sed 's/^> //g' > ${OUTPUT}/diff.txt for item in ${WHITELIST}; do - sed -i "/${item}/d" ${OUTPUT}/diff; + sed -i "\\#^${item}\$#d" ${OUTPUT}/diff.txt; + echo "${item}" >> ${OUTPUT}/used.whitelist.txt done +if [ -s "$fwhitelist" ] ; then + cat $fwhitelist >> ${OUTPUT}/used.whitelist.txt + cat $fwhitelist | grep -v '^#' | while read item; do + sed -i "\\#^${item}\$#d" ${OUTPUT}/diff.txt; + done +fi # too many false positives for directories # echo "Following files are installed in sysroot at least twice" # cat ${OUTPUT}/duplicates -echo "Following files are installed in sysroot, but not tracked by sstate" -cat ${OUTPUT}/diff +RESULT=`cat ${OUTPUT}/diff.txt | wc -l` + +if [ "${RESULT}" != "0" ] ; then + echo "ERROR: ${RESULT} issues were found." + echo "ERROR: Following files are installed in sysroot, but not tracked by sstate:" + cat ${OUTPUT}/diff.txt +else + echo "INFO: All files are tracked by sstate or were explicitly ignored by this script" +fi + +echo "INFO: Output written in: ${OUTPUT}" +exit ${RESULT} diff --git a/scripts/swabber-strace-attach b/scripts/swabber-strace-attach deleted file mode 100755 index bb0391a7ca..0000000000 --- a/scripts/swabber-strace-attach +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python -import os -import sys -import subprocess - -# Detach from the controlling terminal and parent process by forking twice to daemonize ourselves, -# then run the command passed as argv[1]. Send log data to argv[2]. - -pid = os.fork() -if (pid == 0): - os.setsid() - pid = os.fork() - if (pid != 0): - os._exit(0) -else: - sys.exit() - - -si = file(os.devnull, 'r') -so = file(sys.argv[2], 'w') -se = so - -# Replace those fds with our own -os.dup2(si.fileno(), sys.stdin.fileno()) -os.dup2(so.fileno(), sys.stdout.fileno()) -os.dup2(se.fileno(), sys.stderr.fileno()) - -ret = subprocess.call(sys.argv[1], shell=True) - -os._exit(ret) - diff --git a/scripts/sysroot-relativelinks.py b/scripts/sysroot-relativelinks.py new file mode 100755 index 0000000000..ffe254728b --- /dev/null +++ b/scripts/sysroot-relativelinks.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +import sys +import os + +# Take a sysroot directory and turn all the abolute symlinks and turn them into +# relative ones such that the sysroot is usable within another system. + +if len(sys.argv) != 2: + print("Usage is " + sys.argv[0] + "<directory>") + sys.exit(1) + +topdir = sys.argv[1] +topdir = os.path.abspath(topdir) + +def handlelink(filep, subdir): + link = os.readlink(filep) + if link[0] != "/": + return + if link.startswith(topdir): + return + #print("Replacing %s with %s for %s" % (link, topdir+link, filep)) + print("Replacing %s with %s for %s" % (link, os.path.relpath(topdir+link, subdir), filep)) + os.unlink(filep) + os.symlink(os.path.relpath(topdir+link, subdir), filep) + +for subdir, dirs, files in os.walk(topdir): + for f in dirs + files: + filep = os.path.join(subdir, f) + if os.path.islink(filep): + #print("Considering %s" % filep) + handlelink(filep, subdir) diff --git a/scripts/task-time b/scripts/task-time new file mode 100755 index 0000000000..e58040a9b9 --- /dev/null +++ b/scripts/task-time @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 + +import argparse +import os +import re +import sys + +arg_parser = argparse.ArgumentParser( + description=""" +Reports time consumed for one or more task in a format similar to the standard +Bash 'time' builtin. Optionally sorts tasks by real (wall-clock), user (user +space CPU), or sys (kernel CPU) time. +""") + +arg_parser.add_argument( + "paths", + metavar="path", + nargs="+", + help=""" +A path containing task buildstats. If the path is a directory, e.g. +build/tmp/buildstats, then all task found (recursively) in it will be +processed. If the path is a single task buildstat, e.g. +build/tmp/buildstats/20161018083535/foo-1.0-r0/do_compile, then just that +buildstat will be processed. Multiple paths can be specified to process all of +them. Files whose names do not start with "do_" are ignored. +""") + +arg_parser.add_argument( + "--sort", + choices=("none", "real", "user", "sys"), + default="none", + help=""" +The measurement to sort the output by. Defaults to 'none', which means to sort +by the order paths were given on the command line. For other options, tasks are +sorted in descending order from the highest value. +""") + +args = arg_parser.parse_args() + +# Field names and regexes for parsing out their values from buildstat files +field_regexes = (("elapsed", ".*Elapsed time: ([0-9.]+)"), + ("user", "rusage ru_utime: ([0-9.]+)"), + ("sys", "rusage ru_stime: ([0-9.]+)"), + ("child user", "Child rusage ru_utime: ([0-9.]+)"), + ("child sys", "Child rusage ru_stime: ([0-9.]+)")) + +# A list of (<path>, <dict>) tuples, where <path> is the path of a do_* task +# buildstat file and <dict> maps fields from the file to their values +task_infos = [] + +def save_times_for_task(path): + """Saves information for the buildstat file 'path' in 'task_infos'.""" + + if not os.path.basename(path).startswith("do_"): + return + + with open(path) as f: + fields = {} + + for line in f: + for name, regex in field_regexes: + match = re.match(regex, line) + if match: + fields[name] = float(match.group(1)) + break + + # Check that all expected fields were present + for name, regex in field_regexes: + if name not in fields: + print("Warning: Skipping '{}' because no field matching '{}' could be found" + .format(path, regex), + file=sys.stderr) + return + + task_infos.append((path, fields)) + +def save_times_for_dir(path): + """Runs save_times_for_task() for each file in path and its subdirs, recursively.""" + + # Raise an exception for os.walk() errors instead of ignoring them + def walk_onerror(e): + raise e + + for root, _, files in os.walk(path, onerror=walk_onerror): + for fname in files: + save_times_for_task(os.path.join(root, fname)) + +for path in args.paths: + if os.path.isfile(path): + save_times_for_task(path) + else: + save_times_for_dir(path) + +def elapsed_time(task_info): + return task_info[1]["elapsed"] + +def tot_user_time(task_info): + return task_info[1]["user"] + task_info[1]["child user"] + +def tot_sys_time(task_info): + return task_info[1]["sys"] + task_info[1]["child sys"] + +if args.sort != "none": + sort_fn = {"real": elapsed_time, "user": tot_user_time, "sys": tot_sys_time} + task_infos.sort(key=sort_fn[args.sort], reverse=True) + +first_entry = True + +# Catching BrokenPipeError avoids annoying errors when the output is piped into +# e.g. 'less' or 'head' and not completely read +try: + for task_info in task_infos: + real = elapsed_time(task_info) + user = tot_user_time(task_info) + sys = tot_sys_time(task_info) + + if not first_entry: + print() + first_entry = False + + # Mimic Bash's 'time' builtin + print("{}:\n" + "real\t{}m{:.3f}s\n" + "user\t{}m{:.3f}s\n" + "sys\t{}m{:.3f}s" + .format(task_info[0], + int(real//60), real%60, + int(user//60), user%60, + int(sys//60), sys%60)) + +except BrokenPipeError: + pass diff --git a/scripts/test-dependencies.sh b/scripts/test-dependencies.sh index e4cf4d366b..0b94de8608 100755 --- a/scripts/test-dependencies.sh +++ b/scripts/test-dependencies.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Author: Martin Jansa <martin.jansa@gmail.com> # @@ -6,7 +6,7 @@ # Used to detect missing dependencies or automagically # enabled dependencies which aren't explicitly enabled -# or disabled. +# or disabled. Using bash to have PIPESTATUS variable. # It does 3 builds of <target> # 1st to populate sstate-cache directory and sysroot @@ -131,13 +131,17 @@ done echo "$buildtype" | grep -v '^[1234c ]*$' && echo_error "Invalid buildtype \"$buildtype\", only some combination of 1, 2, 3, 4, c separated by space is allowed" OUTPUT_BASE=test-dependencies/`date "+%s"` +declare -i RESULT=0 build_all() { echo "===== 1st build to populate sstate-cache directory and sysroot =====" OUTPUT1=${OUTPUT_BASE}/${TYPE}_all mkdir -p ${OUTPUT1} echo "Logs will be stored in ${OUTPUT1} directory" - bitbake -k $targets | tee -a ${OUTPUT1}/complete.log + bitbake -k $targets 2>&1 | tee -a ${OUTPUT1}/complete.log + RESULT+=${PIPESTATUS[0]} + grep "ERROR: Task.*failed" ${OUTPUT1}/complete.log > ${OUTPUT1}/failed-tasks.log + cat ${OUTPUT1}/failed-tasks.log | sed 's@.*/@@g; s@_.*@@g; s@\.bb, .*@@g; s@\.bb:.*@@g' | sort -u > ${OUTPUT1}/failed-recipes.log } build_every_recipe() { @@ -162,12 +166,24 @@ build_every_recipe() { rm -rf $tmpdir/deploy $tmpdir/pkgdata $tmpdir/sstate-control $tmpdir/stamps $tmpdir/sysroots $tmpdir/work $tmpdir/work-shared 2>/dev/null fi i=1 - count=`cat $recipes | wc -l` - for recipe in `cat $recipes`; do + count=`cat $recipes ${OUTPUT1}/failed-recipes.log | sort -u | wc -l` + for recipe in `cat $recipes ${OUTPUT1}/failed-recipes.log | sort -u`; do echo "Building recipe: ${recipe} ($i/$count)" - bitbake -c cleansstate ${recipe} > ${OUTPUTB}/log.${recipe} 2>&1; - bitbake ${recipe} >> ${OUTPUTB}/log.${recipe} 2>&1; - grep "ERROR: Task.*failed" ${OUTPUTB}/log.${recipe} && mv ${OUTPUTB}/log.${recipe} ${OUTPUTB}/failed/${recipe} || mv ${OUTPUTB}/log.${recipe} ${OUTPUTB}/ok/${recipe} + declare -i RECIPE_RESULT=0 + bitbake -c cleansstate ${recipe} > ${OUTPUTB}/${recipe}.log 2>&1; + RECIPE_RESULT+=$? + bitbake ${recipe} >> ${OUTPUTB}/${recipe}.log 2>&1; + RECIPE_RESULT+=$? + if [ "${RECIPE_RESULT}" != "0" ] ; then + RESULT+=${RECIPE_RESULT} + mv ${OUTPUTB}/${recipe}.log ${OUTPUTB}/failed/ + grep "ERROR: Task.*failed" ${OUTPUTB}/failed/${recipe}.log | tee -a ${OUTPUTB}/failed-tasks.log + grep "ERROR: Task.*failed" ${OUTPUTB}/failed/${recipe}.log | sed 's@.*/@@g; s@_.*@@g; s@\.bb, .*@@g; s@\.bb:.*@@g' >> ${OUTPUTB}/failed-recipes.log + # and append also ${recipe} in case the failed task was from some dependency + echo ${recipe} >> ${OUTPUTB}/failed-recipes.log + else + mv ${OUTPUTB}/${recipe}.log ${OUTPUTB}/ok/ + fi if [ "${TYPE}" != "2" ] ; then rm -rf $tmpdir/deploy $tmpdir/pkgdata $tmpdir/sstate-control $tmpdir/stamps $tmpdir/sysroots $tmpdir/work $tmpdir/work-shared 2>/dev/null fi @@ -178,14 +194,12 @@ build_every_recipe() { # This will be usefull to see which library is pulling new dependency echo "Copying do_package logs to ${OUTPUTB}/do_package/" mkdir ${OUTPUTB}/do_package - find $tmpdir/work/ -name log.do_package | while read f; do + find $tmpdir/work/ -name log.do_package 2>/dev/null| while read f; do # pn is 3 levels back, but we don't know if there is just one log per pn (only one arch and version) # dest=`echo $f | sed 's#^.*/\([^/]*\)/\([^/]*\)/\([^/]*\)/log.do_package#\1#g'` dest=`echo $f | sed "s#$tmpdir/work/##g; s#/#_#g"` cp $f ${OUTPUTB}/do_package/$dest done - grep "ERROR: Task.*failed" ${OUTPUTB}/failed/* - ls -1 ${OUTPUTB}/failed/* >> ${OUTPUT_BASE}/failed.recipes } compare_deps() { @@ -195,7 +209,7 @@ compare_deps() { # OUTPUT_MIN=${OUTPUT_BASE}/3_min \ # openembedded-core/scripts/test-dependencies.sh --tmpdir=tmp-eglibc --targets=glib-2.0 --recipes=recipe_list --buildtype=c echo "===== Compare dependencies recorded in \"${OUTPUT_MAX}\" and \"${OUTPUT_MIN}\" =====" - [ -n "${OUTPUTC}" ] || OUTPUTC=${OUTPUT_BASE} + [ -n "${OUTPUTC}" ] || OUTPUTC=${OUTPUT_BASE}/comp mkdir -p ${OUTPUTC} OUTPUT_FILE=${OUTPUTC}/dependency-changes echo "Differences will be stored in ${OUTPUT_FILE}, dot is shown for every 100 of checked packages" @@ -209,8 +223,12 @@ compare_deps() { find ${OUTPUT_MAX}/packages/ -name latest | sed "s#${OUTPUT_MAX}/##g" | while read pkg; do max_pkg=${OUTPUT_MAX}/${pkg} min_pkg=${OUTPUT_MIN}/${pkg} + # pkg=packages/armv5te-oe-linux-gnueabi/libungif/libungif/latest + recipe=`echo "${pkg}" | sed 's#packages/[^/]*/\([^/]*\)/\([^/]*\)/latest#\1#g'` + package=`echo "${pkg}" | sed 's#packages/[^/]*/\([^/]*\)/\([^/]*\)/latest#\2#g'` if [ ! -f "${min_pkg}" ] ; then - echo "ERROR: ${min_pkg} doesn't exist" | tee -a ${OUTPUT_FILE} + echo "ERROR: ${recipe}: ${package} package isn't created when building with minimal dependencies?" | tee -a ${OUTPUT_FILE} + echo ${recipe} >> ${OUTPUTC}/failed-recipes.log continue fi # strip version information in parenthesis @@ -222,26 +240,29 @@ compare_deps() { fi if [ "${max_deps}" = "${min_deps}" ] ; then # it's annoying long, but at least it's showing some progress, warnings are grepped at the end - echo "NOTE: ${pkg} dependencies weren't changed" >> ${OUTPUT_FILE} + echo "NOTE: ${recipe}: ${package} rdepends weren't changed" >> ${OUTPUT_FILE} else missing_deps= for dep in ${max_deps}; do - echo "${min_deps}" | grep -q " ${dep} " || missing_deps="${missing_deps} ${dep}" + if ! echo "${min_deps}" | grep -q " ${dep} " ; then + missing_deps="${missing_deps} ${dep}" + echo # to get rid of dots on last line + echo "WARN: ${recipe}: ${package} rdepends on ${dep}, but it isn't a build dependency?" | tee -a ${OUTPUT_FILE} + fi done if [ -n "${missing_deps}" ] ; then - echo # to get rid of dots on last line - echo "WARN: ${pkg} lost dependency on ${missing_deps}" | tee -a ${OUTPUT_FILE} + echo ${recipe} >> ${OUTPUTC}/failed-recipes.log fi fi i=`expr $i + 1` done echo # to get rid of dots on last line echo "Found differences: " - grep "^WARN: " ${OUTPUT_FILE} | tee ${OUTPUT_FILE}.warn + grep "^WARN: " ${OUTPUT_FILE} | tee ${OUTPUT_FILE}.warn.log echo "Found errors: " - grep "^ERROR: " ${OUTPUT_FILE} | tee ${OUTPUT_FILE}.error - # useful for reexecuting this script with only small subset of recipes with known issues - sed 's#.*[ /]packages/\([^/]*\)/\([^/]*\)/.*#\2#g' ${OUTPUT_FILE}.warn ${OUTPUT_FILE}.error | sort -u >> ${OUTPUT_BASE}/failed.recipes + grep "^ERROR: " ${OUTPUT_FILE} | tee ${OUTPUT_FILE}.error.log + RESULT+=`cat ${OUTPUT_FILE}.warn.log | wc -l` + RESULT+=`cat ${OUTPUT_FILE}.error.log | wc -l` } for TYPE in $buildtype; do @@ -254,3 +275,12 @@ for TYPE in $buildtype; do *) echo_error "Invalid buildtype \"$TYPE\"" esac done + +cat ${OUTPUT_BASE}/*/failed-recipes.log | sort -u >> ${OUTPUT_BASE}/failed-recipes.log + +if [ "${RESULT}" != "0" ] ; then + echo "ERROR: ${RESULT} issues were found in these recipes: `cat ${OUTPUT_BASE}/failed-recipes.log | xargs`" +fi + +echo "INFO: Output written in: ${OUTPUT_BASE}" +exit ${RESULT} diff --git a/scripts/test-remote-image b/scripts/test-remote-image new file mode 100755 index 0000000000..27b1cae38f --- /dev/null +++ b/scripts/test-remote-image @@ -0,0 +1,357 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2014 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# DESCRIPTION +# This script is used to test public autobuilder images on remote hardware. +# The script is called from a machine that is able download the images from the remote images repository and to connect to the test hardware. +# +# test-remote-image --image-type core-image-sato --repo-link http://192.168.10.2/images --required-packages rpm psplash +# +# Translation: Build the 'rpm' and 'pslash' packages and test a remote core-image-sato image using the http://192.168.10.2/images repository. +# +# You can also use the '-h' option to see some help information. + +import os +import sys +import argparse +import logging +import shutil +from abc import ABCMeta, abstractmethod + +# Add path to scripts/lib in sys.path; +scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] + +import scriptpath +import argparse_oe + +# Add meta/lib to sys.path +scriptpath.add_oe_lib_path() + +import oeqa.utils.ftools as ftools +from oeqa.utils.commands import runCmd, bitbake, get_bb_var + +# Add all lib paths relative to BBPATH to sys.path; this is used to find and import the target controllers. +for path in get_bb_var('BBPATH').split(":"): + sys.path.insert(0, os.path.abspath(os.path.join(path, 'lib'))) + +# In order to import modules that contain target controllers, we need the bitbake libraries in sys.path . +bitbakepath = scriptpath.add_bitbake_lib_path() +if not bitbakepath: + sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n") + sys.exit(1) + +# create a logger +def logger_create(): + log = logging.getLogger('hwauto') + log.setLevel(logging.DEBUG) + + fh = logging.FileHandler(filename='hwauto.log', mode='w') + fh.setLevel(logging.DEBUG) + + ch = logging.StreamHandler(sys.stdout) + ch.setLevel(logging.INFO) + + formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') + fh.setFormatter(formatter) + ch.setFormatter(formatter) + + log.addHandler(fh) + log.addHandler(ch) + + return log + +# instantiate the logger +log = logger_create() + + +# Define and return the arguments parser for the script +def get_args_parser(): + description = "This script is used to run automated runtime tests using remotely published image files. You should prepare the build environment just like building local images and running the tests." + parser = argparse_oe.ArgumentParser(description=description) + parser.add_argument('--image-types', required=True, action="store", nargs='*', dest="image_types", default=None, help='The image types to test(ex: core-image-minimal).') + parser.add_argument('--repo-link', required=True, action="store", type=str, dest="repo_link", default=None, help='The link to the remote images repository.') + parser.add_argument('--required-packages', required=False, action="store", nargs='*', dest="required_packages", default=None, help='Required packages for the tests. They will be built before the testing begins.') + parser.add_argument('--targetprofile', required=False, action="store", nargs=1, dest="targetprofile", default='AutoTargetProfile', help='The target profile to be used.') + parser.add_argument('--repoprofile', required=False, action="store", nargs=1, dest="repoprofile", default='PublicAB', help='The repo profile to be used.') + parser.add_argument('--skip-download', required=False, action="store_true", dest="skip_download", default=False, help='Skip downloading the images completely. This needs the correct files to be present in the directory specified by the target profile.') + return parser + +class BaseTargetProfile(object, metaclass=ABCMeta): + """ + This class defines the meta profile for a specific target (MACHINE type + image type). + """ + + def __init__(self, image_type): + self.image_type = image_type + + self.kernel_file = None + self.rootfs_file = None + self.manifest_file = None + self.extra_download_files = [] # Extra files (full name) to be downloaded. They should be situated in repo_link + + # This method is used as the standard interface with the target profile classes. + # It returns a dictionary containing a list of files and their meaning/description. + def get_files_dict(self): + files_dict = {} + + if self.kernel_file: + files_dict['kernel_file'] = self.kernel_file + else: + log.error('The target profile did not set a kernel file.') + sys.exit(1) + + if self.rootfs_file: + files_dict['rootfs_file'] = self.rootfs_file + else: + log.error('The target profile did not set a rootfs file.') + sys.exit(1) + + if self.manifest_file: + files_dict['manifest_file'] = self.manifest_file + else: + log.error('The target profile did not set a manifest file.') + sys.exit(1) + + for idx, f in enumerate(self.extra_download_files): + files_dict['extra_download_file' + str(idx)] = f + + return files_dict + +class AutoTargetProfile(BaseTargetProfile): + + def __init__(self, image_type): + super(AutoTargetProfile, self).__init__(image_type) + self.image_name = get_bb_var('IMAGE_LINK_NAME', target=image_type) + self.kernel_type = get_bb_var('KERNEL_IMAGETYPE', target=image_type) + self.controller = self.get_controller() + + self.set_kernel_file() + self.set_rootfs_file() + self.set_manifest_file() + self.set_extra_download_files() + + # Get the controller object that will be used by bitbake. + def get_controller(self): + from oeqa.controllers.testtargetloader import TestTargetLoader + + target_controller = get_bb_var('TEST_TARGET') + bbpath = get_bb_var('BBPATH').split(':') + + if target_controller == "qemu": + from oeqa.targetcontrol import QemuTarget + controller = QemuTarget + else: + testtargetloader = TestTargetLoader() + controller = testtargetloader.get_controller_module(target_controller, bbpath) + return controller + + def set_kernel_file(self): + postconfig = "QA_GET_MACHINE = \"${MACHINE}\"" + machine = get_bb_var('QA_GET_MACHINE', postconfig=postconfig) + self.kernel_file = self.kernel_type + '-' + machine + '.bin' + + def set_rootfs_file(self): + image_fstypes = get_bb_var('IMAGE_FSTYPES').split(' ') + # Get a matching value between target's IMAGE_FSTYPES and the image fstypes suppoerted by the target controller. + fstype = self.controller.match_image_fstype(d=None, image_fstypes=image_fstypes) + if fstype: + self.rootfs_file = self.image_name + '.' + fstype + else: + log.error("Could not get a compatible image fstype. Check that IMAGE_FSTYPES and the target controller's supported_image_fstypes fileds have common values.") + sys.exit(1) + + def set_manifest_file(self): + self.manifest_file = self.image_name + ".manifest" + + def set_extra_download_files(self): + self.extra_download_files = self.get_controller_extra_files() + if not self.extra_download_files: + self.extra_download_files = [] + + def get_controller_extra_files(self): + controller = self.get_controller() + return controller.get_extra_files() + + +class BaseRepoProfile(object, metaclass=ABCMeta): + """ + This class defines the meta profile for an images repository. + """ + + def __init__(self, repolink, localdir): + self.localdir = localdir + self.repolink = repolink + + # The following abstract methods are the interfaces to the repository profile classes derived from this abstract class. + + # This method should check the file named 'file_name' if it is different than the upstream one. + # Should return False if the image is the same as the upstream and True if it differs. + @abstractmethod + def check_old_file(self, file_name): + pass + + # This method should fetch file_name and create a symlink to localname if set. + @abstractmethod + def fetch(self, file_name, localname=None): + pass + +class PublicAB(BaseRepoProfile): + + def __init__(self, repolink, localdir=None): + super(PublicAB, self).__init__(repolink, localdir) + if localdir is None: + self.localdir = os.path.join(os.environ['BUILDDIR'], 'PublicABMirror') + + # Not yet implemented. Always returning True. + def check_old_file(self, file_name): + return True + + def get_repo_path(self): + path = '/machines/' + + postconfig = "QA_GET_MACHINE = \"${MACHINE}\"" + machine = get_bb_var('QA_GET_MACHINE', postconfig=postconfig) + if 'qemu' in machine: + path += 'qemu/' + + postconfig = "QA_GET_DISTRO = \"${DISTRO}\"" + distro = get_bb_var('QA_GET_DISTRO', postconfig=postconfig) + path += distro.replace('poky', machine) + '/' + return path + + + def fetch(self, file_name, localname=None): + repo_path = self.get_repo_path() + link = self.repolink + repo_path + file_name + + self.wget(link, self.localdir, localname) + + def wget(self, link, localdir, localname=None, extraargs=None): + wget_cmd = '/usr/bin/env wget -t 2 -T 30 -nv --passive-ftp --no-check-certificate ' + + if localname: + wget_cmd += ' -O ' + localname + ' ' + + if extraargs: + wget_cmd += ' ' + extraargs + ' ' + + wget_cmd += " -P %s '%s'" % (localdir, link) + runCmd(wget_cmd) + +class HwAuto(): + + def __init__(self, image_types, repolink, required_packages, targetprofile, repoprofile, skip_download): + log.info('Initializing..') + self.image_types = image_types + self.repolink = repolink + self.required_packages = required_packages + self.targetprofile = targetprofile + self.repoprofile = repoprofile + self.skip_download = skip_download + self.repo = self.get_repo_profile(self.repolink) + + # Get the repository profile; for now we only look inside this module. + def get_repo_profile(self, *args, **kwargs): + repo = getattr(sys.modules[__name__], self.repoprofile)(*args, **kwargs) + log.info("Using repo profile: %s" % repo.__class__.__name__) + return repo + + # Get the target profile; for now we only look inside this module. + def get_target_profile(self, *args, **kwargs): + target = getattr(sys.modules[__name__], self.targetprofile)(*args, **kwargs) + log.info("Using target profile: %s" % target.__class__.__name__) + return target + + # Run the testimage task on a build while redirecting DEPLOY_DIR_IMAGE to repo.localdir, where the images are downloaded. + def runTestimageBuild(self, image_type): + log.info("Running the runtime tests for %s.." % image_type) + postconfig = "DEPLOY_DIR_IMAGE = \"%s\"" % self.repo.localdir + result = bitbake("%s -c testimage" % image_type, ignore_status=True, postconfig=postconfig) + testimage_results = ftools.read_file(os.path.join(get_bb_var("T", image_type), "log.do_testimage")) + log.info('Runtime tests results for %s:' % image_type) + print(testimage_results) + return result + + # Start the procedure! + def run(self): + if self.required_packages: + # Build the required packages for the tests + log.info("Building the required packages: %s ." % ', '.join(map(str, self.required_packages))) + result = bitbake(self.required_packages, ignore_status=True) + if result.status != 0: + log.error("Could not build required packages: %s. Output: %s" % (self.required_packages, result.output)) + sys.exit(1) + + # Build the package repository meta data. + log.info("Building the package index.") + result = bitbake("package-index", ignore_status=True) + if result.status != 0: + log.error("Could not build 'package-index'. Output: %s" % result.output) + sys.exit(1) + + # Create the directory structure for the images to be downloaded + log.info("Creating directory structure %s" % self.repo.localdir) + if not os.path.exists(self.repo.localdir): + os.makedirs(self.repo.localdir) + + # For each image type, download the needed files and run the tests. + noissuesfound = True + for image_type in self.image_types: + if self.skip_download: + log.info("Skipping downloading the images..") + else: + target = self.get_target_profile(image_type) + files_dict = target.get_files_dict() + log.info("Downloading files for %s" % image_type) + for f in files_dict: + if self.repo.check_old_file(files_dict[f]): + filepath = os.path.join(self.repo.localdir, files_dict[f]) + if os.path.exists(filepath): + os.remove(filepath) + self.repo.fetch(files_dict[f]) + + result = self.runTestimageBuild(image_type) + if result.status != 0: + noissuesfound = False + + if noissuesfound: + log.info('Finished. No issues found.') + else: + log.error('Finished. Some runtime tests have failed. Returning non-0 status code.') + sys.exit(1) + + + +def main(): + + parser = get_args_parser() + args = parser.parse_args() + + hwauto = HwAuto(image_types=args.image_types, repolink=args.repo_link, required_packages=args.required_packages, targetprofile=args.targetprofile, repoprofile=args.repoprofile, skip_download=args.skip_download) + + hwauto.run() + +if __name__ == "__main__": + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc() + sys.exit(ret) diff --git a/scripts/tiny/dirsize.py b/scripts/tiny/dirsize.py new file mode 100755 index 0000000000..ddccc5a8c8 --- /dev/null +++ b/scripts/tiny/dirsize.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2011, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# +# Display details of the root filesystem size, broken up by directory. +# Allows for limiting by size to focus on the larger files. +# +# Author: Darren Hart <dvhart@linux.intel.com> +# + +import os +import sys +import stat + +class Record: + def create(path): + r = Record(path) + + s = os.lstat(path) + if stat.S_ISDIR(s.st_mode): + for p in os.listdir(path): + pathname = path + "/" + p + ss = os.lstat(pathname) + if not stat.S_ISLNK(ss.st_mode): + r.records.append(Record.create(pathname)) + r.size += r.records[-1].size + r.records.sort(reverse=True) + else: + r.size = os.lstat(path).st_size + + return r + create = staticmethod(create) + + def __init__(self, path): + self.path = path + self.size = 0 + self.records = [] + + def __lt__(this, that): + if that is None: + return False + if not isinstance(that, Record): + raise TypeError + if len(this.records) > 0 and len(that.records) == 0: + return False + if this.size > that.size: + return False + return True + + def show(self, minsize): + total = 0 + if self.size <= minsize: + return 0 + print("%10d %s" % (self.size, self.path)) + for r in self.records: + total += r.show(minsize) + if len(self.records) == 0: + total = self.size + return total + + +def main(): + minsize = 0 + if len(sys.argv) == 2: + minsize = int(sys.argv[1]) + rootfs = Record.create(".") + total = rootfs.show(minsize) + print("Displayed %d/%d bytes (%.2f%%)" % \ + (total, rootfs.size, 100 * float(total) / rootfs.size)) + + +if __name__ == "__main__": + main() diff --git a/scripts/tiny/ksize.py b/scripts/tiny/ksize.py new file mode 100755 index 0000000000..ea1ca7ff23 --- /dev/null +++ b/scripts/tiny/ksize.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2011, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# +# Display details of the kernel build size, broken up by built-in.o. Sort +# the objects by size. Run from the top level kernel build directory. +# +# Author: Darren Hart <dvhart@linux.intel.com> +# + +import sys +import getopt +import os +from subprocess import * + +def usage(): + prog = os.path.basename(sys.argv[0]) + print('Usage: %s [OPTION]...' % prog) + print(' -d, display an additional level of drivers detail') + print(' -h, --help display this help and exit') + print('') + print('Run %s from the top-level Linux kernel build directory.' % prog) + + +class Sizes: + def __init__(self, glob): + self.title = glob + p = Popen("size -t " + str(glob), shell=True, stdout=PIPE, stderr=PIPE) + output = p.communicate()[0].splitlines() + if len(output) > 2: + sizes = output[-1].split()[0:4] + self.text = int(sizes[0]) + self.data = int(sizes[1]) + self.bss = int(sizes[2]) + self.total = int(sizes[3]) + else: + self.text = self.data = self.bss = self.total = 0 + + def show(self, indent=""): + print("%-32s %10d | %10d %10d %10d" % \ + (indent+self.title, self.total, self.text, self.data, self.bss)) + + +class Report: + def create(filename, title, subglob=None): + r = Report(filename, title) + path = os.path.dirname(filename) + + p = Popen("ls " + str(path) + "/*.o | grep -v built-in.o", + shell=True, stdout=PIPE, stderr=PIPE) + glob = ' '.join(p.communicate()[0].splitlines()) + oreport = Report(glob, str(path) + "/*.o") + oreport.sizes.title = str(path) + "/*.o" + r.parts.append(oreport) + + if subglob: + p = Popen("ls " + subglob, shell=True, stdout=PIPE, stderr=PIPE) + for f in p.communicate()[0].splitlines(): + path = os.path.dirname(f) + r.parts.append(Report.create(f, path, str(path) + "/*/built-in.o")) + r.parts.sort(reverse=True) + + for b in r.parts: + r.totals["total"] += b.sizes.total + r.totals["text"] += b.sizes.text + r.totals["data"] += b.sizes.data + r.totals["bss"] += b.sizes.bss + + r.deltas["total"] = r.sizes.total - r.totals["total"] + r.deltas["text"] = r.sizes.text - r.totals["text"] + r.deltas["data"] = r.sizes.data - r.totals["data"] + r.deltas["bss"] = r.sizes.bss - r.totals["bss"] + return r + create = staticmethod(create) + + def __init__(self, glob, title): + self.glob = glob + self.title = title + self.sizes = Sizes(glob) + self.parts = [] + self.totals = {"total":0, "text":0, "data":0, "bss":0} + self.deltas = {"total":0, "text":0, "data":0, "bss":0} + + def show(self, indent=""): + rule = str.ljust(indent, 80, '-') + print("%-32s %10s | %10s %10s %10s" % \ + (indent+self.title, "total", "text", "data", "bss")) + print(rule) + self.sizes.show(indent) + print(rule) + for p in self.parts: + if p.sizes.total > 0: + p.sizes.show(indent) + print(rule) + print("%-32s %10d | %10d %10d %10d" % \ + (indent+"sum", self.totals["total"], self.totals["text"], + self.totals["data"], self.totals["bss"])) + print("%-32s %10d | %10d %10d %10d" % \ + (indent+"delta", self.deltas["total"], self.deltas["text"], + self.deltas["data"], self.deltas["bss"])) + print("\n") + + def __lt__(this, that): + if that is None: + return 1 + if not isinstance(that, Report): + raise TypeError + return this.sizes.total < that.sizes.total + + def __cmp__(this, that): + if that is None: + return 1 + if not isinstance(that, Report): + raise TypeError + if this.sizes.total < that.sizes.total: + return -1 + if this.sizes.total > that.sizes.total: + return 1 + return 0 + + +def main(): + try: + opts, args = getopt.getopt(sys.argv[1:], "dh", ["help"]) + except getopt.GetoptError as err: + print('%s' % str(err)) + usage() + sys.exit(2) + + driver_detail = False + for o, a in opts: + if o == '-d': + driver_detail = True + elif o in ('-h', '--help'): + usage() + sys.exit(0) + else: + assert False, "unhandled option" + + glob = "arch/*/built-in.o */built-in.o" + vmlinux = Report.create("vmlinux", "Linux Kernel", glob) + + vmlinux.show() + for b in vmlinux.parts: + if b.totals["total"] > 0 and len(b.parts) > 1: + b.show() + if b.title == "drivers" and driver_detail: + for d in b.parts: + if d.totals["total"] > 0 and len(d.parts) > 1: + d.show(" ") + + +if __name__ == "__main__": + main() diff --git a/scripts/tiny/ksum.py b/scripts/tiny/ksum.py new file mode 100755 index 0000000000..d4f3892156 --- /dev/null +++ b/scripts/tiny/ksum.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2016, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION 'ksum.py' generates a combined summary of vmlinux and +# module sizes for a built kernel, as a quick tool for comparing the +# overall effects of systemic tinification changes. Execute from the +# base directory of the kernel build you want to summarize. Setting +# the 'verbose' flag will display the sizes for each file included in +# the summary. +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# + +__version__ = "0.1.0" + +# Python Standard Library modules +import os +import sys +import getopt +from subprocess import * + +def usage(): + prog = os.path.basename(sys.argv[0]) + print('Usage: %s [OPTION]...' % prog) + print(' -v, display sizes for each file') + print(' -h, --help display this help and exit') + print('') + print('Run %s from the top-level Linux kernel build directory.' % prog) + +verbose = False + +n_ko_files = 0 +ko_file_list = [] + +ko_text = 0 +ko_data = 0 +ko_bss = 0 +ko_total = 0 + +vmlinux_file = "" +vmlinux_level = 0 + +vmlinux_text = 0 +vmlinux_data = 0 +vmlinux_bss = 0 +vmlinux_total = 0 + +def is_vmlinux_file(filename): + global vmlinux_level + if filename == ("vmlinux") and vmlinux_level == 0: + vmlinux_level += 1 + return True + return False + +def is_ko_file(filename): + if filename.endswith(".ko"): + return True + return False + +def collect_object_files(): + print "Collecting object files recursively from %s..." % os.getcwd() + for dirpath, dirs, files in os.walk(os.getcwd()): + for filename in files: + if is_ko_file(filename): + ko_file_list.append(os.path.join(dirpath, filename)) + elif is_vmlinux_file(filename): + global vmlinux_file + vmlinux_file = os.path.join(dirpath, filename) + print "Collecting object files [DONE]" + +def add_ko_file(filename): + p = Popen("size -t " + filename, shell=True, stdout=PIPE, stderr=PIPE) + output = p.communicate()[0].splitlines() + if len(output) > 2: + sizes = output[-1].split()[0:4] + if verbose: + print " %10d %10d %10d %10d\t" % \ + (int(sizes[0]), int(sizes[1]), int(sizes[2]), int(sizes[3])), + print "%s" % filename[len(os.getcwd()) + 1:] + global n_ko_files, ko_text, ko_data, ko_bss, ko_total + ko_text += int(sizes[0]) + ko_data += int(sizes[1]) + ko_bss += int(sizes[2]) + ko_total += int(sizes[3]) + n_ko_files += 1 + +def get_vmlinux_totals(): + p = Popen("size -t " + vmlinux_file, shell=True, stdout=PIPE, stderr=PIPE) + output = p.communicate()[0].splitlines() + if len(output) > 2: + sizes = output[-1].split()[0:4] + if verbose: + print " %10d %10d %10d %10d\t" % \ + (int(sizes[0]), int(sizes[1]), int(sizes[2]), int(sizes[3])), + print "%s" % vmlinux_file[len(os.getcwd()) + 1:] + global vmlinux_text, vmlinux_data, vmlinux_bss, vmlinux_total + vmlinux_text += int(sizes[0]) + vmlinux_data += int(sizes[1]) + vmlinux_bss += int(sizes[2]) + vmlinux_total += int(sizes[3]) + +def sum_ko_files(): + for ko_file in ko_file_list: + add_ko_file(ko_file) + +def main(): + try: + opts, args = getopt.getopt(sys.argv[1:], "vh", ["help"]) + except getopt.GetoptError as err: + print('%s' % str(err)) + usage() + sys.exit(2) + + for o, a in opts: + if o == '-v': + global verbose + verbose = True + elif o in ('-h', '--help'): + usage() + sys.exit(0) + else: + assert False, "unhandled option" + + collect_object_files() + sum_ko_files() + get_vmlinux_totals() + + print "\nTotals:" + print "\nvmlinux:" + print " text\tdata\t\tbss\t\ttotal" + print " %-10d\t%-10d\t%-10d\t%-10d" % \ + (vmlinux_text, vmlinux_data, vmlinux_bss, vmlinux_total) + print "\nmodules (%d):" % n_ko_files + print " text\tdata\t\tbss\t\ttotal" + print " %-10d\t%-10d\t%-10d\t%-10d" % \ + (ko_text, ko_data, ko_bss, ko_total) + print "\nvmlinux + modules:" + print " text\tdata\t\tbss\t\ttotal" + print " %-10d\t%-10d\t%-10d\t%-10d" % \ + (vmlinux_text + ko_text, vmlinux_data + ko_data, \ + vmlinux_bss + ko_bss, vmlinux_total + ko_total) + +if __name__ == "__main__": + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc(5) + sys.exit(ret) diff --git a/scripts/verify-bashisms b/scripts/verify-bashisms new file mode 100755 index 0000000000..dab64ef501 --- /dev/null +++ b/scripts/verify-bashisms @@ -0,0 +1,148 @@ +#!/usr/bin/env python3 + +import sys, os, subprocess, re, shutil + +whitelist = ( + # type is supported by dash + 'if type systemctl >/dev/null 2>/dev/null; then', + 'if type systemd-tmpfiles >/dev/null 2>/dev/null; then', + 'type update-rc.d >/dev/null 2>/dev/null; then', + 'command -v', + # HOSTNAME is set locally + 'buildhistory_single_commit "$CMDLINE" "$HOSTNAME"', + # False-positive, match is a grep not shell expression + 'grep "^$groupname:[^:]*:[^:]*:\\([^,]*,\\)*$username\\(,[^,]*\\)*"', + # TODO verify dash's '. script args' behaviour + '. $target_sdk_dir/${oe_init_build_env_path} $target_sdk_dir >> $LOGFILE' + ) + +def is_whitelisted(s): + for w in whitelist: + if w in s: + return True + return False + +SCRIPT_LINENO_RE = re.compile(r' line (\d+) ') +BASHISM_WARNING = re.compile(r'^(possible bashism in.*)$', re.MULTILINE) + +def process(filename, function, lineno, script): + import tempfile + + if not script.startswith("#!"): + script = "#! /bin/sh\n" + script + + fn = tempfile.NamedTemporaryFile(mode="w+t") + fn.write(script) + fn.flush() + + try: + subprocess.check_output(("checkbashisms.pl", fn.name), universal_newlines=True, stderr=subprocess.STDOUT) + # No bashisms, so just return + return + except subprocess.CalledProcessError as e: + # TODO check exit code is 1 + + # Replace the temporary filename with the function and split it + output = e.output.replace(fn.name, function) + if not output or not output.startswith('possible bashism'): + # Probably starts with or contains only warnings. Dump verbatim + # with one space indention. Can't do the splitting and whitelist + # checking below. + return '\n'.join([filename, + ' Unexpected output from checkbashisms.pl'] + + [' ' + x for x in output.splitlines()]) + + # We know that the first line matches and that therefore the first + # list entry will be empty - skip it. + output = BASHISM_WARNING.split(output)[1:] + # Turn the output into a single string like this: + # /.../foobar.bb + # possible bashism in updatercd_postrm line 2 (type): + # if ${@use_updatercd(d)} && type update-rc.d >/dev/null 2>/dev/null; then + # ... + # ... + result = [] + # Check the results against the whitelist + for message, source in zip(output[0::2], output[1::2]): + if not is_whitelisted(source): + if lineno is not None: + message = SCRIPT_LINENO_RE.sub(lambda m: ' line %d ' % (int(m.group(1)) + int(lineno) - 1), + message) + result.append(' ' + message.strip()) + result.extend([' %s' % x for x in source.splitlines()]) + if result: + result.insert(0, filename) + return '\n'.join(result) + else: + return None + +def get_tinfoil(): + scripts_path = os.path.dirname(os.path.realpath(__file__)) + lib_path = scripts_path + '/lib' + sys.path = sys.path + [lib_path] + import scriptpath + scriptpath.add_bitbake_lib_path() + import bb.tinfoil + tinfoil = bb.tinfoil.Tinfoil() + tinfoil.prepare() + # tinfoil.logger.setLevel(logging.WARNING) + return tinfoil + +if __name__=='__main__': + import shutil + if shutil.which("checkbashisms.pl") is None: + print("Cannot find checkbashisms.pl on $PATH, get it from https://anonscm.debian.org/cgit/collab-maint/devscripts.git/plain/scripts/checkbashisms.pl") + sys.exit(1) + + # The order of defining the worker function, + # initializing the pool and connecting to the + # bitbake server is crucial, don't change it. + def func(item): + (filename, key, lineno), script = item + return process(filename, key, lineno, script) + + import multiprocessing + pool = multiprocessing.Pool() + + tinfoil = get_tinfoil() + + # This is only the default configuration and should iterate over + # recipecaches to handle multiconfig environments + pkg_pn = tinfoil.cooker.recipecaches[""].pkg_pn + + # TODO: use argparse and have --help + if len(sys.argv) > 1: + initial_pns = sys.argv[1:] + else: + initial_pns = sorted(pkg_pn) + + pns = set() + scripts = {} + print("Generating scripts...") + for pn in initial_pns: + for fn in pkg_pn[pn]: + # There's no point checking multiple BBCLASSEXTENDed variants of the same recipe + # (at least in general - there is some risk that the variants contain different scripts) + realfn, _, _ = bb.cache.virtualfn2realfn(fn) + if realfn not in pns: + pns.add(realfn) + data = tinfoil.parse_recipe_file(realfn) + for key in data.keys(): + if data.getVarFlag(key, "func") and not data.getVarFlag(key, "python"): + script = data.getVar(key, False) + if script: + filename = data.getVarFlag(key, "filename") + lineno = data.getVarFlag(key, "lineno") + # There's no point in checking a function multiple + # times just because different recipes include it. + # We identify unique scripts by file, name, and (just in case) + # line number. + attributes = (filename or realfn, key, lineno) + scripts.setdefault(attributes, script) + + + print("Scanning scripts...\n") + for result in pool.imap(func, scripts.items()): + if result: + print(result) + tinfoil.shutdown() diff --git a/scripts/wic b/scripts/wic new file mode 100755 index 0000000000..a5f2dbfc6f --- /dev/null +++ b/scripts/wic @@ -0,0 +1,330 @@ +#!/usr/bin/env python3 +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2013, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# DESCRIPTION 'wic' is the OpenEmbedded Image Creator that users can +# use to generate bootable images. Invoking it without any arguments +# will display help screens for the 'wic' command and list the +# available 'wic' subcommands. Invoking a subcommand without any +# arguments will likewise display help screens for the specified +# subcommand. Please use that interface for detailed help. +# +# AUTHORS +# Tom Zanussi <tom.zanussi (at] linux.intel.com> +# +__version__ = "0.2.0" + +# Python Standard Library modules +import os +import sys +import optparse +import logging +from distutils import spawn + +# External modules +scripts_path = os.path.abspath(os.path.dirname(__file__)) +lib_path = scripts_path + '/lib' +sys.path.insert(0, lib_path) +oe_lib_path = os.path.join(os.path.dirname(scripts_path), 'meta', 'lib') +sys.path.insert(0, oe_lib_path) + +bitbake_exe = spawn.find_executable('bitbake') +if bitbake_exe: + bitbake_path = os.path.join(os.path.dirname(bitbake_exe), '../lib') + sys.path.insert(0, bitbake_path) + from bb import cookerdata + from bb.main import bitbake_main, BitBakeConfigParameters +else: + bitbake_main = None + +from wic import WicError +from wic.utils.misc import get_bitbake_var, BB_VARS +from wic import engine +from wic import help as hlp + + +def wic_logger(): + """Create and convfigure wic logger.""" + logger = logging.getLogger('wic') + logger.setLevel(logging.INFO) + + handler = logging.StreamHandler() + + formatter = logging.Formatter('%(levelname)s: %(message)s') + handler.setFormatter(formatter) + + logger.addHandler(handler) + + return logger + +logger = wic_logger() + +def rootfs_dir_to_args(krootfs_dir): + """ + Get a rootfs_dir dict and serialize to string + """ + rootfs_dir = '' + for key, val in krootfs_dir.items(): + rootfs_dir += ' ' + rootfs_dir += '='.join([key, val]) + return rootfs_dir.strip() + +def callback_rootfs_dir(option, opt, value, parser): + """ + Build a dict using --rootfs_dir connection=dir + """ + if not type(parser.values.rootfs_dir) is dict: + parser.values.rootfs_dir = dict() + + if '=' in value: + (key, rootfs_dir) = value.split('=') + else: + key = 'ROOTFS_DIR' + rootfs_dir = value + + parser.values.rootfs_dir[key] = rootfs_dir + +def wic_create_subcommand(args, usage_str): + """ + Command-line handling for image creation. The real work is done + by image.engine.wic_create() + """ + parser = optparse.OptionParser(usage=usage_str) + + parser.add_option("-o", "--outdir", dest="outdir", default='.', + help="name of directory to create image in") + parser.add_option("-e", "--image-name", dest="image_name", + help="name of the image to use the artifacts from " + "e.g. core-image-sato") + parser.add_option("-r", "--rootfs-dir", dest="rootfs_dir", type="string", + action="callback", callback=callback_rootfs_dir, + help="path to the /rootfs dir to use as the " + ".wks rootfs source") + parser.add_option("-b", "--bootimg-dir", dest="bootimg_dir", + help="path to the dir containing the boot artifacts " + "(e.g. /EFI or /syslinux dirs) to use as the " + ".wks bootimg source") + parser.add_option("-k", "--kernel-dir", dest="kernel_dir", + help="path to the dir containing the kernel to use " + "in the .wks bootimg") + parser.add_option("-n", "--native-sysroot", dest="native_sysroot", + help="path to the native sysroot containing the tools " + "to use to build the image") + parser.add_option("-s", "--skip-build-check", dest="build_check", + action="store_false", default=True, help="skip the build check") + parser.add_option("-f", "--build-rootfs", action="store_true", help="build rootfs") + parser.add_option("-c", "--compress-with", choices=("gzip", "bzip2", "xz"), + dest='compressor', + help="compress image with specified compressor") + parser.add_option("-m", "--bmap", action="store_true", help="generate .bmap") + parser.add_option("-v", "--vars", dest='vars_dir', + help="directory with <image>.env files that store " + "bitbake variables") + parser.add_option("-D", "--debug", dest="debug", action="store_true", + default=False, help="output debug information") + + (options, args) = parser.parse_args(args) + + if len(args) != 1: + parser.print_help() + raise WicError("Wrong number of arguments, exiting") + + if options.build_rootfs and not bitbake_main: + raise WicError("Can't build rootfs as bitbake is not in the $PATH") + + if not options.image_name: + missed = [] + for val, opt in [(options.rootfs_dir, 'rootfs-dir'), + (options.bootimg_dir, 'bootimg-dir'), + (options.kernel_dir, 'kernel-dir'), + (options.native_sysroot, 'native-sysroot')]: + if not val: + missed.append(opt) + if missed: + raise WicError("The following build artifacts are not specified: %s" % + ", ".join(missed)) + + if options.image_name: + BB_VARS.default_image = options.image_name + else: + options.build_check = False + + if options.vars_dir: + BB_VARS.vars_dir = options.vars_dir + + if options.build_check and not engine.verify_build_env(): + raise WicError("Couldn't verify build environment, exiting") + + if options.debug: + logger.setLevel(logging.DEBUG) + + if options.image_name: + if options.build_rootfs: + argv = ["bitbake", options.image_name] + if options.debug: + argv.append("--debug") + + logger.info("Building rootfs...\n") + if bitbake_main(BitBakeConfigParameters(argv), + cookerdata.CookerConfiguration()): + raise WicError("bitbake exited with error") + + rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", options.image_name) + kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE", options.image_name) + bootimg_dir = get_bitbake_var("STAGING_DATADIR", options.image_name) + native_sysroot = get_bitbake_var("RECIPE_SYSROOT_NATIVE", + options.image_name) #, cache=False) + else: + if options.build_rootfs: + raise WicError("Image name is not specified, exiting. " + "(Use -e/--image-name to specify it)") + native_sysroot = options.native_sysroot + + if not native_sysroot or not os.path.isdir(native_sysroot): + logger.info("Building wic-tools...\n") + if bitbake_main(BitBakeConfigParameters("bitbake wic-tools".split()), + cookerdata.CookerConfiguration()): + raise WicError("bitbake wic-tools failed") + native_sysroot = get_bitbake_var("RECIPE_SYSROOT_NATIVE", "wic-tools") + if not native_sysroot: + raise WicError("Unable to find the location of the native " + "tools sysroot to use") + + wks_file = args[0] + + if not wks_file.endswith(".wks"): + wks_file = engine.find_canned_image(scripts_path, wks_file) + if not wks_file: + raise WicError("No image named %s found, exiting. (Use 'wic list images' " + "to list available images, or specify a fully-qualified OE " + "kickstart (.wks) filename)" % args[0]) + + if not options.image_name: + rootfs_dir = '' + if 'ROOTFS_DIR' in options.rootfs_dir: + rootfs_dir = options.rootfs_dir['ROOTFS_DIR'] + bootimg_dir = options.bootimg_dir + kernel_dir = options.kernel_dir + native_sysroot = options.native_sysroot + if rootfs_dir and not os.path.isdir(rootfs_dir): + raise WicError("--rootfs-dir (-r) not found, exiting") + if not os.path.isdir(bootimg_dir): + raise WicError("--bootimg-dir (-b) not found, exiting") + if not os.path.isdir(kernel_dir): + raise WicError("--kernel-dir (-k) not found, exiting") + if not os.path.isdir(native_sysroot): + raise WicError("--native-sysroot (-n) not found, exiting") + else: + not_found = not_found_dir = "" + if not os.path.isdir(rootfs_dir): + (not_found, not_found_dir) = ("rootfs-dir", rootfs_dir) + elif not os.path.isdir(kernel_dir): + (not_found, not_found_dir) = ("kernel-dir", kernel_dir) + elif not os.path.isdir(native_sysroot): + (not_found, not_found_dir) = ("native-sysroot", native_sysroot) + if not_found: + if not not_found_dir: + not_found_dir = "Completely missing artifact - wrong image (.wks) used?" + logger.info("Build artifacts not found, exiting.") + logger.info(" (Please check that the build artifacts for the machine") + logger.info(" selected in local.conf actually exist and that they") + logger.info(" are the correct artifacts for the image (.wks file)).\n") + raise WicError("The artifact that couldn't be found was %s:\n %s", not_found, not_found_dir) + + krootfs_dir = options.rootfs_dir + if krootfs_dir is None: + krootfs_dir = {} + krootfs_dir['ROOTFS_DIR'] = rootfs_dir + + rootfs_dir = rootfs_dir_to_args(krootfs_dir) + + logger.info("Creating image(s)...\n") + engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, + native_sysroot, options) + + +def wic_list_subcommand(args, usage_str): + """ + Command-line handling for listing available images. + The real work is done by image.engine.wic_list() + """ + parser = optparse.OptionParser(usage=usage_str) + args = parser.parse_args(args)[1] + + if not engine.wic_list(args, scripts_path): + parser.print_help() + raise WicError("Bad list arguments, exiting") + + +def wic_help_topic_subcommand(args, usage_str): + """ + Command-line handling for help-only 'subcommands'. This is + essentially a dummy command that doesn nothing but allow users to + use the existing subcommand infrastructure to display help on a + particular topic not attached to any particular subcommand. + """ + pass + + +wic_help_topic_usage = """ +""" + +subcommands = { + "create": [wic_create_subcommand, + hlp.wic_create_usage, + hlp.wic_create_help], + "list": [wic_list_subcommand, + hlp.wic_list_usage, + hlp.wic_list_help], + "plugins": [wic_help_topic_subcommand, + wic_help_topic_usage, + hlp.get_wic_plugins_help], + "overview": [wic_help_topic_subcommand, + wic_help_topic_usage, + hlp.wic_overview_help], + "kickstart": [wic_help_topic_subcommand, + wic_help_topic_usage, + hlp.wic_kickstart_help], +} + + +def main(argv): + parser = optparse.OptionParser(version="wic version %s" % __version__, + usage=hlp.wic_usage) + + parser.disable_interspersed_args() + + args = parser.parse_args(argv)[1] + + if len(args): + if args[0] == "help": + if len(args) == 1: + parser.print_help() + raise WicError("help command requires parameter") + + return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands) + + +if __name__ == "__main__": + try: + sys.exit(main(sys.argv[1:])) + except WicError as err: + print() + logger.error(err) + sys.exit(1) diff --git a/scripts/wipe-sysroot b/scripts/wipe-sysroot deleted file mode 100755 index 2d2cbeac8c..0000000000 --- a/scripts/wipe-sysroot +++ /dev/null @@ -1,44 +0,0 @@ -#! /bin/sh - -# Wipe out all of the sysroots and all of the stamps that populated it. -# Author: Ross Burton <ross.burton@intel.com> -# -# Copyright (c) 2012 Intel Corporation -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -set -e - -ENVS=`mktemp --suffix -wipe-sysroot-envs` -bitbake -p -e > $ENVS - -eval `grep -F SSTATE_MANIFESTS= $ENVS` -eval `grep -F STAGING_DIR= $ENVS` -eval `grep -F STAMPS_DIR= $ENVS` -rm -f $ENVS - -if [ -z "$SSTATE_MANIFESTS" -o -z "$STAGING_DIR" -o -z "$STAMPS_DIR" ]; then - echo "Could not determine SSTATE_MANIFESTS/STAGING_DIR/STAMPS_DIR, check above for errors" - exit 1 -fi - -# The sysroots themselves -rm -rf "$STAGING_DIR" - -# The stamps that said the sysroot was populated -rm -rf "$STAMPS_DIR/*/*/*.do_populate_sysroot.*" -rm -rf "$STAMPS_DIR/*/*/*.do_populate_sysroot_setscene.*" - -# The sstate manifests -rm -rf "$SSTATE_MANIFESTS/manifest-*.populate-sysroot" diff --git a/scripts/yocto-compat-layer-wrapper b/scripts/yocto-compat-layer-wrapper new file mode 100755 index 0000000000..db4b6871b8 --- /dev/null +++ b/scripts/yocto-compat-layer-wrapper @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Yocto Project compatibility layer tool wrapper +# +# Creates a temprary build directory to run Yocto Project Compatible +# script to avoid a contaminated environment. +# +# Copyright (C) 2017 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +if [ -z "$BUILDDIR" ]; then + echo "Please source oe-init-build-env before run this script." + exit 2 +fi + +base_dir=$(realpath $BUILDDIR/../) +cd $base_dir + +build_dir=$(mktemp -p $base_dir -d -t build-XXXX) + +source oe-init-build-env $build_dir +yocto-compat-layer.py "$@" +retcode=$? + +rm -rf $build_dir + +exit $retcode diff --git a/scripts/yocto-compat-layer.py b/scripts/yocto-compat-layer.py new file mode 100755 index 0000000000..0d5700b538 --- /dev/null +++ b/scripts/yocto-compat-layer.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python3 + +# Yocto Project compatibility layer tool +# +# Copyright (C) 2017 Intel Corporation +# Released under the MIT license (see COPYING.MIT) + +import os +import sys +import argparse +import logging +import time +import signal +import shutil +import collections + +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptutils +import scriptpath +scriptpath.add_oe_lib_path() +scriptpath.add_bitbake_lib_path() + +from compatlayer import LayerType, detect_layers, add_layer, add_layer_dependencies, get_signatures +from oeqa.utils.commands import get_bb_vars + +PROGNAME = 'yocto-compat-layer' +CASES_PATHS = [os.path.join(os.path.abspath(os.path.dirname(__file__)), + 'lib', 'compatlayer', 'cases')] +logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout) + +def test_layer_compatibility(td, layer): + from compatlayer.context import CompatLayerTestContext + logger.info("Starting to analyze: %s" % layer['name']) + logger.info("----------------------------------------------------------------------") + + tc = CompatLayerTestContext(td=td, logger=logger, layer=layer) + tc.loadTests(CASES_PATHS) + return tc.runTests() + +def main(): + parser = argparse.ArgumentParser( + description="Yocto Project compatibility layer tool", + add_help=False) + parser.add_argument('layers', metavar='LAYER_DIR', nargs='+', + help='Layer to test compatibility with Yocto Project') + parser.add_argument('-o', '--output-log', + help='File to output log (optional)', action='store') + parser.add_argument('--dependency', nargs="+", + help='Layers to process for dependencies', action='store') + parser.add_argument('--machines', nargs="+", + help='List of MACHINEs to be used during testing', action='store') + parser.add_argument('--additional-layers', nargs="+", + help='List of additional layers to add during testing', action='store') + parser.add_argument('-n', '--no-auto', help='Disable auto layer discovery', + action='store_true') + parser.add_argument('-d', '--debug', help='Enable debug output', + action='store_true') + parser.add_argument('-q', '--quiet', help='Print only errors', + action='store_true') + + parser.add_argument('-h', '--help', action='help', + default=argparse.SUPPRESS, + help='show this help message and exit') + + args = parser.parse_args() + + if args.output_log: + fh = logging.FileHandler(args.output_log) + fh.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) + logger.addHandler(fh) + if args.debug: + logger.setLevel(logging.DEBUG) + elif args.quiet: + logger.setLevel(logging.ERROR) + + if not 'BUILDDIR' in os.environ: + logger.error("You must source the environment before run this script.") + logger.error("$ source oe-init-build-env") + return 1 + builddir = os.environ['BUILDDIR'] + bblayersconf = os.path.join(builddir, 'conf', 'bblayers.conf') + + layers = detect_layers(args.layers, args.no_auto) + if not layers: + logger.error("Fail to detect layers") + return 1 + if args.additional_layers: + additional_layers = detect_layers(args.additional_layers, args.no_auto) + else: + additional_layers = [] + if args.dependency: + dep_layers = detect_layers(args.dependency, args.no_auto) + dep_layers = dep_layers + layers + else: + dep_layers = layers + + logger.info("Detected layers:") + for layer in layers: + if layer['type'] == LayerType.ERROR_BSP_DISTRO: + logger.error("%s: Can't be DISTRO and BSP type at the same time."\ + " The conf/distro and conf/machine folders was found."\ + % layer['name']) + layers.remove(layer) + elif layer['type'] == LayerType.ERROR_NO_LAYER_CONF: + logger.error("%s: Don't have conf/layer.conf file."\ + % layer['name']) + layers.remove(layer) + else: + logger.info("%s: %s, %s" % (layer['name'], layer['type'], + layer['path'])) + if not layers: + return 1 + + shutil.copyfile(bblayersconf, bblayersconf + '.backup') + def cleanup_bblayers(signum, frame): + shutil.copyfile(bblayersconf + '.backup', bblayersconf) + os.unlink(bblayersconf + '.backup') + signal.signal(signal.SIGTERM, cleanup_bblayers) + signal.signal(signal.SIGINT, cleanup_bblayers) + + td = {} + results = collections.OrderedDict() + results_status = collections.OrderedDict() + + layers_tested = 0 + for layer in layers: + if layer['type'] == LayerType.ERROR_NO_LAYER_CONF or \ + layer['type'] == LayerType.ERROR_BSP_DISTRO: + continue + + logger.info('') + logger.info("Setting up for %s(%s), %s" % (layer['name'], layer['type'], + layer['path'])) + + shutil.copyfile(bblayersconf + '.backup', bblayersconf) + + missing_dependencies = not add_layer_dependencies(bblayersconf, layer, dep_layers, logger) + if not missing_dependencies: + for additional_layer in additional_layers: + if not add_layer_dependencies(bblayersconf, additional_layer, dep_layers, logger): + missing_dependencies = True + break + if not add_layer_dependencies(bblayersconf, layer, dep_layers, logger) or \ + any(map(lambda additional_layer: not add_layer_dependencies(bblayersconf, additional_layer, dep_layers, logger), + additional_layers)): + logger.info('Skipping %s due to missing dependencies.' % layer['name']) + results[layer['name']] = None + results_status[layer['name']] = 'SKIPPED (Missing dependencies)' + layers_tested = layers_tested + 1 + continue + + if any(map(lambda additional_layer: not add_layer(bblayersconf, additional_layer, dep_layers, logger), + additional_layers)): + logger.info('Skipping %s due to missing additional layers.' % layer['name']) + results[layer['name']] = None + results_status[layer['name']] = 'SKIPPED (Missing additional layers)' + layers_tested = layers_tested + 1 + continue + + logger.info('Getting initial bitbake variables ...') + td['bbvars'] = get_bb_vars() + logger.info('Getting initial signatures ...') + td['builddir'] = builddir + td['sigs'], td['tunetasks'] = get_signatures(td['builddir']) + td['machines'] = args.machines + + if not add_layer(bblayersconf, layer, dep_layers, logger): + logger.info('Skipping %s ???.' % layer['name']) + results[layer['name']] = None + results_status[layer['name']] = 'SKIPPED (Unknown)' + layers_tested = layers_tested + 1 + continue + + result = test_layer_compatibility(td, layer) + results[layer['name']] = result + results_status[layer['name']] = 'PASS' if results[layer['name']].wasSuccessful() else 'FAIL' + layers_tested = layers_tested + 1 + + if layers_tested: + logger.info('') + logger.info('Summary of results:') + logger.info('') + for layer_name in results_status: + logger.info('%s ... %s' % (layer_name, results_status[layer_name])) + + cleanup_bblayers(None, None) + + return 0 + +if __name__ == '__main__': + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc() + sys.exit(ret) |
