Compare commits

...

5 Commits

Author SHA1 Message Date
Carl Smedstad
a1b66a95b6 Merge branch 'offload-build-handle-non-bash' into 'master'
fix(offload-build): Handle non-bash shell on build server

See merge request archlinux/devtools!293
2025-08-06 22:39:16 +02:00
Jakub Klinkovský
fc56ebedf3 fix(completion): fix bash completion for the license subcommand
Signed-off-by: Jakub Klinkovský <lahwaacz@archlinux.org>
2025-08-05 17:48:12 +02:00
Christian Heusel
01757e6904 fix(commitpkg): Quiet git ls-files output
So far all files in `needsversioning=(...)` have been printed to the
command line if they were found, which is not useful, especially now
that we have more files present there.

It makes sense however to keep the standard error output, as this gives
a actionable suggestion what one should to to fix the issue:

    > error: pathspec 'PKGBUILD' did not match any file(s) known to git
    > Did you forget to 'git add'?

Fixes #281

Signed-off-by: Christian Heusel <christian@heusel.eu>
2025-08-01 11:26:57 +02:00
Daniel M. Capella
c5fe8ff3e6 feat(license): Extend matches for sysusers/tmpfiles configs
Eg. to match:
- sysusers.conf
- $pkgname.sysusers
- $pkgname.sysusers.conf
2025-07-28 23:38:32 -04:00
Carl Smedstad
52b8cf1928 fix(offload-build): Handle non-bash shell on build server
Yesterday I had DevOps change my default shell on build.archlinux.org
from bash to fish. This broke offload builds with pkgctl in the
following way:

    $ pkgctl build --testing --offload
    ==> Updating pacman database cache
    :: Synchronizing package databases...
     core downloading...
     extra downloading...
     multilib downloading...
    ==> Building opentofu
      ->   repo: extra-testing
      ->   arch: x86_64
      -> worker: carsme-7
    ==> Building opentofu for [extra-testing] (x86_64)
    ==> Creating source package...
      -> Adding PKGBUILD...
      -> Generating .SRCINFO file...
      -> Adding tofu.fish...
      -> Compressing source package...
    ==> Leaving fakeroot environment.
    fish: Unsupported use of '='. In fish, please use 'set temp "${XDG_CACHE_HOME:-$HOME/.cache}/offload-build"'.
            temp="${XDG_CACHE_HOME:-$HOME/.cache}/offload-build" &&
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Solve this by explicitly using bash for the commands sent via SSH by
offload-build.
2025-07-25 09:32:32 +02:00
4 changed files with 28 additions and 27 deletions

View File

@@ -150,6 +150,7 @@ _pkgctl_cmds=(
db
diff
issue
license
release
repo
search

View File

@@ -155,7 +155,7 @@ if (( ${#needsversioning[*]} )); then
if [[ ! -f "${file}" ]]; then
continue
fi
if ! git ls-files --error-unmatch "$file"; then
if ! git ls-files --error-unmatch "$file" >/dev/null; then
die "%s is not under version control" "$file"
fi
done

View File

@@ -191,7 +191,9 @@ path = [
".nvchecker.toml",
"*.install",
"*.sysusers",
"*sysusers.conf",
"*.tmpfiles",
"*tmpfiles.conf",
"*.logrotate",
"*.pam",
"*.service",

View File

@@ -94,12 +94,12 @@ makepkg_source_package || die "unable to make source package"
rmdir --ignore-fail-on-non-empty src 2>/dev/null || true
# Create a temporary directory on the server
remote_temp=$(
ssh "${SSH_OPTS[@]}" -- "$server" '
cmd='
temp="${XDG_CACHE_HOME:-$HOME/.cache}/offload-build" &&
mkdir -p "$temp" &&
mktemp --directory --tmpdir="$temp"
')
'
remote_temp=$(ssh "${SSH_OPTS[@]}" -- "$server" "bash -l -c '$cmd'")
# Transfer the srcpkg to the server
msg "Transferring source package to the server..."
@@ -109,18 +109,17 @@ rsync "${RSYNC_OPTS[@]}" -- "$srcpkg" "$server":"$remote_temp" || die
# Prepare the srcpkg on the server
msg "Extracting srcpkg"
ssh "${SSH_OPTS[@]}" -- "$server" "cd ${remote_temp@Q} && bsdtar --strip-components 1 -xvf $(basename "$srcpkg")" || die
ssh "${SSH_OPTS[@]}" -- "$server" "bash -c -l 'cd ${remote_temp@Q} && bsdtar --strip-components 1 -xvf $(basename "$srcpkg")'" || die
# Run the build command on the server
msg "Running archbuild"
# shellcheck disable=SC2145
if ssh "${SSH_OPTS[@]}" -t -- "$server" "cd ${remote_temp@Q} && export LOGDEST="" && ${archbuild_cmd[@]@Q}"; then
if ssh "${SSH_OPTS[@]}" -t -- "$server" "bash -c -l 'cd ${remote_temp@Q} && export LOGDEST="" && ${archbuild_cmd[@]@Q}'"; then
msg "Build complete"
# Get an array of files that should be downloaded from the server
mapfile -t files < <(
ssh "${SSH_OPTS[@]}" -- "$server" "
cd ${remote_temp@Q}"' &&
cmd='
cd '"${remote_temp@Q}"' &&
makepkg_user_config="${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" &&
makepkg_config="/usr/share/devtools/makepkg.conf.d/'"${arch}"'.conf" &&
if [[ -f /usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf ]]; then
@@ -132,13 +131,12 @@ if ssh "${SSH_OPTS[@]}" -t -- "$server" "cd ${remote_temp@Q} && export LOGDEST="
printf "%s\n" '"${remote_temp@Q}/PKGBUILD"'
find '"${remote_temp@Q}"' -name "*.log"
')
'
mapfile -t files < <(ssh "${SSH_OPTS[@]}" -- "$server" "bash -c -l '$cmd'")
else
# Build failed, only the logs should be downloaded from the server
mapfile -t files < <(
ssh "${SSH_OPTS[@]}" -- "$server" '
find '"${remote_temp@Q}"' -name "*.log"
')
cmd='find '"${remote_temp@Q}"' -name "*.log"'
mapfile -t files < <(ssh "${SSH_OPTS[@]}" -- "$server" "bash -c -l '$cmd'")
fi