diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-10-09 16:59:05 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-10-09 16:59:05 +0000 |
commit | da9a7da330fd361c073d1bcde79a18385e9323dc (patch) | |
tree | cedc44b169f34c119f222e81660ebc6af779238a /sys-apps | |
parent | pam_mount bump (diff) | |
download | historical-da9a7da330fd361c073d1bcde79a18385e9323dc.tar.gz historical-da9a7da330fd361c073d1bcde79a18385e9323dc.tar.bz2 historical-da9a7da330fd361c073d1bcde79a18385e9323dc.zip |
2.1.4.5 stable bump for security bug #239560 (insecure search path for
python -c). This also fixes bugs #222091 (mysterious 'Argument list too
long' errors), #239006 (dependency issues triggered by EAPI bump without
revbump), and #239471 (EAPI 2 triggers InvalidDependString during --search).
Bug #240304 tracks all bugs fixed since 2.1.4.4.
Package-Manager: portage-2.2_rc11_p11661/cvs/Linux 2.6.26-0911-x86-64 i686
RepoMan-Options: --force
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/portage/ChangeLog | 12 | ||||
-rw-r--r-- | sys-apps/portage/Manifest | 10 | ||||
-rw-r--r-- | sys-apps/portage/files/portage-2.1.4.5.patch | 92 | ||||
-rw-r--r-- | sys-apps/portage/portage-2.1.4.5.ebuild | 264 |
4 files changed, 373 insertions, 5 deletions
diff --git a/sys-apps/portage/ChangeLog b/sys-apps/portage/ChangeLog index 4a5ba4173488..163f1945fed9 100644 --- a/sys-apps/portage/ChangeLog +++ b/sys-apps/portage/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for sys-apps/portage # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.544 2008/09/26 16:12:26 zmedico Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.545 2008/10/09 16:59:05 zmedico Exp $ + +*portage-2.1.4.5 (09 Oct 2008) + + 09 Oct 2008; Zac Medico <zmedico@gentoo.org> +files/portage-2.1.4.5.patch, + +portage-2.1.4.5.ebuild: + 2.1.4.5 stable bump for security bug #239560 (insecure search path for + python -c). This also fixes bugs #222091 (mysterious 'Argument list too + long' errors), #239006 (dependency issues triggered by EAPI bump without + revbump), and #239471 (EAPI 2 triggers InvalidDependString during --search). + Bug #240304 tracks all bugs fixed since 2.1.4.4. *portage-2.2_rc11 (26 Sep 2008) diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest index 00732e1bb9a5..c42f1f6b0406 100644 --- a/sys-apps/portage/Manifest +++ b/sys-apps/portage/Manifest @@ -5,6 +5,7 @@ AUX 05portage.envd 34 RMD160 014194a1786a0983a8ba91c3924b798f353c330d SHA1 2af2c AUX 2.0.51.22-fixes.patch 10579 RMD160 aecbf663449b7b6c5fc8f4f343c30c1de7515fb3 SHA1 6305707411c213cd78f028952f7aabcb8b56e0ce SHA256 a6ae22f6513e9c5160204d9ba2ca8bab00091a88089139ff64bee68aaf63a95c AUX README.RESCUE 137 RMD160 b8d015f266501fd1f57c91899c6815de9f9d5685 SHA1 cfc8fcf81921e265f40b47644916331e0b8f18b9 SHA256 69bea0c755eab59b6b4d90838b8551744f0b0c8eeac170b1cd13a71ee83f9ac4 AUX manifest221 8642 RMD160 2d57f86637c14e3f2b407ac4d5afe02f10236360 SHA1 b083ff9b73d82f3231a6331914cea4c5dec171bc SHA256 8210bae20c7ec8df5bafc063ef3ef854695594fb04f7afa04258b383cf03954b +AUX portage-2.1.4.5.patch 3354 RMD160 d2e3a7305d226b54ada3b8f10d76e92e55be6881 SHA1 b30d755abad38af86af2717ae446ba103ff51e3f SHA256 9a6259a5787d6e9e7569e1d02be63f9ca7a0eb23ae7e52f7f55a1868b32a286e DIST portage-2.0.51.22.tar.bz2 257823 RMD160 068a6fbc3e41f7357d1ee4d65894e7903c467cfe SHA1 16459ce2b19592c94ec580bcfade5a89750a62fb SHA256 f0dac4366b5234b084645bbbd6b871a5abe05d501cf868046af2777e02a4100c DIST portage-2.1.1-r2.patch.bz2 5263 RMD160 6b749c6700784ea1ecc615b7b3ed39eade28e489 SHA1 4eaedfedf867346d67744d95d5cb3ad5b0da4417 SHA256 4d2bc33b66c6354f008d798507137a347e35ef7448a10ef17e5108160acb0414 DIST portage-2.1.1.tar.bz2 297006 RMD160 489e6c3e82527917f5308fdbff1c9add1a03f254 SHA1 6fdcb9897cef7f48d98829ab96caf37e31bd14a2 SHA256 3a5da4bb41ca8495f2673178f120622d8d923d8117b8744921418af5843c0389 @@ -22,16 +23,17 @@ DIST portage-man-pl-2.1.tar.bz2 52425 RMD160 5fdb898b94b0c6bb23234f0903572675f65 EBUILD portage-2.0.51.22-r3.ebuild 5645 RMD160 aa9a32e18b1190c809eca4bf780d7a33acc18459 SHA1 e62b7740112bba2ec367a83be7c7318403559735 SHA256 121f16d7a18818a9f5f93990170fb27f4510d91537c3150c40e85f3717c00899 EBUILD portage-2.1.1-r2.ebuild 7071 RMD160 55ae2117db2a60ab4a63b5a21309be258082a947 SHA1 4a72145a36ca3da55c275a65de7999058411fe4f SHA256 8a26a0bde49de97906b6ec181e5ecbfe51679cc598d6b501e3f1f95ba2b6ac58 EBUILD portage-2.1.4.4.ebuild 8040 RMD160 a7503dd4cc751c71b9fc01b23b34c6a544c84355 SHA1 2079cbf4ad68622c340ab6971e3e01bc73a4781a SHA256 0b00f1d93651606931d3b6e6addd9fe70183f6d7a8127146d48e093b00ff6198 +EBUILD portage-2.1.4.5.ebuild 8084 RMD160 8289f5e855b4f77dff1a193c8f53a0964275c80a SHA1 f3d1f863435538cb7fd64b20a668e6651bc84784 SHA256 35883b0dab4f6d2199dadbcd9ca5c0771bf681328702ecb03cb558d45db3c9d9 EBUILD portage-2.1.5.6.ebuild 8087 RMD160 4f60a69a380686583acb4de33c3d71abcaf9e304 SHA1 8998bc2244a040e23e6fc97dcd3135c2a46fdbb5 SHA256 c6af288fa2fa1636e41121f29a6b9cddd5ee42b00c6e4ae97ad5ecaa1cb74265 EBUILD portage-2.2_rc11.ebuild 8927 RMD160 ee96d1e7b738d043ed4057ca92b7b3d26046b8ef SHA1 651d3f1bdced242ad391136d954fb2be0d7c1941 SHA256 0112fbda4c52d33827a3ea9c1dd1a04a2447aaaa2f40e1cd67c81eca2440378d EBUILD portage-2.2_rc8.ebuild 8550 RMD160 fb886b2ee551da978610aedcbb46f64eb1d1968c SHA1 3490d8514b99e23fe7b7491161ceaa66aff4b22b SHA256 b9210e64bb0b61758e23c74d77a0d36a7731beae7a90e7167fd4a03838e4c071 EBUILD portage-2.2_rc9.ebuild 8778 RMD160 b088e44444cfe7813e0144a2f6ed7a289a1e2912 SHA1 3d57d5219c9474a0cafe550cb02488292ec63448 SHA256 23bb3a4361c4e10acb93edd81aa0cee96ce45bf375daa01a09a44525b87692f3 -MISC ChangeLog 16532 RMD160 9f9c48352e7f3babae2c368835d18854890f2412 SHA1 5b89bbfb289d997677af7653e2e8e308fc862b4d SHA256 868bc68208ab093534bb9bd52ee88112fb38f92c3bcfdf820089bbb07c003de9 +MISC ChangeLog 17021 RMD160 de4f035c61120d48f47185b1dede098ea1fdae82 SHA1 61fca6019f85754cf02f485e0518b0ca2bcffe1a SHA256 b05dab939a30cb52d00070e5ea9177c28501f1ec94e36aaeba98c93acfafc07e MISC metadata.xml 365 RMD160 f4900ef937d765e123eca2314d4570aa51cba27c SHA1 29e235a40e6f70005374a6f5c4d9dd2eb0eac3cf SHA256 475a792c24a7db2ae5fab7fb108bf39af08c272d03d87ef942883b297de95d6a -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) -iEYEARECAAYFAkjdCeoACgkQ/ejvha5XGaOKMACgnPZ83wtt8GBfdnWsacmpK4cC -3SgAnivDc+IuX2PFC8XL+Qzu94F80BpK -=u2HB +iEYEARECAAYFAkjuOGAACgkQ/ejvha5XGaNadwCgyVYvYqScxl4c1NVYHOGGQf/R +pbAAoOmel5LS4rpsTQGOKj8T2GWpUnYB +=ZS/c -----END PGP SIGNATURE----- diff --git a/sys-apps/portage/files/portage-2.1.4.5.patch b/sys-apps/portage/files/portage-2.1.4.5.patch new file mode 100644 index 000000000000..2abfb4d4f1c1 --- /dev/null +++ b/sys-apps/portage/files/portage-2.1.4.5.patch @@ -0,0 +1,92 @@ +diff --git a/bin/ebuild.sh b/bin/ebuild.sh +index 61f6e18..7fe126e 100755 +--- a/bin/ebuild.sh ++++ b/bin/ebuild.sh +@@ -260,6 +260,12 @@ register_die_hook() { + export EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} $*" + } + ++# Ensure that $PWD is sane whenever possible. ++if ! hasq "$EBUILD_PHASE" clean depend help ; then ++ cd "$PORTAGE_BUILDDIR" || \ ++ die "PORTAGE_BUILDDIR does not exist: '$PORTAGE_BUILDDIR'" ++fi ++ + #if no perms are specified, dirs/files will have decent defaults + #(not secretive, but not stupid) + umask 022 +diff --git a/bin/emerge b/bin/emerge +index bef6f40..61bec13 100755 +--- a/bin/emerge ++++ b/bin/emerge +@@ -634,13 +634,19 @@ class search: + import portage_manifest as manifest + mf = manifest.Manifest( + pkgdir, self.settings["DISTDIR"]) +- fetchlist = self.portdb.getfetchlist(mycpv, +- mysettings=self.settings, all=True)[1] + try: +- mysum[0] = mf.getDistfilesSize(fetchlist) +- except KeyError, e: +- file_size_str = "Unknown (missing digest for %s)" % \ +- str(e) ++ fetchlist = self.portdb.getfetchlist(mycpv, ++ mysettings=self.settings, all=True)[1] ++ except portage_exception.InvalidDependString, e: ++ file_size_str = "Unknown (%s)" % (e,) ++ del e ++ else: ++ try: ++ mysum[0] = mf.getDistfilesSize(fetchlist) ++ except KeyError, e: ++ file_size_str = "Unknown (missing " + \ ++ "digest for %s)" % (e,) ++ del e + + available = False + for db in self._dbs: +@@ -1083,7 +1089,7 @@ class FakeVartree(portage.vartree): + self._aux_get = self.dbapi.aux_get + self.dbapi.aux_get = self._aux_get_wrapper + self._aux_get_history = set() +- self._portdb_keys = ["DEPEND", "RDEPEND", "PDEPEND"] ++ self._portdb_keys = ["EAPI", "DEPEND", "RDEPEND", "PDEPEND"] + self._portdb = portdb + self._global_updates = None + +@@ -1095,6 +1101,8 @@ class FakeVartree(portage.vartree): + # Use the live ebuild metadata if possible. + live_metadata = dict(izip(self._portdb_keys, + self._portdb.aux_get(pkg, self._portdb_keys))) ++ if not portage.eapi_is_supported(live_metadata["EAPI"]): ++ raise KeyError(pkg) + self.dbapi.aux_update(pkg, live_metadata) + except (KeyError, portage_exception.PortageException): + if self._global_updates is None: +diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py +index 83b250b..a078f04 100755 +--- a/bin/filter-bash-environment.py ++++ b/bin/filter-bash-environment.py +@@ -31,7 +31,7 @@ def filter_bash_environment(pattern, file_in, file_out): + file_out.write(line) + continue + if pattern.match(line) is None: +- file_out.write(line) ++ file_out.write(line.replace("\1", "")) + + if __name__ == "__main__": + description = "Filter out any lines that match a given PATTERN " + \ +diff --git a/pym/portage.py b/pym/portage.py +index b63105c..83228ba 100644 +--- a/pym/portage.py ++++ b/pym/portage.py +@@ -4475,8 +4475,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, + + # Build directory creation isn't required for any of these. + have_build_dirs = False +- if mydo not in ("clean", "cleanrm", "digest", +- "fetch", "help", "manifest"): ++ if mydo not in ("clean", "cleanrm", "digest", "help", "manifest"): + mystatus = prepare_build_dirs(myroot, mysettings, cleanup) + if mystatus: + return mystatus diff --git a/sys-apps/portage/portage-2.1.4.5.ebuild b/sys-apps/portage/portage-2.1.4.5.ebuild new file mode 100644 index 000000000000..417abe4924a3 --- /dev/null +++ b/sys-apps/portage/portage-2.1.4.5.ebuild @@ -0,0 +1,264 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.4.5.ebuild,v 1.1 2008/10/09 16:59:05 zmedico Exp $ + +inherit toolchain-funcs eutils flag-o-matic multilib + +DESCRIPTION="Portage is the package management and distribution system for Gentoo" +HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml" +LICENSE="GPL-2" +KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd" +PROVIDE="virtual/portage" +SLOT="0" +IUSE="build doc epydoc selinux linguas_pl" +DEPEND=">=dev-lang/python-2.4 + !build? ( >=sys-apps/sed-4.0.5 ) + doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 ) + epydoc? ( >=dev-python/epydoc-2.0 )" +RDEPEND=">=dev-lang/python-2.4 + !build? ( >=sys-apps/sed-4.0.5 + >=app-shells/bash-3.2_p17 ) + elibc_FreeBSD? ( sys-freebsd/freebsd-bin ) + elibc_glibc? ( >=sys-apps/sandbox-1.2.17 !mips? ( >=sys-apps/sandbox-1.2.18.1-r2 ) ) + elibc_uclibc? ( >=sys-apps/sandbox-1.2.17 !mips? ( >=sys-apps/sandbox-1.2.18.1-r2 ) ) + >=app-misc/pax-utils-0.1.13 + selinux? ( >=dev-python/python-selinux-2.16 )" +PDEPEND=" + !build? ( + >=net-misc/rsync-2.6.4 + userland_GNU? ( >=sys-apps/coreutils-6.4 ) + || ( >=dev-lang/python-2.5 >=dev-python/pycrypto-2.0.1-r6 ) + )" +# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 +# rsync-2.6.4 rdep is for the --filter option #167668 +SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives" + +PV_PL="2.1.2" +PATCHVER_PL="" +TARBALL_PV="2.1.4" +SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2 + ${SRC_ARCHIVES}/${PN}-${TARBALL_PV}.tar.bz2 + linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2 + ${SRC_ARCHIVES}/${PN}-man-pl-${PV_PL}.tar.bz2 )" + +PATCHVER="2.1.4.4" +if [ -n "${PATCHVER}" ]; then + SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2 + ${SRC_ARCHIVES}/${PN}-${PATCHVER}.patch.bz2" +fi + +if [ -n "${PATCHVER_PL}" ]; then + SRC_URI="${SRC_URI} linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}${PATCHVER_PL}.patch.bz2 + ${SRC_ARCHIVES}/${PN}-man-pl-${PV_PL}${PATCHVER_PL}.patch.bz2 )" +fi + +S="${WORKDIR}"/${PN}-${TARBALL_PV} +S_PL="${WORKDIR}"/${PN}-${PV_PL} + +portage_docs() { + elog "" + elog "For help with using portage please consult the Gentoo Handbook" + elog "at http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3" + elog "" +} + +src_unpack() { + unpack ${A} + cd "${S}" + if [ -n "${PATCHVER}" ]; then + cd "${S}" + epatch "${WORKDIR}/${PN}-${PATCHVER}.patch" + fi + epatch "$FILESDIR"/portage-2.1.4.5.patch + einfo "Setting portage.VERSION to ${PVR} ..." + sed -i "s/^VERSION=.*/VERSION=\"${PVR}\"/" pym/portage.py || \ + die "Failed to patch portage.VERSION" + eend 0 + if [ -n "${PATCHVER_PL}" ]; then + use linguas_pl && \ + epatch "${WORKDIR}/${PN}-man-pl-${PV_PL}${PATCHVER_PL}.patch" + fi +} + +src_compile() { + append-lfs-flags + + cd "${S}"/src + $(tc-getCC) ${CFLAGS} ${LDFLAGS} -o tbz2tool tbz2tool.c || \ + die "Failed to build tbz2tool" + + if use doc; then + cd "${S}"/doc + touch fragment/date + sed -i "s/svn-trunk/${PVR}/" fragment/version + make xhtml xhtml-nochunks || die "failed to make docs" + fi + + if use epydoc; then + einfo "Generating api docs" + mkdir "${WORKDIR}"/api + local my_modules + my_modules="$(find "${S}/pym" -name "*.py" \ + | sed -e 's:/__init__.py$::' -e 's:\.py$::' -e "s:^${S}/pym/::" \ + -e 's:/:.:g')" || die "error listing modules" + PYTHONPATH="${S}/pym:${PYTHONPATH}" epydoc -o "${WORKDIR}"/api \ + -qqqqq --no-frames --show-imports \ + --name "${PN}" --url "${HOMEPAGE}" \ + ${my_modules} || die "epydoc failed" + fi +} + +src_test() { + ./tests/runTests || \ + die "test(s) failed" +} + +src_install() { + local libdir=$(get_libdir) + local portage_base="/usr/${libdir}/portage" + cd "${S}"/cnf + insinto /etc + doins etc-update.conf dispatch-conf.conf make.globals + if [ -f "make.conf.${ARCH}".diff ]; then + patch make.conf "make.conf.${ARCH}".diff || \ + die "Failed to patch make.conf.example" + newins make.conf make.conf.example + else + eerror "" + eerror "Portage does not have an arch-specific configuration for this arch." + eerror "Please notify the arch maintainer about this issue. Using generic." + eerror "" + newins make.conf make.conf.example + fi + + insinto /etc/logrotate.d + doins "${S}"/cnf/logrotate.d/elog-save-summary + + dodir ${portage_base}/bin + exeinto ${portage_base}/bin + # BSD and OSX need a sed wrapper so that find/xargs work properly + if use userland_GNU; then + rm "${S}"/bin/sed || die "Failed to remove sed wrapper" + fi + cd "${S}"/bin + doexe * + doexe "${S}"/src/tbz2tool + dosym newins ${portage_base}/bin/donewins + + local mydir + for mydir in pym pym/cache pym/elog_modules; do + dodir ${portage_base}/${mydir} + insinto ${portage_base}/${mydir} + cd "${S}"/${mydir} + doins *.py + done + + doman "${S}"/man/*.[0-9] + if use linguas_pl; then + doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] + doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] + fi + dodoc "${S}"/ChangeLog + dodoc "${S}"/NEWS + dodoc "${S}"/RELEASE-NOTES + use doc && dohtml "${S}"/doc/*.html + use epydoc && dohtml -r "${WORKDIR}"/api + + dodir /usr/bin + local x + for x in ebuild emerge portageq repoman tbz2tool xpak; do + dosym ../${libdir}/portage/bin/${x} /usr/bin/${x} + done + + dodir /usr/sbin + local my_syms="archive-conf + dispatch-conf + emaint + emerge-webrsync + env-update + etc-update + fixpackages + quickpkg + regenworld" + local x + for x in ${my_syms}; do + dosym ../${libdir}/portage/bin/${x} /usr/sbin/${x} + done + dosym env-update /usr/sbin/update-env + dosym etc-update /usr/sbin/update-etc + + dodir /etc/portage + keepdir /etc/portage + + echo PYTHONPATH=\"${portage_base}/pym\" > "${WORKDIR}"/05portage.envd + doenvd "${WORKDIR}"/05portage.envd +} + +pkg_preinst() { + if ! use build && ! has_version dev-python/pycrypto && \ + has_version '>=dev-lang/python-2.5' ; then + if ! built_with_use '>=dev-lang/python-2.5' ssl ; then + echo "If you are a Gentoo developer and you plan to" \ + "commit ebuilds with this system then please install" \ + "pycrypto or enable python's ssl USE flag in order" \ + "to enable RMD160 hash support. See bug #198398 for" \ + "more information." | \ + fmt -w 70 | while read line ; do ewarn "${line}" ; done + fi + fi + local portage_base="/usr/$(get_libdir)/portage" + if has livecvsportage ${FEATURES} && [ "${ROOT}" = "/" ]; then + rm -rf "${D}"/${portage_base}/pym/* + mv "${D}"/${portage_base}/bin/tbz2tool "${T}" + rm -rf "${D}"/${portage_base}/bin/* + mv "${T}"/tbz2tool "${D}"/${portage_base}/bin/ + fi +} + +pkg_postinst() { + local x + + if [ ! -f "${ROOT}/var/lib/portage/world" ] && + [ -f "${ROOT}"/var/cache/edb/world ] && + [ ! -h "${ROOT}"/var/cache/edb/world ]; then + mv "${ROOT}"/var/cache/edb/world "${ROOT}"/var/lib/portage/world + ln -s ../../lib/portage/world /var/cache/edb/world + fi + + for x in "${ROOT}"/etc/._cfg????_make.globals; do + # Overwrite the globals file automatically. + [ -e "${x}" ] && mv -f "${x}" "${ROOT}etc/make.globals" + done + + # Compile all source files recursively. Any orphans + # will be identified and removed in postrm. + compile_all_python_bytecodes "${ROOT}usr/$(get_libdir)/portage/pym" + + echo "If you have an overlay then you should remove **/files/digest-*" \ + "files (Manifest1) because they are no longer supported. If earlier" \ + "versions of portage will be used to generate manifests for your overlay" \ + "then you should add a file named manifest1_obsolete to the root of the" \ + "repository in order to disable generation of the" \ + "Manifest1 digest files." | fmt -w 75 | while read x ; do elog "$x" ; done + + portage_docs +} + +pkg_postrm() { + remove_orphan_python_bytecodes "${ROOT}usr/$(get_libdir)/portage/pym" +} + +compile_all_python_bytecodes() { + python -c "from compileall import compile_dir; compile_dir('${1}', quiet=True)" + python -O -c "from compileall import compile_dir; compile_dir('${1}', quiet=True)" +} + +remove_orphan_python_bytecodes() { + [[ -d ${1} ]] || return + find "${1}" -name '*.py[co]' -print0 | \ + while read -d $'\0' f ; do + src_py=${f%[co]} + [[ -f ${src_py} ]] && continue + rm -f "${src_py}"[co] + done +} |