Lines 1564-1570
Link Here
|
1564 |
|
1564 |
|
1565 |
# XXX This would be to replace getstatusoutput completely. |
1565 |
# XXX This would be to replace getstatusoutput completely. |
1566 |
# XXX Issue: cannot block execution. Deadlock condition. |
1566 |
# XXX Issue: cannot block execution. Deadlock condition. |
1567 |
def spawn(mystring,mysettings,debug=0,free=0,droppriv=0,fd_pipes=None,**keywords): |
1567 |
def spawn(mystring,mysettings,debug=0,free=0,droppriv=0,fd_pipes=None,iw_log=None,**keywords): |
1568 |
"""spawn a subprocess with optional sandbox protection, |
1568 |
"""spawn a subprocess with optional sandbox protection, |
1569 |
depending on whether sandbox is enabled. The "free" argument, |
1569 |
depending on whether sandbox is enabled. The "free" argument, |
1570 |
when set to 1, will disable sandboxing. This allows us to |
1570 |
when set to 1, will disable sandboxing. This allows us to |
Lines 1589-1595
Link Here
|
1589 |
|
1589 |
|
1590 |
if ("sandbox" in features) and (not free): |
1590 |
if ("sandbox" in features) and (not free): |
1591 |
keywords["opt_name"] += " sandbox" |
1591 |
keywords["opt_name"] += " sandbox" |
1592 |
if droppriv and portage_gid and portage_uid: |
1592 |
if iw_log: |
|
|
1593 |
env["INSTALLWATCHFILE"]=iw_log |
1594 |
elif droppriv and portage_gid and portage_uid: |
1593 |
keywords.update({"uid":portage_uid,"gid":portage_gid,"groups":[portage_gid],"umask":002}) |
1595 |
keywords.update({"uid":portage_uid,"gid":portage_gid,"groups":[portage_gid],"umask":002}) |
1594 |
return portage_exec.spawn_sandbox(mystring,env=env,**keywords) |
1596 |
return portage_exec.spawn_sandbox(mystring,env=env,**keywords) |
1595 |
else: |
1597 |
else: |
Lines 2314-2320
Link Here
|
2314 |
droppriv=actionmap[mydo]["args"][1],logfile=logfile) |
2316 |
droppriv=actionmap[mydo]["args"][1],logfile=logfile) |
2315 |
return retval |
2317 |
return retval |
2316 |
|
2318 |
|
2317 |
def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1,fetchall=0,tree="porttree"): |
2319 |
def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1,fetchall=0,tree="porttree",iw_log=None): |
2318 |
global db |
2320 |
global db |
2319 |
|
2321 |
|
2320 |
ebuild_path = os.path.abspath(myebuild) |
2322 |
ebuild_path = os.path.abspath(myebuild) |
Lines 2595-2601
Link Here
|
2595 |
return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile) |
2597 |
return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile) |
2596 |
elif mydo in ["prerm","postrm","preinst","postinst","config"]: |
2598 |
elif mydo in ["prerm","postrm","preinst","postinst","config"]: |
2597 |
mysettings.load_infodir(pkg_dir) |
2599 |
mysettings.load_infodir(pkg_dir) |
2598 |
return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile) |
2600 |
free=1 |
|
|
2601 |
if iw_log: |
2602 |
free=0 |
2603 |
return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=free,logfile=logfile,iw_log=iw_log) |
2599 |
|
2604 |
|
2600 |
try: |
2605 |
try: |
2601 |
mysettings["SLOT"],mysettings["RESTRICT"] = db["/"]["porttree"].dbapi.aux_get(mycpv,["SLOT","RESTRICT"]) |
2606 |
mysettings["SLOT"],mysettings["RESTRICT"] = db["/"]["porttree"].dbapi.aux_get(mycpv,["SLOT","RESTRICT"]) |
Lines 6428-6439
Link Here
|
6428 |
print ">>> Merging",self.mycpv,"to",destroot |
6433 |
print ">>> Merging",self.mycpv,"to",destroot |
6429 |
|
6434 |
|
6430 |
# run preinst script |
6435 |
# run preinst script |
|
|
6436 |
iw_log=None |
6437 |
if "installwatch" in features: |
6438 |
iw_log=self.dbtmpdir+"/PREINST" |
6431 |
if myebuild: |
6439 |
if myebuild: |
6432 |
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg |
6440 |
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg |
6433 |
# (if any). |
6441 |
# (if any). |
6434 |
a=doebuild(myebuild,"preinst",root,self.settings,cleanup=cleanup,use_cache=0) |
6442 |
a=doebuild(myebuild,"preinst",root,self.settings,cleanup=cleanup,use_cache=0,iw_log=iw_log) |
6435 |
else: |
6443 |
else: |
6436 |
a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst",root,self.settings,cleanup=cleanup,use_cache=0) |
6444 |
a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst",root,self.settings,cleanup=cleanup,use_cache=0,iw_log=iw_log) |
|
|
6445 |
|
6446 |
if iw_log: |
6447 |
import portage_installwatch |
6448 |
portage_installwatch.process_iw_log(iw_log, iw_log, root, " ") |
6437 |
|
6449 |
|
6438 |
# XXX: Decide how to handle failures here. |
6450 |
# XXX: Decide how to handle failures here. |
6439 |
if a != 0: |
6451 |
if a != 0: |
Lines 6514-6526
Link Here
|
6514 |
self.dbdir = self.dbtmpdir |
6526 |
self.dbdir = self.dbtmpdir |
6515 |
print ">>> original instance of package unmerged safely." |
6527 |
print ">>> original instance of package unmerged safely." |
6516 |
|
6528 |
|
6517 |
# We hold both directory locks. |
|
|
6518 |
self.dbdir = self.dbpkgdir |
6519 |
self.delete() |
6520 |
movefile(self.dbtmpdir, self.dbpkgdir, mysettings=self.settings) |
6521 |
|
6522 |
self.unlockdb() |
6523 |
|
6524 |
#write out our collection of md5sums |
6529 |
#write out our collection of md5sums |
6525 |
if cfgfiledict.has_key("IGNORE"): |
6530 |
if cfgfiledict.has_key("IGNORE"): |
6526 |
del cfgfiledict["IGNORE"] |
6531 |
del cfgfiledict["IGNORE"] |
Lines 6545-6556
Link Here
|
6545 |
portage_locks.unlockfile(mylock) |
6550 |
portage_locks.unlockfile(mylock) |
6546 |
|
6551 |
|
6547 |
#do postinst script |
6552 |
#do postinst script |
|
|
6553 |
iw_log=None |
6554 |
if "installwatch" in features: |
6555 |
iw_log=self.dbtmpdir+"/POSTINST" |
6548 |
if myebuild: |
6556 |
if myebuild: |
6549 |
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg |
6557 |
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg |
6550 |
# (if any). |
6558 |
# (if any). |
6551 |
a=doebuild(myebuild,"postinst",root,self.settings,use_cache=0) |
6559 |
a=doebuild(myebuild,"postinst",root,self.settings,use_cache=0,iw_log=iw_log) |
6552 |
else: |
6560 |
else: |
6553 |
a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings,use_cache=0) |
6561 |
a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings,use_cache=0,iw_log=iw_log) |
|
|
6562 |
|
6563 |
if iw_log: |
6564 |
import portage_installwatch |
6565 |
portage_installwatch.process_iw_log(iw_log, iw_log, root, " ") |
6566 |
portage_installwatch.remove_duplicates(self.dbtmpdir+"/CONTENTS", self.dbtmpdir+"/POSTINST") |
6567 |
portage_installwatch.remove_duplicates(self.dbtmpdir+"/CONTENTS", self.dbtmpdir+"/PREINST") |
6568 |
|
6569 |
# We hold both directory locks. |
6570 |
self.dbdir = self.dbpkgdir |
6571 |
self.delete() |
6572 |
movefile(self.dbtmpdir, self.dbpkgdir, mysettings=self.settings) |
6573 |
|
6574 |
self.unlockdb() |
6554 |
|
6575 |
|
6555 |
# XXX: Decide how to handle failures here. |
6576 |
# XXX: Decide how to handle failures here. |
6556 |
if a != 0: |
6577 |
if a != 0: |