blob: fb1436e6316fe4d2c61e565cfc2d6374ab12e88e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
#!/usr/bin/env perl
#
# This program creates a source distribution of qpdf. For details,
# see README.maintainer.
#
require 5.008;
use warnings;
use strict;
use File::Basename;
use Cwd;
use IO::File;
my $whoami = basename($0);
usage() unless @ARGV >= 1;
my $srcdir = shift(@ARGV);
my $run_tests = 1;
if (@ARGV)
{
if ($ARGV[0] eq '--no-tests')
{
$run_tests = 0;
}
else
{
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
my $fh = safe_open("configure.ac");
my $config_version = 'unknown';
while (<$fh>)
{
if (m/^AC_INIT\(\[qpdf\],\[([^\)]+)\]\)/)
{
$config_version = $1;
last;
}
}
$fh->close();
$fh = safe_open("libqpdf/QPDF.cc");
my $code_version = 'unknown';
while (<$fh>)
{
if (m/QPDF::qpdf_version = \"([^\"]+)\"/)
{
$code_version = $1;
last;
}
}
$fh->close();
$fh = safe_open("manual/qpdf-manual.xml");
my $doc_version = 'unknown';
while (<$fh>)
{
if (m/swversion "([^\"]+)\"/)
{
$doc_version = $1;
last;
}
}
$fh->close();
$fh = safe_open("qpdf.spec");
my $spec_version = 'unknown';
while (<$fh>)
{
if (m/Version: (.*)$/)
{
$spec_version = $1;
last;
}
}
my $version_error = 0;
if ($version ne $config_version)
{
print "$whoami: configure.ac version = $config_version\n";
$version_error = 1;
}
if ($version ne $code_version)
{
print "$whoami: QPDF.cc version = $code_version\n";
$version_error = 1;
}
if ($version ne $doc_version)
{
print "$whoami: qpdf-manual.xml version = $doc_version\n";
$version_error = 1;
}
if ($version ne $spec_version)
{
print "$whoami: qpdf.spec version = $spec_version\n";
$version_error = 1;
}
if ($version_error)
{
die "$whoami: version numbers are not consistent\n";
}
run("./autogen.sh");
run("./configure --enable-doc-maintenance --enable-werror");
run("make build_manual");
run("make distclean");
cd($pwd);
run("tar czvf $srcdir.tar.gz-candidate $srcdir");
if ($run_tests)
{
cd($srcdir);
run("./configure");
run("make check");
cd($pwd);
}
rename "$srcdir.tar.gz-candidate", "$srcdir.tar.gz" or die;
print "
Source distribution created as $srcdir.tar.gz
You can now remove $srcdir.
If this is a release, don't forget to tag the version control system and
make a backup of the release tar file.
";
sub safe_open
{
my $file = shift;
my $fh = new IO::File("<$file") or die "$whoami: can't open $file: $!";
$fh;
}
sub run
{
my $cmd = shift;
system($cmd) == 0 or die "$whoami: $cmd failed\n";
}
sub cd
{
my $dir = shift;
chdir($dir) or die;
}
sub usage
{
die "
Usage: $whoami qpdf-version [ --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.
";
}
|