mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-14 18:36:18 +02:00
Compare commits
10 Commits
v1.2.1
...
support-of
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a0c0c63a85 | ||
![]() |
e1401ce41c | ||
![]() |
8612b41a20 | ||
![]() |
fbb661645b | ||
![]() |
f1dc2e18f7 | ||
![]() |
c9d821448b | ||
![]() |
a620250535 | ||
![]() |
27eebe383d | ||
![]() |
d6d416b653 | ||
![]() |
9ff63503b9 |
@@ -15,6 +15,8 @@ Description
|
|||||||
Build packages in clean chroot environment, offering various options
|
Build packages in clean chroot environment, offering various options
|
||||||
and functionalities to customize the package building process.
|
and functionalities to customize the package building process.
|
||||||
|
|
||||||
|
By default, chroot environments are located in '/var/lib/archbuild/'.
|
||||||
|
|
||||||
Build Options
|
Build Options
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
@@ -140,7 +140,7 @@ for _pkgname in "${pkgname[@]}"; do
|
|||||||
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
||||||
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
diff --side-by-side --suppress-common-lines --width="$COLUMNS" --color=auto "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
|
find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
|
||||||
find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname"
|
find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname"
|
||||||
|
@@ -165,7 +165,7 @@ pkgctl_aur_drop_from_repo() {
|
|||||||
warning 'Did not find %s in any repository, please delete manually' "${pkgbase}"
|
warning 'Did not find %s in any repository, please delete manually' "${pkgbase}"
|
||||||
else
|
else
|
||||||
msg2 " repo: ${pkgrepo}"
|
msg2 " repo: ${pkgrepo}"
|
||||||
pkgctl_db_remove "${pkgrepo}" "${pkgbase}"
|
pkgctl_db_remove --noconfirm "${pkgrepo}" "${pkgbase}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
@@ -63,7 +63,7 @@ pkgctl_auth_login() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
personal_access_token_url="https://${GITLAB_HOST}/-/profile/personal_access_tokens?name=pkgctl+token&scopes=api,write_repository"
|
personal_access_token_url="https://${GITLAB_HOST}/-/user_settings/personal_access_tokens?name=pkgctl+token&scopes=api,write_repository"
|
||||||
|
|
||||||
cat <<- _EOF_
|
cat <<- _EOF_
|
||||||
Logging into ${BOLD}${GITLAB_HOST}${ALL_OFF}
|
Logging into ${BOLD}${GITLAB_HOST}${ALL_OFF}
|
||||||
|
@@ -55,6 +55,7 @@ pkgctl_build_usage() {
|
|||||||
-o, --offload Build on a remote server and transfer artifacts afterwards
|
-o, --offload Build on a remote server and transfer artifacts afterwards
|
||||||
-c, --clean Recreate the chroot before building
|
-c, --clean Recreate the chroot before building
|
||||||
--inspect WHEN Spawn an interactive shell to inspect the chroot (never, always, failure)
|
--inspect WHEN Spawn an interactive shell to inspect the chroot (never, always, failure)
|
||||||
|
--offline MODE Run a part of the build process offline (build, check)
|
||||||
-w, --worker SLOT Name of the worker slot, useful for concurrent builds (disables automatic names)
|
-w, --worker SLOT Name of the worker slot, useful for concurrent builds (disables automatic names)
|
||||||
--nocheck Do not run the check() function in the PKGBUILD
|
--nocheck Do not run the check() function in the PKGBUILD
|
||||||
|
|
||||||
@@ -79,8 +80,8 @@ pkgctl_build_usage() {
|
|||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
$ ${COMMAND}
|
$ ${COMMAND}
|
||||||
$ ${COMMAND} --rebuild --staging --message 'libyay 0.42 rebuild' libfoo libbar
|
$ ${COMMAND} --rebuild --staging --release --message 'libyay 0.42 rebuild' libfoo libbar
|
||||||
$ ${COMMAND} --pkgver 1.42 --release --db-update
|
$ ${COMMAND} --pkgver=1.42 --release --db-update
|
||||||
_EOF_
|
_EOF_
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,6 +199,10 @@ pkgctl_build() {
|
|||||||
EDIT=1
|
EDIT=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--offline)
|
||||||
|
MAKECHROOT_OPTIONS+=("-o" "$2")
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
-o|--offload)
|
-o|--offload)
|
||||||
OFFLOAD=1
|
OFFLOAD=1
|
||||||
shift
|
shift
|
||||||
|
@@ -271,6 +271,7 @@ pkgctl_repo_configure() {
|
|||||||
if [[ -n $GPGKEY ]]; then
|
if [[ -n $GPGKEY ]]; then
|
||||||
git config commit.gpgsign true
|
git config commit.gpgsign true
|
||||||
git config user.signingKey "${GPGKEY}"
|
git config user.signingKey "${GPGKEY}"
|
||||||
|
git config gpg.format openpgp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set default git exclude
|
# set default git exclude
|
||||||
|
@@ -284,7 +284,7 @@ nvchecker_check_error() {
|
|||||||
local errors
|
local errors
|
||||||
|
|
||||||
if ! errors=$(jq --raw-output --exit-status \
|
if ! errors=$(jq --raw-output --exit-status \
|
||||||
'select(.level == "error") | "\(.event)" + if .error then ": \(.error)" else "" end' \
|
'select((.level == "error") and (.error != null)) | "\(.event)" + if .error then ": \(.error)" else "" end' \
|
||||||
<<< "${result}"); then
|
<<< "${result}"); then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@@ -40,6 +40,8 @@ bindmounts_ro=()
|
|||||||
bindmounts_rw=()
|
bindmounts_rw=()
|
||||||
bindmounts_tmpfs=()
|
bindmounts_tmpfs=()
|
||||||
|
|
||||||
|
offline_options=()
|
||||||
|
|
||||||
copy=$USER
|
copy=$USER
|
||||||
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
||||||
[[ -z "$copy" || $copy = root ]] && copy=copy
|
[[ -z "$copy" || $copy = root ]] && copy=copy
|
||||||
@@ -80,6 +82,7 @@ usage() {
|
|||||||
echo ' Useful for maintaining multiple copies'
|
echo ' Useful for maintaining multiple copies'
|
||||||
echo " Default: $copy"
|
echo " Default: $copy"
|
||||||
echo '-n Run namcap on the package'
|
echo '-n Run namcap on the package'
|
||||||
|
echo '-o Run given step offline'
|
||||||
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'
|
||||||
@@ -105,7 +108,7 @@ sync_chroot() {
|
|||||||
"Locking clean chroot [%s]" "$chrootdir/root"
|
"Locking clean chroot [%s]" "$chrootdir/root"
|
||||||
|
|
||||||
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copy"
|
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copy"
|
||||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
if is_btrfs "$chrootdir" && is_subvolume "$chrootdir/root" && ! mountpoint -q "$copydir"; then
|
||||||
subvolume_delete_recursive "$copydir" ||
|
subvolume_delete_recursive "$copydir" ||
|
||||||
die "Unable to delete subvolume %s" "$copydir"
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||||
@@ -203,6 +206,7 @@ EOF
|
|||||||
declare -p SOURCE_DATE_EPOCH 2>/dev/null || true
|
declare -p SOURCE_DATE_EPOCH 2>/dev/null || true
|
||||||
declare -p BUILDTOOL 2>/dev/null
|
declare -p BUILDTOOL 2>/dev/null
|
||||||
declare -p BUILDTOOLVER 2>/dev/null
|
declare -p BUILDTOOLVER 2>/dev/null
|
||||||
|
declare -p offline_options
|
||||||
printf '_chrootbuild "$@" || exit\n'
|
printf '_chrootbuild "$@" || exit\n'
|
||||||
|
|
||||||
if (( run_namcap )); then
|
if (( run_namcap )); then
|
||||||
@@ -222,14 +226,52 @@ _chrootbuild() {
|
|||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. /etc/profile
|
. /etc/profile
|
||||||
|
|
||||||
|
# for in_array
|
||||||
|
. /usr/share/makepkg/util.sh
|
||||||
|
|
||||||
# Beware, there are some stupid arbitrary rules on how you can
|
# Beware, there are some stupid arbitrary rules on how you can
|
||||||
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
||||||
# ${1} is OK, but $foo or $1 isn't.
|
# ${1} is OK, but $foo or $1 isn't.
|
||||||
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
||||||
|
|
||||||
|
# Run prepare
|
||||||
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
--preserve-env=BUILDTOOL \
|
--preserve-env=BUILDTOOL \
|
||||||
--preserve-env=BUILDTOOLVER \
|
--preserve-env=BUILDTOOLVER \
|
||||||
-iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
-iu builduser bash -c 'cd /startdir; makepkg --nobuild "$@"' -bash "$@"
|
||||||
|
|
||||||
|
if in_array "build" "${offline_options[@]}"; then
|
||||||
|
msg "building offline"
|
||||||
|
# Build offline
|
||||||
|
unshare -n -- sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
|
--preserve-env=BUILDTOOL \
|
||||||
|
--preserve-env=BUILDTOOLVER \
|
||||||
|
-iu builduser \
|
||||||
|
bash -c 'cd /startdir; makepkg --noprepare --noextract --nocheck "$@"' -bash "$@"
|
||||||
|
else
|
||||||
|
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
|
--preserve-env=BUILDTOOL \
|
||||||
|
--preserve-env=BUILDTOOLVER \
|
||||||
|
-iu builduser \
|
||||||
|
bash -c 'cd /startdir; makepkg --noprepare --noextract --nocheck "$@"' -bash "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if in_array "check" "${offline_options[@]}"; then
|
||||||
|
msg "check offline"
|
||||||
|
# Run tests online
|
||||||
|
unshare -n -- sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
|
--preserve-env=BUILDTOOL \
|
||||||
|
--preserve-env=BUILDTOOLVER \
|
||||||
|
-iu builduser \
|
||||||
|
bash -c 'cd /startdir; makepkg --noprepare --noextract --nobuild "$@"' -bash "$@"
|
||||||
|
else
|
||||||
|
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
|
--preserve-env=BUILDTOOL \
|
||||||
|
--preserve-env=BUILDTOOLVER \
|
||||||
|
-iu builduser \
|
||||||
|
bash -c 'cd /startdir; makepkg --noprepare --noextract --nobuild "$@"' -bash "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
ret=$?
|
ret=$?
|
||||||
case $ret in
|
case $ret in
|
||||||
0|14)
|
0|14)
|
||||||
@@ -293,7 +335,7 @@ move_products() {
|
|||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
while getopts 'hcur:I:l:nCTD:d:U:x:t:' arg; do
|
while getopts 'hcur:I:l:nCTD:o:d:U:x:t:' 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") ;;
|
||||||
@@ -304,6 +346,7 @@ while getopts 'hcur:I:l:nCTD:d:U:x:t:' arg; do
|
|||||||
I) install_pkgs+=("$OPTARG") ;;
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
l) copy="$OPTARG" ;;
|
l) copy="$OPTARG" ;;
|
||||||
n) run_namcap=1; makepkg_args+=(--install) ;;
|
n) run_namcap=1; makepkg_args+=(--install) ;;
|
||||||
|
o) offline_options+=("$OPTARG") ;;
|
||||||
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" ;;
|
||||||
|
Reference in New Issue
Block a user