def unpack(self, dest_dir): """ Unpack the source rpm to tmpdir. Leave the cleanup to the caller in case of an error. """ gbpc.RunAtCommand('rpm2cpio', [self.srpmfile, '|', 'cpio', '-id'], shell=True, capture_stderr=True)(dir=dest_dir)
def unpack(self, dest_dir): """ Unpack the source rpm to tmpdir. Leave the cleanup to the caller in case of an error. """ c = gbpc.RunAtCommand('rpm2cpio', [self.srpmfile, '|', 'cpio', '-id'], shell=True, capture_stderr=True) c.run_error = "'%s' failed: {stderr}" % (" ".join([c.cmd] + c.args)) c(dir=dest_dir)
def download_source(pkg, dirs): """Download package from a remote location""" if re.match(r'[a-z]{1,5}://', pkg): mode = 'python urllib2' else: mode = 'yumdownloader' tmpdir = tempfile.mkdtemp(dir=dirs['tmp_base'], prefix='download_') gbp.log.info("Trying to download '%s' using '%s'..." % (pkg, mode)) if mode == 'yumdownloader': gbpc.RunAtCommand('yumdownloader', ['--source', '--destdir=', '.', pkg], shell=False)(dir=tmpdir) else: download_file(tmpdir, pkg) srpm = glob.glob(os.path.join(tmpdir, '*.src.rpm'))[0] return srpm
def download_source(pkg, dirs, unauth): opts = ['--download-only'] if unauth: opts.append('--allow-unauthenticated') if re.match(r'[a-z]{1,5}://', pkg): cmd = 'dget' opts += ['-q', pkg] else: cmd = 'apt-get' opts += ['-qq', 'source', pkg] dirs['download'] = os.path.abspath(tempfile.mkdtemp()) gbp.log.info("Downloading '%s' using '%s'..." % (pkg, cmd)) gbpc.RunAtCommand(cmd, opts, shell=False)(dir=dirs['download']) dsc = glob.glob(os.path.join(dirs['download'], '*.dsc'))[0] return dsc