Use Portage config directly from src dir
Instead of copying the Portage configuration files to `/etc/portage` and `/usr/${target}/etc/portage`, the build scripts now use the configuration directories from the source directory. This avoids issues with changes (especially removal of files) getting propagated to the actual configuration paths.gentoo
parent
3ca750f495
commit
5f62193247
|
@ -1,6 +1,10 @@
|
||||||
/images
|
/images
|
||||||
/linux
|
/linux
|
||||||
/output
|
/output
|
||||||
|
/portage/config/*/etc/portage/make.profile
|
||||||
|
/portage/config/*/etc/portage/repos.conf
|
||||||
|
/portage/config/target/etc/portage/make.conf/10-crossdev.conf
|
||||||
|
/portage/repos/x-portage
|
||||||
/.built
|
/.built
|
||||||
/.prepared
|
/.prepared
|
||||||
/.host-tools
|
/.host-tools
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -5,12 +5,9 @@ update.tar: $(IMAGESDIR)/update.tar.zstd
|
||||||
|
|
||||||
$(O)/.prepared: \
|
$(O)/.prepared: \
|
||||||
prepare.sh \
|
prepare.sh \
|
||||||
config-portage.sh \
|
|
||||||
setup-local-repo.sh \
|
setup-local-repo.sh \
|
||||||
$(shell find portage host-portage -type f) \
|
|
||||||
$(shell find patches/ebuilds -type f)
|
$(shell find patches/ebuilds -type f)
|
||||||
./prepare.sh
|
./prepare.sh
|
||||||
./config-portage.sh
|
|
||||||
./setup-local-repo.sh
|
./setup-local-repo.sh
|
||||||
mkdir -p $(O)
|
mkdir -p $(O)
|
||||||
touch $(O)/.prepared
|
touch $(O)/.prepared
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# vim: set sw=4 ts=4 sts=4 et :
|
# vim: set sw=4 ts=4 sts=4 et :
|
||||||
|
|
||||||
|
PORTAGE_CONFIGROOT="${PWD}"/portage/config/host \
|
||||||
< host-tools.packages xargs -ro \
|
< host-tools.packages xargs -ro \
|
||||||
emerge -vnUj
|
emerge -vnUj
|
||||||
|
|
|
@ -7,6 +7,7 @@ O="${1}"
|
||||||
|
|
||||||
. ./config
|
. ./config
|
||||||
|
|
||||||
|
PORTAGE_CONFIGROOT="${PWD}"/portage/config/host \
|
||||||
emerge -vnj ${kernel_pkg}
|
emerge -vnj ${kernel_pkg}
|
||||||
|
|
||||||
export ARCH=arm64 CROSS_COMPILE=${target}-
|
export ARCH=arm64 CROSS_COMPILE=${target}-
|
||||||
|
|
|
@ -23,12 +23,12 @@ ln -snf \
|
||||||
cp -r portage/. /mnt/gentoo/etc/portage/
|
cp -r portage/. /mnt/gentoo/etc/portage/
|
||||||
|
|
||||||
ROOT=/mnt/gentoo \
|
ROOT=/mnt/gentoo \
|
||||||
PORTAGE_CONFIGROOT=/mnt/gentoo \
|
PORTAGE_CONFIGROOT="${PWD}"/portage/config/target \
|
||||||
< install.packages xargs -ro \
|
< install.packages xargs -ro \
|
||||||
${target}-emerge -Kvnj
|
${target}-emerge -Kvnj
|
||||||
|
|
||||||
ROOT=/mnt/gentoo \
|
ROOT=/mnt/gentoo \
|
||||||
PORTAGE_CONFIGROOT=/mnt/gentoo \
|
PORTAGE_CONFIGROOT="${PWD}"/portage/config/target \
|
||||||
< installonly.packages xargs -ro \
|
< installonly.packages xargs -ro \
|
||||||
${target}-emerge -vnj
|
${target}-emerge -vnj
|
||||||
|
|
||||||
|
|
2
build.sh
2
build.sh
|
@ -7,6 +7,8 @@ set -e
|
||||||
|
|
||||||
unset MAKEFLAGS MAKEOVERRIDES MAKELEVEL
|
unset MAKEFLAGS MAKEOVERRIDES MAKELEVEL
|
||||||
|
|
||||||
|
export PORTAGE_CONFIGROOT="${PWD}"/portage/config/target
|
||||||
|
|
||||||
${target}-emerge -vuUDj sys-apps/util-linux
|
${target}-emerge -vuUDj sys-apps/util-linux
|
||||||
|
|
||||||
cat \
|
cat \
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# vim: set sw=4 ts=4 sts=4 et :
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
. ./config
|
|
||||||
|
|
||||||
cp -r host-portage/. /etc/portage/
|
|
||||||
cp -r portage/. /usr/${target}/etc/portage/
|
|
||||||
|
|
||||||
# Set the Portage profile
|
|
||||||
ln -snf \
|
|
||||||
/var/db/repos/gentoo/profiles/${profile} \
|
|
||||||
/usr/${target}/etc/portage/make.profile
|
|
|
@ -0,0 +1 @@
|
||||||
|
masters = gentoo
|
|
@ -0,0 +1 @@
|
||||||
|
x-portage
|
43
prepare.sh
43
prepare.sh
|
@ -13,16 +13,16 @@ fi
|
||||||
chown portage: "$(portageq envvar DISTDIR)"
|
chown portage: "$(portageq envvar DISTDIR)"
|
||||||
|
|
||||||
ARCH=$(PORTAGE_CONFIGROOT=/usr/${target} portageq envvar ARCH)
|
ARCH=$(PORTAGE_CONFIGROOT=/usr/${target} portageq envvar ARCH)
|
||||||
|
PKGDIR=$(portageq envvar PKGDIR)
|
||||||
|
FEATURES="${FEATURES} binpkg-multi-instance"
|
||||||
|
|
||||||
if [ -f /usr/${target}/etc/portage/make.conf ]; then
|
|
||||||
sed -i '/PKGDIR=/d' /usr/${target}/etc/portage/make.conf
|
|
||||||
fi
|
|
||||||
# For some reason, libcap installs its pkg-config files in the wrong
|
# For some reason, libcap installs its pkg-config files in the wrong
|
||||||
# place. More strangely, even though `PKG_CONFIG_PATH` contains that
|
# place. More strangely, even though `PKG_CONFIG_PATH` contains that
|
||||||
# directory, `pkg-config` does not find the `.pc` files for libcap.
|
# directory, `pkg-config` does not find the `.pc` files for libcap.
|
||||||
# We work around this by merging /usr/lib64/pkgconfig and
|
# We work around this by merging /usr/lib64/pkgconfig and
|
||||||
# /usr/lib/pkgconfig.
|
# /usr/lib/pkgconfig.
|
||||||
FEATURES="${FEATURES} binpkg-multi-instance" \
|
FEATURES="${FEATURES}" \
|
||||||
|
PKGDIR="${PKGDIR}" \
|
||||||
${target}-emerge -kb1vnj sys-libs/libcap
|
${target}-emerge -kb1vnj sys-libs/libcap
|
||||||
if [ -d /usr/${target}/usr/lib/pkgconfig ] \
|
if [ -d /usr/${target}/usr/lib/pkgconfig ] \
|
||||||
&& [ ! -d /usr/${target}/usr/lib64/pkgconfig ]; then
|
&& [ ! -d /usr/${target}/usr/lib64/pkgconfig ]; then
|
||||||
|
@ -30,32 +30,35 @@ if [ -d /usr/${target}/usr/lib/pkgconfig ] \
|
||||||
ln -snf ../lib64/pkgconfig /usr/${target}/usr/lib/pkgconfig
|
ln -snf ../lib64/pkgconfig /usr/${target}/usr/lib/pkgconfig
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d /usr/${target}/etc/portage/make.conf ]; then
|
if [ ! -f portage/make.conf/10-crossdev.conf ]; then
|
||||||
mv /usr/${target}/etc/portage/make.conf \
|
sed -r \
|
||||||
/usr/${target}/etc/portage/make.conf.orig
|
-e 's: ?-pam::' \
|
||||||
sed -ri 's: ?-pam::' /usr/${target}/etc/portage/make.conf.orig
|
-e '/PKGDIR=/d' \
|
||||||
ls -l /usr/${target}/etc/portage
|
/usr/${target}/etc/portage/make.conf \
|
||||||
mkdir /usr/${target}/etc/portage/make.conf
|
> portage/config/target/etc/portage/make.conf/10-crossdev.conf
|
||||||
mv /usr/${target}/etc/portage/make.conf.orig \
|
|
||||||
/usr/${target}/etc/portage/make.conf/10-base.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d /etc/portage/make.conf ]; then
|
|
||||||
mv /etc/portage/make.conf \
|
|
||||||
/etc/portage/make.conf.orig
|
|
||||||
mkdir /etc/portage/make.conf
|
|
||||||
mv /etc/portage/make.conf.orig \
|
|
||||||
/etc/portage/make.conf/10-base.conf
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -snf /var/db/repos/gentoo/profiles/default/linux/${ARCH}/17.0 \
|
ln -snf /var/db/repos/gentoo/profiles/default/linux/${ARCH}/17.0 \
|
||||||
/usr/${target}/etc/portage/make.profile
|
/usr/${target}/etc/portage/make.profile
|
||||||
|
|
||||||
|
FEATURES="${FEATURES}" \
|
||||||
|
PKGDIR="${PKGDIR}" \
|
||||||
${target}-emerge -bk1nvj sys-libs/glibc
|
${target}-emerge -bk1nvj sys-libs/glibc
|
||||||
|
|
||||||
|
FEATURES="${FEATURES}" \
|
||||||
|
PKGDIR=$(portageq envvar PKGDIR) \
|
||||||
|
USE=pam \
|
||||||
${target}-emerge -bknvj sys-apps/util-linux
|
${target}-emerge -bknvj sys-apps/util-linux
|
||||||
|
|
||||||
# Migrate to the merged-usr layout
|
# Migrate to the merged-usr layout
|
||||||
mkdir -p /usr/${target}/bin
|
mkdir -p /usr/${target}/bin
|
||||||
emerge -bknv --quiet-build=y merge-usr
|
emerge -bknv --quiet-build=y merge-usr
|
||||||
merge-usr --root=/usr/${target}
|
merge-usr --root=/usr/${target}
|
||||||
|
|
||||||
|
# Set the Portage profile
|
||||||
|
ln -snf \
|
||||||
|
/var/db/repos/gentoo/profiles/${profile} \
|
||||||
|
portage/config/target/etc/portage/make.profile
|
||||||
|
ln -snf \
|
||||||
|
$(realpath /etc/portage/make.profile) \
|
||||||
|
portage/config/host/etc/portage/make.profile
|
||||||
|
|
|
@ -5,13 +5,10 @@ set -e
|
||||||
|
|
||||||
. ./config
|
. ./config
|
||||||
|
|
||||||
mkdir -p /var/db/repos/x-portage/profiles /var/db/repos/x-portage/metadata
|
mkdir -p portage/config/target/etc/portage/repos.conf
|
||||||
echo x-portage > /var/db/repos/x-portage/profiles/repo_name
|
cat > portage/config/target/etc/portage/repos.conf/x-portage.conf <<EOF
|
||||||
echo 'masters = gentoo' > /var/db/repos/x-portage/metadata/layout.conf
|
|
||||||
mkdir -p /usr/${target}/etc/portage/repos.conf
|
|
||||||
cat > /usr/${target}/etc/portage/repos.conf/x-portage.conf <<EOF
|
|
||||||
[x-portage]
|
[x-portage]
|
||||||
location = /var/db/repos/x-portage
|
location = ${PWD}/portage/repos/x-portage
|
||||||
auto-sync = no
|
auto-sync = no
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -20,9 +17,9 @@ for patch in patches/ebuilds/*/*/*.patch; do
|
||||||
cp=${patch#patches/ebuilds/}
|
cp=${patch#patches/ebuilds/}
|
||||||
cp=${cp%/*.patch}
|
cp=${cp%/*.patch}
|
||||||
printf 'Applying patch %s for %s ...\n' "${patch##*/}" "${cp}"
|
printf 'Applying patch %s for %s ...\n' "${patch##*/}" "${cp}"
|
||||||
mkdir -p /var/db/repos/x-portage/${cp}
|
mkdir -p portage/repos/x-portage/${cp}
|
||||||
cp -r /var/db/repos/gentoo/${cp}/. /var/db/repos/x-portage/${cp}
|
cp -r /var/db/repos/gentoo/${cp}/. portage/repos/x-portage/${cp}
|
||||||
for f in /var/db/repos/x-portage/${cp}/*.ebuild; do
|
for f in portage/repos/x-portage/${cp}/*.ebuild; do
|
||||||
patch "${f}" "${patch}"
|
patch "${f}" "${patch}"
|
||||||
ebuild "${f}" digest
|
ebuild "${f}" digest
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue