From: Alexandre Oliva Date: Fri, 9 Sep 2022 00:19:54 +0000 (-0400) Subject: mkgitrel.setprev: factor out helper scripts, extend it X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=c395e741586fe3147ce0cc6cefcbcc14eeb5f336;p=releases.git mkgitrel.setprev: factor out helper scripts, extend it the logic to find a previous release to compare with didn't cover a major version bump yet, fixed. also added mkgitrel.setdate and mkgitrel.gcfg --- diff --git a/mkgitrel.cln b/mkgitrel.cln index 5098b6d845f..d5fc3301215 100755 --- a/mkgitrel.cln +++ b/mkgitrel.cln @@ -1,6 +1,6 @@ #! /bin/bash -# Copyright 2021 Alexandre Oliva +# Copyright 2021-2022 Alexandre Oliva # # This program is part of GNU Linux-libre, a GNU project that # publishes scripts to clean up Linux so as to make it suitable for @@ -21,51 +21,18 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -reldir=$HOME/linux-libre/releases - -key=474402C8C582DAFBE389C427BCB7CF877E7D47A7 +scriptdir=$(dirname "$0") +. $scriptdir/mkgitrel.gcfg success=: for rel do -rup=$(echo "$rel" | sed 's,-gnu[0-9]*$,,') -cbr=$(echo "$rup" | sed 's,\(\.\|-rc\)[0-9]*$,,') - -if test -d $reldir/$rel; then - echo $reldir/$rel exists >&2 - continue -fi - -if test -h $reldir/LATEST-$cbr.0; then - prev0=$(readlink $reldir/LATEST-$cbr.0) - prevn=$(readlink $reldir/LATEST-$cbr.N) -elif test -h $reldir/LATEST-$rup.N; then - cbr=$rup - prev0=$(readlink $reldir/LATEST-$cbr.0) - prevn=$(readlink $reldir/LATEST-$cbr.N) -else - case $rup in - *-rc*) - prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,') - if test -h $reldir/LATEST-$prevbase.N; then - prev0=$(readlink $reldir/LATEST-$prevbase.N) - prevn=$prev0 - else - echo $reldir/LATEST-$prevbase.N does not exit >&2 - exit 1 - fi - ;; - *) - echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2 - exit 1 - ;; - esac -fi +. $scriptdir/mkgitrel.setprev && for up in linus stable; do git rev-parse --verify -q $up/v$rup && break -done +done && git verify-tag $up/v$rup && @@ -96,11 +63,7 @@ git worktree add --detach logs/v$rel public/logs/v$prevn && git tag incr/v$rel ) && -DATE=$(git cat-file -p incr/v$rel | - gawk '/^(author|tagger)/ { - print strftime(PROCINFO["strftime"], $(NF-1)) - }') && -export GIT_COMMITTER_DATE=$DATE GIT_AUTHOR_DATE=$DATE && +. $scriptdir/mkgitrel.setdate && ( cd sources/v$rel && @@ -147,7 +110,11 @@ fi && { scripts/v$rel/deblob-check --use-awk linux-libre-$rel.tar || scripts/v$rel/deblob-check --use-awk -C linux-libre-$rel.tar \ > linux-libre-$rel.check || - { success=false; continue; }; } + { success=false; continue; }; } && + +continue + +success=false done && diff --git a/mkgitrel.gcfg b/mkgitrel.gcfg new file mode 100644 index 00000000000..29622f80a27 --- /dev/null +++ b/mkgitrel.gcfg @@ -0,0 +1,26 @@ +#! /bin/bash + +# Copyright 2021-2022 Alexandre Oliva +# +# This program is part of GNU Linux-libre, a GNU project that +# publishes scripts to clean up Linux so as to make it suitable for +# use in the GNU Project and in Free System Distributions. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +reldir=$HOME/linux-libre/releases + +key=474402C8C582DAFBE389C427BCB7CF877E7D47A7 diff --git a/mkgitrel.pub b/mkgitrel.pub index 6c9ac901968..847a7fd76de 100755 --- a/mkgitrel.pub +++ b/mkgitrel.pub @@ -1,6 +1,6 @@ #! /bin/bash -# Copyright 2021 Alexandre Oliva +# Copyright 2021-2022 Alexandre Oliva # # This program is part of GNU Linux-libre, a GNU project that # publishes scripts to clean up Linux so as to make it suitable for @@ -21,53 +21,16 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -reldir=$HOME/linux-libre/releases - -key=474402C8C582DAFBE389C427BCB7CF877E7D47A7 +scriptdir=$(dirname "$0") +. $scriptdir/mkgitrel.gcfg success=: for rel do -rup=$(echo "$rel" | sed 's,-gnu[0-9]*$,,') -cbr=$(echo "$rup" | sed 's,\(\.\|-rc\)[0-9]*$,,') - -if test -d $reldir/$rel; then - echo $reldir/$rel exists >&2 - continue -fi - -if test -h $reldir/LATEST-$cbr.0; then - prev0=$(readlink $reldir/LATEST-$cbr.0) - prevn=$(readlink $reldir/LATEST-$cbr.N) -elif test -h $reldir/LATEST-$rup.N; then - cbr=$rup - prev0=$(readlink $reldir/LATEST-$cbr.0) - prevn=$(readlink $reldir/LATEST-$cbr.N) -else - case $rup in - *-rc*) - prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,') - if test -h $reldir/LATEST-$prevbase.N; then - prev0=$(readlink $reldir/LATEST-$prevbase.N) - prevn=$prev0 - else - echo $reldir/LATEST-$prevbase.N does not exit >&2 - exit 1 - fi - ;; - *) - echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2 - exit 1 - ;; - esac -fi +. $scriptdir/mkgitrel.setprev && -DATE=$(git cat-file -p incr/v$rel | - gawk '/^(author|tagger)/ { - print strftime(PROCINFO["strftime"], $(NF-1)) - }') && -export GIT_COMMITTER_DATE=$DATE GIT_AUTHOR_DATE=$DATE && +. $scriptdir/mkgitrel.setdate && if test -f linux-libre-$rel.check; then echo linux-libre-$rel.check exists, abandoning this release @@ -125,7 +88,11 @@ for x in scripts sources logs; do fi done && -git worktree remove --force sources/v$rel +git worktree remove --force sources/v$rel && + +continue + +success=false done && diff --git a/mkgitrel.rel b/mkgitrel.rel index 84e3c71103e..138a4497ad3 100755 --- a/mkgitrel.rel +++ b/mkgitrel.rel @@ -1,6 +1,6 @@ #! /bin/bash -# Copyright 2021 Alexandre Oliva +# Copyright 2021-2022 Alexandre Oliva # # This program is part of GNU Linux-libre, a GNU project that # publishes scripts to clean up Linux so as to make it suitable for @@ -21,47 +21,14 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -reldir=$HOME/linux-libre/releases - -key=474402C8C582DAFBE389C427BCB7CF877E7D47A7 +scriptdir=$(dirname "$0") +. $scriptdir/mkgitrel.gcfg success=: for rel do -rup=$(echo "$rel" | sed 's,-gnu[0-9]*$,,') -cbr=$(echo "$rup" | sed 's,\(\.\|-rc\)[0-9]*$,,') - -if test -d $reldir/$rel; then - echo $reldir/$rel exists >&2 - continue -fi - -if test -h $reldir/LATEST-$cbr.0; then - prev0=$(readlink $reldir/LATEST-$cbr.0) - prevn=$(readlink $reldir/LATEST-$cbr.N) -elif test -h $reldir/LATEST-$rup.N; then - cbr=$rup - prev0=$(readlink $reldir/LATEST-$cbr.0) - prevn=$(readlink $reldir/LATEST-$cbr.N) -else - case $rup in - *-rc*) - prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,') - if test -h $reldir/LATEST-$prevbase.N; then - prev0=$(readlink $reldir/LATEST-$prevbase.N) - prevn=$prev0 - else - echo $reldir/LATEST-$prevbase.N does not exit >&2 - exit 1 - fi - ;; - *) - echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2 - exit 1 - ;; - esac -fi +. $scriptdir/mkgitrel.setprev && if test -f linux-libre-$rel.check; then success=false @@ -70,11 +37,7 @@ if test -f linux-libre-$rel.check; then continue fi && -DATE=$(git cat-file -p incr/v$rel | - gawk '/^(author|tagger)/ { - print strftime(PROCINFO["strftime"], $(NF-1)) - }') && -export GIT_COMMITTER_DATE=$DATE GIT_AUTHOR_DATE=$DATE && +. $scriptdir/mkgitrel.setdate && plist="patch-$prev0-$rel" && if test "$prev0" != "$prevn"; then @@ -127,7 +90,11 @@ elif test -n "$prevbase" && test ! -h $reldir/LATEST-$cbr.0; then fi && git worktree remove logs/v$rel && -git worktree remove scripts/v$rel +git worktree remove scripts/v$rel && + +continue + +success=false done && diff --git a/mkgitrel.setdate b/mkgitrel.setdate new file mode 100644 index 00000000000..3ecf9b71075 --- /dev/null +++ b/mkgitrel.setdate @@ -0,0 +1,28 @@ +#! /bin/bash + +# Copyright 2021-2022 Alexandre Oliva +# +# This program is part of GNU Linux-libre, a GNU project that +# publishes scripts to clean up Linux so as to make it suitable for +# use in the GNU Project and in Free System Distributions. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +DATE=$(git cat-file -p incr/v$rel | + gawk '/^(author|tagger)/ { + print strftime(PROCINFO["strftime"], $(NF-1)) + }') && +export GIT_COMMITTER_DATE=$DATE GIT_AUTHOR_DATE=$DATE diff --git a/mkgitrel.setprev b/mkgitrel.setprev new file mode 100644 index 00000000000..7c9eb6279e8 --- /dev/null +++ b/mkgitrel.setprev @@ -0,0 +1,70 @@ +#! /bin/bash + +# Copyright 2021-2022 Alexandre Oliva +# +# This program is part of GNU Linux-libre, a GNU project that +# publishes scripts to clean up Linux so as to make it suitable for +# use in the GNU Project and in Free System Distributions. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +if test -d $reldir/$rel; then + echo $reldir/$rel exists >&2 + continue +fi + +rup=$(echo "$rel" | sed 's,-gnu[0-9]*$,,') +cbr=$(echo "$rup" | sed 's,\(\.\|-rc\)[0-9]*$,,') + +if test -h $reldir/LATEST-$cbr.0; then + prev0=$(readlink $reldir/LATEST-$cbr.0) + prevn=$(readlink $reldir/LATEST-$cbr.N) +elif test -h $reldir/LATEST-$rup.N; then + cbr=$rup + prev0=$(readlink $reldir/LATEST-$cbr.0) + prevn=$(readlink $reldir/LATEST-$cbr.N) +else + case $rup in + [3-9].0-rc* | [1-9][0-9].0-rc*) + prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,') + if test -h $reldir/LATEST-$prevbase.N; then + prev0=$(readlink $reldir/LATEST-$prevbase.N) + prevn=$prev0 + elif pbase=$(expr "$prevbase" - 1) && test -h $reldir/LATEST-$pbase.N; then + prevbase=$pbase + prev0=$(readlink $reldir/LATEST-$prevbase.N) + prevn=$prev0 + else + echo neither $reldir/LATEST-$prevbase.N nor $reldir/LATEST-$pbase.N exist>&2 + exit 1 + fi + ;; + *-rc*) + prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,') + if test -h $reldir/LATEST-$prevbase.N; then + prev0=$(readlink $reldir/LATEST-$prevbase.N) + prevn=$prev0 + else + echo $reldir/LATEST-$prevbase.N does not exit >&2 + exit 1 + fi + ;; + *) + echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2 + exit 1 + ;; + esac +fi