forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crab-build.file
76 lines (65 loc) · 2.71 KB
/
crab-build.file
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
## NOCOMPILER
## NO_AUTO_DEPENDENCY
## NO_VERSION_SUFFIX
%define crab_type %(echo %n | sed -e 's|crab-||')
%if "%{?crabserver_packages:set}" != "set"
%define crabserver_packages ServerUtilities.py
%endif
%if "%{?dbs_packages:set}" != "set"
%define dbs_packages Client/src/python/dbs PycurlClient/src/python/RestClient
%endif
Source0: git://github.com/dmwm/CRABClient.git?obj=master/%{crabclient_version}&export=CRABClient&output=/CRABClient-%{crabclient_version}.tar.gz
Source1: git://github.com/dmwm/CRABServer.git?obj=master/%{crabserver_version}&export=CRABServer&output=/CRABServer-%{crabserver_version}.tar.gz
Source2: git://github.com/dmwm/DBS.git?obj=master/%{dbs_version}&export=DBS&output=/DBS-%{dbs_version}.tar.gz
%prep
%{?check_version_suffix:%check_version_suffix}
%setup -D -T -b 0 -n CRABClient
%setup -D -T -b 1 -n CRABServer
%setup -D -T -b 2 -n DBS
%build
%install
#Copy CRABClient
rsync -a %{_builddir}/CRABClient/src/python/ %{i}/lib/
sed -i -e 's|"development"|"%{crabclient_version}"|' %{i}/lib/CRABClient/__init__.py
rsync -a %{_builddir}/CRABClient/bin/ %{i}/bin/
rsync -a %{_builddir}/CRABClient/etc/ %{i}/etc/
#List of CRAB python pakcages for which we need to create ProxyPackage symlink
ls %{_builddir}/CRABClient/src/python/*/__init__.py | sed 's|/__init__.py$||;s|.*/||' > %{i}/etc/crab_py_pkgs.txt
echo dbs >> %{i}/etc/crab_py_pkgs.txt
echo RestClient >> %{i}/etc/crab_py_pkgs.txt
#Create fake WMCore
mkdir %{i}/lib/WMCore
cp %{_builddir}/CRABClient/src/python/CRABClient/WMCoreConfiguration.py %{i}/lib/WMCore/Configuration.py
touch %{i}/lib/WMCore/__init__.py
#Copy CRABServer
for pkg in %{crabserver_packages} ; do
if [ -d %{_builddir}/CRABServer/src/python/${pkg} ] ; then
rsync -a %{_builddir}/CRABServer/src/python/${pkg} %{i}/lib/
else
cp %{_builddir}/CRABServer/src/python/${pkg} %{i}/lib/${pkg}
fi
done
#Copy DBS
for pkg in %{dbs_packages} ; do
if [ -d %{_builddir}/DBS/${pkg} ] ; then
rsync -a %{_builddir}/DBS/${pkg} %{i}/lib/
else
cp %{_builddir}/DBS/${pkg} %{i}/lib/${pkg}
fi
done
rsync -a %{_builddir}/DBS/Client/utils/ %{i}/examples/
if [ $(grep '_UseCrab' %{i}/etc/crab-bash-completion.sh | wc -l) -gt 0 ] && [ $(grep ' filenames *crab' %{i}/etc/crab-bash-completion.sh |wc -l) -gt 0 ] ; then
sed -i -e 's|_UseCrab|_UseCrab_%{crab_type}|g;s| filenames *crab| filenames crab-%{crab_type}|' %{i}/etc/crab-bash-completion.sh
if [ "%{crab_type}" = "prod" ] ; then
echo "complete -F _UseCrab_prod -o filenames crab" >> %{i}/etc/crab-bash-completion.sh
fi
else
echo "ERROR: Unable to fix crab use function _UseCrab"
exit 1
fi
%post
cd ${RPM_INSTALL_PREFIX}
mkdir -p share/%{pkgdir}
for dir in bin lib etc examples; do
rsync -a %{pkgrel}/${dir}/ share/%{pkgdir}/${dir}/
done