This patch adds support for a new option to emerge "--fetch-missing" which will result in just the missing files being printed as urls should the pretend option be combined with a fetch option. --- /usr/lib/portage/pym/portage.py.orig 2005-07-27 00:07:00.000000000 +0100 +++ /usr/lib/portage/pym/portage.py 2005-10-14 22:55:02.000000000 +0100 @@ -1604,7 +1604,7 @@ -def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",use_locks=1, try_mirrors=1): +def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",use_locks=1, try_mirrors=1, fetchmissing=0): "fetch files. Will use digest file if available." # 'nomirror' is bad/negative logic. You Restrict mirroring, not no-mirroring. @@ -1821,7 +1821,7 @@ file_lock = portage_locks.lockfile(mysettings["DISTDIR"]+"/"+myfile,wantnewlockfile=1) try: for loc in filedict[myfile]: - if listonly: + if listonly and not fetchmissing: writemsg(loc+" ") continue # allow different fetchcommands per protocol @@ -1868,6 +1868,11 @@ writemsg("An exception was caught(1)...\nFailing the download: %s.\n" % (str(e)),1) fetched=0 + if listonly: + if fetched == 0: + writemsg(loc+" ") + continue + if not can_fetch: if fetched != 2: if fetched == 0: @@ -2320,7 +2325,7 @@ droppriv=actionmap[mydo]["args"][1],logfile=logfile) return retval -def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1,fetchall=0,tree="porttree"): +def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1,fetchall=0,tree="porttree",fetchmissing=0): global db ebuild_path = os.path.abspath(myebuild) @@ -2661,7 +2666,7 @@ except: pass - if mydo!="manifest" and not fetch(fetchme, mysettings, listonly=listonly, fetchonly=fetchonly): + if mydo!="manifest" and not fetch(fetchme, mysettings, listonly=listonly, fetchonly=fetchonly, fetchmissing=fetchmissing): return 1 if mydo=="fetch" and listonly: --- /usr/lib/portage/bin/emerge.orig 2005-10-14 22:56:02.000000000 +0100 +++ /usr/lib/portage/bin/emerge 2005-10-14 22:57:17.000000000 +0100 @@ -174,6 +174,7 @@ "--digest", "--emptytree", "--fetchonly", "--fetch-all-uri", +"--fetch-missing", "--getbinpkg", "--getbinpkgonly", "--help", "--noconfmem", "--newuse", "--nocolor", @@ -1853,10 +1854,14 @@ if (x[0]=="blocks") and ("--fetchonly" not in myopts): raise Exception, "Merging a blocker" elif ("--fetchonly" in myopts) or ("--fetch-all-uri" in myopts): + if ("--fetch-missing" in myopts): + fetchmissing=1 + else: + fetchmissing=0 if ("--fetch-all-uri" in myopts): - retval=portage.doebuild(y,"fetch",myroot,self.pkgsettings,edebug,("--pretend" in myopts),fetchonly=1,fetchall=1) + retval=portage.doebuild(y,"fetch",myroot,self.pkgsettings,edebug,("--pretend" in myopts),fetchonly=1,fetchall=1,fetchmissing=fetchmissing) else: - retval=portage.doebuild(y,"fetch",myroot,self.pkgsettings,edebug,("--pretend" in myopts),fetchonly=1) + retval=portage.doebuild(y,"fetch",myroot,self.pkgsettings,edebug,("--pretend" in myopts),fetchonly=1,fetchmissing=fetchmissing) if (retval == None) or retval: print print "!!! Fetch for",y,"failed, continuing..."