blob: c92fd76b58be910926f9f7c5565fd5621b4db130 [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
James E. King IIIbbc13772019-01-14 12:07:10 -050015cpan install HTTP::Date Log::Log4perl
James E. King, III8101f002017-12-09 10:10:03 -050016cpan install CPAN
17cpan install CPAN::Meta ExtUtils::MakeMaker JSON::PP
James E. King IIIbbc13772019-01-14 12:07:10 -050018# cpan install Module::Signature
James E. King, IIIf3490c52017-01-27 09:43:18 -050019
20perl Makefile.PL
James E. King, III8101f002017-12-09 10:10:03 -050021rm MYMETA.yml
James E. King, IIIf3490c52017-01-27 09:43:18 -050022make manifest
23make dist
James E. King, III8101f002017-12-09 10:10:03 -050024
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)
James E. King IIIcea50752017-12-12 18:41:40 -050034NEWFILE=${DISTFILE/t-v/t-}
35if [[ "$DISTFILE" != "$NEWFILE" ]]; then
36 mv $DISTFILE $NEWFILE
37 DISTFILE="$NEWFILE"
38fi
39tar xzf $DISTFILE
40rm $DISTFILE
James E. King, III8101f002017-12-09 10:10:03 -050041DISTDIR=$(ls -d Thrift*)
James E. King III23dde8c2018-01-24 14:50:10 -050042# cpan doesn't like "Thrift-v0.nn.0 as a directory name
43# needs to be Thrift-0.nn.0
James E. King IIIcea50752017-12-12 18:41:40 -050044NEWDIR=${DISTDIR/t-v/t-}
45if [[ "$DISTDIR" != "$NEWDIR" ]]; then
46 mv $DISTDIR $NEWDIR
47 DISTDIR="$NEWDIR"
48fi
James E. King, III8101f002017-12-09 10:10:03 -050049cd $DISTDIR
James E. King III23dde8c2018-01-24 14:50:10 -050050cp -p ../Makefile.PL .
James E. King IIIbbc13772019-01-14 12:07:10 -050051cp -pr ../gen-perl .
52cp -pr ../gen-perl2 .
James E. King, III8101f002017-12-09 10:10:03 -050053perl ../tools/FixupDist.pl
54cd ..
Jens Geyer224b43e2019-10-09 00:03:11 +020055tar cvzf --hard-dereference $DISTFILE $DISTDIR
James E. King, III8101f002017-12-09 10:10:03 -050056rm -r $DISTDIR