def run(self): from pisi.operations.delta import create_delta_package self.init(database=False, write=False) if len(self.args) != 2: self.help() return if ctx.get_option('output_dir'): ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) else: ctx.ui.info(_('Outputting packages in the working directory.')) ctx.config.options.output_dir = '.' oldpackage = self.args[0] newpackage = self.args[1] create_delta_package(oldpackage, newpackage)
def run(self): from pisi.operations.delta import create_delta_package self.init(database=False, write=False) if len(self.args) != 2: self.help() return if ctx.get_option('output_dir'): ctx.ui.info( _('Output directory: %s') % ctx.config.options.output_dir) else: ctx.ui.info(_('Outputting packages in the working directory.')) ctx.config.options.output_dir = '.' oldpackage = self.args[0] newpackage = self.args[1] create_delta_package(oldpackage, newpackage)
def delta(self, isopackages, oldBinaryPackages, newBinaryPackages): # If we don't want to generate delta packages, return empty lists if not config.generateDelta: return ([], []) logger.debug("delta() -> oldBinaryPackages: %s" % oldBinaryPackages) logger.debug("delta() -> newBinaryPackages: %s" % newBinaryPackages) brandNewBinaryPackages = [] # We should keep a list of the blacklisted packages and return them back # for being able to install their full packages correctly in case of a # 1->many source pisi package. blacklisted_packages = [] for p in newBinaryPackages: if not getName(p) in [getName(pa) for pa in oldBinaryPackages]: brandNewBinaryPackages.append(p) map(newBinaryPackages.remove, brandNewBinaryPackages) # brandNew contains the possible first builds # Just add those to the end of newBinaryPackages for # correct delta generation.. oldBinaryPackages.sort() newBinaryPackages.sort() newBinaryPackages.extend(brandNewBinaryPackages) # Delta packages to be installed on farm for upgrading to new packages deltas_to_install = [] # Other delta packages (between older builds or iso builds) delta_packages = [] for pl in zip(oldBinaryPackages, newBinaryPackages): # zip() returns [] if oldBinaryPackages is empty. logger.debug("Current (old,new) tuple is: %s" % str(pl)) # Parse the name of the new package name = getName(os.path.basename(pl[1])) if name in config.deltaBlacklist: logger.debug("Skipping %s as it's blacklisted.." % name) blacklisted_packages.append(os.path.basename(pl[1])) continue # Full path of the new package p = os.path.join(config.workDir, pl[1]) # Look for an old build first if pl[0]: # Create a delta between the old build and the new one logger.info("Building delta between %s[previous build] and %s." % (pl[0], pl[1])) deltas_to_install.append(create_delta_package(os.path.join(config.binaryPath, pl[0]), p)) if isopackages.has_key(name) and isopackages[name] != pl[0]: # Build delta between ISO build and current build package = os.path.join(config.binaryPath, isopackages[name]) if os.path.exists(package): logger.info("Building delta between %s[ISO] and %s." % (isopackages[name], pl[1])) delta_packages.append(create_delta_package(package, p)) # Search for an older build (older < previous) previous = self.getPreviousBuild(pl[0]) if previous and previous != isopackages.get(name): # Found build (older-1) logger.info("Building delta between %s[older build] and %s." % (previous, pl[1])) delta_packages.append(create_delta_package(os.path.join(config.binaryPath, previous), p)) # Ok for here logger.debug("delta() -> deltas_to_install: %s" % deltas_to_install) return (deltas_to_install, delta_packages, blacklisted_packages)