Compare commits

..

6 Commits

Author SHA1 Message Date
Robin Candau
d6113241aa Merge branch 'build_version_upgrade' into 'master'
feat: introduce the `--version-upgrade` argument to `pkgctl build`

See merge request archlinux/devtools!261
2025-08-11 01:41:17 +02:00
Aaron Liu
3f0ebbc6d2 fix(license): add .gitignore to REUSE defaults
36 packages use this while 26 use *.pam and 21 use *.logrotate. Seems
anecdotally common enough to add this here.
2025-08-08 14:13:32 +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
Robin Candau
6a1a0f6b50 feat: introduce the --version-upgrade argument to pkgctl build
This commit introduces the `--version-upgrade` argument to `pkgctl build` which updates the PKGBUILD to the latest upstream version via `pkgctl version upgrade` before starting the build (similarly to the `--pkgver` argument but automated via the `nvchecker` integration of `pkgctl version`).
2024-06-01 12:58:45 +02:00
7 changed files with 30 additions and 8 deletions

View File

@@ -150,6 +150,7 @@ _pkgctl_cmds=(
db
diff
issue
license
release
repo
search
@@ -196,6 +197,7 @@ _pkgctl_build_args=(
--pkgrel
--rebuild
--update-checksums
--version-upgrade
-e --edit
-r --release

View File

@@ -59,6 +59,7 @@ _pkgctl_build_args=(
'--pkgrel=[Set pkgrel to a given value]:pkgrel:'
'--rebuild[Increment the pkgrel variable]'
'--update-checksums[Force computation and update of the checksums (disables auto-detection)]'
'--version-upgrade[Adjust the PKGBUILD to match the latest upstream version (via pkgctl version upgrade)]'
'(-e --edit)'{-e,--edit}'[Edit the PKGBUILD before building]'
'(-r --release)'{-r,--release}'[Automatically commit, tag and release after building]'
'(-m --message)'{-m,--message}"[Use the given <msg> as the commit message]:message:"

View File

@@ -84,6 +84,9 @@ PKGBUILD Options
are either automatically updated when upgrading a package using `--pkgver`
or should remain immutable during rebuilds.
*--version-upgrade*::
Adjust the PKGBUILD to match the latest upstream version (via `pkgctl version upgrade`).
*-e, --edit*::
Edit the PKGBUILD before building

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

@@ -67,6 +67,7 @@ pkgctl_build_usage() {
--pkgrel=PKGREL Set pkgrel to a given value
--rebuild Increment the current pkgrel variable
--update-checksums Force computation and update of the checksums (disables auto-detection)
--version-upgrade Adjust the PKGBUILD to match the latest upstream version (via pkgctl version upgrade)
-e, --edit Edit the PKGBUILD before building
RELEASE OPTIONS
@@ -116,6 +117,7 @@ pkgctl_build() {
fi
local UPDATE_CHECKSUMS=0
local VERSION_UPGRADE=0
local EDIT=0
local REBUILD=0
local OFFLOAD=0
@@ -187,6 +189,10 @@ pkgctl_build() {
UPDATE_CHECKSUMS=1
shift
;;
--version-upgrade)
VERSION_UPGRADE=1
shift
;;
--rebuild)
# shellcheck source=src/lib/util/git.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh
@@ -452,6 +458,13 @@ pkgctl_build() {
. ./PKGBUILD
fi
# update PKGBUILD to the latest upstream version
if (( VERSION_UPGRADE )); then
if ! $(pkgctl_version_upgrade); then
die
fi
fi
# execute build
for arch in "${BUILD_ARCH[@]}"; do
if [[ -n $arch ]]; then

View File

@@ -94,19 +94,19 @@ pkgctl_license_check() {
pushd "${path}" >/dev/null
if [[ ! -f PKGBUILD ]]; then
msg_error "${BOLD}${path}:${ALL_OFF} no PKGBUILD found"
msg_error "${BOLD}${pkgbase}:${ALL_OFF} no PKGBUILD found"
return 1
fi
if [[ ! -f .SRCINFO ]]; then
msg_error "${BOLD}${path}:${ALL_OFF} no .SRCINFO found"
return 1
fi
# reset common PKGBUILD variables
unset pkgbase
if ! pkgbase=$(grep --max-count=1 --extended-regexp "pkgbase = (.+)" .SRCINFO | awk '{print $3}'); then
msg_error "${BOLD}${path}:${ALL_OFF} pkgbase not found in .SRCINFO"
# shellcheck source=contrib/makepkg/PKGBUILD.proto
if ! . ./PKGBUILD; then
msg_error "${BOLD}${pkgbase}:${ALL_OFF} failed to source PKGBUILD"
return 1
fi
pkgbase=${pkgbase:-$pkgname}
if [[ ! -e LICENSE ]]; then
msg_error "${BOLD}${pkgbase}:${ALL_OFF} is missing the LICENSE file"

View File

@@ -188,10 +188,13 @@ path = [
"README.md",
"keys/**",
".SRCINFO",
".gitignore",
".nvchecker.toml",
"*.install",
"*.sysusers",
"*sysusers.conf",
"*.tmpfiles",
"*tmpfiles.conf",
"*.logrotate",
"*.pam",
"*.service",