diff options
author | clyhtsuriva <aimeric@adjutor.xyz> | 2024-10-15 22:02:54 +0200 |
---|---|---|
committer | clyhtsuriva <aimeric@adjutor.xyz> | 2024-10-15 22:02:54 +0200 |
commit | fc05941c60194547286fdceb93b5a0fc85545310 (patch) | |
tree | 06640841f6466f606b69fb1d3af0dacbe5e7af18 | |
parent | 6bb700b04a3b393dfdda5500b104b815c289109a (diff) |
Continuing auto-build script
Also adding the option to put a custom path for the build architectures file
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | auto-void-packages/auto-build-all-orphans.sh | 29 | ||||
-rwxr-xr-x | auto-void-packages/commit-push-pr.sh | 6 | ||||
-rwxr-xr-x | auto-void-packages/update-package.sh | 13 |
4 files changed, 39 insertions, 10 deletions
@@ -1,2 +1,3 @@ auto-void-packages/*.txt ansible/hosts +auto-void-packages/auto-build diff --git a/auto-void-packages/auto-build-all-orphans.sh b/auto-void-packages/auto-build-all-orphans.sh index cd7b792..44875d4 100755 --- a/auto-void-packages/auto-build-all-orphans.sh +++ b/auto-void-packages/auto-build-all-orphans.sh @@ -42,6 +42,10 @@ typeset package="" typeset -A pkgs_to_update=() +typeset -i nb_of_pkgs_to_build=0 +typeset auto_build_archs_path="" +typeset -i pkg_counter=0 + ### ### COLOURS ### @@ -68,6 +72,11 @@ MAGENTA=$(tput setaf 5) ### FUNCTIONS +function helpy { + printf "command: %s [number_of_packages]\n" "$0" +printf "number_of_packages: Must be an integer, indicates of many packages you want to auto build, defaults to none.\n" +} + function yes_or_no { while true; do read -rp "$* [y/n]: " yn @@ -100,6 +109,11 @@ void_updates_content=$(curl --silent "$void_updates_url") orphan_packages=$(echo "$void_updates_content" | sed -n '/orphan@voidlinux.org/,/@/p' | grep -v '^--' | grep -v '@') orphan_packages_sorted=$(echo "$orphan_packages" | awk '{ print $1 }' | sort -u) +nb_of_pkgs_to_build="${1:-0}" + +echo "Executing update-git-repo.sh" +./update-git-repo.sh || exit 1 + start_spinner "Calculating how many orphan packages there are..." for package in $orphan_packages_sorted; do @@ -110,5 +124,16 @@ do done stop_spinner -echo "Number of orphan packages needing an update : ${#pkgs_to_update[@]}" -yes_or_no "This can take a very long time, would you like to proceed ?" && echo "he said yes" +echo -n "Number of orphan packages needing an update : " ; printf_green "${#pkgs_to_update[@]}" +echo -n "Number of orphan packages you want to build : " ; printf_red "$nb_of_pkgs_to_build" +[ $nb_of_pkgs_to_build == 0 ] && exit 1 + +#while [ $pkg_counter -lt $nb_of_pkgs_to_build ]; do + for package in "${!pkgs_to_update[@]}"; do + latest_version="${pkgs_to_update[$package]}" + echo "[$package - $latest_version]" + # auto_build_archs_path="$HOME/workbench/auto-void-packages/auto-build/archs-${package}-${latest_version}.txt" + # ./update-package.sh "$package" "$latest_version" "$auto_build_archs_path" + done +# ((pkg_counter++)) +#done diff --git a/auto-void-packages/commit-push-pr.sh b/auto-void-packages/commit-push-pr.sh index 1352c73..769a3cd 100755 --- a/auto-void-packages/commit-push-pr.sh +++ b/auto-void-packages/commit-push-pr.sh @@ -3,10 +3,11 @@ helpy(){ -printf "command: %s <package> <version> <tested>\n" "$0" +printf "command: %s <package> <version> <tested> [path]\n" "$0" printf "package: package name\n" printf "version: version update\n" printf "tested: yes/briefly/no\n" +printf "path (optional): path of architectures file, defaults to '\$HOME/workbench/auto-void-packages/architectures.txt'\n" } @@ -14,6 +15,7 @@ printf "tested: yes/briefly/no\n" PKG="$1" VER="$2" TESTED="$3" +archs_fp="${4:-$HOME/workbench/auto-void-packages/architectures.txt}" printf "Updating %s to %s.\n" "$PKG" "$VER" pushd ~/workbench/void-packages || exit 1 @@ -22,7 +24,7 @@ git add "srcpkgs/$PKG" && \ git commit -m "$PKG: update to $VER" && \ git push origin "$PKG-update" -ARCHS=$(/bin/cat "$HOME/workbench/auto-void-packages/architectures.txt") +ARCHS=$(/bin/cat "$archs_fp") gh pr create \ --title "$PKG: update to $VER" \ diff --git a/auto-void-packages/update-package.sh b/auto-void-packages/update-package.sh index 8707626..a21dd6c 100755 --- a/auto-void-packages/update-package.sh +++ b/auto-void-packages/update-package.sh @@ -3,15 +3,17 @@ helpy(){ -printf "command: %s <package> <version>\n" "$0" + printf "command: %s <package> <version> [path]\n" "$0" printf "package: package name\n" printf "version: version update\n" +printf "path (optional): path of architectures file, defaults to '\$HOME/workbench/auto-void-packages/architectures.txt'\n" } [ -z "$1" ] || [ -z "$2" ] && helpy && exit 1 PKG="$1" VER="$2" +archs_fp="${3:-$HOME/workbench/auto-void-packages/architectures.txt}" printf "Updating %s to %s.\n" "$PKG" "$VER" pushd ~/workbench/void-packages || exit 1 @@ -28,11 +30,10 @@ sed -i "s/revision=.*/revision=1/g" "srcpkgs/$PKG/template" xgensum -f -i "$PKG" ; xgensum -f -i "$PKG" || exit 1 -ARCHS_FILE="$HOME/workbench/auto-void-packages/architectures.txt" -[ -f "$ARCHS_FILE" ] && rm -v "$ARCHS_FILE" -./xbps-src -a armv7l pkg "$PKG" && echo " - armv7l" >> "$ARCHS_FILE" -./xbps-src -a armv6l-musl pkg "$PKG" && echo " - armv6l-musl" >> "$ARCHS_FILE" -./xbps-src -a aarch64-musl pkg "$PKG" && echo " - aarch64-musl" >> "$ARCHS_FILE" +[ -f "$archs_fp" ] && rm -v "$archs_fp" +./xbps-src -a armv7l pkg "$PKG" && echo " - armv7l" >> "$archs_fp" +./xbps-src -a armv6l-musl pkg "$PKG" && echo " - armv6l-musl" >> "$archs_fp" +./xbps-src -a aarch64-musl pkg "$PKG" && echo " - aarch64-musl" >> "$archs_fp" ./xbps-src pkg "$PKG" || exit 1 xi -S --repository="hostdir/binpkgs/$PKG-update" "$PKG" && $PKG --version |