diff --git a/src/bin/pungi.py b/src/bin/pungi.py index 2fe5e7d6..10b1b8f3 100755 --- a/src/bin/pungi.py +++ b/src/bin/pungi.py @@ -110,13 +110,28 @@ def main(): mypungi.completePackageSet() if plen == len(mypungi.srpmpolist): break - mypungi.downloadPackages() + if opts.nodownload: + for line in mypungi.listPackages(): + sys.stdout.write("RPM: %s\n" % line) + sys.stdout.flush() + else: + mypungi.downloadPackages() mypungi.makeCompsFile() if not opts.nodebuginfo: mypungi.getDebuginfoList() - mypungi.downloadDebuginfo() + if opts.nodownload: + for line in mypungi.listDebuginfo(): + sys.stdout.write("DEBUGINFO: %s\n" % line) + sys.stdout.flush() + else: + mypungi.downloadDebuginfo() if not opts.nosource: - mypungi.downloadSRPMs() + if opts.nodownload: + for line in mypungi.listSRPMs(): + sys.stdout.write("SRPM: %s\n" % line) + sys.stdout.flush() + else: + mypungi.downloadSRPMs() if opts.do_all or opts.do_createrepo: mypungi.doCreaterepo() @@ -184,6 +199,8 @@ if __name__ == '__main__': help='disable gathering of source packages (optional)') parser.add_option("--nodebuginfo", action="store_true", dest="nodebuginfo", help='disable gathering of debuginfo packages (optional)') + parser.add_option("--nodownload", action="store_true", dest="nodownload", + help='disable downloading of packages. instead, print the package URLs (optional)') parser.add_option("--nogreedy", action="store_true", dest="nogreedy", help='disable pulling of all providers of package dependencies (optional)') parser.add_option("--sourceisos", default=False, action="store_true", dest="sourceisos", diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py index 650eb35b..264d1525 100644 --- a/src/pypungi/__init__.py +++ b/src/pypungi/__init__.py @@ -728,6 +728,22 @@ class Pungi(pypungi.PungiBase): self._downloadPackageList(self.debuginfolist, os.path.join(self.config.get('pungi', 'arch'), 'debug')) + def _listPackages(self, polist): + """Cycle through the list of packages and return their paths.""" + return [ os.path.join(pkg.basepath or "", pkg.relativepath) for pkg in polist ] + + def listPackages(self): + """Cycle through the list of RPMs and return their paths.""" + return self._listPackages(self.polist) + + def listSRPMs(self): + """Cycle through the list of SRPMs and return their paths.""" + return self._listPackages(self.srpmpolist) + + def listDebuginfo(self): + """Cycle through the list of DEBUGINFO RPMs and return their paths.""" + return self._listPackages(self.debuginfolist) + def writeinfo(self, line): """Append a line to the infofile in self.infofile"""