diefunc() {
local funcname="$1" lineno="$2" exitcode="$3"
shift 3
- echo >&2
- echo "!!! ERROR: $CATEGORY/$PF failed." >&2
- dump_trace 2 1>&2
- echo " $(basename "${BASH_SOURCE[1]}"), line ${BASH_LINENO[0]}: Called die" 1>&2
- echo >&2
- echo "!!! ${*:-(no error message)}" >&2
- echo "!!! If you need support, post the topmost build error, and the call stack if relevant." >&2
+ eerror
+ eerror "ERROR: $CATEGORY/$PF failed."
+ dump_trace 2
+ eerror "$(basename "${BASH_SOURCE[1]}"), line ${BASH_LINENO[0]}: Called die"
+ eerror
+ eerror "${*:-(no error message)}"
+ eerror "If you need support, post the topmost build error, and the call stack if relevant."
[ -n "${PORTAGE_LOG_FILE}" ] && \
- echo "!!! A complete build log is located at '${PORTAGE_LOG_FILE}'." >&2
- echo >&2
+ eerror "A complete build log is located at '${PORTAGE_LOG_FILE}'."
if [ -n "${EBUILD_OVERLAY_ECLASSES}" ] ; then
- echo "This ebuild used the following eclasses from overlays:" >&2
- echo >&2
- for x in ${EBUILD_OVERLAY_ECLASSES} ; do
- echo " ${x}" >&2
- done
- echo >&2
+ eerror "This ebuild used eclasses from overlays: ${EBUILD_OVERLAY_ECLASSES}"
+ fi
+ if [ ${EBUILD#${PORTDIR}/} == ${EBUILD} ] ; then
+ local overlay=${EBUILD%/*}
+ overlay=${overlay%/*}
+ overlay=${overlay%/*}
+ eerror "This ebuild is from an overlay: '${overlay}/'"
fi
+ eerror
if [ "${EBUILD_PHASE/depend}" == "${EBUILD_PHASE}" ]; then
local x
strip=$(( $1 ))
fi
- echo "Call stack:"
+ eerror "Call stack:"
for (( n = ${#FUNCNAME[@]} - 1, p = ${#BASH_ARGV[@]} ; n > $strip ; n-- )) ; do
funcname=${FUNCNAME[${n} - 1]}
sourcefile=$(basename ${BASH_SOURCE[${n}]})
done
(( p -= ${BASH_ARGC[${n} - 1]} ))
fi
- echo " ${sourcefile}, line ${lineno}: Called ${funcname}${args:+ ${args}}"
+ eerror "${sourcefile}, line ${lineno}: Called ${funcname}${args:+ ${args}}"
done
}
mysettings["FILESDIR"] = pkg_dir+"/files"
mysettings["PF"] = mypv
+ mysettings["PORTDIR"] = os.path.realpath(mysettings["PORTDIR"])
mysettings["ECLASSDIR"] = mysettings["PORTDIR"]+"/eclass"
mysettings["SANDBOX_LOG"] = mycpv.replace("/", "_-_")
print "!!! Unknown mydo:",mydo
return 1
- if retval != os.EX_OK and tree == "porttree":
- for i in xrange(len(mydbapi.porttrees)-1):
- t = mydbapi.porttrees[i+1]
- if myebuild.startswith(t):
- # Display the non-cannonical path, in case it's different, to
- # prevent confusion.
- overlays = mysettings["PORTDIR_OVERLAY"].split()
- try:
- writemsg("!!! This ebuild is from an overlay: '%s'\n" % \
- overlays[i], noiselevel=-1)
- except IndexError:
- pass
- break
return retval
finally:
uid=portage_uid, gid=portage_gid, mode=070, mask=0)
builddir_lock = None
catdir_lock = None
+ retval = -1
try:
if myebuildpath:
catdir_lock = portage_locks.lockdir(catdir)
self.settings, use_cache=0, tree="vartree",
mydbapi=self.vartree.dbapi, vartree=self.vartree)
- # process logs created during pre/postrm
- elog_process(self.mycpv, self.settings)
-
# XXX: Decide how to handle failures here.
if retval != os.EX_OK:
writemsg("!!! FAILED postrm: %s\n" % retval, noiselevel=-1)
return retval
- doebuild(myebuildpath, "cleanrm", self.myroot, self.settings,
- tree="vartree", mydbapi=self.vartree.dbapi,
- vartree=self.vartree)
finally:
if builddir_lock:
- portage_locks.unlockdir(builddir_lock)
+ try:
+ if myebuildpath:
+ # process logs created during pre/postrm
+ elog_process(self.mycpv, self.settings)
+ if retval == os.EX_OK:
+ doebuild(myebuildpath, "cleanrm", self.myroot,
+ self.settings, tree="vartree",
+ mydbapi=self.vartree.dbapi,
+ vartree=self.vartree)
+ finally:
+ unlockdir(builddir_lock)
try:
if myebuildpath and not catdir_lock:
# Lock catdir for removal if empty.
others_in_slot = []
for cur_cpv in slot_matches:
+ # Clone the config in case one of these has to be unmerged since
+ # we need it to have private ${T} etc... for things like elog.
others_in_slot.append(dblink(self.cat, catsplit(cur_cpv)[1],
- self.vartree.root, self.settings,
+ self.vartree.root, config(clone=self.settings),
vartree=self.vartree))
retval = self._security_check(others_in_slot)
if retval:
contents=contents, env=self.settings.environ())
writemsg_stdout(">>> %s %s\n" % (self.mycpv,"merged."))
-
- # Process ebuild logfiles
- elog_process(self.mycpv, self.settings)
- if "noclean" not in self.settings.features:
- doebuild(myebuild, "clean", destroot, self.settings,
- tree=self.treetype, mydbapi=mydbapi, vartree=self.vartree)
return os.EX_OK
def mergeme(self,srcroot,destroot,outfile,secondhand,stufftomerge,cfgfiledict,thismtime):
def merge(self, mergeroot, inforoot, myroot, myebuild=None, cleanup=0,
mydbapi=None, prev_mtimes=None):
+ retval = -1
+ self.lockdb()
try:
- self.lockdb()
- return self.treewalk(mergeroot, myroot, inforoot, myebuild,
+ retval = self.treewalk(mergeroot, myroot, inforoot, myebuild,
cleanup=cleanup, mydbapi=mydbapi, prev_mtimes=prev_mtimes)
+ # Process ebuild logfiles
+ elog_process(self.mycpv, self.settings)
+ if retval == os.EX_OK and "noclean" not in self.settings.features:
+ if myebuild is None:
+ myebuild = os.path.join(inforoot, self.pkg + ".ebuild")
+ doebuild(myebuild, "clean", myroot, self.settings,
+ tree=self.treetype, mydbapi=mydbapi, vartree=self.vartree)
finally:
self.unlockdb()
+ return retval
def getstring(self,name):
"returns contents of a file with whitespace converted to spaces"