--- pym/portage.py.orig 2004-02-04 18:15:01.193769391 +0100 +++ pym/portage.py 2004-02-04 18:15:15.805967691 +0100 @@ -2048,7 +2048,7 @@ actionmap[mydo]["args"][0], actionmap[mydo]["args"][1]) -def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1): +def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1,log_counter=0): global db ebuild_path = os.path.abspath(myebuild) @@ -2232,14 +2232,18 @@ mysettings["WORKDIR"]=mysettings["BUILDDIR"]+"/work" mysettings["D"]=mysettings["BUILDDIR"]+"/image/" + # if we don't get a log_counter from treewalk or unmerge, guess a new one + if log_counter <= 0: + log_counter = db[myroot]["vartree"].dbapi.get_counter_tick_core("/") + if mysettings.has_key("PORT_LOGDIR"): if os.access(mysettings["PORT_LOGDIR"]+"/",os.W_OK): try: - os.chown(mysettings["BUILD_PREFIX"],portage_uid,portage_gid) + os.chown(mysettings["PORT_LOGDIR"],portage_uid,portage_gid) os.chmod(mysettings["PORT_LOGDIR"],06770) if not mysettings.has_key("LOG_PF") or (mysettings["LOG_PF"] != mysettings["PF"]): mysettings["LOG_PF"]=mysettings["PF"] - mysettings["LOG_COUNTER"]=str(db[myroot]["vartree"].dbapi.get_counter_tick_core("/")) + mysettings["LOG_COUNTER"]=str(log_counter) except ValueError, e: mysettings["PORT_LOGDIR"]="" print "!!! Unable to chown/chmod PORT_LOGDIR. Disabling logging." @@ -5167,9 +5171,15 @@ myebuildpath=self.dbdir+"/"+x break + # get counter to use it as LOG_COUNTER for prerm/postrm + try: + mycounter = long(self.getstring("COUNTER")) + except ValueError: + mycounter = 0 + #do prerm script if myebuildpath and os.path.exists(myebuildpath): - a=doebuild(myebuildpath,"prerm",self.myroot,self.settings,cleanup=cleanup,use_cache=0) + a=doebuild(myebuildpath,"prerm",self.myroot,self.settings,cleanup=cleanup,use_cache=0,log_counter=mycounter) # XXX: Decide how to handle failures here. if a != 0: writemsg("!!! FAILED prerm: "+str(a)+"\n") @@ -5386,7 +5396,7 @@ if myebuildpath and os.path.exists(myebuildpath): # XXX: This should be the old config, not the current one. # XXX: Use vardbapi to load up env vars. - a=doebuild(myebuildpath,"postrm",self.myroot,self.settings,use_cache=0) + a=doebuild(myebuildpath,"postrm",self.myroot,self.settings,use_cache=0,log_counter=mycounter) # XXX: Decide how to handle failures here. if a != 0: writemsg("!!! FAILED postrm: "+str(a)+"\n") @@ -5546,9 +5556,9 @@ if myebuild: # if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg # (if any). - a=doebuild(myebuild,"postinst",root,self.settings,use_cache=0) + a=doebuild(myebuild,"postinst",root,self.settings,use_cache=0,log_counter=counter) else: - a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings,use_cache=0) + a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings,use_cache=0,log_counter=counter) # XXX: Decide how to handle failures here. if a != 0: