From ca0d190812839687bc1a8c33966e43c3f6eb87c8 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 21 Feb 2018 07:02:45 -0500 Subject: [PATCH] Have make_dist infer the version --- README-maintainer.md | 2 +- make_dist | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/README-maintainer.md b/README-maintainer.md index 5291856a..98ee2ecc 100644 --- a/README-maintainer.md +++ b/README-maintainer.md @@ -53,7 +53,7 @@ Example: rm -rf /tmp/qpdf-x.y.z git archive --prefix=qpdf-x.y.z/ HEAD . | (cd /tmp; tar xf -) ``` - From the parent of that directory, run `make_dist` with the directory as an argument. Remember to have fop in your path. For internally testing releases, you can run make_dist with the `--no-tests` option. + From the parent of that directory, run `qpdf-x.y.z/make_dist`. Remember to have fop in your path. For internally testing releases, you can run make_dist with the `--no-tests` option. * To create a source release of external libs, do an export from the version control system into a directory called `qpdf-external-libs` and just make a zip file of the result called `qpdf-external-libs-src.zip`. See the README.txt file there for information on creating binary external libs releases. Run this from the external-libs repository: ``` git archive --prefix=external-libs/ HEAD . | (cd /tmp; tar xf -) diff --git a/make_dist b/make_dist index 8cca6085..eff0d81c 100755 --- a/make_dist +++ b/make_dist @@ -9,16 +9,18 @@ use warnings; use strict; use File::Basename; use Cwd; +use Cwd 'abs_path'; use IO::File; my $whoami = basename($0); +my $srcdir = basename(dirname($0)); +my $pwd = getcwd(); +usage() unless $pwd eq abs_path(dirname(dirname($0))); -usage() unless @ARGV >= 1; -my $srcdir = shift(@ARGV); my $run_tests = 1; -if (@ARGV) +foreach my $arg (@ARGV) { - if ($ARGV[0] eq '--no-tests') + if ($arg eq '--no-tests') { $run_tests = 0; } @@ -27,12 +29,9 @@ if (@ARGV) usage(); } } -$srcdir =~ s,/$,,; + usage() unless $srcdir =~ m/^qpdf-(\d+\.\d+(?:\.(a|b|rc)?\d+)?)$/; my $version = $1; -usage() unless -d $srcdir; - -my $pwd = getcwd(); cd($srcdir); # Check versions @@ -139,12 +138,12 @@ sub cd sub usage { die " -Usage: $whoami qpdf-version [ --no-tests ] +Usage: $whoami [ --no-tests ] -qpdf-version must be a directory containing a pristine export of that -version of qpdf from the version control system. Use of --no-tests -can be used for internally testing releases, but do not use it for a -real release. +$whoami must be run from the parent of a directory called +qpdf- which must contain a pristine export of that version of +qpdf from the version control system. Use of --no-tests can be used +for internally testing releases, but do not use it for a real release. "; }