Skip to content

Commit c282562

Browse files
oschwaldclaude
andcommitted
Remove File::Slurp dependency from release scripts
Replace File::Slurp-based version extraction with bash regex (grep + BASH_REMATCH) in release.sh and ppa-release.sh. Keep perl -pi -e for portable in-place substitution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c72d249 commit c282562

2 files changed

Lines changed: 13 additions & 18 deletions

File tree

dev-bin/ppa-release.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ set -u
66

77
DISTS=( groovy focal bionic xenial trusty )
88

9-
VERSION=$(perl -MFile::Slurp::Tiny=read_file -MDateTime <<EOF
10-
use v5.16;
11-
my \$log = read_file(q{Changes.md});
12-
\$log =~ /^## (\d+\.\d+\.\d+) - (\d{4}-\d{2}-\d{2})/;
13-
die 'Release time is not today!' unless DateTime->now->ymd eq \$2;
14-
say \$1;
15-
EOF
16-
)
9+
changelog_header=$(head -n 3 Changes.md)
10+
if [[ ! $changelog_header =~ ^##\ ([0-9]+\.[0-9]+\.[0-9]+)\ -\ ([0-9]{4}-[0-9]{2}-[0-9]{2}) ]]; then
11+
echo "Could not find version in Changes.md!"
12+
exit 1
13+
fi
14+
VERSION="${BASH_REMATCH[1]}"
1715

1816
RESULTS=/tmp/build-libmaxminddb-results/
1917
SRCDIR="$RESULTS/libmaxminddb"

dev-bin/release.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,14 @@ if [ -n "$(git status --porcelain)" ]; then
8181
exit 1
8282
fi
8383

84-
old_version=$(
85-
perl -MFile::Slurp=read_file <<EOF
86-
use v5.16;
87-
my \$conf = read_file(q{configure.ac});
88-
\$conf =~ /AC_INIT.+\[(\d+\.\d+\.\d+)\]/;
89-
say \$1;
90-
EOF
91-
)
84+
ac_init=$(grep AC_INIT configure.ac)
85+
if [[ ! $ac_init =~ \[([0-9]+\.[0-9]+\.[0-9]+)\] ]]; then
86+
echo "Could not find version in configure.ac!"
87+
exit 1
88+
fi
89+
old_version="${BASH_REMATCH[1]}"
9290

93-
perl -MFile::Slurp=edit_file -e \
94-
"edit_file { s/\Q$old_version/$version/g } \$_ for qw( configure.ac include/maxminddb.h CMakeLists.txt )"
91+
perl -pi -e "s/\Q$old_version/$version/g" configure.ac include/maxminddb.h CMakeLists.txt
9592

9693
if [ -n "$(git status --porcelain)" ]; then
9794
git diff

0 commit comments

Comments
 (0)