Lines 1566-1572
Link Here
|
1566 |
|
1566 |
|
1567 |
# XXX This would be to replace getstatusoutput completely. |
1567 |
# XXX This would be to replace getstatusoutput completely. |
1568 |
# XXX Issue: cannot block execution. Deadlock condition. |
1568 |
# XXX Issue: cannot block execution. Deadlock condition. |
1569 |
def spawn(mystring,mysettings,debug=0,free=0,droppriv=0,fd_pipes=None,**keywords): |
1569 |
def spawn(mystring,mysettings,debug=0,free=0,droppriv=0,fd_pipes=None,iw_log=None,**keywords): |
1570 |
"""spawn a subprocess with optional sandbox protection, |
1570 |
"""spawn a subprocess with optional sandbox protection, |
1571 |
depending on whether sandbox is enabled. The "free" argument, |
1571 |
depending on whether sandbox is enabled. The "free" argument, |
1572 |
when set to 1, will disable sandboxing. This allows us to |
1572 |
when set to 1, will disable sandboxing. This allows us to |
Lines 1600-1605
Link Here
|
1600 |
return portage_exec.spawn_sandbox(mystring,env=env,**keywords) |
1600 |
return portage_exec.spawn_sandbox(mystring,env=env,**keywords) |
1601 |
else: |
1601 |
else: |
1602 |
keywords["opt_name"] += " bash" |
1602 |
keywords["opt_name"] += " bash" |
|
|
1603 |
if iw_log: |
1604 |
env["LD_PRELOAD"]="/lib/libsandbox.so" |
1605 |
env["INSTALLWATCHFILE"]=iw_log |
1603 |
return portage_exec.spawn_bash(mystring,env=env,**keywords) |
1606 |
return portage_exec.spawn_bash(mystring,env=env,**keywords) |
1604 |
|
1607 |
|
1605 |
|
1608 |
|
Lines 2320-2326
Link Here
|
2320 |
droppriv=actionmap[mydo]["args"][1],logfile=logfile) |
2323 |
droppriv=actionmap[mydo]["args"][1],logfile=logfile) |
2321 |
return retval |
2324 |
return retval |
2322 |
|
2325 |
|
2323 |
def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1,fetchall=0,tree="porttree"): |
2326 |
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): |
2324 |
global db |
2327 |
global db |
2325 |
|
2328 |
|
2326 |
ebuild_path = os.path.abspath(myebuild) |
2329 |
ebuild_path = os.path.abspath(myebuild) |
Lines 2606-2612
Link Here
|
2606 |
return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile) |
2609 |
return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile) |
2607 |
elif mydo in ["prerm","postrm","preinst","postinst","config"]: |
2610 |
elif mydo in ["prerm","postrm","preinst","postinst","config"]: |
2608 |
mysettings.load_infodir(pkg_dir) |
2611 |
mysettings.load_infodir(pkg_dir) |
2609 |
return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile) |
2612 |
return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile,iw_log=iw_log) |
2610 |
|
2613 |
|
2611 |
try: |
2614 |
try: |
2612 |
mysettings["SLOT"],mysettings["RESTRICT"] = db["/"]["porttree"].dbapi.aux_get(mycpv,["SLOT","RESTRICT"]) |
2615 |
mysettings["SLOT"],mysettings["RESTRICT"] = db["/"]["porttree"].dbapi.aux_get(mycpv,["SLOT","RESTRICT"]) |
Lines 6442-6453
Link Here
|
6442 |
print ">>> Merging",self.mycpv,"to",destroot |
6445 |
print ">>> Merging",self.mycpv,"to",destroot |
6443 |
|
6446 |
|
6444 |
# run preinst script |
6447 |
# run preinst script |
|
|
6448 |
preinst_log=None |
6449 |
if "installwatch" in features: |
6450 |
preinst_log=self.dbtmpdir+"/PREINST" |
6445 |
if myebuild: |
6451 |
if myebuild: |
6446 |
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg |
6452 |
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg |
6447 |
# (if any). |
6453 |
# (if any). |
6448 |
a=doebuild(myebuild,"preinst",root,self.settings,cleanup=cleanup,use_cache=0) |
6454 |
a=doebuild(myebuild,"preinst",root,self.settings,cleanup=cleanup,use_cache=0,iw_log=preinst_log) |
6449 |
else: |
6455 |
else: |
6450 |
a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst",root,self.settings,cleanup=cleanup,use_cache=0) |
6456 |
a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst",root,self.settings,cleanup=cleanup,use_cache=0,iw_log=preinst_log) |
6451 |
|
6457 |
|
6452 |
# XXX: Decide how to handle failures here. |
6458 |
# XXX: Decide how to handle failures here. |
6453 |
if a != 0: |
6459 |
if a != 0: |
Lines 6528-6540
Link Here
|
6528 |
self.dbdir = self.dbtmpdir |
6534 |
self.dbdir = self.dbtmpdir |
6529 |
print ">>> original instance of package unmerged safely." |
6535 |
print ">>> original instance of package unmerged safely." |
6530 |
|
6536 |
|
6531 |
# We hold both directory locks. |
|
|
6532 |
self.dbdir = self.dbpkgdir |
6533 |
self.delete() |
6534 |
movefile(self.dbtmpdir, self.dbpkgdir, mysettings=self.settings) |
6535 |
|
6536 |
self.unlockdb() |
6537 |
|
6538 |
#write out our collection of md5sums |
6537 |
#write out our collection of md5sums |
6539 |
if cfgfiledict.has_key("IGNORE"): |
6538 |
if cfgfiledict.has_key("IGNORE"): |
6540 |
del cfgfiledict["IGNORE"] |
6539 |
del cfgfiledict["IGNORE"] |
Lines 6559-6570
Link Here
|
6559 |
portage_locks.unlockfile(mylock) |
6558 |
portage_locks.unlockfile(mylock) |
6560 |
|
6559 |
|
6561 |
#do postinst script |
6560 |
#do postinst script |
|
|
6561 |
postinst_log=None |
6562 |
if "installwatch" in features: |
6563 |
postinst_log=self.dbtmpdir+"/POSTINST" |
6562 |
if myebuild: |
6564 |
if myebuild: |
6563 |
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg |
6565 |
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg |
6564 |
# (if any). |
6566 |
# (if any). |
6565 |
a=doebuild(myebuild,"postinst",root,self.settings,use_cache=0) |
6567 |
a=doebuild(myebuild,"postinst",root,self.settings,use_cache=0,iw_log=postinst_log) |
6566 |
else: |
6568 |
else: |
6567 |
a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings,use_cache=0) |
6569 |
a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings,use_cache=0,iw_log=postinst_log) |
|
|
6570 |
if postinst_log: |
6571 |
import portage_installwatch |
6572 |
portage_installwatch.process_iw_log(preinst_log, preinst_log, root, " ") |
6573 |
portage_installwatch.remove_duplicates(self.dbtmpdir+"/CONTENTS", preinst_log) |
6574 |
portage_installwatch.process_iw_log(postinst_log, postinst_log, root, " ") |
6575 |
portage_installwatch.remove_duplicates(self.dbtmpdir+"/CONTENTS", postinst_log) |
6576 |
|
6577 |
|
6578 |
# We hold both directory locks. |
6579 |
self.dbdir = self.dbpkgdir |
6580 |
self.delete() |
6581 |
movefile(self.dbtmpdir, self.dbpkgdir, mysettings=self.settings) |
6582 |
|
6583 |
self.unlockdb() |
6568 |
|
6584 |
|
6569 |
# XXX: Decide how to handle failures here. |
6585 |
# XXX: Decide how to handle failures here. |
6570 |
if a != 0: |
6586 |
if a != 0: |