aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-11-01 10:42:08 +0100
committerMichał Górny <mgorny@gentoo.org>2018-11-05 19:48:28 +0100
commit3f50bfc1ae5bb211135d1c9286087ca39626ddf9 (patch)
treeb511341b2e10f68ca97d2907f1636b1486f3d8e5 /bin/misc-functions.sh
parentmisc-functions.sh: Inline and reflow __prepall (diff)
downloadportage-3f50bfc1ae5bb211135d1c9286087ca39626ddf9.tar.gz
portage-3f50bfc1ae5bb211135d1c9286087ca39626ddf9.tar.bz2
portage-3f50bfc1ae5bb211135d1c9286087ca39626ddf9.zip
Support disabling docompress for binary package builds
Add FEATURES=binpkg-docompress that can be used whether docompress compression is performed before or after creating binary packages. With the feature enabled (the default), the current behavior of storing compressed files in binpkg is preserved. With it disabled, uncompressed files are stored inside binary package and are compressed when installing. Storing uncompressed files in binary packages has two advantages: 1. Avoids the double-compression penalty, effectively improving binary package compression speed and compression ratio. 2. Allows the same packages to be reused on systems with different docompress configurations. The option is roughly backwards compatible. Old Portage versions will install packages created with FEATURES=-binpkg-docompress correctly, albeit without compression. Portage with FEATURES=binpkg-docompress should install old binpackages semi-correctly, potentially recompressing them (and throwing already-compressed warnings on format mismatch). The new behavior is left off by default to avoid those problems. Signed-off-by: Michał Górny <mgorny@gentoo.org> Reviewed-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'bin/misc-functions.sh')
-rwxr-xr-xbin/misc-functions.sh43
1 files changed, 39 insertions, 4 deletions
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index db7aaed5a..3b3a5e09c 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -109,10 +109,13 @@ install_qa_check() {
[[ -d ${ED%/}/usr/share/info ]] && prepinfo
- # Apply compression.
- "${PORTAGE_BIN_PATH}"/ecompress --queue "${PORTAGE_DOCOMPRESS[@]}"
- "${PORTAGE_BIN_PATH}"/ecompress --ignore "${PORTAGE_DOCOMPRESS_SKIP[@]}"
- "${PORTAGE_BIN_PATH}"/ecompress --dequeue
+ # If binpkg-docompress is enabled, apply compression before creating
+ # the binary package.
+ if has binpkg-docompress ${FEATURES}; then
+ "${PORTAGE_BIN_PATH}"/ecompress --queue "${PORTAGE_DOCOMPRESS[@]}"
+ "${PORTAGE_BIN_PATH}"/ecompress --ignore "${PORTAGE_DOCOMPRESS_SKIP[@]}"
+ "${PORTAGE_BIN_PATH}"/ecompress --dequeue
+ fi
export STRIP_MASK
if ___eapi_has_dostrip; then
@@ -160,6 +163,38 @@ install_qa_check() {
rm -f "${ED%/}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!"
}
+__dyn_instprep() {
+ if [[ -e ${PORTAGE_BUILDDIR}/.instprepped ]] ; then
+ __vecho ">>> It appears that '$PF' is already instprepped; skipping."
+ __vecho ">>> Remove '${PORTAGE_BUILDDIR}/.instprepped' to force instprep."
+ return 0
+ fi
+
+ if has chflags ${FEATURES}; then
+ # Save all the file flags for restoration afterwards.
+ mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
+ # Remove all the file flags so that we can do anything necessary.
+ chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
+ chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
+ fi
+
+ # If binpkg-docompress is disabled, we need to apply compression
+ # before installing.
+ if ! has binpkg-docompress ${FEATURES}; then
+ "${PORTAGE_BIN_PATH}"/ecompress --queue "${PORTAGE_DOCOMPRESS[@]}"
+ "${PORTAGE_BIN_PATH}"/ecompress --ignore "${PORTAGE_DOCOMPRESS_SKIP[@]}"
+ "${PORTAGE_BIN_PATH}"/ecompress --dequeue
+ fi
+
+ if has chflags ${FEATURES}; then
+ # Restore all the file flags that were saved earlier on.
+ mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
+ fi
+
+ >> "${PORTAGE_BUILDDIR}/.instprepped" || \
+ die "Failed to create ${PORTAGE_BUILDDIR}/.instprepped"
+}
+
preinst_qa_check() {
postinst_qa_check preinst
}