forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cms-common.spec
57 lines (47 loc) · 1.86 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
52
53
54
55
56
57
### RPM cms cms-common 1.0
## REVISION 1201
## NOCOMPILER
%define tag 2be1bcbed0412f5f70cde73efeb912912e5f0a08
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/common $RPM_INSTALL_PREFIX/bin $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
for file in `find . -name "*" -type f`; do
rm -f $RPM_INSTALL_PREFIX/$file
cp $file $RPM_INSTALL_PREFIX/$file
done
cd $RPM_INSTALL_PREFIX
for l in common/scramv1 common/scramv0 ; do
if [ ! -L $l ] ; then
rm -f $l; ln -s scram $l
fi
done
for l in cmsarch cmsos scramv1 ; do
if [ ! -L bin/$l ] ; then
rm -f bin/$l; ln -s ../common/$l bin/$l
fi
done
echo %{pkgrevision} > etc/%{pkgname}/revision