Dernière activité 1740366766

List of available updates for void (anyone/mypkg/no version) packages installed locally.

Vinfall a révisé ce gist 1740366766. Aller à la révision

1 file changed, 34 insertions, 6 deletions

xoutdated.sh

@@ -1,13 +1,17 @@
1 - #!/bin/bash
1 + #!/usr/bin/env bash
2 + set -euo pipefail
2 3
3 4 # Prerequisite:
4 5 # 1. presumably Void Linux
5 6 # 2. install xtools, perl (base-devel)
6 7 # 3. set XBPS_DISTDIR to your local copy of void-packages
7 8
9 + # VERSION="3.2.2"
10 +
8 11 # List available updates of void packages installed locally for a specific contributor
9 12 # Usage: outdated_who email author
10 13 outdated_who(){
14 + # local EXCLUDE_REGEX="apache-"
11 15 local email="$1"
12 16 local author="$2"
13 17
@@ -25,6 +29,7 @@ outdated_who(){
25 29
26 30 # filter out uninterested packages
27 31 # opinionated, `lib` could be a bit overkill
32 + # TODO: pass regex as variable to grep
28 33 grep -vE 'apache-|avr-|brltty|cargo-|cinnamon|dkms|gnome-|gst-|jenkins|lib|linux|nemo-|pantheon-|perl-|ruby-|R-cran-|webkit2gtk' "${DISTFILE}" | sponge "${DISTFILE}"
29 34
30 35 # dedup, leave only the highest available version
@@ -33,10 +38,6 @@ outdated_who(){
33 38
34 39 # dedup again, leave only installed packages
35 40 awk 'NR==FNR{installed[$1]; next} $1 in installed' installed.txt "${DISTFILE}" | sort | sponge "${DISTFILE}"
36 -
37 - # TODO: filter out existing update branches
38 - # git branch --list |awk '{print $1}' > branches.txt
39 - # awk 'NR==FNR{branches[$1]; next} {for (b in branches) if ($1 ~ b) next} {print}' branches.txt "${DISTFILE}"
40 41 }
41 42
42 43 # List my outdated packages w/o xcheckmypkgs
@@ -50,10 +51,10 @@ outdated_mypkg(){
50 51 CONNECTION_TIMEOUT=5000 xbps-fetch -o "${MYFILE}" "${MYURL}"
51 52 }
52 53
54 + LOG_FILE="updates_nover.txt"
53 55 # List packages that have error checking updates
54 56 outdated_error(){
55 57 local LOG_URL="https://repo-default.voidlinux.org/void-updates/void-updates/_log.txt"
56 - local LOG_FILE="updates_nover.txt"
57 58
58 59 CONNECTION_TIMEOUT=5000 xbps-fetch -o "${LOG_FILE}" "${LOG_URL}"
59 60
@@ -69,6 +70,32 @@ outdated_error(){
69 70 }' | sponge ${LOG_FILE}
70 71 }
71 72
73 + # strip updated packages
74 + # TODO: add version comparison logic/walk through commit history to wisely include when newer updates are available
75 + strip_updated(){
76 + # local UPDATED_PKGS=(colord-gtk lvm2 python3-usb)
77 +
78 + echo "Stripping..."
79 + # NOTE: assume you follow "$PKG-update" scheme in branch names (and "$PKG" is indeed latest)
80 + git branch | grep "update" | sed 's/-update//g' | awk '{ print $1 }' > branches.txt
81 +
82 + shopt -s nullglob
83 + for file in updates_*.txt
84 + do
85 + # skip no ver
86 + if [[ "${file}" == "${LOG_FILE}" ]] ; then
87 + true
88 + else
89 + # strip updated packages in branches with mixed commits
90 + grep -vE "colord-gtk|lvm2|python3-usb" "${file}" | sponge "${file}"
91 + # strip updated branch
92 + awk 'NR==FNR{branches[$1]; next} {for (b in branches) if ($1 ~ b) next} {print}' branches.txt "${file}" | sponge "${file}"
93 + fi
94 + done
95 +
96 + rm branches.txt
97 + }
98 +
72 99 cd "$XBPS_DISTDIR" || exit 1
73 100
74 101 # list only manually installed packages
@@ -80,6 +107,7 @@ xpkg -m > installed.txt
80 107 outdated_who "[email protected]" "orphan"
81 108 outdated_mypkg
82 109 outdated_error
110 + strip_updated
83 111
84 112 # garbage clean
85 113 rm installed.txt

Vinfall a révisé ce gist 1740038601. Aller à la révision

1 file changed, 7 insertions, 1 deletion

xoutdated.sh

@@ -1,5 +1,9 @@
1 1 #!/bin/bash
2 - # Prerequisite (presumably Void Linux with base-system installed): xtools, perl (base-devel)
2 +
3 + # Prerequisite:
4 + # 1. presumably Void Linux
5 + # 2. install xtools, perl (base-devel)
6 + # 3. set XBPS_DISTDIR to your local copy of void-packages
3 7
4 8 # List available updates of void packages installed locally for a specific contributor
5 9 # Usage: outdated_who email author
@@ -65,6 +69,8 @@ outdated_error(){
65 69 }' | sponge ${LOG_FILE}
66 70 }
67 71
72 + cd "$XBPS_DISTDIR" || exit 1
73 +
68 74 # list only manually installed packages
69 75 xpkg -m > installed.txt
70 76 # query all installed packages (including core packages, more complete, but MUCH slower)

Vinfall a révisé ce gist 1740038228. Aller à la révision

1 file changed, 24 insertions, 12 deletions

xoutdated.sh

@@ -1,26 +1,38 @@
1 1 #!/bin/bash
2 + # Prerequisite (presumably Void Linux with base-system installed): xtools, perl (base-devel)
2 3
3 - # List of available updates for unmaintained void packages installed locally
4 - outdated_orphan(){
5 - local DISTURL="https://repo-default.voidlinux.org/void-updates/void-updates/updates_orphan%40voidlinux.org.txt"
6 - local DISTFILE="updates_orphan.txt"
4 + # List available updates of void packages installed locally for a specific contributor
5 + # Usage: outdated_who email author
6 + outdated_who(){
7 + local email="$1"
8 + local author="$2"
7 9
8 - wget --hsts-file="$XDG_CACHE_HOME/wget-hsts" --output-document ${DISTFILE} --quiet ${DISTURL}
10 + # URL encode email
11 + local encoded_email
12 + # encoded_email=$(echo -n "$email" | jq -sRr @uri)
13 + encoded_email=$(echo -n "$email" | perl -MURI::Escape -ne 'print uri_escape($_)')
14 + # encoded_email=$(echo -n "$email" | python3 -c "import sys, urllib.parse; print(urllib.parse.quote(sys.stdin.read()))")
15 + local DISTURL="https://repo-default.voidlinux.org/void-updates/void-updates/updates_${encoded_email}.txt"
16 + local DISTFILE="updates_${author}.txt"
17 +
18 + CONNECTION_TIMEOUT=5000 xbps-fetch -o "${DISTFILE}" "${DISTURL}"
19 + # wcurl --curl-options="--progress-bar" --output "${DISTFILE}" "${DISTURL}"
20 + # wget --hsts-file="$XDG_CACHE_HOME/wget-hsts" --output-document "${DISTFILE}" --quiet "${DISTURL}"
9 21
10 22 # filter out uninterested packages
11 23 # opinionated, `lib` could be a bit overkill
12 - grep -vE 'apache-|avr-|cargo-|cinnamon|dkms|gnome-|gst-|jenkins|lib|linux|live555|nemo-|pantheon-|perl-|python3-grpcio|python3-google|ruby-|R-cran-' ${DISTFILE} | sponge ${DISTFILE}
24 + grep -vE 'apache-|avr-|brltty|cargo-|cinnamon|dkms|gnome-|gst-|jenkins|lib|linux|nemo-|pantheon-|perl-|ruby-|R-cran-|webkit2gtk' "${DISTFILE}" | sponge "${DISTFILE}"
13 25
14 26 # dedup, leave only the highest available version
15 27 # side effect: order is slightly different
16 - awk '!seen[$1]++ {line[$1] = $0} {line[$1] = $0} END {for (pkg in line) print line[pkg]}' ${DISTFILE} | sort | sponge ${DISTFILE}
28 + awk '!seen[$1]++ {line[$1] = $0} {line[$1] = $0} END {for (pkg in line) print line[pkg]}' "${DISTFILE}" | sort | sponge "${DISTFILE}"
17 29
18 30 # dedup again, leave only installed packages
19 - awk 'NR==FNR{installed[$1]; next} $1 in installed' installed.txt ${DISTFILE} | sort | sponge ${DISTFILE}
31 + awk 'NR==FNR{installed[$1]; next} $1 in installed' installed.txt "${DISTFILE}" | sort | sponge "${DISTFILE}"
20 32
21 33 # TODO: filter out existing update branches
22 34 # git branch --list |awk '{print $1}' > branches.txt
23 - # awk 'NR==FNR{branches[$1]; next} {for (b in branches) if ($1 ~ b) next} {print}' branches.txt ${DISTFILE}
35 + # awk 'NR==FNR{branches[$1]; next} {for (b in branches) if ($1 ~ b) next} {print}' branches.txt "${DISTFILE}"
24 36 }
25 37
26 38 # List my outdated packages w/o xcheckmypkgs
@@ -31,7 +43,7 @@ outdated_mypkg(){
31 43 MYURL="https://repo-default.voidlinux.org/void-updates/void-updates/updates_$(git -C "${XDISTDIR}" config user.email | sed 's/@/%40/').txt"
32 44 local MYFILE="updates_me.txt"
33 45
34 - wget --hsts-file="$XDG_CACHE_HOME/wget-hsts" --output-document ${MYFILE} --quiet "${MYURL}"
46 + CONNECTION_TIMEOUT=5000 xbps-fetch -o "${MYFILE}" "${MYURL}"
35 47 }
36 48
37 49 # List packages that have error checking updates
@@ -39,7 +51,7 @@ outdated_error(){
39 51 local LOG_URL="https://repo-default.voidlinux.org/void-updates/void-updates/_log.txt"
40 52 local LOG_FILE="updates_nover.txt"
41 53
42 - wget --hsts-file="$XDG_CACHE_HOME/wget-hsts" --output-document ${LOG_FILE} --quiet ${LOG_URL}
54 + CONNECTION_TIMEOUT=5000 xbps-fetch -o "${LOG_FILE}" "${LOG_URL}"
43 55
44 56 # leave only (manually) installed packages
45 57 grep -v 'No such file' < ${LOG_FILE} | awk 'BEGIN {
@@ -59,7 +71,7 @@ xpkg -m > installed.txt
59 71 # xbps-query -l | awk '{ print $2 }' | xargs -n1 xbps-uhelper getpkgname > installed.txt
60 72
61 73 # functions here
62 - outdated_orphan
74 + outdated_who "[email protected]" "orphan"
63 75 outdated_mypkg
64 76 outdated_error
65 77

Vinfall a révisé ce gist 1736148231. Aller à la révision

1 file changed, 1 insertion, 1 deletion

xoutdated.sh

@@ -9,7 +9,7 @@ outdated_orphan(){
9 9
10 10 # filter out uninterested packages
11 11 # opinionated, `lib` could be a bit overkill
12 - grep -vE 'apache-|avr-|cargo-|cinnamon|gnome-|gst-|jenkins|lib|linux|live555|nemo-|pantheon-|perl-|python3-grpcio|python3-google|ruby-|R-cran-' ${DISTFILE} | sponge ${DISTFILE}
12 + grep -vE 'apache-|avr-|cargo-|cinnamon|dkms|gnome-|gst-|jenkins|lib|linux|live555|nemo-|pantheon-|perl-|python3-grpcio|python3-google|ruby-|R-cran-' ${DISTFILE} | sponge ${DISTFILE}
13 13
14 14 # dedup, leave only the highest available version
15 15 # side effect: order is slightly different

Vinfall a révisé ce gist 1734315660. Aller à la révision

1 file changed, 0 insertions, 0 deletions

xoutdated renommé en xoutdated.sh

Fichier renommé sans modifications

Vinfall a révisé ce gist 1732782061. Aller à la révision

Aucun changement

Vinfall a révisé ce gist 1732782046. Aller à la révision

1 file changed, 0 insertions, 0 deletions

void-outdated-pkg.sh renommé en xoutdated

Fichier renommé sans modifications

Vinfall a révisé ce gist 1731732571. Aller à la révision

1 file changed, 4 insertions, 2 deletions

void-outdated-pkg.sh

@@ -23,10 +23,12 @@ outdated_orphan(){
23 23 # awk 'NR==FNR{branches[$1]; next} {for (b in branches) if ($1 ~ b) next} {print}' branches.txt ${DISTFILE}
24 24 }
25 25
26 - # List my outdated packages w/o xcheckmypkgs (only work in local void-packages git repo)
26 + # List my outdated packages w/o xcheckmypkgs
27 + # only work in local void-packages copy if XBPS_DISTDIR is not set
27 28 outdated_mypkg(){
28 29 local MYURL
29 - MYURL="https://repo-default.voidlinux.org/void-updates/void-updates/updates_$(git config --local user.email | sed 's/@/%40/').txt"
30 + XDISTDIR="$(xdistdir)" || exit 1
31 + MYURL="https://repo-default.voidlinux.org/void-updates/void-updates/updates_$(git -C "${XDISTDIR}" config user.email | sed 's/@/%40/').txt"
30 32 local MYFILE="updates_me.txt"
31 33
32 34 wget --hsts-file="$XDG_CACHE_HOME/wget-hsts" --output-document ${MYFILE} --quiet "${MYURL}"

Vinfall a révisé ce gist 1731415078. Aller à la révision

Aucun changement

Vinfall a révisé ce gist 1731415050. Aller à la révision

Aucun changement

Plus récent Plus ancien