Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/commitpkg.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/commitpkg.in')
-rw-r--r--src/commitpkg.in29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/commitpkg.in b/src/commitpkg.in
index 8a8087a..e17b270 100644
--- a/src/commitpkg.in
+++ b/src/commitpkg.in
@@ -5,9 +5,13 @@
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
# shellcheck source=src/lib/common.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
+# shellcheck source=src/lib/util/srcinfo.sh
+source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/srcinfo.sh
source /usr/share/makepkg/util/util.sh
+set -eo pipefail
+
check_pkgbuild_validity() {
# shellcheck source=contrib/makepkg/PKGBUILD.proto
@@ -70,6 +74,12 @@ if ! repo_spec=$(git config --local devtools.version) || [[ ${repo_spec} != "${G
exit 1
fi
+if ! repo_variant=$(git config --local devtools.variant) || [[ ${repo_variant} != canonical ]]; then
+ error "cannot release from a repository with none canonical specs (%s), try:" "${repo_variant:-development}"
+ msg2 'pkgctl repo configure'
+ exit 1
+fi
+
if [[ "$(git symbolic-ref --short HEAD)" != main ]]; then
die 'must be run from the main branch'
fi
@@ -111,7 +121,7 @@ if (( ${#validpgpkeys[@]} != 0 )); then
fi
# find files which should be under source control
-needsversioning=()
+needsversioning=(PKGBUILD)
for s in "${source[@]}"; do
[[ $s != *://* ]] && needsversioning+=("$s")
done
@@ -177,13 +187,10 @@ done
# check for PKGBUILD standards
check_pkgbuild_validity
-# auto generate .SRCINFO if present
-if [[ -f .SRCINFO ]]; then
- stat_busy 'Generating .SRCINFO'
- makepkg --printsrcinfo > .SRCINFO
- git add .SRCINFO
- stat_done
-fi
+# auto generate .SRCINFO
+# shellcheck disable=SC2119
+write_srcinfo_file
+git add --force .SRCINFO
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
stat_busy 'Staging files'
@@ -206,14 +213,14 @@ if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
echo "$msgtemplate" > "$msgfile"
if [[ -n $GIT_EDITOR ]]; then
$GIT_EDITOR "$msgfile" || die
+ elif giteditor=$(git config --get core.editor); then
+ $giteditor "$msgfile" || die
elif [[ -n $VISUAL ]]; then
$VISUAL "$msgfile" || die
elif [[ -n $EDITOR ]]; then
$EDITOR "$msgfile" || die
- elif giteditor=$(git config --get core.editor); then
- $giteditor "$msgfile" || die
else
- die "No usable editor found (tried \$GIT_EDITOR, \$VISUAL, \$EDITOR, git config [core.editor])."
+ die "No usable editor found (tried \$GIT_EDITOR, git config [core.editor], \$VISUAL, \$EDITOR)."
fi
[[ -s $msgfile ]] || die
stat_busy 'Committing changes'