summaryrefslogtreecommitdiff
path: root/lib/perl
diff options
context:
space:
mode:
authorJames E. King, III <jking@apache.org>2017-12-09 10:10:03 -0500
committerJames E. King, III <jking@apache.org>2017-12-09 17:02:12 -0500
commit8101f00b0966deebd36a6ba658aa59d718453345 (patch)
tree0e3825bb3eff2fb66828ba0c91b4f148d1602c17 /lib/perl
parentc4af63385f06f501e012712c747379eb33f273af (diff)
downloadthrift-8101f00b0966deebd36a6ba658aa59d718453345.tar.gz
THRIFT-4416: fixed up CPAN module creation and automated all steps except for upload to CPAN
Client: perl This closes #1441
Diffstat (limited to 'lib/perl')
-rw-r--r--lib/perl/MANIFEST.SKIP13
-rw-r--r--lib/perl/Makefile.PL5
-rwxr-xr-xlib/perl/build-cpan-dist.sh34
-rw-r--r--lib/perl/tools/FixupDist.pl35
4 files changed, 86 insertions, 1 deletions
diff --git a/lib/perl/MANIFEST.SKIP b/lib/perl/MANIFEST.SKIP
new file mode 100644
index 000000000..7963b42ad
--- /dev/null
+++ b/lib/perl/MANIFEST.SKIP
@@ -0,0 +1,13 @@
+blib/.*$
+build-cpan-dist.sh
+FixupDist.pl
+MANIFEST.bak
+MANIFEST.SKIP
+MYMETA.json
+Makefile
+Makefile.am
+Makefile.in
+pm_to_blib
+test/Makefile.am
+test/Makefile.in
+tools/FixupDist.pl
diff --git a/lib/perl/Makefile.PL b/lib/perl/Makefile.PL
index ee7a43612..bdeaad2b7 100644
--- a/lib/perl/Makefile.PL
+++ b/lib/perl/Makefile.PL
@@ -17,7 +17,12 @@
# under the License.
#
+use 5.10.0;
+use strict;
+use warnings;
+
use ExtUtils::MakeMaker;
+
WriteMakefile( ABSTRACT => 'Apache Thrift is a software framework for scalable cross-language services development.',
AUTHOR => 'Apache Thrift <dev@thrift.apache.org>',
LICENSE => 'apache_2_0',
diff --git a/lib/perl/build-cpan-dist.sh b/lib/perl/build-cpan-dist.sh
index 1765e6d08..3b80734f4 100755
--- a/lib/perl/build-cpan-dist.sh
+++ b/lib/perl/build-cpan-dist.sh
@@ -1,9 +1,41 @@
#!/bin/bash
#
# This script is intended to be used after tagging the repository and updating
-# the version files for a release. It will create a CPAN archive.
+# the version files for a release. It will create a CPAN archive. Run this
+# from inside a docker image like ubuntu-xenial.
+#
+
+set -e
+
+rm MANIFEST
+rm -rf Thrift-*
+
+# setup cpan without a prompt
+echo | cpan
+cpan install HTTP::Date
+cpan install CPAN
+cpan install CPAN::Meta ExtUtils::MakeMaker JSON::PP
perl Makefile.PL
+rm MYMETA.yml
make
make manifest
make dist
+
+#
+# We unpack the archive so we can add version metadata for CPAN
+# so that it properly indexes Thrift and remove unnecessary files.
+#
+
+echo '-----------------------------------------------------------'
+set -x
+
+DISTFILE=$(ls Thrift*.gz)
+tar xzf Thrift-*.gz
+rm Thrift-*.gz
+DISTDIR=$(ls -d Thrift*)
+cd $DISTDIR
+perl ../tools/FixupDist.pl
+cd ..
+tar cvzf $DISTFILE $DISTDIR
+rm -r $DISTDIR
diff --git a/lib/perl/tools/FixupDist.pl b/lib/perl/tools/FixupDist.pl
new file mode 100644
index 000000000..24a2b200a
--- /dev/null
+++ b/lib/perl/tools/FixupDist.pl
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# This will fix up the distribution so that CPAN properly
+# indexes Thrift.
+#
+
+use 5.10.0;
+use strict;
+use warnings;
+use utf8;
+
+use Data::Dumper;
+use CPAN::Meta;
+
+my $meta = CPAN::Meta->load_file('META.json');
+$meta->{'provides'} = { 'Thrift' => { 'file' => 'lib/Thrift.pm', 'version' => $meta->version() } };
+$meta->save('META.json');