James E. King, III | f3490c5 | 2017-01-27 09:43:18 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # This script is intended to be used after tagging the repository and updating |
James E. King, III | 8101f00 | 2017-12-09 10:10:03 -0500 | [diff] [blame] | 4 | # 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 | |
| 8 | set -e |
| 9 | |
James E. King III | cea5075 | 2017-12-12 18:41:40 -0500 | [diff] [blame] | 10 | rm -f MANIFEST |
James E. King, III | 8101f00 | 2017-12-09 10:10:03 -0500 | [diff] [blame] | 11 | rm -rf Thrift-* |
| 12 | |
| 13 | # setup cpan without a prompt |
| 14 | echo | cpan |
| 15 | cpan install HTTP::Date |
| 16 | cpan install CPAN |
| 17 | cpan install CPAN::Meta ExtUtils::MakeMaker JSON::PP |
James E. King, III | f3490c5 | 2017-01-27 09:43:18 -0500 | [diff] [blame] | 18 | |
| 19 | perl Makefile.PL |
James E. King, III | 8101f00 | 2017-12-09 10:10:03 -0500 | [diff] [blame] | 20 | rm MYMETA.yml |
James E. King, III | f3490c5 | 2017-01-27 09:43:18 -0500 | [diff] [blame] | 21 | make manifest |
| 22 | make dist |
James E. King, III | 8101f00 | 2017-12-09 10:10:03 -0500 | [diff] [blame] | 23 | |
| 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 | |
| 29 | echo '-----------------------------------------------------------' |
| 30 | set -x |
| 31 | |
| 32 | DISTFILE=$(ls Thrift*.gz) |
James E. King III | cea5075 | 2017-12-12 18:41:40 -0500 | [diff] [blame] | 33 | NEWFILE=${DISTFILE/t-v/t-} |
| 34 | if [[ "$DISTFILE" != "$NEWFILE" ]]; then |
| 35 | mv $DISTFILE $NEWFILE |
| 36 | DISTFILE="$NEWFILE" |
| 37 | fi |
| 38 | tar xzf $DISTFILE |
| 39 | rm $DISTFILE |
James E. King, III | 8101f00 | 2017-12-09 10:10:03 -0500 | [diff] [blame] | 40 | DISTDIR=$(ls -d Thrift*) |
James E. King III | 23dde8c | 2018-01-24 14:50:10 -0500 | [diff] [blame] | 41 | # cpan doesn't like "Thrift-v0.nn.0 as a directory name |
| 42 | # needs to be Thrift-0.nn.0 |
James E. King III | cea5075 | 2017-12-12 18:41:40 -0500 | [diff] [blame] | 43 | NEWDIR=${DISTDIR/t-v/t-} |
| 44 | if [[ "$DISTDIR" != "$NEWDIR" ]]; then |
| 45 | mv $DISTDIR $NEWDIR |
| 46 | DISTDIR="$NEWDIR" |
| 47 | fi |
James E. King, III | 8101f00 | 2017-12-09 10:10:03 -0500 | [diff] [blame] | 48 | cd $DISTDIR |
James E. King III | 23dde8c | 2018-01-24 14:50:10 -0500 | [diff] [blame] | 49 | cp -p ../Makefile.PL . |
James E. King, III | 8101f00 | 2017-12-09 10:10:03 -0500 | [diff] [blame] | 50 | perl ../tools/FixupDist.pl |
| 51 | cd .. |
| 52 | tar cvzf $DISTFILE $DISTDIR |
| 53 | rm -r $DISTDIR |