mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 06:08:38 -04:00
moved the guts of api_history utility to SQLiteUtil
This commit is contained in:
parent
e657de6c50
commit
eb69d88479
2 changed files with 30 additions and 26 deletions
|
@ -8,6 +8,7 @@ use File::Copy;
|
|||
|
||||
our @EXPORT = qw/
|
||||
extract_constants versions srcdir mirror copy_files
|
||||
check_api_history
|
||||
/;
|
||||
|
||||
our $ROOT = "$FindBin::Bin/..";
|
||||
|
@ -157,7 +158,6 @@ my %compat = map {$_ => 1} qw/
|
|||
flags_for_file_open_operations
|
||||
/;
|
||||
|
||||
|
||||
sub extract_constants {
|
||||
my $file = shift;
|
||||
$file ||= "$FindBin::Bin/../sqlite3.h";
|
||||
|
@ -274,6 +274,34 @@ sub copy_files {
|
|||
copy("$dir/fts3_tokenizer.h", $ROOT);
|
||||
}
|
||||
|
||||
sub check_api_history {
|
||||
require Array::Diff;
|
||||
my %current;
|
||||
for my $version (versions()) {
|
||||
print "checking $version...\n";
|
||||
my $dir = srcdir($version);
|
||||
unless ($dir && -d $dir) {
|
||||
$dir = mirror($version) or next;
|
||||
}
|
||||
my %constants = extract_constants("$dir/sqlite3.h");
|
||||
if (%current) {
|
||||
for (sort keys %current) {
|
||||
print "$version: deleted $_\n" if !exists $constants{$_};
|
||||
}
|
||||
for (sort keys %constants) {
|
||||
if (!exists $current{$_}) {
|
||||
print "$version: added $_\n";
|
||||
next;
|
||||
}
|
||||
my $diff = Array::Diff->diff($current{$_}, $constants{$_});
|
||||
print "$version: added $_\n" for @{$diff->added || []};
|
||||
print "$version: deleted $_\n" for @{$diff->deleted || []};
|
||||
}
|
||||
}
|
||||
%current = %constants;
|
||||
}
|
||||
}
|
||||
|
||||
package SQLiteUtil::Version;
|
||||
|
||||
use overload '""' => sub {
|
||||
|
|
|
@ -5,29 +5,5 @@ use warnings;
|
|||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use SQLiteUtil;
|
||||
use Array::Diff;
|
||||
|
||||
my %current;
|
||||
for my $version (versions()) {
|
||||
print "checking $version...\n";
|
||||
my $dir = srcdir($version);
|
||||
unless ($dir && -d $dir) {
|
||||
$dir = mirror($version) or next;
|
||||
}
|
||||
my %constants = extract_constants("$dir/sqlite3.h");
|
||||
if (%current) {
|
||||
for (sort keys %current) {
|
||||
print "$version: deleted $_\n" if !exists $constants{$_};
|
||||
}
|
||||
for (sort keys %constants) {
|
||||
if (!exists $current{$_}) {
|
||||
print "$version: added $_\n";
|
||||
next;
|
||||
}
|
||||
my $diff = Array::Diff->diff($current{$_}, $constants{$_});
|
||||
print "$version: added $_\n" for @{$diff->added || []};
|
||||
print "$version: deleted $_\n" for @{$diff->deleted || []};
|
||||
}
|
||||
}
|
||||
%current = %constants;
|
||||
}
|
||||
check_api_history();
|
||||
|
|
Loading…
Add table
Reference in a new issue