diff -Nru abi-monitor-1.9/abi-monitor.pl abi-monitor-1.10/abi-monitor.pl --- abi-monitor-1.9/abi-monitor.pl 2016-07-04 16:14:30.000000000 +0000 +++ abi-monitor-1.10/abi-monitor.pl 2016-10-12 15:32:01.000000000 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/perl ################################################################## -# ABI Monitor 1.9 +# ABI Monitor 1.10 # A tool to monitor new versions of a software library, build them # and create profile for ABI Tracker. # @@ -14,8 +14,9 @@ # # REQUIREMENTS # ============ -# Perl 5 (5.8 or newer) +# Perl 5 # cURL +# wget # CMake # Automake # GCC @@ -43,7 +44,7 @@ use Cwd qw(abs_path cwd); use Data::Dumper; -my $TOOL_VERSION = "1.9"; +my $TOOL_VERSION = "1.10"; my $DB_PATH = "Monitor.data"; my $REPO = "src"; my $INSTALLED = "installed"; @@ -536,40 +537,31 @@ } my @Links = getLinks($SourceUrl); - my @Pages = getPages($SourceUrl, \@Links); - - # One step into directory tree - foreach my $Page (@Pages) - { - foreach my $Link (getLinks($Page)) - { - push(@Links, $Link); - } - } + my $Depth = 2; if(defined $Profile->{"SourceUrlDepth"}) { # More steps into directory tree - my $Depth = $Profile->{"SourceUrlDepth"}; + $Depth = $Profile->{"SourceUrlDepth"}; + } + + if($Depth>=2) + { + my %Checked = (); + $Checked{$SourceUrl} = 1; - if($Depth>2) + foreach my $D (1 .. $Depth - 1) { - my %Checked = map {$_=>1} @Pages; - - foreach my $D (1 .. $Depth - 2) + my @Pages = getPages($SourceUrl, \@Links); + foreach my $Page (@Pages) { - my @MorePages = getPages($SourceUrl, \@Links); - foreach my $Page (@MorePages) + if(not defined $Checked{$Page}) { - if(not defined $Checked{$Page}) + $Checked{$Page} = 1; + foreach my $Link (getLinks($Page)) { - $Checked{$Page} = 1; - foreach my $Link (getLinks($Page)) - { - push(@Links, $Link); - } + push(@Links, $Link); } } - } } } @@ -616,14 +608,14 @@ return undef; } -sub isOldMicro($) +sub isOldMicro($$) { - my $V = $_[0]; - my $M = getMajor($V); + my ($V, $L) = @_; + my $M = getMajor($V, $L); foreach my $Ver (sort keys(%{$DB->{"Source"}})) { - if(getMajor($Ver) eq $M) + if(getMajor($Ver, $L) eq $M) { if(cmpVersions_P($Ver, $V, $Profile)>=0) { @@ -657,12 +649,20 @@ if(defined $Profile->{"LatestMicro"}) { - if(isOldMicro($V)) + if(isOldMicro($V, 2)) { # do not download old micro releases return -1; } } + if(defined $Profile->{"LatestNano"}) + { + if(isOldMicro($V, 3)) + { # do not download old nano releases + return -1; + } + } + my $Dir = $REPO."/".$TARGET_LIB."/".$V; if(not -e $Dir) { @@ -738,8 +738,8 @@ my $Cmd = ""; - if($USE_CURL) - { + if($USE_CURL and index($Page, "ftp:")!=0) + { # TODO: how to list absolute paths in FTP directory using curl? $Cmd = "curl -L \"$Page\""; $Cmd .= " --connect-timeout $CONNECT_TIMEOUT"; $Cmd .= " --retry $ACCESS_TRIES --output \"$To\""; @@ -802,55 +802,57 @@ next; } + my ($P, $V, $E) = (); + if($Link=~/(\A|\/)(\Q$Pkg\E[_\-]*([^\/"'<>+%]+?)\.($PKG_EXT))([\/\?]|\Z)/i) { - my ($P, $V, $E) = ($2, $3, $4); - - $V=~s/\Av(\d)/$1/i; # v1.1 - $V=~s/[\-\_](src|source|sources)\Z//i; # pkg-X.Y.Z-Source.tar.gz - - if(defined $Res{$V}) - { - if($Res{$V}{"Ext"} ne "zip" or $E eq "zip") - { - next; - } - } - - if($V=~/mingw|msvc/i) { - next; - } - - if($V=~/snapshot/i) { - next; - } - - if(getVersionType($V, $Profile) eq "unknown") { - next; - } - - if(my $Release = checkReleasePattern($V, $Profile)) + ($P, $V, $E) = ($2, $3, $4); + } + elsif($Link=~/(archive|get)\/v?([\d\.\-\_]+([ab]\d*|alpha\d*|beta\d*|rc\d*|))\.(tar\.gz)/i) + { # github + # bitbucket + ($V, $E) = ($2, $4); + $P = $Pkg."-".$V.".".$E; + } + + $V=~s/\Av(\d)/$1/i; # v1.1 + $V=~s/[\-\_](src|source|sources)\Z//i; # pkg-X.Y.Z-Source.tar.gz + + if(defined $Res{$V}) + { + if($Res{$V}{"Ext"} ne "zip" or $E eq "zip") { - $V = $Release; - } - - if(skipVersion($V, $Profile)) { next; } - + } + + if($V=~/mingw|msvc/i) { + next; + } + + if($V=~/snapshot/i) { + next; + } + + if(getVersionType($V, $Profile) eq "unknown") { + next; + } + + if(my $Release = checkReleasePattern($V, $Profile)) + { + $V = $Release; + } + + if(skipVersion($V, $Profile)) { + next; + } + + if($P) + { $Res{$V}{"Url"} = $Link; $Res{$V}{"Pkg"} = $P; $Res{$V}{"Ext"} = $E; } - elsif($Link=~/(archive|get)\/v?([\d\.\-\_]+([ab]\d*|alpha\d*|beta\d*|rc\d*|))\.(tar\.gz)/i) - { # github - # bitbucket - my $V = $2; - - $Res{$V}{"Url"} = $Link; - $Res{$V}{"Pkg"} = $Pkg."-".$V.".".$4; - $Res{$V}{"Ext"} = $4; - } } return \%Res; @@ -865,7 +867,7 @@ foreach my $Link (@{$Links}) { - if($Link!~/\/\Z/ and $Link!~/\A\/\d[\d\.\-]*\Z/) + if($Link!~/\/\Z/ and $Link!~/\/v?\d[\d\.\-]*\Z/i) { if($Link!~/github\.com\/.+\?after\=/) { @@ -888,9 +890,17 @@ next; } } - elsif($Link=~/\/($TARGET_LIB[\-_]*|)([\d\.\-\_v]+)\/\Z/i) + elsif($Link=~/\/($TARGET_LIB[\-_]*|)v?([\d\.\-\_]+)[\/]*\Z/i) { - if(defined $DB->{"Source"}{$2}) + my $V = $2; + if(defined $DB->{"Source"}{$V}) + { + if($Debug) { + printMsg("INFO", "Skip: $Link"); + } + next; + } + elsif(skipVersion($V, $Profile)) { if($Debug) { printMsg("INFO", "Skip: $Link"); @@ -922,7 +932,7 @@ my $Content = readFile($To); unlink($To); - my (%Links1, %Links2, %Links3, %Links4, %Links5, %Links6) = (); + my (%Links1, %Links2, %Links3, %Links4) = (); my @Lines = split(/\n/, $Content); @@ -940,20 +950,19 @@ while($Line=~s/["']([^"'<>\s]+\.($PKG_EXT))["']//i) { $Links4{linkSum($Url, $1)} = 1; } - if($Page=~/ftp/) - { - while($Line=~s/ftp\s+\w+\s+\w+\s+\w+\s+[^\s]+\s+([^\s]+\.($PKG_EXT))//i) { - $Links5{linkSum($Url, $1)} = 1; - } - while($Line=~s/\d+\s+\w+\s+\d+\s+\d+\s+([^\s]+\.($PKG_EXT))//i) - { # -rw-r--r-- 1 3003 65534 2016707 Nov 03 2001 pkg-1.0.tar.gz - $Links6{linkSum($Url, $1)} = 1; - } + } + + foreach my $U (keys(%Links4)) + { + my $F = getFilename($U); + + if(grep {getFilename($_) eq $F} keys(%Links1)) { + delete($Links4{$U}); } } my @Res = (); - my @AllLinks = (sort {$b cmp $a} keys(%Links1), sort {$b cmp $a} keys(%Links2), sort {$b cmp $a} keys(%Links3), sort {$b cmp $a} keys(%Links4), sort {$b cmp $a} keys(%Links5), sort {$b cmp $a} keys(%Links6)); + my @AllLinks = (sort {$b cmp $a} keys(%Links1), sort {$b cmp $a} keys(%Links2), sort {$b cmp $a} keys(%Links3), sort {$b cmp $a} keys(%Links4)); foreach (@AllLinks) { while($_=~s/\/[^\/]+\/\.\.\//\//g){}; @@ -1292,7 +1301,7 @@ next; } - my $M = getMajor($V); + my $M = getMajor($V, 2); if(defined $MaxMicro{$M}) { @@ -1307,6 +1316,30 @@ } } + if(defined $Profile->{"LatestNano"}) + { + my %MaxNano = (); + foreach my $V (reverse(@Versions)) + { + if($V eq "current") { + next; + } + + my $M = getMajor($V, 3); + + if(defined $MaxNano{$M}) + { + if(not defined $Profile->{"Versions"}{$V}{"Deleted"}) + { # One can set Deleted to 0 in order to prevent deleting + $Profile->{"Versions"}{$V}{"Deleted"} = 1; + } + } + else { + $MaxNano{$M} = $V; + } + } + } + foreach my $V (reverse(@Versions)) { my @Info = (); @@ -1357,6 +1390,12 @@ foreach my $K (sort keys(%{$O_Info})) { + # if($K eq "PublicSymbols" + # or $K eq "PublicTypes") + # { # obsolete + # next; + # } + if($K ne "Pos") { if(defined $O_Info->{$K}) { @@ -1412,7 +1451,7 @@ my $Dir = $_[0]; foreach my $Name ("NEWS", "CHANGES", "CHANGES.txt", "RELEASE_NOTES", "ChangeLog", "Changelog", - "RELEASE_NOTES.md", "RELEASE_NOTES.markdown") + "RELEASE_NOTES.md", "RELEASE_NOTES.markdown", "NEWS.md") { if(-f $Dir."/".$Name and -s $Dir."/".$Name) @@ -1455,7 +1494,7 @@ my @Files = listDir("."); - my ($CMake, $Autotools, $Scons) = (0, 0, 0); + my ($CMake, $Autotools, $Scons, $Waf) = (0, 0, 0, 0); my ($Configure, $Autogen, $Bootstrap, $Buildconf) = (0, 0, 0, 0); @@ -1484,6 +1523,9 @@ elsif($File eq "SConstruct") { $Scons = 1; } + elsif($File eq "waf") { + $Waf = 1; + } } if(defined $Profile->{"BuildSystem"}) @@ -1504,7 +1546,7 @@ { # try to generate configure script if($Autogen) { - my $Cmd_A = "sh autogen.sh"; + my $Cmd_A = "NOCONFIGURE=1 NO_CONFIGURE=1 sh autogen.sh --no-configure"; $Cmd_A .= " >\"$LogDir/autogen\" 2>&1"; qx/$Cmd_A/; @@ -1633,6 +1675,24 @@ return 0; } } + elsif($Waf) + { + my $Cmd_C = "./waf configure --prefix=\"$To\" --debug"; + + if($ConfigOptions) { + $Cmd_C .= " ".$ConfigOptions; + } + + $Cmd_C .= " >\"$LogDir/configure\" 2>&1"; + + qx/$Cmd_C/; # execute + if($?) + { + printMsg("ERROR", "failed to './waf configure'"); + printMsg("ERROR", "see error log in '$LogDir_R/configure'"); + return 0; + } + } else { printMsg("ERROR", "unknown build system, please set \"BuildScript\" in the profile"); @@ -1666,6 +1726,29 @@ return 0; } } + elsif($Waf) + { + my $Cmd_M = "./waf build"; + + $Cmd_M .= " >$LogDir/build 2>&1"; + + qx/$Cmd_M/; # execute + if($?) + { + printMsg("ERROR", "failed to './waf build'"); + printMsg("ERROR", "see error log in '$LogDir_R/build'"); + return 0; + } + + my $Cmd_I = "./waf install >$LogDir/install 2>&1"; + qx/$Cmd_I/; # execute + if($?) + { + printMsg("ERROR", "failed to './waf install'"); + printMsg("ERROR", "see error log in '$LogDir_R/install'"); + return 0; + } + } my $PostInstall = $Profile->{"PostInstall"}; if($V eq "current") @@ -1675,6 +1758,10 @@ } } + if($CMake) { + chdir(".."); + } + if($PostInstall) { $PostInstall = addParams($PostInstall, $To, $V); @@ -1702,20 +1789,6 @@ { my $To = $_[0]; - if(my $Dirs = $Profile->{"CopyHeaders"}) - { - foreach my $D (@{$Dirs}) - { - foreach my $H (findHeaders($D)) - { - my $H_To = $To."/include/".$H; - my $D_To = getDirname($H_To); - mkpath($D_To); - copy($H, $D_To); - } - } - } - foreach my $Tag ("CopyHeaders", "CopyObjects") { if(not defined $Profile->{$Tag}) { @@ -1861,6 +1934,7 @@ mkpath($InstallDir); my $InstallDir_A = abs_path($InstallDir); + my $InstallRoot_A = abs_path($INSTALLED); my $BuildDir = $TMP_DIR."/build/"; mkpath($BuildDir); @@ -1909,9 +1983,13 @@ } } + if(my $CustomDir = $Profile->{"BuildDir"}) { + chdir($CustomDir); + } + if(defined $BuildScript) { - my $Cmd_I = "INSTALL_TO=\"$InstallDir_A\" sh \"".$BuildScript."\""; + my $Cmd_I = "INSTALL_TO=\"$InstallDir_A\" INSTALL_ROOT=\"$InstallRoot_A\" sh \"".$BuildScript."\""; $Cmd_I .= " >\"$LogDir/build\" 2>&1"; qx/$Cmd_I/; # execute @@ -1952,18 +2030,52 @@ { buildShared($V); } + if(not defined $Profile->{"ClearInstalled"} or $Profile->{"ClearInstalled"} ne "Off") { foreach my $D ("share", "bin", "sbin", "etc", "var", "opt", "libexec", "doc", "manual", "man", "logs", "icons", - "conf", "cgi-bin", "docs") + "conf", "cgi-bin", "docs", "lib/systemd", + "lib/udev", "lib/cmake", "systemd", "udev", + "lib/girepository-1.0", "lib/python2.7", + "tmp", "info", "lib/sysctl.d", "lib64/cmake") { if(-d $InstallDir."/".$D) { rmtree($InstallDir."/".$D); } } + + my @Fs = listPaths($InstallDir."/lib"); + my @Fs64 = listPaths($InstallDir."/lib64"); + my $Shared = undef; + + foreach my $F (@Fs, @Fs64) + { + if($F=~/\.so(\.|\Z)/) + { + $Shared = 1; + last; + } + } + + foreach my $F (@Fs, @Fs64) + { + if(-f $F) + { + if($F=~/\.(la|jar|o)\Z/) { + unlink($F) + } + + if(defined $Shared) + { + if($F=~/\.a\Z/) { + unlink($F) + } + } + } + } } } else @@ -1993,24 +2105,9 @@ foreach my $Object (@Objects) { - my $CDir = $TMP_DIR."/convert"; - mkpath($CDir); - my $Object_A = abs_path($Object); my $To = getDirname($Object); - chdir($CDir); - - my $Cmd_E = "ar -x \"$Object_A\""; - qx/$Cmd_E/; - - if($?) - { - print STDERR "ERROR: failed to extract static object(s)\n"; - chdir($ORIG_DIR); - return 0; - } - my $Object_S = getFilename($Object); $Object_S=~s/\.a\Z/.so/g; @@ -2020,7 +2117,8 @@ return 1; } - my $Cmd_B = $GCC." -shared -o \"$Object_S\" *.o"; + chdir($To); + my $Cmd_B = $GCC." -nostdlib -shared -o \"$Object_S\" -Wl,--whole-archive \"$Object_A\""; qx/$Cmd_B/; if($?) @@ -2031,9 +2129,7 @@ } chdir($ORIG_DIR); - move($CDir."/".$Object_S, $To); print "Created \'$To/$Object_S\'\n"; - rmtree($CDir); } } diff -Nru abi-monitor-1.9/debian/changelog abi-monitor-1.10/debian/changelog --- abi-monitor-1.9/debian/changelog 2016-07-07 21:34:50.000000000 +0000 +++ abi-monitor-1.10/debian/changelog 2016-11-29 21:42:32.000000000 +0000 @@ -1,3 +1,10 @@ +abi-monitor (1.10-1) unstable; urgency=medium + + * New upstream release + * d/compat: bump to 10 + + -- Peter Spiess-Knafl Tue, 29 Nov 2016 22:42:32 +0100 + abi-monitor (1.9-1) unstable; urgency=medium * New upstream release diff -Nru abi-monitor-1.9/debian/compat abi-monitor-1.10/debian/compat --- abi-monitor-1.9/debian/compat 2016-03-21 15:33:31.000000000 +0000 +++ abi-monitor-1.10/debian/compat 2016-11-29 21:42:32.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru abi-monitor-1.9/debian/control abi-monitor-1.10/debian/control --- abi-monitor-1.9/debian/control 2016-05-26 22:57:00.000000000 +0000 +++ abi-monitor-1.10/debian/control 2016-11-29 21:42:32.000000000 +0000 @@ -2,7 +2,7 @@ Section: devel Priority: optional Maintainer: Peter Spiess-Knafl -Build-Depends: debhelper (>= 9), help2man +Build-Depends: debhelper (>= 10), help2man Standards-Version: 3.9.8 Homepage: https://github.com/lvc/abi-monitor Vcs-Git: https://anonscm.debian.org/git/collab-maint/abi-monitor.git @@ -12,7 +12,8 @@ Architecture: all Depends: build-essential, cmake, - curl | wget, + wget, + curl, git, ${misc:Depends}, ${perl:Depends} diff -Nru abi-monitor-1.9/modules/Internals/Basic.pm abi-monitor-1.10/modules/Internals/Basic.pm --- abi-monitor-1.9/modules/Internals/Basic.pm 2016-07-04 16:14:30.000000000 +0000 +++ abi-monitor-1.10/modules/Internals/Basic.pm 2016-10-12 15:32:01.000000000 +0000 @@ -64,6 +64,20 @@ return @Files; } +sub listPaths($) +{ + my $Path = $_[0]; + return () if(not $Path); + + my @Paths = (); + + foreach my $F (listDir($Path)) { + push(@Paths, $Path."/".$F); + } + + return @Paths; +} + sub getFilename($) { # much faster than basename() from File::Basename module if($_[0] and $_[0]=~/([^\/\\]+)[\/\\]*\Z/) { diff -Nru abi-monitor-1.9/modules/Internals/CmpVersions.pm abi-monitor-1.10/modules/Internals/CmpVersions.pm --- abi-monitor-1.9/modules/Internals/CmpVersions.pm 2016-07-04 16:14:30.000000000 +0000 +++ abi-monitor-1.10/modules/Internals/CmpVersions.pm 2016-10-12 15:32:01.000000000 +0000 @@ -506,19 +506,18 @@ return "unknown"; } -sub getMajor($) +sub getMajor($$) { - my $V = $_[0]; + my ($V, $L) = @_; - $V=~s/\-/./; + $V=~s/[\-_]/./g; my @P = split(/\./, $V); - if($#P>1) { - pop(@P); + if($#P>=$L) { + return join(".", splice(@P, 0, $L)); } - - return join(".", @P); + return $V; } return 1; diff -Nru abi-monitor-1.9/README abi-monitor-1.10/README --- abi-monitor-1.9/README 2016-07-04 16:14:30.000000000 +0000 +++ abi-monitor-1.10/README 2016-10-12 15:32:01.000000000 +0000 @@ -11,6 +11,7 @@ REQUIRES: Perl 5 (5.8 or newer) cURL + wget CMake Automake GCC