mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Compare versions between CLI and library
This commit is contained in:
parent
2b011f9d81
commit
12b159118a
@ -1,5 +1,12 @@
|
|||||||
2019-04-20 Jay Berkenbilt <ejb@ql.org>
|
2019-04-20 Jay Berkenbilt <ejb@ql.org>
|
||||||
|
|
||||||
|
* When qpdf --version is run, it will detect if the qpdf CLI was
|
||||||
|
built with a different version of qpdf than the library. This
|
||||||
|
usually indicates that multiple versions of qpdf are installed and
|
||||||
|
that the library path is not set up properly. This situation
|
||||||
|
sometimes causes confusing behavior for users who are not actually
|
||||||
|
running the version of qpdf they think they are running.
|
||||||
|
|
||||||
* Add parameter --remove-page-labels to remove page labels from
|
* Add parameter --remove-page-labels to remove page labels from
|
||||||
output. In qpdf 8.3.0, the behavior changed so that page labels
|
output. In qpdf 8.3.0, the behavior changed so that page labels
|
||||||
were preserved when merging and splitting files. Some users were
|
were preserved when merging and splitting files. Some users were
|
||||||
|
@ -103,6 +103,7 @@ RELEASE PREPARATION
|
|||||||
* configure.ac
|
* configure.ac
|
||||||
* libqpdf/QPDF.cc
|
* libqpdf/QPDF.cc
|
||||||
* manual/qpdf-manual.xml
|
* manual/qpdf-manual.xml
|
||||||
|
* qpdf/qpdf.cc
|
||||||
`make_dist` verifies this consistency.
|
`make_dist` verifies this consistency.
|
||||||
|
|
||||||
* Add a release entry to ChangeLog.
|
* Add a release entry to ChangeLog.
|
||||||
|
22
make_dist
22
make_dist
@ -63,6 +63,7 @@ cd($tmpdir);
|
|||||||
my $config_version = get_version_from_configure();
|
my $config_version = get_version_from_configure();
|
||||||
my $code_version = get_version_from_source();
|
my $code_version = get_version_from_source();
|
||||||
my $doc_version = get_version_from_manual();
|
my $doc_version = get_version_from_manual();
|
||||||
|
my $cli_version = get_version_from_cli();
|
||||||
|
|
||||||
my $version_error = 0;
|
my $version_error = 0;
|
||||||
if ($version ne $config_version)
|
if ($version ne $config_version)
|
||||||
@ -80,6 +81,11 @@ if ($version ne $doc_version)
|
|||||||
print "$whoami: qpdf-manual.xml version = $doc_version\n";
|
print "$whoami: qpdf-manual.xml version = $doc_version\n";
|
||||||
$version_error = 1;
|
$version_error = 1;
|
||||||
}
|
}
|
||||||
|
if ($version ne $cli_version)
|
||||||
|
{
|
||||||
|
print "$whoami: qpdf.cc version = $cli_version\n";
|
||||||
|
$version_error = 1;
|
||||||
|
}
|
||||||
if ($version_error)
|
if ($version_error)
|
||||||
{
|
{
|
||||||
die "$whoami: version numbers are not consistent\n";
|
die "$whoami: version numbers are not consistent\n";
|
||||||
@ -161,6 +167,22 @@ sub get_version_from_manual
|
|||||||
$doc_version;
|
$doc_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub get_version_from_cli
|
||||||
|
{
|
||||||
|
my $fh = safe_open("qpdf/qpdf.cc");
|
||||||
|
my $cli_version = 'unknown';
|
||||||
|
while (<$fh>)
|
||||||
|
{
|
||||||
|
if (m/expected_version = \"([^\"]+)\"/)
|
||||||
|
{
|
||||||
|
$cli_version = $1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$fh->close();
|
||||||
|
$cli_version;
|
||||||
|
}
|
||||||
|
|
||||||
sub safe_open
|
sub safe_open
|
||||||
{
|
{
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
|
13
qpdf/qpdf.cc
13
qpdf/qpdf.cc
@ -30,6 +30,8 @@ static int const EXIT_WARNING = 3;
|
|||||||
|
|
||||||
static char const* whoami = 0;
|
static char const* whoami = 0;
|
||||||
|
|
||||||
|
static std::string expected_version = "8.4.0";
|
||||||
|
|
||||||
struct PageSpec
|
struct PageSpec
|
||||||
{
|
{
|
||||||
PageSpec(std::string const& filename,
|
PageSpec(std::string const& filename,
|
||||||
@ -993,6 +995,17 @@ ArgParser::argPositional(char* arg)
|
|||||||
void
|
void
|
||||||
ArgParser::argVersion()
|
ArgParser::argVersion()
|
||||||
{
|
{
|
||||||
|
if (expected_version != QPDF::QPDFVersion())
|
||||||
|
{
|
||||||
|
std::cerr << "***\n"
|
||||||
|
<< "WARNING: qpdf CLI from version " << expected_version
|
||||||
|
<< " is using library version " << QPDF::QPDFVersion()
|
||||||
|
<< ".\n"
|
||||||
|
<< "This probably means you have multiple versions of qpdf installed\n"
|
||||||
|
<< "and don't have your library path configured correctly.\n"
|
||||||
|
<< "***"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
std::cout
|
std::cout
|
||||||
<< whoami << " version " << QPDF::QPDFVersion() << std::endl
|
<< whoami << " version " << QPDF::QPDFVersion() << std::endl
|
||||||
<< "Run " << whoami << " --copyright to see copyright and license information."
|
<< "Run " << whoami << " --copyright to see copyright and license information."
|
||||||
|
@ -667,7 +667,7 @@ $n_tests += 3;
|
|||||||
|
|
||||||
$td->runtest("qpdf version",
|
$td->runtest("qpdf version",
|
||||||
{$td->COMMAND => "qpdf --version"},
|
{$td->COMMAND => "qpdf --version"},
|
||||||
{$td->REGEXP => "qpdf version \\S+\n.*", $td->EXIT_STATUS => 0},
|
{$td->REGEXP => ".*qpdf version \\S+\n.*", $td->EXIT_STATUS => 0},
|
||||||
$td->NORMALIZE_NEWLINES);
|
$td->NORMALIZE_NEWLINES);
|
||||||
$td->runtest("qpdf copyright contains version too",
|
$td->runtest("qpdf copyright contains version too",
|
||||||
{$td->COMMAND => "qpdf --copyright"},
|
{$td->COMMAND => "qpdf --copyright"},
|
||||||
|
Loading…
Reference in New Issue
Block a user