├── .github └── workflows │ └── docker.yml ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── docker-bake.hcl ├── entrypoint.sh └── void-updates.sh /.github/workflows/docker.yml: -------------------------------------------------------------------------------- 1 | name: docker 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | jobs: 9 | main: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Set version 13 | run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV 14 | 15 | - name: Checkout repo 16 | uses: classabbyamp/treeless-checkout-action@v1 17 | 18 | - name: Docker metadata 19 | id: meta 20 | uses: docker/metadata-action@v4 21 | with: 22 | images: | 23 | ghcr.io/${{ github.repository_owner }}/void-updates 24 | tags: | 25 | type=sha,prefix= 26 | type=raw,value=latest 27 | type=raw,value=${{env.RELEASE_VERSION}},priority=1000 28 | flavor: latest=false 29 | labels: | 30 | org.opencontainers.image.authors=Void Linux team and contributors 31 | org.opencontainers.image.url=https://voidlinux.org 32 | org.opencontainers.image.source=https://github.com/${{ github.repository }} 33 | org.opencontainers.image.vendor=Void Linux 34 | org.opencontainers.image.title=void-updates 35 | org.opencontainers.image.description=Update check system for void-packages 36 | 37 | - name: Set up QEMU 38 | uses: docker/setup-qemu-action@v2 39 | 40 | - name: Set up Docker Buildx 41 | uses: docker/setup-buildx-action@v2 42 | 43 | - name: Login to GCHR 44 | uses: docker/login-action@v2 45 | with: 46 | registry: ghcr.io 47 | username: ${{ github.actor }} 48 | password: ${{ secrets.GITHUB_TOKEN }} 49 | 50 | - name: Build and push images 51 | id: build_and_push 52 | uses: docker/bake-action@v5 53 | with: 54 | push: true 55 | targets: void-updates 56 | files: | 57 | docker-bake.hcl 58 | ${{ steps.meta.outputs.bake-file }} 59 | set: | 60 | _common.cache-to=type=gha 61 | _common.cache-from=type=gha 62 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE=ghcr.io/void-linux/void-musl-full:20231003R1 2 | FROM ${BASE} 3 | RUN xbps-install -yMu xbps && xbps-install -yMu git bash curl util-linux findutils 4 | COPY void-updates.sh /usr/local/bin/void-updates 5 | COPY entrypoint.sh /entrypoint 6 | 7 | # Needed to allow the update checker to run as root. 8 | ENV XBPS_ALLOW_CHROOT_BREAKOUT=1 9 | ENV PARALLELISM=20 10 | 11 | LABEL org.opencontainers.image.source https://github.com/void-linux/void-updates 12 | 13 | ENTRYPOINT ["/entrypoint"] 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, The Void distribution 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PREFIX ?= /usr/local 2 | 3 | all: 4 | @: 5 | 6 | install: 7 | install -d ${DESTDIR}/${PREFIX}/bin 8 | install -m755 void-updates.sh ${DESTDIR}/${PREFIX}/bin/void-updates 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | void-updates 2 | ============ 3 | 4 | Script intended to be run daily via cron for finding upstream updates 5 | to [void-packages][]. This is just a wrapper around `./xbps-src update-check`. 6 | 7 | Requirements 8 | ------------ 9 | 10 | * xbps 11 | * git 12 | 13 | Usage 14 | ----- 15 | 16 | 1. Create a dedicated user for `void-updates` which is member of the 17 | `xbuilder` group. 18 | 2. Run a command like the following from the dedicated user's crontab 19 | daily: 20 | 21 | void-updates -p 20 \ 22 | -r https://github.com/void-linux/void-packages.git \ 23 | -s /var/cache/void-packages \ 24 | -o /srv/http/void-updates 25 | 26 | [void-packages]: https://github.com/void-linux/void-packages 27 | -------------------------------------------------------------------------------- /docker-bake.hcl: -------------------------------------------------------------------------------- 1 | target "docker-metadata-action" {} 2 | 3 | target "_common" { 4 | inherits = ["docker-metadata-action"] 5 | dockerfile = "Dockerfile" 6 | cache-to = ["type=local,dest=/tmp/buildx-cache"] 7 | cache-from = ["type=local,src=/tmp/buildx-cache"] 8 | } 9 | 10 | target "void-updates" { 11 | inherits = ["_common"] 12 | platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/arm/v6"] 13 | args = { "LIBC" = "musl" } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -d /void-packages-origin/.git ] ; then 4 | printf "local origin is possible, bootstrapping from that...\n" 5 | git clone /void-packages-origin /void-packages 6 | fi 7 | 8 | /usr/local/bin/void-updates \ 9 | -p "$PARALLELISM" \ 10 | -r https://github.com/void-linux/void-packages.git \ 11 | -s /void-packages \ 12 | -o "${OUTDIR:-/void-updates}" 13 | -------------------------------------------------------------------------------- /void-updates.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | init_src() { 6 | if ! [ -d $src/.git ]; then 7 | mkdir -p $src 8 | git clone -q $repo $src 9 | fi 10 | } 11 | 12 | update_src() { 13 | printf "updating clone\n" 14 | GIT_WORK_TREE=$src GIT_DIR=$src/.git git pull -q 15 | printf "update complete\n" 16 | } 17 | 18 | is_meta() { 19 | ( 20 | cd $src 21 | ./xbps-src show $1 | grep -q '^build_style:[[:blank:]]*meta$' 22 | ) 23 | } 24 | 25 | has_distfiles() { 26 | ( 27 | cd $src 28 | ./xbps-src show $1 | grep -q '^distfiles:' 29 | ) 30 | } 31 | 32 | is_versioned() { 33 | case $1 in 34 | *-git) return 1;; 35 | esac 36 | return 0 37 | } 38 | 39 | find_pkgs() { 40 | local f p 41 | 42 | for f in $src/srcpkgs/*; do 43 | p=$(basename $f) 44 | 45 | if [ ! -h $f ] && 46 | [ -f $f/template ] && 47 | ! is_meta $p && 48 | has_distfiles $p && 49 | is_versioned $p; then 50 | printf -- '%s\n' $p 51 | fi 52 | done 53 | } 54 | 55 | get_var() { 56 | grep ^$2= $src/srcpkgs/$1/template | cut -d= -f2- | tr -d "\"'" 57 | } 58 | 59 | add_maintainer() { 60 | local p m 61 | while IFS= read -r p; do 62 | m=$(get_var $p maintainer | awk -F\< '{ print $2 }' | tr -d '> ') 63 | 64 | if [ "$m" ]; then 65 | printf '%s %s\n' $p $dest/updates_$m.txt 66 | fi 67 | done 68 | } 69 | 70 | get_date() { 71 | local f=$1 72 | local p=$2 73 | local v="$3" 74 | local lookback=30 75 | local i dt pf 76 | 77 | for i in $(seq $lookback -1 0); do 78 | dt=$(date --date="-$i days" +%Y-%m-%d) 79 | pf=$out/${name}_$dt/$f 80 | [ -f $pf ] || continue 81 | 82 | if fgrep -q "$p $v" $pf; then 83 | if [ $lookback -ne $i ]; then 84 | printf '%s' $dt 85 | fi 86 | return 0 87 | fi 88 | done 89 | } 90 | 91 | add_date() { 92 | local f=$1 93 | local p v 94 | while read -r p v; do 95 | printf '%s\t%s\t%s\n' $p "$v" "$(get_date $f $p "$v")" 96 | done 97 | } 98 | 99 | add_homepage() { 100 | local p v 101 | while read -r p v; do 102 | printf '%s\t%s\t%s\n' $p "$v" "$(get_var $p homepage)" 103 | done 104 | } 105 | 106 | parallel_check() { 107 | printf "beginning checks\n" 108 | xargs -P$procs -L1 /bin/sh -c " 109 | (cd $src && ./xbps-src update-check \$0) | 110 | sed -e \"s|\$0-||g\" -e \"s|^|\$0 |\" >> \$1 111 | " 112 | } 113 | 114 | create_summary() { 115 | local f m 116 | 117 | { 118 | for f in $dest/updates_*.txt; do 119 | if [ -s $f ]; then 120 | m=$(basename ${f%%.txt} | sed 's/updates_//') 121 | 122 | printf '%s\n%s\n' $m $(printf %${#m}s |tr ' ' -) 123 | sort $f | add_date $(basename $f) | add_homepage | column -t -s"$(printf '\t')" 124 | printf -- '\n' 125 | else 126 | rm -f $f 127 | fi 128 | done 129 | } > $dest.txt 130 | } 131 | 132 | create_heading() { 133 | local d=$(($end - $start)) 134 | local t="Void Updates for $(date +%Y-%m-%d\ %H:%M\ %Z) (took: ${d}s)" 135 | local s 136 | s=$(printf %${#t}s |tr ' ' =) 137 | 138 | sed -e "1s/^/$s\n\n/" -e "1s/^/$t\n/" -i $dest.txt 139 | } 140 | 141 | make_current() { 142 | ln -vsf ${dest##*/}.txt $out/$name.txt 143 | ln -vsfn ${dest##*/} $out/$name 144 | } 145 | 146 | while getopts "p:r:s:o:" opt; do 147 | case $opt in 148 | p) 149 | procs=$OPTARG 150 | ;; 151 | r) 152 | repo=$OPTARG 153 | ;; 154 | s) 155 | src=$OPTARG 156 | ;; 157 | o) 158 | out=$OPTARG 159 | ;; 160 | esac 161 | done 162 | 163 | [ "$procs" ] || procs=1 164 | [ "$repo" ] 165 | [ "$src" ] 166 | [ "$out" ] 167 | 168 | name=$(basename $0) 169 | date=$(date +%Y-%m-%d) 170 | dest=$out/${name}_$date 171 | 172 | mkdir -p $dest 173 | 174 | { 175 | start=$(date +%s) 176 | init_src 177 | update_src 178 | find_pkgs | add_maintainer | parallel_check 179 | create_summary 180 | end=$(date +%s) 181 | create_heading 182 | make_current 183 | } 2> $dest/_log.txt 184 | --------------------------------------------------------------------------------