Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/lib/version
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/version')
-rw-r--r--src/lib/version/check.sh17
-rw-r--r--src/lib/version/setup.sh2
-rw-r--r--src/lib/version/upgrade.sh62
3 files changed, 59 insertions, 22 deletions
diff --git a/src/lib/version/check.sh b/src/lib/version/check.sh
index ec90eb4..4a2b5fa 100644
--- a/src/lib/version/check.sh
+++ b/src/lib/version/check.sh
@@ -114,10 +114,6 @@ pkgctl_version_check() {
fi
pushd "${path}" >/dev/null
- if [[ ! -f "PKGBUILD" ]]; then
- die "No PKGBUILD found for ${path}"
- fi
-
# update the current terminal spinner status
(( ++current_item ))
pkgctl_version_check_spinner \
@@ -128,6 +124,13 @@ pkgctl_version_check() {
"${current_item}" \
"${#pkgbases[@]}"
+ if [[ ! -f "PKGBUILD" ]]; then
+ result="${BOLD}${path}${ALL_OFF}: no PKGBUILD found"
+ failure+=("${result}")
+ popd >/dev/null
+ continue
+ fi
+
# reset common PKGBUILD variables
unset pkgbase pkgname arch source pkgver pkgrel validpgpkeys
# shellcheck source=contrib/makepkg/PKGBUILD.proto
@@ -224,7 +227,7 @@ get_upstream_version() {
fi
if ! output=$(GIT_TERMINAL_PROMPT=0 nvchecker --file "${config}" --logger json "${opts[@]}" 2>&1 | \
- jq --raw-output 'select(.level != "debug")'); then
+ jq --raw-output 'select((.level != "debug") and (.event != "ignoring invalid version"))'); then
printf "failed to run nvchecker: %s" "${output}"
return 1
fi
@@ -264,13 +267,13 @@ nvchecker_check_config() {
done
# check if the config contains a pkgbase section
- if [[ -n ${pkgbase} ]] && ! grep --max-count=1 --extended-regexp --quiet "^\\[\"?${pkgbase}\"?\\]" < "${config}"; then
+ if [[ -n ${pkgbase} ]] && ! grep --max-count=1 --extended-regexp --quiet "^\\[\"?${pkgbase//+/\\+}\"?\\]" < "${config}"; then
printf "missing pkgbase section in %s: %s" "${config}" "${pkgbase}"
return 1
fi
# check if the config contains any section other than pkgbase
- if [[ -n ${pkgbase} ]] && property=$(grep --max-count=1 --perl-regexp "^\\[(?!\"?${pkgbase}\"?\\]).+\\]" < "${config}"); then
+ if [[ -n ${pkgbase} ]] && property=$(grep --max-count=1 --perl-regexp "^\\[(?!\"?${pkgbase//+/\\+}\"?\\]).+\\]" < "${config}"); then
printf "non-pkgbase section not supported in %s: %s" "${config}" "${property}"
return 1
fi
diff --git a/src/lib/version/setup.sh b/src/lib/version/setup.sh
index 123862c..cdfbeac 100644
--- a/src/lib/version/setup.sh
+++ b/src/lib/version/setup.sh
@@ -252,7 +252,7 @@ nvchecker_setup() {
# escape the section if it contains toml subsection chars
section="${pkgbase}"
- if [[ ${section} == *.* ]]; then
+ if [[ ${section} == *.* ]] || [[ ${section} == *+* ]]; then
section="\"${section}\""
fi
diff --git a/src/lib/version/upgrade.sh b/src/lib/version/upgrade.sh
index df3b77d..70a4659 100644
--- a/src/lib/version/upgrade.sh
+++ b/src/lib/version/upgrade.sh
@@ -30,14 +30,15 @@ pkgctl_version_upgrade_usage() {
Upon execution, it automatically adjusts the PKGBUILD file, ensuring that the
pkgver field is set to match the latest version available from the upstream
source. In addition to updating the pkgver, this command also resets the pkgrel
- to 1.
+ to 1 and updates checksums.
Outputs a summary of upgraded packages, up-to-date packages, and any check
failures.
OPTIONS
- -v, --verbose Display results including up-to-date versions
- -h, --help Show this help text
+ --no-update-checksums Disable computation and update of the checksums
+ -v, --verbose Display results including up-to-date versions
+ -h, --help Show this help text
EXAMPLES
$ ${COMMAND} neovim vim
@@ -50,6 +51,7 @@ pkgctl_version_upgrade() {
local verbose=0
local exit_code=0
local current_item=0
+ local update_checksums=1
while (( $# )); do
case $1 in
@@ -57,6 +59,10 @@ pkgctl_version_upgrade() {
pkgctl_version_upgrade_usage
exit 0
;;
+ --no-update-checksums)
+ update_checksums=0
+ shift
+ ;;
-v|--verbose)
verbose=1
shift
@@ -105,25 +111,31 @@ pkgctl_version_upgrade() {
fi
pushd "${path}" >/dev/null
+ (( ++current_item ))
+
if [[ ! -f "PKGBUILD" ]]; then
- die "No PKGBUILD found for ${path}"
+ result="${BOLD}${path}${ALL_OFF}: no PKGBUILD found"
+ failure+=("${result}")
+ popd >/dev/null
+ continue
fi
+ # reset common PKGBUILD variables
+ unset pkgbase pkgname arch source pkgver pkgrel validpgpkeys
+ # shellcheck source=contrib/makepkg/PKGBUILD.proto
+ . ./PKGBUILD
+ pkgbase=${pkgbase:-$pkgname}
+
# update the current terminal spinner status
- (( ++current_item ))
pkgctl_version_upgrade_spinner \
"${status_dir}" \
"${#up_to_date[@]}" \
"${#out_of_date[@]}" \
"${#failure[@]}" \
"${current_item}" \
- "${#pkgbases[@]}"
-
- # reset common PKGBUILD variables
- unset pkgbase pkgname arch source pkgver pkgrel validpgpkeys
- # shellcheck source=contrib/makepkg/PKGBUILD.proto
- . ./PKGBUILD
- pkgbase=${pkgbase:-$pkgname}
+ "${#pkgbases[@]}" \
+ "${pkgbase}" \
+ "query latest version"
if ! result=$(get_upstream_version); then
result="${BOLD}${pkgbase}${ALL_OFF}: ${result}"
@@ -153,6 +165,24 @@ pkgctl_version_upgrade() {
# change the PKGBUILD
pkgbuild_set_pkgver "${upstream_version}"
pkgbuild_set_pkgrel 1
+
+ # download sources and update the checksums
+ if (( update_checksums )); then
+ pkgctl_version_upgrade_spinner \
+ "${status_dir}" \
+ "${#up_to_date[@]}" \
+ "${#out_of_date[@]}" \
+ "${#failure[@]}" \
+ "${current_item}" \
+ "${#pkgbases[@]}" \
+ "${pkgbase}" \
+ "updating checksums"
+
+ if ! result=$(pkgbuild_update_checksums /dev/null); then
+ result="${BOLD}${pkgbase}${ALL_OFF}: failed to update checksums for version ${DARK_GREEN}${upstream_version}${ALL_OFF}"
+ failure+=("${result}")
+ fi
+ fi
fi
popd >/dev/null
@@ -231,6 +261,8 @@ pkgctl_version_upgrade_spinner() {
local failure_count=$4
local current=$5
local total=$6
+ local pkgbase=$7
+ local message=$8
local percentage=$(( 100 * current / total ))
local tmp_file="${status_dir}/tmp"
@@ -243,8 +275,10 @@ pkgctl_version_upgrade_spinner() {
"${failure_count}" > "${tmp_file}"
# print the progress status
- printf "📡 Upgrading: %s/%s [%s] %%spinner%%" \
- "${BOLD}${current}" "${total}" "${percentage}%${ALL_OFF}" \
+ printf "📡 %s: %s\n" \
+ "${pkgbase}" "${BOLD}${message}${ALL_OFF}" >> "${tmp_file}"
+ printf "⌛ Upgrading: %s/%s [%s] %%spinner%%" \
+ "${BOLD}${current}" "${total}" "${percentage}%${ALL_OFF}" \
>> "${tmp_file}"
# swap the status file