--- pym/portage.py.orig 2004-01-06 12:30:48.118311568 +0100 +++ pym/portage.py 2004-01-06 12:55:55.761115024 +0100 @@ -1813,7 +1813,7 @@ actionmap[mydo]["args"][0], actionmap[mydo]["args"][1]) -def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0): +def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,log_counter=0): global db ebuild_path = os.path.abspath(myebuild) @@ -1996,11 +1996,8 @@ 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("/")) except ValueError, e: mysettings["PORT_LOGDIR"]="" print "!!! Unable to chown/chmod PORT_LOGDIR. Disabling logging." @@ -2010,6 +2007,23 @@ print "!!! PORT_LOGDIR:",mysettings["PORT_LOGDIR"] mysettings["PORT_LOGDIR"]="" + if len(mysettings["PORT_LOGDIR"]): + if not mysettings.has_key("LOG_PF") or (mysettings["LOG_PF"] != mysettings["PF"]): + mysettings["LOG_PF"]=mysettings["PF"] + # Try to be smart on the LOG_COUNTER value to have only one log per package installation. + # We may get it as a parameter (from treewalk during preinst/postinst), or from the + # db (for prerm/postrm), or from the usual vartree method (for building, etc.). + # This reduces 3 times the number of files in the log directory. + if log_counter <= 0 and os.path.normpath(pkg_dir+"/..")==os.path.normpath(myroot+"///var/db/pkg/"+cat): + mydblink=dblink(cat,os.path.basename(pkg_dir),myroot,mysettings) + try: + log_counter=long(mydblink.getstring("COUNTER")) + except ValueError: + log_counter=0 + elif log_counter <= 0: + log_counter=db[myroot]["vartree"].dbapi.get_counter_tick_core("/") + mysettings["LOG_COUNTER"]=str(log_counter) + if mydo=="unmerge": return unmerge(mysettings["CATEGORY"],mysettings["PF"],myroot) @@ -5307,9 +5321,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,"preinst",root,self.settings,cleanup=cleanup) + a=doebuild(myebuild,"preinst",root,self.settings,cleanup=cleanup,log_counter=counter) else: - a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst",root,self.settings,cleanup=cleanup) + a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst",root,self.settings,cleanup=cleanup,log_counter=counter) # XXX: Decide how to handle failures here. if a >= (1<<8): @@ -5409,9 +5423,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) + a=doebuild(myebuild,"postinst",root,self.settings,log_counter=counter) else: - a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings) + a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings,log_counter=counter) # XXX: Decide how to handle failures here. if a >= (1<<8):