1#!/bin/bash 2# 3# This script is intended to be used after tagging the repository and updating 4# the version files for a release. It will create a CPAN archive. Run this 5# from inside a docker image like ubuntu-focal. 6# 7 8set -e 9 10rm -f MANIFEST 11rm -rf Thrift-* 12 13# setup cpan without a prompt 14echo | cpan 15cpan install HTTP::Date Log::Log4perl 16cpan install CPAN 17cpan install CPAN::Meta ExtUtils::MakeMaker JSON::PP 18# cpan install Module::Signature 19 20perl Makefile.PL 21rm MYMETA.yml 22make manifest 23make dist 24 25# 26# We unpack the archive so we can add version metadata for CPAN 27# so that it properly indexes Thrift and remove unnecessary files. 28# 29 30echo '-----------------------------------------------------------' 31set -x 32 33DISTFILE=$(ls Thrift*.gz) 34NEWFILE=${DISTFILE/t-v/t-} 35if [[ "$DISTFILE" != "$NEWFILE" ]]; then 36 mv $DISTFILE $NEWFILE 37 DISTFILE="$NEWFILE" 38fi 39tar xzf $DISTFILE 40rm $DISTFILE 41DISTDIR=$(ls -d Thrift*) 42# cpan doesn't like "Thrift-v0.nn.0 as a directory name 43# needs to be Thrift-0.nn.0 44NEWDIR=${DISTDIR/t-v/t-} 45if [[ "$DISTDIR" != "$NEWDIR" ]]; then 46 mv $DISTDIR $NEWDIR 47 DISTDIR="$NEWDIR" 48fi 49cd $DISTDIR 50cp -p ../Makefile.PL . 51cp -pr ../gen-perl . 52cp -pr ../gen-perl2 . 53perl ../tools/FixupDist.pl 54cd .. 55tar cvzf $DISTFILE $DISTDIR 56rm -r $DISTDIR 57