aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclyhtsuriva <aimeric@adjutor.xyz>2022-11-02 22:20:50 +0100
committerclyhtsuriva <aimeric@adjutor.xyz>2022-11-02 22:20:50 +0100
commit852a96b3cf69bb80773f926921c9d3f6b0101faf (patch)
tree05d6560368527f4a766511be02634eba74f708b3
parent0685ff941978dab274ff24e095de5c6a9e1931bb (diff)
Adding scripts to semi-automate void-packages updates
-rw-r--r--.gitignore1
-rwxr-xr-xauto-void-packages/commit-push-pr.sh39
-rw-r--r--auto-void-packages/contributed-to.txt30
-rwxr-xr-xauto-void-packages/update-check-contributed.sh55
-rwxr-xr-xauto-void-packages/update-git-repo.sh24
-rwxr-xr-xauto-void-packages/update-package.sh40
-rwxr-xr-xauto-void-packages/who-needs-update.sh53
7 files changed, 242 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6b651e0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+auto-void-packages/needs_update.txt
diff --git a/auto-void-packages/commit-push-pr.sh b/auto-void-packages/commit-push-pr.sh
new file mode 100755
index 0000000..1352c73
--- /dev/null
+++ b/auto-void-packages/commit-push-pr.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+#Clyhtsuriva
+
+
+helpy(){
+printf "command: %s <package> <version> <tested>\n" "$0"
+printf "package: package name\n"
+printf "version: version update\n"
+printf "tested: yes/briefly/no\n"
+}
+
+
+[ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] && helpy && exit 1
+PKG="$1"
+VER="$2"
+TESTED="$3"
+printf "Updating %s to %s.\n" "$PKG" "$VER"
+
+pushd ~/workbench/void-packages || exit 1
+
+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")
+
+gh pr create \
+ --title "$PKG: update to $VER" \
+ --body "#### Testing the changes
+- I tested the changes in this PR: **$TESTED**
+
+#### Local build testing
+- I built this PR locally for my native architecture, x86_64
+- I crossbuilded this PR locally for these architectures:
+$ARCHS" \
+ --base master \
+ --head "clyhtsuriva:$PKG-update"
+
+popd || exit 1
diff --git a/auto-void-packages/contributed-to.txt b/auto-void-packages/contributed-to.txt
new file mode 100644
index 0000000..ae85fe6
--- /dev/null
+++ b/auto-void-packages/contributed-to.txt
@@ -0,0 +1,30 @@
+pyradio
+nbd
+rocksndiamonds
+tvbrowser
+pigz
+paprefs
+moe
+bcal
+archiver
+cksfv
+eqonomize
+avidemux
+gnupg
+scid_vs_pc
+badwolf
+ddpt
+balsa
+quadrapassel
+catfish
+pdd
+tali
+vile
+xmag
+ansi
+translate-shell
+xonsh
+pwget
+sss-cli
+gops
+gogglesmm
diff --git a/auto-void-packages/update-check-contributed.sh b/auto-void-packages/update-check-contributed.sh
new file mode 100755
index 0000000..e399b24
--- /dev/null
+++ b/auto-void-packages/update-check-contributed.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+
+# Clyhsuriva
+
+### Colours
+
+NORMAL=$(tput sgr0)
+
+printf_red(){
+RED=$(tput setaf 1)
+ printf "%s%s%s\n" "$RED" "$1" "$NORMAL"
+}
+
+printf_green(){
+GREEN=$(tput setaf 2)
+BOLD=$(tput bold)
+ printf "%s%s%s%s\n" "$GREEN" "$BOLD" "$1" "$NORMAL"
+}
+
+printf_magenta(){
+MAGENTA=$(tput setaf 5)
+ printf "%s[%s]%s" "$MAGENTA" "$1" "$NORMAL"
+}
+
+####
+
+WORKBENCH_FOLDER="$HOME/workbench"
+
+NEEDS_UPDATE="$WORKBENCH_FOLDER/auto-void-packages/needs_update.txt"
+[ -f "$NEEDS_UPDATE" ] && rm "$NEEDS_UPDATE"
+
+CONTRIBUTED_TO_FILE="$WORKBENCH_FOLDER/auto-void-packages/contributed-to.txt"
+VOID_PACKAGES_FOLDER="$WORKBENCH_FOLDER/void-packages"
+
+# for each package that needs an update put it in the file
+# for every package, print its name with an icon depending on its status
+# x for not needing an update
+# v for needing one
+pushd "$VOID_PACKAGES_FOLDER" || exit 1
+while read -r PKG;
+do
+ printf_magenta "$PKG"
+ UPDATES=$(./xbps-src update-check "$PKG")
+ if [ -z "$UPDATES" ];
+ then
+ printf_red "✖"
+ else
+ printf_green "✔️"
+ echo "$UPDATES" >> "$NEEDS_UPDATE"
+ fi
+done <"$CONTRIBUTED_TO_FILE"
+popd || exit 1
+
+# print the file containing the packages needding an update
+[ -f "$NEEDS_UPDATE" ] && bat "$NEEDS_UPDATE"
diff --git a/auto-void-packages/update-git-repo.sh b/auto-void-packages/update-git-repo.sh
new file mode 100755
index 0000000..e71701c
--- /dev/null
+++ b/auto-void-packages/update-git-repo.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+echo_n_notify(){
+ echo "$1" && notify-send "$1"
+}
+
+pushd "$HOME/workbench/void-packages" || exit 1
+CHECKOUT="checkout"
+FETCH="fetch"
+MERGE="merge"
+PUSH="push"
+
+git checkout master && \
+ echo_n_notify "$CHECKOUT: ok" && \
+ git fetch upstream && \
+ echo_n_notify "$FETCH: ok" && \
+ git merge upstream/master && \
+ echo_n_notify "$MERGE: ok" && \
+ git push && \
+ echo_n_notify "$PUSH: ok"
+
+./xbps-src bootstrap-update
+
+popd || exit 1
diff --git a/auto-void-packages/update-package.sh b/auto-void-packages/update-package.sh
new file mode 100755
index 0000000..c9eb7d1
--- /dev/null
+++ b/auto-void-packages/update-package.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+#Clyhtsuriva
+
+
+helpy(){
+printf "command: %s <package> <version>\n" "$0"
+printf "package: package name\n"
+printf "version: version update\n"
+}
+
+
+[ -z "$1" ] || [ -z "$2" ] && helpy && exit 1
+PKG="$1"
+VER="$2"
+printf "Updating %s to %s.\n" "$PKG" "$VER"
+
+pushd ~/workbench/void-packages || exit 1
+
+git checkout master
+git checkout -b "$PKG-update" || ( \
+ git checkout master &&\
+ git branch -D "$PKG-update" && \
+ git checkout -b "$PKG-update" ) || \
+ exit 1
+
+sed -i "s/version=.*/version=$VER/g" "srcpkgs/$PKG/template"
+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" >> "$ARCHS_FILE"
+./xbps-src -a aarch64-musl pkg "$PKG" && echo " - aarch64-musl" >> "$ARCHS_FILE"
+./xbps-src pkg "$PKG" || exit 1
+
+xi -S --repository="hostdir/binpkgs/$PKG-update" "$PKG" && $PKG --version
+
+popd || exit 1
diff --git a/auto-void-packages/who-needs-update.sh b/auto-void-packages/who-needs-update.sh
new file mode 100755
index 0000000..162e174
--- /dev/null
+++ b/auto-void-packages/who-needs-update.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+
+# Clyhsuriva
+
+### Colours
+
+NORMAL=$(tput sgr0)
+
+printf_red(){
+RED=$(tput setaf 1)
+ printf "%s%s%s\n" "$RED" "$1" "$NORMAL"
+}
+
+printf_green(){
+GREEN=$(tput setaf 2)
+BOLD=$(tput bold)
+ printf "%s%s%s%s\n" "$GREEN" "$BOLD" "$1" "$NORMAL"
+}
+
+printf_magenta(){
+MAGENTA=$(tput setaf 5)
+ printf "%s[%s]%s" "$MAGENTA" "$1" "$NORMAL"
+}
+
+####
+
+NEEDS_UPDATE="needs_update.txt"
+[ -f "$NEEDS_UPDATE" ] && rm "$NEEDS_UPDATE"
+
+CONTRIBUTED_TO_FILE="contributed-to.txt"
+
+VOID_UPDATES_URL="https://a-hel-fi.m.voidlinux.org/void-updates/void-updates.txt"
+VOID_UPDATES=$(curl --silent "$VOID_UPDATES_URL")
+
+# for each package that needs an update put it in the file
+# for every package, print its name with an icon depending on its status
+# x for not needing an update
+# v for needing one
+while read -r PKG;
+do
+ printf_magenta "$PKG"
+ UPDATES=$(echo "$VOID_UPDATES" | grep -e "^$PKG ")
+ if [ -z "$UPDATES" ];
+ then
+ printf_red "✖"
+ else
+ printf_green "✔️"
+ echo "$UPDATES" >> "$NEEDS_UPDATE"
+ fi
+done <$CONTRIBUTED_TO_FILE
+
+# print the file containing the packages needding an update
+[ -f "$NEEDS_UPDATE" ] && bat $NEEDS_UPDATE