-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
admin/ohpc-filesystem: include custom requires/provides plugin files for RPM dependency analysis #645
admin/ohpc-filesystem: include custom requires/provides plugin files for RPM dependency analysis #645
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# | ||
# ohpc-find-provides | ||
#----------------------------------------------------------------------- | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you | ||
# may not use this file except in compliance with the License. You may | ||
# obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
# implied. See the License for the specific language governing | ||
# permissions and limitations under the License. | ||
#----------------------------------------------------------------------- | ||
|
||
IFS=$'\n' | ||
|
||
# Get the list of files. | ||
filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"` | ||
|
||
# Use standard elfdeps tool and append additional (ohpc) color delimiter | ||
|
||
if [ -x /usr/lib/rpm/elfdeps -a -n "$filelist" ];then | ||
|
||
provideList=$(echo $filelist | /usr/lib/rpm/elfdeps -P) | ||
for provide in $provideList; do | ||
echo "$provide(ohpc)" | ||
done | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
# | ||
# ohpc-find-requires | ||
#----------------------------------------------------------------------- | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you | ||
# may not use this file except in compliance with the License. You may | ||
# obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
# implied. See the License for the specific language governing | ||
# permissions and limitations under the License. | ||
#----------------------------------------------------------------------- | ||
|
||
IFS=$'\n' | ||
|
||
# First argument is buildroot | ||
buildroot="$1" | ||
if [ ! -d "$buildroot" ]; then | ||
>&2 echo "Invalid buildroot" | ||
exit 1 | ||
fi | ||
|
||
# Second argument is top-level search path | ||
searchPath="$2" | ||
if [ -z "$searchPath" ];then | ||
>&2echo "Required search path argument not provided" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -x /usr/lib/rpm/elfdeps ]; then | ||
>&2 echo "Required /usr/lib/rpm/elfdeps binary not available locally" | ||
exit 1 | ||
fi | ||
|
||
# Get the list of files. | ||
filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"` | ||
|
||
if [ -z "$filelist" ]; then exit 0; fi | ||
|
||
|
||
# Step 1: use standard elfdeps analysis and cache results | ||
requireList=$(echo ${filelist} | /usr/lib/rpm/elfdeps -R) | ||
|
||
# Step 2: append additional color delimiter for ohpc provided packages (that | ||
# install into $searchPath) | ||
|
||
for require in ${requireList}; do | ||
|
||
# Check if this is owned by ohpc pre-requisite | ||
package=$(rpm -q --queryformat '%{NAME}\n' --whatprovides "$require(ohpc)") | ||
if [ $? -eq 0 ];then | ||
echo "$require(ohpc)" | ||
else | ||
|
||
# check if this requirement is housed in ${buildroot}/opt/ohpc. | ||
# If so, we append an (ohpc) color designation, otherwise we | ||
# leave the requirement as is. | ||
|
||
libname=${require%%(*} # strip off () to get libname | ||
match=$(find ${buildroot}/${searchPath} -name ${libname}) | ||
|
||
if [ -n "${match}" ];then | ||
echo "$require(ohpc)" | ||
else | ||
echo "$require" | ||
fi | ||
|
||
fi | ||
|
||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%__ohpc_provides /usr/lib/rpm/ohpc-find-provides | ||
%__ohpc_requires /usr/lib/rpm/ohpc-find-requires %{buildroot} %{OHPC_HOME} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The usage of %{OHPC_HOME} in this file makes me a bit nervous. At what time is the file evaluated. After including OHPC_macros? But with happens with RPMs that do not define %{OHPC_HOME}. It then probably resolves to literally '%{OHPC_HOME}'. Is that a problem. Main question: Does this break building non-OHPC RPMS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair point...let me look into that further and test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like standard macro syntax works fine for the path designations, so can guard those with the following:
The she-bang macro test does not look to work in the requires stanza, so working on a slightly amended solution for that. Will double check with ohpc and non-ohpc package builds and follow up with newer patches... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update in PR #648. See what you think. I built a non-ohpc package with the updated config and didn't see any issues (and get the same Provides/Requires results you get without the extra ohpc dependency files enabled). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, I take back the fact that the macro checks in the .attr file work as expected after kicking off a number of builds - I should have tested more with non-ohpc packages that include elf binaries. I have updated again via #650 and this approach simply calls out the I was previously concerned with trying to allow for someone to relocate the top-level path for all ohpc packages (say customized environment were someone is rebuilding everything from .src rpms). However, in that case, a user will likely need to modify OHPC_macros to set the desired top-level path, so I just leveraged those settings in the creation of the |
||
%__ohpc_path ^%{OHPC_HOME} | ||
%__elf_exclude_path ^%{OHPC_HOME} | ||
|
||
%__ohpc_magic ^ELF (32|64)-bit.*$ | ||
%__ohpc_flags magic_and_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment what this for would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in #648