forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmssw-patch-build.file
101 lines (86 loc) · 3.83 KB
/
cmssw-patch-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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
%if "%{?baserel_postfix:set}" != "set"
%define baserel_postfix %{nil}
%endif
%define isPatch yes
%define baserelver %(echo %realversion | sed -e "s|_[[:alnum:]]*patch[[:digit:]][[:digit:]]*||")%{baserel_postfix}
%define baserelname %(echo %n | sed -e "s|-patch||")
%define parent_release_fpath %{cmsroot}/%{cmsplatf}/%{pkgcategory}/%{baserelname}/%{baserelver}
%define must_have_packages FWCore/Version
%if "%{?baserelqueue:set}" != "set"
%define baserelqueue %(echo %realversion | sed -e "s|_[[:alnum:]]*patch.*||")
%endif
%if "%{?cvstag:set}" != "set"
%define cvstag %realversion
%endif
%if "%{?prebuildtarget}" == "gindices"
%define prebuildtarget %{nil}
%endif
%define source1 cmstc://?tag=%{cvstag}&module=CMSSW&export=src&baserelver=%{baserelver}&baserel=%{baserelqueue}&output=/src.tar.gz
%define baserelverX %(echo %{pkgreqs} | sed -e 's|.*/%baserelname/||' | awk '{print $1}')
%define patchsrc9 \
if [ "X%{baserelverX}" != "X%{baserelver}" ] ; then \
echo "ERROR: Please define valid baserel_postfix e.g. -cms, which was added by cmsBuild for %baserelname base release, in %n.spec file.";\
false ;\
fi
%if "%{?PartialBootstrapPatch:set}" == "set"
%define PartialBootstrapPatch %{nil}
%endif
%define PatchReleaseLink \
for SUBSYS in `ls -d %{parent_release_fpath}/$DIR/*`; do \
if [ -d $SUBSYS ] ; then \
S=`basename $SUBSYS`; \
if [ -d $DIR/$S ] ; then \
for PKG in `ls -d $SUBSYS/[A-Za-z]*`; do \
P=`basename $PKG`;\
if [ ! -e $DIR/$S/$P ] ; then ln -s $SUBSYS/$P $DIR/$S/. ; fi;\
done;\
else ln -s $SUBSYS $DIR/. ;\
fi;\
fi; \
done
%define RelocateReleaseLinks \
for L in `find $DIR -type l`; do \
lnk=`readlink -n $L 2>&1` ;\
case $lnk in \
%{cmsroot}/%{cmsplatf}/*) \
rl=`echo $L | sed -e 's|[^/]*/|../|g;' | xargs dirname` ;\
al=`echo $lnk | sed -e "s|^%{cmsroot}/%{cmsplatf}/|../../../$rl/|"` ;\
rm -f $L ;\
ln -sf $al $L ;\
;; \
esac ;\
done
%define PatchReleasePythonSymlinks \
CWD=`/bin/pwd`; cd %i; %scramcmd b --verbose -f tmp/common/cache/python_symlinks </dev/null; DIR=python; %{PatchReleaseLink} ; cd $CWD;
%define PatchReleaseSourceSymlinks \
CWD=`/bin/pwd`; cd %i; DIR=%{srctree}; %{PatchReleaseLink}; %{RelocateReleaseLinks}; DIR=cfipython/%{cmsplatf}; %{PatchReleaseLink}; %{RelocateReleaseLinks}; DIR=python; %{RelocateReleaseLinks}; cd $CWD;
%define PatchReleaseFilesRelocate \
if [ -e %{srctree}/.glimpse_filenames ] ; then \
perl -p -i -e "s|.*/%{baserelver}/%{srctree}/||g" %{srctree}/.glimpse_filenames; \
perl -p -i -e "s|.*/%{baserelver}/%{srctree}/||g" %{srctree}/.glimpse_full/.glimpse_filenames ;\
fi
%define PatchReleaseDependencyInfo \
gunzip -c %{parent_release_fpath}/etc/dependencies/usedby.out.gz > %i/etc/dependencies/usedbyAll.out ;\
gunzip -c %{parent_release_fpath}/etc/dependencies/pyusedby.out.gz > %i/etc/dependencies/pyusedbyAll.out ;\
cat %i/etc/dependencies/usedby.out >> %i/etc/dependencies/usedbyAll.out ;\
cat %i/etc/dependencies/pyusedby.out >> %i/etc/dependencies/pyusedbyAll.out ;\
mv -f %i/etc/dependencies/usedbyAll.out %i/etc/dependencies/usedby.out ;\
mv -f %i/etc/dependencies/pyusedbyAll.out %i/etc/dependencies/pyusedby.out
%if "%{?must_have_packages:set}" == "set"
%define PatchReleaseAdditionalPackages \
for PKG in %{must_have_packages}; do \
if [ ! -e $PKG ] ; then \
if [ -d %{parent_release_fpath}/%{srctree}/$PKG ] ; then \
mkdir -p `dirname $PKG`; \
cp -r %{parent_release_fpath}/%{srctree}/$PKG $PKG;\
fi;\
fi;\
done;
%endif
%if "%{?runGlimpse:set}" == "set"
%undefine runGlimpse
%define PatchReleaseGlimpse \
CWD=`/bin/pwd`; \
cd %i ; %scramcmd b --verbose -f gindices; \
cd $CWD
%endif