From 501231640a9524620a2741cd6fad818ba774365e Mon Sep 17 00:00:00 2001 From: q66 Date: Mon, 27 Jan 2020 03:48:07 +0100 Subject: [PATCH] xbps-src: implement per-architecture repocache That means instead of having a single hostdir/repocache, there is now hostdir/repocache-$XBPS_TARGET_MACHINE. This solves multiple problems: 1) When cross-compiling for different architectures and the repos for host and target differ, you will not get signature/checksum conflicts for noarch packages. 2) The clean-repocache command will not delete noarch packages that don't belong to that architecture. 3) Clean mixing of glibc and musl masterdirs with the same hostdir is now possible; even when building natively, the musl masterdir will use its repocache-foo-musl, while the glibc masterdir will use repocache-foo. [ci skip] --- common/xbps-src/shutils/common.sh | 4 +-- xbps-src | 50 +++++++++++++++---------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh index 5ca4d7132de..cfe097f364c 100644 --- a/common/xbps-src/shutils/common.sh +++ b/common/xbps-src/shutils/common.sh @@ -334,8 +334,8 @@ setup_pkg() { export XBPS_CROSS_BASE=/usr/$XBPS_CROSS_TRIPLET export XBPS_TARGET_QEMU_MACHINE - XBPS_INSTALL_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_INSTALL_CMD -c /host/repocache -r $XBPS_CROSS_BASE" - XBPS_QUERY_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_QUERY_CMD -c /host/repocache -r $XBPS_CROSS_BASE" + XBPS_INSTALL_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_INSTALL_CMD -c /host/repocache-$XBPS_TARGET_MACHINE -r $XBPS_CROSS_BASE" + XBPS_QUERY_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_QUERY_CMD -c /host/repocache-$XBPS_TARGET_MACHINE -r $XBPS_CROSS_BASE" XBPS_RECONFIGURE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_RECONFIGURE_CMD -r $XBPS_CROSS_BASE" XBPS_REMOVE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_REMOVE_CMD -r $XBPS_CROSS_BASE" XBPS_RINDEX_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_RINDEX_CMD" diff --git a/xbps-src b/xbps-src index 1ba52432707..6eaca002821 100755 --- a/xbps-src +++ b/xbps-src @@ -476,30 +476,6 @@ readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build-style readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec readonly XBPS_BUILDHELPERDIR=$XBPS_COMMONDIR/build-helper -if [ "$IN_CHROOT" ]; then - readonly XBPS_UHELPER_CMD="xbps-uhelper" - readonly XBPS_INSTALL_CMD="xbps-install -c /host/repocache" - readonly XBPS_QUERY_CMD="xbps-query -c /host/repocache" - readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure" - readonly XBPS_REMOVE_CMD="xbps-remove" - readonly XBPS_CHECKVERS_CMD="xbps-checkvers" - readonly XBPS_DESTDIR=/destdir - readonly XBPS_BUILDDIR=/builddir -else - readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR" - readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache -r $XBPS_MASTERDIR" - readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache -r $XBPS_MASTERDIR" - readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR" - readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR" - readonly XBPS_CHECKVERS_CMD="xbps-checkvers -r $XBPS_MASTERDIR" - readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir - readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir -fi -readonly XBPS_RINDEX_CMD="xbps-rindex" -readonly XBPS_FETCH_CMD="xbps-fetch" -readonly XBPS_DIGEST_CMD="xbps-digest" -readonly XBPS_CMPVER_CMD="xbps-uhelper cmpver" - readonly XBPS_TARGET="$1" if [ "$2" ]; then XBPS_TARGET_PKG="${2##*/}" @@ -548,6 +524,30 @@ if [ -z "$XBPS_TARGET_MACHINE" ]; then export XBPS_TARGET_MACHINE=$XBPS_MACHINE fi +if [ "$IN_CHROOT" ]; then + readonly XBPS_UHELPER_CMD="xbps-uhelper" + readonly XBPS_INSTALL_CMD="xbps-install -c /host/repocache-$XBPS_MACHINE" + readonly XBPS_QUERY_CMD="xbps-query -c /host/repocache-$XBPS_MACHINE" + readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure" + readonly XBPS_REMOVE_CMD="xbps-remove" + readonly XBPS_CHECKVERS_CMD="xbps-checkvers" + readonly XBPS_DESTDIR=/destdir + readonly XBPS_BUILDDIR=/builddir +else + readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR" + readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR" + readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR" + readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR" + readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR" + readonly XBPS_CHECKVERS_CMD="xbps-checkvers -r $XBPS_MASTERDIR" + readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir + readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir +fi +readonly XBPS_RINDEX_CMD="xbps-rindex" +readonly XBPS_FETCH_CMD="xbps-fetch" +readonly XBPS_DIGEST_CMD="xbps-digest" +readonly XBPS_CMPVER_CMD="xbps-uhelper cmpver" + export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \ XBPS_SRCPKGDIR XBPS_COMMONDIR XBPS_BUILDDIR \ XBPS_REPOSITORY XBPS_ALT_REPOSITORY XBPS_SRCDISTDIR XBPS_DIGEST_CMD \ @@ -691,7 +691,7 @@ case "$XBPS_TARGET" in ;; clean-repocache) export XBPS_TARGET_ARCH="${XBPS_CROSS_BUILD:-$XBPS_TARGET_MACHINE}" - $XBPS_REMOVE_CMD -C /dev/null -c $XBPS_HOSTDIR/repocache -O + $XBPS_REMOVE_CMD -C /dev/null -c $XBPS_HOSTDIR/repocache-${XBPS_TARGET_ARCH} -O ;; consistency-check) consistency_check