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:
authorLevente Polyak <anthraxx@archlinux.org>2024-04-19 21:16:06 +0200
committerLevente Polyak <anthraxx@archlinux.org>2024-04-23 20:23:49 +0200
commit9a5181db5bfa78d33d3123145ea4c84375f2e8f2 (patch)
tree0fa37ffd91753cb57368eb7d4546fa0aeeead82c /src/lib/version
parent55c2ca1312e649916a9a4469b7e88464f2f20c38 (diff)
feat(pkgctl): add internal update checksums to better control output
This allows us to have more control over the output and status logs. Using this method we are able to avoid cluttering the version upgrade subcommand while downloading sources for updating the checksums. Having this internally will also allow us in the future to have smart checksums updating by only trying to change the checksums of sources that have actually changed, for example when adjusting a patch file we should avoid trying to overwrite the archive checksums unintentionally. Component: pkgctl version upgrade
Diffstat (limited to 'src/lib/version')
-rw-r--r--src/lib/version/upgrade.sh39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/lib/version/upgrade.sh b/src/lib/version/upgrade.sh
index 2885182..c57171c 100644
--- a/src/lib/version/upgrade.sh
+++ b/src/lib/version/upgrade.sh
@@ -115,6 +115,12 @@ pkgctl_version_upgrade() {
die "No PKGBUILD found for ${path}"
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 \
@@ -123,13 +129,9 @@ pkgctl_version_upgrade() {
"${#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}"
@@ -162,7 +164,20 @@ pkgctl_version_upgrade() {
# download sources and update the checksums
if (( update_checksums )); then
- updpkgsums
+ 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
@@ -242,6 +257,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"
@@ -254,8 +271,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