#! /bin/bash # Copyright 2021-2023 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 scriptdir=$(dirname "$0") . $scriptdir/mkgitrel.gcfg force= && case $1 in --force) force=$1; shift;; esac success=: for rel do . $scriptdir/mkgitrel.setprev && for up in linus stable; do git rev-parse --verify -q $up/v$rup && break done && git verify-tag $up/v$rup && { test -d scripts/v$rel || git worktree add --detach scripts/v$rel scripts/$cbr } && case $(sed -n 's,^kver=\(.*\) extra=\(.*\),\1-gnu\2,p' \ scripts/v$rel/deblob-$cbr) in "$cbr$(echo $rel | sed -n 's,.*\(-gnu\),\1,p')") ;; *) echo $rel mismatches release implied by scripts/v$rel/deblob-$cbr >&2 echo "$cbr$(echo $rel | sed -n 's,.*\(-gnu\),\1,p')" vs \ $(sed -n 's,^kver=\(.*\) extra=\(.*\),\1-gnu\2,p' \ scripts/v$rel/deblob-$cbr) >&2 continue;; esac && git worktree add --detach sources/v$rel $up/v$rup && git worktree add --detach logs/v$rel public/logs/v$prevn && (cd logs/v$rel && git rm -f linux-*) && if (cd sources/v$rel && ../../scripts/v$rel/deblob-$cbr $force) \ >& logs/v$rel/linux-libre-$rel.log && { test -z "$force" || test $(grep -i error logs/v$rel/linux-libre-$rel.log | grep -c -v force) = 0; }; then : else grep -i error logs/v$rel/linux-libre-$rel.log > linux-libre-$rel.check success=false; continue fi && ( cd sources/v$rel && git commit -m "GNU Linux-libre v$rel incremental" -a && git tag incr/v$rel ) && . $scriptdir/mkgitrel.setdate && ( cd sources/v$rel && git reset --soft -q public/sources/v$prevn && git commit --amend --reset-author -S$key \ -m "GNU Linux-libre $rel" && git tag -m "GNU Linux-libre $rel" -s -u $key sources/v$rel && git reset --hard incr/v$rel^ && { git merge --no-commit incr/v$prevn || :; } && git diff incr/v$rel > ../../linux-libre-$rel.patckT && mv -v ../../linux-libre-$rel.patckT ../../linux-libre-$rel.patck ) && git archive --format tar --prefix=linux-$rup/ -o linux-libre-$rel.tar sources/v$rel && gpg --armor --detach-sign linux-libre-$rel.tar && mv linux-libre-$rel.tar.asc logs/v$rel/linux-libre-$rel.tar.sign && for f in linux-libre-; do if cmp logs/v$rel/$f$rel.log $reldir/$prevn/$f$prevn.log; then ln -vf $reldir/$prevn/$f$prevn.log logs/v$rel/$f$rel.log && ln -vf $reldir/$prevn/$f$prevn.log.sign logs/v$rel/$f$rel.log.sign else gpg --armor --detach-sign logs/v$rel/$f$rel.log && mv -v logs/v$rel/$f$rel.log.asc logs/v$rel/$f$rel.log.sign fi done && ( cd logs/v$rel && git add linux* && git commit --amend --reset-author -S$key -m "GNU Linux-libre $rel logs" && git tag -m "GNU Linux-libre $rel logs" -s -u $key logs/v$rel ) && git diff --src-prefix=linux-libre-$prev0/ --dst-prefix=linux-libre-$rel/ \ public/sources/v$prev0 sources/v$rel -- > patch-$prev0-$rel && if test "$prev0" != "$prevn"; then git diff --src-prefix=linux-libre-$prevn/ --dst-prefix=linux-libre-$rel/ \ public/sources/v$prevn sources/v$rel -- > patch-$prevn-$rel fi && { { test -z "$force" && 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; }; } && if test -n "$force"; then echo aborting, --force is for testing only >> linux-libre-$rel.check success=false fi && continue echo something went wrong > linux-libre-$rel.check success=false done && : $success