Skip to content

Commit

Permalink
Merge pull request #1833 from smuzaffar/IB/CMSSW_5_3_X/slc6_amd64_gcc472
Browse files Browse the repository at this point in the history
updated das client/wrapper
  • Loading branch information
smuzaffar committed Sep 23, 2015
2 parents 9b344f0 + b24936b commit ee7f279
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cmssw-tool-conf.spec
Expand Up @@ -20,7 +20,7 @@ Requires: curl-toolfile
%if "%(case %cmsplatf in (osx*) echo true ;; (*) echo false ;; esac)" == "true"
Requires: freetype-toolfile
%endif
Requires: das-client-toolfile
Requires: das_client-toolfile
Requires: db4-toolfile
Requires: dbs-client-toolfile
Requires: dpm-toolfile
Expand Down
16 changes: 0 additions & 16 deletions das-client.spec

This file was deleted.

8 changes: 4 additions & 4 deletions das-client-toolfile.spec → das_client-toolfile.spec
@@ -1,12 +1,12 @@
### RPM cms das-client-toolfile 1.0
Requires: das-client
### RPM cms das_client-toolfile 1.0
Requires: das_client
%prep
%build
%install

mkdir -p %i/etc/scram.d
cat << \EOF_TOOLFILE >%i/etc/scram.d/das-client.xml
<tool name="das-client" version="@TOOL_VERSION@">
cat << \EOF_TOOLFILE >%i/etc/scram.d/das_client.xml
<tool name="das_client" version="@TOOL_VERSION@">
<client>
<environment name="DAS_CLIENT_BASE" default="@TOOL_ROOT@"/>
</client>
Expand Down
62 changes: 62 additions & 0 deletions das_client.spec
@@ -0,0 +1,62 @@
### RPM cms das_client v02.05.00
%define pkg DAS

Source0: git://github.com/dmwm/DAS?obj=master/%realversion&export=%pkg&output=/%pkg.tar.gz
Requires: python

# RPM macros documentation
# http://www.rpm.org/max-rpm/s1-rpm-inside-macros.html
%prep
%setup -c
%setup -T -D -a 0

%build

%install
mkdir -p %i/bin
cp %{pkg}/src/python/DAS/tools/das_client.py %i/bin

# create wrapper script
mkdir -p %i/etc
cat << \EOF > %i/etc/das_client
#!/bin/sh
# VERSION:%{cmsplatf}/%{v}
# Clean-up CMSSW environment
eval `scram unsetenv -sh 2>/dev/null`
# Sourcing dasclient environment
SHARED_ARCH=`cmsos`
LATEST_VERSION=`cd %{instroot}; ls ${SHARED_ARCH}_*/%{pkgcategory}/%{pkgname}/v*/etc/profile.d/init.sh | sed 's|.*/%{pkgcategory}/%{pkgname}/||' | sort | tail -1`
DAS_ENV=`ls %{instroot}/${SHARED_ARCH}_*/%{pkgcategory}/%{pkgname}/${LATEST_VERSION} | sort | tail -1`
source $DAS_ENV
if [ $# == 0 ] || [ "$1" == "--help" ] || [ "$1" == "-help" ]
then
$DAS_CLIENT_ROOT/bin/das_client.py --help | sed 's/das_client.py/das_client/'
else
$DAS_CLIENT_ROOT/bin/das_client.py "$@"
fi
EOF

chmod +x %i/etc/das_client

# Generate dependencies-setup.{sh,csh} so init.{sh,csh} picks full environment.
mkdir -p %i/etc/profile.d
: > %i/etc/profile.d/dependencies-setup.sh
: > %i/etc/profile.d/dependencies-setup.csh
for tool in $(echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'); do
root=$(echo $tool | tr a-z- A-Z_)_ROOT; eval r=\$$root
if [ X"$r" != X ] && [ -r "$r/etc/profile.d/init.sh" ]; then
echo "test X\$$root != X || . $r/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
echo "test X\$?$root = X1 || source $r/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
fi
done

%post
%{relocateConfig}etc/profile.d/dependencies-setup.*sh
%{relocateConfig}etc/das_client

# copy wrapper script into common if latest version is same as this version
mkdir -p $RPM_INSTALL_PREFIX/common
if [ "`ls ${RPM_INSTALL_PREFIX}/*/%{pkgcategory}/%{pkgname}/v*/etc/profile.d/init.sh | sed 's|.*/%{pkgcategory}/%{pkgname}/||;s|/etc/profile.d/init.sh||' | sort | tail -1`" = "%v" ] ; then
/bin/cp -f ${RPM_INSTALL_PREFIX}/%{pkgrel}/etc/das_client $RPM_INSTALL_PREFIX/common/das_client.tmp
mv $RPM_INSTALL_PREFIX/common/das_client.tmp $RPM_INSTALL_PREFIX/common/das_client
fi

0 comments on commit ee7f279

Please sign in to comment.