mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 01:46:19 +02:00
Compare commits
2 Commits
179-build-
...
github/for
Author | SHA1 | Date | |
---|---|---|---|
![]() |
669c88da7d | ||
![]() |
4b500415c2 |
10
archbuild.in
10
archbuild.in
@@ -34,16 +34,18 @@ usage() {
|
|||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
echo ' -c Recreate the chroot before building'
|
echo ' -c Recreate the chroot before building'
|
||||||
echo ' -r <dir> Create chroots in this directory'
|
echo ' -r <dir> Create chroots in this directory'
|
||||||
|
echo ' -s Do not run setarch'
|
||||||
echo ''
|
echo ''
|
||||||
echo "Default makechrootpkg args: ${makechrootpkg_args[*]}"
|
echo "Default makechrootpkg args: ${makechrootpkg_args[*]}"
|
||||||
echo ''
|
echo ''
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'hcr:' arg; do
|
while getopts 'hcr:s' arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
c) clean_first=true ;;
|
c) clean_first=true ;;
|
||||||
r) chroots="$OPTARG" ;;
|
r) chroots="$OPTARG" ;;
|
||||||
|
s) nosetarch_opt="-s" ;;
|
||||||
*) usage ;;
|
*) usage ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -51,7 +53,7 @@ done
|
|||||||
check_root SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER,GNUPGHOME
|
check_root SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER,GNUPGHOME
|
||||||
|
|
||||||
# Pass all arguments after -- right to makepkg
|
# Pass all arguments after -- right to makepkg
|
||||||
makechrootpkg_args+=("${@:$OPTIND}")
|
makechrootpkg_args+=("${nosetarch_opt}" "${@:$OPTIND}")
|
||||||
|
|
||||||
if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
||||||
msg "Creating chroot for [%s] (%s)..." "${repo}" "${arch}"
|
msg "Creating chroot for [%s] (%s)..." "${repo}" "${arch}"
|
||||||
@@ -69,14 +71,14 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
|||||||
|
|
||||||
rm -rf --one-file-system "${chroots}/${repo}-${arch}"
|
rm -rf --one-file-system "${chroots}/${repo}-${arch}"
|
||||||
(umask 0022; mkdir -p "${chroots}/${repo}-${arch}")
|
(umask 0022; mkdir -p "${chroots}/${repo}-${arch}")
|
||||||
setarch "${arch}" mkarchroot \
|
mkarchroot ${nosetarch_opt} \
|
||||||
-C "${pacman_config}" \
|
-C "${pacman_config}" \
|
||||||
-M "${makepkg_config}" \
|
-M "${makepkg_config}" \
|
||||||
"${chroots}/${repo}-${arch}/root" \
|
"${chroots}/${repo}-${arch}/root" \
|
||||||
"${base_packages[@]}" || abort
|
"${base_packages[@]}" || abort
|
||||||
else
|
else
|
||||||
lock 9 "${chroots}/${repo}-${arch}/root.lock" "Locking clean chroot"
|
lock 9 "${chroots}/${repo}-${arch}/root.lock" "Locking clean chroot"
|
||||||
arch-nspawn \
|
arch-nspawn ${nosetarch_opt} \
|
||||||
-C "${pacman_config}" \
|
-C "${pacman_config}" \
|
||||||
-M "${makepkg_config}" \
|
-M "${makepkg_config}" \
|
||||||
"${chroots}/${repo}-${arch}/root" \
|
"${chroots}/${repo}-${arch}/root" \
|
||||||
|
@@ -78,6 +78,7 @@ usage() {
|
|||||||
echo '-C Run checkpkg on the package'
|
echo '-C Run checkpkg on the package'
|
||||||
echo '-T Build in a temporary directory'
|
echo '-T Build in a temporary directory'
|
||||||
echo '-U Run makepkg as a specified user'
|
echo '-U Run makepkg as a specified user'
|
||||||
|
echo '-s Do not run setarch'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +145,7 @@ install_packages() {
|
|||||||
pkgnames=("${install_pkgs[@]##*/}")
|
pkgnames=("${install_pkgs[@]##*/}")
|
||||||
|
|
||||||
cp -- "${install_pkgs[@]}" "$copydir/root/"
|
cp -- "${install_pkgs[@]}" "$copydir/root/"
|
||||||
arch-nspawn "$copydir" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
arch-nspawn ${nosetarch_opt} "$copydir" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
bash -c 'yes y | pacman -U -- "$@"' -bash "${pkgnames[@]/#//root/}"
|
bash -c 'yes y | pacman -U -- "$@"' -bash "${pkgnames[@]/#//root/}"
|
||||||
ret=$?
|
ret=$?
|
||||||
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
||||||
@@ -273,7 +274,7 @@ move_products() {
|
|||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
while getopts 'hcur:I:l:nCTD:d:U:' arg; do
|
while getopts 'hcur:I:l:nCTD:d:U:s' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
c) clean_first=1 ;;
|
c) clean_first=1 ;;
|
||||||
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
|
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
|
||||||
@@ -286,6 +287,7 @@ while getopts 'hcur:I:l:nCTD:d:U:' arg; do
|
|||||||
C) run_checkpkg=1 ;;
|
C) run_checkpkg=1 ;;
|
||||||
T) temp_chroot=1; copy+="-$$" ;;
|
T) temp_chroot=1; copy+="-$$" ;;
|
||||||
U) makepkg_user="$OPTARG" ;;
|
U) makepkg_user="$OPTARG" ;;
|
||||||
|
s) nosetarch_opt="-s" ;;
|
||||||
h|*) usage ;;
|
h|*) usage ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -340,7 +342,7 @@ if [[ ! -d $copydir ]] || (( clean_first )); then
|
|||||||
sync_chroot "$chrootdir" "$copydir" "$copy"
|
sync_chroot "$chrootdir" "$copydir" "$copy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(( update_first )) && arch-nspawn "$copydir" \
|
(( update_first )) && arch-nspawn ${nosetarch_opt} "$copydir" \
|
||||||
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
pacman -Syuu --noconfirm
|
pacman -Syuu --noconfirm
|
||||||
|
|
||||||
@@ -360,7 +362,7 @@ download_sources
|
|||||||
|
|
||||||
prepare_chroot
|
prepare_chroot
|
||||||
|
|
||||||
if arch-nspawn "$copydir" \
|
if arch-nspawn ${nosetarch_opt} "$copydir" \
|
||||||
--bind="${PWD//:/\\:}:/startdir" \
|
--bind="${PWD//:/\\:}:/startdir" \
|
||||||
--bind="${SRCDEST//:/\\:}:/srcdest" \
|
--bind="${SRCDEST//:/\\:}:/srcdest" \
|
||||||
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
@@ -397,7 +399,7 @@ else
|
|||||||
for remotepkg in "${remotepkgs[@]}"; do
|
for remotepkg in "${remotepkgs[@]}"; do
|
||||||
if [[ $remotepkg != file://* ]]; then
|
if [[ $remotepkg != file://* ]]; then
|
||||||
msg2 "Downloading current versions"
|
msg2 "Downloading current versions"
|
||||||
arch-nspawn "$copydir" pacman --noconfirm -Swdd "${pkgnames[@]}"
|
arch-nspawn ${nosetarch_opt} "$copydir" pacman --noconfirm -Swdd "${pkgnames[@]}"
|
||||||
mapfile -t remotepkgs < <(pacman --config "$copydir"/etc/pacman.conf \
|
mapfile -t remotepkgs < <(pacman --config "$copydir"/etc/pacman.conf \
|
||||||
--dbpath "$copydir"/var/lib/pacman \
|
--dbpath "$copydir"/var/lib/pacman \
|
||||||
-Sddp "${pkgnames[@]}")
|
-Sddp "${pkgnames[@]}")
|
||||||
|
Reference in New Issue
Block a user