Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/lib/release.sh
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2024-02-06 21:59:11 +0100
committerLevente Polyak <anthraxx@archlinux.org>2024-02-08 00:52:20 +0100
commit3ecba314fc3a7508d80c5450aaae4b5fc507d62b (patch)
treeb49d8fb9233d9f821b1769a7c8520d22d51b38a8 /src/lib/release.sh
parent5042dcaeb4916e199b30ecf21048a4234da43499 (diff)
feat(build): consolidate repo flags in build and release subcommand
Previously the behavior was inconsistent and not fully fulfilling its purpose of only using --repo once when initially pushing a new and unknown package to the official repositories. Consolidate the behavior by only allowing to use --repo during the initial packaging and disallow any subsequent usage. The expected user experience is to subsequently use --testing or --staging to influence the auto-detection of the build target. This avoids any kind of human error which leads to releasing core packages to extra-testing by accident. Furthermore, allow the build subcommand to automatically fallback to extra as the default stable repository target which greatly improves the usability for AUR or local override builds. Fixes #193 Fixes #191 Component: pkgctl build Component: pkgctl release Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'src/lib/release.sh')
-rw-r--r--src/lib/release.sh29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/lib/release.sh b/src/lib/release.sh
index 028d92e..700b2b0 100644
--- a/src/lib/release.sh
+++ b/src/lib/release.sh
@@ -35,7 +35,7 @@ pkgctl_release_usage() {
OPTIONS
-m, --message MSG Use the given <msg> as the commit message
- -r, --repo REPO Specify a target repository (disables auto-detection)
+ -r, --repo REPO Specify target repository for new packages not in any official repo
-s, --staging Release to the staging counterpart of the auto-detected repo
-t, --testing Release to the testing counterpart of the auto-detected repo
-u, --db-update Automatically update the pacman database after uploading
@@ -43,8 +43,8 @@ pkgctl_release_usage() {
EXAMPLES
$ ${COMMAND}
- $ ${COMMAND} --repo core-testing --message 'libyay 0.42 rebuild' libfoo libbar
- $ ${COMMAND} --staging --db-update libfoo
+ $ ${COMMAND} --staging --message 'libyay 0.42 rebuild' libfoo libbar
+ $ ${COMMAND} --repo extra --db-update new-package
_EOF_
}
@@ -134,15 +134,22 @@ pkgctl_release() {
pushd "${path}" >/dev/null
pkgbase=$(basename "${path}")
- if [[ -n ${REPO} ]]; then
- repo=${REPO}
- else
- if ! repo=$(get_pacman_repo_from_pkgbuild PKGBUILD); then
- die 'Failed to get pacman repo'
- fi
- if [[ -z "${repo}" ]]; then
- die 'Unknown repo, please specify --repo for new packages'
+ # auto-detect target repository
+ if ! repo=$(get_pacman_repo_from_pkgbuild PKGBUILD); then
+ die 'Failed to query pacman repo'
+ fi
+
+ # fail if an existing package specifies --repo
+ if [[ -n "${repo}" ]] && [[ -n ${REPO} ]]; then
+ die 'Using --repo for packages that exist in official repositories is disallowed'
+ fi
+
+ # fail if a new package does not specify --repo
+ if [[ -z "${repo}" ]]; then
+ if [[ -z ${REPO} ]]; then
+ die 'Specify --repo for packages that do not yet exist in official repositories'
fi
+ repo=${REPO}
fi
if (( TESTING )); then