parallel/packager/releasescripts/updateversion
2023-12-23 19:42:22 +01:00

78 lines
2.7 KiB
Bash
Executable file

#!/bin/bash
# SPDX-FileCopyrightText: 2021-2022 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
# SPDX-License-Identifier: GPL-3.0-or-later
# Set DOI and SPCTAG then run this
updater() {
export DOI
export TAG
export SPCTAG
export YYYYMMDD=`yyyymmdd`
export YYYY=${YYYYMMDD:0:4}
export YYYYMM=${YYYYMMDD:0:6}
export YYYYMMDD=${YYYYMM}22
export MON=`date +%b`
export MONTH=`date +%B`
# Space Tag => SpaceTag
TAG=$(echo $SPCTAG | perl -pe 's/ //g')
# DOI=10.5281/zenodo.
# DOINO=10428184
DOINO=$(echo $DOI | perl -pe 's/.*\.//')
export DOINO
echo Tag=$TAG=\"$SPCTAG\" Date:$YYYYMMDD Year:$YYYY Mon:$MON Month:$MONTH DOI:$DOI DOINO=$DOINO
export TITLE="GNU Parallel $YYYYMMDD ('$SPCTAG')"
if [ -z "$DOI" ] ; then
echo '*** Set DOI and try again ***'
echo 'https://zenodo.org/deposit/new (Get a DOI now!)'
echo '[Save draft]'
cat .last-doitag.txt
echo . .last-doitag.txt
return
fi
if [ -z "$SPCTAG" ] ; then
echo '*** Set SPCTAG and try again ***'
cat .last-doitag.txt
echo . .last-doitag.txt
return
fi
echo "export DOI=$DOI" > .last-doitag.txt
echo "export DOINO=$DOINO" >> .last-doitag.txt
echo "export TAG='$TAG'" >> .last-doitag.txt
echo "export SPCTAG='$SPCTAG'" >> .last-doitag.txt
echo "export YYYYMMDD=$YYYYMMDD" >> .last-doitag.txt
echo 'echo "$DOINO $DOI $YYYYMMDD ($TAG)"' >> .last-doitag.txt
perl -i -pe "s/20\d\d\d\d\d\d/$YYYYMMDD/" configure.ac
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/sql
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/parsort
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/env_parallel*
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/niceload
perl -i -pe "s/parallel-20\d\d\d\d\d\d/parallel-$YYYYMMDD/" README
perl -i -pe '
# Update version 20209999
/version/ and s/20\d\d\d\d\d\d/$ENV{YYYYMMDD}/;
# Update: 10.5281/zenodo.1146014
s:10.5281/zenodo.\d+:$ENV{DOI}:;
# Update "@software{tange_2015_16303,"
s:tange_\d+_\d+:tange_$ENV{YYYY}_$ENV{DOINO}:;
# Update month = mar,
s/(month\s+=\s+)\S+,",/$1$ENV{MON},",/;
# Update title = {GNU Parallel 20200522 ('Kraftwerk')},",
/ title\s+= / and s/\{.*\}/{$ENV{TITLE}}/;
# Tange, O. (2020, May 22). GNU Parallel 20200522 ('Kraftwerk').
s/(Tange, O. .).*(.. )(GNU.*[)])/$1$ENV{YYYY}, $ENV{MONTH} 22$2$ENV{TITLE}/;
' src/parallel README
(
ppar --help
ppar --citation
grep -i 'zenodo|tange' README
) 2>&1 | grep -E '^ |^}|tange'
mv ~/.parallel/will-cite ~/.parallel/will-cite.
ppar ::: true
mv ~/.parallel/will-cite. ~/.parallel/will-cite
}
updater