From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qxoqa-0008O7-MT for garchives@archives.gentoo.org; Sun, 28 Aug 2011 23:33:00 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D645C21C073; Sun, 28 Aug 2011 23:32:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8E2F921C073 for ; Sun, 28 Aug 2011 23:32:52 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E65481B40BC for ; Sun, 28 Aug 2011 23:32:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1319080040 for ; Sun, 28 Aug 2011 23:32:51 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/ebuild.sh pym/portage/package/ebuild/doebuild.py X-VCS-Directories: pym/portage/package/ebuild/ bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: ae9b6cb513c7b29376caecf3b4e52aac452e2b93 Date: Sun, 28 Aug 2011 23:32:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 808bb9d4d9c62833762d6a28f02a3b39 commit: ae9b6cb513c7b29376caecf3b4e52aac452e2b93 Author: Zac Medico gentoo org> AuthorDate: Sun Aug 28 23:29:49 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Aug 28 23:29:49 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dae9b6cb5 doebuild: avoid redundant distfiles checks When the unpack phase is already marked as complete, it's wasteful to check distfiles digests. In order to avoid this, we have to migrate the distfiles/workdir timestamp comparisons from ebuild.sh to doebuild.py, so that doebuild always knows when unpack will be triggered. This also allows us to eliminate code in dyn_unpack that duplicated dyn_clean, actually call dyn_clean instead. --- bin/ebuild.sh | 37 +--------------- pym/portage/package/ebuild/doebuild.py | 70 ++++++++++++++++++++++++++= +++++- 2 files changed, 71 insertions(+), 36 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index d68e54b..23a1240 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -726,41 +726,10 @@ dyn_setup() { } =20 dyn_unpack() { - local newstuff=3D"no" - if [ -e "${WORKDIR}" ]; then - local x - local checkme - for x in $A ; do - vecho ">>> Checking ${x}'s mtime..." - if [ "${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/${x}" -nt "${WORKDIR}" ];= then - vecho ">>> ${x} has been updated; recreating WORKDIR..." - newstuff=3D"yes" - break - fi - done - if [ ! -f "${PORTAGE_BUILDDIR}/.unpacked" ] ; then - vecho ">>> Not marked as unpacked; recreating WORKDIR..." - newstuff=3D"yes" - fi - fi - if [ "${newstuff}" =3D=3D "yes" ]; then - # We don't necessarily have privileges to do a full dyn_clean here. - rm -rf "${PORTAGE_BUILDDIR}"/{.setuped,.unpacked,.prepared,.configured= ,.compiled,.tested,.installed,.packaged,build-info} - if ! has keepwork $FEATURES ; then - rm -rf "${WORKDIR}" - fi - if [ -d "${T}" ] && \ - ! has keeptemp $FEATURES ; then - rm -rf "${T}" && mkdir "${T}" - fi - fi - if [ -e "${WORKDIR}" ]; then - if [ "$newstuff" =3D=3D "no" ]; then - vecho ">>> WORKDIR is up-to-date, keeping..." - return 0 - fi + if [[ -f ${PORTAGE_BUILDDIR}/.unpacked ]] ; then + vecho ">>> WORKDIR is up-to-date, keeping..." + return 0 fi - if [ ! -d "${WORKDIR}" ]; then install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed= to create dir '${WORKDIR}'" fi diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package= /ebuild/doebuild.py index c252e86..a95a418 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -432,6 +432,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debu= g=3D0, listonly=3D0, "install":["test"], "rpm": ["install"], "package":["install"], + "merge" :["install"], } =09 if mydbapi is None: @@ -666,6 +667,68 @@ def doebuild(myebuild, mydo, myroot, mysettings, deb= ug=3D0, listonly=3D0, return unmerge(mysettings["CATEGORY"], mysettings["PF"], myroot, mysettings, vartree=3Dvartree) =20 + phases_to_run =3D set() + if "noauto" in mysettings.features or \ + mydo not in actionmap_deps: + phases_to_run.add(mydo) + else: + phase_stack =3D [mydo] + while phase_stack: + x =3D phase_stack.pop() + if x in phases_to_run: + continue + phases_to_run.add(x) + phase_stack.extend(actionmap_deps.get(x, [])) + del phase_stack + + alist =3D set(mysettings.configdict["pkg"].get("A", "").split()) + + unpacked =3D False + if "unpack" in phases_to_run: + try: + workdir_st =3D os.stat(mysettings["WORKDIR"]) + except OSError: + pass + else: + newstuff =3D False + if not os.path.exists(os.path.join( + mysettings["PORTAGE_BUILDDIR"], ".unpacked")): + writemsg_stdout( + ">>> Not marked as unpacked; recreating WORKDIR...\n") + newstuff =3D True + else: + for x in alist: + writemsg_stdout(">>> Checking %s's mtime...\n" % x) + try: + x_st =3D os.stat(os.path.join( + mysettings["DISTDIR"], x)) + except OSError: + # file not fetched yet + x_st =3D None + + if x_st is None or x_st.st_mtime > workdir_st.st_mtime: + writemsg_stdout(">>> Timestamp of " + "%s has changed; recreating WORKDIR...\n" % x) + newstuff =3D True + break + + if newstuff: + if builddir_lock is None and \ + 'PORTAGE_BUILDIR_LOCKED' not in mysettings: + builddir_lock =3D EbuildBuildDir( + scheduler=3DPollScheduler().sched_iface, + settings=3Dmysettings) + builddir_lock.lock() + try: + _spawn_phase("clean", mysettings) + finally: + if builddir_lock is not None: + builddir_lock.unlock() + builddir_lock =3D None + else: + writemsg_stdout(">>> WORKDIR is up-to-date, keeping...\n") + unpacked =3D True + # Build directory creation isn't required for any of these. # In the fetch phase, the directory is needed only for RESTRICT=3Dfetc= h # in order to satisfy the sane $PWD requirement (from bug #239560) @@ -739,10 +802,9 @@ def doebuild(myebuild, mydo, myroot, mysettings, deb= ug=3D0, listonly=3D0, # Only try and fetch the files if we are going to need them ... # otherwise, if user has FEATURES=3Dnoauto and they run `ebuild clean # unpack compile install`, we will try and fetch 4 times :/ - need_distfiles =3D tree =3D=3D "porttree" and \ + need_distfiles =3D tree =3D=3D "porttree" and not unpacked and \ (mydo in ("fetch", "unpack") or \ mydo not in ("digest", "manifest") and "noauto" not in features) - alist =3D set(mysettings.configdict["pkg"].get("A", "").split()) if need_distfiles: =20 src_uri, =3D mydbapi.aux_get(mysettings.mycpv, @@ -787,6 +849,10 @@ def doebuild(myebuild, mydo, myroot, mysettings, deb= ug=3D0, listonly=3D0, # Files are already checked inside fetch(), # so do not check them again. checkme =3D [] + elif unpacked: + # The unpack phase is marked as complete, so it + # would be wasteful to check distfiles again. + checkme =3D [] else: checkme =3D alist =20