-
Notifications
You must be signed in to change notification settings - Fork 183
/
cms-common.spec
51 lines (43 loc) · 1.93 KB
/
cms-common.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
### RPM cms cms-common 1.0
## REVISION 1243
## NOCOMPILER
%define tag a99996fce4b88dff99f0f476df1bffcd41beac3c
Source: git+https://github.com/cms-sw/cms-common.git?obj=master/%{tag}&export=%{n}-%{realversion}-%{tag}&output=/%{n}-%{realversion}-%{tag}.tgz
%prep
#Make sure that we always build cms-common with a different revision and
#hardcoded version 1.0 because this is what bootstrap.sh is going to install
%if "%{v}" != "1.0"
echo "ERROR: Please do not change the version. We have to build this RPM with a different REVISION"
echo " Please update the revision in %{n}.spec and make sure that version is set to 1.0"
exit 1
%endif
%setup -n %{n}-%{realversion}-%{tag}
find . -type f | xargs sed -i -e 's|@CMS_PREFIX@|%{instroot}|g;s|@SCRAM_ARCH@|%{cmsplatf}|'
%build
%install
mkdir -p %{i}/%{pkgrevision}
rsync -a %_builddir/%{n}-%{realversion}-%{tag}/ %{i}/%{pkgrevision}/
%post
cd $RPM_INSTALL_PREFIX/%{pkgrel}/%{pkgrevision}
%{relocateCmsFiles} `find . -name "*" -type f`
mkdir -p $RPM_INSTALL_PREFIX/etc/%{pkgname} $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/profile.d
#Check if a newer revision is already installed
#Also force installation if older revision has deleted cmsset_default.sh
if [ -f $RPM_INSTALL_PREFIX/cmsset_default.csh ] && [ -f $RPM_INSTALL_PREFIX/etc/%{pkgname}/revision ] ; then
oldrev=`cat $RPM_INSTALL_PREFIX/etc/%{pkgname}/revision`
if [ $oldrev -ge %{pkgrevision} ] ; then
exit 0
fi
fi
mkdir -p $RPM_INSTALL_PREFIX/share $RPM_INSTALL_PREFIX/etc/scramrc
[ -d ./etc/scramrc/SCRAM ] && rsync -a --delete ./etc/scramrc/SCRAM/ $RPM_INSTALL_PREFIX/etc/scramrc/SCRAM/
[ -d ./share ] && rsync -a ./share/ $RPM_INSTALL_PREFIX/share/
for file in $(find . -name '*' | grep -v '^./etc/scramrc/SCRAM' ); do
if [ -d $file ] ; then
mkdir -p $RPM_INSTALL_PREFIX/$file
else
rm -f $RPM_INSTALL_PREFIX/$file
cp -P $file $RPM_INSTALL_PREFIX/$file
fi
done
echo %{pkgrevision} > $RPM_INSTALL_PREFIX/etc/%{pkgname}/revision