From c6c745e8573b8b8df3b9cf673532263608969de1 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Tue, 17 Aug 2010 16:13:46 -0700 Subject: Fix up chain building We were not setting up the chains right, and our logging was all funky. We now handle chains properly and log it sensibly --- src/fedpkg.py | 23 ++++++++++++++++------- src/pyfedpkg/__init__.py | 8 +++++--- 2 files changed, 21 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/fedpkg.py b/src/fedpkg.py index f5cee54..ae829fa 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -344,29 +344,38 @@ def chainbuild(args): if mymodule.module in args.package: log.error('%s must not be in the chain' % mymodule.module) sys.exit(1) + # make sure we didn't get an empty chain + if args.package == [':']: + log.error('Must provide at least one dependency build') + sys.exit(1) # Break the chain up into sections urls = [] build_set = [] log.debug('Processing chain %s' % ' '.join(args.package)) for component in args.package: if component == ':': - if build_set: - # We've hit the end of a set, add the set as a unit to the - # url list and reset the build_set. - urls.append(build_set) - log.debug('Created a build set: %s' % ' '.join(build_set)) - build_set = [] + # We've hit the end of a set, add the set as a unit to the + # url list and reset the build_set. + urls.append(build_set) + log.debug('Created a build set: %s' % ' '.join(build_set)) + build_set = [] else: # Figure out the scm url to build from package name try: hash = pyfedpkg.get_latest_commit(component) url = pyfedpkg.ANONGITURL % {'module': component} + '#%s' % hash - build_set.append(url) except pyfedpkg.FedpkgError, e: log.error('Could not get a build url for %s: %s' % (component, e)) sys.exit(1) + # If there are no ':' in the chain list, treat each object as an + # individual chain + if ':' in args.package: + build_set.append(url) + else: + urls.append([url]) + log.debug('Created a build set: %s' % url) # Take care of the last build set if we have one if build_set: log.debug('Created a build set: %s' % ' '.join(build_set)) diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 9a5abc9..775306f 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -967,10 +967,12 @@ class PackageModule: # Handle the chain build version if chain: log.debug('Adding %s to the chain' % url) - chain[-1].append(url) - cmd.append(url) + chain.append([url]) + # This next list comp is ugly, but it's how we properly get a : + # put in between each build set + cmd.extend(' : '.join([' '.join(sets) for sets in chain]).split()) log.info('Chain building %s + %s for %s' % (self.nvr, - chain, + chain[:-1], self.target)) log.debug('Building chain %s for %s with options %s and a ' \ 'priority of %s' % -- cgit