use warnings;
use IPC::Open2;
use Cwd;
+use constant DOCKER => -e '/.dockerenv';
my $pwd = getcwd();
# how to run poldek
my @ignore = qw(vserver-packages python-devel-src);
-my @poldek = (qw(sudo poldek -n th-x86_64-ready), "--cachedir=$pwd/poldekcache",
- "--skip-installed", "--conf=$pwd/poldekconf/poldek.conf",
+my @poldek;
+if (DOCKER) {
+ push(@poldek, qw[poldek]);
+} else {
+ push(@poldek, qw[sudo poldek -n th-x86_64-ready],
+ "--cachedir=$pwd/poldekcache",
+ "--conf=$pwd/poldekconf/poldek.conf",
+ );
+}
+push(@poldek, (
+ "--skip-installed",
"-O", "ignore=" . (join " ", @ignore)
-);
+));
# if multiple packages provide some funcionality those will be selected:
my %preferred = (
# for m4 in *.m4; do R=$(rpm -qf $m4); R=${R%-*-*}; \
# awk -vr=$R '/^\s*(AC_DEFUN|AU_ALIAS)/ { gsub(/\].*/,""); gsub(/.*\[/,""); print r " " $0}' $m4; \
# done | sort | awk '{print "\t\"" $2 "\" => \"" $1 "\","}'
-my %ac2br = do "findbr-ac2br";
+my %ac2br = do (DOCKER ? './cleanbuild/findbr-ac2br' : './findbr-ac2br');
my %cmake2br = (
"findkde4:44" => "kde4-kdelibs",
sub poldek_cmd
{
my $cmd = shift;
+
warn "Poldek: $cmd\n";
- my $pid = open( READ, "-|", @poldek, "--shcmd=".$cmd );
- my @read = <READ>;
- close READ;
+ my @cmd = (@poldek, "--shcmd=".$cmd);
+ open my $fh, '-|', @cmd or die "$!: @cmd";
+ my @read = <$fh>;
+ close $fh or die $!;
- return @read if wantarray;
- return \@read;
+ return wantarray ? @read : \@read;
}
my $check_ac = 0;
my $check_config_log = undef;
+my $check_mkmf_log = undef;
my %checked_files;
sub poldek_file
my %checked;
my $cmake_get_call = 0;
my $cmake_pkg_list = 0;
+my $py_ver = undef;
while ( $_ = shift @lines ) {
chomp;
#next if $checked{ $_ };
#$checked{ $_ } = 1;
+ # try to extract current python version from setup.py run
+ if (m{^copying .+ -> build-(\d+)/lib/}) {
+ $py_ver = $1;
+ warn "py_ver set to '$py_ver'\n";
+ }
+
$reason = $_;
if ( /^\S+: (\S+): (?:Command )?not found$/ or /.*configure\[\d+\]: (\S+): not found$/
or m{which: no (\S+) in \(.*/bin.*\)}
or m{^ERROR: Cannot find .+: No module named (\S+)$}
or m{^ERROR: Failed to import the ".+" module: No module named (\S+)$}
or m{^distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse\('([^'>=]+).*'\)}
+ or m{^error: Could not find suitable distribution for Requirement.parse\('([^'>=]+).*'\)}
or m{^Couldn't find index page for '(\S+)'}
) {
my $mod = $1;
$mod =~ s#\.#/#g;
- warn "Looking for python module $mod\n";
+ warn "Looking for Python$py_ver module $mod\n";
poldek_file(
- "/usr/share/python2*/$mod/__init__.py*",
- "/usr/share/python2*/$mod.py*",
- "/usr/lib*/python2*/$mod/__init__.py*",
- "/usr/lib*/python2*/$mod.py*",
- "/usr/lib*/python2*/_$mod.so",
- "/usr/lib*/python2*/$mod.so" );
+ "/usr/share/python$py_ver*/site-packages/$mod/__init__.py*",
+ "/usr/share/python$py_ver*/$mod/__init__.py*",
+ "/usr/share/python$py_ver*/site-packages/$mod.py*",
+ "/usr/share/python$py_ver*/$mod.py*",
+ "/usr/lib*/python$py_ver*/site-packages/$mod/__init__.py*",
+ "/usr/lib*/python$py_ver*/$mod/__init__.py*",
+ "/usr/lib*/python$py_ver*/site-packages/$mod.py*",
+ "/usr/lib*/python$py_ver*/$mod.py*",
+ "/usr/lib*/python$py_ver*/site-packages/_$mod.so",
+ "/usr/lib*/python$py_ver*/_$mod.so",
+ "/usr/lib*/python$py_ver*/site-packages/$mod.so",
+ "/usr/lib*/python$py_ver*/$mod.so",
+ );
}
if (
next;
}
+ if (
+ m{^You need to install the (\S+) module} or
+ m{\*\*\*Error\*\*\*: You must have (\S+) >= (\S+) installed}
+ ) {
+ add_br($1);
+ next;
+ }
+
if (
m{^cannot load such file -- (\S+)} or
m{in `require': cannot load such file -- (\S+) \(LoadError\)}
or m{^pkg-config unavailable, build terminated}
or m{^\*\*\*Error\*\*\*: You must have pkg-config >= .* installed}
or m{^-- Could NOT find PkgConfig \(missing: PKG_CONFIG_EXECUTABLE\)}
+ or m{exec: "pkg-config": executable file not found in \$PATH}
) {
add_br( "pkgconfig" );
next;
warn "Looking for docbook file $db\n";
poldek_file( "/usr/share/sgml/*/$db" );
}
+ if (m{Could not find HTML docbook.xsl}) {
+ add_br("docbook-style-xsl");
+ }
if ( m{LaTeX Error: File `(\S+)' not found} ) {
my $tex = $1;
if ( m{configure: error: C\+\+ compiler cannot create executables} ) {
add_br( "libstdc++-devel", "maybe try: %undefine\t__cxx" );
}
+ if ( m{ccache: error: Could not find compiler ".+-g\+\+" in PATH}) {
+ add_br("libstdc++-devel");
+ }
if ( m{configure: error: XML::Parser perl module is required for intltool} ) {
add_br( "perl-XML-Parser" );
}
$check_config_log = 1 unless defined $check_config_log;
}
+ if ( m{Check the mkmf.log file for more details} ) {
+ $check_mkmf_log = 1 unless defined $check_mkmf_log;
+ }
+
if ( m{^CMake (?:Error|Warning) at (?:\S+/)?(\S+?)\.cmake:(\d+) } ) {
my ( $module, $line ) = ( lc $1, $2 );
my $br;
} else {
warn "unrecognized Qt requirement: $l\n";
}
+ } elsif ( $module eq "qt5coreconfig" ) {
+ my $l = $lines[2];
+ chomp $l;
+ if ( $l =~ /qmake/ ) {
+ add_br( "qt5-qmake", $l );
+ } elsif ( $l =~ /moc/) {
+ add_br( "qt5-build", $l );
+ } else {
+ warn "Unrecognized Qt requirement: $l\n";
+ }
} elsif ( $module eq "cmakedeterminecxxcompiler" ) {
add_br( "libstdc++-devel",
'"try: -DCMAKE_CXX_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER="%{__cc}"' );
warn "Unrecognized cmake error: $reason\n";
}
}
+
+ if ( m{^CMake Error at (?:\S+/)?(\S+?):(\d+) \(find_package\):} ) {
+ my ($file, $line) = (lc $1, $2);
+
+ #CMake Error at CMakeLists.txt:29 (find_package):
+ # Could not find a package configuration file provided by "LLVM" with any of the following names:
+ #
+ # LLVMConfig.cmake
+ # llvm-config.cmake
+ my @files = grep { /\.cmake$/ } @lines;
+ my @find = map { chomp; s/^\s+//; "/usr/*/cmake/*/$_" } @files;
+ poldek_file(@find);
+ }
+
if ( m{^\s*ERROR: (?:\S+/)?(\S+?\.cmake) not found} ) {
my $cmake = $1;
warn "Looking for cmake file: $cmake\n";
}
}
- # CMake Error at CMakeLists.txt:86 (find_package):
- # By not providing "FindQt5LinguistTools.cmake" in CMAKE_MODULE_PATH this
- # project has asked CMake to find a package configuration file provided by
- # "Qt5LinguistTools", but CMake did not find one.
- #
- # Could not find a package configuration file provided by "Qt5LinguistTools"
- # with any of the following names:
- #
- # Qt5LinguistToolsConfig.cmake
- # qt5linguisttools-config.cmake
- #
- # Add the installation prefix of "Qt5LinguistTools" to CMAKE_PREFIX_PATH or
- # set "Qt5LinguistTools_DIR" to a directory containing one of the above
- # files. If "Qt5LinguistTools" provides a separate development package or
- # SDK, be sure it has been installed.
- # ---
- #CMake Warning at /usr/lib64/cmake/Qt5Core/Qt5CoreMacros.cmake:273 (find_package):
- # Could not find a package configuration file provided by "Qt5Network" with
- # any of the following names:
- #
- # Qt5NetworkConfig.cmake
- # qt5network-config.cmake
- #
- # Add the installation prefix of "Qt5Network" to CMAKE_PREFIX_PATH or set
- # "Qt5Network_DIR" to a directory containing one of the above files. If
- # "Qt5Network" provides a separate development package or SDK, be sure it has
- # been installed.
- # Can not use "Network" module which has not yet been found.
-
if (m{By not providing "Find(.+)\.cmake" in CMAKE_MODULE_PATH}
or m{Could not find a package configuration file provided by "(.+)"
}) {
poldek_file( "/usr/bin/$exec", "/bin/$exec" );
}
}
+
+
+ if (
+ m{Could not find (\S+)}
+ ) {
+ my $exec = $1;
+ poldek_file("/usr/bin/$exec", "/bin/$exec" );
+ }
}
-sub wanted
+sub find_configure
{
return unless /^configure(\.(?:ac|in|in\.in))?$/;
return unless -r;
use File::Find;
if ( $check_ac ) {
- find( \&wanted, $builddir );
+ find( \&find_configure, $builddir );
}
-sub wanted2
+sub find_config_log
{
return unless /^config\.log$/;
return unless -r;
if ( $check_config_log ) {
$check_config_log = 0;
- find( \&wanted2, $builddir );
+ find( \&find_config_log, $builddir );
+ goto start_check if @lines;
+}
+
+if ($check_mkmf_log) {
+ $check_mkmf_log = 0;
+ find(sub {
+ return unless /^mkmf\.log$/;
+ return unless -r;
+
+ warn "$File::Find::name\n";
+ open F_IN, "<", $_;
+ push @lines, <F_IN>;
+ close F_IN;
+ }, $builddir);
goto start_check if @lines;
}