Accepting request 650047 from home:eeich:branches:science:machinelearning

- Expand modules handling (bsc#1116458):
  * add %%hpc_modules_init to store the list of modules
  * if a modules list is available, use environment during
    dependency generation to exclude objects which will be
    found thru environment modules.
  * bump package version.

OBS-URL: https://build.opensuse.org/request/show/650047
OBS-URL: https://build.opensuse.org/package/show/science:HPC/suse-hpc?expand=0&rev=35
This commit is contained in:
Egbert Eich 2018-11-18 21:36:28 +00:00 committed by Git OBS Bridge
parent 4bda905855
commit 947aaec95d
7 changed files with 127 additions and 4 deletions

View File

@ -5,8 +5,8 @@
<param name="package-meta">no</param>
<param name="exclude">.git</param>
<param name="filename">suse-hpc</param>
<param name="versionformat">0.1.%h</param>
<param name="revision">d6d9c0fddeefd4f22d4aa44d6a9f7bc7f625bcba</param>
<param name="versionformat">0.4.%h</param>
<param name="revision">87f3f2c336d9dc5f9e8874e7639459371cfae3b0</param>
<param name="extract">general/dlinfo.c</param>
<param name="extract">general/macros.hpc</param>
<param name="extract">general/hpc_elf.pl</param>

5
hpc_elf.attr Normal file
View File

@ -0,0 +1,5 @@
%__hpc_elf_provides %{_rpmconfigdir}/hpc_elf.pl --provides %{?__filter_GLIBC_PRIVATE:--filter-private} %{?hpc_dep_gen_attr}
%__hpc_elf_requires %{_rpmconfigdir}/hpc_elf.pl %{?_hpc_modules:--modules "%_hpc_modules"} --requires %{?__filter_GLIBC_PRIVATE:--filter-private} %{?hpc_dep_gen_attr}
%__hpc_elf_magic ^(setuid )?(setgid )?(sticky )?ELF (32|64)-bit.*executable
%__hpc_elf_path %hpc_prefix
%__hpc_elf_flags exeonly

93
hpc_elf.pl Normal file
View File

@ -0,0 +1,93 @@
#! /usr/bin/perl
use Cwd 'abs_path';
use File::Basename;
$dir=dirname(abs_path($0));
$command=$dir . "/elfdeps";
$dlinfo=$dir . "/dlinfo";
$arglist = "";
sub usage {
my $message = <<EOF;
Usage: $0 [-?] [-P|--provides] [-R|--requires] [--filter-private]
[--soname-only] [--no-fake-soname] [--assume-exec] [-?|--help]
[--usage]
EOF
print $message;
exit (0);
}
sub help {
my $message = <<EOF;
Usage: $0 [OPTION...]
-P, --provides
-R, --requires
--filter-private
--soname-only
--no-fake-soname
--assume-exec
Help options:
-?, --help Show this help message
--usage Display brief usage message
EOF
print $message;
exit (0);
}
while ( $a = shift @ARGV ) {
if ( $a =~ /--assume-exec/ ||
$a =~ /--provides/ ||
$a =~ /-P/ ||
$a =~ /--requires/ ||
$a =~ /-R/ ||
$a =~ /--filter-private/ ||
$a =~ /--soname-only/ ||
$a =~ /--no-fake-soname/ ||
$a =~ /--filter-private/ ) {
$arglist .= " " . $a;
} elsif ( $a =~ /--modules/ ) {
$modules = shift @ARGV;
} elsif ( $a =~ /--help/ || $a =~ /-?/ ) {
help;
} elsif ( $a =~ /--usage/ ) {
usage;
# } elsif ( $a = ~ / / ) {
# } else {
}
}
open HANDLE, "$command $arglist |";
if ( $modules ) {
$ldlibrarypath = `module load $modules; echo \$LD_LIBRARY_PATH`;
chop $ldlibrarypath;
}
while ((chop($line = <HANDLE>))) {
$line =~ /([^\(]+)(.*)/;
$libs{$1}{$2} = 1;
}
foreach $lib ( keys %libs ) {
$full=`$dlinfo $lib`;
chop $full;
if (!$full) {
delete $libs{$lib};
} elsif ( $ldlibrarypath ) {
$hpc = `LD_LIBRARY_PATH=$ldlibrarypath $dlinfo $lib`;
chop $hpc;
if ( $full ne $hpc) {
delete $libs{$lib};
}
}
}
foreach $lib ( keys %libs ) {
foreach $key ( keys %{ $libs{$lib} } ) {
print "$lib$key\n";
}
}

5
hpc_elflib.attr Normal file
View File

@ -0,0 +1,5 @@
%__hpc_elflib_provides %{_rpmconfigdir}/hpc_elf.pl --provides --assume-exec %{?__filter_GLIBC_PRIVATE:--filter-private} %{?hpc_dep_gen_attr}
%__hpc_elflib_requires %{_rpmconfigdir}/hpc_elf.pl %{?_hpc_modules:--modules "%_hpc_modules"} --requires --assume-exec %{?__filter_GLIBC_PRIVATE:--filter-private} %{?hpc_dep_gen_attr}
%__hpc_elflib_magic ^(setuid )?(setgid )?(sticky )?ELF (32|64)-bit.*executable
%__hpc_elflib_path ^%hpc_prefix
%__hpc_elflib_flags exeonly

View File

@ -196,6 +196,15 @@ EOF\
# This can be overridden in the spec file.
%hpc_module_pname %pname
# Modules init: Set up modules required for building
# %hpc_modules_init <module_list>
# <module_list>: list of modules (exclude compiler and MPI library).
# May be empty if only compiler and MPI library are needed.
%hpc_modules_init() \
%{!?_hpc_init_done: %{error: "%%hpc_setup_compiler: Call %%hpc_init first!"}} \
%{?*:%global _hpc_modules_other %{**}} \
%global _hpc_modules %{?hpc_compiler_family:%{expand:%%{?%{expand:_hpc_%{hpc_compiler_family}_module}}}} %{?hpc_mpi_family:%{expand:%%{?%{expand:_hpc_%{hpc_mpi_family}_module}}}} %{?_hpc_modules_other}
%hpc_setup_compiler \
%{!?_hpc_init_done: %{error: "%%hpc_setup_compiler: Call %%hpc_init first!"}} \
module purge \
@ -206,7 +215,8 @@ EOF\
%hpc_setup \
%hpc_setup_compiler \
%{!?_hpc_build_mpi:%hpc_setup_mpi}
%{!?_hpc_build_mpi:%hpc_setup_mpi} \
%{?_hpc_modules_other:[ -n "%{?_hpc_modules_other}" ] && module load %_hpc_modules_other}
# delete default in %postun
%hpc_module_delete_if_default \

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Sun Nov 18 10:19:22 UTC 2018 - eich@suse.com
- Expand modules handling (bsc#1116458):
* add %%hpc_modules_init to store the list of modules
* if a modules list is available, use environment during
dependency generation to exclude objects which will be
found thru environment modules.
* bump package version.
-------------------------------------------------------------------
Fri Oct 26 10:49:00 UTC 2018 - eich@suse.com

View File

@ -20,7 +20,7 @@ Summary: SUSE HPC Environment
License: BSD-3-Clause
Group: Productivity/Clustering/Computing
Name: suse-hpc
Version: 0.3
Version: 0.4
Release: 0
Source0: macros.hpc
Source1: dlinfo.c