Skip to content

Commit

Permalink
Merge pull request #74 from Antiz96/various_improvements_rebuild_todo
Browse files Browse the repository at this point in the history
rebuild-todo: Various improvements
  • Loading branch information
jelly committed Jul 6, 2024
2 parents e5eeff6 + 8dc888c commit 655a2fa
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions package/rebuild-todo
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ filter=("extra")
maintainers=()
packages=()
ignore=()

skipped_packages=()
rebuilt_packages=()
released_packages=()

if ! ((${#})); then
usage
Expand Down Expand Up @@ -147,7 +149,17 @@ done
TMPDIR=$(mktemp -d /var/tmp/contrib-rebuild.XXXX) || exit 1
trap "rm -rf ${TMPDIR}" EXIT

remove_from_rebuilt_packages_list() {
local element=$1
for i in "${!rebuilt_packages[@]}"; do
if [[ "${rebuilt_packages[i]}" == "$element" ]]; then
unset 'rebuilt_packages[i]'
fi
done
}

if [[ "$URL" != "" ]]; then
echo -e "Parsing packages list...\n"
while read -r json; do
readarray -t packages < <(jq --slurpfile repo <(printf '"%s" ' "${filter[@]}") \
--slurpfile maint <(printf '"%s" ' "${maintainers[@]}") \
Expand Down Expand Up @@ -194,7 +206,7 @@ if ! ((${#packages[@]})); then
fi
echo "Rebuilding packages:"
printf ' %s\n' "${packages[@]}"
printf "Confirm..."
printf "Press enter to confirm "
read <&1

pkgctl repo clone "${packages[@]}"
Expand All @@ -214,7 +226,10 @@ for pkg in "${packages[@]}"; do
SKIP_BUILD=0
while true; do
if pkgctl build --rebuild $REPO; then
rebuilt_packages+=("$pkg")
break
else
skipped_packages+=("$pkg")
fi
if ((SKIP_BROKEN)); then
SKIP_BUILD=1
Expand All @@ -234,8 +249,26 @@ for pkg in "${packages[@]}"; do
fi
fi
if ! ((NO_PUBLISH)); then
pkgctl release --db-update $REPO -m "$message"
if pkgctl release --db-update $REPO -m "$message"; then
remove_from_rebuilt_packages_list "$pkg"
released_packages+=("$pkg")
fi
fi
fi
popd &>/dev/null
done

if ((${#skipped_packages[@]})); then
echo -e "\nSkipped packages (failed to build):"
printf ' %s\n' "${skipped_packages[@]}"
fi

if ((${#rebuilt_packages[@]})); then
echo -e "\nRebuilt packages (but not released):"
printf ' %s\n' "${rebuilt_packages[@]}"
fi

if ((${#released_packages[@]})); then
echo -e "\nReleased packages:"
printf ' %s\n' "${released_packages[@]}"
fi

0 comments on commit 655a2fa

Please sign in to comment.