From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12026 invoked by uid 1002); 1 May 2003 12:55:52 -0000 Mailing-List: contact gentoo-dev-help@gentoo.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Received: (qmail 3700 invoked from network); 1 May 2003 12:55:51 -0000 From: Panard To: gentoo-dev@gentoo.org Date: Thu, 1 May 2003 14:50:43 +0200 User-Agent: KMail/1.5.1 References: <20030429T133403Z_B95E00150000@gentoo.org> <200305010052.38709.panard@inzenet.org> <3EB068AA.2090706@home.se> In-Reply-To: <3EB068AA.2090706@home.se> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_jgRs+9Nuz3pr9Cl" Message-Id: <200305011450.43409.panard@inzenet.org> Subject: Re: [gentoo-dev] [update] emerge with interacitve use X-Archives-Salt: 0ced5095-c00b-4628-a44b-4bffe2d11099 X-Archives-Hash: 274736b2728de88ab96c210847576c92 --Boundary-00=_jgRs+9Nuz3pr9Cl Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Jeudi 1 Mai 2003 02:22, Daniel Armyr a =E9crit : | Could you supply a diff? I would like to see your changes. =2D-=20 ________________________________________________________ panard@inzenet.org http://www.inzenet.org "Computers are like air-conditioners, they stop working properly when you o= pen=20 Windows." --Boundary-00=_jgRs+9Nuz3pr9Cl Content-Type: text/x-diff; charset="iso-8859-1"; name="emerge-interactive.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="emerge-interactive.patch" --- emerge 2003-05-01 14:47:56.000000000 +0200 +++ emerge-interactive 2003-05-01 02:32:10.000000000 +0200 @@ -23,13 +23,13 @@ "--changelog", "--columns", "--debug", "--deep", "--emptytree", "--fetchonly", -"--help", "--noconfmem", +"--help", "--interactive", "--noconfmem", "--nodeps", "--noreplace", "--nospinner", "--oneshot", "--onlydeps", "--pretend", "--quiet", "--resume", "--searchdesc", "--selective", -"--update", "--upgradeonly", +"--update", "--upgradeonly", "--usecustom", "--usepkg", "--usepkgonly", "--verbose", "--version" ] @@ -41,7 +41,7 @@ "e":"--emptytree", "f":"--fetchonly", "h":"--help", -"i":"--inject", +"i":"--inject", "I":"--interactive", "k":"--usepkg", "K":"--usepkgonly", "l":"--changelog", "n":"--noreplace", @@ -1095,6 +1095,8 @@ myroot=x[1] #the last argument in the portage.doebuild() tells doebuild to *not* do dep checking #(emerge is already handling that) + + y=portage.portdb.findname(x[2]) if not "--pretend" in myopts: print ">>> emerge ("+str(mergecount)+" of "+str(len(mymergelist))+")",x[2],"to",x[1] @@ -1820,6 +1822,171 @@ print darkgreen("emerge: It seems we have nothing to resume...") sys.exit(0) + if myaction not in ["system","world"]: + if not myfiles: + print "emerge: please tell me what to do." + help() + sys.exit(1) + #we don't have any files to process; skip this step and exit + + # INTERACTIVE MODE + if "--interactive" in myopts: + print ">>> Per packages interactive USE management" + mydepgraph = depgraph (myaction,myopts) + if myaction not in ["system","world"]: + ret,files = mydepgraph.select_files (myfiles) + else: + if not mydepgraph.xcreate(myaction): + print "!!! Depgraph creation failed." + sys.exit(1) + + mygraph = mydepgraph.digraph.copy() + retlist = mygraph.dict.keys() + + files = [] + for i in retlist: + i = string.split (i) + if i[1] == "blocks": + print "!!! Error: Conflict problem..." + sys.exit(1) + if i[3] == "merge": + if myaction not in ["system","world"]: + for j in mygraph.dict.keys(): + try: + files.index(string.split(j,' ')) + except: + files.append(string.split(j,' ')) + else: + try: + files.index(i) + except: + files.append(i) + for x in files: + t=portage.portdb.xmatch("bestmatch-visible",x[2]) + if t != '': + x=t + print ">>> Interactive mode for "+green(x[2]) + + useruse=[] + explode = string.split (x[2],"/") + mycat=explode[0] + mypkg=explode[1] + + if "--update" not in myopts: + whichpkg = mypkg + whichcat = mycat + else: + # we take the old package USECUSTOM + myoldbest=portage.best(portage.db[x[1]]["vartree"].dbapi.match(portage.pkgsplit(x[2])[0])) + myoldbest = string.split (myoldbest,'/') + whichcat = myoldbest[0] + whichpkg = myoldbest[1] + + mydblink = portage.dblink (whichcat,whichpkg,'/var/tmp/portage') + + + usecustom = mydblink.getelements("USECUSTOM") + do_ask=1 + if usecustom != [] and "--usecustom" not in myopts: + to_print = "Use previous USE flags for this package? (" + for u in usecustom: + if u != "": + if u[0] == '-': + to_print = to_print+blue(u) + else: + to_print = to_print+green("+"+u) + to_print = to_print+" " + choice = raw_input (to_print+") [Y/n] ").lower () + if choice != '': + if choice[0] == 'y': + do_ask=0 + elif choice[0] != 'n': + print red("Bad input -- assume no") + else: + do_ask=0 + elif usecustom == [] and "--usecustom" in myopts: + do_ask = 1 + elif usecustom != [] and "--usecustom" in myopts: + do_ask = 0 + + + if do_ask == 0: + for u in usecustom: + if u != "": + if u[0] == '-': + try: + portage.usesplit.remove(u[1:]) + except: + "" + else: + try: + portage.usesplit.remove("-"+u) + except: + "" + try: + portage.usesplit.remove(u) + except: + "" + portage.usesplit.append(u) + + + if do_ask == 1: + for ebuild_iuse in string.split(portage.portdb.aux_get(x[2],["IUSE"])[0], " "): + if ebuild_iuse != "": + to_print = "Use "+ebuild_iuse+"? [" + try: + if (portage.usesplit.index(ebuild_iuse) >= 0) : + default='y' + to_print = to_print+"Y/n" + except ValueError: + if ebuild_iuse != "": + default='n' + to_print = to_print+"y/N" + to_print = to_print+"]" + + choice = raw_input (to_print+" ").lower () + if choice == '': + state=default + else: + choice = choice[0] + if choice != default: + if choice == 'y': + print green('Enabled '+ebuild_iuse) + state='y' + elif choice == 'n': + print blue('Disabled '+ebuild_iuse) + state='n' + else: + print red('Bad input -- reverting to default... ('+default+')') + state=default + else: + state=default + + + # we remove the ebuild from usesplit (it will be append, with his value next) + try: + portage.usesplit.remove(ebuild_iuse) + except: + "" + try: + portage.usesplit.remove('-'+ebuild_iuse) + except: + "" + if state == 'n': + ebuild_iuse = '-'+ebuild_iuse + + portage.usesplit.append(ebuild_iuse) + useruse.append(ebuild_iuse) + + # save use settings to USECUSTOM + print ">>> Save USE settings" + mydblink=portage.dblink(mycat,mypkg,"/var/tmp/portage") + mydblink.setelements(useruse,"USECUSTOM") + + portage.settings.configlist[-1]["USE"]=string.join(portage.usesplit," ") + + print + mydepgraph=depgraph(myaction,myopts) if myaction in ["system","world"]: print "Calculating",myaction,"dependencies ", @@ -1827,12 +1994,7 @@ print "!!! Depgraph creation failed." sys.exit(1) print "\b\b ...done!" - else: - if not myfiles: - print "emerge: please tell me what to do." - help() - sys.exit(1) - #we don't have any files to process; skip this step and exit + if myaction not in ["system","world"]: print "Calculating dependencies ", retval,favorites=mydepgraph.select_files(myfiles) if not retval: --Boundary-00=_jgRs+9Nuz3pr9Cl Content-Type: text/plain; charset=us-ascii -- gentoo-dev@gentoo.org mailing list --Boundary-00=_jgRs+9Nuz3pr9Cl--