From 947aaec95d7bf99a17037682923dab3f62b38f9358a64561be072a6bae48079c Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Sun, 18 Nov 2018 21:36:28 +0000 Subject: [PATCH 1/3] 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 --- _service | 4 +-- hpc_elf.attr | 5 +++ hpc_elf.pl | 93 ++++++++++++++++++++++++++++++++++++++++++++++++ hpc_elflib.attr | 5 +++ macros.hpc | 12 ++++++- suse-hpc.changes | 10 ++++++ suse-hpc.spec | 2 +- 7 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 hpc_elf.attr create mode 100644 hpc_elf.pl create mode 100644 hpc_elflib.attr diff --git a/_service b/_service index 1575196..e7955cb 100644 --- a/_service +++ b/_service @@ -5,8 +5,8 @@ no .git suse-hpc - 0.1.%h - d6d9c0fddeefd4f22d4aa44d6a9f7bc7f625bcba + 0.4.%h + 87f3f2c336d9dc5f9e8874e7639459371cfae3b0 general/dlinfo.c general/macros.hpc general/hpc_elf.pl diff --git a/hpc_elf.attr b/hpc_elf.attr new file mode 100644 index 0000000..e03d066 --- /dev/null +++ b/hpc_elf.attr @@ -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 diff --git a/hpc_elf.pl b/hpc_elf.pl new file mode 100644 index 0000000..a068535 --- /dev/null +++ b/hpc_elf.pl @@ -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 = <))) { + $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"; + } +} + diff --git a/hpc_elflib.attr b/hpc_elflib.attr new file mode 100644 index 0000000..8a9926e --- /dev/null +++ b/hpc_elflib.attr @@ -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 diff --git a/macros.hpc b/macros.hpc index 8ca376e..84d66a3 100644 --- a/macros.hpc +++ b/macros.hpc @@ -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 +# : 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 \ diff --git a/suse-hpc.changes b/suse-hpc.changes index 8d87b44..2111fcd 100644 --- a/suse-hpc.changes +++ b/suse-hpc.changes @@ -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 diff --git a/suse-hpc.spec b/suse-hpc.spec index d50362c..daedcbc 100644 --- a/suse-hpc.spec +++ b/suse-hpc.spec @@ -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 From 9f361ce7b4bcfbde5609fc4e5bb4e7f24e08c373590994265708aafd1adc76a4 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Mon, 19 Nov 2018 07:14:05 +0000 Subject: [PATCH 2/3] Accepting request 650115 from home:eeich:branches:science:machinelearning - Improve python handling: * set python3 as default for Factory * allow to specify subdir to HPC pyton path OBS-URL: https://build.opensuse.org/request/show/650115 OBS-URL: https://build.opensuse.org/package/show/science:HPC/suse-hpc?expand=0&rev=36 --- macros.hpc | 14 +++++++------- suse-hpc.changes | 7 +++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/macros.hpc b/macros.hpc index 84d66a3..746c1b3 100644 --- a/macros.hpc +++ b/macros.hpc @@ -168,7 +168,7 @@ EOF\ %global tmp %__elflib_exclude_path \ %global __elflib_exclude_path (%tmp)|(^%hpc_base) \ %undefine tmp \ - %{expand:%([ 0%{?sle_version} -ge 150000 ] && echo %%global _hpc_python3 1)} \ + %{expand:%([ 0%{?sle_version} -ge 150000 -o 0%{?suse_version} -gt 1500 ] && echo %%global _hpc_python3 1)} \ %global _hpc_init_done 1 %hpc_init(Cc:Mm:v:V:e:) %{expand:%%_hpc_init %{**}} @@ -604,17 +604,17 @@ When this package gets updated it installs the latest version of %name. \ fi \ done -# %hpc_python_mv_to_sitearch +# %hpc_python_mv_to_sitearch [] # -# move to python sitearch, remove shebang lines and -# remove any excecute permissions. +# move to python sitearch subdir if set, remove shebang +# lines and remove any excecute permissions. # This should be done on any python files that do not contain # any executable code. %hpc_python_mv_to_sitearch() \ - _hpc_pydir=%hpc_python_sitearch_no_singlespec \ + _hpc_pydir=%{hpc_python_sitearch_no_singlespec}%{?2:/%{2}} \ _hpc_base=$(basename %{1}) \ - [ -d %{buildroot}/$_hpc_pydir ] || mkdir -p %{buildroot}/$_hpc_pydir \ - mv %{buildroot}%{1} %{buildroot}/$_hpc_pydir \ + [ -d %{buildroot}/$_hpc_pydir ] || mkdir -p %{buildroot}/${_hpc_pydir} \ + mv %{buildroot}%{1} %{buildroot}/${_hpc_pydir} \ chmod a-x %{buildroot}/$_hpc_pydir/$_hpc_base \ %{hpc_shebang_remove %{buildroot}/$_hpc_pydir/$_hpc_base} diff --git a/suse-hpc.changes b/suse-hpc.changes index 2111fcd..4e3569b 100644 --- a/suse-hpc.changes +++ b/suse-hpc.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Nov 19 01:19:05 UTC 2018 - eich@suse.com + +- Improve python handling: + * set python3 as default for Factory + * allow to specify subdir to HPC pyton path + ------------------------------------------------------------------- Sun Nov 18 10:19:22 UTC 2018 - eich@suse.com From 413dd18fa9ec5f34fd47241410e464fbb1a79e96a9b33ca4072599fc5f180240 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Mon, 19 Nov 2018 09:32:41 +0000 Subject: [PATCH 3/3] Accepting request 650133 from home:eeich:branches:science:machinelearning * Do not remove executable flag on .so files OBS-URL: https://build.opensuse.org/request/show/650133 OBS-URL: https://build.opensuse.org/package/show/science:HPC/suse-hpc?expand=0&rev=37 --- macros.hpc | 2 +- suse-hpc.changes | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/macros.hpc b/macros.hpc index 746c1b3..ca8fa70 100644 --- a/macros.hpc +++ b/macros.hpc @@ -615,7 +615,7 @@ When this package gets updated it installs the latest version of %name. \ _hpc_base=$(basename %{1}) \ [ -d %{buildroot}/$_hpc_pydir ] || mkdir -p %{buildroot}/${_hpc_pydir} \ mv %{buildroot}%{1} %{buildroot}/${_hpc_pydir} \ - chmod a-x %{buildroot}/$_hpc_pydir/$_hpc_base \ + [[ "$_hpc_base" =~ .*\.so ]] || chmod a-x %{buildroot}/$_hpc_pydir/$_hpc_base \ %{hpc_shebang_remove %{buildroot}/$_hpc_pydir/$_hpc_base} # %hpc_verify_python3 diff --git a/suse-hpc.changes b/suse-hpc.changes index 4e3569b..a518f7d 100644 --- a/suse-hpc.changes +++ b/suse-hpc.changes @@ -4,6 +4,7 @@ Mon Nov 19 01:19:05 UTC 2018 - eich@suse.com - Improve python handling: * set python3 as default for Factory * allow to specify subdir to HPC pyton path + * Do not remove executable flag on .so files ------------------------------------------------------------------- Sun Nov 18 10:19:22 UTC 2018 - eich@suse.com