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]
This commit is contained in:
q66 2020-01-27 03:48:07 +01:00 committed by Daniel Kolesa
parent 3ebb28727d
commit f0e852c511
2 changed files with 27 additions and 27 deletions

View File

@ -334,8 +334,8 @@ setup_pkg() {
export XBPS_CROSS_BASE=/usr/$XBPS_CROSS_TRIPLET export XBPS_CROSS_BASE=/usr/$XBPS_CROSS_TRIPLET
export XBPS_TARGET_QEMU_MACHINE 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_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 -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_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_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" XBPS_RINDEX_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_RINDEX_CMD"

View File

@ -476,30 +476,6 @@ readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build-style
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
readonly XBPS_BUILDHELPERDIR=$XBPS_COMMONDIR/build-helper 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" readonly XBPS_TARGET="$1"
if [ "$2" ]; then if [ "$2" ]; then
XBPS_TARGET_PKG="${2##*/}" XBPS_TARGET_PKG="${2##*/}"
@ -548,6 +524,30 @@ if [ -z "$XBPS_TARGET_MACHINE" ]; then
export XBPS_TARGET_MACHINE=$XBPS_MACHINE export XBPS_TARGET_MACHINE=$XBPS_MACHINE
fi 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 \ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
XBPS_SRCPKGDIR XBPS_COMMONDIR XBPS_BUILDDIR \ XBPS_SRCPKGDIR XBPS_COMMONDIR XBPS_BUILDDIR \
XBPS_REPOSITORY XBPS_ALT_REPOSITORY XBPS_SRCDISTDIR XBPS_DIGEST_CMD \ XBPS_REPOSITORY XBPS_ALT_REPOSITORY XBPS_SRCDISTDIR XBPS_DIGEST_CMD \
@ -691,7 +691,7 @@ case "$XBPS_TARGET" in
;; ;;
clean-repocache) clean-repocache)
export XBPS_TARGET_ARCH="${XBPS_CROSS_BUILD:-$XBPS_TARGET_MACHINE}" 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)
consistency_check consistency_check