blob: ae22e7e623c1d02bfe6f188d560b8173d4f310f5 [file] [log] [blame]
James E. King, IIIf3490c52017-01-27 09:43:18 -05001#!/bin/bash
2#
3# This script is intended to be used after tagging the repository and updating
James E. King, III8101f002017-12-09 10:10:03 -05004# the version files for a release. It will create a CPAN archive. Run this
5# from inside a docker image like ubuntu-xenial.
6#
7
8set -e
9
James E. King IIIcea50752017-12-12 18:41:40 -050010rm -f MANIFEST
James E. King, III8101f002017-12-09 10:10:03 -050011rm -rf Thrift-*
12
13# setup cpan without a prompt
14echo | cpan
15cpan install HTTP::Date
16cpan install CPAN
17cpan install CPAN::Meta ExtUtils::MakeMaker JSON::PP
James E. King, IIIf3490c52017-01-27 09:43:18 -050018
19perl Makefile.PL
James E. King, III8101f002017-12-09 10:10:03 -050020rm MYMETA.yml
James E. King, IIIf3490c52017-01-27 09:43:18 -050021make manifest
22make dist
James E. King, III8101f002017-12-09 10:10:03 -050023
24#
25# We unpack the archive so we can add version metadata for CPAN
26# so that it properly indexes Thrift and remove unnecessary files.
27#
28
29echo '-----------------------------------------------------------'
30set -x
31
32DISTFILE=$(ls Thrift*.gz)
James E. King IIIcea50752017-12-12 18:41:40 -050033NEWFILE=${DISTFILE/t-v/t-}
34if [[ "$DISTFILE" != "$NEWFILE" ]]; then
35 mv $DISTFILE $NEWFILE
36 DISTFILE="$NEWFILE"
37fi
38tar xzf $DISTFILE
39rm $DISTFILE
James E. King, III8101f002017-12-09 10:10:03 -050040DISTDIR=$(ls -d Thrift*)
James E. King III23dde8c2018-01-24 14:50:10 -050041# cpan doesn't like "Thrift-v0.nn.0 as a directory name
42# needs to be Thrift-0.nn.0
James E. King IIIcea50752017-12-12 18:41:40 -050043NEWDIR=${DISTDIR/t-v/t-}
44if [[ "$DISTDIR" != "$NEWDIR" ]]; then
45 mv $DISTDIR $NEWDIR
46 DISTDIR="$NEWDIR"
47fi
James E. King, III8101f002017-12-09 10:10:03 -050048cd $DISTDIR
James E. King III23dde8c2018-01-24 14:50:10 -050049cp -p ../Makefile.PL .
James E. King, III8101f002017-12-09 10:10:03 -050050perl ../tools/FixupDist.pl
51cd ..
52tar cvzf $DISTFILE $DISTDIR
53rm -r $DISTDIR