mkgitrel.cln: run single check pass and refuse --force releases
[releases.git] / mkgitrel.pub
1 #! /bin/bash
2
3 # Copyright 2021-2023 Alexandre Oliva <lxoliva@fsfla.org>
4 #
5 # This program is part of GNU Linux-libre, a GNU project that
6 # publishes scripts to clean up Linux so as to make it suitable for
7 # use in the GNU Project and in Free System Distributions.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22 # USA
23
24 scriptdir=$(dirname "$0")
25 . $scriptdir/mkgitrel.gcfg
26
27 success=:
28 for rel
29 do
30     
31 . $scriptdir/mkgitrel.setprev &&
32
33 . $scriptdir/mkgitrel.setdate &&
34
35 if test -f linux-libre-$rel.check; then
36     echo linux-libre-$rel.check exists, abandoning this release
37     git tag -d incr/v$rel logs/v$rel sources/v$rel |&
38       tee -a linux-libre-$rel.dtags
39     continue
40 fi &&
41
42 while test -f linux-libre-$rel.patck && test ! -f linux-libre-$rel.check; do
43   echo please verify linux-libre-$rel.patck and move it away to complete the release
44   sleep 30
45 done &&
46
47 # Look for .check again, maybe it was created manually while we waited
48 # for .patck to be removed.  In this case, we have to duplicate the
49 # cleanups that .rel would have already done.
50 if test -f linux-libre-$rel.check; then
51     echo linux-libre-$rel.check exists, abandoning this release
52     git tag -d incr/v$rel logs/v$rel sources/v$rel |&
53       tee -a linux-libre-$rel.dtags
54     git worktree remove logs/v$rel
55     git worktree remove --force sources/v$rel
56     continue
57 fi &&
58
59 (
60   cd scripts/v$rel &&
61   { { git reset --soft -q scripts/$cbr &&
62       otop=$(git rev-parse --verify -q HEAD); } ||
63     echo $rel | grep -q -e -rc; } &&
64   { git commit -a -S$key -m "GNU Linux-libre $rel scripts" ||
65     if git status -su | grep .; then
66       success=false
67       continue
68     fi; } &&
69   case $rup:$(git rev-parse --verify -q HEAD) in
70   *-rc*:* | "$cbr":*) forcetag=: ;;
71   *:"$otop") forcetag=false ;;
72   *) forcetag=: ;;
73   esac &&
74   if $forcetag; then
75     git tag -m "GNU Linux-libre $rel scripts" -s -u $key \
76         -f \
77       scripts/v$rel &&
78     git checkout scripts/$cbr &&
79     git reset --hard scripts/v$rel &&
80     git checkout HEAD
81   fi
82 ) &&
83
84 for x in scripts sources logs; do
85   if git rev-parse --verify -q $x/v$rel > /dev/null ; then
86     git tag public/$x/v$rel $x/v$rel &&
87     git tag -d $x/v$rel
88   fi
89 done &&
90
91 git worktree remove --force sources/v$rel &&
92
93 continue
94
95 success=false
96
97 done &&
98
99 : $success