diff options
Diffstat (limited to 'scripts')
209 files changed, 20089 insertions, 29615 deletions
diff --git a/scripts/bitbake-prserv-tool b/scripts/bitbake-prserv-tool index 28c2416bfe..fa31b52584 100755 --- a/scripts/bitbake-prserv-tool +++ b/scripts/bitbake-prserv-tool @@ -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 55cfe4b234..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,7 +24,7 @@ import shutil import re import warnings import subprocess -from optparse import OptionParser +import argparse scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) lib_path = scripts_path + '/lib' @@ -38,6 +37,8 @@ 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 none %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 dfebcddf72..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(): @@ -33,6 +33,12 @@ def main(): 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) @@ -46,6 +52,11 @@ 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) @@ -81,7 +92,7 @@ def main(): import gitdb try: - changes = oe.buildhistory_analysis.process_changes(options.buildhistory_dir, fromrev, torev, options.report_all, options.report_ver) + 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 a7f5a3a667..0000000000 --- a/scripts/cleanup-workdir +++ /dev/null @@ -1,198 +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 + '/(.*?)/' - - cmd = "bitbake -e | grep ^SDK_ARCH=" - output = run_command(cmd) - sdk_arch = output.split('"')[1] - - # select thest 5 packages to get the dirs of current arch - pkgs = ['hicolor-icon-theme', 'base-files', 'acl-native', 'binutils-crosssdk-' + sdk_arch, '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. Remove 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 851003d855..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,13 +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" @@ -68,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 @@ -93,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) @@ -109,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 @@ -122,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"] @@ -134,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: @@ -145,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): @@ -177,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'] @@ -192,19 +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) 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: @@ -234,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: @@ -271,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' \ @@ -278,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 @@ -316,10 +570,10 @@ def get_repos(conf, repo_names): for repo in repos: if not repo in conf.repos: logger.error("Specified component '%s' not found in configuration" % repo) - sys.exit(0) + 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 @@ -337,32 +591,65 @@ 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 """ components = [arg.split(':')[0] for arg in args[1:]] - revisions = [] + revisions = {} for arg in args[1:]: - revision= arg.split(':', 1)[1] if ':' in arg else None - revisions.append(revision) - # Map commitishes to repos - repos = OrderedDict(zip(get_repos(conf, components), revisions)) + 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() - if not os.path.exists(patch_dir): - 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: @@ -370,7 +657,19 @@ def action_update(conf, args): else: action_pull(conf, ['arg0'] + components) - for name, revision in repos.iteritems(): + 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'] @@ -396,7 +695,14 @@ def action_update(conf, args): 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) @@ -431,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) @@ -445,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): """ @@ -469,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) @@ -480,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) @@ -493,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) @@ -544,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]) @@ -579,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 @@ -605,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/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 cdd7885dca..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" @@ -180,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 @@ -206,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 @@ -350,6 +353,33 @@ test3 () { 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! @@ -359,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 a503f11d0d..ab929957a5 100755 --- a/scripts/contrib/ddimage +++ b/scripts/contrib/ddimage @@ -100,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/graph-tool b/scripts/contrib/graph-tool index 6dc7d337f8..1df5b8c345 100755 --- a/scripts/contrib/graph-tool +++ b/scripts/contrib/graph-tool @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Simple graph query utility # useful for getting answers from .dot files produced by bitbake -g @@ -30,8 +30,7 @@ def get_path_networkx(dotfile, fromnode, tonode): print('ERROR: Please install the networkx python module') sys.exit(1) - graph = networkx.DiGraph(networkx.read_dot(dotfile)) - + 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) @@ -53,11 +52,11 @@ def find_paths(args, usage): fromnode = args[1] tonode = args[2] - paths = list(get_path_networkx(args[0], fromnode, tonode)) - if paths: - for path in paths: - print ' -> '.join(path) - else: + + 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) diff --git a/scripts/contrib/list-packageconfig-flags.py b/scripts/contrib/list-packageconfig-flags.py index 2f3b8b06a6..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 @@ -37,7 +37,6 @@ if not bitbakepath: sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n") sys.exit(1) -import bb.cache import bb.cooker import bb.providers import bb.tinfoil @@ -45,7 +44,7 @@ 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): @@ -58,11 +57,11 @@ 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) + data = bbhandler.parse_recipe_file(fn) flags = data.getVarFlags("PACKAGECONFIG") flags.pop('doc', None) if flags: @@ -77,7 +76,7 @@ def collect_pkgs(data_dict): for fn in data_dict: pkgconfigflags = data_dict[fn].getVarFlags("PACKAGECONFIG") pkgconfigflags.pop('doc', None) - pkgname = data_dict[fn].getVar("P", True) + pkgname = data_dict[fn].getVar("P") pkg_dict[pkgname] = sorted(pkgconfigflags.keys()) return pkg_dict @@ -86,7 +85,7 @@ 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 in flag_dict: flag_dict[flag].append(pkgname) @@ -104,8 +103,8 @@ def display_pkgs(pkg_dict): pkgname_len += 1 header = '%-*s%s' % (pkgname_len, str("RECIPE NAME"), str("PACKAGECONFIG FLAGS")) - print header - print str("").ljust(len(header), '=') + print(header) + print(str("").ljust(len(header), '=')) for pkgname in sorted(pkg_dict): print('%-*s%s' % (pkgname_len, pkgname, ' '.join(pkg_dict[pkgname]))) @@ -115,28 +114,28 @@ def display_flags(flag_dict): flag_len = len("PACKAGECONFIG FLAG") + 5 header = '%-*s%s' % (flag_len, str("PACKAGECONFIG FLAG"), str("RECIPE NAMES")) - print header - print str("").ljust(len(header), '=') + 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(): + 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(): pkg_dict = {} @@ -160,20 +159,20 @@ def main(): options, args = parser.parse_args(sys.argv) - bbhandler = bb.tinfoil.Tinfoil() - 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) + 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 b96b7d4f7d..800733f0af 100755 --- a/scripts/contrib/mkefidisk.sh +++ b/scripts/contrib/mkefidisk.sh @@ -20,6 +20,11 @@ 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" @@ -136,6 +141,9 @@ unmount_device() { } unmount() { + if [ "$1" = "" ] ; then + return 0 + fi grep -q $1 /proc/mounts if [ $? -eq 0 ]; then debug "Unmounting $1" @@ -149,8 +157,55 @@ unmount() { # Parse and validate arguments # if [ $# -lt 3 ] || [ $# -gt 4 ]; then - usage - exit 1 + 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 @@ -159,9 +214,15 @@ if [ "$1" = "-v" ]; then shift fi -DEVICE=$1 -HDDIMG=$2 -TARGET_DEVICE=$3 +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 LINK=$(readlink $DEVICE) if [ $? -eq 0 ]; then @@ -170,7 +231,11 @@ fi if [ ! -w "$DEVICE" ]; then usage - die "Device $DEVICE does not exist or is not writable" + 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 @@ -218,11 +283,11 @@ 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 $DEVICE mklabel msdos || die "Failed to create MSDOS partition table" - DEVICE_SIZE=$(parted $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//") + 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)) @@ -262,22 +327,22 @@ 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" debug "Creating new partition table (MSDOS) on $DEVICE" -parted $DEVICE mklabel msdos >$OUT 2>&1 || die "Failed to create MSDOS partition table" +parted -s $DEVICE mklabel msdos >$OUT 2>&1 || die "Failed to create MSDOS partition table" debug "Creating boot partition on $BOOTFS" -parted $DEVICE mkpart primary 0% $BOOT_SIZE >$OUT 2>&1 || die "Failed to create BOOT partition" +parted -s $DEVICE mkpart primary 0% $BOOT_SIZE >$OUT 2>&1 || die "Failed to create BOOT partition" debug "Enabling boot flag on $BOOTFS" -parted $DEVICE set 1 boot on >$OUT 2>&1 || die "Failed to enable boot flag" +parted -s $DEVICE set 1 boot on >$OUT 2>&1 || die "Failed to enable boot flag" debug "Creating ROOTFS partition on $ROOTFS" -parted $DEVICE mkpart primary $ROOTFS_START $ROOTFS_END >$OUT 2>&1 || die "Failed to create ROOTFS partition" +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 $DEVICE mkpart primary $SWAP_START 100% >$OUT 2>&1 || die "Failed to create SWAP partition" +parted -s $DEVICE mkpart primary $SWAP_START 100% >$OUT 2>&1 || die "Failed to create SWAP partition" if [ $DEBUG -eq 1 ]; then - parted $DEVICE print + parted -s $DEVICE print fi @@ -309,8 +374,8 @@ mkswap $SWAP >$OUT 2>&1 || die "Failed to prepare swap" # Installing to $DEVICE # debug "Mounting images and device in preparation for installation" -mount -o loop $HDDIMG $HDDIMG_MNT >$OUT 2>&1 || error "Failed to mount $HDDIMG" -mount -o loop $HDDIMG_MNT/rootfs.img $HDDIMG_ROOTFS_MNT >$OUT 2>&1 || error "Failed to mount rootfs.img" +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" @@ -319,7 +384,7 @@ 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 gummiboot loader dir (we might just be a GRUB image) +# 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 @@ -342,28 +407,28 @@ if [ -e "$GRUB_CFG" ]; then sed -i "s/ LABEL=[^ ]*/ /" $GRUB_CFG sed -i "s@ root=[^ ]*@ @" $GRUB_CFG - sed -i "s@vmlinuz @vmlinuz root=$TARGET_ROOTFS ro rootwait quiet @" $GRUB_CFG + sed -i "s@vmlinuz @vmlinuz root=$TARGET_ROOTFS ro rootwait console=ttyS0 console=tty0 @" $GRUB_CFG fi -# Look for a gummiboot installation -GUMMI_ENTRIES="$BOOTFS_MNT/loader/entries" -GUMMI_CFG="$GUMMI_ENTRIES/boot.conf" -if [ -d "$GUMMI_ENTRIES" ]; then - info "Configuring Gummiboot" +# 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 $GUMMI_ENTRIES/install.conf >$OUT 2>&1 + rm $SYSTEMD_BOOT_ENTRIES/install.conf >$OUT 2>&1 - if [ ! -e "$GUMMI_CFG" ]; then - echo "ERROR: $GUMMI_CFG not found" + if [ ! -e "$SYSTEMD_BOOT_CFG" ]; then + echo "ERROR: $SYSTEMD_BOOT_CFG not found" fi - sed -i "/initrd /d" $GUMMI_CFG - sed -i "s@ root=[^ ]*@ @" $GUMMI_CFG - sed -i "s@options *LABEL=boot @options LABEL=Boot root=$TARGET_ROOTFS ro rootwait quiet @" $GUMMI_CFG + 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 $GUMMI_CFG ]; then +if [ ! -e $GRUB_CFG ] && [ ! -e $SYSTEMD_BOOT_CFG ]; then die "No EFI bootloader configuration found" fi @@ -378,6 +443,9 @@ if [ -d $ROOTFS_MNT/etc/udev/ ] ; then echo "$TARGET_DEVICE" >> $ROOTFS_MNT/etc/udev/mount.blacklist fi +# Add startup.nsh script for automated boot +echo "fs0:\EFI\BOOT\bootx64.efi" > $BOOTFS_MNT/startup.nsh + # Call cleanup to unmount devices and images and remove the TMPDIR cleanup 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 99bdca8994..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,7 +115,7 @@ 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 # @@ -130,7 +148,7 @@ class MakefileMaker: 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,31 +165,35 @@ 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", "${PN}-lang ${PN}-re", - "__future__.* _abcoll.* abc.* copy.* copy_reg.* ConfigParser.* " + + "__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.* _sysconfigdata.* config/Makefile " + + "_weakrefset.* sysconfig.* _sysconfigdata.* " + "${includedir}/python${PYTHON_MAJMIN}/pyconfig*.h " + "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py ") @@ -185,7 +207,8 @@ 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 translator", "${PN}-core", "${bindir}/2to3 lib2to3" ) # package @@ -244,16 +267,12 @@ if __name__ == "__main__": 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", "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", "imaplib.* email" ) # package @@ -275,7 +294,7 @@ if __name__ == "__main__": 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 ${PN}-netclient", + 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.*" ) @@ -310,11 +329,11 @@ if __name__ == "__main__": "*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.*" ) + "decimal.* fractions.* numbers.*" ) m.addPackage( "${PN}-pickle", "Python serialisation/persistence support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re", "pickle.* shelve.* lib-dynload/cPickle.so pickletools.*" ) @@ -322,6 +341,9 @@ if __name__ == "__main__": m.addPackage( "${PN}-pkgutil", "Python package extension utility support", "${PN}-core", "pkgutil.*") + 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.*" ) @@ -361,7 +383,7 @@ if __name__ == "__main__": 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", @@ -376,8 +398,8 @@ if __name__ == "__main__": 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 XML-RPC support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang", "xmlrpclib.* SimpleXMLRPCServer.* DocXMLRPCServer.*" ) diff --git a/scripts/contrib/python/generate-manifest-3.3.py b/scripts/contrib/python/generate-manifest-3.5.py index 48cc84d4e0..075860c418 100755 --- a/scripts/contrib/python/generate-manifest-3.3.py +++ b/scripts/contrib/python/generate-manifest-3.5.py @@ -13,27 +13,31 @@ # 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.3.3" +VERSION = "3.5.0" __author__ = "Michael 'Mickey' Lauer <mlauer@vanille-media.de>" __version__ = "20140131" 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 @@ -59,16 +63,40 @@ class MakefileMaker: 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 # @@ -100,7 +128,7 @@ 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 # @@ -133,7 +161,7 @@ class MakefileMaker: 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 @@ -150,33 +178,39 @@ class MakefileMaker: 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 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", "${PN}-lang ${PN}-re ${PN}-reprlib ${PN}-codecs ${PN}-io ${PN}-math", - "__future__.* _abcoll.* abc.* copy.* copyreg.* ConfigParser.* " + + "__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.* config/Makefile " + - "${includedir}/python${PYTHON_MAJMIN}/pyconfig*.h " + + "_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", @@ -189,10 +223,11 @@ 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 translator", "${PN}-core", - "${bindir}/2to3 lib2to3" ) # package + "lib2to3" ) # package m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter", "${bindir}/idle idlelib" ) # package @@ -206,14 +241,20 @@ 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}-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", - "gzip.* zipfile.* tarfile.* lib-dynload/bz2.*.so" ) + 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" ) @@ -224,16 +265,16 @@ if __name__ == "__main__": 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 ${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.* lib-dynload/datetime.*.so" ) + "_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", + 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", @@ -242,27 +283,26 @@ if __name__ == "__main__": 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", "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", "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.* htmllib.* markupbase.* sgmllib.* HTMLParser.* " ) + "formatter.* htmlentitydefs.* html htmllib.* markupbase.* sgmllib.* HTMLParser.* " ) - m.addPackage( "${PN}-importlib", "Python import implementation library", "${PN}-core", - "importlib" ) + 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" ) @@ -272,15 +312,15 @@ if __name__ == "__main__": 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 " + - "pipes.* socket.* ssl.* tempfile.* StringIO.* io.* _pyio.*" ) + "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", + 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.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* symbol.* repr.* token.* " + + "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", @@ -289,7 +329,7 @@ if __name__ == "__main__": m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime", "mailbox.*" ) - m.addPackage( "${PN}-math", "Python math support", "${PN}-core", + 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", @@ -301,18 +341,18 @@ if __name__ == "__main__": 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}-argparse ${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime ${PN}-html", "*Cookie*.* " + - "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.* uuid.* rfc822.* mimetools.*" ) + "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", - "cgi.* *HTTPServer.* SocketServer.*" ) + 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.* numbers.*" ) + "decimal.* fractions.* numbers.*" ) m.addPackage( "${PN}-pickle", "Python serialisation/persistence support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re", - "pickle.* shelve.* lib-dynload/cPickle.*.so pickletools.*" ) + "_compat_pickle.* pickle.* shelve.* lib-dynload/cPickle.*.so pickletools.*" ) m.addPackage( "${PN}-pkgutil", "Python package extension utility support", "${PN}-core", "pkgutil.*") @@ -330,19 +370,22 @@ if __name__ == "__main__": "lib-dynload/readline.*.so rlcompleter.*" ) m.addPackage( "${PN}-reprlib", "Python alternate repr() implementation", "${PN}-core", - "${libdir}/python3.3/reprlib.py" ) + "reprlib.py" ) 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}-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}-robotparser", "Python robots.txt parser", "${PN}-core ${PN}-netclient", - "urllib/robotparser.*") + 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", - "subprocess.*" ) + 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.*" ) @@ -363,21 +406,24 @@ if __name__ == "__main__": "test" ) # package m.addPackage( "${PN}-threading", "Python threading & synchronization support", "${PN}-core ${PN}-lang", - "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" ) + "_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}-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 XML-RPC 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 ${PN}-pydoc", "xmlrpclib.* SimpleXMLRPCServer.* DocXMLRPCServer.* xmlrpc" ) m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime", 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 index 86cc82bca3..76f1749cfa 100755 --- a/scripts/contrib/verify-homepage.py +++ b/scripts/contrib/verify-homepage.py @@ -1,63 +1,62 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 -# This script is used for verify HOMEPAGE. +# 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 urllib2 +import urllib.request -def search_bitbakepath(): - bitbakepath = "" - # Search path to bitbake lib dir in order to load bb modules - if os.path.exists(os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib/bb')): - bitbakepath = os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib') - bitbakepath = os.path.abspath(bitbakepath) - 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, '../lib')) - break - if not bitbakepath: - sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n") - sys.exit(1) - return bitbakepath - -# For importing the following modules -sys.path.insert(0, search_bitbakepath()) +# 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: - bb.warn("Failed to verify HOMEPAGE (%s) of %s" % (homepage, pn)) + logger.warn("%s: failed to verify HOMEPAGE: %s " % (pn, homepage)) return 1 else: return 0 def verifyHomepage(bbhandler): - pkg_pn = bbhandler.cooker.recipecache.pkg_pn + pkg_pn = bbhandler.cooker.recipecaches[''].pkg_pn pnlist = sorted(pkg_pn) count = 0 + checked = [] for pn in pnlist: - fn = pkg_pn[pn].pop() - data = bb.cache.Cache.loadDataFull(fn, bbhandler.cooker.collection.get_file_appends(fn), bbhandler.config_data) - homepage = data.getVar("HOMEPAGE") - if homepage: - try: - urllib2.urlopen(homepage, timeout=5) - except Exception: - count = count + wgetHomepage(pn, homepage) + 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__': - failcount = 0 - bbhandler = bb.tinfoil.Tinfoil() - bbhandler.prepare() - print "Start to verify HOMEPAGE:" - failcount = verifyHomepage(bbhandler) - print "finish to verify HOMEPAGE." - print "Summary: %s failed" % failcount + 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 28eb90d4a0..35eb211be3 100755 --- a/scripts/cp-noerror +++ b/scripts/cp-noerror @@ -1,4 +1,4 @@ -#!/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. @@ -33,16 +33,16 @@ 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]) diff --git a/scripts/create-pull-request b/scripts/create-pull-request index 97ed874e7f..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,10 +197,25 @@ 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" @@ -183,10 +225,11 @@ 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 :$BRANCH >> "$PM" + 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 @@ -219,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 e4bc4c322b..0000000000 --- a/scripts/create-recipe +++ /dev/null @@ -1,2071 +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"; - } - - 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 || $ARGV[0] eq "--help" ) { - 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 (scalar(@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 index 981ff515d3..c9ad9ddb95 100755 --- a/scripts/devtool +++ b/scripts/devtool @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # OpenEmbedded Development tool # -# Copyright (C) 2014 Intel Corporation +# 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 @@ -22,7 +22,7 @@ import os import argparse import glob import re -import ConfigParser +import configparser import subprocess import logging @@ -35,7 +35,9 @@ 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 = [] @@ -49,12 +51,12 @@ class ConfigHandler(object): def __init__(self, filename): self.config_file = filename - self.config_obj = ConfigParser.SafeConfigParser() + 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): + except (configparser.NoOptionError, configparser.NoSectionError): if default != None: ret = default else: @@ -84,6 +86,11 @@ class ConfigHandler(object): 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) @@ -99,26 +106,59 @@ def read_workspace(): 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-[a-zA-Z0-9-]*)? =.*$') + externalsrc_re = re.compile(r'^EXTERNALSRC(_pn-([^ =]+))? *= *"([^"]*)"$') for fn in glob.glob(os.path.join(config.workspace_path, 'appends', '*.bbappend')): - pn = os.path.splitext(os.path.basename(fn))[0].split('_')[0] with open(fn, 'r') as f: for line in f: - if externalsrc_re.match(line.rstrip()): - splitval = line.split('=', 2) - workspace[pn] = splitval[1].strip('" \n\r\t') - break + 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, args.create_only) + _create_workspace(workspacedir, config, basepath) + if not args.create_only: + _enable_workspace_layer(workspacedir, config, basepath) -def _create_workspace(workspacedir, config, basepath, create_only=False): +def _create_workspace(workspacedir, config, basepath): import bb confdir = os.path.join(workspacedir, 'conf') @@ -139,24 +179,35 @@ def _create_workspace(workspacedir, config, basepath, create_only=False): # 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. In most instances you should use the\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 you can remove the path to this\n') - f.write('workspace layer from your conf/bblayers.conf file (and then delete the\n') - f.write('layer, if you wish).\n') - if not create_only: - # Add the workspace layer to bblayers.conf - bblayers_conf = os.path.join(basepath, 'conf', 'bblayers.conf') - if not os.path.exists(bblayers_conf): - logger.error('Unable to find bblayers.conf') - return -1 - bb.utils.edit_bblayers_conf(bblayers_conf, workspacedir, config.workspace_path) - if config.workspace_path != workspacedir: - # Update our config to point to the new location - config.workspace_path = workspacedir - config.write() + 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(): @@ -164,61 +215,61 @@ def main(): 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__)) - 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) - parser = argparse.ArgumentParser(description="OpenEmbedded development tool", - epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + 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') - subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>') + global_args, unparsed_args = parser.parse_known_args() - if not context.fixed_setup: - parser_create_workspace = subparsers.add_parser('create-workspace', - help='Set up a workspace', - 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.') - 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) - - scriptutils.load_plugins(logger, plugins, os.path.join(scripts_path, 'lib', 'devtool')) - for plugin in plugins: - if hasattr(plugin, 'register_commands'): - plugin.register_commands(subparsers, context) - - args = parser.parse_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 args.debug: + if global_args.debug: logger.setLevel(logging.DEBUG) - elif args.quiet: + elif global_args.quiet: logger.setLevel(logging.ERROR) - if args.basepath: + if global_args.basepath: # Override - basepath = args.basepath - elif 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) + 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: @@ -237,12 +288,60 @@ def main(): logger.debug('Using standard bitbake path %s' % bitbakepath) scriptpath.add_oe_lib_path() - scriptutils.logger_setup_color(logger, args.color) + 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 - if args.subparser_name != 'create-workspace': + 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() - ret = args.func(args, config, basepath, workspace) + 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 @@ -253,5 +352,5 @@ if __name__ == "__main__": except Exception: ret = 1 import traceback - traceback.print_exc(5) + traceback.print_exc() sys.exit(ret) diff --git a/scripts/gen-lockedsig-cache b/scripts/gen-lockedsig-cache index c93b2c0b99..6765891d19 100755 --- a/scripts/gen-lockedsig-cache +++ b/scripts/gen-lockedsig-cache @@ -1,7 +1,4 @@ -#!/usr/bin/env python -# -# gen-lockedsig-cache <locked-sigs.inc> <input-cachedir> <output-cachedir> -# +#!/usr/bin/env python3 import os import sys @@ -16,31 +13,62 @@ def mkdir(d): if e.errno != errno.EEXIST: raise e -if len(sys.argv) < 3: +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: - sigs.append(l.split(":")[2].split()[0]) + 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[:2] + "/*" + s + "*" + p = sys.argv[2] + "/%s/" % sys.argv[4] + s[:2] + "/*" + s + "*" files |= set(glob.glob(p)) +print('Processing files') for f in files: - dst = f.replace(sys.argv[2], sys.argv[3]) + 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(f).st_dev == os.stat(destdir).st_dev): - os.link(f, 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: - shutil.copyfile(f, dst) + print('copying') + shutil.copyfile(src, dst) + +print('Done!') 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/wic/3rdparty/pykickstart/__init__.py b/scripts/lib/compatlayer/cases/__init__.py index e69de29bb2..e69de29bb2 100644 --- a/scripts/lib/wic/3rdparty/pykickstart/__init__.py +++ 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 index 3f8158e24a..d646b0cf63 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Development tool - utility functions for plugins # @@ -16,20 +16,35 @@ # 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: @@ -38,41 +53,242 @@ def exec_build_env_command(init_path, builddir, cmd, watch=False, **options): if watch: if sys.stdout.isatty(): # Fool bitbake into thinking it's outputting to a terminal (because it is, indirectly) - cmd = 'script -q -c "%s" /dev/null' % cmd + 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): - if isinstance(cmd, basestring) and not "shell" in 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 = process.stdout.read(1) + out = reader.read(1, 1) if out: sys.stdout.write(out) sys.stdout.flush() buf += out elif out == '' and process.poll() != None: break - return buf -def setup_tinfoil(): + 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 - 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 - import logging - tinfoil = bb.tinfoil.Tinfoil() - tinfoil.prepare(False) - tinfoil.logger.setLevel(logging.WARNING) + 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 index bd23e95dd9..b3730ae833 100644 --- a/scripts/lib/devtool/deploy.py +++ b/scripts/lib/devtool/deploy.py @@ -1,6 +1,6 @@ # Development tool - deploy/undeploy command plugin # -# Copyright (C) 2014 Intel Corporation +# 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 @@ -14,87 +14,312 @@ # 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 -from devtool import exec_build_env_command +import tempfile +import shutil +import argparse_oe +from devtool import exec_fakeroot, setup_tinfoil, check_workspace_recipe, DevtoolError logger = logging.getLogger('devtool') -def plugin_init(pluginlist): - pass +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 - from devtool import exec_build_env_command + import math + import oe.recipeutils + + check_workspace_recipe(workspace, args.recipename, checksrc=False) - if not args.recipename in workspace: - logger.error("no recipe named %s in your workspace" % args.recipename) - return -1 try: host, destdir = args.target.split(':') except ValueError: destdir = '/' else: args.target = host + if not destdir.endswith('/'): + destdir += '/' - deploy_dir = os.path.join(basepath, 'target_deploy', args.target) - deploy_file = os.path.join(deploy_dir, args.recipename + '.list') + 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) - if os.path.exists(deploy_file): - undeploy(args) + 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 - stdout, stderr = exec_build_env_command(config.init_path, basepath, 'bitbake -e %s' % args.recipename, shell=True) - recipe_outdir = re.search(r'^D="(.*)"', stdout, re.MULTILINE).group(1) - ret = subprocess.call('scp -qr %s/* %s:%s' % (recipe_outdir, args.target, destdir), shell=True) - if ret != 0: - return ret - logger.info('Successfully deployed %s' % recipe_outdir) + extraoptions = '' + if args.no_host_check: + extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + if not args.show_status: + extraoptions += ' -q' - if not os.path.exists(deploy_dir): - os.makedirs(deploy_dir) + 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 - 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)) + # 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) - with open(deploy_file, 'w') as fobj: - fobj.write('\n'.join(files_list)) + # 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 - deploy_file = os.path.join(basepath, 'target_deploy', args.target, args.recipename + '.list') - if not os.path.exists(deploy_file): - logger.error('%s has not been deployed' % args.recipename) - return -1 + args.target = args.target.split(':')[0] - ret = subprocess.call("scp -q %s %s:/tmp" % (deploy_file, args.target), shell=True) + 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: - logger.error('Failed to copy %s to %s' % (deploy, args.target)) - return -1 + raise DevtoolError('Undeploy failed - rerun with -s to get a complete ' + 'error message') - ret = subprocess.call("ssh %s 'xargs -n1 rm -f </tmp/%s'" % (args.target, os.path.basename(deploy_file)), shell=True) - if ret == 0: + if not args.all and not args.dry_run: logger.info('Successfully undeployed %s' % args.recipename) - os.remove(deploy_file) - - return ret + return 0 def register_commands(subparsers, context): - parser_deploy = subparsers.add_parser('deploy-target', help='Deploy recipe output files to live target machine') + """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') - parser_undeploy.add_argument('recipename', help='Recipe to undeploy') + 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 index cabf3feaf3..5ff1e230fd 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -1,6 +1,6 @@ # Development tool - standard commands plugin # -# Copyright (C) 2014 Intel Corporation +# 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 @@ -14,242 +14,678 @@ # 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 glob +import subprocess import tempfile import logging import argparse -from devtool import exec_build_env_command, setup_tinfoil +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 plugin_init(pluginlist): - pass - def add(args, config, basepath, workspace): + """Entry point for the devtool 'add' subcommand""" import bb import oe.recipeutils - if args.recipename in workspace: - logger.error("recipe %s is already in your workspace" % args.recipename) - return -1 - - reason = oe.recipeutils.validate_pn(args.recipename) - if reason: - logger.error(reason) - return -1 - - srctree = os.path.abspath(args.srctree) - appendpath = os.path.join(config.workspace_path, 'appends') - if not os.path.exists(appendpath): - os.makedirs(appendpath) + 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") - recipedir = os.path.join(config.workspace_path, 'recipes', args.recipename) - bb.utils.mkdirhier(recipedir) if args.version: if '_' in args.version or ' ' in args.version: - logger.error('Invalid version string "%s"' % args.version) - return -1 - bp = "%s_%s" % (args.recipename, args.version) - else: - bp = args.recipename - recipefile = os.path.join(recipedir, "%s.bb" % bp) - if sys.stdout.isatty(): + raise DevtoolError('Invalid version string "%s"' % args.version) + + if args.color == 'auto' and sys.stdout.isatty(): color = 'always' else: color = args.color - stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s %s' % (color, recipefile, srctree)) - logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) + 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' - _add_md5(config, args.recipename, recipefile) + 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) - 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() + for fn in os.listdir(recipedir): + _add_md5(config, recipename, os.path.join(recipedir, fn)) - appendfile = os.path.join(appendpath, '%s.bbappend' % args.recipename) - with open(appendfile, 'w') as f: - f.write('inherit externalsrc\n') - f.write('EXTERNALSRC = "%s"\n' % srctree) - if args.same_dir: - f.write('EXTERNALSRC_BUILD = "%s"\n' % srctree) - if initial_rev: - f.write('\n# initial_rev: %s\n' % initial_rev) + 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) - _add_md5(config, args.recipename, appendfile) + 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 _get_recipe_file(cooker, pn): - import oe.recipeutils - recipefile = oe.recipeutils.pn_to_recipe(cooker, pn) - if not recipefile: - skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn) - if skipreasons: - logger.error('\n'.join(skipreasons)) - else: - logger.error("Unable to find any recipe file matching %s" % pn) - return recipefile +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 - import oe.recipeutils - tinfoil = setup_tinfoil() + 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 - recipefile = _get_recipe_file(tinfoil.cooker, args.recipename) - if not recipefile: - # Error already logged - return -1 - rd = oe.recipeutils.parse_recipe(recipefile, tinfoil.config_data) + 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) - srctree = os.path.abspath(args.srctree) - initial_rev = _extract_source(srctree, args.keep_temp, args.branch, rd) - if initial_rev: - return 0 - else: - return -1 + 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 -def _extract_source(srctree, keep_temp, devbranch, d): - import bb.event + 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) - def eventfilter(name, handler, event, d): - if name == 'base_eventhandler': - return True + if initial_rev: + return 0 else: - return False + return 1 + finally: + tinfoil.shutdown() - if hasattr(bb.event, 'set_eventfilter'): - bb.event.set_eventfilter(eventfilter) - pn = d.getVar('PN', True) +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) - if pn == 'perf': - logger.error("The perf recipe does not actually check out source and thus cannot be supported by this tool") + rd = parse_recipe(config, tinfoil, recipename, True) + if not rd: return None - if bb.data.inherits_class('image', d): - logger.error("The %s recipe is an image, and therefore is not supported by this tool" % pn) - 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 - if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC', True): - logger.error("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) - return None - if os.path.exists(srctree): - if not os.path.isdir(srctree): - logger.error("output path %s exists and is not a directory" % srctree) - return None - elif os.listdir(srctree): - logger.error("output path %s already exists and is non-empty" % srctree) - return None +def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil): + """Extract sources of a recipe""" + import oe.recipeutils + + pn = d.getVar('PN') - # Prepare for shutil.move later on - bb.utils.mkdirhier(srctree) - os.rmdir(srctree) + _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 - tempdir = tempfile.mkdtemp(prefix='devtool') + # 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) - crd.setVar('T', os.path.join(tempdir, 'temp')) - if not crd.getVar('S', True).startswith(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}/${BP}') + 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}') - # FIXME: This is very awkward. Unfortunately it's not currently easy to properly - # execute tasks outside of bitbake itself, until then this has to suffice if we - # are to handle e.g. linux-yocto's extra tasks - executed = [] - def exec_task_func(func, report): - if not func in executed: - deps = crd.getVarFlag(func, 'deps') - if deps: - for taskdepfunc in deps: - exec_task_func(taskdepfunc, True) - if report: - logger.info('Executing %s...' % func) - fn = d.getVar('FILE', True) - localdata = bb.build._task_data(fn, func, crd) - bb.build.exec_func(func, localdata) - executed.append(func) - - logger.info('Fetching %s...' % pn) - exec_task_func('do_fetch', False) - logger.info('Unpacking...') - exec_task_func('do_unpack', False) - srcsubdir = crd.getVar('S', True) - if srcsubdir != workdir and 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]) - - if os.path.exists(os.path.join(srcsubdir, '.git')): - alternatesfile = os.path.join(srcsubdir, '.git', 'objects', 'info', 'alternates') - if os.path.exists(alternatesfile): - # This will have been cloned with -s, so we need to convert it to a full clone - bb.process.run('git repack -a', cwd=srcsubdir) - os.remove(alternatesfile) - - patchdir = os.path.join(srcsubdir, 'patches') - haspatches = False - if os.path.exists(patchdir): - if os.listdir(patchdir): - haspatches = True - else: - os.rmdir(patchdir) + 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): - (stdout, _) = bb.process.run('git --git-dir="%s" rev-parse HEAD' % crd.expand('${WORKDIR}/git'), cwd=srcsubdir) - initial_rev = stdout.rstrip() - else: - if not os.listdir(srcsubdir): - logger.error("no source unpacked to S, perhaps the %s recipe doesn't use any source?" % pn) - return None + # 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]) - if not os.path.exists(os.path.join(srcsubdir, '.git')): - bb.process.run('git init', cwd=srcsubdir) - bb.process.run('git add .', cwd=srcsubdir) - bb.process.run('git commit -q -m "Initial commit from upstream at version %s"' % crd.getVar('PV', True), cwd=srcsubdir) + scriptutils.git_convert_standalone_clone(srcsubdir) - (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srcsubdir) - initial_rev = stdout.rstrip() + # 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) - bb.process.run('git checkout -b %s' % devbranch, cwd=srcsubdir) - bb.process.run('git tag -f devtool-base', cwd=srcsubdir) + setup_git_repo(srcsubdir, crd.getVar('PV'), devbranch, d=d) - crd.setVar('PATCHTOOL', 'git') + (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srcsubdir) + initial_rev = stdout.rstrip() logger.info('Patching...') - exec_task_func('do_patch', False) + runtask(fn, 'patch') bb.process.run('git tag -f devtool-patched', cwd=srcsubdir) - if os.path.exists(patchdir): - shutil.rmtree(patchdir) - if haspatches: - bb.process.run('git checkout patches', 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) - shutil.move(srcsubdir, srctree) - logger.info('Source tree extracted to %s' % srctree) finally: if keep_temp: logger.info('Preserving temporary directory %s' % tempdir) @@ -258,23 +694,42 @@ def _extract_source(srctree, keep_temp, devbranch, d): 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 - md5 = bb.utils.md5_file(filename) - with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f: - f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5)) + + 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') + 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]) - md5 = bb.utils.md5_file(removefile) + 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) @@ -286,365 +741,1178 @@ def _check_preserve(config, recipename): tf.write(line) os.rename(newfile, origfile) - return False - - def modify(args, config, basepath, workspace): + """Entry point for the devtool 'modify' subcommand""" import bb import oe.recipeutils if args.recipename in workspace: - logger.error("recipe %s is already in your workspace" % args.recipename) - return -1 - - if not args.extract: - if not os.path.isdir(args.srctree): - logger.error("directory %s does not exist or not a directory (specify -x to extract source from recipe)" % args.srctree) - return -1 + raise DevtoolError("recipe %s is already in your workspace" % + args.recipename) - tinfoil = setup_tinfoil() - - recipefile = _get_recipe_file(tinfoil.cooker, args.recipename) - if not recipefile: - # Error already logged - return -1 - rd = oe.recipeutils.parse_recipe(recipefile, tinfoil.config_data) + tinfoil = setup_tinfoil(basepath=basepath) + try: + rd = parse_recipe(config, tinfoil, args.recipename, True) + if not rd: + return 1 - if bb.data.inherits_class('image', rd): - logger.error("The %s recipe is an image, and therefore is not supported by this tool" % args.recipename) - return None + 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) - initial_rev = None - commits = [] - srctree = os.path.abspath(args.srctree) - if args.extract: - initial_rev = _extract_source(args.srctree, False, args.branch, rd) - if not initial_rev: - return -1 - # Get list of commits since this revision - (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=args.srctree) - commits = stdout.split() - else: - if os.path.exists(os.path.join(args.srctree, '.git')): - (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=args.srctree) - initial_rev = stdout.rstrip() - - # Check that recipe isn't using a shared workdir - s = rd.getVar('S', True) - workdir = rd.getVar('WORKDIR', True) - if s.startswith(workdir): - # Handle if S is set to a subdirectory of the source - if s != workdir and os.path.dirname(s) != workdir: - srcsubdir = os.sep.join(os.path.relpath(s, workdir).split(os.sep)[1:]) + 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) - appendpath = os.path.join(config.workspace_path, 'appends') - if not os.path.exists(appendpath): - os.makedirs(appendpath) - - appendname = os.path.splitext(os.path.basename(recipefile))[0] - if args.wildcard: - appendname = re.sub(r'_.*', '_%', appendname) - appendfile = os.path.join(appendpath, appendname + '.bbappend') - with open(appendfile, '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' % (args.recipename, srctree)) - if args.same_dir or bb.data.inherits_class('autotools-brokensep', rd): - if args.same_dir: - logger.info('using source tree as build directory since --same-dir specified') - else: - logger.info('using source tree as build directory since original recipe inherits autotools-brokensep') - f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (args.recipename, srctree)) - 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, args.recipename, appendfile) + 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) - logger.info('Recipe %s now set up to build from %s' % (args.recipename, srctree)) + _add_md5(config, pn, appendfile) - return 0 + logger.info('Recipe %s now set up to build from %s' % (pn, srctree)) + finally: + tinfoil.shutdown() -def update_recipe(args, config, basepath, workspace): - if not args.recipename in workspace: - logger.error("no recipe named %s in your workspace" % args.recipename) - return -1 + return 0 - # Get initial revision from bbappend - appends = glob.glob(os.path.join(config.workspace_path, 'appends', '%s_*.bbappend' % args.recipename)) - if not appends: - logger.error('unable to find workspace bbappend for recipe %s' % args.recipename) - return -1 - tinfoil = setup_tinfoil() +def rename(args, config, basepath, workspace): + """Entry point for the devtool 'rename' subcommand""" import bb - from oe.patch import GitApplyTree import oe.recipeutils - recipefile = _get_recipe_file(tinfoil.cooker, args.recipename) + 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: - # Error already logged - return -1 - rd = oe.recipeutils.parse_recipe(recipefile, tinfoil.config_data) + raise DevtoolError('devtool rename can only be used where the recipe file itself is in the workspace (e.g. after devtool add)') - orig_src_uri = rd.getVar('SRC_URI', False) or '' - if args.mode == 'auto': - if 'git://' in orig_src_uri: - mode = 'srcrev' - else: - mode = 'patch' + if args.newname and args.newname != args.recipename: + reason = oe.recipeutils.validate_pn(args.newname) + if reason: + raise DevtoolError(reason) + newname = args.newname else: - mode = args.mode - - def remove_patches(srcuri, patchlist): - # Remove any patches that we don't need - updated = False - for patch in patchlist: - patchfile = os.path.basename(patch) - for i in xrange(len(srcuri)): - if srcuri[i].startswith('file://') and os.path.basename(srcuri[i]).split(';')[0] == patchfile: - logger.info('Removing patch %s' % patchfile) - srcuri.pop(i) - # 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 - if patch.startswith(os.path.dirname(recipefile)): - os.remove(patch) - updated = True - break - return updated - - srctree = workspace[args.recipename] - if mode == 'srcrev': - (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) - srcrev = stdout.strip() - if len(srcrev) != 40: - logger.error('Invalid hash returned by git: %s' % stdout) + 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 - logger.info('Updating SRCREV in recipe %s' % os.path.basename(recipefile)) + 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 = {} - patchfields['SRCREV'] = srcrev - if not args.no_remove: - # Find list of existing patches in recipe file - existing_patches = oe.recipeutils.get_recipe_patches(rd) + 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() - old_srcrev = (rd.getVar('SRCREV', False) or '') - tempdir = tempfile.mkdtemp(prefix='devtool') - removepatches = [] + 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: - GitApplyTree.extractPatches(srctree, old_srcrev, tempdir) - newpatches = os.listdir(tempdir) - for patch in existing_patches: - patchfile = os.path.basename(patch) - if patchfile in newpatches: - removepatches.append(patch) - finally: - shutil.rmtree(tempdir) - if removepatches: - srcuri = (rd.getVar('SRC_URI', False) or '').split() - if remove_patches(srcuri, removepatches): - patchfields['SRC_URI'] = ' '.join(srcuri) - - oe.recipeutils.patch_recipe(rd, recipefile, patchfields) - - 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') + 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 - elif mode == 'patch': - commits = [] - update_rev = None - if args.initial_rev: - initial_rev = args.initial_rev + +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: - initial_rev = None - with open(appends[0], 'r') as f: - for line in f: - if line.startswith('# initial_rev:'): - initial_rev = line.split(':')[-1].strip() - elif line.startswith('# commit:'): - commits.append(line.split(':')[-1].strip()) + 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') - 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 xrange(min(len(commits), len(newcommits))): - if newcommits[i] == commits[i]: - update_rev = commits[i] + _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 - if not initial_rev: - logger.error('Unable to find initial revision - please specify it with --initial-rev') - return -1 + 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) - if not update_rev: - update_rev = initial_rev + 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') - # Find list of existing patches in recipe file - existing_patches = oe.recipeutils.get_recipe_patches(rd) + dl_dir = rd.getVar('DL_DIR') + if not dl_dir.endswith('/'): + dl_dir += '/' - removepatches = [] - if not args.no_remove: + 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 - tempdir = tempfile.mkdtemp(prefix='devtool') - try: - GitApplyTree.extractPatches(srctree, initial_rev, tempdir) - newpatches = os.listdir(tempdir) - for patch in existing_patches: - patchfile = os.path.basename(patch) - if patchfile not in newpatches: - removepatches.append(patch) - finally: - shutil.rmtree(tempdir) + 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 - tempdir = tempfile.mkdtemp(prefix='devtool') - try: - GitApplyTree.extractPatches(srctree, update_rev, tempdir) - - # Match up and replace existing patches with corresponding new patches - updatepatches = False - updaterecipe = False - newpatches = os.listdir(tempdir) - for patch in existing_patches: - patchfile = os.path.basename(patch) - if patchfile in newpatches: - logger.info('Updating patch %s' % patchfile) - shutil.move(os.path.join(tempdir, patchfile), patch) - newpatches.remove(patchfile) - updatepatches = True - srcuri = (rd.getVar('SRC_URI', False) or '').split() - if newpatches: - # Add any patches left over - patchdir = os.path.join(os.path.dirname(recipefile), rd.getVar('BPN', True)) - bb.utils.mkdirhier(patchdir) - for patchfile in newpatches: - logger.info('Adding new patch %s' % patchfile) - shutil.move(os.path.join(tempdir, patchfile), os.path.join(patchdir, patchfile)) - srcuri.append('file://%s' % patchfile) - updaterecipe = True - if removepatches: - if remove_patches(srcuri, removepatches): + 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 updatepatches: + oe.recipeutils.patch_recipe(rd, recipefile, + {'SRC_URI': ' '.join(srcuri)}) + elif not updatefiles: # Neither patches nor recipe were updated - logger.info('No patches need updating') - finally: - shutil.rmtree(tempdir) + 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: - logger.error('update_recipe: invalid mode %s' % mode) - return 1 + 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.iteritems(): - print("%s: %s" % (recipe, value)) + 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): - import bb.utils - if not args.recipename in workspace: - logger.error("no recipe named %s in your workspace" % args.recipename) - return -1 - - if not args.no_clean: - logger.info('Cleaning sysroot for recipe %s...' % args.recipename) - exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % args.recipename) - - _check_preserve(config, args.recipename) - - preservepath = os.path.join(config.workspace_path, 'attic', args.recipename) - def preservedir(origdir): - if os.path.exists(origdir): - for fn in os.listdir(origdir): - logger.warn('Preserving %s in %s' % (fn, preservepath)) - bb.utils.mkdirhier(preservepath) - shutil.move(os.path.join(origdir, fn), os.path.join(preservepath, fn)) - os.rmdir(origdir) - - preservedir(os.path.join(config.workspace_path, 'recipes', args.recipename)) - # We don't automatically create this dir next to appends, but the user can - preservedir(os.path.join(config.workspace_path, 'appends', args.recipename)) + """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 build(args, config, basepath, workspace): +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 - if not args.recipename in workspace: - logger.error("no recipe named %s in your workspace" % args.recipename) - return -1 - build_task = config.get('Build', 'build_task', 'populate_sysroot') - exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True) + 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', - formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser_add.add_argument('recipename', help='Name for new recipe to add') - parser_add.add_argument('srctree', help='Path to external source tree') - parser_add.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") + 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.set_defaults(func=add) - - parser_add = subparsers.add_parser('modify', help='Modify the source for an existing recipe', - description='Enables modifying the source for an existing recipe', - formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser_add.add_argument('recipename', help='Name for recipe to edit') - parser_add.add_argument('srctree', help='Path to external source tree') - parser_add.add_argument('--wildcard', '-w', action="store_true", help='Use wildcard for unversioned bbappend') - parser_add.add_argument('--extract', '-x', action="store_true", help='Extract source as well') - parser_add.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") - parser_add.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (only when using -x)') - parser_add.set_defaults(func=modify) - - parser_add = subparsers.add_parser('extract', help='Extract the source for an existing recipe', + 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', - formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser_add.add_argument('recipename', help='Name for recipe to extract the source for') - parser_add.add_argument('srctree', help='Path to where to extract the source tree') - parser_add.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout') - parser_add.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') - parser_add.set_defaults(func=extract) - - parser_add = 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)') - parser_add.add_argument('recipename', help='Name of recipe to update') - parser_add.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_add.add_argument('--initial-rev', help='Starting revision for patches') - parser_add.add_argument('--no-remove', '-n', action="store_true", help='Don\'t remove patches, only add or update') - parser_add.set_defaults(func=update_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', - formatter_class=argparse.ArgumentDefaultsHelpFormatter) + group='info', order=100) parser_status.set_defaults(func=status) - parser_build = subparsers.add_parser('build', help='Build a recipe', - description='Builds the specified recipe using bitbake', - formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser_build.add_argument('recipename', help='Recipe to build') - parser_build.set_defaults(func=build) - parser_reset = subparsers.add_parser('reset', help='Remove a recipe from your workspace', - description='Removes the specified recipe from your workspace (resetting its state)', - formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser_reset.add_argument('recipename', help='Recipe to reset') + 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/image/__init__.py b/scripts/lib/image/__init__.py deleted file mode 100644 index 1ff814e761..0000000000 --- a/scripts/lib/image/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -# OpenEmbedded Image tools library -# -# 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. -# -# AUTHORS -# Tom Zanussi <tom.zanussi (at] linux.intel.com> -# diff --git a/scripts/lib/image/canned-wks/mkgummidisk.wks b/scripts/lib/image/canned-wks/mkgummidisk.wks deleted file mode 100644 index f81cbdfb84..0000000000 --- a/scripts/lib/image/canned-wks/mkgummidisk.wks +++ /dev/null @@ -1,11 +0,0 @@ -# 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=gummiboot" --ondisk sda --label msdos --active --align 1024 - -part / --source rootfs --ondisk sda --fstype=ext3 --label platform --align 1024 - -part swap --ondisk sda --size 44 --label swap1 --fstype=swap - -bootloader --timeout=10 --append="rootwait rootfstype=ext3 console=ttyPCH0,115200 console=tty0 vmalloc=256MB snd-hda-intel.enable_msi=0" diff --git a/scripts/lib/image/config/wic.conf b/scripts/lib/image/config/wic.conf deleted file mode 100644 index a51bcb55eb..0000000000 --- a/scripts/lib/image/config/wic.conf +++ /dev/null @@ -1,6 +0,0 @@ -[common] -; general settings -distro_name = OpenEmbedded - -[create] -; settings for create subcommand diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py deleted file mode 100644 index 68d1ce2659..0000000000 --- a/scripts/lib/image/engine.py +++ /dev/null @@ -1,279 +0,0 @@ -# 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 os -import sys -from abc import ABCMeta, abstractmethod -import shlex -import json -import subprocess -import shutil - -import os, sys, errno -from wic import msger, creator -from wic.utils import cmdln, misc, errors -from wic.conf import configmgr -from wic.plugin import pluginmgr -from wic.__version__ import VERSION -from wic.utils.oe.misc import * - - -def verify_build_env(): - """ - Verify that the build environment is sane. - - Returns True if it is, false otherwise - """ - try: - builddir = os.environ["BUILDDIR"] - except KeyError: - print "BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)" - sys.exit(1) - - return True - - -def find_artifacts(image_name): - """ - Gather the build artifacts for the current image (the image_name - e.g. core-image-minimal) for the current MACHINE set in local.conf - """ - bitbake_env_lines = get_bitbake_env_lines() - - rootfs_dir = kernel_dir = bootimg_dir = native_sysroot = "" - - for line in bitbake_env_lines.split('\n'): - if (get_line_val(line, "IMAGE_ROOTFS")): - rootfs_dir = get_line_val(line, "IMAGE_ROOTFS") - continue - if (get_line_val(line, "DEPLOY_DIR_IMAGE")): - kernel_dir = get_line_val(line, "DEPLOY_DIR_IMAGE") - continue - if (get_line_val(line, "STAGING_DIR_NATIVE")): - native_sysroot = get_line_val(line, "STAGING_DIR_NATIVE") - continue - - return (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) - - -CANNED_IMAGE_DIR = "lib/image/canned-wks" # relative to scripts -SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR - -def build_canned_image_list(dl): - layers_path = get_bitbake_var("BBLAYERS") - canned_wks_layer_dirs = [] - - if layers_path is not None: - for layer_path in layers_path.split(): - path = os.path.join(layer_path, SCRIPTS_CANNED_IMAGE_DIR) - canned_wks_layer_dirs.append(path) - - path = os.path.join(dl, CANNED_IMAGE_DIR) - canned_wks_layer_dirs.append(path) - - 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 file in files: - if file.endswith("~") or file.endswith("#"): - continue - if file.endswith(".wks") and wks_file + ".wks" == file: - fullpath = os.path.join(canned_wks_dir, file) - 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 file in files: - if file.endswith("~") or file.endswith("#"): - continue - if file.endswith(".wks"): - fullpath = os.path.join(canned_wks_dir, file) - f = open(fullpath, "r") - lines = f.readlines() - for line in lines: - desc = "" - idx = line.find("short-description:") - if idx != -1: - desc = line[idx + len("short-description:"):].strip() - break - basename = os.path.splitext(file)[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. - """ - f = open(fullpath, "r") - lines = f.readlines() - found = False - for line in lines: - 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_source_plugins() - - for plugin in plugins: - print " %s" % plugin - - -def wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir, - native_sysroot, scripts_path, image_output_dir, debug, - properties_file, properties=None): - """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 - scripts_path - absolute path to /scripts dir - image_output_dir - dirname to create for image - properties_file - use values from this file if nonempty i.e no prompting - properties - use values from this string if nonempty i.e no prompting - - 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: - print "BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)" - sys.exit(1) - - direct_args = list() - direct_args.insert(0, oe_builddir) - direct_args.insert(0, image_output_dir) - direct_args.insert(0, wks_file) - direct_args.insert(0, rootfs_dir) - direct_args.insert(0, bootimg_dir) - direct_args.insert(0, kernel_dir) - direct_args.insert(0, native_sysroot) - direct_args.insert(0, "direct") - - if debug: - msger.set_loglevel('debug') - - cr = creator.Creator() - - cr.main(direct_args) - - print "\nThe image(s) were created using OE kickstart file:\n %s" % wks_file - - -def wic_list(args, scripts_path, properties_file): - """ - Print the complete list of properties defined by the image, or the - possible values for a particular image property. - """ - if len(args) < 1: - return False - - if len(args) == 1: - if args[0] == "images": - list_canned_images(scripts_path) - return True - elif args[0] == "source-plugins": - list_source_plugins() - return True - elif args[0] == "properties": - return True - else: - return False - - if len(args) == 2: - if args[0] == "properties": - wks_file = args[1] - print "print properties contained in wks file: %s" % wks_file - return True - elif args[0] == "property": - print "print property values for property: %s" % args[1] - return True - elif args[1] == "help": - wks_file = args[0] - fullpath = find_canned_image(scripts_path, wks_file) - if not fullpath: - print "No image named %s found, exiting. (Use 'wic list images' to list available images, or specify a fully-qualified OE kickstart (.wks) filename)\n" % wks_file - sys.exit(1) - list_canned_image_help(scripts_path, fullpath) - return True - else: - return False - - return False 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 index ae599cbb70..5af58a12f7 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py @@ -1,6 +1,6 @@ # Recipe creation tool - create command plugin # -# Copyright (C) 2014 Intel Corporation +# 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 @@ -21,13 +21,29 @@ 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 @@ -37,105 +53,465 @@ def tinfoil_init(instance): global tinfoil tinfoil = instance -class RecipeHandler(): +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): + def checkfiles(path, speclist, recursive=False): results = [] - for spec in speclist: - results.extend(glob.glob(os.path.join(path, spec))) + 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 - def genfunction(self, outlines, funcname, content): - outlines.append('%s () {' % funcname) + @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('\t%s' % line) + 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): + 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 fetch_source(uri, destdir): - import bb.data - bb.utils.mkdirhier(destdir) +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) - bb.data.update_data(localdata) - localdata.setVar('BB_STRICT_CHECKSUM', '') + # 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}') - 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() - 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) - except bb.fetch2.BBFetchException, e: - raise bb.build.FuncFailed(e) - finally: - os.chdir(olddir) - return ret - -def supports_srcrev(uri): - localdata = bb.data.createCopy(tinfoil.config_data) - bb.data.update_data(localdata) - fetcher = bb.fetch2.Fetch([uri], localdata) - urldata = fetcher.ud - for u in urldata: - if urldata[u].method.supports_srcrev(): + 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 = '' - if '://' in args.source: + srcrev = '${AUTOREV}' + + if os.path.isfile(source): + source = 'file://%s' % os.path.abspath(source) + + if scriptutils.is_src_url(source): # Fetch a URL - srcuri = args.source - if args.extract_to: - srctree = args.extract_to - else: - tempsrc = tempfile.mkdtemp(prefix='recipetool-') - srctree = tempsrc + 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) - checksums = fetch_source(args.source, srctree) + 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 and os.path.isdir(os.path.join(srctree, dirlist[0])): - # We unpacked a single directory, so we should use that - srcsubdir = dirlist[0] - srctree = os.path.join(srctree, srcsubdir) + 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(args.source): - logger.error('Invalid source directory %s' % args.source) + if not os.path.isdir(source): + logger.error('Invalid source directory %s' % source) sys.exit(1) + srctree = source srcuri = '' - srctree = args.source + 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 - outfile = args.outfile + 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) @@ -147,52 +523,55 @@ def create_recipe(args): 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.)') - lines_before.append('#') - - licvalues = guess_license(srctree) - lic_files_chksum = [] - 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])) - 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; if that is correct you should separate') - lines_before.append('# these in the LICENSE value using & if the multiple licenses all apply, or | if there') - lines_before.append('# is a choice between the multiple licenses. If in doubt, check the accompanying') - lines_before.append('# documentation to determine which situation is applicable.') - 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'] - lines_before.append('LICENSE = "%s"' % ' '.join(licenses)) - lines_before.append('LIC_FILES_CHKSUM = "%s"' % ' \\\n '.join(lic_files_chksum)) + # 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 - # we'd also want a way to automatically set outfile based upon auto-detecting these values from the source if possible - 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 - pv = None + 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 srcuri: - if pv and pv not in 'git svn hg'.split(): - srcuri = srcuri.replace(pv, '${PV}') + 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 @@ -203,17 +582,17 @@ def create_recipe(args): if srcuri and supports_srcrev(srcuri): lines_before.append('') lines_before.append('# Modify these as desired') - lines_before.append('PV = "1.0+git${SRCPV}"') - lines_before.append('SRCREV = "${AUTOREV}"') + 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 pv: - if srcsubdir == "%s-%s" % (pn, pv): - # This would be the default, so we don't need to set S in the recipe - srcsubdir = '' - if srcsubdir: - if pv and pv not in 'git svn hg'.split(): - srcsubdir = srcsubdir.replace(pv, '${PV}') + 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('') @@ -221,43 +600,253 @@ def create_recipe(args): 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 - handlers = [] + logger.debug('Loading recipe handlers') + raw_handlers = [] for plugin in plugins: if hasattr(plugin, 'register_recipe_handlers'): - plugin.register_recipe_handlers(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 - classes = [] - handled = [] + if args.binary: + classes.append('bin_package') + handled.append('buildsystem') + for handler in handlers: - handler.process(srctree, classes, lines_before, lines_after, handled) + 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: - f.write('\n'.join(outlines) + '\n') - logger.info('Recipe %s has been created; further editing may be required to make it fully functional' % outfile) + 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: - shutil.rmtree(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', True) + 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 @@ -292,43 +881,149 @@ def get_license_md5sums(d, static_only=False): 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 guess_license(srctree): +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(tinfoil.config_data) + md5sums = get_license_md5sums(d) licenses = [] - licspecs = ['LICENSE*', 'COPYING*', '*[Ll]icense*', 'LICENCE*', 'LEGAL*', '[Ll]egal*', '*GPL*', 'README.lic*', 'COPYRIGHT*', '[Cc]opyright*'] + 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): - licfiles.append(os.path.join(root, fn)) + 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, 'Unknown') + 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', True) + 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.iteritems(): + for pc, pkg in pkgmap.items(): pkgdatafile = os.path.join(pkgdatadir, 'runtime', pkg) if os.path.exists(pkgdatafile): with open(pkgdatafile, 'r') as f: @@ -337,81 +1032,134 @@ def read_pkgconfig_provides(d): recipemap[pc] = line.split(':', 1)[1].strip() return recipemap -def convert_pkginfo(pkginfofile): - values = {} - with open(pkginfofile, 'r') as f: - indesc = False - for line in f: - if indesc: - if line.strip(): - values['DESCRIPTION'] += ' ' + line.strip() - else: - indesc = False - else: - splitline = line.split(': ', 1) - key = line[0] - value = line[1] - if key == 'LICENSE': - for dep in value.split(','): - dep = dep.split()[0] - mapped = depmap.get(dep, '') - if mapped: - depends.append(mapped) - elif key == 'License': - values['LICENSE'] = value - elif key == 'Summary': - values['SUMMARY'] = value - elif key == 'Description': - values['DESCRIPTION'] = value - indesc = True - return values - 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')) as f: + with open(os.path.join(debpath, 'control'), 'r', errors='surrogateescape') as f: indesc = False for line in f: if indesc: - if line.strip(): + if line.startswith(' '): if line.startswith(' This package contains'): indesc = False else: - values['DESCRIPTION'] += ' ' + line.strip() + if 'DESCRIPTION' in values: + values['DESCRIPTION'] += ' ' + line.strip() + else: + values['DESCRIPTION'] = line.strip() else: indesc = False - else: + if not indesc: splitline = line.split(':', 1) - key = line[0] - value = line[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 == 'Section': - values['SECTION'] = value 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) + #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_command(subparsers): +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', required=True) + 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.set_defaults(func=create_recipe) + 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 index 6c9e0efa2a..e914e53aab 100644 --- a/scripts/lib/recipetool/create_buildsys.py +++ b/scripts/lib/recipetool/create_buildsys.py @@ -1,6 +1,6 @@ # Recipe creation tool - create command build system handlers # -# Copyright (C) 2014 Intel Corporation +# 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 @@ -17,23 +17,35 @@ import re import logging -from recipetool.create import RecipeHandler, read_pkgconfig_provides +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): + 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('') @@ -41,8 +53,266 @@ class CmakeRecipeHandler(RecipeHandler): 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): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): if 'buildsystem' in handled: return False @@ -55,8 +325,9 @@ class SconsRecipeHandler(RecipeHandler): return True return False + class QmakeRecipeHandler(RecipeHandler): - def process(self, srctree, classes, lines_before, lines_after, handled): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): if 'buildsystem' in handled: return False @@ -66,29 +337,47 @@ class QmakeRecipeHandler(RecipeHandler): return True return False + class AutotoolsRecipeHandler(RecipeHandler): - def process(self, srctree, classes, lines_before, lines_after, handled): + 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) + values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, extravalues) classes.extend(values.pop('inherit', '').split()) - for var, value in values.iteritems(): + 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') as f: + 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') @@ -102,136 +391,328 @@ class AutotoolsRecipeHandler(RecipeHandler): return False @staticmethod - def extract_autotools_deps(outlines, srctree, acfile=None): + def extract_autotools_deps(outlines, srctree, extravalues=None, acfile=None): import shlex - import oe.package + + # 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 = [] - # FIXME this mapping is very thin + # 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'} + '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'} - - ignoredeps = ['gcc-runtime', 'glibc', 'uclibc'] - - pkg_re = re.compile('PKG_CHECK_MODULES\(\[?[a-zA-Z0-9]*\]?, \[?([^,\]]*)[),].*') - lib_re = re.compile('AC_CHECK_LIB\(\[?([a-zA-Z0-9]*)\]?, .*') - progs_re = re.compile('_PROGS?\(\[?[a-zA-Z0-9]*\]?, \[?([^,\]]*)\]?[),].*') + '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('([^ ><=]+)( [<>=]+ [^ ><=]+)?') - - # Build up lib library->package mapping - shlib_providers = oe.package.read_shlib_providers(tinfoil.config_data) - libdir = tinfoil.config_data.getVar('libdir', True) - base_libdir = tinfoil.config_data.getVar('base_libdir', True) - libpaths = list(set([base_libdir, libdir])) - libname_re = re.compile('^lib(.+)\.so.*$') - pkglibmap = {} - for lib, item in shlib_providers.iteritems(): - for path, pkg in item.iteritems(): - 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 - recipelibmap = {} - pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) - for libname, pkg in pkglibmap.iteritems(): - try: - with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: - for line in f: - if line.startswith('PN:'): - 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 + 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, ['configure.ac', 'configure.in']) + srcfiles = RecipeHandler.checkfiles(srctree, ['acinclude.m4', 'configure.ac', 'configure.in']) + pcdeps = [] + libdeps = [] deps = [] unmapped = [] - unmappedlibs = [] - with open(srcfiles[0], 'r') as f: - for line in f: - if 'PKG_CHECK_MODULES' in line: - res = pkg_re.search(line) + + 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: - res = dep_re.findall(res.group(1)) - if res: - pcdeps.extend([x[0] for x in res]) - inherits.append('pkgconfig') - if line.lstrip().startswith('AM_GNU_GETTEXT'): - inherits.append('gettext') - elif 'AC_CHECK_PROG' in line or 'AC_PATH_PROG' in line: - res = progs_re.search(line) + 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: - for prog in shlex.split(res.group(1)): - prog = prog.split()[0] - progclass = progclassmap.get(prog, None) - if progclass: - inherits.append(progclass) - else: + 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) - else: - if not prog.startswith('$'): - unmapped.append(prog) - elif 'AC_CHECK_LIB' in line: - res = lib_re.search(line) + 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: - lib = res.group(1) - libdep = recipelibmap.get(lib, None) - if libdep: - deps.append(libdep) - else: - if libdep is None: - if not lib.startswith('$'): - unmappedlibs.append(lib) - elif 'AC_PATH_X' in line: - deps.append('libx11') - - if unmapped: - outlines.append('# NOTE: the following prog dependencies are unknown, ignoring: %s' % ' '.join(unmapped)) + 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 unmappedlibs: - outlines.append('# NOTE: the following library dependencies are unknown, ignoring: %s' % ' '.join(unmappedlibs)) - outlines.append('# (this is based on recipes that have previously been built and packaged)') + if in_keyword: + process_macro(in_keyword, partial) - recipemap = read_pkgconfig_provides(tinfoil.config_data) - unmapped = [] - for pcdep in pcdeps: - recipe = recipemap.get(pcdep, None) - if recipe: - deps.append(recipe) - else: - if not pcdep.startswith('$'): - unmapped.append(pcdep) - - deps = set(deps).difference(set(ignoredeps)) + 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: unable to map the following pkg-config dependencies: %s' % ' '.join(unmapped)) - outlines.append('# (this is based on recipes that have previously been built and packaged)') + outlines.append('# NOTE: the following prog dependencies are unknown, ignoring: %s' % ' '.join(list(set(unmapped)))) - if deps: - values['DEPENDS'] = ' '.join(deps) + 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))) @@ -239,12 +720,41 @@ class AutotoolsRecipeHandler(RecipeHandler): 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): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): if 'buildsystem' in handled: return False - makefile = RecipeHandler.checkfiles(srctree, ['Makefile']) + 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') @@ -260,7 +770,7 @@ class MakefileRecipeHandler(RecipeHandler): 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.iteritems(): + 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)) @@ -279,7 +789,7 @@ class MakefileRecipeHandler(RecipeHandler): installtarget = True try: - stdout, stderr = bb.process.run('make -qn install', cwd=srctree, shell=True) + stdout, stderr = bb.process.run('make -n install', cwd=srctree, shell=True) except bb.process.ExecutionError as e: if e.exitcode != 1: installtarget = False @@ -287,7 +797,7 @@ class MakefileRecipeHandler(RecipeHandler): if installtarget: func.append('# This is a guess; additional arguments may be required') makeargs = '' - with open(makefile[0], 'r') as f: + with open(makefile[0], 'r', errors='surrogateescape') as f: for i in range(1, 100): if 'DESTDIR' in f.readline(): makeargs += " 'DESTDIR=${D}'" @@ -307,13 +817,73 @@ class MakefileRecipeHandler(RecipeHandler): self.genfunction(lines_after, 'do_install', ['# Specify install commands here']) -def plugin_init(pluginlist): - pass +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): - # These are in a specific order so that the right one is detected first - handlers.append(CmakeRecipeHandler()) - handlers.append(AutotoolsRecipeHandler()) - handlers.append(SconsRecipeHandler()) - handlers.append(QmakeRecipeHandler()) - handlers.append(MakefileRecipeHandler()) + # 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 index f4f4212559..ec5449bee9 100644 --- a/scripts/lib/recipetool/create_buildsys_python.py +++ b/scripts/lib/recipetool/create_buildsys_python.py @@ -61,8 +61,6 @@ class PythonRecipeHandler(RecipeHandler): } # PN/PV are already set by recipetool core & desc can be extremely long excluded_fields = [ - 'Name', - 'Version', 'Description', ] setup_parse_map = { @@ -88,8 +86,11 @@ class PythonRecipeHandler(RecipeHandler): ] setuparg_multi_line_values = ['Description'] replacements = [ + ('License', r' +$', ''), + ('License', r'^ +', ''), ('License', r' ', '-'), - ('License', r'-License$', ''), + ('License', r'^GNU-', ''), + ('License', r'-[Ll]icen[cs]e(,?-[Vv]ersion)?', ''), ('License', r'^UNKNOWN$', ''), # Remove currently unhandled version numbers from these variables @@ -159,7 +160,7 @@ class PythonRecipeHandler(RecipeHandler): def __init__(self): pass - def process(self, srctree, classes, lines_before, lines_after, handled): + def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): if 'buildsystem' in handled: return False @@ -218,6 +219,9 @@ class PythonRecipeHandler(RecipeHandler): 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: @@ -225,60 +229,53 @@ class PythonRecipeHandler(RecipeHandler): 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 - bbinfo = {} - for field, values in info.iteritems(): + for field, values in info.items(): if field in self.excluded_fields: continue if field not in self.bbvar_map: continue - if isinstance(values, basestring): + 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 bbinfo and value: - bbinfo[bbvar] = value - - comment_lic_line = None - for pos, line in enumerate(list(lines_before)): - if line.startswith('#') and 'LICENSE' in line: - comment_lic_line = pos - elif line.startswith('LICENSE =') and 'LICENSE' in bbinfo: - if line in ('LICENSE = "Unknown"', 'LICENSE = "CLOSED"'): - lines_before[pos] = 'LICENSE = "{}"'.format(bbinfo['LICENSE']) - if line == 'LICENSE = "CLOSED"' and comment_lic_line: - lines_before[comment_lic_line:pos] = [ - '# WARNING: the following LICENSE value is a best guess - it is your', - '# responsibility to verify that the value is complete and correct.' - ] - del bbinfo['LICENSE'] - - src_uri_line = None - for pos, line in enumerate(lines_before): - if line.startswith('SRC_URI ='): - src_uri_line = pos - - if bbinfo: - mdinfo = [''] - for k in sorted(bbinfo): - v = bbinfo[k] - mdinfo.append('{} = "{}"'.format(k, v)) - lines_before[src_uri_line-1:src_uri_line-1] = mdinfo + 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) @@ -291,8 +288,8 @@ class PythonRecipeHandler(RecipeHandler): 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.iterkeys()))) - for feature, feature_reqs in extras_req.iteritems(): + 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)) @@ -358,7 +355,7 @@ class PythonRecipeHandler(RecipeHandler): # Naive mapping of setup() arguments to PKG-INFO field names for d in [info, non_literals]: - for key, value in d.items(): + for key, value in list(d.items()): new_key = _map(key) if new_key != key: del d[key] @@ -433,14 +430,14 @@ class PythonRecipeHandler(RecipeHandler): return value value = info[variable] - if isinstance(value, basestring): + 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, 'iteritems'): - for dkey, dvalue in value.iteritems(): + 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) @@ -501,8 +498,10 @@ class PythonRecipeHandler(RecipeHandler): 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 @@ -533,11 +532,11 @@ class PythonRecipeHandler(RecipeHandler): def parse_pkgdata_for_python_packages(self): suffixes = [t[0] for t in imp.get_suffixes()] - pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) + 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', 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, @@ -555,7 +554,7 @@ class PythonRecipeHandler(RecipeHandler): else: continue - for fn in files_info.iterkeys(): + for fn in files_info: for suffix in suffixes: if fn.endswith(suffix): break @@ -563,6 +562,8 @@ class PythonRecipeHandler(RecipeHandler): 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) @@ -590,7 +591,7 @@ class PythonRecipeHandler(RecipeHandler): if 'stderr' not in popenargs: popenargs['stderr'] = subprocess.STDOUT try: - return subprocess.check_output(cmd, **popenargs) + return subprocess.check_output(cmd, **popenargs).decode('utf-8') except OSError as exc: logger.error('Unable to run `{}`: {}', ' '.join(cmd), exc) raise @@ -605,7 +606,7 @@ def gather_setup_info(fileobj): visitor.visit(parsed) non_literals, extensions = {}, [] - for key, value in visitor.keywords.items(): + for key, value in list(visitor.keywords.items()): if key == 'ext_modules': if isinstance(value, list): for ext in value: @@ -637,7 +638,7 @@ class SetupScriptVisitor(ast.NodeVisitor): def visit_setup(self, node): call = LiteralAstTransform().visit(node) self.keywords = call.keywords - for k, v in self.keywords.iteritems(): + for k, v in self.keywords.items(): if has_non_literals(v): self.non_literals.append(k) @@ -703,18 +704,14 @@ class LiteralAstTransform(ast.NodeTransformer): def has_non_literals(value): if isinstance(value, ast.AST): return True - elif isinstance(value, basestring): + elif isinstance(value, str): return False - elif hasattr(value, 'itervalues'): - return any(has_non_literals(v) for v in value.itervalues()) + 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 plugin_init(pluginlist): - pass - - def register_recipe_handlers(handlers): # We need to make sure this is ahead of the makefile fallback handler - handlers.insert(0, PythonRecipeHandler()) + 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/scriptutils.py b/scripts/lib/scriptutils.py index e7861268a5..4ccbe5c108 100644 --- a/scripts/lib/scriptutils.py +++ b/scripts/lib/scriptutils.py @@ -19,10 +19,12 @@ import sys import os import logging import glob +import argparse +import subprocess -def logger_create(name): +def logger_create(name, stream=None): logger = logging.getLogger(name) - loggerhandler = logging.StreamHandler() + loggerhandler = logging.StreamHandler(stream=stream) loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) logger.addHandler(loggerhandler) logger.setLevel(logging.INFO) @@ -50,11 +52,84 @@ def load_plugins(logger, plugins, pluginpath): 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 = os.path.splitext(os.path.basename(fn))[0] - if name != '__init__': + 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) + 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/3rdparty/pykickstart/base.py b/scripts/lib/wic/3rdparty/pykickstart/base.py deleted file mode 100644 index e6c8f56f9d..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/base.py +++ /dev/null @@ -1,466 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2006, 2007, 2008 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -""" -Base classes for creating commands and syntax version object. - -This module exports several important base classes: - - BaseData - The base abstract class for all data objects. Data objects - are contained within a BaseHandler object. - - BaseHandler - The base abstract class from which versioned kickstart - handler are derived. Subclasses of BaseHandler hold - BaseData and KickstartCommand objects. - - DeprecatedCommand - An abstract subclass of KickstartCommand that should - be further subclassed by users of this module. When - a subclass is used, a warning message will be - printed. - - KickstartCommand - The base abstract class for all kickstart commands. - Command objects are contained within a BaseHandler - object. -""" -import gettext -gettext.textdomain("pykickstart") -_ = lambda x: gettext.ldgettext("pykickstart", x) - -import types -import warnings -from pykickstart.errors import * -from pykickstart.ko import * -from pykickstart.parser import Packages -from pykickstart.version import versionToString - -### -### COMMANDS -### -class KickstartCommand(KickstartObject): - """The base class for all kickstart commands. This is an abstract class.""" - removedKeywords = [] - removedAttrs = [] - - def __init__(self, writePriority=0, *args, **kwargs): - """Create a new KickstartCommand instance. This method must be - provided by all subclasses, but subclasses must call - KickstartCommand.__init__ first. Instance attributes: - - currentCmd -- The name of the command in the input file that - caused this handler to be run. - currentLine -- The current unprocessed line from the input file - that caused this handler to be run. - handler -- A reference to the BaseHandler subclass this - command is contained withing. This is needed to - allow referencing of Data objects. - lineno -- The current line number in the input file. - writePriority -- An integer specifying when this command should be - printed when iterating over all commands' __str__ - methods. The higher the number, the later this - command will be written. All commands with the - same priority will be written alphabetically. - """ - - # We don't want people using this class by itself. - if self.__class__ is KickstartCommand: - raise TypeError, "KickstartCommand is an abstract class." - - KickstartObject.__init__(self, *args, **kwargs) - - self.writePriority = writePriority - - # These will be set by the dispatcher. - self.currentCmd = "" - self.currentLine = "" - self.handler = None - self.lineno = 0 - - # If a subclass provides a removedKeywords list, remove all the - # members from the kwargs list before we start processing it. This - # ensures that subclasses don't continue to recognize arguments that - # were removed. - for arg in filter(kwargs.has_key, self.removedKeywords): - kwargs.pop(arg) - - def __call__(self, *args, **kwargs): - """Set multiple attributes on a subclass of KickstartCommand at once - via keyword arguments. Valid attributes are anything specified in - a subclass, but unknown attributes will be ignored. - """ - for (key, val) in kwargs.items(): - # Ignore setting attributes that were removed in a subclass, as - # if they were unknown attributes. - if key in self.removedAttrs: - continue - - if hasattr(self, key): - setattr(self, key, val) - - def __str__(self): - """Return a string formatted for output to a kickstart file. This - method must be provided by all subclasses. - """ - return KickstartObject.__str__(self) - - def parse(self, args): - """Parse the list of args and set data on the KickstartCommand object. - This method must be provided by all subclasses. - """ - raise TypeError, "parse() not implemented for KickstartCommand" - - def apply(self, instroot="/"): - """Write out the configuration related to the KickstartCommand object. - Subclasses which do not provide this method will not have their - configuration written out. - """ - return - - def dataList(self): - """For commands that can occur multiple times in a single kickstart - file (like network, part, etc.), return the list that we should - append more data objects to. - """ - return None - - def deleteRemovedAttrs(self): - """Remove all attributes from self that are given in the removedAttrs - list. This method should be called from __init__ in a subclass, - but only after the superclass's __init__ method has been called. - """ - for attr in filter(lambda k: hasattr(self, k), self.removedAttrs): - delattr(self, attr) - - # Set the contents of the opts object (an instance of optparse.Values - # returned by parse_args) as attributes on the KickstartCommand object. - # It's useful to call this from KickstartCommand subclasses after parsing - # the arguments. - def _setToSelf(self, optParser, opts): - self._setToObj(optParser, opts, self) - - # Sets the contents of the opts object (an instance of optparse.Values - # returned by parse_args) as attributes on the provided object obj. It's - # useful to call this from KickstartCommand subclasses that handle lists - # of objects (like partitions, network devices, etc.) and need to populate - # a Data object. - def _setToObj(self, optParser, opts, obj): - for key in filter (lambda k: getattr(opts, k) != None, optParser.keys()): - setattr(obj, key, getattr(opts, key)) - -class DeprecatedCommand(KickstartCommand): - """Specify that a command is deprecated and no longer has any function. - Any command that is deprecated should be subclassed from this class, - only specifying an __init__ method that calls the superclass's __init__. - This is an abstract class. - """ - def __init__(self, writePriority=None, *args, **kwargs): - # We don't want people using this class by itself. - if self.__class__ is KickstartCommand: - raise TypeError, "DeprecatedCommand is an abstract class." - - # Create a new DeprecatedCommand instance. - KickstartCommand.__init__(self, writePriority, *args, **kwargs) - - def __str__(self): - """Placeholder since DeprecatedCommands don't work anymore.""" - return "" - - def parse(self, args): - """Print a warning message if the command is seen in the input file.""" - mapping = {"lineno": self.lineno, "cmd": self.currentCmd} - warnings.warn(_("Ignoring deprecated command on line %(lineno)s: The %(cmd)s command has been deprecated and no longer has any effect. It may be removed from future releases, which will result in a fatal error from kickstart. Please modify your kickstart file to remove this command.") % mapping, DeprecationWarning) - - -### -### HANDLERS -### -class BaseHandler(KickstartObject): - """Each version of kickstart syntax is provided by a subclass of this - class. These subclasses are what users will interact with for parsing, - extracting data, and writing out kickstart files. This is an abstract - class. - - version -- The version this syntax handler supports. This is set by - a class attribute of a BaseHandler subclass and is used to - set up the command dict. It is for read-only use. - """ - version = None - - def __init__(self, mapping=None, dataMapping=None, commandUpdates=None, - dataUpdates=None, *args, **kwargs): - """Create a new BaseHandler instance. This method must be provided by - all subclasses, but subclasses must call BaseHandler.__init__ first. - - mapping -- A custom map from command strings to classes, - useful when creating your own handler with - special command objects. It is otherwise unused - and rarely needed. If you give this argument, - the mapping takes the place of the default one - and so must include all commands you want - recognized. - dataMapping -- This is the same as mapping, but for data - objects. All the same comments apply. - commandUpdates -- This is similar to mapping, but does not take - the place of the defaults entirely. Instead, - this mapping is applied after the defaults and - updates it with just the commands you want to - modify. - dataUpdates -- This is the same as commandUpdates, but for - data objects. - - - Instance attributes: - - commands -- A mapping from a string command to a KickstartCommand - subclass object that handles it. Multiple strings can - map to the same object, but only one instance of the - command object should ever exist. Most users should - never have to deal with this directly, as it is - manipulated internally and called through dispatcher. - currentLine -- The current unprocessed line from the input file - that caused this handler to be run. - packages -- An instance of pykickstart.parser.Packages which - describes the packages section of the input file. - platform -- A string describing the hardware platform, which is - needed only by system-config-kickstart. - scripts -- A list of pykickstart.parser.Script instances, which is - populated by KickstartParser.addScript and describes the - %pre/%post/%traceback script section of the input file. - """ - - # We don't want people using this class by itself. - if self.__class__ is BaseHandler: - raise TypeError, "BaseHandler is an abstract class." - - KickstartObject.__init__(self, *args, **kwargs) - - # This isn't really a good place for these, but it's better than - # everything else I can think of. - self.scripts = [] - self.packages = Packages() - self.platform = "" - - # These will be set by the dispatcher. - self.commands = {} - self.currentLine = 0 - - # A dict keyed by an integer priority number, with each value being a - # list of KickstartCommand subclasses. This dict is maintained by - # registerCommand and used in __str__. No one else should be touching - # it. - self._writeOrder = {} - - self._registerCommands(mapping, dataMapping, commandUpdates, dataUpdates) - - def __str__(self): - """Return a string formatted for output to a kickstart file.""" - retval = "" - - if self.platform != "": - retval += "#platform=%s\n" % self.platform - - retval += "#version=%s\n" % versionToString(self.version) - - lst = self._writeOrder.keys() - lst.sort() - - for prio in lst: - for obj in self._writeOrder[prio]: - retval += obj.__str__() - - for script in self.scripts: - retval += script.__str__() - - retval += self.packages.__str__() - - return retval - - def _insertSorted(self, lst, obj): - length = len(lst) - i = 0 - - while i < length: - # If the two classes have the same name, it's because we are - # overriding an existing class with one from a later kickstart - # version, so remove the old one in favor of the new one. - if obj.__class__.__name__ > lst[i].__class__.__name__: - i += 1 - elif obj.__class__.__name__ == lst[i].__class__.__name__: - lst[i] = obj - return - elif obj.__class__.__name__ < lst[i].__class__.__name__: - break - - if i >= length: - lst.append(obj) - else: - lst.insert(i, obj) - - def _setCommand(self, cmdObj): - # Add an attribute on this version object. We need this to provide a - # way for clients to access the command objects. We also need to strip - # off the version part from the front of the name. - if cmdObj.__class__.__name__.find("_") != -1: - name = unicode(cmdObj.__class__.__name__.split("_", 1)[1]) - else: - name = unicode(cmdObj.__class__.__name__).lower() - - setattr(self, name.lower(), cmdObj) - - # Also, add the object into the _writeOrder dict in the right place. - if cmdObj.writePriority is not None: - if self._writeOrder.has_key(cmdObj.writePriority): - self._insertSorted(self._writeOrder[cmdObj.writePriority], cmdObj) - else: - self._writeOrder[cmdObj.writePriority] = [cmdObj] - - def _registerCommands(self, mapping=None, dataMapping=None, commandUpdates=None, - dataUpdates=None): - if mapping == {} or mapping == None: - from pykickstart.handlers.control import commandMap - cMap = commandMap[self.version] - else: - cMap = mapping - - if dataMapping == {} or dataMapping == None: - from pykickstart.handlers.control import dataMap - dMap = dataMap[self.version] - else: - dMap = dataMapping - - if type(commandUpdates) == types.DictType: - cMap.update(commandUpdates) - - if type(dataUpdates) == types.DictType: - dMap.update(dataUpdates) - - for (cmdName, cmdClass) in cMap.iteritems(): - # First make sure we haven't instantiated this command handler - # already. If we have, we just need to make another mapping to - # it in self.commands. - cmdObj = None - - for (key, val) in self.commands.iteritems(): - if val.__class__.__name__ == cmdClass.__name__: - cmdObj = val - break - - # If we didn't find an instance in self.commands, create one now. - if cmdObj == None: - cmdObj = cmdClass() - self._setCommand(cmdObj) - - # Finally, add the mapping to the commands dict. - self.commands[cmdName] = cmdObj - self.commands[cmdName].handler = self - - # We also need to create attributes for the various data objects. - # No checks here because dMap is a bijection. At least, that's what - # the comment says. Hope no one screws that up. - for (dataName, dataClass) in dMap.iteritems(): - setattr(self, dataName, dataClass) - - def dispatcher(self, args, lineno): - """Call the appropriate KickstartCommand handler for the current line - in the kickstart file. A handler for the current command should - be registered, though a handler of None is not an error. Returns - the data object returned by KickstartCommand.parse. - - args -- A list of arguments to the current command - lineno -- The line number in the file, for error reporting - """ - cmd = args[0] - - if not self.commands.has_key(cmd): - raise KickstartParseError, formatErrorMsg(lineno, msg=_("Unknown command: %s" % cmd)) - elif self.commands[cmd] != None: - self.commands[cmd].currentCmd = cmd - self.commands[cmd].currentLine = self.currentLine - self.commands[cmd].lineno = lineno - - # The parser returns the data object that was modified. This could - # be a BaseData subclass that should be put into a list, or it - # could be the command handler object itself. - obj = self.commands[cmd].parse(args[1:]) - lst = self.commands[cmd].dataList() - if lst is not None: - lst.append(obj) - - return obj - - def maskAllExcept(self, lst): - """Set all entries in the commands dict to None, except the ones in - the lst. All other commands will not be processed. - """ - self._writeOrder = {} - - for (key, val) in self.commands.iteritems(): - if not key in lst: - self.commands[key] = None - - def hasCommand(self, cmd): - """Return true if there is a handler for the string cmd.""" - return hasattr(self, cmd) - - -### -### DATA -### -class BaseData(KickstartObject): - """The base class for all data objects. This is an abstract class.""" - removedKeywords = [] - removedAttrs = [] - - def __init__(self, *args, **kwargs): - """Create a new BaseData instance. - - lineno -- Line number in the ks-file where this object was defined - """ - - # We don't want people using this class by itself. - if self.__class__ is BaseData: - raise TypeError, "BaseData is an abstract class." - - KickstartObject.__init__(self, *args, **kwargs) - self.lineno = 0 - - def __str__(self): - """Return a string formatted for output to a kickstart file.""" - return "" - - def __call__(self, *args, **kwargs): - """Set multiple attributes on a subclass of BaseData at once via - keyword arguments. Valid attributes are anything specified in a - subclass, but unknown attributes will be ignored. - """ - for (key, val) in kwargs.items(): - # Ignore setting attributes that were removed in a subclass, as - # if they were unknown attributes. - if key in self.removedAttrs: - continue - - if hasattr(self, key): - setattr(self, key, val) - - def deleteRemovedAttrs(self): - """Remove all attributes from self that are given in the removedAttrs - list. This method should be called from __init__ in a subclass, - but only after the superclass's __init__ method has been called. - """ - for attr in filter(lambda k: hasattr(self, k), self.removedAttrs): - delattr(self, attr) diff --git a/scripts/lib/wic/3rdparty/pykickstart/commands/__init__.py b/scripts/lib/wic/3rdparty/pykickstart/commands/__init__.py deleted file mode 100644 index 2d94550935..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/commands/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2009 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -import bootloader, partition diff --git a/scripts/lib/wic/3rdparty/pykickstart/commands/bootloader.py b/scripts/lib/wic/3rdparty/pykickstart/commands/bootloader.py deleted file mode 100644 index c2b552f689..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/commands/bootloader.py +++ /dev/null @@ -1,216 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2007 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -from pykickstart.base import * -from pykickstart.options import * - -class FC3_Bootloader(KickstartCommand): - removedKeywords = KickstartCommand.removedKeywords - removedAttrs = KickstartCommand.removedAttrs - - def __init__(self, writePriority=10, *args, **kwargs): - KickstartCommand.__init__(self, writePriority, *args, **kwargs) - self.op = self._getParser() - - self.driveorder = kwargs.get("driveorder", []) - self.appendLine = kwargs.get("appendLine", "") - self.forceLBA = kwargs.get("forceLBA", False) - self.linear = kwargs.get("linear", True) - self.location = kwargs.get("location", "") - self.md5pass = kwargs.get("md5pass", "") - self.password = kwargs.get("password", "") - self.upgrade = kwargs.get("upgrade", False) - self.useLilo = kwargs.get("useLilo", False) - - self.deleteRemovedAttrs() - - def _getArgsAsStr(self): - retval = "" - - if self.appendLine != "": - retval += " --append=\"%s\"" % self.appendLine - if self.linear: - retval += " --linear" - if self.location: - retval += " --location=%s" % self.location - if hasattr(self, "forceLBA") and self.forceLBA: - retval += " --lba32" - if self.password != "": - retval += " --password=\"%s\"" % self.password - if self.md5pass != "": - retval += " --md5pass=\"%s\"" % self.md5pass - if self.upgrade: - retval += " --upgrade" - if self.useLilo: - retval += " --useLilo" - if len(self.driveorder) > 0: - retval += " --driveorder=\"%s\"" % ",".join(self.driveorder) - - return retval - - def __str__(self): - retval = KickstartCommand.__str__(self) - - if self.location != "": - retval += "# System bootloader configuration\nbootloader" - retval += self._getArgsAsStr() + "\n" - - return retval - - def _getParser(self): - def driveorder_cb (option, opt_str, value, parser): - for d in value.split(','): - parser.values.ensure_value(option.dest, []).append(d) - - op = KSOptionParser() - op.add_option("--append", dest="appendLine") - op.add_option("--linear", dest="linear", action="store_true", - default=True) - op.add_option("--nolinear", dest="linear", action="store_false") - op.add_option("--location", dest="location", type="choice", - default="mbr", - choices=["mbr", "partition", "none", "boot"]) - op.add_option("--lba32", dest="forceLBA", action="store_true", - default=False) - op.add_option("--password", dest="password", default="") - op.add_option("--md5pass", dest="md5pass", default="") - op.add_option("--upgrade", dest="upgrade", action="store_true", - default=False) - op.add_option("--useLilo", dest="useLilo", action="store_true", - default=False) - op.add_option("--driveorder", dest="driveorder", action="callback", - callback=driveorder_cb, nargs=1, type="string") - return op - - def parse(self, args): - (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) - self._setToSelf(self.op, opts) - - if self.currentCmd == "lilo": - self.useLilo = True - - return self - -class FC4_Bootloader(FC3_Bootloader): - removedKeywords = FC3_Bootloader.removedKeywords + ["linear", "useLilo"] - removedAttrs = FC3_Bootloader.removedAttrs + ["linear", "useLilo"] - - def __init__(self, writePriority=10, *args, **kwargs): - FC3_Bootloader.__init__(self, writePriority, *args, **kwargs) - - def _getArgsAsStr(self): - retval = "" - if self.appendLine != "": - retval += " --append=\"%s\"" % self.appendLine - if self.location: - retval += " --location=%s" % self.location - if hasattr(self, "forceLBA") and self.forceLBA: - retval += " --lba32" - if self.password != "": - retval += " --password=\"%s\"" % self.password - if self.md5pass != "": - retval += " --md5pass=\"%s\"" % self.md5pass - if self.upgrade: - retval += " --upgrade" - if len(self.driveorder) > 0: - retval += " --driveorder=\"%s\"" % ",".join(self.driveorder) - return retval - - def _getParser(self): - op = FC3_Bootloader._getParser(self) - op.remove_option("--linear") - op.remove_option("--nolinear") - op.remove_option("--useLilo") - return op - - def parse(self, args): - (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) - self._setToSelf(self.op, opts) - return self - -class F8_Bootloader(FC4_Bootloader): - removedKeywords = FC4_Bootloader.removedKeywords - removedAttrs = FC4_Bootloader.removedAttrs - - def __init__(self, writePriority=10, *args, **kwargs): - FC4_Bootloader.__init__(self, writePriority, *args, **kwargs) - - self.timeout = kwargs.get("timeout", None) - self.default = kwargs.get("default", "") - - def _getArgsAsStr(self): - ret = FC4_Bootloader._getArgsAsStr(self) - - if self.timeout is not None: - ret += " --timeout=%d" %(self.timeout,) - if self.default: - ret += " --default=%s" %(self.default,) - - return ret - - def _getParser(self): - op = FC4_Bootloader._getParser(self) - op.add_option("--timeout", dest="timeout", type="int") - op.add_option("--default", dest="default") - return op - -class F12_Bootloader(F8_Bootloader): - removedKeywords = F8_Bootloader.removedKeywords - removedAttrs = F8_Bootloader.removedAttrs - - def _getParser(self): - op = F8_Bootloader._getParser(self) - op.add_option("--lba32", dest="forceLBA", deprecated=1, action="store_true") - return op - -class F14_Bootloader(F12_Bootloader): - removedKeywords = F12_Bootloader.removedKeywords + ["forceLBA"] - removedAttrs = F12_Bootloader.removedKeywords + ["forceLBA"] - - def _getParser(self): - op = F12_Bootloader._getParser(self) - op.remove_option("--lba32") - return op - -class F15_Bootloader(F14_Bootloader): - removedKeywords = F14_Bootloader.removedKeywords - removedAttrs = F14_Bootloader.removedAttrs - - def __init__(self, writePriority=10, *args, **kwargs): - F14_Bootloader.__init__(self, writePriority, *args, **kwargs) - - self.isCrypted = kwargs.get("isCrypted", False) - - def _getArgsAsStr(self): - ret = F14_Bootloader._getArgsAsStr(self) - - if self.isCrypted: - ret += " --iscrypted" - - return ret - - def _getParser(self): - def password_cb(option, opt_str, value, parser): - parser.values.isCrypted = True - parser.values.password = value - - op = F14_Bootloader._getParser(self) - op.add_option("--iscrypted", dest="isCrypted", action="store_true", default=False) - op.add_option("--md5pass", action="callback", callback=password_cb, nargs=1, type="string") - return op diff --git a/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py b/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py deleted file mode 100644 index b564b1a7ab..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py +++ /dev/null @@ -1,314 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -from pykickstart.base import * -from pykickstart.errors import * -from pykickstart.options import * - -import gettext -import warnings -_ = lambda x: gettext.ldgettext("pykickstart", x) - -class FC3_PartData(BaseData): - removedKeywords = BaseData.removedKeywords - removedAttrs = BaseData.removedAttrs - - def __init__(self, *args, **kwargs): - BaseData.__init__(self, *args, **kwargs) - self.active = kwargs.get("active", False) - self.primOnly = kwargs.get("primOnly", False) - self.end = kwargs.get("end", 0) - self.fstype = kwargs.get("fstype", "") - self.grow = kwargs.get("grow", False) - self.maxSizeMB = kwargs.get("maxSizeMB", 0) - self.format = kwargs.get("format", True) - self.onbiosdisk = kwargs.get("onbiosdisk", "") - self.disk = kwargs.get("disk", "") - self.onPart = kwargs.get("onPart", "") - self.recommended = kwargs.get("recommended", False) - self.size = kwargs.get("size", None) - self.start = kwargs.get("start", 0) - self.mountpoint = kwargs.get("mountpoint", "") - - def __eq__(self, y): - if self.mountpoint: - return self.mountpoint == y.mountpoint - else: - return False - - def _getArgsAsStr(self): - retval = "" - - if self.active: - retval += " --active" - if self.primOnly: - retval += " --asprimary" - if hasattr(self, "end") and self.end != 0: - retval += " --end=%s" % self.end - if self.fstype != "": - retval += " --fstype=\"%s\"" % self.fstype - if self.grow: - retval += " --grow" - if self.maxSizeMB > 0: - retval += " --maxsize=%d" % self.maxSizeMB - if not self.format: - retval += " --noformat" - if self.onbiosdisk != "": - retval += " --onbiosdisk=%s" % self.onbiosdisk - if self.disk != "": - retval += " --ondisk=%s" % self.disk - if self.onPart != "": - retval += " --onpart=%s" % self.onPart - if self.recommended: - retval += " --recommended" - if self.size and self.size != 0: - retval += " --size=%sk" % self.size - if hasattr(self, "start") and self.start != 0: - retval += " --start=%s" % self.start - - return retval - - def __str__(self): - retval = BaseData.__str__(self) - if self.mountpoint: - mountpoint_str = "%s" % self.mountpoint - else: - mountpoint_str = "(No mount point)" - retval += "part %s%s\n" % (mountpoint_str, self._getArgsAsStr()) - return retval - -class FC4_PartData(FC3_PartData): - removedKeywords = FC3_PartData.removedKeywords - removedAttrs = FC3_PartData.removedAttrs - - def __init__(self, *args, **kwargs): - FC3_PartData.__init__(self, *args, **kwargs) - self.bytesPerInode = kwargs.get("bytesPerInode", 4096) - self.fsopts = kwargs.get("fsopts", "") - self.label = kwargs.get("label", "") - - def _getArgsAsStr(self): - retval = FC3_PartData._getArgsAsStr(self) - - if hasattr(self, "bytesPerInode") and self.bytesPerInode != 0: - retval += " --bytes-per-inode=%d" % self.bytesPerInode - if self.fsopts != "": - retval += " --fsoptions=\"%s\"" % self.fsopts - if self.label != "": - retval += " --label=%s" % self.label - - return retval - -class F9_PartData(FC4_PartData): - removedKeywords = FC4_PartData.removedKeywords + ["bytesPerInode"] - removedAttrs = FC4_PartData.removedAttrs + ["bytesPerInode"] - - def __init__(self, *args, **kwargs): - FC4_PartData.__init__(self, *args, **kwargs) - self.deleteRemovedAttrs() - - self.fsopts = kwargs.get("fsopts", "") - self.label = kwargs.get("label", "") - self.fsprofile = kwargs.get("fsprofile", "") - self.encrypted = kwargs.get("encrypted", False) - self.passphrase = kwargs.get("passphrase", "") - - def _getArgsAsStr(self): - retval = FC4_PartData._getArgsAsStr(self) - - if self.fsprofile != "": - retval += " --fsprofile=\"%s\"" % self.fsprofile - if self.encrypted: - retval += " --encrypted" - - if self.passphrase != "": - retval += " --passphrase=\"%s\"" % self.passphrase - - return retval - -class F11_PartData(F9_PartData): - removedKeywords = F9_PartData.removedKeywords + ["start", "end"] - removedAttrs = F9_PartData.removedAttrs + ["start", "end"] - -class F12_PartData(F11_PartData): - removedKeywords = F11_PartData.removedKeywords - removedAttrs = F11_PartData.removedAttrs - - def __init__(self, *args, **kwargs): - F11_PartData.__init__(self, *args, **kwargs) - - self.escrowcert = kwargs.get("escrowcert", "") - self.backuppassphrase = kwargs.get("backuppassphrase", False) - - def _getArgsAsStr(self): - retval = F11_PartData._getArgsAsStr(self) - - if self.encrypted and self.escrowcert != "": - retval += " --escrowcert=\"%s\"" % self.escrowcert - - if self.backuppassphrase: - retval += " --backuppassphrase" - - return retval - -F14_PartData = F12_PartData - -class FC3_Partition(KickstartCommand): - removedKeywords = KickstartCommand.removedKeywords - removedAttrs = KickstartCommand.removedAttrs - - def __init__(self, writePriority=130, *args, **kwargs): - KickstartCommand.__init__(self, writePriority, *args, **kwargs) - self.op = self._getParser() - - self.partitions = kwargs.get("partitions", []) - - def __str__(self): - retval = "" - - for part in self.partitions: - retval += part.__str__() - - if retval != "": - return "# Disk partitioning information\n" + retval - else: - return "" - - def _getParser(self): - def part_cb (option, opt_str, value, parser): - if value.startswith("/dev/"): - parser.values.ensure_value(option.dest, value[5:]) - else: - parser.values.ensure_value(option.dest, value) - - op = KSOptionParser() - op.add_option("--active", dest="active", action="store_true", - default=False) - op.add_option("--asprimary", dest="primOnly", action="store_true", - default=False) - op.add_option("--end", dest="end", action="store", type="int", - nargs=1) - op.add_option("--fstype", "--type", dest="fstype") - op.add_option("--grow", dest="grow", action="store_true", default=False) - op.add_option("--maxsize", dest="maxSizeMB", action="store", type="int", - nargs=1) - op.add_option("--noformat", dest="format", action="store_false", - default=True) - op.add_option("--onbiosdisk", dest="onbiosdisk") - op.add_option("--ondisk", "--ondrive", dest="disk") - op.add_option("--onpart", "--usepart", dest="onPart", action="callback", - callback=part_cb, nargs=1, type="string") - op.add_option("--recommended", dest="recommended", action="store_true", - default=False) - op.add_option("--size", dest="size", action="store", type="size", - nargs=1) - op.add_option("--start", dest="start", action="store", type="int", - nargs=1) - return op - - def parse(self, args): - (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) - - pd = self.handler.PartData() - self._setToObj(self.op, opts, pd) - pd.lineno = self.lineno - if extra: - pd.mountpoint = extra[0] - if pd in self.dataList(): - warnings.warn(_("A partition with the mountpoint %s has already been defined.") % pd.mountpoint) - else: - pd.mountpoint = None - - return pd - - def dataList(self): - return self.partitions - -class FC4_Partition(FC3_Partition): - removedKeywords = FC3_Partition.removedKeywords - removedAttrs = FC3_Partition.removedAttrs - - def __init__(self, writePriority=130, *args, **kwargs): - FC3_Partition.__init__(self, writePriority, *args, **kwargs) - - def part_cb (option, opt_str, value, parser): - if value.startswith("/dev/"): - parser.values.ensure_value(option.dest, value[5:]) - else: - parser.values.ensure_value(option.dest, value) - - def _getParser(self): - op = FC3_Partition._getParser(self) - op.add_option("--bytes-per-inode", dest="bytesPerInode", action="store", - type="int", nargs=1) - op.add_option("--fsoptions", dest="fsopts") - op.add_option("--label", dest="label") - return op - -class F9_Partition(FC4_Partition): - removedKeywords = FC4_Partition.removedKeywords - removedAttrs = FC4_Partition.removedAttrs - - def __init__(self, writePriority=130, *args, **kwargs): - FC4_Partition.__init__(self, writePriority, *args, **kwargs) - - def part_cb (option, opt_str, value, parser): - if value.startswith("/dev/"): - parser.values.ensure_value(option.dest, value[5:]) - else: - parser.values.ensure_value(option.dest, value) - - def _getParser(self): - op = FC4_Partition._getParser(self) - op.add_option("--bytes-per-inode", deprecated=1) - op.add_option("--fsprofile") - op.add_option("--encrypted", action="store_true", default=False) - op.add_option("--passphrase") - return op - -class F11_Partition(F9_Partition): - removedKeywords = F9_Partition.removedKeywords - removedAttrs = F9_Partition.removedAttrs - - def _getParser(self): - op = F9_Partition._getParser(self) - op.add_option("--start", deprecated=1) - op.add_option("--end", deprecated=1) - return op - -class F12_Partition(F11_Partition): - removedKeywords = F11_Partition.removedKeywords - removedAttrs = F11_Partition.removedAttrs - - def _getParser(self): - op = F11_Partition._getParser(self) - op.add_option("--escrowcert") - op.add_option("--backuppassphrase", action="store_true", default=False) - return op - -class F14_Partition(F12_Partition): - removedKeywords = F12_Partition.removedKeywords - removedAttrs = F12_Partition.removedAttrs - - def _getParser(self): - op = F12_Partition._getParser(self) - op.remove_option("--bytes-per-inode") - op.remove_option("--start") - op.remove_option("--end") - return op diff --git a/scripts/lib/wic/3rdparty/pykickstart/constants.py b/scripts/lib/wic/3rdparty/pykickstart/constants.py deleted file mode 100644 index 5e12fc80ec..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/constants.py +++ /dev/null @@ -1,57 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2005-2007 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -CLEARPART_TYPE_LINUX = 0 -CLEARPART_TYPE_ALL = 1 -CLEARPART_TYPE_NONE = 2 - -DISPLAY_MODE_CMDLINE = 0 -DISPLAY_MODE_GRAPHICAL = 1 -DISPLAY_MODE_TEXT = 2 - -FIRSTBOOT_DEFAULT = 0 -FIRSTBOOT_SKIP = 1 -FIRSTBOOT_RECONFIG = 2 - -KS_MISSING_PROMPT = 0 -KS_MISSING_IGNORE = 1 - -SELINUX_DISABLED = 0 -SELINUX_ENFORCING = 1 -SELINUX_PERMISSIVE = 2 - -KS_SCRIPT_PRE = 0 -KS_SCRIPT_POST = 1 -KS_SCRIPT_TRACEBACK = 2 - -KS_WAIT = 0 -KS_REBOOT = 1 -KS_SHUTDOWN = 2 - -KS_INSTKEY_SKIP = -99 - -BOOTPROTO_DHCP = "dhcp" -BOOTPROTO_BOOTP = "bootp" -BOOTPROTO_STATIC = "static" -BOOTPROTO_QUERY = "query" -BOOTPROTO_IBFT = "ibft" - -GROUP_REQUIRED = 0 -GROUP_DEFAULT = 1 -GROUP_ALL = 2 diff --git a/scripts/lib/wic/3rdparty/pykickstart/errors.py b/scripts/lib/wic/3rdparty/pykickstart/errors.py deleted file mode 100644 index a234d99d43..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/errors.py +++ /dev/null @@ -1,103 +0,0 @@ -# -# errors.py: Kickstart error handling. -# -# Chris Lumens <clumens@redhat.com> -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -""" -Error handling classes and functions. - -This module exports a single function: - - formatErrorMsg - Properly formats an error message. - -It also exports several exception classes: - - KickstartError - A generic exception class. - - KickstartParseError - An exception for errors relating to parsing. - - KickstartValueError - An exception for errors relating to option - processing. - - KickstartVersionError - An exception for errors relating to unsupported - syntax versions. -""" -import gettext -_ = lambda x: gettext.ldgettext("pykickstart", x) - -def formatErrorMsg(lineno, msg=""): - """Properly format the error message msg for inclusion in an exception.""" - if msg != "": - mapping = {"lineno": lineno, "msg": msg} - return _("The following problem occurred on line %(lineno)s of the kickstart file:\n\n%(msg)s\n") % mapping - else: - return _("There was a problem reading from line %s of the kickstart file") % lineno - -class KickstartError(Exception): - """A generic exception class for unspecific error conditions.""" - def __init__(self, val = ""): - """Create a new KickstartError exception instance with the descriptive - message val. val should be the return value of formatErrorMsg. - """ - Exception.__init__(self) - self.value = val - - def __str__ (self): - return self.value - -class KickstartParseError(KickstartError): - """An exception class for errors when processing the input file, such as - unknown options, commands, or sections. - """ - def __init__(self, msg): - """Create a new KickstartParseError exception instance with the - descriptive message val. val should be the return value of - formatErrorMsg. - """ - KickstartError.__init__(self, msg) - - def __str__(self): - return self.value - -class KickstartValueError(KickstartError): - """An exception class for errors when processing arguments to commands, - such as too many arguments, too few arguments, or missing required - arguments. - """ - def __init__(self, msg): - """Create a new KickstartValueError exception instance with the - descriptive message val. val should be the return value of - formatErrorMsg. - """ - KickstartError.__init__(self, msg) - - def __str__ (self): - return self.value - -class KickstartVersionError(KickstartError): - """An exception class for errors related to using an incorrect version of - kickstart syntax. - """ - def __init__(self, msg): - """Create a new KickstartVersionError exception instance with the - descriptive message val. val should be the return value of - formatErrorMsg. - """ - KickstartError.__init__(self, msg) - - def __str__ (self): - return self.value diff --git a/scripts/lib/wic/3rdparty/pykickstart/handlers/__init__.py b/scripts/lib/wic/3rdparty/pykickstart/handlers/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/handlers/__init__.py +++ /dev/null diff --git a/scripts/lib/wic/3rdparty/pykickstart/handlers/control.py b/scripts/lib/wic/3rdparty/pykickstart/handlers/control.py deleted file mode 100644 index 8dc80d1ebe..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/handlers/control.py +++ /dev/null @@ -1,46 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -from pykickstart.version import * -from pykickstart.commands import * - -# This map is keyed on kickstart syntax version as provided by -# pykickstart.version. Within each sub-dict is a mapping from command name -# to the class that handles it. This is an onto mapping - that is, multiple -# command names can map to the same class. However, the Handler will ensure -# that only one instance of each class ever exists. -commandMap = { - # based on f15 - F16: { - "bootloader": bootloader.F15_Bootloader, - "part": partition.F14_Partition, - "partition": partition.F14_Partition, - }, -} - -# This map is keyed on kickstart syntax version as provided by -# pykickstart.version. Within each sub-dict is a mapping from a data object -# name to the class that provides it. This is a bijective mapping - that is, -# each name maps to exactly one data class and all data classes have a name. -# More than one instance of each class is allowed to exist, however. -dataMap = { - F16: { - "PartData": partition.F14_PartData, - }, -} diff --git a/scripts/lib/wic/3rdparty/pykickstart/handlers/f16.py b/scripts/lib/wic/3rdparty/pykickstart/handlers/f16.py deleted file mode 100644 index 3c52f8d754..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/handlers/f16.py +++ /dev/null @@ -1,24 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2011 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -from pykickstart.base import * -from pykickstart.version import * - -class F16Handler(BaseHandler): - version = F16 diff --git a/scripts/lib/wic/3rdparty/pykickstart/ko.py b/scripts/lib/wic/3rdparty/pykickstart/ko.py deleted file mode 100644 index 1350d19c70..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/ko.py +++ /dev/null @@ -1,37 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2009 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -""" -Base classes for internal pykickstart use. - -The module exports the following important classes: - - KickstartObject - The base class for all classes in pykickstart -""" - -class KickstartObject(object): - """The base class for all other classes in pykickstart.""" - def __init__(self, *args, **kwargs): - """Create a new KickstartObject instance. All other classes in - pykickstart should be derived from this one. Instance attributes: - """ - pass - - def __str__(self): - return "" diff --git a/scripts/lib/wic/3rdparty/pykickstart/options.py b/scripts/lib/wic/3rdparty/pykickstart/options.py deleted file mode 100644 index b2d8e3e516..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/options.py +++ /dev/null @@ -1,223 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2005, 2006, 2007 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -""" -Specialized option handling. - -This module exports two classes: - - KSOptionParser - A specialized subclass of OptionParser to be used - in BaseHandler subclasses. - - KSOption - A specialized subclass of Option. -""" -import warnings -from copy import copy -from optparse import * - -from constants import * -from errors import * -from version import * - -import gettext -_ = lambda x: gettext.ldgettext("pykickstart", x) - -class KSOptionParser(OptionParser): - """A specialized subclass of optparse.OptionParser to handle extra option - attribute checking, work error reporting into the KickstartParseError - framework, and to turn off the default help. - """ - def exit(self, status=0, msg=None): - pass - - def error(self, msg): - if self.lineno != None: - raise KickstartParseError, formatErrorMsg(self.lineno, msg=msg) - else: - raise KickstartParseError, msg - - def keys(self): - retval = [] - - for opt in self.option_list: - if opt not in retval: - retval.append(opt.dest) - - return retval - - def _init_parsing_state (self): - OptionParser._init_parsing_state(self) - self.option_seen = {} - - def check_values (self, values, args): - def seen(self, option): - return self.option_seen.has_key(option) - - def usedTooNew(self, option): - return option.introduced and option.introduced > self.version - - def usedDeprecated(self, option): - return option.deprecated - - def usedRemoved(self, option): - return option.removed and option.removed <= self.version - - for option in filter(lambda o: isinstance(o, Option), self.option_list): - if option.required and not seen(self, option): - raise KickstartValueError, formatErrorMsg(self.lineno, _("Option %s is required") % option) - elif seen(self, option) and usedTooNew(self, option): - mapping = {"option": option, "intro": versionToString(option.introduced), - "version": versionToString(self.version)} - self.error(_("The %(option)s option was introduced in version %(intro)s, but you are using kickstart syntax version %(version)s.") % mapping) - elif seen(self, option) and usedRemoved(self, option): - mapping = {"option": option, "removed": versionToString(option.removed), - "version": versionToString(self.version)} - - if option.removed == self.version: - self.error(_("The %(option)s option is no longer supported.") % mapping) - else: - self.error(_("The %(option)s option was removed in version %(removed)s, but you are using kickstart syntax version %(version)s.") % mapping) - elif seen(self, option) and usedDeprecated(self, option): - mapping = {"lineno": self.lineno, "option": option} - warnings.warn(_("Ignoring deprecated option on line %(lineno)s: The %(option)s option has been deprecated and no longer has any effect. It may be removed from future releases, which will result in a fatal error from kickstart. Please modify your kickstart file to remove this option.") % mapping, DeprecationWarning) - - return (values, args) - - def parse_args(self, *args, **kwargs): - if kwargs.has_key("lineno"): - self.lineno = kwargs.pop("lineno") - - return OptionParser.parse_args(self, **kwargs) - - def __init__(self, mapping=None, version=None): - """Create a new KSOptionParser instance. Each KickstartCommand - subclass should create one instance of KSOptionParser, providing - at least the lineno attribute. mapping and version are not required. - Instance attributes: - - mapping -- A mapping from option strings to different values. - version -- The version of the kickstart syntax we are checking - against. - """ - OptionParser.__init__(self, option_class=KSOption, - add_help_option=False, - conflict_handler="resolve") - if mapping is None: - self.map = {} - else: - self.map = mapping - - self.lineno = None - self.option_seen = {} - self.version = version - -def _check_ksboolean(option, opt, value): - if value.lower() in ("on", "yes", "true", "1"): - return True - elif value.lower() in ("off", "no", "false", "0"): - return False - else: - mapping = {"opt": opt, "value": value} - raise OptionValueError(_("Option %(opt)s: invalid boolean value: %(value)r") % mapping) - -def _check_string(option, opt, value): - if len(value) > 2 and value.startswith("--"): - mapping = {"opt": opt, "value": value} - raise OptionValueError(_("Option %(opt)s: invalid string value: %(value)r") % mapping) - else: - return value - -def _check_size(option, opt, value): - # Former default was MB - if (value.isdigit()): - return int(value) * 1024L - - mapping = {"opt": opt, "value": value} - if (not value[:-1].isdigit()): - raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping) - - size = int(value[:-1]) - if (value.endswith("k") or value.endswith("K")): - return size - if (value.endswith("M")): - return size * 1024L - if (value.endswith("G")): - return size * 1024L * 1024L - raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping) - -# Creates a new Option class that supports several new attributes: -# - required: any option with this attribute must be supplied or an exception -# is thrown -# - introduced: the kickstart syntax version that this option first appeared -# in - an exception will be raised if the option is used and -# the specified syntax version is less than the value of this -# attribute -# - deprecated: the kickstart syntax version that this option was deprecated -# in - a DeprecationWarning will be thrown if the option is -# used and the specified syntax version is greater than the -# value of this attribute -# - removed: the kickstart syntax version that this option was removed in - an -# exception will be raised if the option is used and the specified -# syntax version is greated than the value of this attribute -# Also creates a new type: -# - ksboolean: support various kinds of boolean values on an option -# And two new actions: -# - map : allows you to define an opt -> val mapping such that dest gets val -# when opt is seen -# - map_extend: allows you to define an opt -> [val1, ... valn] mapping such -# that dest gets a list of vals built up when opt is seen -class KSOption (Option): - ATTRS = Option.ATTRS + ['introduced', 'deprecated', 'removed', 'required'] - ACTIONS = Option.ACTIONS + ("map", "map_extend",) - STORE_ACTIONS = Option.STORE_ACTIONS + ("map", "map_extend",) - - TYPES = Option.TYPES + ("ksboolean", "string", "size") - TYPE_CHECKER = copy(Option.TYPE_CHECKER) - TYPE_CHECKER["ksboolean"] = _check_ksboolean - TYPE_CHECKER["string"] = _check_string - TYPE_CHECKER["size"] = _check_size - - def _check_required(self): - if self.required and not self.takes_value(): - raise OptionError(_("Required flag set for option that doesn't take a value"), self) - - # Make sure _check_required() is called from the constructor! - CHECK_METHODS = Option.CHECK_METHODS + [_check_required] - - def process (self, opt, value, values, parser): - Option.process(self, opt, value, values, parser) - parser.option_seen[self] = 1 - - # Override default take_action method to handle our custom actions. - def take_action(self, action, dest, opt, value, values, parser): - if action == "map": - values.ensure_value(dest, parser.map[opt.lstrip('-')]) - elif action == "map_extend": - values.ensure_value(dest, []).extend(parser.map[opt.lstrip('-')]) - else: - Option.take_action(self, action, dest, opt, value, values, parser) - - def takes_value(self): - # Deprecated options don't take a value. - return Option.takes_value(self) and not self.deprecated - - def __init__(self, *args, **kwargs): - self.deprecated = False - self.required = False - Option.__init__(self, *args, **kwargs) diff --git a/scripts/lib/wic/3rdparty/pykickstart/parser.py b/scripts/lib/wic/3rdparty/pykickstart/parser.py deleted file mode 100644 index 9c9674bf73..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/parser.py +++ /dev/null @@ -1,619 +0,0 @@ -# -# parser.py: Kickstart file parser. -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2005, 2006, 2007, 2008, 2011 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -""" -Main kickstart file processing module. - -This module exports several important classes: - - Script - Representation of a single %pre, %post, or %traceback script. - - Packages - Representation of the %packages section. - - KickstartParser - The kickstart file parser state machine. -""" - -from collections import Iterator -import os -import shlex -import sys -import tempfile -from copy import copy -from optparse import * - -import constants -from errors import KickstartError, KickstartParseError, KickstartValueError, formatErrorMsg -from ko import KickstartObject -from sections import * -import version - -import gettext -_ = lambda x: gettext.ldgettext("pykickstart", x) - -STATE_END = "end" -STATE_COMMANDS = "commands" - -ver = version.DEVEL - - -class PutBackIterator(Iterator): - def __init__(self, iterable): - self._iterable = iter(iterable) - self._buf = None - - def __iter__(self): - return self - - def put(self, s): - self._buf = s - - def next(self): - if self._buf: - retval = self._buf - self._buf = None - return retval - else: - return self._iterable.next() - -### -### SCRIPT HANDLING -### -class Script(KickstartObject): - """A class representing a single kickstart script. If functionality beyond - just a data representation is needed (for example, a run method in - anaconda), Script may be subclassed. Although a run method is not - provided, most of the attributes of Script have to do with running the - script. Instances of Script are held in a list by the Version object. - """ - def __init__(self, script, *args , **kwargs): - """Create a new Script instance. Instance attributes: - - errorOnFail -- If execution of the script fails, should anaconda - stop, display an error, and then reboot without - running any other scripts? - inChroot -- Does the script execute in anaconda's chroot - environment or not? - interp -- The program that should be used to interpret this - script. - lineno -- The line number this script starts on. - logfile -- Where all messages from the script should be logged. - script -- A string containing all the lines of the script. - type -- The type of the script, which can be KS_SCRIPT_* from - pykickstart.constants. - """ - KickstartObject.__init__(self, *args, **kwargs) - self.script = "".join(script) - - self.interp = kwargs.get("interp", "/bin/sh") - self.inChroot = kwargs.get("inChroot", False) - self.lineno = kwargs.get("lineno", None) - self.logfile = kwargs.get("logfile", None) - self.errorOnFail = kwargs.get("errorOnFail", False) - self.type = kwargs.get("type", constants.KS_SCRIPT_PRE) - - def __str__(self): - """Return a string formatted for output to a kickstart file.""" - retval = "" - - if self.type == constants.KS_SCRIPT_PRE: - retval += '\n%pre' - elif self.type == constants.KS_SCRIPT_POST: - retval += '\n%post' - elif self.type == constants.KS_SCRIPT_TRACEBACK: - retval += '\n%traceback' - - if self.interp != "/bin/sh" and self.interp != "": - retval += " --interpreter=%s" % self.interp - if self.type == constants.KS_SCRIPT_POST and not self.inChroot: - retval += " --nochroot" - if self.logfile != None: - retval += " --logfile %s" % self.logfile - if self.errorOnFail: - retval += " --erroronfail" - - if self.script.endswith("\n"): - if ver >= version.F8: - return retval + "\n%s%%end\n" % self.script - else: - return retval + "\n%s\n" % self.script - else: - if ver >= version.F8: - return retval + "\n%s\n%%end\n" % self.script - else: - return retval + "\n%s\n" % self.script - - -## -## PACKAGE HANDLING -## -class Group: - """A class representing a single group in the %packages section.""" - def __init__(self, name="", include=constants.GROUP_DEFAULT): - """Create a new Group instance. Instance attributes: - - name -- The group's identifier - include -- The level of how much of the group should be included. - Values can be GROUP_* from pykickstart.constants. - """ - self.name = name - self.include = include - - def __str__(self): - """Return a string formatted for output to a kickstart file.""" - if self.include == constants.GROUP_REQUIRED: - return "@%s --nodefaults" % self.name - elif self.include == constants.GROUP_ALL: - return "@%s --optional" % self.name - else: - return "@%s" % self.name - - def __cmp__(self, other): - if self.name < other.name: - return -1 - elif self.name > other.name: - return 1 - return 0 - -class Packages(KickstartObject): - """A class representing the %packages section of the kickstart file.""" - def __init__(self, *args, **kwargs): - """Create a new Packages instance. Instance attributes: - - addBase -- Should the Base group be installed even if it is - not specified? - default -- Should the default package set be selected? - excludedList -- A list of all the packages marked for exclusion in - the %packages section, without the leading minus - symbol. - excludeDocs -- Should documentation in each package be excluded? - groupList -- A list of Group objects representing all the groups - specified in the %packages section. Names will be - stripped of the leading @ symbol. - excludedGroupList -- A list of Group objects representing all the - groups specified for removal in the %packages - section. Names will be stripped of the leading - -@ symbols. - handleMissing -- If unknown packages are specified in the %packages - section, should it be ignored or not? Values can - be KS_MISSING_* from pykickstart.constants. - packageList -- A list of all the packages specified in the - %packages section. - instLangs -- A list of languages to install. - """ - KickstartObject.__init__(self, *args, **kwargs) - - self.addBase = True - self.default = False - self.excludedList = [] - self.excludedGroupList = [] - self.excludeDocs = False - self.groupList = [] - self.handleMissing = constants.KS_MISSING_PROMPT - self.packageList = [] - self.instLangs = None - - def __str__(self): - """Return a string formatted for output to a kickstart file.""" - pkgs = "" - - if not self.default: - grps = self.groupList - grps.sort() - for grp in grps: - pkgs += "%s\n" % grp.__str__() - - p = self.packageList - p.sort() - for pkg in p: - pkgs += "%s\n" % pkg - - grps = self.excludedGroupList - grps.sort() - for grp in grps: - pkgs += "-%s\n" % grp.__str__() - - p = self.excludedList - p.sort() - for pkg in p: - pkgs += "-%s\n" % pkg - - if pkgs == "": - return "" - - retval = "\n%packages" - - if self.default: - retval += " --default" - if self.excludeDocs: - retval += " --excludedocs" - if not self.addBase: - retval += " --nobase" - if self.handleMissing == constants.KS_MISSING_IGNORE: - retval += " --ignoremissing" - if self.instLangs: - retval += " --instLangs=%s" % self.instLangs - - if ver >= version.F8: - return retval + "\n" + pkgs + "\n%end\n" - else: - return retval + "\n" + pkgs + "\n" - - def _processGroup (self, line): - op = OptionParser() - op.add_option("--nodefaults", action="store_true", default=False) - op.add_option("--optional", action="store_true", default=False) - - (opts, extra) = op.parse_args(args=line.split()) - - if opts.nodefaults and opts.optional: - raise KickstartValueError, _("Group cannot specify both --nodefaults and --optional") - - # If the group name has spaces in it, we have to put it back together - # now. - grp = " ".join(extra) - - if opts.nodefaults: - self.groupList.append(Group(name=grp, include=constants.GROUP_REQUIRED)) - elif opts.optional: - self.groupList.append(Group(name=grp, include=constants.GROUP_ALL)) - else: - self.groupList.append(Group(name=grp, include=constants.GROUP_DEFAULT)) - - def add (self, pkgList): - """Given a list of lines from the input file, strip off any leading - symbols and add the result to the appropriate list. - """ - existingExcludedSet = set(self.excludedList) - existingPackageSet = set(self.packageList) - newExcludedSet = set() - newPackageSet = set() - - excludedGroupList = [] - - for pkg in pkgList: - stripped = pkg.strip() - - if stripped[0] == "@": - self._processGroup(stripped[1:]) - elif stripped[0] == "-": - if stripped[1] == "@": - excludedGroupList.append(Group(name=stripped[2:])) - else: - newExcludedSet.add(stripped[1:]) - else: - newPackageSet.add(stripped) - - # Groups have to be excluded in two different ways (note: can't use - # sets here because we have to store objects): - excludedGroupNames = map(lambda g: g.name, excludedGroupList) - - # First, an excluded group may be cancelling out a previously given - # one. This is often the case when using %include. So there we should - # just remove the group from the list. - self.groupList = filter(lambda g: g.name not in excludedGroupNames, self.groupList) - - # Second, the package list could have included globs which are not - # processed by pykickstart. In that case we need to preserve a list of - # excluded groups so whatever tool doing package/group installation can - # take appropriate action. - self.excludedGroupList.extend(excludedGroupList) - - existingPackageSet = (existingPackageSet - newExcludedSet) | newPackageSet - existingExcludedSet = (existingExcludedSet - existingPackageSet) | newExcludedSet - - self.packageList = list(existingPackageSet) - self.excludedList = list(existingExcludedSet) - - -### -### PARSER -### -class KickstartParser: - """The kickstart file parser class as represented by a basic state - machine. To create a specialized parser, make a subclass and override - any of the methods you care about. Methods that don't need to do - anything may just pass. However, _stateMachine should never be - overridden. - """ - def __init__ (self, handler, followIncludes=True, errorsAreFatal=True, - missingIncludeIsFatal=True): - """Create a new KickstartParser instance. Instance attributes: - - errorsAreFatal -- Should errors cause processing to halt, or - just print a message to the screen? This - is most useful for writing syntax checkers - that may want to continue after an error is - encountered. - followIncludes -- If %include is seen, should the included - file be checked as well or skipped? - handler -- An instance of a BaseHandler subclass. If - None, the input file will still be parsed - but no data will be saved and no commands - will be executed. - missingIncludeIsFatal -- Should missing include files be fatal, even - if errorsAreFatal is False? - """ - self.errorsAreFatal = errorsAreFatal - self.followIncludes = followIncludes - self.handler = handler - self.currentdir = {} - self.missingIncludeIsFatal = missingIncludeIsFatal - - self._state = STATE_COMMANDS - self._includeDepth = 0 - self._line = "" - - self.version = self.handler.version - - global ver - ver = self.version - - self._sections = {} - self.setupSections() - - def _reset(self): - """Reset the internal variables of the state machine for a new kickstart file.""" - self._state = STATE_COMMANDS - self._includeDepth = 0 - - def getSection(self, s): - """Return a reference to the requested section (s must start with '%'s), - or raise KeyError if not found. - """ - return self._sections[s] - - def handleCommand (self, lineno, args): - """Given the list of command and arguments, call the Version's - dispatcher method to handle the command. Returns the command or - data object returned by the dispatcher. This method may be - overridden in a subclass if necessary. - """ - if self.handler: - self.handler.currentCmd = args[0] - self.handler.currentLine = self._line - retval = self.handler.dispatcher(args, lineno) - - return retval - - def registerSection(self, obj): - """Given an instance of a Section subclass, register the new section - with the parser. Calling this method means the parser will - recognize your new section and dispatch into the given object to - handle it. - """ - if not obj.sectionOpen: - raise TypeError, "no sectionOpen given for section %s" % obj - - if not obj.sectionOpen.startswith("%"): - raise TypeError, "section %s tag does not start with a %%" % obj.sectionOpen - - self._sections[obj.sectionOpen] = obj - - def _finalize(self, obj): - """Called at the close of a kickstart section to take any required - actions. Internally, this is used to add scripts once we have the - whole body read. - """ - obj.finalize() - self._state = STATE_COMMANDS - - def _handleSpecialComments(self, line): - """Kickstart recognizes a couple special comments.""" - if self._state != STATE_COMMANDS: - return - - # Save the platform for s-c-kickstart. - if line[:10] == "#platform=": - self.handler.platform = self._line[11:] - - def _readSection(self, lineIter, lineno): - obj = self._sections[self._state] - - while True: - try: - line = lineIter.next() - if line == "": - # This section ends at the end of the file. - if self.version >= version.F8: - raise KickstartParseError, formatErrorMsg(lineno, msg=_("Section does not end with %%end.")) - - self._finalize(obj) - except StopIteration: - break - - lineno += 1 - - # Throw away blank lines and comments, unless the section wants all - # lines. - if self._isBlankOrComment(line) and not obj.allLines: - continue - - if line.startswith("%"): - args = shlex.split(line) - - if args and args[0] == "%end": - # This is a properly terminated section. - self._finalize(obj) - break - elif args and args[0] == "%ksappend": - continue - elif args and (self._validState(args[0]) or args[0] in ["%include", "%ksappend"]): - # This is an unterminated section. - if self.version >= version.F8: - raise KickstartParseError, formatErrorMsg(lineno, msg=_("Section does not end with %%end.")) - - # Finish up. We do not process the header here because - # kicking back out to STATE_COMMANDS will ensure that happens. - lineIter.put(line) - lineno -= 1 - self._finalize(obj) - break - else: - # This is just a line within a section. Pass it off to whatever - # section handles it. - obj.handleLine(line) - - return lineno - - def _validState(self, st): - """Is the given section tag one that has been registered with the parser?""" - return st in self._sections.keys() - - def _tryFunc(self, fn): - """Call the provided function (which doesn't take any arguments) and - do the appropriate error handling. If errorsAreFatal is False, this - function will just print the exception and keep going. - """ - try: - fn() - except Exception, msg: - if self.errorsAreFatal: - raise - else: - print msg - - def _isBlankOrComment(self, line): - return line.isspace() or line == "" or line.lstrip()[0] == '#' - - def _stateMachine(self, lineIter): - # For error reporting. - lineno = 0 - - while True: - # Get the next line out of the file, quitting if this is the last line. - try: - self._line = lineIter.next() - if self._line == "": - break - except StopIteration: - break - - lineno += 1 - - # Eliminate blank lines, whitespace-only lines, and comments. - if self._isBlankOrComment(self._line): - self._handleSpecialComments(self._line) - continue - - # Remove any end-of-line comments. - sanitized = self._line.split("#")[0] - - # Then split the line. - args = shlex.split(sanitized.rstrip()) - - if args[0] == "%include": - # This case comes up primarily in ksvalidator. - if not self.followIncludes: - continue - - if len(args) == 1 or not args[1]: - raise KickstartParseError, formatErrorMsg(lineno) - - self._includeDepth += 1 - - try: - self.readKickstart(args[1], reset=False) - except KickstartError: - # Handle the include file being provided over the - # network in a %pre script. This case comes up in the - # early parsing in anaconda. - if self.missingIncludeIsFatal: - raise - - self._includeDepth -= 1 - continue - - # Now on to the main event. - if self._state == STATE_COMMANDS: - if args[0] == "%ksappend": - # This is handled by the preprocess* functions, so continue. - continue - elif args[0][0] == '%': - # This is the beginning of a new section. Handle its header - # here. - newSection = args[0] - if not self._validState(newSection): - raise KickstartParseError, formatErrorMsg(lineno, msg=_("Unknown kickstart section: %s" % newSection)) - - self._state = newSection - obj = self._sections[self._state] - self._tryFunc(lambda: obj.handleHeader(lineno, args)) - - # This will handle all section processing, kicking us back - # out to STATE_COMMANDS at the end with the current line - # being the next section header, etc. - lineno = self._readSection(lineIter, lineno) - else: - # This is a command in the command section. Dispatch to it. - self._tryFunc(lambda: self.handleCommand(lineno, args)) - elif self._state == STATE_END: - break - - def readKickstartFromString (self, s, reset=True): - """Process a kickstart file, provided as the string str.""" - if reset: - self._reset() - - # Add a "" to the end of the list so the string reader acts like the - # file reader and we only get StopIteration when we're after the final - # line of input. - i = PutBackIterator(s.splitlines(True) + [""]) - self._stateMachine (i) - - def readKickstart(self, f, reset=True): - """Process a kickstart file, given by the filename f.""" - if reset: - self._reset() - - # an %include might not specify a full path. if we don't try to figure - # out what the path should have been, then we're unable to find it - # requiring full path specification, though, sucks. so let's make - # the reading "smart" by keeping track of what the path is at each - # include depth. - if not os.path.exists(f): - if self.currentdir.has_key(self._includeDepth - 1): - if os.path.exists(os.path.join(self.currentdir[self._includeDepth - 1], f)): - f = os.path.join(self.currentdir[self._includeDepth - 1], f) - - cd = os.path.dirname(f) - if not cd.startswith("/"): - cd = os.path.abspath(cd) - self.currentdir[self._includeDepth] = cd - - try: - s = file(f).read() - except IOError, e: - raise KickstartError, formatErrorMsg(0, msg=_("Unable to open input kickstart file: %s") % e.strerror) - - self.readKickstartFromString(s, reset=False) - - def setupSections(self): - """Install the sections all kickstart files support. You may override - this method in a subclass, but should avoid doing so unless you know - what you're doing. - """ - self._sections = {} - - # Install the sections all kickstart files support. - self.registerSection(PreScriptSection(self.handler, dataObj=Script)) - self.registerSection(PostScriptSection(self.handler, dataObj=Script)) - self.registerSection(TracebackScriptSection(self.handler, dataObj=Script)) - self.registerSection(PackageSection(self.handler)) diff --git a/scripts/lib/wic/3rdparty/pykickstart/sections.py b/scripts/lib/wic/3rdparty/pykickstart/sections.py deleted file mode 100644 index 44df856b8d..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/sections.py +++ /dev/null @@ -1,244 +0,0 @@ -# -# sections.py: Kickstart file sections. -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2011 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -""" -This module exports the classes that define a section of a kickstart file. A -section is a chunk of the file starting with a %tag and ending with a %end. -Examples of sections include %packages, %pre, and %post. - -You may use this module to define your own custom sections which will be -treated just the same as a predefined one by the kickstart parser. All that -is necessary is to create a new subclass of Section and call -parser.registerSection with an instance of your new class. -""" -from constants import * -from options import KSOptionParser -from version import * - -class Section(object): - """The base class for defining kickstart sections. You are free to - subclass this as appropriate. - - Class attributes: - - allLines -- Does this section require the parser to call handleLine - for every line in the section, even blanks and comments? - sectionOpen -- The string that denotes the start of this section. You - must start your tag with a percent sign. - timesSeen -- This attribute is for informational purposes only. It is - incremented every time handleHeader is called to keep - track of the number of times a section of this type is - seen. - """ - allLines = False - sectionOpen = "" - timesSeen = 0 - - def __init__(self, handler, **kwargs): - """Create a new Script instance. At the least, you must pass in an - instance of a baseHandler subclass. - - Valid kwargs: - - dataObj -- - """ - self.handler = handler - - self.version = self.handler.version - - self.dataObj = kwargs.get("dataObj", None) - - def finalize(self): - """This method is called when the %end tag for a section is seen. It - is not required to be provided. - """ - pass - - def handleLine(self, line): - """This method is called for every line of a section. Take whatever - action is appropriate. While this method is not required to be - provided, not providing it does not make a whole lot of sense. - - Arguments: - - line -- The complete line, with any trailing newline. - """ - pass - - def handleHeader(self, lineno, args): - """This method is called when the opening tag for a section is seen. - Not all sections will need this method, though all provided with - kickstart include one. - - Arguments: - - args -- A list of all strings passed as arguments to the section - opening tag. - """ - self.timesSeen += 1 - -class NullSection(Section): - """This defines a section that pykickstart will recognize but do nothing - with. If the parser runs across a %section that has no object registered, - it will raise an error. Sometimes, you may want to simply ignore those - sections instead. This class is useful for that purpose. - """ - def __init__(self, *args, **kwargs): - """Create a new NullSection instance. You must pass a sectionOpen - parameter (including a leading '%') for the section you wish to - ignore. - """ - Section.__init__(self, *args, **kwargs) - self.sectionOpen = kwargs.get("sectionOpen") - -class ScriptSection(Section): - allLines = True - - def __init__(self, *args, **kwargs): - Section.__init__(self, *args, **kwargs) - self._script = {} - self._resetScript() - - def _getParser(self): - op = KSOptionParser(self.version) - op.add_option("--erroronfail", dest="errorOnFail", action="store_true", - default=False) - op.add_option("--interpreter", dest="interpreter", default="/bin/sh") - op.add_option("--log", "--logfile", dest="log") - return op - - def _resetScript(self): - self._script = {"interp": "/bin/sh", "log": None, "errorOnFail": False, - "lineno": None, "chroot": False, "body": []} - - def handleLine(self, line): - self._script["body"].append(line) - - def finalize(self): - if " ".join(self._script["body"]).strip() == "": - return - - kwargs = {"interp": self._script["interp"], - "inChroot": self._script["chroot"], - "lineno": self._script["lineno"], - "logfile": self._script["log"], - "errorOnFail": self._script["errorOnFail"], - "type": self._script["type"]} - - s = self.dataObj (self._script["body"], **kwargs) - self._resetScript() - - if self.handler: - self.handler.scripts.append(s) - - def handleHeader(self, lineno, args): - """Process the arguments to a %pre/%post/%traceback header for later - setting on a Script instance once the end of the script is found. - This method may be overridden in a subclass if necessary. - """ - Section.handleHeader(self, lineno, args) - op = self._getParser() - - (opts, extra) = op.parse_args(args=args[1:], lineno=lineno) - - self._script["interp"] = opts.interpreter - self._script["lineno"] = lineno - self._script["log"] = opts.log - self._script["errorOnFail"] = opts.errorOnFail - if hasattr(opts, "nochroot"): - self._script["chroot"] = not opts.nochroot - -class PreScriptSection(ScriptSection): - sectionOpen = "%pre" - - def _resetScript(self): - ScriptSection._resetScript(self) - self._script["type"] = KS_SCRIPT_PRE - -class PostScriptSection(ScriptSection): - sectionOpen = "%post" - - def _getParser(self): - op = ScriptSection._getParser(self) - op.add_option("--nochroot", dest="nochroot", action="store_true", - default=False) - return op - - def _resetScript(self): - ScriptSection._resetScript(self) - self._script["chroot"] = True - self._script["type"] = KS_SCRIPT_POST - -class TracebackScriptSection(ScriptSection): - sectionOpen = "%traceback" - - def _resetScript(self): - ScriptSection._resetScript(self) - self._script["type"] = KS_SCRIPT_TRACEBACK - -class PackageSection(Section): - sectionOpen = "%packages" - - def handleLine(self, line): - if not self.handler: - return - - (h, s, t) = line.partition('#') - line = h.rstrip() - - self.handler.packages.add([line]) - - def handleHeader(self, lineno, args): - """Process the arguments to the %packages header and set attributes - on the Version's Packages instance appropriate. This method may be - overridden in a subclass if necessary. - """ - Section.handleHeader(self, lineno, args) - op = KSOptionParser(version=self.version) - op.add_option("--excludedocs", dest="excludedocs", action="store_true", - default=False) - op.add_option("--ignoremissing", dest="ignoremissing", - action="store_true", default=False) - op.add_option("--nobase", dest="nobase", action="store_true", - default=False) - op.add_option("--ignoredeps", dest="resolveDeps", action="store_false", - deprecated=FC4, removed=F9) - op.add_option("--resolvedeps", dest="resolveDeps", action="store_true", - deprecated=FC4, removed=F9) - op.add_option("--default", dest="defaultPackages", action="store_true", - default=False, introduced=F7) - op.add_option("--instLangs", dest="instLangs", type="string", - default="", introduced=F9) - - (opts, extra) = op.parse_args(args=args[1:], lineno=lineno) - - self.handler.packages.excludeDocs = opts.excludedocs - self.handler.packages.addBase = not opts.nobase - if opts.ignoremissing: - self.handler.packages.handleMissing = KS_MISSING_IGNORE - else: - self.handler.packages.handleMissing = KS_MISSING_PROMPT - - if opts.defaultPackages: - self.handler.packages.default = True - - if opts.instLangs: - self.handler.packages.instLangs = opts.instLangs diff --git a/scripts/lib/wic/3rdparty/pykickstart/version.py b/scripts/lib/wic/3rdparty/pykickstart/version.py deleted file mode 100644 index 8a8e6aad22..0000000000 --- a/scripts/lib/wic/3rdparty/pykickstart/version.py +++ /dev/null @@ -1,168 +0,0 @@ -# -# Chris Lumens <clumens@redhat.com> -# -# Copyright 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. Any Red Hat -# trademarks that are incorporated in the source code or documentation are not -# subject to the GNU General Public License and may only be used or replicated -# with the express permission of Red Hat, Inc. -# -""" -Methods for working with kickstart versions. - -This module defines several symbolic constants that specify kickstart syntax -versions. Each version corresponds roughly to one release of Red Hat Linux, -Red Hat Enterprise Linux, or Fedora Core as these are where most syntax -changes take place. - -This module also exports several functions: - - makeVersion - Given a version number, return an instance of the - matching handler class. - - returnClassForVersion - Given a version number, return the matching - handler class. This does not return an - instance of that class, however. - - stringToVersion - Convert a string representation of a version number - into the symbolic constant. - - versionToString - Perform the reverse mapping. - - versionFromFile - Read a kickstart file and determine the version of - syntax it uses. This requires the kickstart file to - have a version= comment in it. -""" -import imputil, re, sys - -import gettext -_ = lambda x: gettext.ldgettext("pykickstart", x) - -from pykickstart.errors import KickstartVersionError - -# Symbolic names for internal version numbers. -RHEL3 = 900 -FC3 = 1000 -RHEL4 = 1100 -FC4 = 2000 -FC5 = 3000 -FC6 = 4000 -RHEL5 = 4100 -F7 = 5000 -F8 = 6000 -F9 = 7000 -F10 = 8000 -F11 = 9000 -F12 = 10000 -F13 = 11000 -RHEL6 = 11100 -F14 = 12000 -F15 = 13000 -F16 = 14000 - -# This always points at the latest version and is the default. -DEVEL = F16 - -# A one-to-one mapping from string representations to version numbers. -versionMap = { - "DEVEL": DEVEL, - "FC3": FC3, "FC4": FC4, "FC5": FC5, "FC6": FC6, "F7": F7, "F8": F8, - "F9": F9, "F10": F10, "F11": F11, "F12": F12, "F13": F13, - "F14": F14, "F15": F15, "F16": F16, - "RHEL3": RHEL3, "RHEL4": RHEL4, "RHEL5": RHEL5, "RHEL6": RHEL6 -} - -def stringToVersion(s): - """Convert string into one of the provided version constants. Raises - KickstartVersionError if string does not match anything. - """ - # First try these short forms. - try: - return versionMap[s.upper()] - except KeyError: - pass - - # Now try the Fedora versions. - m = re.match("^fedora.* (\d+)$", s, re.I) - - if m and m.group(1): - if versionMap.has_key("FC" + m.group(1)): - return versionMap["FC" + m.group(1)] - elif versionMap.has_key("F" + m.group(1)): - return versionMap["F" + m.group(1)] - else: - raise KickstartVersionError(_("Unsupported version specified: %s") % s) - - # Now try the RHEL versions. - m = re.match("^red hat enterprise linux.* (\d+)([\.\d]*)$", s, re.I) - - if m and m.group(1): - if versionMap.has_key("RHEL" + m.group(1)): - return versionMap["RHEL" + m.group(1)] - else: - raise KickstartVersionError(_("Unsupported version specified: %s") % s) - - # If nothing else worked, we're out of options. - raise KickstartVersionError(_("Unsupported version specified: %s") % s) - -def versionToString(version, skipDevel=False): - """Convert version into a string representation of the version number. - This is the reverse operation of stringToVersion. Raises - KickstartVersionError if version does not match anything. - """ - if not skipDevel and version == versionMap["DEVEL"]: - return "DEVEL" - - for (key, val) in versionMap.iteritems(): - if key == "DEVEL": - continue - elif val == version: - return key - - raise KickstartVersionError(_("Unsupported version specified: %s") % version) - -def returnClassForVersion(version=DEVEL): - """Return the class of the syntax handler for version. version can be - either a string or the matching constant. Raises KickstartValueError - if version does not match anything. - """ - try: - version = int(version) - module = "%s" % versionToString(version, skipDevel=True) - except ValueError: - module = "%s" % version - version = stringToVersion(version) - - module = module.lower() - - try: - import pykickstart.handlers - sys.path.extend(pykickstart.handlers.__path__) - found = imputil.imp.find_module(module) - loaded = imputil.imp.load_module(module, found[0], found[1], found[2]) - - for (k, v) in loaded.__dict__.iteritems(): - if k.lower().endswith("%shandler" % module): - return v - except: - raise KickstartVersionError(_("Unsupported version specified: %s") % version) - -def makeVersion(version=DEVEL): - """Return a new instance of the syntax handler for version. version can be - either a string or the matching constant. This function is useful for - standalone programs which just need to handle a specific version of - kickstart syntax (as provided by a command line argument, for example) - and need to instantiate the correct object. - """ - cl = returnClassForVersion(version) - return cl() diff --git a/scripts/lib/wic/__init__.py b/scripts/lib/wic/__init__.py index 63c1d9c846..85876b138c 100644 --- a/scripts/lib/wic/__init__.py +++ b/scripts/lib/wic/__init__.py @@ -1,4 +1,20 @@ -import os, sys +#!/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. -cur_path = os.path.dirname(__file__) or '.' -sys.path.insert(0, cur_path + '/3rdparty') +class WicError(Exception): + pass diff --git a/scripts/lib/wic/__version__.py b/scripts/lib/wic/__version__.py deleted file mode 100644 index 5452a46712..0000000000 --- a/scripts/lib/wic/__version__.py +++ /dev/null @@ -1 +0,0 @@ -VERSION = "2.00" 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/image/canned-wks/directdisk.wks b/scripts/lib/wic/canned-wks/directdisk-gpt.wks index 62dcab15ce..8d7d8de6ea 100644 --- a/scripts/lib/image/canned-wks/directdisk.wks +++ b/scripts/lib/wic/canned-wks/directdisk-gpt.wks @@ -4,7 +4,7 @@ part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 -part / --source rootfs --ondisk sda --fstype=ext3 --label platform --align 1024 +part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid -bootloader --timeout=0 --append="rootwait rootfstype=ext3 video=vesafb vga=0x318 console=tty0" +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/image/canned-wks/mkefidisk.wks b/scripts/lib/wic/canned-wks/mkefidisk.wks index 58d42e61eb..9f534fe184 100644 --- a/scripts/lib/image/canned-wks/mkefidisk.wks +++ b/scripts/lib/wic/canned-wks/mkefidisk.wks @@ -4,8 +4,8 @@ part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024 -part / --source rootfs --ondisk sda --fstype=ext3 --label platform --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 --timeout=10 --append="rootwait rootfstype=ext3 console=ttyPCH0,115200 console=tty0 vmalloc=256MB snd-hda-intel.enable_msi=0" +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/image/canned-wks/sdimage-bootpart.wks b/scripts/lib/wic/canned-wks/sdimage-bootpart.wks index 7ffd632f4a..7ffd632f4a 100644 --- a/scripts/lib/image/canned-wks/sdimage-bootpart.wks +++ b/scripts/lib/wic/canned-wks/sdimage-bootpart.wks 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/conf.py b/scripts/lib/wic/conf.py deleted file mode 100644 index be34355ce4..0000000000 --- a/scripts/lib/wic/conf.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/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 os, sys, re -import ConfigParser - -from wic import msger -from wic import kickstart -from wic.utils import misc, runner, errors - - -def get_siteconf(): - wic_path = os.path.dirname(__file__) - eos = wic_path.find('scripts') + len('scripts') - scripts_path = wic_path[:eos] - - return scripts_path + "/lib/image/config/wic.conf" - -class ConfigMgr(object): - DEFAULTS = {'common': { - "distro_name": "Default Distribution", - "plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also? - }, - 'create': { - "tmpdir": '/var/tmp/wic', - "outdir": './wic-output', - - "release": None, - "logfile": None, - "name_prefix": None, - "name_suffix": None, - }, - } - - # make the manager class as singleton - _instance = None - def __new__(cls, *args, **kwargs): - if not cls._instance: - cls._instance = super(ConfigMgr, cls).__new__(cls, *args, **kwargs) - - return cls._instance - - def __init__(self, ksconf=None, siteconf=None): - # reset config options - self.reset() - - if not siteconf: - siteconf = get_siteconf() - - # initial options from siteconf - self._siteconf = siteconf - - if ksconf: - self._ksconf = ksconf - - def reset(self): - self.__ksconf = None - self.__siteconf = None - - # initialize the values with defaults - for sec, vals in self.DEFAULTS.iteritems(): - setattr(self, sec, vals) - - def __set_ksconf(self, ksconf): - if not os.path.isfile(ksconf): - msger.error('Cannot find ks file: %s' % ksconf) - - self.__ksconf = ksconf - self._parse_kickstart(ksconf) - def __get_ksconf(self): - return self.__ksconf - _ksconf = property(__get_ksconf, __set_ksconf) - - def _parse_kickstart(self, ksconf=None): - if not ksconf: - return - - ks = kickstart.read_kickstart(ksconf) - - self.create['ks'] = ks - self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0] - - self.create['name'] = misc.build_name(ksconf, - self.create['release'], - self.create['name_prefix'], - self.create['name_suffix']) - -configmgr = ConfigMgr() diff --git a/scripts/lib/wic/creator.py b/scripts/lib/wic/creator.py deleted file mode 100644 index 2219377b38..0000000000 --- a/scripts/lib/wic/creator.py +++ /dev/null @@ -1,187 +0,0 @@ -#!/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 os, sys, re -from optparse import SUPPRESS_HELP - -from wic import msger -from wic.utils import cmdln, errors -from wic.conf import configmgr -from wic.plugin import pluginmgr - - -class Creator(cmdln.Cmdln): - """${name}: create an image - - Usage: - ${name} SUBCOMMAND <ksfile> [OPTS] - - ${command_list} - ${option_list} - """ - - name = 'wic create(cr)' - - def __init__(self, *args, **kwargs): - cmdln.Cmdln.__init__(self, *args, **kwargs) - self._subcmds = [] - - # get cmds from pluginmgr - # mix-in do_subcmd interface - for subcmd, klass in pluginmgr.get_plugins('imager').iteritems(): - if not hasattr(klass, 'do_create'): - msger.warning("Unsupported subcmd: %s" % subcmd) - continue - - func = getattr(klass, 'do_create') - setattr(self.__class__, "do_"+subcmd, func) - self._subcmds.append(subcmd) - - def get_optparser(self): - optparser = cmdln.CmdlnOptionParser(self) - optparser.add_option('-d', '--debug', action='store_true', - dest='debug', - help=SUPPRESS_HELP) - optparser.add_option('-v', '--verbose', action='store_true', - dest='verbose', - help=SUPPRESS_HELP) - optparser.add_option('', '--logfile', type='string', dest='logfile', - default=None, - help='Path of logfile') - optparser.add_option('-c', '--config', type='string', dest='config', - default=None, - help='Specify config file for wic') - optparser.add_option('-o', '--outdir', type='string', action='store', - dest='outdir', default=None, - help='Output directory') - optparser.add_option('', '--tmpfs', action='store_true', dest='enabletmpfs', - help='Setup tmpdir as tmpfs to accelerate, experimental' - ' feature, use it if you have more than 4G memory') - return optparser - - def preoptparse(self, argv): - optparser = self.get_optparser() - - largs = [] - rargs = [] - while argv: - arg = argv.pop(0) - - if arg in ('-h', '--help'): - rargs.append(arg) - - elif optparser.has_option(arg): - largs.append(arg) - - if optparser.get_option(arg).takes_value(): - try: - largs.append(argv.pop(0)) - except IndexError: - raise errors.Usage("option %s requires arguments" % arg) - - else: - if arg.startswith("--"): - if "=" in arg: - opt = arg.split("=")[0] - else: - opt = None - elif arg.startswith("-") and len(arg) > 2: - opt = arg[0:2] - else: - opt = None - - if opt and optparser.has_option(opt): - largs.append(arg) - else: - rargs.append(arg) - - return largs + rargs - - def postoptparse(self): - abspath = lambda pth: os.path.abspath(os.path.expanduser(pth)) - - if self.options.verbose: - msger.set_loglevel('verbose') - if self.options.debug: - msger.set_loglevel('debug') - - if self.options.logfile: - logfile_abs_path = abspath(self.options.logfile) - if os.path.isdir(logfile_abs_path): - raise errors.Usage("logfile's path %s should be file" - % self.options.logfile) - if not os.path.exists(os.path.dirname(logfile_abs_path)): - os.makedirs(os.path.dirname(logfile_abs_path)) - msger.set_interactive(False) - msger.set_logfile(logfile_abs_path) - configmgr.create['logfile'] = self.options.logfile - - if self.options.config: - configmgr.reset() - configmgr._siteconf = self.options.config - - if self.options.outdir is not None: - configmgr.create['outdir'] = abspath(self.options.outdir) - - cdir = 'outdir' - if os.path.exists(configmgr.create[cdir]) \ - and not os.path.isdir(configmgr.create[cdir]): - msger.error('Invalid directory specified: %s' \ - % configmgr.create[cdir]) - - if self.options.enabletmpfs: - configmgr.create['enabletmpfs'] = self.options.enabletmpfs - - def main(self, argv=None): - if argv is None: - argv = sys.argv - else: - argv = argv[:] # don't modify caller's list - - self.optparser = self.get_optparser() - if self.optparser: - try: - argv = self.preoptparse(argv) - self.options, args = self.optparser.parse_args(argv) - - except cmdln.CmdlnUserError, ex: - msg = "%s: %s\nTry '%s help' for info.\n"\ - % (self.name, ex, self.name) - msger.error(msg) - - except cmdln.StopOptionProcessing, ex: - return 0 - else: - # optparser=None means no process for opts - self.options, args = None, argv[1:] - - if not args: - return self.emptyline() - - self.postoptparse() - - return self.cmd(args) - - def precmd(self, argv): # check help before cmd - - if '-h' in argv or '?' in argv or '--help' in argv or 'help' in argv: - return argv - - if len(argv) == 1: - return ['help', argv[0]] - - return argv 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/image/help.py b/scripts/lib/wic/help.py index e1eb265979..d6e027d253 100644 --- a/scripts/lib/image/help.py +++ b/scripts/lib/wic/help.py @@ -28,9 +28,12 @@ import subprocess import logging +from wic.pluginbase import PluginMgr, PLUGIN_TYPES + +logger = logging.getLogger('wic') def subcommand_error(args): - logging.info("invalid subcommand %s" % args[0]) + logger.info("invalid subcommand %s", args[0]) def display_help(subcommand, subcommands): @@ -40,9 +43,11 @@ def display_help(subcommand, subcommands): if subcommand not in subcommands: return False - help = subcommands.get(subcommand, subcommand_error)[2] + hlp = subcommands.get(subcommand, subcommand_error)[2] + if callable(hlp): + hlp = hlp() pager = subprocess.Popen('less', stdin=subprocess.PIPE) - pager.communicate(help) + pager.communicate(hlp.encode('utf-8')) return True @@ -55,19 +60,38 @@ def wic_help(args, usage_str, 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: - logging.error("No subcommand specified, exiting") + 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: - logging.error("Unsupported subcommand %s, exiting\n" % (args[0])) + 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) @@ -81,19 +105,17 @@ wic_usage = """ Create a customized OpenEmbedded image - usage: wic [--version] [--help] COMMAND [ARGS] + 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 values for options and image properties + 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 - - See 'wic help <COMMAND or HELP TOPIC>' for more information on a specific - command or help topic. + overview wic overview - General overview of wic + plugins wic plugins - Overview and API + kickstart wic kickstart - wic kickstart reference """ wic_help_usage = """ @@ -111,7 +133,7 @@ wic_create_usage = """ [-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] + [-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>. @@ -129,10 +151,10 @@ NAME SYNOPSIS 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] + [-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 @@ -167,6 +189,8 @@ DESCRIPTION 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 @@ -197,32 +221,24 @@ DESCRIPTION The -o option can be used to place the image in a directory with a different name and location. - As an alternative to the wks file, the image-specific properties - that define the values that will be used to generate a particular - image can be specified on the command-line using the -i option and - supplying a JSON object consisting of the set of name:value pairs - needed by image creation. + The -c option is used to specify compressor utility to compress + an image. gzip, bzip2 and xz compressors are supported. - The set of properties available for a given image type can be - listed using the 'wic list' command. + 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 image properties and values + List available OpenEmbedded images and source plugins usage: wic list images wic list <image> help wic list source-plugins - wic list properties - wic list properties <wks file> - wic list property <property> - [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] This command enumerates the set of available canned images as well as - help for those images. It also can be used to enumerate the complete - set of possible values for a specified option or property needed by - the image creation process. + help for those images. It also can be used to list of available source + plugins. The first form enumerates all the available 'canned' images. @@ -232,44 +248,27 @@ wic_list_usage = """ The third form enumerates all the available --sources (source plugins). - The fourth form enumerates all the possible values that exist and can - be specified in an OE kickstart (wks) file. - - The fifth form enumerates all the possible options that exist for the - set of properties specified in a given OE kickstart (ks) file. - - The final form enumerates all the possible values that exist and can - be specified for any given OE kickstart (wks) property. - See 'wic help list' for more details. """ wic_list_help = """ NAME - wic list - List available OpenEmbedded image properties and values + wic list - List available OpenEmbedded images and source plugins SYNOPSIS wic list images wic list <image> help wic list source-plugins - wic list properties - wic list properties <wks file> - wic list property <property> - [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] DESCRIPTION - This command enumerates the complete set of possible values for a - specified option or property needed by the image creation process. - This command enumerates the set of available canned images as well - as help for those images. It also can be used to enumerate the - complete set of possible values for a specified option or property - needed by the image creation process. + 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/image/canned-wks directory). + into the /scripts/lib/wic/canned-wks directory). The second form lists the detailed help information for a specific 'canned' image. @@ -282,60 +281,6 @@ DESCRIPTION sources listed by the 'list source-plugins' command. Users can also add their own source plugins - see 'wic help plugins' for details. - - The third form enumerates all the possible values that exist and - can be specified in a OE kickstart (wks) file. The output of this - can be used by the third form to print the description and - possible values of a specific property. - - The fourth form enumerates all the possible options that exist for - the set of properties specified in a given OE kickstart (wks) - file. If the -o option is specified, the list of properties, in - addition to being displayed, will be written to the specified file - as a JSON object. In this case, the object will consist of the - set of name:value pairs corresponding to the (possibly nested) - dictionary of properties defined by the input statements used by - the image. Some example output for the 'list <wks file>' command: - - $ wic list test.ks - "part" : { - "mountpoint" : "/" - "fstype" : "ext3" - } - "part" : { - "mountpoint" : "/home" - "fstype" : "ext3" - "offset" : "10000" - } - "bootloader" : { - "type" : "efi" - } - . - . - . - - Each entry in the output consists of the name of the input element - e.g. "part", followed by the properties defined for that - element enclosed in braces. This information should provide - sufficient information to create a complete user interface with. - - The final form enumerates all the possible values that exist and - can be specified for any given OE kickstart (wks) property. If - the -o option is specified, the list of values for the given - property, in addition to being displayed, will be written to the - specified file as a JSON object. In this case, the object will - consist of the set of name:value pairs corresponding to the array - of property values associated with the property. - - $ wic list property part - ["mountpoint", "where the partition should be mounted"] - ["fstype", "filesytem type of the partition"] - ["ext3"] - ["ext4"] - ["btrfs"] - ["swap"] - ["offset", "offset of the partition within the image"] - """ wic_plugins_help = """ @@ -428,12 +373,7 @@ DESCRIPTION This scheme is extensible - adding more hooks is a simple matter of adding more plugin methods to SourcePlugin and derived classes. - The code that then needs to call the plugin methods uses - plugin.get_source_plugin_methods() to find the method(s) needed by - the call; this is done by filling up a dict with keys containing - the method names of interest - on success, these will be filled in - with the actual methods. Please see the implementation for - examples and details. + Please see the implementation for details. """ wic_overview_help = """ @@ -528,8 +468,8 @@ DESCRIPTION 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] + [-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>. @@ -572,7 +512,7 @@ DESCRIPTION NATIVE_SYSROOT: ... The image(s) were created using OE kickstart file: - .../scripts/lib/image/canned-wks/directdisk.wks + .../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 @@ -599,18 +539,33 @@ DESCRIPTION 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 /home/trz/testwic --rootfs-dir - /home/trz/yocto/build/tmp/work/crownbay/core-image-minimal/1.0-r0/rootfs - --bootimg-dir /home/trz/yocto/build/tmp/sysroots/crownbay/usr/share - --kernel-dir /home/trz/yocto/build/tmp/sysroots/crownbay/usr/src/kernel - --native-sysroot /home/trz/yocto/build/tmp/sysroots/x86_64-linux + $ 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)... + Creating image(s)... - Info: The new image(s) can be found here: - /home/trz/testwic/build/test-201309260032-sda.direct + 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 @@ -662,7 +617,7 @@ DESCRIPTION This command creates a partition on the system and uses the following syntax: - part <mountpoint> + part [<mountpoint>] The <mountpoint> is where the partition will be mounted and must take of one of the following forms: @@ -671,6 +626,16 @@ DESCRIPTION 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 @@ -678,6 +643,12 @@ DESCRIPTION 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 @@ -705,6 +676,10 @@ DESCRIPTION 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. @@ -712,6 +687,8 @@ DESCRIPTION apply to partitions created using '--source rootfs' (see --source above). Valid values are: + vfat + msdos ext2 ext3 ext4 @@ -743,17 +720,43 @@ DESCRIPTION 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. + 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. + 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 @@ -767,8 +770,28 @@ DESCRIPTION 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/imager/__init__.py b/scripts/lib/wic/imager/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/wic/imager/__init__.py +++ /dev/null diff --git a/scripts/lib/wic/imager/baseimager.py b/scripts/lib/wic/imager/baseimager.py deleted file mode 100644 index e8305272a2..0000000000 --- a/scripts/lib/wic/imager/baseimager.py +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2007 Red Hat Inc. -# Copyright (c) 2009, 2010, 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. - -from __future__ import with_statement -import os, sys -import tempfile -import shutil - -from wic import kickstart -from wic import msger -from wic.utils.errors import CreatorError -from wic.utils import misc, runner, fs_related as fs - -class BaseImageCreator(object): - """Base class for image creation. - - BaseImageCreator is the simplest creator class available; it will - create a system image according to the supplied kickstart file. - - e.g. - - import wic.imgcreate as imgcreate - ks = imgcreate.read_kickstart("foo.ks") - imgcreate.ImageCreator(ks, "foo").create() - """ - - def __del__(self): - self.cleanup() - - def __init__(self, createopts = None): - """Initialize an ImageCreator instance. - - ks -- a pykickstart.KickstartParser instance; this instance will be - used to drive the install by e.g. providing the list of packages - to be installed, the system configuration and %post scripts - - name -- a name for the image; used for e.g. image filenames or - filesystem labels - """ - - self.__builddir = None - - self.ks = None - self.name = "target" - self.tmpdir = "/var/tmp/wic" - self.workdir = "/var/tmp/wic/build" - - # setup tmpfs tmpdir when enabletmpfs is True - self.enabletmpfs = False - - if createopts: - # Mapping table for variables that have different names. - optmap = {"outdir" : "destdir", - } - - # update setting from createopts - for key in createopts.keys(): - if key in optmap: - option = optmap[key] - else: - option = key - setattr(self, option, createopts[key]) - - self.destdir = os.path.abspath(os.path.expanduser(self.destdir)) - - self._dep_checks = ["ls", "bash", "cp", "echo"] - - # Output image file names - self.outimage = [] - - # No ks provided when called by convertor, so skip the dependency check - if self.ks: - # If we have btrfs partition we need to check necessary tools - for part in self.ks.handler.partition.partitions: - if part.fstype and part.fstype == "btrfs": - self._dep_checks.append("mkfs.btrfs") - break - - # make sure the specified tmpdir and cachedir exist - if not os.path.exists(self.tmpdir): - os.makedirs(self.tmpdir) - - - # - # Hooks for subclasses - # - def _create(self): - """Create partitions for the disk image(s) - - This is the hook where subclasses may create the partitions - that will be assembled into disk image(s). - - There is no default implementation. - """ - pass - - def _cleanup(self): - """Undo anything performed in _create(). - - This is the hook where subclasses must undo anything which was - done in _create(). - - There is no default implementation. - - """ - pass - - # - # Actual implementation - # - def __ensure_builddir(self): - if not self.__builddir is None: - return - - try: - self.workdir = os.path.join(self.tmpdir, "build") - if not os.path.exists(self.workdir): - os.makedirs(self.workdir) - self.__builddir = tempfile.mkdtemp(dir = self.workdir, - prefix = "imgcreate-") - except OSError, (err, msg): - raise CreatorError("Failed create build directory in %s: %s" % - (self.tmpdir, msg)) - - def __setup_tmpdir(self): - if not self.enabletmpfs: - return - - runner.show('mount -t tmpfs -o size=4G tmpfs %s' % self.workdir) - - def __clean_tmpdir(self): - if not self.enabletmpfs: - return - - runner.show('umount -l %s' % self.workdir) - - def create(self): - """Create partitions for the disk image(s) - - Create the partitions that will be assembled into disk - image(s). - """ - self.__setup_tmpdir() - self.__ensure_builddir() - - self._create() - - def cleanup(self): - """Undo anything performed in create(). - - Note, make sure to call this method once finished with the creator - instance in order to ensure no stale files are left on the host e.g.: - - creator = ImageCreator(ks, name) - try: - creator.create() - finally: - creator.cleanup() - - """ - if not self.__builddir: - return - - self._cleanup() - - shutil.rmtree(self.__builddir, ignore_errors = True) - self.__builddir = None - - self.__clean_tmpdir() - - - def print_outimage_info(self): - msg = "The new image can be found here:\n" - self.outimage.sort() - for file in self.outimage: - msg += ' %s\n' % os.path.abspath(file) - - msger.info(msg) diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py deleted file mode 100644 index d368401af4..0000000000 --- a/scripts/lib/wic/imager/direct.py +++ /dev/null @@ -1,379 +0,0 @@ -# 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' image creator class for 'wic' -# -# AUTHORS -# Tom Zanussi <tom.zanussi (at] linux.intel.com> -# - -import os -import stat -import shutil - -from wic import kickstart, msger -from wic.utils import fs_related, runner, misc -from wic.utils.partitionedfs import Image -from wic.utils.errors import CreatorError, ImageError -from wic.imager.baseimager import BaseImageCreator -from wic.utils.oe.misc import * -from wic.plugin import pluginmgr - -disk_methods = { - "do_install_disk":None, -} - -class DirectImageCreator(BaseImageCreator): - """ - Installs a system into a file containing a partitioned disk image. - - DirectImageCreator is an advanced ImageCreator subclass; 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. - """ - - def __init__(self, oe_builddir, image_output_dir, rootfs_dir, bootimg_dir, - kernel_dir, native_sysroot, creatoropts=None): - """ - Initialize a DirectImageCreator instance. - - This method takes the same arguments as ImageCreator.__init__() - """ - BaseImageCreator.__init__(self, creatoropts) - - self.__image = None - self.__disks = {} - self.__disk_format = "direct" - self._disk_names = [] - self._ptable_format = self.ks.handler.bootloader.ptable - - self.oe_builddir = oe_builddir - if image_output_dir: - self.tmpdir = image_output_dir - self.rootfs_dir = rootfs_dir - self.bootimg_dir = bootimg_dir - self.kernel_dir = kernel_dir - self.native_sysroot = native_sysroot - - def __get_part_num(self, num, parts): - """calculate the real partition number, accounting for partitions not - in the partition table and logical partitions - """ - realnum = 0 - for n, p in enumerate(parts, 1): - if not p.no_table: - realnum += 1 - if n == num: - if p.no_table: - return 0 - if self._ptable_format == 'msdos' and realnum > 3: - # account for logical partition numbering, ex. sda5.. - return realnum + 1 - return realnum - - 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 image_rootfs is None: - return None - - fstab = image_rootfs + "/etc/fstab" - if not os.path.isfile(fstab): - return None - - parts = self._get_parts() - - self._save_fstab(fstab) - fstab_lines = self._get_fstab(fstab, parts) - self._update_fstab(fstab_lines, parts) - self._write_fstab(fstab, fstab_lines) - - return fstab - - def _update_fstab(self, fstab_lines, parts): - """Assume partition order same as in wks""" - for num, p in enumerate(parts, 1): - pnum = self.__get_part_num(num, parts) - if not p.mountpoint or p.mountpoint == "/" or p.mountpoint == "/boot" or pnum == 0: - continue - - part = '' - # mmc device partitions are named mmcblk0p1, mmcblk0p2.. - if p.disk.startswith('mmcblk'): - part = 'p' - - device_name = "/dev/" + p.disk + part + str(pnum) - - opts = "defaults" - if p.fsopts: - opts = p.fsopts - - fstab_entry = device_name + "\t" + \ - p.mountpoint + "\t" + \ - p.fstype + "\t" + \ - opts + "\t0\t0\n" - fstab_lines.append(fstab_entry) - - def _write_fstab(self, fstab, fstab_lines): - fstab = open(fstab, "w") - for line in fstab_lines: - fstab.write(line) - fstab.close() - - def _save_fstab(self, fstab): - """Save the current fstab in rootfs""" - shutil.copyfile(fstab, fstab + ".orig") - - def _restore_fstab(self, fstab): - """Restore the saved fstab in rootfs""" - if fstab is None: - return - shutil.move(fstab + ".orig", fstab) - - def _get_fstab(self, fstab, parts): - """Return the desired contents of /etc/fstab.""" - f = open(fstab, "r") - fstab_contents = f.readlines() - f.close() - - return fstab_contents - - def set_bootimg_dir(self, bootimg_dir): - """ - Accessor for bootimg_dir, the actual location used for the source - of the bootimg. Should be set by source plugins (only if they - change the default bootimg source) so the correct info gets - displayed for print_outimage_info(). - """ - self.bootimg_dir = bootimg_dir - - def _get_parts(self): - if not self.ks: - raise CreatorError("Failed to get partition info, " - "please check your kickstart setting.") - - # Set a default partition if no partition is given out - if not self.ks.handler.partition.partitions: - partstr = "part / --size 1900 --ondisk sda --fstype=ext3" - args = partstr.split() - pd = self.ks.handler.partition.parse(args[1:]) - if pd not in self.ks.handler.partition.partitions: - self.ks.handler.partition.partitions.append(pd) - - # partitions list from kickstart file - return kickstart.get_partitions(self.ks) - - def get_disk_names(self): - """ Returns a list of physical target disk names (e.g., 'sdb') which - will be created. """ - - if self._disk_names: - return self._disk_names - - #get partition info from ks handler - parts = self._get_parts() - - for i in range(len(parts)): - if parts[i].disk: - disk_name = parts[i].disk - else: - raise CreatorError("Failed to create disks, no --ondisk " - "specified in partition line of ks file") - - if parts[i].mountpoint and not parts[i].fstype: - raise CreatorError("Failed to create disks, no --fstype " - "specified for partition with mountpoint " - "'%s' in the ks file") - - self._disk_names.append(disk_name) - - return self._disk_names - - def _full_name(self, name, extention): - """ Construct full file name for a file we generate. """ - return "%s-%s.%s" % (self.name, name, extention) - - def _full_path(self, path, name, extention): - """ Construct full file path to a file we generate. """ - return os.path.join(path, self._full_name(name, extention)) - - def get_default_source_plugin(self): - """ - The default source plugin i.e. the plugin that's consulted for - overall image generation tasks outside of any particular - partition. For convenience, we just hang it off the - bootloader handler since it's the one non-partition object in - any setup. By default the default plugin is set to the same - plugin as the /boot partition; since we hang it off the - bootloader object, the default can be explicitly set using the - --source bootloader param. - """ - return self.ks.handler.bootloader.source - - # - # 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. - """ - parts = self._get_parts() - - self.__image = Image() - - for p in parts: - # as a convenience, set source to the boot partition source - # instead of forcing it to be set via bootloader --source - if not self.ks.handler.bootloader.source and p.mountpoint == "/boot": - self.ks.handler.bootloader.source = p.source - - fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) - - for p in parts: - # need to create the filesystems in order to get their - # sizes before we can add them and do the layout. - # Image.create() actually calls __format_disks() to create - # the disk images and carve out the partitions, then - # self.assemble() calls Image.assemble() which calls - # __write_partitition() for each partition to dd the fs - # into the partitions. - p.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir, - self.bootimg_dir, self.kernel_dir, self.native_sysroot) - - - self.__image.add_partition(int(p.size), - p.disk, - p.mountpoint, - p.source_file, - p.fstype, - p.label, - fsopts = p.fsopts, - boot = p.active, - align = p.align, - no_table = p.no_table, - part_type = p.part_type) - - self._restore_fstab(fstab) - - self.__image.layout_partitions(self._ptable_format) - - self.__imgdir = self.workdir - for disk_name, disk in self.__image.disks.items(): - full_path = self._full_path(self.__imgdir, disk_name, "direct") - msger.debug("Adding disk %s as %s with size %s bytes" \ - % (disk_name, full_path, disk['min_size'])) - disk_obj = fs_related.DiskImage(full_path, disk['min_size']) - self.__disks[disk_name] = disk_obj - self.__image.add_disk(disk_name, disk_obj) - - self.__image.create() - - def assemble(self): - """ - Assemble partitions into disk image(s) - """ - for disk_name, disk in self.__image.disks.items(): - full_path = self._full_path(self.__imgdir, disk_name, "direct") - msger.debug("Assembling disk %s as %s with size %s bytes" \ - % (disk_name, full_path, disk['min_size'])) - self.__image.assemble(full_path) - - 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.get_default_source_plugin() - if source_plugin: - self._source_methods = pluginmgr.get_source_plugin_methods(source_plugin, disk_methods) - for disk_name, disk in self.__image.disks.items(): - self._source_methods["do_install_disk"](disk, disk_name, self, - self.workdir, - self.oe_builddir, - self.bootimg_dir, - self.kernel_dir, - self.native_sysroot) - - def print_outimage_info(self): - """ - Print the image(s) and artifacts used, for the user. - """ - msg = "The new image(s) can be found here:\n" - - parts = self._get_parts() - - for disk_name, disk in self.__image.disks.items(): - full_path = self._full_path(self.__imgdir, disk_name, "direct") - msg += ' %s\n\n' % full_path - - msg += 'The following build artifacts were used to create the image(s):\n' - for p in parts: - if p.get_rootfs() is None: - continue - if p.mountpoint == '/': - str = ':' - else: - str = '["%s"]:' % p.label - msg += ' ROOTFS_DIR%s%s\n' % (str.ljust(20), p.get_rootfs()) - - msg += ' BOOTIMG_DIR: %s\n' % self.bootimg_dir - msg += ' KERNEL_DIR: %s\n' % self.kernel_dir - msg += ' NATIVE_SYSROOT: %s\n' % self.native_sysroot - - msger.info(msg) - - def _get_boot_config(self): - """ - Return the rootdev/root_part_uuid (if specified by - --part-type) - - Assume partition order same as in wks - """ - rootdev = None - root_part_uuid = None - parts = self._get_parts() - for num, p in enumerate(parts, 1): - if p.mountpoint == "/": - part = '' - if p.disk.startswith('mmcblk'): - part = 'p' - - pnum = self.__get_part_num(num, parts) - rootdev = "/dev/%s%s%-d" % (p.disk, part, pnum) - root_part_uuid = p.part_type - - return (rootdev, root_part_uuid) - - def _cleanup(self): - if not self.__image is None: - try: - self.__image.cleanup() - except ImageError, err: - msger.warning("%s" % err) - diff --git a/scripts/lib/wic/kickstart/__init__.py b/scripts/lib/wic/kickstart/__init__.py deleted file mode 100644 index 10959213d1..0000000000 --- a/scripts/lib/wic/kickstart/__init__.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2007 Red Hat, Inc. -# Copyright (c) 2009, 2010, 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 os, sys, re -import shutil -import subprocess -import string - -import pykickstart.sections as kssections -import pykickstart.commands as kscommands -import pykickstart.constants as ksconstants -import pykickstart.errors as kserrors -import pykickstart.parser as ksparser -import pykickstart.version as ksversion -from pykickstart.handlers.control import commandMap -from pykickstart.handlers.control import dataMap - -from wic import msger -from wic.utils import errors, misc, runner, fs_related as fs -from custom_commands import wicboot, partition - -def read_kickstart(path): - """Parse a kickstart file and return a KickstartParser instance. - - This is a simple utility function which takes a path to a kickstart file, - parses it and returns a pykickstart KickstartParser instance which can - be then passed to an ImageCreator constructor. - - If an error occurs, a CreatorError exception is thrown. - """ - - #version = ksversion.makeVersion() - #ks = ksparser.KickstartParser(version) - - using_version = ksversion.DEVEL - commandMap[using_version]["bootloader"] = wicboot.Wic_Bootloader - commandMap[using_version]["part"] = partition.Wic_Partition - commandMap[using_version]["partition"] = partition.Wic_Partition - dataMap[using_version]["PartData"] = partition.Wic_PartData - superclass = ksversion.returnClassForVersion(version=using_version) - - class KSHandlers(superclass): - def __init__(self): - superclass.__init__(self, mapping=commandMap[using_version]) - - ks = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True) - - try: - ks.readKickstart(path) - except (kserrors.KickstartParseError, kserrors.KickstartError), err: - msger.warning("Errors occurred when parsing kickstart file: %s\n" % path) - msger.error("%s" % err) - - return ks - -def get_image_size(ks, default = None): - __size = 0 - for p in ks.handler.partition.partitions: - if p.mountpoint == "/" and p.size: - __size = p.size - if __size > 0: - return int(__size) * 1024L - else: - return default - -def get_image_fstype(ks, default = None): - for p in ks.handler.partition.partitions: - if p.mountpoint == "/" and p.fstype: - return p.fstype - return default - -def get_image_fsopts(ks, default = None): - for p in ks.handler.partition.partitions: - if p.mountpoint == "/" and p.fsopts: - return p.fsopts - return default - -def get_timeout(ks, default = None): - if not hasattr(ks.handler.bootloader, "timeout"): - return default - if ks.handler.bootloader.timeout is None: - return default - return int(ks.handler.bootloader.timeout) - -def get_kernel_args(ks, default = "ro rd.live.image"): - if not hasattr(ks.handler.bootloader, "appendLine"): - return default - if ks.handler.bootloader.appendLine is None: - return default - return "%s %s" %(default, ks.handler.bootloader.appendLine) - -def get_menu_args(ks, default = ""): - if not hasattr(ks.handler.bootloader, "menus"): - return default - if ks.handler.bootloader.menus in (None, ""): - return default - return "%s" % ks.handler.bootloader.menus - -def get_default_kernel(ks, default = None): - if not hasattr(ks.handler.bootloader, "default"): - return default - if not ks.handler.bootloader.default: - return default - return ks.handler.bootloader.default - -def get_partitions(ks): - return ks.handler.partition.partitions diff --git a/scripts/lib/wic/kickstart/custom_commands/__init__.py b/scripts/lib/wic/kickstart/custom_commands/__init__.py deleted file mode 100644 index f84c6d9e00..0000000000 --- a/scripts/lib/wic/kickstart/custom_commands/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from micpartition import Mic_Partition -from micpartition import Mic_PartData -from partition import Wic_Partition - -__all__ = ( - "Mic_Partition", - "Mic_PartData", - "Wic_Partition", - "Wic_PartData", -) diff --git a/scripts/lib/wic/kickstart/custom_commands/micboot.py b/scripts/lib/wic/kickstart/custom_commands/micboot.py deleted file mode 100644 index d162142506..0000000000 --- a/scripts/lib/wic/kickstart/custom_commands/micboot.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2008, 2009, 2010 Intel, Inc. -# -# Anas Nashif -# -# 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. - -from pykickstart.base import * -from pykickstart.errors import * -from pykickstart.options import * -from pykickstart.commands.bootloader import * - -class Mic_Bootloader(F8_Bootloader): - def __init__(self, writePriority=10, appendLine="", driveorder=None, - forceLBA=False, location="", md5pass="", password="", - upgrade=False, menus=""): - F8_Bootloader.__init__(self, writePriority, appendLine, driveorder, - forceLBA, location, md5pass, password, upgrade) - - self.menus = "" - self.ptable = "msdos" - - def _getArgsAsStr(self): - ret = F8_Bootloader._getArgsAsStr(self) - - if self.menus == "": - ret += " --menus=%s" %(self.menus,) - if self.ptable: - ret += " --ptable=\"%s\"" %(self.ptable,) - return ret - - def _getParser(self): - op = F8_Bootloader._getParser(self) - op.add_option("--menus", dest="menus") - op.add_option("--ptable", dest="ptable", type="string") - return op - diff --git a/scripts/lib/wic/kickstart/custom_commands/micpartition.py b/scripts/lib/wic/kickstart/custom_commands/micpartition.py deleted file mode 100644 index d6be008ceb..0000000000 --- a/scripts/lib/wic/kickstart/custom_commands/micpartition.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -tt -# -# Marko Saukko <marko.saukko@cybercom.com> -# -# Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -# -# This copyrighted material is made available to anyone wishing to use, modify, -# copy, or redistribute it subject to the terms and conditions of the GNU -# General Public License v.2. This program is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the -# implied warranties 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. - -from pykickstart.commands.partition import * - -class Mic_PartData(FC4_PartData): - removedKeywords = FC4_PartData.removedKeywords - removedAttrs = FC4_PartData.removedAttrs - - def __init__(self, *args, **kwargs): - FC4_PartData.__init__(self, *args, **kwargs) - self.deleteRemovedAttrs() - self.align = kwargs.get("align", None) - self.extopts = kwargs.get("extopts", None) - self.part_type = kwargs.get("part_type", None) - - def _getArgsAsStr(self): - retval = FC4_PartData._getArgsAsStr(self) - - if self.align: - retval += " --align=%d" % self.align - if self.extopts: - retval += " --extoptions=%s" % self.extopts - if self.part_type: - retval += " --part-type=%s" % self.part_type - - return retval - -class Mic_Partition(FC4_Partition): - removedKeywords = FC4_Partition.removedKeywords - removedAttrs = FC4_Partition.removedAttrs - - def _getParser(self): - op = FC4_Partition._getParser(self) - # The alignment value is given in kBytes. e.g., value 8 means that - # the partition is aligned to start from 8096 byte boundary. - op.add_option("--align", type="int", action="store", dest="align", - default=None) - op.add_option("--extoptions", type="string", action="store", dest="extopts", - default=None) - op.add_option("--part-type", type="string", action="store", dest="part_type", - default=None) - return op diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py deleted file mode 100644 index 4f5a1e5ce4..0000000000 --- a/scripts/lib/wic/kickstart/custom_commands/partition.py +++ /dev/null @@ -1,563 +0,0 @@ -# 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 the OpenEmbedded partition object definitions. -# -# AUTHORS -# Tom Zanussi <tom.zanussi (at] linux.intel.com> -# - -import shutil -import os -import tempfile - -from pykickstart.commands.partition import * -from wic.utils.oe.misc import * -from wic.kickstart.custom_commands import * -from wic.plugin import pluginmgr - -partition_methods = { - "do_stage_partition":None, - "do_prepare_partition":None, - "do_configure_partition":None, -} - -class Wic_PartData(Mic_PartData): - removedKeywords = Mic_PartData.removedKeywords - removedAttrs = Mic_PartData.removedAttrs - - def __init__(self, *args, **kwargs): - Mic_PartData.__init__(self, *args, **kwargs) - self.deleteRemovedAttrs() - self.source = kwargs.get("source", None) - self.sourceparams = kwargs.get("sourceparams", None) - self.rootfs = kwargs.get("rootfs-dir", None) - self.no_table = kwargs.get("no-table", False) - self.extra_space = kwargs.get("extra-space", "10M") - self.overhead_factor = kwargs.get("overhead-factor", 1.3) - self.source_file = "" - self.size = 0 - - def _getArgsAsStr(self): - retval = Mic_PartData._getArgsAsStr(self) - - if self.source: - retval += " --source=%s" % self.source - if self.sourceparams: - retval += " --sourceparams=%s" % self.sourceparams - if self.rootfs: - retval += " --rootfs-dir=%s" % self.rootfs - if self.no_table: - retval += " --no-table" - retval += " --extra-space=%d" % self.extra_space - retval += " --overhead-factor=%f" % self.overhead_factor - - return retval - - def get_rootfs(self): - """ - Acessor for rootfs dir - """ - return self.rootfs - - def set_rootfs(self, rootfs): - """ - Acessor for actual rootfs dir, which must be set by source - plugins. - """ - self.rootfs = rootfs - - def get_size(self): - """ - Accessor for partition size, 0 or --size before set_size(). - """ - return self.size - - def set_size(self, size): - """ - Accessor for actual partition size, which must be set by source - plugins. - """ - self.size = size - - def set_source_file(self, source_file): - """ - Accessor for source_file, the location of the generated partition - image, which must be set by source plugins. - """ - self.source_file = source_file - - 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. - """ - msger.debug("Requested partition size for %s: %d" % \ - (self.mountpoint, self.size)) - - if not self.size: - return 0 - - requested_blocks = self.size - - msger.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 prepare(self, cr, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir, - kernel_dir, native_sysroot): - """ - Prepare content for individual partitions, depending on - partition command parameters. - """ - self.sourceparams_dict = {} - - if self.sourceparams: - self.sourceparams_dict = parse_sourceparams(self.sourceparams) - - if not self.source: - if not self.size: - msger.error("The %s partition has a size of zero. Please specify a non-zero --size for that partition." % self.mountpoint) - if self.fstype and self.fstype == "swap": - self.prepare_swap_partition(cr_workdir, oe_builddir, - native_sysroot) - elif self.fstype: - self.prepare_empty_partition(cr_workdir, oe_builddir, - native_sysroot) - return - - plugins = pluginmgr.get_source_plugins() - - if self.source not in plugins: - msger.error("The '%s' --source specified for %s doesn't exist.\n\tSee '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)) - - self._source_methods = pluginmgr.get_source_plugin_methods(self.source, partition_methods) - self._source_methods["do_configure_partition"](self, self.sourceparams_dict, - cr, cr_workdir, - oe_builddir, - bootimg_dir, - kernel_dir, - native_sysroot) - self._source_methods["do_stage_partition"](self, self.sourceparams_dict, - cr, cr_workdir, - oe_builddir, - bootimg_dir, kernel_dir, - native_sysroot) - self._source_methods["do_prepare_partition"](self, self.sourceparams_dict, - cr, cr_workdir, - oe_builddir, - bootimg_dir, kernel_dir, rootfs_dir, - native_sysroot) - - def prepare_rootfs_from_fs_image(self, cr_workdir, oe_builddir, - rootfs_dir): - """ - Handle an already-created partition e.g. xxx.ext3 - """ - rootfs = oe_builddir - du_cmd = "du -Lbks %s" % rootfs - out = exec_cmd(du_cmd) - rootfs_size = out.split()[0] - - self.size = rootfs_size - self.source_file = rootfs - - 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. - """ - pseudo = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot - pseudo += "export PSEUDO_LOCALSTATEDIR=%s/../pseudo;" % rootfs_dir - pseudo += "export PSEUDO_PASSWD=%s;" % rootfs_dir - pseudo += "export PSEUDO_NOSYMLINKEXP=1;" - pseudo += "%s/usr/bin/pseudo " % native_sysroot - - if self.fstype.startswith("ext"): - return self.prepare_rootfs_ext(cr_workdir, oe_builddir, - rootfs_dir, native_sysroot, - pseudo) - elif self.fstype.startswith("btrfs"): - return self.prepare_rootfs_btrfs(cr_workdir, oe_builddir, - rootfs_dir, native_sysroot, - pseudo) - - elif self.fstype.startswith("vfat"): - return self.prepare_rootfs_vfat(cr_workdir, oe_builddir, - rootfs_dir, native_sysroot, - pseudo) - elif self.fstype.startswith("squashfs"): - return self.prepare_rootfs_squashfs(cr_workdir, oe_builddir, - rootfs_dir, native_sysroot, - pseudo) - - def prepare_rootfs_ext(self, cr_workdir, oe_builddir, rootfs_dir, - native_sysroot, pseudo): - """ - Prepare content for an ext2/3/4 rootfs partition. - """ - - image_rootfs = rootfs_dir - rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype) - - du_cmd = "du -ks %s" % image_rootfs - out = exec_cmd(du_cmd) - actual_rootfs_size = int(out.split()[0]) - - 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 - - msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ - (extra_blocks, self.mountpoint, rootfs_size)) - - dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \ - (rootfs, rootfs_size) - exec_cmd(dd_cmd) - - 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, image_rootfs) - (rc, out) = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) - if rc: - print "rootfs_dir: %s" % rootfs_dir - msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details) when creating filesystem from rootfs directory: %s" % (self.fstype, rc, rootfs_dir)) - - # get the rootfs size in the right units for kickstart (kB) - du_cmd = "du -Lbks %s" % rootfs - out = exec_cmd(du_cmd) - rootfs_size = out.split()[0] - - self.size = rootfs_size - self.source_file = rootfs - - return 0 - - def prepare_rootfs_btrfs(self, cr_workdir, oe_builddir, rootfs_dir, - native_sysroot, pseudo): - """ - Prepare content for a btrfs rootfs partition. - - Currently handles ext2/3/4 and btrfs. - """ - image_rootfs = rootfs_dir - rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype) - - du_cmd = "du -ks %s" % image_rootfs - out = exec_cmd(du_cmd) - actual_rootfs_size = int(out.split()[0]) - - 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 - - msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ - (extra_blocks, self.mountpoint, rootfs_size)) - - dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \ - (rootfs, rootfs_size) - exec_cmd(dd_cmd) - - 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, image_rootfs, label_str, rootfs) - (rc, out) = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) - if rc: - msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details) when creating filesystem from rootfs directory: %s" % (self.fstype, rc, rootfs_dir)) - - # get the rootfs size in the right units for kickstart (kB) - du_cmd = "du -Lbks %s" % rootfs - out = exec_cmd(du_cmd) - rootfs_size = out.split()[0] - - self.size = rootfs_size - self.source_file = rootfs - - def prepare_rootfs_vfat(self, cr_workdir, oe_builddir, rootfs_dir, - native_sysroot, pseudo): - """ - Prepare content for a vfat rootfs partition. - """ - image_rootfs = rootfs_dir - rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label, self.fstype) - - du_cmd = "du -bks %s" % image_rootfs - out = exec_cmd(du_cmd) - blocks = int(out.split()[0]) - - extra_blocks = self.get_extra_block_count(blocks) - if extra_blocks < self.extra_space: - extra_blocks = self.extra_space - - blocks += extra_blocks - - msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ - (extra_blocks, self.mountpoint, blocks)) - - # Ensure total sectors is an integral number of sectors per - # track or mcopy will complain. Sectors are 512 bytes, and we - # generate images with 32 sectors per track. This calculation - # is done in blocks, thus the mod by 16 instead of 32. Apply - # sector count fix only when needed. - if blocks % 16 != 0: - blocks += (16 - (blocks % 16)) - - label_str = "-n boot" - if (self.label): - label_str = "-n %s" % self.label - - dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks) - exec_native_cmd(dosfs_cmd, native_sysroot) - - mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, image_rootfs) - rc, out = exec_native_cmd(mcopy_cmd, native_sysroot) - if rc: - msger.error("ERROR: mcopy returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % rc) - - chmod_cmd = "chmod 644 %s" % rootfs - exec_cmd(chmod_cmd) - - # get the rootfs size in the right units for kickstart (kB) - du_cmd = "du -Lbks %s" % rootfs - out = exec_cmd(du_cmd) - rootfs_size = out.split()[0] - - self.set_size(rootfs_size) - self.set_source_file(rootfs) - - def prepare_rootfs_squashfs(self, cr_workdir, oe_builddir, rootfs_dir, - native_sysroot, pseudo): - """ - Prepare content for a squashfs rootfs partition. - """ - image_rootfs = rootfs_dir - rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype) - - squashfs_cmd = "mksquashfs %s %s -noappend" % \ - (image_rootfs, rootfs) - exec_native_cmd(pseudo + squashfs_cmd, native_sysroot) - - # get the rootfs size in the right units for kickstart (kB) - du_cmd = "du -Lbks %s" % rootfs - out = exec_cmd(du_cmd) - rootfs_size = out.split()[0] - - self.size = rootfs_size - self.source_file = rootfs - - return 0 - - def prepare_empty_partition(self, cr_workdir, oe_builddir, native_sysroot): - """ - Prepare an empty partition. - """ - if self.fstype.startswith("ext"): - return self.prepare_empty_partition_ext(cr_workdir, oe_builddir, - native_sysroot) - elif self.fstype.startswith("btrfs"): - return self.prepare_empty_partition_btrfs(cr_workdir, oe_builddir, - native_sysroot) - elif self.fstype.startswith("vfat"): - return self.prepare_empty_partition_vfat(cr_workdir, oe_builddir, - native_sysroot) - elif self.fstype.startswith("squashfs"): - return self.prepare_empty_partition_squashfs(cr_workdir, oe_builddir, - native_sysroot) - - def prepare_empty_partition_ext(self, cr_workdir, oe_builddir, - native_sysroot): - """ - Prepare an empty ext2/3/4 partition. - """ - fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) - - dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ - (fs, self.size) - exec_cmd(dd_cmd) - - 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, fs) - (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) - if rc: - msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc)) - - self.source_file = fs - - return 0 - - def prepare_empty_partition_btrfs(self, cr_workdir, oe_builddir, - native_sysroot): - """ - Prepare an empty btrfs partition. - """ - fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) - - dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ - (fs, self.size) - exec_cmd(dd_cmd) - - 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, fs) - (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) - if rc: - msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc)) - - self.source_file = fs - - return 0 - - def prepare_empty_partition_vfat(self, cr_workdir, oe_builddir, - native_sysroot): - """ - Prepare an empty vfat partition. - """ - fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) - - blocks = self.size - - label_str = "-n boot" - if (self.label): - label_str = "-n %s" % self.label - - dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, fs, blocks) - exec_native_cmd(dosfs_cmd, native_sysroot) - - chmod_cmd = "chmod 644 %s" % fs - exec_cmd(chmod_cmd) - - self.source_file = fs - - return 0 - - def prepare_empty_partition_squashfs(self, cr_workdir, oe_builddir, - native_sysroot): - """ - Prepare an empty squashfs partition. - """ - msger.warning("Creating of an empty squashfs %s partition was attempted. " \ - "Proceeding as requested." % self.mountpoint) - - fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) - - # it is not possible to create a squashfs without source data, - # thus prepare an empty temp dir that is used as source - tmpdir = tempfile.mkdtemp() - - squashfs_cmd = "mksquashfs %s %s -noappend" % \ - (tmpdir, fs) - exec_native_cmd(squashfs_cmd, native_sysroot) - - os.rmdir(tmpdir) - - # get the rootfs size in the right units for kickstart (kB) - du_cmd = "du -Lbks %s" % fs - out = exec_cmd(du_cmd) - fs_size = out.split()[0] - - self.size = fs_size - self.source_file = fs - - return 0 - - def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot): - """ - Prepare a swap partition. - """ - fs = "%s/fs.%s" % (cr_workdir, self.fstype) - - dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ - (fs, self.size) - exec_cmd(dd_cmd) - - 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()), fs) - exec_native_cmd(mkswap_cmd, native_sysroot) - - self.source_file = fs - - return 0 - -class Wic_Partition(Mic_Partition): - removedKeywords = Mic_Partition.removedKeywords - removedAttrs = Mic_Partition.removedAttrs - - def _getParser(self): - def overhead_cb (option, opt_str, value, parser): - if (value < 1): - raise OptionValueError("Option %s: invalid value: %r" % (option, value)) - setattr(parser.values, option.dest, value) - - op = Mic_Partition._getParser(self) - # use specified source file to fill the partition - # and calculate partition size - op.add_option("--source", type="string", action="store", - dest="source", default=None) - # comma-separated list of param=value pairs - op.add_option("--sourceparams", type="string", action="store", - dest="sourceparams", default=None) - # use specified rootfs path to fill the partition - op.add_option("--rootfs-dir", type="string", action="store", - dest="rootfs", default=None) - # wether to add the partition in the partition table - op.add_option("--no-table", dest="no_table", action="store_true", - default=False) - # extra space beyond the partition size - op.add_option("--extra-space", dest="extra_space", action="store", - type="size", nargs=1, default="10M") - op.add_option("--overhead-factor", dest="overhead_factor", - action="callback", callback=overhead_cb, type="float", - nargs=1, default=1.3) - return op diff --git a/scripts/lib/wic/kickstart/custom_commands/wicboot.py b/scripts/lib/wic/kickstart/custom_commands/wicboot.py deleted file mode 100644 index f1914169d8..0000000000 --- a/scripts/lib/wic/kickstart/custom_commands/wicboot.py +++ /dev/null @@ -1,57 +0,0 @@ -# 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 module provides the OpenEmbedded bootloader object definitions. -# -# AUTHORS -# Tom Zanussi <tom.zanussi (at] linux.intel.com> -# - -from pykickstart.base import * -from pykickstart.errors import * -from pykickstart.options import * -from pykickstart.commands.bootloader import * - -from wic.kickstart.custom_commands.micboot import * - -class Wic_Bootloader(Mic_Bootloader): - def __init__(self, writePriority=10, appendLine="", driveorder=None, - forceLBA=False, location="", md5pass="", password="", - upgrade=False, menus=""): - Mic_Bootloader.__init__(self, writePriority, appendLine, driveorder, - forceLBA, location, md5pass, password, upgrade) - - self.source = "" - - def _getArgsAsStr(self): - retval = Mic_Bootloader._getArgsAsStr(self) - - if self.source: - retval += " --source=%s" % self.source - - return retval - - def _getParser(self): - op = Mic_Bootloader._getParser(self) - # use specified source plugin to implement bootloader-specific methods - op.add_option("--source", type="string", action="store", - dest="source", default=None) - return op - 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/msger.py b/scripts/lib/wic/msger.py deleted file mode 100644 index 9f557e7b9a..0000000000 --- a/scripts/lib/wic/msger.py +++ /dev/null @@ -1,309 +0,0 @@ -#!/usr/bin/env python -tt -# vim: ai ts=4 sts=4 et sw=4 -# -# Copyright (c) 2009, 2010, 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 os,sys -import re -import time - -__ALL__ = ['set_mode', - 'get_loglevel', - 'set_loglevel', - 'set_logfile', - 'raw', - 'debug', - 'verbose', - 'info', - 'warning', - 'error', - 'ask', - 'pause', - ] - -# COLORs in ANSI -INFO_COLOR = 32 # green -WARN_COLOR = 33 # yellow -ERR_COLOR = 31 # red -ASK_COLOR = 34 # blue -NO_COLOR = 0 - -PREFIX_RE = re.compile('^<(.*?)>\s*(.*)', re.S) - -INTERACTIVE = True - -LOG_LEVEL = 1 -LOG_LEVELS = { - 'quiet': 0, - 'normal': 1, - 'verbose': 2, - 'debug': 3, - 'never': 4, - } - -LOG_FILE_FP = None -LOG_CONTENT = '' -CATCHERR_BUFFILE_FD = -1 -CATCHERR_BUFFILE_PATH = None -CATCHERR_SAVED_2 = -1 - -def _general_print(head, color, msg = None, stream = None, level = 'normal'): - global LOG_CONTENT - if not stream: - stream = sys.stdout - - if LOG_LEVELS[level] > LOG_LEVEL: - # skip - return - - # encode raw 'unicode' str to utf8 encoded str - if msg and isinstance(msg, unicode): - msg = msg.encode('utf-8', 'ignore') - - errormsg = '' - if CATCHERR_BUFFILE_FD > 0: - size = os.lseek(CATCHERR_BUFFILE_FD , 0, os.SEEK_END) - os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_SET) - errormsg = os.read(CATCHERR_BUFFILE_FD, size) - os.ftruncate(CATCHERR_BUFFILE_FD, 0) - - # append error msg to LOG - if errormsg: - LOG_CONTENT += errormsg - - # append normal msg to LOG - save_msg = msg.strip() if msg else None - if save_msg: - timestr = time.strftime("[%m/%d %H:%M:%S %Z] ", time.localtime()) - LOG_CONTENT += timestr + save_msg + '\n' - - if errormsg: - _color_print('', NO_COLOR, errormsg, stream, level) - - _color_print(head, color, msg, stream, level) - -def _color_print(head, color, msg, stream, level): - colored = True - if color == NO_COLOR or \ - not stream.isatty() or \ - os.getenv('ANSI_COLORS_DISABLED') is not None: - colored = False - - if head.startswith('\r'): - # need not \n at last - newline = False - else: - newline = True - - if colored: - head = '\033[%dm%s:\033[0m ' %(color, head) - if not newline: - # ESC cmd to clear line - head = '\033[2K' + head - else: - if head: - head += ': ' - if head.startswith('\r'): - head = head.lstrip() - newline = True - - if msg is not None: - if isinstance(msg, unicode): - msg = msg.encode('utf8', 'ignore') - - stream.write('%s%s' % (head, msg)) - if newline: - stream.write('\n') - - stream.flush() - -def _color_perror(head, color, msg, level = 'normal'): - if CATCHERR_BUFFILE_FD > 0: - _general_print(head, color, msg, sys.stdout, level) - else: - _general_print(head, color, msg, sys.stderr, level) - -def _split_msg(head, msg): - if isinstance(msg, list): - msg = '\n'.join(map(str, msg)) - - if msg.startswith('\n'): - # means print \n at first - msg = msg.lstrip() - head = '\n' + head - - elif msg.startswith('\r'): - # means print \r at first - msg = msg.lstrip() - head = '\r' + head - - m = PREFIX_RE.match(msg) - if m: - head += ' <%s>' % m.group(1) - msg = m.group(2) - - return head, msg - -def get_loglevel(): - return (k for k,v in LOG_LEVELS.items() if v==LOG_LEVEL).next() - -def set_loglevel(level): - global LOG_LEVEL - if level not in LOG_LEVELS: - # no effect - return - - LOG_LEVEL = LOG_LEVELS[level] - -def set_interactive(mode=True): - global INTERACTIVE - if mode: - INTERACTIVE = True - else: - INTERACTIVE = False - -def log(msg=''): - # log msg to LOG_CONTENT then save to logfile - global LOG_CONTENT - if msg: - LOG_CONTENT += msg - -def raw(msg=''): - _general_print('', NO_COLOR, msg) - -def info(msg): - head, msg = _split_msg('Info', msg) - _general_print(head, INFO_COLOR, msg) - -def verbose(msg): - head, msg = _split_msg('Verbose', msg) - _general_print(head, INFO_COLOR, msg, level = 'verbose') - -def warning(msg): - head, msg = _split_msg('Warning', msg) - _color_perror(head, WARN_COLOR, msg) - -def debug(msg): - head, msg = _split_msg('Debug', msg) - _color_perror(head, ERR_COLOR, msg, level = 'debug') - -def error(msg): - head, msg = _split_msg('Error', msg) - _color_perror(head, ERR_COLOR, msg) - sys.exit(1) - -def ask(msg, default=True): - _general_print('\rQ', ASK_COLOR, '') - try: - if default: - msg += '(Y/n) ' - else: - msg += '(y/N) ' - if INTERACTIVE: - while True: - repl = raw_input(msg) - if repl.lower() == 'y': - return True - elif repl.lower() == 'n': - return False - elif not repl.strip(): - # <Enter> - return default - - # else loop - else: - if default: - msg += ' Y' - else: - msg += ' N' - _general_print('', NO_COLOR, msg) - - return default - except KeyboardInterrupt: - sys.stdout.write('\n') - sys.exit(2) - -def choice(msg, choices, default=0): - if default >= len(choices): - return None - _general_print('\rQ', ASK_COLOR, '') - try: - msg += " [%s] " % '/'.join(choices) - if INTERACTIVE: - while True: - repl = raw_input(msg) - if repl in choices: - return repl - elif not repl.strip(): - return choices[default] - else: - msg += choices[default] - _general_print('', NO_COLOR, msg) - - return choices[default] - except KeyboardInterrupt: - sys.stdout.write('\n') - sys.exit(2) - -def pause(msg=None): - if INTERACTIVE: - _general_print('\rQ', ASK_COLOR, '') - if msg is None: - msg = 'press <ENTER> to continue ...' - raw_input(msg) - -def set_logfile(fpath): - global LOG_FILE_FP - - def _savelogf(): - if LOG_FILE_FP: - fp = open(LOG_FILE_FP, 'w') - fp.write(LOG_CONTENT) - fp.close() - - if LOG_FILE_FP is not None: - warning('duplicate log file configuration') - - LOG_FILE_FP = fpath - - import atexit - atexit.register(_savelogf) - -def enable_logstderr(fpath): - global CATCHERR_BUFFILE_FD - global CATCHERR_BUFFILE_PATH - global CATCHERR_SAVED_2 - - if os.path.exists(fpath): - os.remove(fpath) - CATCHERR_BUFFILE_PATH = fpath - CATCHERR_BUFFILE_FD = os.open(CATCHERR_BUFFILE_PATH, os.O_RDWR|os.O_CREAT) - CATCHERR_SAVED_2 = os.dup(2) - os.dup2(CATCHERR_BUFFILE_FD, 2) - -def disable_logstderr(): - global CATCHERR_BUFFILE_FD - global CATCHERR_BUFFILE_PATH - global CATCHERR_SAVED_2 - - raw(msg = None) # flush message buffer and print it. - os.dup2(CATCHERR_SAVED_2, 2) - os.close(CATCHERR_SAVED_2) - os.close(CATCHERR_BUFFILE_FD) - os.unlink(CATCHERR_BUFFILE_PATH) - CATCHERR_BUFFILE_FD = -1 - CATCHERR_BUFFILE_PATH = None - CATCHERR_SAVED_2 = -1 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/plugin.py b/scripts/lib/wic/plugin.py deleted file mode 100644 index 41a80175ca..0000000000 --- a/scripts/lib/wic/plugin.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/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 os, sys - -from wic import msger -from wic import pluginbase -from wic.utils import errors -from wic.utils.oe.misc import * - -__ALL__ = ['PluginMgr', 'pluginmgr'] - -PLUGIN_TYPES = ["imager", "source"] - -PLUGIN_DIR = "/lib/wic/plugins" # relative to scripts -SCRIPTS_PLUGIN_DIR = "scripts" + PLUGIN_DIR - -class PluginMgr(object): - plugin_dirs = {} - - # make the manager class as singleton - _instance = None - def __new__(cls, *args, **kwargs): - if not cls._instance: - cls._instance = super(PluginMgr, cls).__new__(cls, *args, **kwargs) - - return cls._instance - - def __init__(self): - wic_path = os.path.dirname(__file__) - eos = wic_path.find('scripts') + len('scripts') - scripts_path = wic_path[:eos] - self.scripts_path = scripts_path - self.plugin_dir = scripts_path + PLUGIN_DIR - self.layers_path = None - - def _build_plugin_dir_list(self, dl, ptype): - if self.layers_path is None: - self.layers_path = get_bitbake_var("BBLAYERS") - layer_dirs = [] - - if self.layers_path is not None: - for layer_path in self.layers_path.split(): - path = os.path.join(layer_path, SCRIPTS_PLUGIN_DIR, ptype) - layer_dirs.append(path) - - path = os.path.join(dl, ptype) - layer_dirs.append(path) - - return layer_dirs - - def append_dirs(self, dirs): - for path in dirs: - self._add_plugindir(path) - - # load all the plugins AGAIN - self._load_all() - - def _add_plugindir(self, path): - path = os.path.abspath(os.path.expanduser(path)) - - if not os.path.isdir(path): - msger.debug("Plugin dir is not a directory or does not exist: %s"\ - % path) - return - - if path not in self.plugin_dirs: - self.plugin_dirs[path] = False - # the value True/False means "loaded" - - def _load_all(self): - for (pdir, loaded) in self.plugin_dirs.iteritems(): - if loaded: continue - - sys.path.insert(0, pdir) - for mod in [x[:-3] for x in os.listdir(pdir) if x.endswith(".py")]: - if mod and mod != '__init__': - if mod in sys.modules: - #self.plugin_dirs[pdir] = True - msger.warning("Module %s already exists, skip" % mod) - else: - try: - pymod = __import__(mod) - self.plugin_dirs[pdir] = True - msger.debug("Plugin module %s:%s imported"\ - % (mod, pymod.__file__)) - except ImportError, err: - msg = 'Failed to load plugin %s/%s: %s' \ - % (os.path.basename(pdir), mod, err) - msger.warning(msg) - - del(sys.path[0]) - - def get_plugins(self, ptype): - """ the return value is dict of name:class pairs """ - - if ptype not in PLUGIN_TYPES: - raise errors.CreatorError('%s is not valid plugin type' % ptype) - - plugins_dir = self._build_plugin_dir_list(self.plugin_dir, ptype) - - self.append_dirs(plugins_dir) - - return pluginbase.get_plugins(ptype) - - def get_source_plugins(self): - """ - Return list of available source plugins. - """ - plugins_dir = self._build_plugin_dir_list(self.plugin_dir, 'source') - - self.append_dirs(plugins_dir) - - plugins = [] - - for _source_name, klass in self.get_plugins('source').iteritems(): - plugins.append(_source_name) - - return plugins - - - def get_source_plugin_methods(self, source_name, methods): - """ - The methods param is a dict with the method names to find. On - return, the dict values will be filled in with pointers to the - corresponding methods. If one or more methods are not found, - None is returned. - """ - return_methods = None - for _source_name, klass in self.get_plugins('source').iteritems(): - if _source_name == source_name: - for _method_name in methods.keys(): - if not hasattr(klass, _method_name): - msger.warning("Unimplemented %s source interface for: %s"\ - % (_method_name, _source_name)) - return None - func = getattr(klass, _method_name) - methods[_method_name] = func - return_methods = methods - return return_methods - -pluginmgr = PluginMgr() diff --git a/scripts/lib/wic/pluginbase.py b/scripts/lib/wic/pluginbase.py index e3de9bacb8..fb3d179c2d 100644 --- a/scripts/lib/wic/pluginbase.py +++ b/scripts/lib/wic/pluginbase.py @@ -15,37 +15,74 @@ # 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 shutil -from wic import msger -from wic.utils import errors +import logging + +from collections import defaultdict +from importlib.machinery import SourceFileLoader -class _Plugin(object): - class __metaclass__(type): - def __init__(cls, name, bases, attrs): - if not hasattr(cls, 'plugins'): - cls.plugins = {} +from wic import WicError +from wic.utils.misc import get_bitbake_var - elif 'wic_plugin_type' in attrs: - if attrs['wic_plugin_type'] not in cls.plugins: - cls.plugins[attrs['wic_plugin_type']] = {} +PLUGIN_TYPES = ["imager", "source"] - elif hasattr(cls, 'wic_plugin_type') and 'name' in attrs: - cls.plugins[cls.wic_plugin_type][attrs['name']] = cls +SCRIPTS_PLUGIN_DIR = "scripts/lib/wic/plugins" - def show_plugins(cls): - for cls in cls.plugins[cls.wic_plugin_type]: - print cls +logger = logging.getLogger('wic') - def get_plugins(cls): - return cls.plugins +PLUGINS = defaultdict(dict) +class PluginMgr: + _plugin_dirs = [] -class ImagerPlugin(_Plugin): + @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(_Plugin): +class SourcePlugin(metaclass=PluginMeta): wic_plugin_type = "source" """ The methods that can be implemented by --source plugins. @@ -54,17 +91,17 @@ class SourcePlugin(_Plugin): """ @classmethod - def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir, + 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. """ - msger.debug("SourcePlugin: do_install_disk: disk: %s" % disk_name) + logger.debug("SourcePlugin: do_install_disk: disk: %s", disk_name) @classmethod - def do_stage_partition(self, part, source_params, cr, cr_workdir, + def do_stage_partition(cls, part, source_params, creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot): """ @@ -78,10 +115,10 @@ class SourcePlugin(_Plugin): Not that get_bitbake_var() allows you to acces non-standard variables that you might want to use for this. """ - msger.debug("SourcePlugin: do_stage_partition: part: %s" % part) + logger.debug("SourcePlugin: do_stage_partition: part: %s", part) @classmethod - def do_configure_partition(self, part, source_params, cr, cr_workdir, + def do_configure_partition(cls, part, source_params, creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot): """ @@ -89,23 +126,15 @@ class SourcePlugin(_Plugin): custom configuration files for a partition, for example syslinux or grub config files. """ - msger.debug("SourcePlugin: do_configure_partition: part: %s" % part) + logger.debug("SourcePlugin: do_configure_partition: part: %s", part) @classmethod - def do_prepare_partition(self, part, source_params, cr, cr_workdir, + 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. """ - msger.debug("SourcePlugin: do_prepare_partition: part: %s" % part) - -def get_plugins(typen): - ps = ImagerPlugin.get_plugins() - if typen in ps: - return ps[typen] - else: - return None + logger.debug("SourcePlugin: do_prepare_partition: part: %s", part) -__all__ = ['ImagerPlugin', 'SourcePlugin', 'get_plugins'] 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/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py deleted file mode 100644 index 5601c3f1c9..0000000000 --- a/scripts/lib/wic/plugins/imager/direct_plugin.py +++ /dev/null @@ -1,98 +0,0 @@ -# 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 os -import shutil -import re -import tempfile - -from wic import msger -from wic.utils import misc, fs_related, errors, runner, cmdln -from wic.conf import configmgr -from wic.plugin import pluginmgr - -import wic.imager.direct as direct -from wic.pluginbase import ImagerPlugin - -class DirectPlugin(ImagerPlugin): - name = 'direct' - - @classmethod - def __rootfs_dir_to_dict(self, rootfs_dirs): - """ - Gets a string that contain 'connection=dir' splitted by - space and return a dict - """ - krootfs_dir = {} - for rootfs_dir in rootfs_dirs.split(' '): - k, v = rootfs_dir.split('=') - krootfs_dir[k] = v - - return krootfs_dir - - @classmethod - def do_create(self, subcmd, opts, *args): - """ - Create direct image, called from creator as 'direct' cmd - """ - if len(args) != 7: - raise errors.Usage("Extra arguments given") - - native_sysroot = args[0] - kernel_dir = args[1] - bootimg_dir = args[2] - rootfs_dir = args[3] - - creatoropts = configmgr.create - ksconf = args[4] - - image_output_dir = args[5] - oe_builddir = args[6] - - krootfs_dir = self.__rootfs_dir_to_dict(rootfs_dir) - - configmgr._ksconf = ksconf - - creator = direct.DirectImageCreator(oe_builddir, - image_output_dir, - krootfs_dir, - bootimg_dir, - kernel_dir, - native_sysroot, - creatoropts) - - try: - creator.create() - creator.assemble() - creator.finalize() - creator.print_outimage_info() - - except errors.CreatorError: - raise - finally: - creator.cleanup() - - return 0 diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index ee57881e90..9879cb9fce 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -24,69 +24,70 @@ # Tom Zanussi <tom.zanussi (at] linux.intel.com> # +import logging import os import shutil -import re -import tempfile - -from wic import kickstart, msger -from wic.utils import misc, fs_related, errors, runner, cmdln -from wic.conf import configmgr -from wic.plugin import pluginmgr -import wic.imager.direct as direct + +from wic import WicError +from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * -from wic.imager.direct import DirectImageCreator +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(self, hdddir, cr, cr_workdir): + def do_configure_grubefi(cls, creator, cr_workdir): """ Create loader-specific (grub-efi) config """ - splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") - if os.path.exists(splash): - splashline = "menu background splash.jpg" - else: - splashline = "" - - (rootdev, root_part_uuid) = cr._get_boot_config() - options = cr.ks.handler.bootloader.appendLine + 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) - grubefi_conf = "" - grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" - grubefi_conf += "default=boot\n" - timeout = kickstart.get_timeout(cr.ks) - if not timeout: - timeout = 0 - grubefi_conf += "timeout=%s\n" % timeout - grubefi_conf += "menuentry 'boot'{\n" + if not custom_cfg: + # Create grub configuration using parameters from wks file + bootloader = creator.ks.bootloader - kernel = "/bzImage" + 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" - if cr._ptable_format == 'msdos': - rootstr = rootdev - else: - raise ImageError("Unsupported partition table format found") + kernel = "/bzImage" - grubefi_conf += "linux %s root=%s rootwait %s\n" \ - % (kernel, rootstr, options) - grubefi_conf += "}\n" - if splashline: - syslinux_conf += "%s\n" % splashline + grubefi_conf += "linux %s root=%s rootwait %s\n" \ + % (kernel, creator.rootdev, bootloader.append) + grubefi_conf += "}\n" - msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" \ - % cr_workdir) + 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_gummiboot(self, hdddir, cr, cr_workdir): + def do_configure_systemdboot(cls, hdddir, creator, cr_workdir, source_params): """ - Create loader-specific (gummiboot) config + Create loader-specific systemd-boot/gummiboot config """ install_cmd = "install -d %s/loader" % hdddir exec_cmd(install_cmd) @@ -94,70 +95,89 @@ class BootimgEFIPlugin(SourcePlugin): install_cmd = "install -d %s/loader/entries" % hdddir exec_cmd(install_cmd) - (rootdev, root_part_uuid) = cr._get_boot_config() - options = cr.ks.handler.bootloader.appendLine - - timeout = kickstart.get_timeout(cr.ks) - if not timeout: - timeout = 0 + bootloader = creator.ks.bootloader loader_conf = "" loader_conf += "default boot\n" - loader_conf += "timeout %d\n" % timeout + 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") - msger.debug("Writing gummiboot config %s/hdd/boot/loader/loader.conf" \ - % cr_workdir) + 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() - kernel = "/bzImage" + 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 cr._ptable_format == 'msdos': - rootstr = rootdev - else: - raise ImageError("Unsupported partition table format found") + 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" \ - % (rootstr, options) + 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) - msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \ - % cr_workdir) + 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(self, part, source_params, cr, cr_workdir, + 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 - rm_cmd = "rm -rf %s" % cr_workdir - exec_cmd(rm_cmd) install_cmd = "install -d %s/EFI/BOOT" % hdddir exec_cmd(install_cmd) try: if source_params['loader'] == 'grub-efi': - self.do_configure_grubefi(hdddir, cr, cr_workdir) - elif source_params['loader'] == 'gummiboot': - self.do_configure_gummiboot(hdddir, cr, cr_workdir) + cls.do_configure_grubefi(creator, cr_workdir) + elif source_params['loader'] == 'systemd-boot': + cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) else: - msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader']) + raise WicError("unrecognized bootimg-efi loader: %s" % source_params['loader']) except KeyError: - msger.error("bootimg-efi requires a loader, none specified") + raise WicError("bootimg-efi requires a loader, none specified") @classmethod - def do_prepare_partition(self, part, source_params, cr, cr_workdir, + def do_prepare_partition(cls, part, source_params, creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, rootfs_dir, native_sysroot): """ @@ -165,12 +185,10 @@ class BootimgEFIPlugin(SourcePlugin): 'prepares' the partition to be incorporated into the image. In this case, prepare content for an EFI (grub) boot partition. """ - if not bootimg_dir: - bootimg_dir = get_bitbake_var("HDDDIR") - if not bootimg_dir: - msger.error("Couldn't find HDDDIR, exiting\n") - # just so the result notes display it - cr.set_bootimg_dir(bootimg_dir) + 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 @@ -180,21 +198,30 @@ class BootimgEFIPlugin(SourcePlugin): (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) - cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (bootimg_dir, hdddir) - exec_cmd(cp_cmd, True) + 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'] == 'gummiboot': - cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (bootimg_dir, hdddir) - exec_cmd(cp_cmd, True) + 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: - msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader']) + raise WicError("unrecognized bootimg-efi loader: %s" % + source_params['loader']) except KeyError: - msger.error("bootimg-efi requires a loader, none specified") + 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) @@ -207,14 +234,8 @@ class BootimgEFIPlugin(SourcePlugin): blocks += extra_blocks - msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ - (extra_blocks, part.mountpoint, blocks)) - - # Ensure total sectors is an integral number of sectors per - # track or mcopy will complain. Sectors are 512 bytes, and we - # generate images with 32 sectors per track. This calculation is - # done in blocks, thus the mod by 16 instead of 32. - blocks += (16 - (blocks % 16)) + 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 @@ -232,5 +253,5 @@ class BootimgEFIPlugin(SourcePlugin): out = exec_cmd(du_cmd) bootimg_size = out.split()[0] - part.set_size(bootimg_size) - part.set_source_file(bootimg) + 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 index c5eb7b8b80..13fddbd478 100644 --- a/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -23,39 +23,28 @@ # Maciej Borzecki <maciej.borzecki (at] open-rnd.pl> # +import logging import os import re -from wic import msger -from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * from glob import glob -class BootimgPartitionPlugin(SourcePlugin): - name = 'bootimg-partition' +from wic import WicError +from wic.pluginbase import SourcePlugin +from wic.utils.misc import exec_cmd, get_bitbake_var - @classmethod - def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir, - bootimg_dir, kernel_dir, native_sysroot): - """ - Called after all partitions have been prepared and assembled into a - disk image. Do nothing. - """ - pass +logger = logging.getLogger('wic') - @classmethod - def do_configure_partition(self, part, source_params, cr, cr_workdir, - oe_builddir, bootimg_dir, kernel_dir, - native_sysroot): - """ - Called before do_prepare_partition(). Possibly prepare - configuration files of some sort. +class BootimgPartitionPlugin(SourcePlugin): + """ + Create an image of boot partition, copying over files + listed in IMAGE_BOOT_FILES bitbake variable. + """ - """ - pass + name = 'bootimg-partition' @classmethod - def do_prepare_partition(self, part, source_params, cr, cr_workdir, + def do_prepare_partition(cls, part, source_params, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, rootfs_dir, native_sysroot): """ @@ -66,25 +55,22 @@ class BootimgPartitionPlugin(SourcePlugin): - copies all files listed in IMAGE_BOOT_FILES variable """ hdddir = "%s/boot" % cr_workdir - rm_cmd = "rm -rf %s/boot" % cr_workdir - exec_cmd(rm_cmd) - install_cmd = "install -d %s" % hdddir exec_cmd(install_cmd) - if not bootimg_dir: - bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") - if not bootimg_dir: - msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") + 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") - msger.debug('Bootimg dir: %s' % bootimg_dir) + logger.debug('Kernel dir: %s', bootimg_dir) boot_files = get_bitbake_var("IMAGE_BOOT_FILES") if not boot_files: - msger.error('No boot files defined, IMAGE_BOOT_FILES unset') + raise WicError('No boot files defined, IMAGE_BOOT_FILES unset') - msger.debug('Boot files: %s' % boot_files) + logger.debug('Boot files: %s', boot_files) # list of tuples (src_name, dst_name) deploy_files = [] @@ -92,11 +78,11 @@ class BootimgPartitionPlugin(SourcePlugin): if ';' in src_entry: dst_entry = tuple(src_entry.split(';')) if not dst_entry[0] or not dst_entry[1]: - msger.error('Malformed boot file entry: %s' % (src_entry)) + raise WicError('Malformed boot file entry: %s' % src_entry) else: dst_entry = (src_entry, src_entry) - msger.debug('Destination entry: %r' % (dst_entry,)) + logger.debug('Destination entry: %r', dst_entry) deploy_files.append(dst_entry) for deploy_entry in deploy_files: @@ -112,27 +98,26 @@ class BootimgPartitionPlugin(SourcePlugin): os.path.join(dst, os.path.basename(name)) - srcs = glob(os.path.join(bootimg_dir, src)) + srcs = glob(os.path.join(kernel_dir, src)) - msger.debug('Globbed sources: %s' % (', '.join(srcs))) + 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(bootimg_dir, src), + install_task = [(os.path.join(kernel_dir, src), os.path.join(hdddir, dst))] for task in install_task: src_path, dst_path = task - msger.debug('Install %s as %s' % (os.path.basename(src_path), - dst_path)) + 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) - msger.debug('Prepare boot partition using rootfs in %s' % (hdddir)) + 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 index c4786a6e0e..5890c1267b 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -24,102 +24,126 @@ # Tom Zanussi <tom.zanussi (at] linux.intel.com> # +import logging import os -import shutil -import re -import tempfile - -from wic import kickstart, msger -from wic.utils import misc, fs_related, errors, runner, cmdln -from wic.conf import configmgr -from wic.plugin import pluginmgr -import wic.imager.direct as direct + +from wic import WicError +from wic.engine import get_custom_config +from wic.utils import runner from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * -from wic.imager.direct import DirectImageCreator +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 do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir, + 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 cr._ptable_format == 'msdos': + 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): - msger.error("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) + 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 = cr._full_path(workdir, disk_name, "direct") - msger.debug("Installing MBR on disk %s as %s with size %s bytes" \ - % (disk_name, full_path, disk['min_size'])) + 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) - rc = runner.show(['dd', 'if=%s' % mbrfile, - 'of=%s' % full_path, 'conv=notrunc']) - if rc != 0: - raise ImageError("Unable to set MBR to %s" % full_path) + dd_cmd = "dd if=%s of=%s conv=notrunc" % (mbrfile, full_path) + exec_cmd(dd_cmd, native_sysroot) @classmethod - def do_configure_partition(self, part, source_params, cr, cr_workdir, + 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 - rm_cmd = "rm -rf " + cr_workdir - exec_cmd(rm_cmd) install_cmd = "install -d %s" % hdddir exec_cmd(install_cmd) - splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg") - if os.path.exists(splash): - splashline = "menu background splash.jpg" - else: - splashline = "" - - (rootdev, root_part_uuid) = cr._get_boot_config() - options = cr.ks.handler.bootloader.appendLine - - syslinux_conf = "" - syslinux_conf += "PROMPT 0\n" - timeout = kickstart.get_timeout(cr.ks) - if not timeout: - timeout = 0 - syslinux_conf += "TIMEOUT " + str(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" - - if cr._ptable_format == 'msdos': - rootstr = rootdev - else: - raise ImageError("Unsupported partition table format found") - - syslinux_conf += "APPEND label=boot root=%s %s\n" % (rootstr, options) - - msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \ - % cr_workdir) + 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(self, part, source_params, cr, cr_workdir, + def do_prepare_partition(cls, part, source_params, creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, rootfs_dir, native_sysroot): """ @@ -127,33 +151,25 @@ class BootimgPcbiosPlugin(SourcePlugin): 'prepares' the partition to be incorporated into the image. In this case, prepare content for legacy bios boot partition. """ - def _has_syslinux(dir): - if dir: - syslinux = "%s/syslinux" % dir - if os.path.exists(syslinux): - return True - return False - - if not _has_syslinux(bootimg_dir): - bootimg_dir = get_bitbake_var("STAGING_DATADIR") - if not bootimg_dir: - msger.error("Couldn't find STAGING_DATADIR, exiting\n") - if not _has_syslinux(bootimg_dir): - msger.error("Please build syslinux first\n") - # just so the result notes display it - cr.set_bootimg_dir(bootimg_dir) + bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux') staging_kernel_dir = kernel_dir hdddir = "%s/hdd/boot" % cr_workdir - install_cmd = "install -m 0644 %s/bzImage %s/vmlinuz" \ - % (staging_kernel_dir, hdddir) - exec_cmd(install_cmd) + 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)) - install_cmd = "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" \ - % (bootimg_dir, hdddir) - exec_cmd(install_cmd) + for install_cmd in cmds: + exec_cmd(install_cmd) du_cmd = "du -bks %s" % hdddir out = exec_cmd(du_cmd) @@ -166,14 +182,8 @@ class BootimgPcbiosPlugin(SourcePlugin): blocks += extra_blocks - msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ - (extra_blocks, part.mountpoint, blocks)) - - # Ensure total sectors is an integral number of sectors per - # track or mcopy will complain. Sectors are 512 bytes, and we - # generate images with 32 sectors per track. This calculation is - # done in blocks, thus the mod by 16 instead of 32. - blocks += (16 - (blocks % 16)) + 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 @@ -194,7 +204,5 @@ class BootimgPcbiosPlugin(SourcePlugin): out = exec_cmd(du_cmd) bootimg_size = out.split()[0] - part.set_size(bootimg_size) - part.set_source_file(bootimg) - - + part.size = int(bootimg_size) + part.source_file = bootimg diff --git a/scripts/lib/wic/plugins/source/fsimage.py b/scripts/lib/wic/plugins/source/fsimage.py deleted file mode 100644 index 0967883afa..0000000000 --- a/scripts/lib/wic/plugins/source/fsimage.py +++ /dev/null @@ -1,70 +0,0 @@ -# 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 os -import re - -from wic import msger -from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * - -class FSImagePlugin(SourcePlugin): - name = 'fsimage' - - @classmethod - def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir, - bootimg_dir, kernel_dir, native_sysroot): - """ - Called after all partitions have been prepared and assembled into a - disk image. Do nothing. - """ - pass - - @classmethod - def do_configure_partition(self, part, source_params, cr, cr_workdir, - oe_builddir, bootimg_dir, kernel_dir, - native_sysroot): - """ - Called before do_prepare_partition(). Possibly prepare - configuration files of some sort. - """ - pass - - @classmethod - def do_prepare_partition(self, 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 bootimg_dir: - bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") - if not bootimg_dir: - msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") - - msger.debug('Bootimg dir: %s' % bootimg_dir) - - if ('file' not in source_params): - msger.error("No file specified\n") - return - - src = os.path.join(bootimg_dir, source_params['file']) - - - msger.debug('Preparing partition using image %s' % (src)) - part.prepare_rootfs_from_fs_image(cr_workdir, src, "") 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 index cf6236a04f..e1c4f5e7db 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py @@ -15,70 +15,55 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # +import logging import os -import re -from wic import msger +from wic import WicError from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * +from wic.utils.misc import exec_cmd, get_bitbake_var +from wic.filemap import sparse_copy -class RawCopyPlugin(SourcePlugin): - name = 'rawcopy' +logger = logging.getLogger('wic') - @classmethod - def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir, - bootimg_dir, kernel_dir, native_sysroot): - """ - Called after all partitions have been prepared and assembled into a - disk image. Do nothing. - """ - pass +class RawCopyPlugin(SourcePlugin): + """ + Populate partition content from raw image file. + """ - @classmethod - def do_configure_partition(self, part, source_params, cr, cr_workdir, - oe_builddir, bootimg_dir, kernel_dir, - native_sysroot): - """ - Called before do_prepare_partition(). Possibly prepare - configuration files of some sort. - """ - pass + name = 'rawcopy' @classmethod - def do_prepare_partition(self, part, source_params, cr, cr_workdir, + 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 bootimg_dir: - bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") - if not bootimg_dir: - msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") + 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") - msger.debug('Bootimg dir: %s' % bootimg_dir) + logger.debug('Kernel dir: %s', kernel_dir) - if ('file' not in source_params): - msger.error("No file specified\n") - return + if 'file' not in source_params: + raise WicError("No file specified") - src = os.path.join(bootimg_dir, source_params['file']) - dst = src + 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): - dst = os.path.join(cr_workdir, source_params['file']) - dd_cmd = "dd if=%s of=%s ibs=%s skip=1 conv=notrunc" % \ - (src, dst, source_params['skip']) - exec_cmd(dd_cmd) + 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 = out.split()[0] + 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 index a432a18705..f2e2ca8a2b 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py @@ -25,21 +25,23 @@ # Joao Henrique Ferreira de Freitas <joaohf (at] gmail.com> # +import logging import os import shutil -import re -import tempfile - -from wic import kickstart, msger -from wic.utils import misc, fs_related, errors, runner, cmdln -from wic.conf import configmgr -from wic.plugin import pluginmgr -import wic.imager.direct as direct + +from oe.path import copyhardlinktree + +from wic import WicError from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * -from wic.imager.direct import DirectImageCreator +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 @@ -47,22 +49,16 @@ class RootfsPlugin(SourcePlugin): if os.path.isdir(rootfs_dir): return rootfs_dir - bitbake_env_lines = find_bitbake_env_lines(rootfs_dir) - if not bitbake_env_lines: - msg = "Couldn't get bitbake environment, exiting." - msger.error(msg) - - image_rootfs_dir = find_artifact(bitbake_env_lines, "IMAGE_ROOTFS") + image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) if not os.path.isdir(image_rootfs_dir): - msg = "No valid artifact IMAGE_ROOTFS from image named" - msg += " %s has been found at %s, exiting.\n" % \ - (rootfs_dir, image_rootfs_dir) - msger.error(msg) + 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(self, part, source_params, cr, cr_workdir, + def do_prepare_partition(cls, part, source_params, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, krootfs_dir, native_sysroot): """ @@ -70,23 +66,60 @@ class RootfsPlugin(SourcePlugin): 'prepares' the partition to be incorporated into the image. In this case, prepare content for legacy bios boot partition. """ - if part.rootfs is None: + if part.rootfs_dir is None: if not 'ROOTFS_DIR' in krootfs_dir: - msg = "Couldn't find --rootfs-dir, exiting" - msger.error(msg) + raise WicError("Couldn't find --rootfs-dir, exiting") + rootfs_dir = krootfs_dir['ROOTFS_DIR'] else: - if part.rootfs in krootfs_dir: - rootfs_dir = krootfs_dir[part.rootfs] - elif part.rootfs: - rootfs_dir = part.rootfs + if part.rootfs_dir in krootfs_dir: + rootfs_dir = krootfs_dir[part.rootfs_dir] + elif part.rootfs_dir: + rootfs_dir = part.rootfs_dir else: - msg = "Couldn't find --rootfs-dir=%s connection" - msg += " or it is not a valid path, exiting" - msger.error(msg % part.rootfs) + 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)) - real_rootfs_dir = self.__get_rootfs_dir(rootfs_dir) + # 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) - part.set_rootfs(real_rootfs_dir) - part.prepare_rootfs(cr_workdir, oe_builddir, real_rootfs_dir, native_sysroot) + 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/test b/scripts/lib/wic/test deleted file mode 100644 index 9daeafb986..0000000000 --- a/scripts/lib/wic/test +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/scripts/lib/wic/utils/cmdln.py b/scripts/lib/wic/utils/cmdln.py deleted file mode 100644 index b099473ee4..0000000000 --- a/scripts/lib/wic/utils/cmdln.py +++ /dev/null @@ -1,1586 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2002-2007 ActiveState Software Inc. -# License: MIT (see LICENSE.txt for license details) -# Author: Trent Mick -# Home: http://trentm.com/projects/cmdln/ - -"""An improvement on Python's standard cmd.py module. - -As with cmd.py, this module provides "a simple framework for writing -line-oriented command intepreters." This module provides a 'RawCmdln' -class that fixes some design flaws in cmd.Cmd, making it more scalable -and nicer to use for good 'cvs'- or 'svn'-style command line interfaces -or simple shells. And it provides a 'Cmdln' class that add -optparse-based option processing. Basically you use it like this: - - import cmdln - - class MySVN(cmdln.Cmdln): - name = "svn" - - @cmdln.alias('stat', 'st') - @cmdln.option('-v', '--verbose', action='store_true' - help='print verbose information') - def do_status(self, subcmd, opts, *paths): - print "handle 'svn status' command" - - #... - - if __name__ == "__main__": - shell = MySVN() - retval = shell.main() - sys.exit(retval) - -See the README.txt or <http://trentm.com/projects/cmdln/> for more -details. -""" - -__version_info__ = (1, 1, 2) -__version__ = '.'.join(map(str, __version_info__)) - -import os -import sys -import re -import cmd -import optparse -from pprint import pprint -import sys - - - - -#---- globals - -LOOP_ALWAYS, LOOP_NEVER, LOOP_IF_EMPTY = range(3) - -# An unspecified optional argument when None is a meaningful value. -_NOT_SPECIFIED = ("Not", "Specified") - -# Pattern to match a TypeError message from a call that -# failed because of incorrect number of arguments (see -# Python/getargs.c). -_INCORRECT_NUM_ARGS_RE = re.compile( - r"(takes [\w ]+ )(\d+)( arguments? \()(\d+)( given\))") - - - -#---- exceptions - -class CmdlnError(Exception): - """A cmdln.py usage error.""" - def __init__(self, msg): - self.msg = msg - def __str__(self): - return self.msg - -class CmdlnUserError(Exception): - """An error by a user of a cmdln-based tool/shell.""" - pass - - - -#---- public methods and classes - -def alias(*aliases): - """Decorator to add aliases for Cmdln.do_* command handlers. - - Example: - class MyShell(cmdln.Cmdln): - @cmdln.alias("!", "sh") - def do_shell(self, argv): - #...implement 'shell' command - """ - def decorate(f): - if not hasattr(f, "aliases"): - f.aliases = [] - f.aliases += aliases - return f - return decorate - - -class RawCmdln(cmd.Cmd): - """An improved (on cmd.Cmd) framework for building multi-subcommand - scripts (think "svn" & "cvs") and simple shells (think "pdb" and - "gdb"). - - A simple example: - - import cmdln - - class MySVN(cmdln.RawCmdln): - name = "svn" - - @cmdln.aliases('stat', 'st') - def do_status(self, argv): - print "handle 'svn status' command" - - if __name__ == "__main__": - shell = MySVN() - retval = shell.main() - sys.exit(retval) - - See <http://trentm.com/projects/cmdln> for more information. - """ - name = None # if unset, defaults basename(sys.argv[0]) - prompt = None # if unset, defaults to self.name+"> " - version = None # if set, default top-level options include --version - - # Default messages for some 'help' command error cases. - # They are interpolated with one arg: the command. - nohelp = "no help on '%s'" - unknowncmd = "unknown command: '%s'" - - helpindent = '' # string with which to indent help output - - def __init__(self, completekey='tab', - stdin=None, stdout=None, stderr=None): - """Cmdln(completekey='tab', stdin=None, stdout=None, stderr=None) - - The optional argument 'completekey' is the readline name of a - completion key; it defaults to the Tab key. If completekey is - not None and the readline module is available, command completion - is done automatically. - - The optional arguments 'stdin', 'stdout' and 'stderr' specify - alternate input, output and error output file objects; if not - specified, sys.* are used. - - If 'stdout' but not 'stderr' is specified, stdout is used for - error output. This is to provide least surprise for users used - to only the 'stdin' and 'stdout' options with cmd.Cmd. - """ - import sys - if self.name is None: - self.name = os.path.basename(sys.argv[0]) - if self.prompt is None: - self.prompt = self.name+"> " - self._name_str = self._str(self.name) - self._prompt_str = self._str(self.prompt) - if stdin is not None: - self.stdin = stdin - else: - self.stdin = sys.stdin - if stdout is not None: - self.stdout = stdout - else: - self.stdout = sys.stdout - if stderr is not None: - self.stderr = stderr - elif stdout is not None: - self.stderr = stdout - else: - self.stderr = sys.stderr - self.cmdqueue = [] - self.completekey = completekey - self.cmdlooping = False - - def get_optparser(self): - """Hook for subclasses to set the option parser for the - top-level command/shell. - - This option parser is used retrieved and used by `.main()' to - handle top-level options. - - The default implements a single '-h|--help' option. Sub-classes - can return None to have no options at the top-level. Typically - an instance of CmdlnOptionParser should be returned. - """ - version = (self.version is not None - and "%s %s" % (self._name_str, self.version) - or None) - return CmdlnOptionParser(self, version=version) - - def postoptparse(self): - """Hook method executed just after `.main()' parses top-level - options. - - When called `self.options' holds the results of the option parse. - """ - pass - - def main(self, argv=None, loop=LOOP_NEVER): - """A possible mainline handler for a script, like so: - - import cmdln - class MyCmd(cmdln.Cmdln): - name = "mycmd" - ... - - if __name__ == "__main__": - MyCmd().main() - - By default this will use sys.argv to issue a single command to - 'MyCmd', then exit. The 'loop' argument can be use to control - interactive shell behaviour. - - Arguments: - "argv" (optional, default sys.argv) is the command to run. - It must be a sequence, where the first element is the - command name and subsequent elements the args for that - command. - "loop" (optional, default LOOP_NEVER) is a constant - indicating if a command loop should be started (i.e. an - interactive shell). Valid values (constants on this module): - LOOP_ALWAYS start loop and run "argv", if any - LOOP_NEVER run "argv" (or .emptyline()) and exit - LOOP_IF_EMPTY run "argv", if given, and exit; - otherwise, start loop - """ - if argv is None: - import sys - argv = sys.argv - else: - argv = argv[:] # don't modify caller's list - - self.optparser = self.get_optparser() - if self.optparser: # i.e. optparser=None means don't process for opts - try: - self.options, args = self.optparser.parse_args(argv[1:]) - except CmdlnUserError, ex: - msg = "%s: %s\nTry '%s help' for info.\n"\ - % (self.name, ex, self.name) - self.stderr.write(self._str(msg)) - self.stderr.flush() - return 1 - except StopOptionProcessing, ex: - return 0 - else: - self.options, args = None, argv[1:] - self.postoptparse() - - if loop == LOOP_ALWAYS: - if args: - self.cmdqueue.append(args) - return self.cmdloop() - elif loop == LOOP_NEVER: - if args: - return self.cmd(args) - else: - return self.emptyline() - elif loop == LOOP_IF_EMPTY: - if args: - return self.cmd(args) - else: - return self.cmdloop() - - def cmd(self, argv): - """Run one command and exit. - - "argv" is the arglist for the command to run. argv[0] is the - command to run. If argv is an empty list then the - 'emptyline' handler is run. - - Returns the return value from the command handler. - """ - assert isinstance(argv, (list, tuple)), \ - "'argv' is not a sequence: %r" % argv - retval = None - try: - argv = self.precmd(argv) - retval = self.onecmd(argv) - self.postcmd(argv) - except: - if not self.cmdexc(argv): - raise - retval = 1 - return retval - - def _str(self, s): - """Safely convert the given str/unicode to a string for printing.""" - try: - return str(s) - except UnicodeError: - #XXX What is the proper encoding to use here? 'utf-8' seems - # to work better than "getdefaultencoding" (usually - # 'ascii'), on OS X at least. - #import sys - #return s.encode(sys.getdefaultencoding(), "replace") - return s.encode("utf-8", "replace") - - def cmdloop(self, intro=None): - """Repeatedly issue a prompt, accept input, parse into an argv, and - dispatch (via .precmd(), .onecmd() and .postcmd()), passing them - the argv. In other words, start a shell. - - "intro" (optional) is a introductory message to print when - starting the command loop. This overrides the class - "intro" attribute, if any. - """ - self.cmdlooping = True - self.preloop() - if self.use_rawinput and self.completekey: - try: - import readline - self.old_completer = readline.get_completer() - readline.set_completer(self.complete) - readline.parse_and_bind(self.completekey+": complete") - except ImportError: - pass - try: - if intro is None: - intro = self.intro - if intro: - intro_str = self._str(intro) - self.stdout.write(intro_str+'\n') - self.stop = False - retval = None - while not self.stop: - if self.cmdqueue: - argv = self.cmdqueue.pop(0) - assert isinstance(argv, (list, tuple)), \ - "item on 'cmdqueue' is not a sequence: %r" % argv - else: - if self.use_rawinput: - try: - line = raw_input(self._prompt_str) - except EOFError: - line = 'EOF' - else: - self.stdout.write(self._prompt_str) - self.stdout.flush() - line = self.stdin.readline() - if not len(line): - line = 'EOF' - else: - line = line[:-1] # chop '\n' - argv = line2argv(line) - try: - argv = self.precmd(argv) - retval = self.onecmd(argv) - self.postcmd(argv) - except: - if not self.cmdexc(argv): - raise - retval = 1 - self.lastretval = retval - self.postloop() - finally: - if self.use_rawinput and self.completekey: - try: - import readline - readline.set_completer(self.old_completer) - except ImportError: - pass - self.cmdlooping = False - return retval - - def precmd(self, argv): - """Hook method executed just before the command argv is - interpreted, but after the input prompt is generated and issued. - - "argv" is the cmd to run. - - Returns an argv to run (i.e. this method can modify the command - to run). - """ - return argv - - def postcmd(self, argv): - """Hook method executed just after a command dispatch is finished. - - "argv" is the command that was run. - """ - pass - - def cmdexc(self, argv): - """Called if an exception is raised in any of precmd(), onecmd(), - or postcmd(). If True is returned, the exception is deemed to have - been dealt with. Otherwise, the exception is re-raised. - - The default implementation handles CmdlnUserError's, which - typically correspond to user error in calling commands (as - opposed to programmer error in the design of the script using - cmdln.py). - """ - import sys - type, exc, traceback = sys.exc_info() - if isinstance(exc, CmdlnUserError): - msg = "%s %s: %s\nTry '%s help %s' for info.\n"\ - % (self.name, argv[0], exc, self.name, argv[0]) - self.stderr.write(self._str(msg)) - self.stderr.flush() - return True - - def onecmd(self, argv): - if not argv: - return self.emptyline() - self.lastcmd = argv - cmdname = self._get_canonical_cmd_name(argv[0]) - if cmdname: - handler = self._get_cmd_handler(cmdname) - if handler: - return self._dispatch_cmd(handler, argv) - return self.default(argv) - - def _dispatch_cmd(self, handler, argv): - return handler(argv) - - def default(self, argv): - """Hook called to handle a command for which there is no handler. - - "argv" is the command and arguments to run. - - The default implementation writes and error message to stderr - and returns an error exit status. - - Returns a numeric command exit status. - """ - errmsg = self._str(self.unknowncmd % (argv[0],)) - if self.cmdlooping: - self.stderr.write(errmsg+"\n") - else: - self.stderr.write("%s: %s\nTry '%s help' for info.\n" - % (self._name_str, errmsg, self._name_str)) - self.stderr.flush() - return 1 - - def parseline(self, line): - # This is used by Cmd.complete (readline completer function) to - # massage the current line buffer before completion processing. - # We override to drop special '!' handling. - line = line.strip() - if not line: - return None, None, line - elif line[0] == '?': - line = 'help ' + line[1:] - i, n = 0, len(line) - while i < n and line[i] in self.identchars: i = i+1 - cmd, arg = line[:i], line[i:].strip() - return cmd, arg, line - - def helpdefault(self, cmd, known): - """Hook called to handle help on a command for which there is no - help handler. - - "cmd" is the command name on which help was requested. - "known" is a boolean indicating if this command is known - (i.e. if there is a handler for it). - - Returns a return code. - """ - if known: - msg = self._str(self.nohelp % (cmd,)) - if self.cmdlooping: - self.stderr.write(msg + '\n') - else: - self.stderr.write("%s: %s\n" % (self.name, msg)) - else: - msg = self.unknowncmd % (cmd,) - if self.cmdlooping: - self.stderr.write(msg + '\n') - else: - self.stderr.write("%s: %s\n" - "Try '%s help' for info.\n" - % (self.name, msg, self.name)) - self.stderr.flush() - return 1 - - def do_help(self, argv): - """${cmd_name}: give detailed help on a specific sub-command - - Usage: - ${name} help [COMMAND] - """ - if len(argv) > 1: # asking for help on a particular command - doc = None - cmdname = self._get_canonical_cmd_name(argv[1]) or argv[1] - if not cmdname: - return self.helpdefault(argv[1], False) - else: - helpfunc = getattr(self, "help_"+cmdname, None) - if helpfunc: - doc = helpfunc() - else: - handler = self._get_cmd_handler(cmdname) - if handler: - doc = handler.__doc__ - if doc is None: - return self.helpdefault(argv[1], handler != None) - else: # bare "help" command - doc = self.__class__.__doc__ # try class docstring - if doc is None: - # Try to provide some reasonable useful default help. - if self.cmdlooping: prefix = "" - else: prefix = self.name+' ' - doc = """Usage: - %sCOMMAND [ARGS...] - %shelp [COMMAND] - - ${option_list} - ${command_list} - ${help_list} - """ % (prefix, prefix) - cmdname = None - - if doc: # *do* have help content, massage and print that - doc = self._help_reindent(doc) - doc = self._help_preprocess(doc, cmdname) - doc = doc.rstrip() + '\n' # trim down trailing space - self.stdout.write(self._str(doc)) - self.stdout.flush() - do_help.aliases = ["?"] - - def _help_reindent(self, help, indent=None): - """Hook to re-indent help strings before writing to stdout. - - "help" is the help content to re-indent - "indent" is a string with which to indent each line of the - help content after normalizing. If unspecified or None - then the default is use: the 'self.helpindent' class - attribute. By default this is the empty string, i.e. - no indentation. - - By default, all common leading whitespace is removed and then - the lot is indented by 'self.helpindent'. When calculating the - common leading whitespace the first line is ignored -- hence - help content for Conan can be written as follows and have the - expected indentation: - - def do_crush(self, ...): - '''${cmd_name}: crush your enemies, see them driven before you... - - c.f. Conan the Barbarian''' - """ - if indent is None: - indent = self.helpindent - lines = help.splitlines(0) - _dedentlines(lines, skip_first_line=True) - lines = [(indent+line).rstrip() for line in lines] - return '\n'.join(lines) - - def _help_preprocess(self, help, cmdname): - """Hook to preprocess a help string before writing to stdout. - - "help" is the help string to process. - "cmdname" is the canonical sub-command name for which help - is being given, or None if the help is not specific to a - command. - - By default the following template variables are interpolated in - help content. (Note: these are similar to Python 2.4's - string.Template interpolation but not quite.) - - ${name} - The tool's/shell's name, i.e. 'self.name'. - ${option_list} - A formatted table of options for this shell/tool. - ${command_list} - A formatted table of available sub-commands. - ${help_list} - A formatted table of additional help topics (i.e. 'help_*' - methods with no matching 'do_*' method). - ${cmd_name} - The name (and aliases) for this sub-command formatted as: - "NAME (ALIAS1, ALIAS2, ...)". - ${cmd_usage} - A formatted usage block inferred from the command function - signature. - ${cmd_option_list} - A formatted table of options for this sub-command. (This is - only available for commands using the optparse integration, - i.e. using @cmdln.option decorators or manually setting the - 'optparser' attribute on the 'do_*' method.) - - Returns the processed help. - """ - preprocessors = { - "${name}": self._help_preprocess_name, - "${option_list}": self._help_preprocess_option_list, - "${command_list}": self._help_preprocess_command_list, - "${help_list}": self._help_preprocess_help_list, - "${cmd_name}": self._help_preprocess_cmd_name, - "${cmd_usage}": self._help_preprocess_cmd_usage, - "${cmd_option_list}": self._help_preprocess_cmd_option_list, - } - - for marker, preprocessor in preprocessors.items(): - if marker in help: - help = preprocessor(help, cmdname) - return help - - def _help_preprocess_name(self, help, cmdname=None): - return help.replace("${name}", self.name) - - def _help_preprocess_option_list(self, help, cmdname=None): - marker = "${option_list}" - indent, indent_width = _get_indent(marker, help) - suffix = _get_trailing_whitespace(marker, help) - - if self.optparser: - # Setup formatting options and format. - # - Indentation of 4 is better than optparse default of 2. - # C.f. Damian Conway's discussion of this in Perl Best - # Practices. - self.optparser.formatter.indent_increment = 4 - self.optparser.formatter.current_indent = indent_width - block = self.optparser.format_option_help() + '\n' - else: - block = "" - - help = help.replace(indent+marker+suffix, block, 1) - return help - - - def _help_preprocess_command_list(self, help, cmdname=None): - marker = "${command_list}" - indent, indent_width = _get_indent(marker, help) - suffix = _get_trailing_whitespace(marker, help) - - # Find any aliases for commands. - token2canonical = self._get_canonical_map() - aliases = {} - for token, cmdname in token2canonical.items(): - if token == cmdname: continue - aliases.setdefault(cmdname, []).append(token) - - # Get the list of (non-hidden) commands and their - # documentation, if any. - cmdnames = {} # use a dict to strip duplicates - for attr in self.get_names(): - if attr.startswith("do_"): - cmdnames[attr[3:]] = True - cmdnames = cmdnames.keys() - cmdnames.sort() - linedata = [] - for cmdname in cmdnames: - if aliases.get(cmdname): - a = aliases[cmdname] - a.sort() - cmdstr = "%s (%s)" % (cmdname, ", ".join(a)) - else: - cmdstr = cmdname - doc = None - try: - helpfunc = getattr(self, 'help_'+cmdname) - except AttributeError: - handler = self._get_cmd_handler(cmdname) - if handler: - doc = handler.__doc__ - else: - doc = helpfunc() - - # Strip "${cmd_name}: " from the start of a command's doc. Best - # practice dictates that command help strings begin with this, but - # it isn't at all wanted for the command list. - to_strip = "${cmd_name}:" - if doc and doc.startswith(to_strip): - #log.debug("stripping %r from start of %s's help string", - # to_strip, cmdname) - doc = doc[len(to_strip):].lstrip() - linedata.append( (cmdstr, doc) ) - - if linedata: - subindent = indent + ' '*4 - lines = _format_linedata(linedata, subindent, indent_width+4) - block = indent + "Commands:\n" \ - + '\n'.join(lines) + "\n\n" - help = help.replace(indent+marker+suffix, block, 1) - return help - - def _gen_names_and_attrs(self): - # Inheritance says we have to look in class and - # base classes; order is not important. - names = [] - classes = [self.__class__] - while classes: - aclass = classes.pop(0) - if aclass.__bases__: - classes = classes + list(aclass.__bases__) - for name in dir(aclass): - yield (name, getattr(aclass, name)) - - def _help_preprocess_help_list(self, help, cmdname=None): - marker = "${help_list}" - indent, indent_width = _get_indent(marker, help) - suffix = _get_trailing_whitespace(marker, help) - - # Determine the additional help topics, if any. - helpnames = {} - token2cmdname = self._get_canonical_map() - for attrname, attr in self._gen_names_and_attrs(): - if not attrname.startswith("help_"): continue - helpname = attrname[5:] - if helpname not in token2cmdname: - helpnames[helpname] = attr - - if helpnames: - linedata = [(n, a.__doc__ or "") for n, a in helpnames.items()] - linedata.sort() - - subindent = indent + ' '*4 - lines = _format_linedata(linedata, subindent, indent_width+4) - block = (indent - + "Additional help topics (run `%s help TOPIC'):\n" % self.name - + '\n'.join(lines) - + "\n\n") - else: - block = '' - help = help.replace(indent+marker+suffix, block, 1) - return help - - def _help_preprocess_cmd_name(self, help, cmdname=None): - marker = "${cmd_name}" - handler = self._get_cmd_handler(cmdname) - if not handler: - raise CmdlnError("cannot preprocess '%s' into help string: " - "could not find command handler for %r" - % (marker, cmdname)) - s = cmdname - if hasattr(handler, "aliases"): - s += " (%s)" % (", ".join(handler.aliases)) - help = help.replace(marker, s) - return help - - #TODO: this only makes sense as part of the Cmdln class. - # Add hooks to add help preprocessing template vars and put - # this one on that class. - def _help_preprocess_cmd_usage(self, help, cmdname=None): - marker = "${cmd_usage}" - handler = self._get_cmd_handler(cmdname) - if not handler: - raise CmdlnError("cannot preprocess '%s' into help string: " - "could not find command handler for %r" - % (marker, cmdname)) - indent, indent_width = _get_indent(marker, help) - suffix = _get_trailing_whitespace(marker, help) - - # Extract the introspection bits we need. - func = handler.im_func - if func.func_defaults: - func_defaults = list(func.func_defaults) - else: - func_defaults = [] - co_argcount = func.func_code.co_argcount - co_varnames = func.func_code.co_varnames - co_flags = func.func_code.co_flags - CO_FLAGS_ARGS = 4 - CO_FLAGS_KWARGS = 8 - - # Adjust argcount for possible *args and **kwargs arguments. - argcount = co_argcount - if co_flags & CO_FLAGS_ARGS: argcount += 1 - if co_flags & CO_FLAGS_KWARGS: argcount += 1 - - # Determine the usage string. - usage = "%s %s" % (self.name, cmdname) - if argcount <= 2: # handler ::= do_FOO(self, argv) - usage += " [ARGS...]" - elif argcount >= 3: # handler ::= do_FOO(self, subcmd, opts, ...) - argnames = list(co_varnames[3:argcount]) - tail = "" - if co_flags & CO_FLAGS_KWARGS: - name = argnames.pop(-1) - import warnings - # There is no generally accepted mechanism for passing - # keyword arguments from the command line. Could - # *perhaps* consider: arg=value arg2=value2 ... - warnings.warn("argument '**%s' on '%s.%s' command " - "handler will never get values" - % (name, self.__class__.__name__, - func.func_name)) - if co_flags & CO_FLAGS_ARGS: - name = argnames.pop(-1) - tail = "[%s...]" % name.upper() - while func_defaults: - func_defaults.pop(-1) - name = argnames.pop(-1) - tail = "[%s%s%s]" % (name.upper(), (tail and ' ' or ''), tail) - while argnames: - name = argnames.pop(-1) - tail = "%s %s" % (name.upper(), tail) - usage += ' ' + tail - - block_lines = [ - self.helpindent + "Usage:", - self.helpindent + ' '*4 + usage - ] - block = '\n'.join(block_lines) + '\n\n' - - help = help.replace(indent+marker+suffix, block, 1) - return help - - #TODO: this only makes sense as part of the Cmdln class. - # Add hooks to add help preprocessing template vars and put - # this one on that class. - def _help_preprocess_cmd_option_list(self, help, cmdname=None): - marker = "${cmd_option_list}" - handler = self._get_cmd_handler(cmdname) - if not handler: - raise CmdlnError("cannot preprocess '%s' into help string: " - "could not find command handler for %r" - % (marker, cmdname)) - indent, indent_width = _get_indent(marker, help) - suffix = _get_trailing_whitespace(marker, help) - if hasattr(handler, "optparser"): - # Setup formatting options and format. - # - Indentation of 4 is better than optparse default of 2. - # C.f. Damian Conway's discussion of this in Perl Best - # Practices. - handler.optparser.formatter.indent_increment = 4 - handler.optparser.formatter.current_indent = indent_width - block = handler.optparser.format_option_help() + '\n' - else: - block = "" - - help = help.replace(indent+marker+suffix, block, 1) - return help - - def _get_canonical_cmd_name(self, token): - map = self._get_canonical_map() - return map.get(token, None) - - def _get_canonical_map(self): - """Return a mapping of available command names and aliases to - their canonical command name. - """ - cacheattr = "_token2canonical" - if not hasattr(self, cacheattr): - # Get the list of commands and their aliases, if any. - token2canonical = {} - cmd2funcname = {} # use a dict to strip duplicates - for attr in self.get_names(): - if attr.startswith("do_"): cmdname = attr[3:] - elif attr.startswith("_do_"): cmdname = attr[4:] - else: - continue - cmd2funcname[cmdname] = attr - token2canonical[cmdname] = cmdname - for cmdname, funcname in cmd2funcname.items(): # add aliases - func = getattr(self, funcname) - aliases = getattr(func, "aliases", []) - for alias in aliases: - if alias in cmd2funcname: - import warnings - warnings.warn("'%s' alias for '%s' command conflicts " - "with '%s' handler" - % (alias, cmdname, cmd2funcname[alias])) - continue - token2canonical[alias] = cmdname - setattr(self, cacheattr, token2canonical) - return getattr(self, cacheattr) - - def _get_cmd_handler(self, cmdname): - handler = None - try: - handler = getattr(self, 'do_' + cmdname) - except AttributeError: - try: - # Private command handlers begin with "_do_". - handler = getattr(self, '_do_' + cmdname) - except AttributeError: - pass - return handler - - def _do_EOF(self, argv): - # Default EOF handler - # Note: an actual EOF is redirected to this command. - #TODO: separate name for this. Currently it is available from - # command-line. Is that okay? - self.stdout.write('\n') - self.stdout.flush() - self.stop = True - - def emptyline(self): - # Different from cmd.Cmd: don't repeat the last command for an - # emptyline. - if self.cmdlooping: - pass - else: - return self.do_help(["help"]) - - -#---- optparse.py extension to fix (IMO) some deficiencies -# -# See the class _OptionParserEx docstring for details. -# - -class StopOptionProcessing(Exception): - """Indicate that option *and argument* processing should stop - cleanly. This is not an error condition. It is similar in spirit to - StopIteration. This is raised by _OptionParserEx's default "help" - and "version" option actions and can be raised by custom option - callbacks too. - - Hence the typical CmdlnOptionParser (a subclass of _OptionParserEx) - usage is: - - parser = CmdlnOptionParser(mycmd) - parser.add_option("-f", "--force", dest="force") - ... - try: - opts, args = parser.parse_args() - except StopOptionProcessing: - # normal termination, "--help" was probably given - sys.exit(0) - """ - -class _OptionParserEx(optparse.OptionParser): - """An optparse.OptionParser that uses exceptions instead of sys.exit. - - This class is an extension of optparse.OptionParser that differs - as follows: - - Correct (IMO) the default OptionParser error handling to never - sys.exit(). Instead OptParseError exceptions are passed through. - - Add the StopOptionProcessing exception (a la StopIteration) to - indicate normal termination of option processing. - See StopOptionProcessing's docstring for details. - - I'd also like to see the following in the core optparse.py, perhaps - as a RawOptionParser which would serve as a base class for the more - generally used OptionParser (that works as current): - - Remove the implicit addition of the -h|--help and --version - options. They can get in the way (e.g. if want '-?' and '-V' for - these as well) and it is not hard to do: - optparser.add_option("-h", "--help", action="help") - optparser.add_option("--version", action="version") - These are good practices, just not valid defaults if they can - get in the way. - """ - def error(self, msg): - raise optparse.OptParseError(msg) - - def exit(self, status=0, msg=None): - if status == 0: - raise StopOptionProcessing(msg) - else: - #TODO: don't lose status info here - raise optparse.OptParseError(msg) - - - -#---- optparse.py-based option processing support - -class CmdlnOptionParser(_OptionParserEx): - """An optparse.OptionParser class more appropriate for top-level - Cmdln options. For parsing of sub-command options, see - SubCmdOptionParser. - - Changes: - - disable_interspersed_args() by default, because a Cmdln instance - has sub-commands which may themselves have options. - - Redirect print_help() to the Cmdln.do_help() which is better - equiped to handle the "help" action. - - error() will raise a CmdlnUserError: OptionParse.error() is meant - to be called for user errors. Raising a well-known error here can - make error handling clearer. - - Also see the changes in _OptionParserEx. - """ - def __init__(self, cmdln, **kwargs): - self.cmdln = cmdln - kwargs["prog"] = self.cmdln.name - _OptionParserEx.__init__(self, **kwargs) - self.disable_interspersed_args() - - def print_help(self, file=None): - self.cmdln.onecmd(["help"]) - - def error(self, msg): - raise CmdlnUserError(msg) - - -class SubCmdOptionParser(_OptionParserEx): - def set_cmdln_info(self, cmdln, subcmd): - """Called by Cmdln to pass relevant info about itself needed - for print_help(). - """ - self.cmdln = cmdln - self.subcmd = subcmd - - def print_help(self, file=None): - self.cmdln.onecmd(["help", self.subcmd]) - - def error(self, msg): - raise CmdlnUserError(msg) - - -def option(*args, **kwargs): - """Decorator to add an option to the optparser argument of a Cmdln - subcommand. - - Example: - class MyShell(cmdln.Cmdln): - @cmdln.option("-f", "--force", help="force removal") - def do_remove(self, subcmd, opts, *args): - #... - """ - #XXX Is there a possible optimization for many options to not have a - # large stack depth here? - def decorate(f): - if not hasattr(f, "optparser"): - f.optparser = SubCmdOptionParser() - f.optparser.add_option(*args, **kwargs) - return f - return decorate - - -class Cmdln(RawCmdln): - """An improved (on cmd.Cmd) framework for building multi-subcommand - scripts (think "svn" & "cvs") and simple shells (think "pdb" and - "gdb"). - - A simple example: - - import cmdln - - class MySVN(cmdln.Cmdln): - name = "svn" - - @cmdln.aliases('stat', 'st') - @cmdln.option('-v', '--verbose', action='store_true' - help='print verbose information') - def do_status(self, subcmd, opts, *paths): - print "handle 'svn status' command" - - #... - - if __name__ == "__main__": - shell = MySVN() - retval = shell.main() - sys.exit(retval) - - 'Cmdln' extends 'RawCmdln' by providing optparse option processing - integration. See this class' _dispatch_cmd() docstring and - <http://trentm.com/projects/cmdln> for more information. - """ - def _dispatch_cmd(self, handler, argv): - """Introspect sub-command handler signature to determine how to - dispatch the command. The raw handler provided by the base - 'RawCmdln' class is still supported: - - def do_foo(self, argv): - # 'argv' is the vector of command line args, argv[0] is - # the command name itself (i.e. "foo" or an alias) - pass - - In addition, if the handler has more than 2 arguments option - processing is automatically done (using optparse): - - @cmdln.option('-v', '--verbose', action='store_true') - def do_bar(self, subcmd, opts, *args): - # subcmd = <"bar" or an alias> - # opts = <an optparse.Values instance> - if opts.verbose: - print "lots of debugging output..." - # args = <tuple of arguments> - for arg in args: - bar(arg) - - TODO: explain that "*args" can be other signatures as well. - - The `cmdln.option` decorator corresponds to an `add_option()` - method call on an `optparse.OptionParser` instance. - - You can declare a specific number of arguments: - - @cmdln.option('-v', '--verbose', action='store_true') - def do_bar2(self, subcmd, opts, bar_one, bar_two): - #... - - and an appropriate error message will be raised/printed if the - command is called with a different number of args. - """ - co_argcount = handler.im_func.func_code.co_argcount - if co_argcount == 2: # handler ::= do_foo(self, argv) - return handler(argv) - elif co_argcount >= 3: # handler ::= do_foo(self, subcmd, opts, ...) - try: - optparser = handler.optparser - except AttributeError: - optparser = handler.im_func.optparser = SubCmdOptionParser() - assert isinstance(optparser, SubCmdOptionParser) - optparser.set_cmdln_info(self, argv[0]) - try: - opts, args = optparser.parse_args(argv[1:]) - except StopOptionProcessing: - #TODO: this doesn't really fly for a replacement of - # optparse.py behaviour, does it? - return 0 # Normal command termination - - try: - return handler(argv[0], opts, *args) - except TypeError, ex: - # Some TypeError's are user errors: - # do_foo() takes at least 4 arguments (3 given) - # do_foo() takes at most 5 arguments (6 given) - # do_foo() takes exactly 5 arguments (6 given) - # Raise CmdlnUserError for these with a suitably - # massaged error message. - import sys - tb = sys.exc_info()[2] # the traceback object - if tb.tb_next is not None: - # If the traceback is more than one level deep, then the - # TypeError do *not* happen on the "handler(...)" call - # above. In that we don't want to handle it specially - # here: it would falsely mask deeper code errors. - raise - msg = ex.args[0] - match = _INCORRECT_NUM_ARGS_RE.search(msg) - if match: - msg = list(match.groups()) - msg[1] = int(msg[1]) - 3 - if msg[1] == 1: - msg[2] = msg[2].replace("arguments", "argument") - msg[3] = int(msg[3]) - 3 - msg = ''.join(map(str, msg)) - raise CmdlnUserError(msg) - else: - raise - else: - raise CmdlnError("incorrect argcount for %s(): takes %d, must " - "take 2 for 'argv' signature or 3+ for 'opts' " - "signature" % (handler.__name__, co_argcount)) - - - -#---- internal support functions - -def _format_linedata(linedata, indent, indent_width): - """Format specific linedata into a pleasant layout. - - "linedata" is a list of 2-tuples of the form: - (<item-display-string>, <item-docstring>) - "indent" is a string to use for one level of indentation - "indent_width" is a number of columns by which the - formatted data will be indented when printed. - - The <item-display-string> column is held to 15 columns. - """ - lines = [] - WIDTH = 78 - indent_width - SPACING = 2 - NAME_WIDTH_LOWER_BOUND = 13 - NAME_WIDTH_UPPER_BOUND = 16 - NAME_WIDTH = max([len(s) for s,d in linedata]) - if NAME_WIDTH < NAME_WIDTH_LOWER_BOUND: - NAME_WIDTH = NAME_WIDTH_LOWER_BOUND - else: - NAME_WIDTH = NAME_WIDTH_UPPER_BOUND - - DOC_WIDTH = WIDTH - NAME_WIDTH - SPACING - for namestr, doc in linedata: - line = indent + namestr - if len(namestr) <= NAME_WIDTH: - line += ' ' * (NAME_WIDTH + SPACING - len(namestr)) - else: - lines.append(line) - line = indent + ' ' * (NAME_WIDTH + SPACING) - line += _summarize_doc(doc, DOC_WIDTH) - lines.append(line.rstrip()) - return lines - -def _summarize_doc(doc, length=60): - r"""Parse out a short one line summary from the given doclines. - - "doc" is the doc string to summarize. - "length" is the max length for the summary - - >>> _summarize_doc("this function does this") - 'this function does this' - >>> _summarize_doc("this function does this", 10) - 'this fu...' - >>> _summarize_doc("this function does this\nand that") - 'this function does this and that' - >>> _summarize_doc("this function does this\n\nand that") - 'this function does this' - """ - import re - if doc is None: - return "" - assert length > 3, "length <= 3 is absurdly short for a doc summary" - doclines = doc.strip().splitlines(0) - if not doclines: - return "" - - summlines = [] - for i, line in enumerate(doclines): - stripped = line.strip() - if not stripped: - break - summlines.append(stripped) - if len(''.join(summlines)) >= length: - break - - summary = ' '.join(summlines) - if len(summary) > length: - summary = summary[:length-3] + "..." - return summary - - -def line2argv(line): - r"""Parse the given line into an argument vector. - - "line" is the line of input to parse. - - This may get niggly when dealing with quoting and escaping. The - current state of this parsing may not be completely thorough/correct - in this respect. - - >>> from cmdln import line2argv - >>> line2argv("foo") - ['foo'] - >>> line2argv("foo bar") - ['foo', 'bar'] - >>> line2argv("foo bar ") - ['foo', 'bar'] - >>> line2argv(" foo bar") - ['foo', 'bar'] - - Quote handling: - - >>> line2argv("'foo bar'") - ['foo bar'] - >>> line2argv('"foo bar"') - ['foo bar'] - >>> line2argv(r'"foo\"bar"') - ['foo"bar'] - >>> line2argv("'foo bar' spam") - ['foo bar', 'spam'] - >>> line2argv("'foo 'bar spam") - ['foo bar', 'spam'] - - >>> line2argv('some\tsimple\ttests') - ['some', 'simple', 'tests'] - >>> line2argv('a "more complex" test') - ['a', 'more complex', 'test'] - >>> line2argv('a more="complex test of " quotes') - ['a', 'more=complex test of ', 'quotes'] - >>> line2argv('a more" complex test of " quotes') - ['a', 'more complex test of ', 'quotes'] - >>> line2argv('an "embedded \\"quote\\""') - ['an', 'embedded "quote"'] - - # Komodo bug 48027 - >>> line2argv('foo bar C:\\') - ['foo', 'bar', 'C:\\'] - - # Komodo change 127581 - >>> line2argv(r'"\test\slash" "foo bar" "foo\"bar"') - ['\\test\\slash', 'foo bar', 'foo"bar'] - - # Komodo change 127629 - >>> if sys.platform == "win32": - ... line2argv(r'\foo\bar') == ['\\foo\\bar'] - ... line2argv(r'\\foo\\bar') == ['\\\\foo\\\\bar'] - ... line2argv('"foo') == ['foo'] - ... else: - ... line2argv(r'\foo\bar') == ['foobar'] - ... line2argv(r'\\foo\\bar') == ['\\foo\\bar'] - ... try: - ... line2argv('"foo') - ... except ValueError, ex: - ... "not terminated" in str(ex) - True - True - True - """ - import string - line = line.strip() - argv = [] - state = "default" - arg = None # the current argument being parsed - i = -1 - while 1: - i += 1 - if i >= len(line): break - ch = line[i] - - if ch == "\\" and i+1 < len(line): - # escaped char always added to arg, regardless of state - if arg is None: arg = "" - if (sys.platform == "win32" - or state in ("double-quoted", "single-quoted") - ) and line[i+1] not in tuple('"\''): - arg += ch - i += 1 - arg += line[i] - continue - - if state == "single-quoted": - if ch == "'": - state = "default" - else: - arg += ch - elif state == "double-quoted": - if ch == '"': - state = "default" - else: - arg += ch - elif state == "default": - if ch == '"': - if arg is None: arg = "" - state = "double-quoted" - elif ch == "'": - if arg is None: arg = "" - state = "single-quoted" - elif ch in string.whitespace: - if arg is not None: - argv.append(arg) - arg = None - else: - if arg is None: arg = "" - arg += ch - if arg is not None: - argv.append(arg) - if not sys.platform == "win32" and state != "default": - raise ValueError("command line is not terminated: unfinished %s " - "segment" % state) - return argv - - -def argv2line(argv): - r"""Put together the given argument vector into a command line. - - "argv" is the argument vector to process. - - >>> from cmdln import argv2line - >>> argv2line(['foo']) - 'foo' - >>> argv2line(['foo', 'bar']) - 'foo bar' - >>> argv2line(['foo', 'bar baz']) - 'foo "bar baz"' - >>> argv2line(['foo"bar']) - 'foo"bar' - >>> print argv2line(['foo" bar']) - 'foo" bar' - >>> print argv2line(["foo' bar"]) - "foo' bar" - >>> argv2line(["foo'bar"]) - "foo'bar" - """ - escapedArgs = [] - for arg in argv: - if ' ' in arg and '"' not in arg: - arg = '"'+arg+'"' - elif ' ' in arg and "'" not in arg: - arg = "'"+arg+"'" - elif ' ' in arg: - arg = arg.replace('"', r'\"') - arg = '"'+arg+'"' - escapedArgs.append(arg) - return ' '.join(escapedArgs) - - -# Recipe: dedent (0.1) in /Users/trentm/tm/recipes/cookbook -def _dedentlines(lines, tabsize=8, skip_first_line=False): - """_dedentlines(lines, tabsize=8, skip_first_line=False) -> dedented lines - - "lines" is a list of lines to dedent. - "tabsize" is the tab width to use for indent width calculations. - "skip_first_line" is a boolean indicating if the first line should - be skipped for calculating the indent width and for dedenting. - This is sometimes useful for docstrings and similar. - - Same as dedent() except operates on a sequence of lines. Note: the - lines list is modified **in-place**. - """ - DEBUG = False - if DEBUG: - print "dedent: dedent(..., tabsize=%d, skip_first_line=%r)"\ - % (tabsize, skip_first_line) - indents = [] - margin = None - for i, line in enumerate(lines): - if i == 0 and skip_first_line: continue - indent = 0 - for ch in line: - if ch == ' ': - indent += 1 - elif ch == '\t': - indent += tabsize - (indent % tabsize) - elif ch in '\r\n': - continue # skip all-whitespace lines - else: - break - else: - continue # skip all-whitespace lines - if DEBUG: print "dedent: indent=%d: %r" % (indent, line) - if margin is None: - margin = indent - else: - margin = min(margin, indent) - if DEBUG: print "dedent: margin=%r" % margin - - if margin is not None and margin > 0: - for i, line in enumerate(lines): - if i == 0 and skip_first_line: continue - removed = 0 - for j, ch in enumerate(line): - if ch == ' ': - removed += 1 - elif ch == '\t': - removed += tabsize - (removed % tabsize) - elif ch in '\r\n': - if DEBUG: print "dedent: %r: EOL -> strip up to EOL" % line - lines[i] = lines[i][j:] - break - else: - raise ValueError("unexpected non-whitespace char %r in " - "line %r while removing %d-space margin" - % (ch, line, margin)) - if DEBUG: - print "dedent: %r: %r -> removed %d/%d"\ - % (line, ch, removed, margin) - if removed == margin: - lines[i] = lines[i][j+1:] - break - elif removed > margin: - lines[i] = ' '*(removed-margin) + lines[i][j+1:] - break - return lines - -def _dedent(text, tabsize=8, skip_first_line=False): - """_dedent(text, tabsize=8, skip_first_line=False) -> dedented text - - "text" is the text to dedent. - "tabsize" is the tab width to use for indent width calculations. - "skip_first_line" is a boolean indicating if the first line should - be skipped for calculating the indent width and for dedenting. - This is sometimes useful for docstrings and similar. - - textwrap.dedent(s), but don't expand tabs to spaces - """ - lines = text.splitlines(1) - _dedentlines(lines, tabsize=tabsize, skip_first_line=skip_first_line) - return ''.join(lines) - - -def _get_indent(marker, s, tab_width=8): - """_get_indent(marker, s, tab_width=8) -> - (<indentation-of-'marker'>, <indentation-width>)""" - # Figure out how much the marker is indented. - INDENT_CHARS = tuple(' \t') - start = s.index(marker) - i = start - while i > 0: - if s[i-1] not in INDENT_CHARS: - break - i -= 1 - indent = s[i:start] - indent_width = 0 - for ch in indent: - if ch == ' ': - indent_width += 1 - elif ch == '\t': - indent_width += tab_width - (indent_width % tab_width) - return indent, indent_width - -def _get_trailing_whitespace(marker, s): - """Return the whitespace content trailing the given 'marker' in string 's', - up to and including a newline. - """ - suffix = '' - start = s.index(marker) + len(marker) - i = start - while i < len(s): - if s[i] in ' \t': - suffix += s[i] - elif s[i] in '\r\n': - suffix += s[i] - if s[i] == '\r' and i+1 < len(s) and s[i+1] == '\n': - suffix += s[i+1] - break - else: - break - i += 1 - return suffix - - - -#---- bash completion support -# Note: This is still experimental. I expect to change this -# significantly. -# -# To get Bash completion for a cmdln.Cmdln class, run the following -# bash command: -# $ complete -C 'python -m cmdln /path/to/script.py CmdlnClass' cmdname -# For example: -# $ complete -C 'python -m cmdln ~/bin/svn.py SVN' svn -# -#TODO: Simplify the above so don't have to given path to script (try to -# find it on PATH, if possible). Could also make class name -# optional if there is only one in the module (common case). - -if __name__ == "__main__" and len(sys.argv) == 6: - def _log(s): - return # no-op, comment out for debugging - from os.path import expanduser - fout = open(expanduser("~/tmp/bashcpln.log"), 'a') - fout.write(str(s) + '\n') - fout.close() - - # Recipe: module_from_path (1.0.1+) - def _module_from_path(path): - import imp, os, sys - path = os.path.expanduser(path) - dir = os.path.dirname(path) or os.curdir - name = os.path.splitext(os.path.basename(path))[0] - sys.path.insert(0, dir) - try: - iinfo = imp.find_module(name, [dir]) - return imp.load_module(name, *iinfo) - finally: - sys.path.remove(dir) - - def _get_bash_cplns(script_path, class_name, cmd_name, - token, preceding_token): - _log('--') - _log('get_cplns(%r, %r, %r, %r, %r)' - % (script_path, class_name, cmd_name, token, preceding_token)) - comp_line = os.environ["COMP_LINE"] - comp_point = int(os.environ["COMP_POINT"]) - _log("COMP_LINE: %r" % comp_line) - _log("COMP_POINT: %r" % comp_point) - - try: - script = _module_from_path(script_path) - except ImportError, ex: - _log("error importing `%s': %s" % (script_path, ex)) - return [] - shell = getattr(script, class_name)() - cmd_map = shell._get_canonical_map() - del cmd_map["EOF"] - - # Determine if completing the sub-command name. - parts = comp_line[:comp_point].split(None, 1) - _log(parts) - if len(parts) == 1 or not (' ' in parts[1] or '\t' in parts[1]): - #TODO: if parts[1].startswith('-'): handle top-level opts - _log("complete sub-command names") - matches = {} - for name, canon_name in cmd_map.items(): - if name.startswith(token): - matches[name] = canon_name - if not matches: - return [] - elif len(matches) == 1: - return matches.keys() - elif len(set(matches.values())) == 1: - return [matches.values()[0]] - else: - return matches.keys() - - # Otherwise, complete options for the given sub-command. - #TODO: refine this so it does the right thing with option args - if token.startswith('-'): - cmd_name = comp_line.split(None, 2)[1] - try: - cmd_canon_name = cmd_map[cmd_name] - except KeyError: - return [] - handler = shell._get_cmd_handler(cmd_canon_name) - optparser = getattr(handler, "optparser", None) - if optparser is None: - optparser = SubCmdOptionParser() - opt_strs = [] - for option in optparser.option_list: - for opt_str in option._short_opts + option._long_opts: - if opt_str.startswith(token): - opt_strs.append(opt_str) - return opt_strs - - return [] - - for cpln in _get_bash_cplns(*sys.argv[1:]): - print cpln - diff --git a/scripts/lib/wic/utils/errors.py b/scripts/lib/wic/utils/errors.py deleted file mode 100644 index 9410311875..0000000000 --- a/scripts/lib/wic/utils/errors.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/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 CreatorError(Exception): - """An exception base class for all imgcreate errors.""" - keyword = '<creator>' - - def __init__(self, msg): - self.msg = msg - - def __str__(self): - if isinstance(self.msg, unicode): - self.msg = self.msg.encode('utf-8', 'ignore') - else: - self.msg = str(self.msg) - return self.keyword + self.msg - -class Usage(CreatorError): - keyword = '<usage>' - - def __str__(self): - if isinstance(self.msg, unicode): - self.msg = self.msg.encode('utf-8', 'ignore') - else: - self.msg = str(self.msg) - return self.keyword + self.msg + ', please use "--help" for more info' - -class KsError(CreatorError): - keyword = '<kickstart>' - -class ImageError(CreatorError): - keyword = '<mount>' diff --git a/scripts/lib/wic/utils/fs_related.py b/scripts/lib/wic/utils/fs_related.py deleted file mode 100644 index ea9f85c60f..0000000000 --- a/scripts/lib/wic/utils/fs_related.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2007, Red Hat, Inc. -# Copyright (c) 2009, 2010, 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. - -from __future__ import with_statement -import os -import sys -import errno -import stat -import random -import string -import time -import uuid - -from wic import msger -from wic.utils import runner -from wic.utils.errors import * -from wic.utils.oe.misc import * - -def find_binary_path(binary): - if os.environ.has_key("PATH"): - paths = os.environ["PATH"].split(":") - else: - paths = [] - if os.environ.has_key("HOME"): - paths += [os.environ["HOME"] + "/bin"] - paths += ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"] - - for path in paths: - bin_path = "%s/%s" % (path, binary) - if os.path.exists(bin_path): - return bin_path - - print "External command '%s' not found, exiting." % binary - print " (Please install '%s' on your host system)" % binary - sys.exit(1) - -def makedirs(dirname): - """A version of os.makedirs() that doesn't throw an - exception if the leaf directory already exists. - """ - try: - os.makedirs(dirname) - except OSError, err: - if err.errno != errno.EEXIST: - raise - -class Disk: - """ - Generic base object for a disk. - """ - def __init__(self, size, device = None): - self._device = device - self._size = size - - def create(self): - pass - - def cleanup(self): - pass - - def get_device(self): - return self._device - def set_device(self, path): - self._device = path - device = property(get_device, set_device) - - def get_size(self): - return self._size - size = property(get_size) - - -class DiskImage(Disk): - """ - A Disk backed by a file. - """ - def __init__(self, image_file, size): - Disk.__init__(self, size) - self.image_file = image_file - - def exists(self): - return os.path.exists(self.image_file) - - def create(self): - if self.device is not None: - return - - blocks = self.size / 1024 - if self.size - blocks * 1024: - blocks += 1 - - # create disk image - dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=1" % \ - (self.image_file, blocks) - exec_cmd(dd_cmd) - - self.device = self.image_file diff --git a/scripts/lib/wic/utils/misc.py b/scripts/lib/wic/utils/misc.py index 6e56316608..46099840ca 100644 --- a/scripts/lib/wic/utils/misc.py +++ b/scripts/lib/wic/utils/misc.py @@ -1,59 +1,230 @@ -#!/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) 2010, 2011 Intel Inc. +# 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 as published by the Free -# Software Foundation; version 2 of the License +# 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 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. +# 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 sys -import time +import re -def build_name(kscfg, release=None, prefix = None, suffix = None): - """Construct and return an image name string. +from collections import defaultdict +from distutils import spawn - This is a utility function to help create sensible name and fslabel - strings. The name is constructed using the sans-prefix-and-extension - kickstart filename and the supplied prefix and suffix. +from wic import WicError +from wic.utils import runner - kscfg -- a path to a kickstart file - release -- a replacement to suffix for image release - prefix -- a prefix to prepend to the name; defaults to None, which causes - no prefix to be used - suffix -- a suffix to append to the name; defaults to None, which causes - a YYYYMMDDHHMM suffix to be used +logger = logging.getLogger('wic') - Note, if maxlen is less then the len(suffix), you get to keep both pieces. +# 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 """ - name = os.path.basename(kscfg) - idx = name.rfind('.') - if idx >= 0: - name = name[:idx] + 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 - if release is not None: - suffix = "" - if prefix is None: - prefix = "" - if suffix is None: - suffix = time.strftime("%Y%m%d%H%M") + wtools_sysroot = get_bitbake_var("RECIPE_SYSROOT_NATIVE", "wic-tools") - if name.startswith(prefix): - name = name[len(prefix):] + 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) - prefix = "%s-" % prefix if prefix else "" - suffix = "-%s" % suffix if suffix else "" + # 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) - ret = prefix + name + suffix + 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 + 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/oe/__init__.py b/scripts/lib/wic/utils/oe/__init__.py deleted file mode 100644 index 0a81575a74..0000000000 --- a/scripts/lib/wic/utils/oe/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -# OpenEmbedded wic utils library -# -# 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. -# -# AUTHORS -# Tom Zanussi <tom.zanussi (at] linux.intel.com> -# diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py deleted file mode 100644 index ea9b6e8ec4..0000000000 --- a/scripts/lib/wic/utils/oe/misc.py +++ /dev/null @@ -1,203 +0,0 @@ -# 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> -# - -from wic import msger -from wic.utils import runner - -def __exec_cmd(cmd_and_args, as_shell = False, catch = 3): - """ - Execute command, catching stderr, stdout - - Need to execute as_shell if the command uses wildcards - """ - msger.debug("__exec_cmd: %s" % cmd_and_args) - args = cmd_and_args.split() - msger.debug(args) - - if (as_shell): - rc, out = runner.runtool(cmd_and_args, catch) - else: - rc, out = runner.runtool(args, catch) - out = out.strip() - msger.debug("__exec_cmd: output for %s (rc = %d): %s" % \ - (cmd_and_args, rc, out)) - - return (rc, out) - - -def exec_cmd(cmd_and_args, as_shell = False, catch = 3): - """ - Execute command, catching stderr, stdout - - Exits if rc non-zero - """ - rc, out = __exec_cmd(cmd_and_args, as_shell, catch) - - if rc != 0: - msger.error("exec_cmd: %s returned '%s' instead of 0" % (cmd_and_args, rc)) - - return out - - -def exec_cmd_quiet(cmd_and_args, as_shell = False): - """ - Execute command, catching nothing in the output - - Exits if rc non-zero - """ - return exec_cmd(cmd_and_args, as_shell, 0) - - -def exec_native_cmd(cmd_and_args, native_sysroot, catch = 3): - """ - Execute native command, catching stderr, stdout - - Need to execute as_shell if the command uses wildcards - - Always need to execute native commands as_shell - """ - native_paths = \ - "export PATH=%s/sbin:%s/usr/sbin:%s/usr/bin:$PATH" % \ - (native_sysroot, native_sysroot, native_sysroot) - native_cmd_and_args = "%s;%s" % (native_paths, cmd_and_args) - msger.debug("exec_native_cmd: %s" % cmd_and_args) - - args = cmd_and_args.split() - msger.debug(args) - - rc, out = __exec_cmd(native_cmd_and_args, True, catch) - - if rc == 127: # shell command-not-found - msger.error("A native (host) program required to build the image " - "was not found (see details above). Please make sure " - "it's installed and try again.") - - return (rc, out) - - -def exec_native_cmd_quiet(cmd_and_args, native_sysroot): - """ - Execute native command, catching nothing in the output - - Need to execute as_shell if the command uses wildcards - - Always need to execute native commands as_shell - """ - return exec_native_cmd(cmd_and_args, native_sysroot, 0) - - -# kickstart doesn't support variable substution in commands, so this -# is our current simplistic scheme for supporting that - -wks_vars = dict() - -def get_wks_var(key): - return wks_vars[key] - -def add_wks_var(key, val): - wks_vars[key] = val - -BOOTDD_EXTRA_SPACE = 16384 - -__bitbake_env_lines = "" - -def set_bitbake_env_lines(bitbake_env_lines): - global __bitbake_env_lines - __bitbake_env_lines = bitbake_env_lines - -def get_bitbake_env_lines(): - return __bitbake_env_lines - -def find_bitbake_env_lines(image_name): - """ - If image_name is empty, plugins might still be able to use the - environment, so set it regardless. - """ - if image_name: - bitbake_env_cmd = "bitbake -e %s" % image_name - else: - bitbake_env_cmd = "bitbake -e" - rc, bitbake_env_lines = __exec_cmd(bitbake_env_cmd) - if rc != 0: - print "Couldn't get '%s' output." % bitbake_env_cmd - return None - - return bitbake_env_lines - -def find_artifact(bitbake_env_lines, variable): - """ - Gather the build artifact for the current image (the image_name - e.g. core-image-minimal) for the current MACHINE set in local.conf - """ - retval = "" - - for line in bitbake_env_lines.split('\n'): - if (get_line_val(line, variable)): - retval = get_line_val(line, variable) - break - - return retval - -def get_line_val(line, key): - """ - Extract the value from the VAR="val" string - """ - if line.startswith(key + "="): - stripped_line = line.split('=')[1] - stripped_line = stripped_line.replace('\"', '') - return stripped_line - return None - -def get_bitbake_var(key): - for line in __bitbake_env_lines.split('\n'): - if (get_line_val(line, key)): - val = get_line_val(line, key) - return val - return None - -def parse_sourceparams(sourceparams): - """ - Split sourceparams string of the form key1=val1[,key2=val2,...] - into a dict. Also accepts valueless keys i.e. without =. - - Returns dict of param key/val pairs (note that val may be None). - """ - params_dict = {} - - params = sourceparams.split(',') - if params: - for p in params: - if not p: - continue - if not '=' in p: - key = p - val = None - else: - key, val = p.split('=') - params_dict[key] = val - - return params_dict diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py deleted file mode 100644 index 162f8e1b9c..0000000000 --- a/scripts/lib/wic/utils/partitionedfs.py +++ /dev/null @@ -1,375 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2009, 2010, 2011 Intel, Inc. -# Copyright (c) 2007, 2008 Red Hat, Inc. -# Copyright (c) 2008 Daniel P. Berrange -# Copyright (c) 2008 David P. Huff -# -# 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 os - -from wic import msger -from wic.utils import runner -from wic.utils.errors import ImageError -from wic.utils.fs_related import * -from wic.utils.oe.misc import * - -# 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 Image: - """ - Generic base object for an image. - - An Image is a container for a set of DiskImages and associated - partitions. - """ - def __init__(self): - self.disks = {} - self.partitions = [] - self.parted = find_binary_path("parted") - # Size of a sector used in calculations - self.sector_size = SECTOR_SIZE - self._partitions_layed_out = False - - def __add_disk(self, disk_name): - """ Add a disk 'disk_name' to the internal list of disks. Note, - 'disk_name' is the name of the disk in the target system - (e.g., sdb). """ - - if disk_name in self.disks: - # We already have this disk - return - - assert not self._partitions_layed_out - - self.disks[disk_name] = \ - { 'disk': None, # Disk object - 'numpart': 0, # Number of allocate partitions - 'realpart': 0, # Number of partitions in the partition table - 'partitions': [], # Indexes to self.partitions - 'offset': 0, # Offset of next partition (in sectors) - # Minimum required disk size to fit all partitions (in bytes) - 'min_size': 0, - 'ptable_format': "msdos" } # Partition table format - - def add_disk(self, disk_name, disk_obj): - """ Add a disk object which have to be partitioned. More than one disk - can be added. In case of multiple disks, disk partitions have to be - added for each disk separately with 'add_partition()". """ - - self.__add_disk(disk_name) - self.disks[disk_name]['disk'] = disk_obj - - def __add_partition(self, part): - """ This is a helper function for 'add_partition()' which adds a - partition to the internal list of partitions. """ - - assert not self._partitions_layed_out - - self.partitions.append(part) - self.__add_disk(part['disk_name']) - - def add_partition(self, size, disk_name, mountpoint, source_file = None, fstype = None, - label=None, fsopts = None, boot = False, align = None, no_table=False, - part_type = None): - """ Add the next partition. Prtitions have to be added in the - first-to-last order. """ - - ks_pnum = len(self.partitions) - - # Converting kB to sectors for parted - size = size * 1024 / self.sector_size - - # We still need partition for "/" or non-subvolume - if mountpoint == "/" or not fsopts: - part = { 'ks_pnum' : ks_pnum, # Partition number in the KS file - 'size': size, # In sectors - 'mountpoint': mountpoint, # Mount relative to chroot - 'source_file': source_file, # partition contents - 'fstype': fstype, # Filesystem type - 'fsopts': fsopts, # Filesystem mount options - 'label': label, # Partition label - 'disk_name': disk_name, # physical disk name holding partition - 'device': None, # kpartx device node for partition - 'num': None, # Partition number - 'boot': boot, # Bootable flag - 'align': align, # Partition alignment - 'no_table' : no_table, # Partition does not appear in partition table - 'part_type' : part_type } # Partition type - - self.__add_partition(part) - - def layout_partitions(self, ptable_format = "msdos"): - """ 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". """ - - msger.debug("Assigning %s partitions to disks" % ptable_format) - - if ptable_format not in ('msdos', 'gpt'): - raise ImageError("Unknown partition table format '%s', supported " \ - "formats are: 'msdos'" % ptable_format) - - if self._partitions_layed_out: - return - - self._partitions_layed_out = True - - # Go through partitions in the order they are added in .ks file - for n in range(len(self.partitions)): - p = self.partitions[n] - - if not self.disks.has_key(p['disk_name']): - raise ImageError("No disk %s for partition %s" \ - % (p['disk_name'], p['mountpoint'])) - - if p['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 ImageError("setting custom partition type is not " \ - "implemented for msdos partitions") - - # Get the disk where the partition is located - d = self.disks[p['disk_name']] - d['numpart'] += 1 - if not p['no_table']: - d['realpart'] += 1 - d['ptable_format'] = ptable_format - - if d['numpart'] == 1: - if ptable_format == "msdos": - overhead = MBR_OVERHEAD - elif ptable_format == "gpt": - overhead = GPT_OVERHEAD - - # Skip one sector required for the partitioning scheme overhead - d['offset'] += overhead - - if d['realpart'] > 3: - # Reserve a sector for EBR for every logical partition - # before alignment is performed. - if ptable_format == "msdos": - d['offset'] += 1 - - - if p['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 = d['offset'] % (p['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 = (p['align'] * 1024 / self.sector_size) - align_sectors - - msger.debug("Realignment for %s%s with %s sectors, original" - " offset %s, target alignment is %sK." % - (p['disk_name'], d['numpart'], align_sectors, - d['offset'], p['align'])) - - # increase the offset so we actually start the partition on right alignment - d['offset'] += align_sectors - - p['start'] = d['offset'] - d['offset'] += p['size'] - - p['type'] = 'primary' - if not p['no_table']: - p['num'] = d['realpart'] - else: - p['num'] = 0 - - if d['ptable_format'] == "msdos": - if d['realpart'] > 3: - p['type'] = 'logical' - p['num'] = d['realpart'] + 1 - - d['partitions'].append(n) - msger.debug("Assigned %s to %s%d, sectors range %d-%d size %d " - "sectors (%d bytes)." \ - % (p['mountpoint'], p['disk_name'], p['num'], - p['start'], p['start'] + p['size'] - 1, - p['size'], p['size'] * self.sector_size)) - - # Once all the partitions have been layed out, we can calculate the - # minumim disk sizes. - for disk_name, d in self.disks.items(): - d['min_size'] = d['offset'] - if d['ptable_format'] == "gpt": - d['min_size'] += GPT_OVERHEAD - - d['min_size'] *= self.sector_size - - def __run_parted(self, args): - """ Run parted with arguments specified in the 'args' list. """ - - args.insert(0, self.parted) - msger.debug(args) - - rc, out = runner.runtool(args, catch = 3) - out = out.strip() - if out: - msger.debug('"parted" output: %s' % out) - - if rc != 0: - # We don't throw exception when return code is not 0, because - # parted always fails to reload part table with loop devices. This - # prevents us from distinguishing real errors based on return - # code. - msger.error("WARNING: parted returned '%s' instead of 0 (use --debug for details)" % rc) - - 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 - msger.debug("Added '%s' partition, sectors %d-%d, size %d sectors" % - (parttype, start, end, size)) - - args = ["-s", device, "unit", "s", "mkpart", parttype] - if fstype: - args.extend([fstype]) - args.extend(["%d" % start, "%d" % end]) - - return self.__run_parted(args) - - def __format_disks(self): - self.layout_partitions() - - for dev in self.disks.keys(): - d = self.disks[dev] - msger.debug("Initializing partition table for %s" % \ - (d['disk'].device)) - self.__run_parted(["-s", d['disk'].device, "mklabel", - d['ptable_format']]) - - msger.debug("Creating partitions") - - for p in self.partitions: - if p['num'] == 0: - continue - - d = self.disks[p['disk_name']] - if d['ptable_format'] == "msdos" and p['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(d['disk'].device, "extended", - None, p['start'] - 1, - d['offset'] - p['start'] + 1) - - if p['fstype'] == "swap": - parted_fs_type = "linux-swap" - elif p['fstype'] == "vfat": - parted_fs_type = "fat32" - elif p['fstype'] == "msdos": - parted_fs_type = "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 p['mountpoint'] == "/boot" and p['fstype'] in ["vfat", "msdos"] \ - and p['size'] % 2: - msger.debug("Substracting one sector from '%s' partition to " \ - "get even number of sectors for the partition" % \ - p['mountpoint']) - p['size'] -= 1 - - self.__create_partition(d['disk'].device, p['type'], - parted_fs_type, p['start'], p['size']) - - if p['boot']: - flag_name = "boot" - msger.debug("Set '%s' flag for partition '%s' on disk '%s'" % \ - (flag_name, p['num'], d['disk'].device)) - self.__run_parted(["-s", d['disk'].device, "set", - "%d" % p['num'], flag_name, "on"]) - - # Parted defaults to enabling the lba flag for fat16 partitions, - # which causes compatibility issues with some firmware (and really - # isn't necessary). - if parted_fs_type == "fat16": - if d['ptable_format'] == 'msdos': - msger.debug("Disable 'lba' flag for partition '%s' on disk '%s'" % \ - (p['num'], d['disk'].device)) - self.__run_parted(["-s", d['disk'].device, "set", - "%d" % p['num'], "lba", "off"]) - - def cleanup(self): - if self.disks: - for dev in self.disks.keys(): - d = self.disks[dev] - try: - d['disk'].cleanup() - except: - pass - - def __write_partition(self, num, source_file, start, size): - """ - Install source_file contents into a partition. - """ - if not source_file: # nothing to write - return - - # Start is included in the size so need to substract one from the end. - end = start + size - 1 - msger.debug("Installed %s in partition %d, sectors %d-%d, size %d sectors" % (source_file, num, start, end, size)) - - dd_cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \ - (source_file, self.image_file, self.sector_size, start, size) - exec_cmd(dd_cmd) - - - def assemble(self, image_file): - msger.debug("Installing partitions") - - self.image_file = image_file - - for p in self.partitions: - d = self.disks[p['disk_name']] - - self.__write_partition(p['num'], p['source_file'], - p['start'], p['size']) - - def create(self): - for dev in self.disks.keys(): - d = self.disks[dev] - d['disk'].create() - - self.__format_disks() - - return diff --git a/scripts/lib/wic/utils/runner.py b/scripts/lib/wic/utils/runner.py index 2ae9f417c5..4aa00fbe20 100644 --- a/scripts/lib/wic/utils/runner.py +++ b/scripts/lib/wic/utils/runner.py @@ -14,29 +14,17 @@ # 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 subprocess -from wic import msger +from wic import WicError -def runtool(cmdln_or_args, catch=1): +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) - catch: 0, quitely run - 1, only STDOUT - 2, only STDERR - 3, both STDOUT and STDERR return: - (rc, output) - if catch==0: the output will always None + rc, output """ - - if catch not in (0, 1, 2, 3): - # invalid catch selection, will cause exception, that's good - return None - if isinstance(cmdln_or_args, list): cmd = cmdln_or_args[0] shell = False @@ -45,65 +33,20 @@ def runtool(cmdln_or_args, catch=1): cmd = shlex.split(cmdln_or_args)[0] shell = True - if catch != 3: - dev_null = os.open("/dev/null", os.O_WRONLY) - - if catch == 0: - sout = dev_null - serr = dev_null - elif catch == 1: - sout = subprocess.PIPE - serr = dev_null - elif catch == 2: - sout = dev_null - serr = subprocess.PIPE - elif catch == 3: - sout = subprocess.PIPE - serr = subprocess.STDOUT + sout = subprocess.PIPE + serr = subprocess.STDOUT try: - p = subprocess.Popen(cmdln_or_args, stdout=sout, - stderr=serr, shell=shell) - (sout, serr) = p.communicate() - # combine stdout and stderr, filter None out - out = ''.join(filter(None, [sout, serr])) - except OSError, e: - if e.errno == 2: + 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 - msger.error('Cannot run command: %s, lost dependency?' % cmd) + raise WicError('Cannot run command: %s, lost dependency?' % cmd) else: raise # relay - finally: - if catch != 3: - os.close(dev_null) - - return (p.returncode, out) - -def show(cmdln_or_args): - # show all the message using msger.verbose - - rc, out = runtool(cmdln_or_args, catch=3) - - if isinstance(cmdln_or_args, list): - cmd = ' '.join(cmdln_or_args) - else: - cmd = cmdln_or_args - - msg = 'running command: "%s"' % cmd - if out: out = out.strip() - if out: - msg += ', with output::' - msg += '\n +----------------' - for line in out.splitlines(): - msg += '\n | %s' % line - msg += '\n +----------------' - - msger.verbose(msg) - return rc - -def outs(cmdln_or_args, catch=1): - # get the outputs of tools - return runtool(cmdln_or_args, catch)[1].strip() -def quiet(cmdln_or_args): - return runtool(cmdln_or_args, catch=0)[0] + return process.returncode, out diff --git a/scripts/lnr b/scripts/lnr index 9dacebe095..5fed780eb2 100755 --- a/scripts/lnr +++ b/scripts/lnr @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # Create a *relative* symlink, just like ln --relative does but without needing # coreutils 8.16. @@ -6,7 +6,7 @@ import sys, os if len(sys.argv) != 3: - print "$ lnr TARGET LINK_NAME" + print("$ lnr TARGET LINK_NAME") sys.exit(1) target = sys.argv[1] 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 9ed2721536..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 "$OE_SKIP_SDK_CHECK" -a ! -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 0ce7ed090e..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,24 +138,44 @@ 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 + METHOD="SOCKS4:$PROXY:$1:$2,socksport=$PORT" else # Assume PROXY (http, https, etc) 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 b075775b8f..6255662a4b 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # OpenEmbedded pkgdata utility # @@ -33,6 +33,7 @@ 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(): @@ -60,6 +61,7 @@ def glob(args): skipval += "|" + args.exclude skipregex = re.compile(skipval) + skippedpkgs = set() mappedpkgs = set() with open(args.pkglistfile, 'r') as f: for line in f: @@ -73,6 +75,7 @@ def glob(args): # Skip packages for which there is no point applying globs if skipregex.search(pkg): logger.debug("%s -> !!" % pkg) + skippedpkgs.add(pkg) continue # Skip packages that already match the globs, so if e.g. a dev package @@ -84,6 +87,7 @@ def glob(args): already = True break if already: + skippedpkgs.add(pkg) logger.debug("%s -> !" % pkg) continue @@ -152,23 +156,34 @@ def glob(args): logger.debug("------") - print("\n".join(mappedpkgs)) + print("\n".join(mappedpkgs - skippedpkgs)) def read_value(args): # Handle both multiple arguments and multiple values within an arg (old syntax) packages = [] - for pkgitem in args.pkg: - packages.extend(pkgitem.split()) + 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, valuename): + def readvar(pkgdata_file, valuename, mappedpkg): val = "" with open(pkgdata_file, 'r') as f: for line in f: - if line.startswith(valuename + ":"): + if (line.startswith(valuename + ":") or + line.startswith(valuename + "_" + mappedpkg + ":")): val = line.split(': ', 1)[1].rstrip() return val - logger.debug("read-value('%s', '%s' '%s'" % (args.pkgdata_dir, args.valuename, 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] @@ -178,14 +193,17 @@ def read_value(args): if os.path.exists(revlink): mappedpkg = os.path.basename(os.readlink(revlink)) qvar = args.valuename + value = readvar(revlink, qvar, mappedpkg) if qvar == "PKGSIZE": - # append packagename - qvar = "%s_%s" % (args.valuename, mappedpkg) # PKGSIZE is now in bytes, but we we want it in KB - pkgsize = (int(readvar(revlink, qvar)) + 1024 // 2) // 1024 - print("%d" % pkgsize) + pkgsize = (int(value) + 1024 // 2) // 1024 + value = "%d" % pkgsize + if args.prefix_name: + print('%s %s' % (pkg_name, value)) else: - print(readvar(revlink, qvar)) + print(value) + else: + logger.debug("revlink %s does not exist", revlink) def lookup_pkglist(pkgs, pkgdata_dir, reverse): if reverse: @@ -222,7 +240,7 @@ def lookup_pkg(args): sys.exit(1) if args.reverse: - items = mappings.values() + items = list(mappings.values()) else: items = [] for pkg in pkgs: @@ -256,6 +274,61 @@ def lookup_recipe(args): 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): @@ -362,7 +435,7 @@ def list_pkg_files(args): sys.exit(1) pkglist = args.pkg - for pkg in pkglist: + for pkg in sorted(pkglist): print("%s:" % pkg) if args.runtime: pkgdatafile = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg) @@ -414,11 +487,12 @@ def find_path(args): def main(): - parser = argparse.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 = 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', @@ -451,6 +525,13 @@ def main(): 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') @@ -461,7 +542,9 @@ def main(): 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('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', @@ -486,14 +569,17 @@ def main(): sys.exit(1) logger.debug('Found bitbake path: %s' % bitbakepath) tinfoil = tinfoil_init() - args.pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) + 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' % pkgdata_dir) + logger.error('Unable to find pkgdata directory %s' % args.pkgdata_dir) sys.exit(1) ret = args.func(args) 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 index a04e9fc96c..52366b1c8d 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (c) 2013 Intel Corporation # @@ -16,13 +16,13 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # DESCRIPTION -# This script runs tests defined in meta/lib/selftest/ +# 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" to run all the tests in in meta/lib/selftest/ -# Call the script as: "oe-selftest <module>.<Class>.<method>" to run just a single test -# E.g: "oe-selftest bboutput.BitbakeLayers" will run just the BitbakeLayers class from meta/lib/selftest/bboutput.py +# 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 @@ -30,19 +30,46 @@ import sys import unittest import logging import argparse - -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'meta/lib'))) +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.selftest.base import oeSelfTest +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='oe-selftest.log', mode='w') + fh = logging.FileHandler(filename=log_file, mode='w') fh.setLevel(logging.DEBUG) ch = logging.StreamHandler(sys.stdout) @@ -60,18 +87,38 @@ def logger_create(): log = logger_create() def get_args_parser(): - description = "Script that runs unit tests agains 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.ArgumentParser(description=description) + 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('--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('--run-all-tests', required=False, action="store_true", dest="run_all_tests", default=False, help='Run all (unhidden) tests') - group.add_argument('--list-modules', required=False, action="store_true", dest="list_modules", default=False, help='List all available test modules.') + 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"): @@ -84,7 +131,27 @@ def preflight_check(): os.chdir(builddir) if not "meta-selftest" in get_bb_var("BBLAYERS"): - log.error("You don't seem to have the meta-selftest layer in 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") @@ -93,52 +160,376 @@ def preflight_check(): return True def add_include(): - builddir = os.environ.get("BUILDDIR") + 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 selftest.inc") + "\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(): - builddir = os.environ.get("BUILDDIR") + 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"), \ - "#include added by oe-selftest.py\ninclude selftest.inc") + "\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(os.environ.get("BUILDDIR"), "conf/selftest.inc")) + 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 (AttributeError, OSError,) as e: # AttributeError may happen if BUILDDIR is not set + 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): - testslist = [] + test_modules = list() for x in exclusive_modules: - testslist.append('oeqa.selftest.' + x) - if not testslist: - testpath = os.path.abspath(os.path.dirname(oeqa.selftest.__file__)) - files = sorted([f for f in os.listdir(testpath) if f.endswith('.py') and not (f.startswith('_') and not include_hidden) and not f.startswith('__') and f != 'base.py']) - for f in files: - module = 'oeqa.selftest.' + f[:-3] - testslist.append(module) + 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() - return testslist 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 @@ -146,11 +537,11 @@ def main(): log.info('Listing all available test modules:') testslist = get_tests(include_hidden=True) for test in testslist: - module = test.split('.')[-1] + module = test.split('oeqa.selftest.')[-1] info = '' if module.startswith('_'): info = ' (hidden)' - print module + info + print(module + info) if args.list_allclasses: try: import importlib @@ -158,25 +549,29 @@ def main(): for v in vars(modlib): t = vars(modlib)[v] if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest: - print " --", v + print(" --", v) for method in dir(t): - if method.startswith("test_"): - print " -- --", method + if method.startswith("test_") and isinstance(vars(t)[method], collections.Callable): + print(" -- --", method) except (AttributeError, ImportError) as e: - print e + print(e) pass - - if args.run_tests or args.run_all_tests: + if args.run_tests or args.run_all_tests or args.run_tests_by: if not preflight_check(): return 1 - testslist = get_tests(exclusive_modules=(args.run_tests or []), include_hidden=False) + 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 = unittest.TextTestRunner(verbosity=2) + 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() @@ -189,20 +584,230 @@ def main(): log.error(e) return 1 add_include() - result = runner.run(suite) + + 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(5) + traceback.print_exc() finally: remove_include() remove_inc_files() diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir index f73aa3416d..ef495517aa 100755 --- a/scripts/oe-setup-builddir +++ b/scripts/oe-setup-builddir @@ -23,7 +23,15 @@ 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 [ ! -d "$BUILDDIR" ]; then echo >&2 "Error: The builddir ($BUILDDIR) does not exist!" @@ -35,16 +43,20 @@ if [ ! -w "$BUILDDIR" ]; then 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" if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then - TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg) + TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg") fi . $OEROOT/.templateconf if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then - echo "$TEMPLATECONF" >$BUILDDIR/conf/templateconf.cfg + echo "$TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg" fi # @@ -57,7 +69,7 @@ if [ -n "$TEMPLATECONF" ]; then TEMPLATECONF="$OEROOT/$TEMPLATECONF" fi if [ ! -d "$TEMPLATECONF" ]; then - echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf" + echo >&2 "Error: TEMPLATECONF value points to nonexistent directory '$TEMPLATECONF'" exit 1 fi fi @@ -71,15 +83,14 @@ if [ -z "$OECORELOCALCONF" ]; then OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample" fi if [ ! -r "$BUILDDIR/conf/local.conf" ]; then -cat <<EOM + 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. +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 @@ -88,9 +99,9 @@ if [ -z "$OECORELAYERCONF" ]; then fi if [ ! -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. +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 @@ -100,7 +111,7 @@ EOM # to replace it for compatibility. sed -e "s|##OEROOT##|$OEROOT|g" \ -e "s|##COREBASE##|$OEROOT|g" \ - $OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf + $OECORELAYERCONF > "$BUILDDIR/conf/bblayers.conf" SHOWYPDOC=yes fi diff --git a/scripts/oe-setup-rpmrepo b/scripts/oe-setup-rpmrepo index 917b98b984..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,7 +89,7 @@ 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" 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 index f7b2e4e0bf..04621ae8a1 100755 --- a/scripts/oepydevshell-internal.py +++ b/scripts/oepydevshell-internal.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys @@ -22,16 +22,20 @@ def cbreaknoecho(fd): old[3] = old[3] &~ termios.ECHO &~ termios.ICANON termios.tcsetattr(fd, termios.TCSADRAIN, old) -if len(sys.argv) != 3: - print("Incorrect parameters") - sys.exit(1) +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]) -# Don't buffer output by line endings -sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) -sys.stdin = os.fdopen(sys.stdin.fileno(), 'r', 0) nonblockingfd(pty) nonblockingfd(sys.stdin) @@ -41,7 +45,7 @@ readline.parse_and_bind("tab: complete") try: readline.read_history_file(histfile) except IOError: - pass + pass try: @@ -50,7 +54,7 @@ try: # 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()) + "\n") + pty.write(str(os.getpid()).encode('utf-8') + b"\n") while True: try: writers = [] @@ -59,17 +63,18 @@ try: (ready, _, _) = select.select([pty, sys.stdin], writers , [], 0) try: if pty in ready: - i = i + pty.read() + 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 = raw_input() + o = input().encode('utf-8') cbreaknoecho(sys.stdin.fileno()) - pty.write(o + "\n") + pty.write(o + b"\n") except (IOError, OSError) as e: if e.errno == 11: continue diff --git a/scripts/opkg-query-helper.py b/scripts/opkg-query-helper.py index 2fb1a78970..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 # 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 3907f25f19..bf65e19a41 100644 --- a/scripts/postinst-intercepts/update_font_cache +++ b/scripts/postinst-intercepts/update_font_cache @@ -1,7 +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 -chown -R root:root $D${localstatedir}/cache/fontconfig - +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 95bf4f90a3..5d44075fb4 100644 --- a/scripts/postinst-intercepts/update_pixbuf_cache +++ b/scripts/postinst-intercepts/update_pixbuf_cache @@ -1,11 +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 \ + $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/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py index 8c574be50c..201ce4577f 100644 --- a/scripts/pybootchartgui/pybootchartgui/draw.py +++ b/scripts/pybootchartgui/pybootchartgui/draw.py @@ -133,6 +133,16 @@ 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 STATE_RUNNING = 1 @@ -256,7 +266,7 @@ def draw_chart(ctx, color, fill, chart_bounds, data, proc_tree, data_range): # avoid divide by zero if max_y == 0: max_y = 1.0 - xscale = float (chart_bounds[2]) / max_x + 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. @@ -321,6 +331,16 @@ def extents(options, xscale, trace): 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): @@ -334,80 +354,134 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): proc_tree = options.proc_tree(trace) # render bar legend - 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 + 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) - 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 + 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.records['MemTotal'] - sample.records['MemFree'] for sample in mem_stats) + 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.records['SwapTotal'] - sample.records['SwapFree'])/1024 for sample in mem_stats]), \ + 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.records['MemTotal'] - sample.records['MemFree']) for sample in trace.mem_stats], \ + [(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.records['MemTotal'] - sample.records['MemFree'] - sample.records['Buffers']) for sample in mem_stats], \ + [(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.records['Cached']) for sample in mem_stats], \ + [(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.records['SwapTotal'] - sample.records['SwapFree'])) for sample in mem_stats], \ + [(sample.time, float(sample.swap)) for sample in mem_stats], \ proc_tree, None) curr_y = curr_y + meminfo_bar_h @@ -415,7 +489,7 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): 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 - (curr_y+header_h) + proc_h] + 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) @@ -496,6 +570,9 @@ def render(ctx, options, xscale, trace): 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 @@ -513,9 +590,6 @@ def render(ctx, options, xscale, trace): else: curr_y = off_y; - if options.charts: - curr_y = render_charts (ctx, options, clip, trace, curr_y, w, h, sec_w) - # draw process boxes proc_height = h if proc_tree.taskstats and options.cumulative: diff --git a/scripts/pybootchartgui/pybootchartgui/main.py.in b/scripts/pybootchartgui/pybootchartgui/main.py.in index 21bb0be3a7..a954b125da 100644 --- a/scripts/pybootchartgui/pybootchartgui/main.py.in +++ b/scripts/pybootchartgui/pybootchartgui/main.py.in @@ -16,8 +16,6 @@ # You should have received a copy of the GNU General Public License # along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. -from __future__ import print_function - import sys import os import optparse @@ -149,9 +147,7 @@ def main(argv=None): for time in res[4]: if time is not None: # output as ms - print(time * 10, file=f) - else: - print(file=f) + f.write(time * 10) finally: f.close() filename = _get_filename(options.output) diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py index d423b9f77c..bcfb2da569 100644 --- a/scripts/pybootchartgui/pybootchartgui/parsing.py +++ b/scripts/pybootchartgui/pybootchartgui/parsing.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>. - -from __future__ import with_statement - import os import string import re @@ -41,16 +38,18 @@ class Trace: self.min = None self.max = None self.headers = None - self.disk_stats = None + self.disk_stats = [] self.ps_stats = None self.taskstats = None - self.cpu_stats = None + self.cpu_stats = [] self.cmdline = None self.kernel = None self.kernel_tree = None self.filename = None self.parent_map = None - self.mem_stats = 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) @@ -61,6 +60,19 @@ class Trace: 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 @@ -430,7 +442,13 @@ def _parse_proc_stat_log(file): # skip the rest of statistics lines return samples -def _parse_proc_disk_stat_log(file, numCpu): +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: @@ -465,12 +483,31 @@ def _parse_proc_disk_stat_log(file, numCpu): 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 = 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. @@ -487,14 +524,37 @@ def _parse_proc_meminfo_log(file): for line in lines: match = meminfo_re.match(line) if not match: - raise ParseError("Invalid meminfo line \"%s\"" % match.groups(0)) + raise ParseError("Invalid meminfo line \"%s\"" % line) sample.add_value(match.group(1), int(match.group(2))) if sample.valid(): - mem_stats.append(sample) + 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))) + + if sample.valid(): + disk_stats.append(sample) + + 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 @@ -631,6 +691,20 @@ def _parse_cmdline_log(writer, file): cmdLines[pid] = values return cmdLines +def _parse_bitbake_buildstats(writer, state, filename, file): + paths = filename.split("/") + task = paths[-1] + pn = paths[-2] + start = None + end = None + for line in file: + if line.startswith("Started:"): + start = int(float(line.split()[-1])) + elif line.startswith("Ended:"): + end = int(float(line.split()[-1])) + 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 @@ -650,18 +724,25 @@ def get_num_cpus(headers): def _do_parse(writer, state, filename, file): writer.info("parsing '%s'" % filename) t1 = clock() - paths = filename.split("/") - task = paths[-1] - pn = paths[-2] - start = None - end = None - for line in file: - if line.startswith("Started:"): - start = int(float(line.split()[-1])) - elif line.startswith("Ended:"): - end = int(float(line.split()[-1])) - if start and end: - state.add_process(pn + ":" + task, start, end) + 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 diff --git a/scripts/pybootchartgui/pybootchartgui/samples.py b/scripts/pybootchartgui/pybootchartgui/samples.py index 015d743aa0..9fc309b3ab 100644 --- a/scripts/pybootchartgui/pybootchartgui/samples.py +++ b/scripts/pybootchartgui/pybootchartgui/samples.py @@ -53,6 +53,33 @@ class MemSample: # 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 diff --git a/scripts/pythondeps b/scripts/pythondeps index ff92e747ed..590b9769e7 100755 --- a/scripts/pythondeps +++ b/scripts/pythondeps @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Determine dependencies of python scripts or available python modules in a search path. # @@ -187,7 +187,7 @@ 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.iteritems(): + for filename, provide in provides.items(): if os.path.isdir(filename): filename = os.path.join(filename, '__init__.py') ispkg = True diff --git a/scripts/recipetool b/scripts/recipetool index 2cfa763201..3765ec7cf9 100755 --- a/scripts/recipetool +++ b/scripts/recipetool @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Recipe creation tool # @@ -27,20 +27,18 @@ 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(): +def tinfoil_init(parserecipes): import bb.tinfoil import logging - tinfoil = bb.tinfoil.Tinfoil() - tinfoil.prepare(True) - - for plugin in plugins: - if hasattr(plugin, 'tinfoil_init'): - plugin.tinfoil_init(tinfoil) - tinfoil.logger.setLevel(logging.WARNING) + tinfoil = bb.tinfoil.Tinfoil(tracking=True) + tinfoil.prepare(not parserecipes) + tinfoil.logger.setLevel(logger.getEffectiveLevel()) + return tinfoil def main(): @@ -48,29 +46,25 @@ def main(): 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.ArgumentParser(description="OpenEmbedded recipe tool", - epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + 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') - subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') - scriptutils.load_plugins(logger, plugins, os.path.join(scripts_path, 'lib', 'recipetool')) - registered = False - for plugin in plugins: - if hasattr(plugin, 'register_command'): - registered = True - plugin.register_command(subparsers) - - if not registered: - logger.error("No commands registered - missing plugins?") - sys.exit(1) + global_args, unparsed_args = parser.parse_known_args() - args = parser.parse_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 args.debug: + if global_args.debug: logger.setLevel(logging.DEBUG) - elif args.quiet: + elif global_args.quiet: logger.setLevel(logging.ERROR) import scriptpath @@ -79,12 +73,45 @@ def main(): 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, args.color) - - tinfoil_init() + scriptutils.logger_setup_color(logger, global_args.color) - ret = args.func(args) + 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 @@ -95,5 +122,5 @@ if __name__ == "__main__": except Exception: ret = 1 import traceback - traceback.print_exc(5) + traceback.print_exc() sys.exit(ret) diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py index b2dd258c34..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 # @@ -103,6 +103,8 @@ def change_interpreter(elf_file_name): 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)) @@ -112,7 +114,7 @@ def change_interpreter(elf_file_name): f.write(dl_path) break -def change_dl_sysdirs(): +def change_dl_sysdirs(elf_file_name): if arch == 32: sh_fmt = "<IIIIIIIIII" else: @@ -156,12 +158,33 @@ def change_dl_sysdirs(): 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 += 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(b("\0")) sysdirs = b("") @@ -229,7 +252,7 @@ for e in executables_list: if arch: parse_elf_header() change_interpreter(e) - change_dl_sysdirs() + change_dl_sysdirs(e) """ change permissions back """ if perms: 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 1277e82dd9..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,497 +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 environment variables (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 ext4" - 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="" -KVM_ENABLED="no" -KVM_ACTIVE="no" - -# 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. -while true; do - arg=${1} - case "$arg" in - "qemux86" | "qemux86-64" | "qemuarm" | "qemuarm64" | "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" - ;; - "biosdir="*) - CUSTOMBIOSDIR="${arg##biosdir=}" - ;; - "biosfilename="*) - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -bios ${arg##biosfilename=}" - ;; - "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\)'` - vga_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-vga\)'` - [ ! -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 -n 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'` - 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 -n 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'` - 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" - 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 - if [ "$SLIRP_ENABLED" != "yes" ] ; 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 -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=ext4 - -QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin -QEMUX86_64_DEFAULT_FSTYPE=ext4 - -QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin -QEMUARM_DEFAULT_FSTYPE=ext4 - -QEMUARM64_DEFAULT_KERNEL=Image-qemuarm64.bin -QEMUARM64_DEFAULT_FSTYPE=ext4 - -QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin -QEMUMIPS_DEFAULT_FSTYPE=ext4 - -QEMUMIPSEL_DEFAULT_KERNEL=vmlinux-qemumipsel.bin -QEMUMIPSEL_DEFAULT_FSTYPE=ext4 - -QEMUMIPS64_DEFAULT_KERNEL=vmlinux-qemumips64.bin -QEMUMIPS64_DEFAULT_FSTYPE=ext4 - -QEMUSH4_DEFAULT_KERNEL=vmlinux-qemumips.bin -QEMUSH4_DEFAULT_FSTYPE=ext4 - -QEMUPPC_DEFAULT_KERNEL=vmlinux-qemuppc.bin -QEMUPPC_DEFAULT_FSTYPE=ext4 - -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_path_vars() { - if [ -z "$OE_TMPDIR" ] ; then - PATHS_REQUIRED=true - elif [ "$1" = "1" -a -z "$DEPLOY_DIR_IMAGE" ] ; then - PATHS_REQUIRED=true - else - PATHS_REQUIRED=false - fi - - if [ "$PATHS_REQUIRED" = "true" ]; then - # Try to get the variable values 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 the variable values from bitbake - BITBAKE_ENV_TMPFILE=`mktemp --tmpdir runqemu.XXXXXXXXXX` - if [ "$?" != "0" ] ; then - echo "Error: mktemp failed for bitbake environment output" - exit 1 - fi - - MACHINE=$MACHINE bitbake -e > $BITBAKE_ENV_TMPFILE - if [ -z "$OE_TMPDIR" ] ; then - OE_TMPDIR=`sed -n 's/^TMPDIR=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE` - fi - if [ -z "$DEPLOY_DIR_IMAGE" ] ; then - DEPLOY_DIR_IMAGE=`sed -n 's/^DEPLOY_DIR_IMAGE=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE` - fi - if [ -z "$OE_TMPDIR" ]; then - # Check for errors from bitbake that the user needs to know about - BITBAKE_OUTPUT=`cat $BITBAKE_ENV_TMPFILE | wc -l` - if [ "$BITBAKE_OUTPUT" -eq "0" ]; then - echo "Error: this script needs to be run from your build directory, or you need" - echo "to explicitly set OE_TMPDIR and DEPLOY_DIR_IMAGE in your environment" - else - echo "There was an error running bitbake to determine TMPDIR" - echo "Here is the output from 'bitbake -e':" - cat $BITBAKE_ENV_TMPFILE - fi - rm $BITBAKE_ENV_TMPFILE - exit 1 - fi - rm $BITBAKE_ENV_TMPFILE - 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_path_vars - 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. - filename=`ls -t1 $where/*-image*$machine.$extension 2>/dev/null | head -n1` - if [ "x$filename" != "x" ]; then - ROOTFS=$filename - return - fi - - 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_path_vars 1 - eval kernel_file=\$${machine2}_DEFAULT_KERNEL - KERNEL=$DEPLOY_DIR_IMAGE/$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_path_vars 1 - echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE" - ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE -fi - -if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then - setup_path_vars 1 - T=$DEPLOY_DIR_IMAGE - 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, now expand it to be an absolute path, it should exist at this point - -ROOTFS=`readlink -f $ROOTFS` - -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 - -# Specify directory for BIOS, VGA BIOS and keymaps -if [ ! -z "$CUSTOMBIOSDIR" ]; then - if [ -d "$OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" ]; then - echo "Assuming biosdir is $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" - else - if [ ! -d "$CUSTOMBIOSDIR" ]; then - echo "Custom BIOS directory not found. Tried: $CUSTOMBIOSDIR" - echo "and $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" - exit 1; - fi - echo "Assuming biosdir is $CUSTOMBIOSDIR" - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $CUSTOMBIOSDIR" - fi -fi - -. $INTERNAL_SCRIPT -exit $? +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 + + 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 40ab20143f..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/unfsd" ]; then - echo "Error: Unable to find unfsd 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,23 +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 -UNFSD_OPTS="-p -N -i $NFSPID -e $EXPORTS -x $NFS_NFSPROG -n $NFS_PORT -y $NFS_MOUNTPROG -m $MOUNT_PORT" - -# 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 @@ -114,9 +108,12 @@ case "$1" in 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/unfsd $UNFSD_OPTS" - $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/unfsd $UNFSD_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 diff --git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk index 32ddd485b6..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 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 8f66cfa2a9..ffbc9de442 100755 --- a/scripts/runqemu-ifdown +++ b/scripts/runqemu-ifdown @@ -41,11 +41,11 @@ 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 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 6594dc33ec..0000000000 --- a/scripts/runqemu-internal +++ /dev/null @@ -1,693 +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=256 - ;; - "qemux86-64") - mem_size=256 - ;; - "qemuarm") - mem_size=128 - ;; - "qemuarm64") - mem_size=512 - ;; - "qemumicroblaze") - mem_size=64 - ;; - "qemumips"|"qemumips64") - mem_size=256 - ;; - "qemuppc") - mem_size=256 - ;; - "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="ip=dhcp" - 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 2>/dev/null - if [ $? -ne 0 ]; then - echo "Acquiring lockfile for $lockfile.lock failed" - return 1 - fi - 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="" - USE_PRECONF_TAP="no" - for tap in $POSSIBLE; do - LOCKFILE="$LOCKDIR/$tap" - if [ -e "$LOCKFILE.skip" ]; then - echo "Found $LOCKFILE.skip, skipping $tap" - continue - fi - echo "Acquiring lockfile for $tap..." - acquire_lock $LOCKFILE - if [ $? -eq 0 ]; then - TAP=$tap - USE_PRECONF_TAP="yes" - 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'" - echo "If this is not intended, touch $LOCKFILE.skip to make runqemu skip $TAP." - fi - - cleanup() { - if [ ! -e "$NOSUDO_FLAG" -a "$USE_PRECONF_TAP" = "no" ]; 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 - if [ "$MACHINE" = "qemuarm64" ]; then - QEMU_NETWORK_CMD="-netdev tap,id=net0,ifname=$TAP,script=no,downscript=no -device virtio-net-device,netdev=net0 " - DROOT="/dev/vda" - ROOTFS_OPTIONS="-drive id=disk0,file=$ROOTFS -device virtio-blk-device,drive=disk0" - fi - - KERNCMDLINE="mem=$QEMU_MEMORY" - QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" - if [ $MACHINE = 'qemuarm64' ]; then - QEMU_UI_OPTIONS="-nographic" - fi - - 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") ;; - "qemuarm64") ;; - "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 [ "$NFS_SERVER" = "" ]; then - NFS_SERVER="192.168.7.1" - if [ "$SLIRP_ENABLED" = "yes" ]; then - NFS_SERVER="10.0.2.2" - fi -fi - -if [ "$FSTYPE" = "nfs" ]; then - NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'` - if [ "$NFS_INSTANCE" = "" ] ; then - NFS_INSTANCE=0 - fi - 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=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,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 - return 1 - fi - NFSRUNNING="true" -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" = "qemuarm64" ]; then - QEMU=qemu-system-aarch64 - - export QEMU_AUDIO_DRV="none" - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" - if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then - KERNCMDLINE="root=/dev/vda rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD" - # qemu-system-aarch64 only support '-machine virt -cpu cortex-a57' for now - QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $ROOTFS_OPTIONS $QEMU_UI_OPTIONS" - fi -fi - - -if [ "$MACHINE" = "qemux86" ]; then - QEMU=qemu-system-i386 - if [ "$KVM_ACTIVE" = "yes" ]; then - CPU_SUBTYPE=kvm32 - else - CPU_SUBTYPE=qemu32 - fi - if [ ! -z "$vga_option" ]; then - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" - else - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware" - fi - 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 -cpu $CPU_SUBTYPE $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 - if [ "$KVM_ACTIVE" = "yes" ]; then - CPU_SUBTYPE=kvm64 - else - CPU_SUBTYPE=core2duo - fi - if [ ! -z "$vga_option" ]; then - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" - else - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware" - fi - 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 -cpu $CPU_SUBTYPE $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 -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS" - fi - if [ "$FSTYPE" = "vmdk" ]; then - QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $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 [ "${FSTYPE:0:3}" = "ext" ]; then - KERNCMDLINE="$KERNCMDLINE rootfstype=$FSTYPE" -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 console=ttyS0 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 index 1a1b96580d..15b5e84911 100755 --- a/scripts/send-error-report +++ b/scripts/send-error-report @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Sends an error report (if the report-error class was enabled) to a # remote server. @@ -7,7 +7,7 @@ # Author: Andreea Proca <andreea.b.proca@intel.com> # Author: Michael Wood <michael.g.wood@intel.com> -import urllib2 +import urllib.request, urllib.error import sys import json import os @@ -15,16 +15,20 @@ 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 = urllib2.Request(url, None) + req = urllib.request.Request(url, None) try: - response = urllib2.urlopen(req) - except urllib2.URLError as e: + 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) @@ -40,12 +44,12 @@ def getPayloadLimit(url): def ask_for_contactdetails(): print("Please enter your name and your email (optionally), they'll be saved in the file you send.") - username = raw_input("Name (required): ") - email = raw_input("E-mail (not required): ") + username = input("Name (required): ") + email = input("E-mail (not required): ") return username, email def edit_content(json_file_path): - edit = raw_input("Review information before sending? (y/n): ") + edit = input("Review information before sending? (y/n): ") if 'y' in edit or 'Y' in edit: editor = os.environ.get('EDITOR', None) if editor: @@ -104,7 +108,7 @@ def prepare_data(args): if max_log_size != 0: for fail in jsondata['failures']: if len(fail['log']) > max_log_size: - print "Truncating log to allow for upload" + print("Truncating log to allow for upload") fail['log'] = fail['log'][-max_log_size:] data = json.dumps(jsondata, indent=4, sort_keys=True) @@ -121,7 +125,7 @@ def prepare_data(args): with open(args.error_file, 'r') as json_fp: data = json_fp.read() - return data + return data.encode('utf-8') def send_data(data, args): @@ -132,18 +136,18 @@ def send_data(data, args): else: url = "http://"+args.server+"/ClientPost/" - req = urllib2.Request(url, data=data, headers=headers) + req = urllib.request.Request(url, data=data, headers=headers) try: - response = urllib2.urlopen(req) - except urllib2.HTTPError, e: + response = urllib.request.urlopen(req) + except urllib.error.HTTPError as e: logging.error(e.reason) sys.exit(1) - print response.read() + print(response.read()) if __name__ == '__main__': - arg_parse = argparse.ArgumentParser(description="This scripts will send an error report to your specified error-report-web server.") + 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", @@ -188,7 +192,7 @@ if __name__ == '__main__': args = arg_parse.parse_args() if (args.json == False): - print "Preparing to send errors to: "+args.server + print("Preparing to send errors to: "+args.server) data = prepare_data(args) send_data(data, args) 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 2286765ebd..2ab450ab59 100755 --- a/scripts/sstate-cache-management.sh +++ b/scripts/sstate-cache-management.sh @@ -101,7 +101,7 @@ do_nothing () { # Read the input "y" read_confirm () { - echo "$total_deleted from $total_files files will be removed! " + echo "$total_deleted out of $total_files files will be removed! " if [ "$confirm" != "y" ]; then echo "Do you want to continue (y/n)? " while read confirm; do @@ -282,7 +282,7 @@ remove_duplicated () { 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 from $total_tgz_suffix .tgz files for $suffix suffix will be removed or $deleted_files from $total_files_suffix when counting also .siginfo and .done files)" + 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 diff --git a/scripts/sstate-sysroot-cruft.sh b/scripts/sstate-sysroot-cruft.sh index f62485eaaa..b6166aa1b2 100755 --- a/scripts/sstate-sysroot-cruft.sh +++ b/scripts/sstate-sysroot-cruft.sh @@ -90,6 +90,12 @@ WHITELIST="${WHITELIST} \ WHITELIST="${WHITELIST} \ .*\.pyc \ .*\.pyo \ + .*/__pycache__ \ +" + +# generated by lua +WHITELIST="${WHITELIST} \ + .*\.luac \ " # generated by sgml-common-native @@ -97,6 +103,16 @@ 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 \ @@ -106,6 +122,35 @@ WHITELIST="${WHITELIST} \ 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/" 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 index ac26367e77..ffe254728b 100755 --- a/scripts/sysroot-relativelinks.py +++ b/scripts/sysroot-relativelinks.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import os @@ -24,7 +24,7 @@ def handlelink(filep, subdir): os.symlink(os.path.relpath(topdir+link, subdir), filep) for subdir, dirs, files in os.walk(topdir): - for f in files: + for f in dirs + files: filep = os.path.join(subdir, f) if os.path.islink(filep): #print("Considering %s" % filep) 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 0170947f0e..0b94de8608 100755 --- a/scripts/test-dependencies.sh +++ b/scripts/test-dependencies.sh @@ -141,7 +141,7 @@ build_all() { 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' | sort -u > ${OUTPUT1}/failed-recipes.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() { @@ -178,7 +178,7 @@ build_every_recipe() { 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' >> ${OUTPUTB}/failed-recipes.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 diff --git a/scripts/test-remote-image b/scripts/test-remote-image index f3a44ebe51..27b1cae38f 100755 --- a/scripts/test-remote-image +++ b/scripts/test-remote-image @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (c) 2014 Intel Corporation # @@ -38,6 +38,7 @@ 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() @@ -82,7 +83,7 @@ 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.ArgumentParser(description=description) + 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.') @@ -91,13 +92,11 @@ def get_args_parser(): 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): +class BaseTargetProfile(object, metaclass=ABCMeta): """ This class defines the meta profile for a specific target (MACHINE type + image type). """ - __metaclass__ = ABCMeta - def __init__(self, image_type): self.image_type = image_type @@ -190,13 +189,11 @@ class AutoTargetProfile(BaseTargetProfile): return controller.get_extra_files() -class BaseRepoProfile(object): +class BaseRepoProfile(object, metaclass=ABCMeta): """ This class defines the meta profile for an images repository. """ - __metaclass__ = ABCMeta - def __init__(self, repolink, localdir): self.localdir = localdir self.repolink = repolink @@ -288,7 +285,7 @@ class HwAuto(): 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 + print(testimage_results) return result # Start the procedure! @@ -356,5 +353,5 @@ if __name__ == "__main__": except Exception: ret = 1 import traceback - traceback.print_exc(5) + traceback.print_exc() sys.exit(ret) diff --git a/scripts/tiny/dirsize.py b/scripts/tiny/dirsize.py index 40ff4ab895..ddccc5a8c8 100755 --- a/scripts/tiny/dirsize.py +++ b/scripts/tiny/dirsize.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2011, Intel Corporation. # All rights reserved. @@ -52,26 +52,22 @@ class Record: self.size = 0 self.records = [] - def __cmp__(this, that): + def __lt__(this, that): if that is None: - return 1 + return False if not isinstance(that, Record): raise TypeError if len(this.records) > 0 and len(that.records) == 0: - return -1 - if len(this.records) == 0 and len(that.records) > 0: - return 1 - if this.size < that.size: - return -1 + return False if this.size > that.size: - return 1 - return 0 + return False + return True def show(self, minsize): total = 0 if self.size <= minsize: return 0 - print "%10d %s" % (self.size, self.path) + print("%10d %s" % (self.size, self.path)) for r in self.records: total += r.show(minsize) if len(self.records) == 0: @@ -85,8 +81,8 @@ def main(): 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) + print("Displayed %d/%d bytes (%.2f%%)" % \ + (total, rootfs.size, 100 * float(total) / rootfs.size)) if __name__ == "__main__": diff --git a/scripts/tiny/ksize.py b/scripts/tiny/ksize.py index 4006f2f6f1..ea1ca7ff23 100755 --- a/scripts/tiny/ksize.py +++ b/scripts/tiny/ksize.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2011, Intel Corporation. # All rights reserved. @@ -28,22 +28,20 @@ import sys import getopt import os from subprocess import * -from string import join - 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) + 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 " + glob, shell=True, stdout=PIPE, stderr=PIPE) + 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] @@ -55,8 +53,8 @@ class Sizes: 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) + print("%-32s %10d | %10d %10d %10d" % \ + (indent+self.title, self.total, self.text, self.data, self.bss)) class Report: @@ -64,18 +62,18 @@ class Report: r = Report(filename, title) path = os.path.dirname(filename) - p = Popen("ls " + path + "/*.o | grep -v built-in.o", + 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, path + "/*.o") - oreport.sizes.title = path + "/*.o" + 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, path + "/*/built-in.o")) + r.parts.append(Report.create(f, path, str(path) + "/*/built-in.o")) r.parts.sort(reverse=True) for b in r.parts: @@ -101,22 +99,29 @@ class Report: def show(self, indent=""): rule = str.ljust(indent, 80, '-') - print "%-32s %10s | %10s %10s %10s" % \ - (indent+self.title, "total", "text", "data", "bss") - print rule + print("%-32s %10s | %10s %10s %10s" % \ + (indent+self.title, "total", "text", "data", "bss")) + print(rule) self.sizes.show(indent) - print rule + print(rule) for p in self.parts: if p.sizes.total > 0: p.sizes.show(indent) - print rule - print "%-32s %10d | %10d %10d %10d" % \ + 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" % \ + 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" + 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: @@ -133,8 +138,8 @@ class Report: def main(): try: opts, args = getopt.getopt(sys.argv[1:], "dh", ["help"]) - except getopt.GetoptError, err: - print '%s' % str(err) + except getopt.GetoptError as err: + print('%s' % str(err)) usage() sys.exit(2) 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 index e7df60f28e..a5f2dbfc6f 100755 --- a/scripts/wic +++ b/scripts/wic @@ -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 -*- # @@ -28,31 +28,61 @@ # AUTHORS # Tom Zanussi <tom.zanussi (at] linux.intel.com> # - -__version__ = "0.1.0" +__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(os.path.abspath(sys.argv[0]))) +scripts_path = os.path.abspath(os.path.dirname(__file__)) lib_path = scripts_path + '/lib' -sys.path = sys.path + [lib_path] +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) -from image.help import * -from image.engine import * + return logger + +logger = wic_logger() def rootfs_dir_to_args(krootfs_dir): """ Get a rootfs_dir dict and serialize to string """ rootfs_dir = '' - for k, v in krootfs_dir.items(): + for key, val in krootfs_dir.items(): rootfs_dir += ' ' - rootfs_dir += '='.join([k, v]) + rootfs_dir += '='.join([key, val]) return rootfs_dir.strip() def callback_rootfs_dir(option, opt, value, parser): @@ -65,8 +95,8 @@ def callback_rootfs_dir(option, opt, value, parser): if '=' in value: (key, rootfs_dir) = value.split('=') else: - key = 'ROOTFS_DIR' - rootfs_dir = value + key = 'ROOTFS_DIR' + rootfs_dir = value parser.values.rootfs_dir[key] = rootfs_dir @@ -75,79 +105,115 @@ 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", - action = "store", help = "name of directory to create image in") - parser.add_option("-i", "--infile", dest = "properties_file", - action = "store", help = "name of file containing the values for image properties as a JSON file") - parser.add_option("-e", "--image-name", dest = "image_name", - action = "store", help = "name of the image to use the artifacts from e.g. core-image-sato") - parser.add_option("-r", "--rootfs-dir", dest = "rootfs_dir", - action = "callback", callback = callback_rootfs_dir, type = "string", - help = "path to the /rootfs dir to use as the .wks rootfs source") - parser.add_option("-b", "--bootimg-dir", dest = "bootimg_dir", - action = "store", 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", - action = "store", help = "path to the dir containing the kernel to use in the .wks bootimg") - parser.add_option("-n", "--native-sysroot", dest = "native_sysroot", - action = "store", help = "path to the native sysroot containing the tools to use to build the image") - parser.add_option("-p", "--skip-build-check", dest = "build_check", - action = "store_false", default = True, help = "skip the build check") - parser.add_option("-D", "--debug", dest = "debug", action = "store_true", - default = False, help = "output debug information") + 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: - logging.error("Wrong number of arguments, exiting\n") parser.print_help() - sys.exit(1) + raise WicError("Wrong number of arguments, exiting") - if not options.image_name and not (options.rootfs_dir and - options.bootimg_dir and - options.kernel_dir and - options.native_sysroot): - print "Build artifacts not completely specified, exiting." - print " (Use 'wic -e' or 'wic -r -b -k -n' to specify artifacts)" - sys.exit(1) + 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: - options.build_check = False + 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.build_check and not options.properties_file: - print "Checking basic build environment..." - if not verify_build_env(): - print "Couldn't verify build environment, exiting\n" - sys.exit(1) - else: - print "Done.\n" + if options.image_name: + BB_VARS.default_image = options.image_name + else: + options.build_check = False - print "Creating image(s)...\n" + if options.vars_dir: + BB_VARS.vars_dir = options.vars_dir - bitbake_env_lines = find_bitbake_env_lines(options.image_name) - if not bitbake_env_lines: - print "Couldn't get bitbake environment, exiting." - sys.exit(1) - set_bitbake_env_lines(bitbake_env_lines) + if options.build_check and not engine.verify_build_env(): + raise WicError("Couldn't verify build environment, exiting") - bootimg_dir = "" + if options.debug: + logger.setLevel(logging.DEBUG) if options.image_name: - (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) \ - = find_artifacts(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 = find_canned_image(scripts_path, wks_file) + wks_file = engine.find_canned_image(scripts_path, wks_file) if not wks_file: - print "No image named %s found, exiting. (Use 'wic list images' to list available images, or specify a fully-qualified OE kickstart (.wks) filename)\n" % wks_file - sys.exit(1) - - image_output_dir = "" - if options.outdir: - image_output_dir = options.outdir + 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 = '' @@ -157,17 +223,13 @@ def wic_create_subcommand(args, usage_str): kernel_dir = options.kernel_dir native_sysroot = options.native_sysroot if rootfs_dir and not os.path.isdir(rootfs_dir): - print "--roofs-dir (-r) not found, exiting\n" - sys.exit(1) + raise WicError("--rootfs-dir (-r) not found, exiting") if not os.path.isdir(bootimg_dir): - print "--bootimg-dir (-b) not found, exiting\n" - sys.exit(1) + raise WicError("--bootimg-dir (-b) not found, exiting") if not os.path.isdir(kernel_dir): - print "--kernel-dir (-k) not found, exiting\n" - sys.exit(1) + raise WicError("--kernel-dir (-k) not found, exiting") if not os.path.isdir(native_sysroot): - print "--native-sysroot (-n) not found, exiting\n" - sys.exit(1) + raise WicError("--native-sysroot (-n) not found, exiting") else: not_found = not_found_dir = "" if not os.path.isdir(rootfs_dir): @@ -179,49 +241,35 @@ def wic_create_subcommand(args, usage_str): if not_found: if not not_found_dir: not_found_dir = "Completely missing artifact - wrong image (.wks) used?" - print "Build artifacts not found, exiting." - print " (Please check that the build artifacts for the machine" - print " selected in local.conf actually exist and that they" - print " are the correct artifacts for the image (.wks file)).\n" - print "The artifact that couldn't be found was %s:\n %s" % \ - (not_found, not_found_dir) - sys.exit(1) + 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 + krootfs_dir = {} + krootfs_dir['ROOTFS_DIR'] = rootfs_dir rootfs_dir = rootfs_dir_to_args(krootfs_dir) - wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir, - native_sysroot, scripts_path, image_output_dir, - options.debug, options.properties_file) + 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 image properties and - values. The real work is done by image.engine.wic_list() + Command-line handling for listing available images. + The real work is done by image.engine.wic_list() """ - parser = optparse.OptionParser(usage = usage_str) - - parser.add_option("-o", "--outfile", action = "store", - dest = "properties_file", - help = "dump the possible values for image properties to a JSON file") - - (options, args) = parser.parse_args(args) + parser = optparse.OptionParser(usage=usage_str) + args = parser.parse_args(args)[1] - bitbake_env_lines = find_bitbake_env_lines(None) - if not bitbake_env_lines: - print "Couldn't get bitbake environment, exiting." - sys.exit(1) - set_bitbake_env_lines(bitbake_env_lines) - - if not wic_list(args, scripts_path, options.properties_file): - logging.error("Bad list arguments, exiting\n") + if not engine.wic_list(args, scripts_path): parser.print_help() - sys.exit(1) + raise WicError("Bad list arguments, exiting") def wic_help_topic_subcommand(args, usage_str): @@ -239,50 +287,44 @@ wic_help_topic_usage = """ subcommands = { "create": [wic_create_subcommand, - wic_create_usage, - wic_create_help], + hlp.wic_create_usage, + hlp.wic_create_help], "list": [wic_list_subcommand, - wic_list_usage, - wic_list_help], + hlp.wic_list_usage, + hlp.wic_list_help], "plugins": [wic_help_topic_subcommand, wic_help_topic_usage, - wic_plugins_help], - "overview": [wic_help_topic_subcommand, + hlp.get_wic_plugins_help], + "overview": [wic_help_topic_subcommand, wic_help_topic_usage, - wic_overview_help], - "kickstart": [wic_help_topic_subcommand, + hlp.wic_overview_help], + "kickstart": [wic_help_topic_subcommand, wic_help_topic_usage, - wic_kickstart_help], + hlp.wic_kickstart_help], } -def start_logging(loglevel): - logging.basicConfig(filname = 'wic.log', filemode = 'w', level=loglevel) - - -def main(): - parser = optparse.OptionParser(version = "wic version %s" % __version__, - usage = wic_usage) +def main(argv): + parser = optparse.OptionParser(version="wic version %s" % __version__, + usage=hlp.wic_usage) parser.disable_interspersed_args() - (options, args) = parser.parse_args() + args = parser.parse_args(argv)[1] if len(args): if args[0] == "help": if len(args) == 1: parser.print_help() - sys.exit(1) + raise WicError("help command requires parameter") - invoke_subcommand(args, parser, wic_help_usage, subcommands) + return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands) if __name__ == "__main__": try: - ret = main() - except Exception: - ret = 1 - import traceback - traceback.print_exc(5) - sys.exit(ret) - + 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 c22d39a405..0000000000 --- a/scripts/wipe-sysroot +++ /dev/null @@ -1,54 +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 - -if [ $# -gt 0 ]; then - echo "Wipe all sysroots and sysroot-related stamps for the current build directory." >&2 - echo "Usage: $0" >&2 - exit 1 -fi - -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 from bitbake, check above for errors" - exit 1 -fi - -echo "Deleting the sysroots in $STAGING_DIR, and selected stamps in $SSTATE_MANIFESTS and $STAMPS_DIR." - -# 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.* -rm -rf $STAMPS_DIR/*/*/*.do_packagedata.* -rm -rf $STAMPS_DIR/*/*/*.do_packagedata_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) |
