Lines 165-175
Link Here
|
165 |
print "emerge: can't specify both of \"--tree\" and \"--columns\"." |
165 |
print "emerge: can't specify both of \"--tree\" and \"--columns\"." |
166 |
sys.exit(1) |
166 |
sys.exit(1) |
167 |
|
167 |
|
168 |
# Always create packages if FEATURES=buildpkg |
|
|
169 |
# Imply --buildpkg if --buildpkgonly |
168 |
# Imply --buildpkg if --buildpkgonly |
170 |
if ("buildpkg" in portage.features) or ("--buildpkgonly" in myopts): |
169 |
if ("--buildpkgonly" in myopts) and ("--buildpkg" not in myopts): |
171 |
if "--buildpkg" not in myopts: |
170 |
myopts.append("--buildpkg") |
172 |
myopts.append("--buildpkg") |
|
|
173 |
|
171 |
|
174 |
# Also allow -S to invoke search action (-sS) |
172 |
# Also allow -S to invoke search action (-sS) |
175 |
if ("--searchdesc" in myopts): |
173 |
if ("--searchdesc" in myopts): |
Lines 1409-1415
Link Here
|
1409 |
|
1407 |
|
1410 |
def outdated(self): |
1408 |
def outdated(self): |
1411 |
return self.outdatedpackages |
1409 |
return self.outdatedpackages |
1412 |
|
1410 |
|
|
|
1411 |
#buildpkg: check if a package is in system |
1412 |
def issyspkg(self,mycpv): |
1413 |
mykey=portage.cpv_getkey(mycpv) |
1414 |
myreturn=0 |
1415 |
mysysdict=genericdict(syslist) |
1416 |
if mysysdict.has_key(mykey): |
1417 |
myreturn=1 |
1418 |
# FIXME: this won't recognize packages emerged for the first time if they |
1419 |
# are not the default for their virtuals. Need a PROVIDE aux_get key to |
1420 |
# do it the right way. |
1421 |
else: |
1422 |
myvirtdict=portage.grabdict(portage.root+"var/cache/edb/virtuals") |
1423 |
for myvirt in myvirtdict.keys(): |
1424 |
if mykey in myvirtdict[myvirt] and mysysdict.has_key(myvirt): |
1425 |
myreturn=1 |
1426 |
break |
1427 |
return myreturn |
1428 |
|
1429 |
# buildpkg: check if a package should be kept as a binary tbz2 |
1430 |
def istobuildpkg(self,mycpv): |
1431 |
mykey=portage.cpv_getkey(mycpv) |
1432 |
mycat=mykey.split("/")[0] |
1433 |
mybuildpolicy=self.pkgsettings["BUILD_PKGS"].split() |
1434 |
# A package will be kept if it matches at least one positive rules, |
1435 |
# and no negative rule of a strictly higher level. Levels are: |
1436 |
# 4 for "cat/pkg", 3 for "category", 2 for "system", 1 for "*" |
1437 |
conclusion=0 |
1438 |
for myrule in mybuildpolicy: |
1439 |
# Rule sign: negative if "!something" |
1440 |
rulesign=1 |
1441 |
if myrule[0]=="!": |
1442 |
rulesign=-1 |
1443 |
myrule=myrule[1:] |
1444 |
# Calculate rule value (0 if non-matching) |
1445 |
rulevalue=0 |
1446 |
if myrule=="*": |
1447 |
rulevalue = 1 * rulesign |
1448 |
elif myrule=="system" and self.issyspkg(mycpv): |
1449 |
rulevalue = 2 * rulesign |
1450 |
elif myrule==mycat: |
1451 |
rulevalue = 3 * rulesign |
1452 |
elif myrule==mykey: |
1453 |
rulevalue = 4 * rulesign |
1454 |
# Update conclusion. Be carefull not to depend on rules ordering. |
1455 |
if (conclusion >= 0) and (abs(rulevalue) > conclusion) \ |
1456 |
or (conclusion < 0) and (abs(rulevalue) >= abs(conclusion)): |
1457 |
conclusion=rulevalue |
1458 |
# Return a boolean |
1459 |
if (conclusion > 0): |
1460 |
print ">>> We'll keep a binary tarball of this package." |
1461 |
return (conclusion > 0) |
1462 |
|
1413 |
def merge(self,mylist): |
1463 |
def merge(self,mylist): |
1414 |
returnme=0 |
1464 |
returnme=0 |
1415 |
mymergelist=[] |
1465 |
mymergelist=[] |
Lines 1425-1432
Link Here
|
1425 |
if ("--pretend" not in myopts): |
1475 |
if ("--pretend" not in myopts): |
1426 |
sys.exit(1) |
1476 |
sys.exit(1) |
1427 |
|
1477 |
|
1428 |
#buildsyspkg: I need mysysdict also on resume (moved from the else block) |
|
|
1429 |
mysysdict=genericdict(syslist) |
1430 |
if ("--resume" in myopts): |
1478 |
if ("--resume" in myopts): |
1431 |
# We're resuming. |
1479 |
# We're resuming. |
1432 |
print green("*** Resuming merge...") |
1480 |
print green("*** Resuming merge...") |
Lines 1437-1442
Link Here
|
1437 |
else: |
1485 |
else: |
1438 |
myfavs=portage.grabfile(portage.root+"var/cache/edb/world") |
1486 |
myfavs=portage.grabfile(portage.root+"var/cache/edb/world") |
1439 |
myfavdict=genericdict(myfavs) |
1487 |
myfavdict=genericdict(myfavs) |
|
|
1488 |
mysysdict=genericdict(syslist) |
1440 |
for x in range(len(mylist)): |
1489 |
for x in range(len(mylist)): |
1441 |
if mylist[x][3]!="nomerge": |
1490 |
if mylist[x][3]!="nomerge": |
1442 |
# Add to the mergelist |
1491 |
# Add to the mergelist |
Lines 1477-1486
Link Here
|
1477 |
print ">>> emerge ("+str(mergecount)+" of "+str(len(mymergelist))+")",x[pkgindex],"to",x[1] |
1526 |
print ">>> emerge ("+str(mergecount)+" of "+str(len(mymergelist))+")",x[pkgindex],"to",x[1] |
1478 |
emergelog(" >>> emerge ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" to "+x[1]) |
1527 |
emergelog(" >>> emerge ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" to "+x[1]) |
1479 |
self.pkgsettings["EMERGE_FROM"] = x[0][:] |
1528 |
self.pkgsettings["EMERGE_FROM"] = x[0][:] |
1480 |
#buildsyspkg: Check if we need to _force_ binary package creation |
|
|
1481 |
issyspkg = ("buildsyspkg" in myfeat) \ |
1482 |
and mysysdict.has_key(portage.cpv_getkey(x[2])) \ |
1483 |
and not ("--buildpkg" in myopts) |
1484 |
if x[0] in ["ebuild","blocks"]: |
1529 |
if x[0] in ["ebuild","blocks"]: |
1485 |
if (x[0]=="blocks") and ("--fetchonly" not in myopts): |
1530 |
if (x[0]=="blocks") and ("--fetchonly" not in myopts): |
1486 |
raise Exception, "Merging a blocker" |
1531 |
raise Exception, "Merging a blocker" |
Lines 1492-1502
Link Here
|
1492 |
print |
1537 |
print |
1493 |
returnme=1 |
1538 |
returnme=1 |
1494 |
continue |
1539 |
continue |
1495 |
elif "--buildpkg" in myopts or issyspkg: |
1540 |
elif ("--buildpkg" in myopts) or ("buildpkg" in portage.features and self.istobuildpkg(x[pkgindex])): |
1496 |
#buildsyspkg: Sounds useful to display something, but I don't know if we should also log it |
|
|
1497 |
if issyspkg: |
1498 |
print ">>> This is a system package, let's pack a rescue tarball." |
1499 |
#emergelog(">>> This is a system package, let's pack a rescue tarball.") |
1500 |
#create pkg, then merge pkg |
1541 |
#create pkg, then merge pkg |
1501 |
emergelog(" === ("+str(mergecount)+" of "+str(len(mymergelist))+") Cleaning ("+x[pkgindex]+"::"+y+")") |
1542 |
emergelog(" === ("+str(mergecount)+" of "+str(len(mymergelist))+") Cleaning ("+x[pkgindex]+"::"+y+")") |
1502 |
retval=portage.doebuild(y,"clean",myroot,self.pkgsettings,edebug,cleanup=1) |
1543 |
retval=portage.doebuild(y,"clean",myroot,self.pkgsettings,edebug,cleanup=1) |
Lines 2176-2182
Link Here
|
2176 |
myvars=['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK', |
2217 |
myvars=['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK', |
2177 |
'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR', 'PORTDIR_OVERLAY', |
2218 |
'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR', 'PORTDIR_OVERLAY', |
2178 |
'USE', 'COMPILER', 'CHOST', 'CFLAGS', 'CXXFLAGS','ACCEPT_KEYWORDS', |
2219 |
'USE', 'COMPILER', 'CHOST', 'CFLAGS', 'CXXFLAGS','ACCEPT_KEYWORDS', |
2179 |
'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES'] |
2220 |
'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES', 'BUILD_PKGS'] |
2180 |
myvars.sort() |
2221 |
myvars.sort() |
2181 |
for x in myvars: |
2222 |
for x in myvars: |
2182 |
print x+'="'+portage.settings[x]+'"' |
2223 |
print x+'="'+portage.settings[x]+'"' |