ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/SCRAMV1.spec
Revision: 1.45
Committed: Fri Feb 16 19:51:51 2007 UTC (18 years, 2 months ago) by muzaffar
Branch: MAIN
Changes since 1.44: +9 -6 lines
Log Message:
make sure that arch/lcg/SCRAMV1/scramdb directory exists at install time

File Contents

# User Rev Content
1 sashby 1.43 ### RPM lcg SCRAMV1 V1_0_3-p1
2 argiro 1.1 ## INITENV +PATH PATH %instroot/bin
3 eulisse 1.7 ## INITENV +PATH PERL5LIB %{i}
4 eulisse 1.21 Requires: expat p5-template-toolkit p5-uri p5-xml-parser p5-libwww-perl cms-env
5 eulisse 1.7 Provides: perl(SCRAM::Helper)
6     Provides: perl(Utilities::AddDir)
7     Provides: perl(Utilities::Architecture)
8     Provides: perl(Utilities::SCRAMUtils)
9     Provides: perl(ActiveDoc::GroupChecker)
10     Provides: perl(ActiveDoc::UserInterface_basic)
11     Provides: perl(ActiveDoc::UserQuery)
12     Provides: perl(Doxygen::Context)
13     Provides: perl(Graph::Graph)
14     Provides: perl(ObjectStore)
15 eulisse 1.24 Provides: perl(Utilities::SVNmodule)
16     Provides: perl(URL::URL_cvsfile)
17 eulisse 1.35 Provides: perl(BuildSystem::Block)
18     Provides: perl(BuildSystem::Build)
19     Provides: perl(BuildSystem::BuildClass)
20     Provides: perl(BuildSystem::BuildSetup)
21     Provides: perl(BuildSystem::DateStampRecord)
22     Provides: perl(BuildSystem::Tool)
23     Provides: perl(BuildSystem::ToolBox)
24     Provides: perl(BuildSystem::ToolDoc)
25     Provides: perl(Utilities::GroupChecker)
26 eulisse 1.7
27 argiro 1.1 # This package is somewhat unusual compared to other packages we
28     # build: we install the normally versioned product "SCRAM", but also
29     # create the front-end "scram" wrapper and the package database. The
30     # latter do not follow the standard versioning.
31     #
32     # The front-end script can be overwritten by any version *PROVIDED*
33     # the platform string comes first as is the default (i.e. the
34     # installation tree looks like <platf>/lcg/SCRAM/<version>/src).
35     #
36     # The database is only created, but never changeed. It is made part
37     # of this package, but none of the files in it are included, so if
38     # the package is removed, the directory will left intact. (FIXME:
39     # check this is really so -- should we use %dir, or the default is
40     # good?)
41     #
42     # The front-end wrapper and the script go at the installation root,
43     # not anywhere in the package tree. They must remain modifiable.
44     #
45     # We do the install ourselves, as "Installation/install_scram" would
46     # do, but putting the results elsewhere and using our own scram
47     # wrapper instead of using the supplied one -- mainly for easier
48     # override of SCRAM_LOOKUPDB; the wrapper is really rather simple so
49     # there is no point in trying to patch it.
50     #
51     # FIXME: should we have more than one project database and link them
52     # together into one big one?
53    
54 muzaffar 1.42 %define cvsrepo cvs://:pserver:anonymous@isscvs.cern.ch:/local/reps/scram?passwd=AA_:yZZ3e
55 argiro 1.1
56 eulisse 1.2 Source0: %{cvsrepo}&tag=-r%{v}&module=SCRAM&output=/source.tar.gz
57 argiro 1.1
58     %prep
59     %setup -n SCRAM
60     %build
61     %install
62     tar -cf - . | tar -C %i -xvvf -
63 eulisse 1.7 rm -rf %i/cgi
64 muzaffar 1.42 mkdir -p %instroot/bin %instroot/%cmsplatf/lcg/SCRAMV1/scramdb %i/Installation
65 eulisse 1.19 mkdir -p %i/bin
66 muzaffar 1.44 touch %instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup
67 eulisse 1.2
68 eulisse 1.19 cat Installation/scram.pl.in | sed -e "s|@PERLEXE@|/usr/bin/env perl|;s|@SCRAM_HOME@|%i|;s|@INSTALLDIR@|%i/src|" > %i/bin/scramv1
69 eulisse 1.24 cat Installation/scram.pl.in | sed -e "s|@PERLEXE@|/usr/bin/env perl|;s|@SCRAM_HOME@|%i|;s|@INSTALLDIR@|%i/src|" > %i/src/main/scram.pl
70     chmod +x %i/src/main/scram.pl
71 muzaffar 1.42 cat Installation/SCRAM_SITE.pm.in | sed -e "s|@SCRAM_HOME@|%i|;s|@SCRAM_LOOKUPDB_DIR@|%instroot/%cmsplatf/lcg/SCRAMV1/scramdb/|;s|@PERLEXE@|/usr/bin/env perl|;s|@TT2INSTALLDIR@|$TEMPLATE_TOOLKIT_ROOT/lib|;s|@SITETEMPLATEDIR@|%i/Templates|;s|@SCRAM_SITENAME@|STANDALONE|" > %i/Installation/SCRAM_SITE.pm
72 eulisse 1.2
73     # cat > %instroot/bin/scramv1 << \EOF
74     # #!/bin/sh
75     #
76     # # FIXME: Handle -re?
77     # # FIXME: Since we can install the same package on many platforms in
78     # # one tree, should the project lookup database be platform-specific?
79     #
80     # SCRAM=$0
81     # : ${SCRAM_HOME=%i}
82 muzaffar 1.42 # : ${SCRAM_LOOKUPDB=%instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup}
83 eulisse 1.2 # : ${SCRAMPERL="/usr/bin/env perl"}
84     # PERL5LIB=$SCRAM_HOME/src${PERL5LIB+":$PERL5LIB"}
85     # : ${SITENAME=CERN}
86     # : ${SEARCHOVRD=true}
87     # : ${LOCTOOLS=NODEFAULT}
88     # export SCRAM SCRAM_HOME SCRAM_LOOKUPDB SCRAMPERL
89     # export PERL5LIB SITENAME SEARCHOVRD LOCTOOLS
90     #
91     # exec perl "$SCRAM_HOME/src/scramcli" ${1+"$@"}
92     # EOF
93 eulisse 1.19 chmod 755 %i/bin/scramv1
94    
95 eulisse 1.3 mkdir %i/etc
96     echo $PERL5LIB > %i/etc/perl5lib.env
97 eulisse 1.6
98 eulisse 1.15 mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d
99 eulisse 1.6 mkdir -p %{i}/etc/profile.d
100     echo "#!/bin/sh" > %i/etc/profile.d/dependencies-setup.sh
101     echo "source $EXPAT_ROOT/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
102     echo "source $P5_TEMPLATE_TOOLKIT_ROOT/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
103     echo "source $P5_URI_ROOT/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
104     echo "source $P5_XML_PARSER_ROOT/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
105     echo "source $P5_LIBWWW_PERL_ROOT/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
106    
107 eulisse 1.11 echo "#!/bin/csh" > %i/etc/profile.d/dependencies-setup.csh
108     echo "source $EXPAT_ROOT/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
109     echo "source $P5_TEMPLATE_TOOLKIT_ROOT/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
110     echo "source $P5_URI_ROOT/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
111     echo "source $P5_XML_PARSER_ROOT/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
112     echo "source $P5_LIBWWW_PERL_ROOT/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
113    
114 eulisse 1.7 perl -p -i -e "s|#!.*perl|/usr/bin/env perl|" %{i}/doc/doxygen/DoxyFilt.pl
115    
116 eulisse 1.5 %post
117 eulisse 1.6 %{relocateConfig}etc/perl5lib.env
118 eulisse 1.5 %{relocateConfig}Installation/SCRAM_SITE.pm
119 eulisse 1.19 %{relocateConfig}bin/scramv1
120 eulisse 1.24 %{relocateConfig}src/main/scram.pl
121 eulisse 1.6 %{relocateConfig}etc/profile.d/dependencies-setup.sh
122 eulisse 1.12 %{relocateConfig}etc/profile.d/dependencies-setup.csh
123 eulisse 1.24 # If and only if there is no default-scramv1 set the default to be the version we package in this spec.
124     OLD_VERSION=""
125 eulisse 1.32 if [ -f $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/default-scramv1-version ]
126 eulisse 1.24 then
127 eulisse 1.32 mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc
128 eulisse 1.24 OLD_VERSION=`cat $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/default-scramv1-version`
129     fi
130     NEW_VERSION=%v
131     (echo $OLD_VERSION;echo $NEW_VERSION) | sort | tail -1 > $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/default-scramv1-version
132 eulisse 1.15
133 eulisse 1.39 # Create the wrapper script.
134     # This has to be done in the post installation script because otherwise it gets deleted when
135     # uninstalling the old revision of scram.
136     cat << \EOF_BIN_SCRAMV1 > $RPM_INSTALL_PREFIX/bin/scramv1
137     #!/bin/sh
138     CMSARCH=`cmsarch`
139     SCRAM_VERSION=`cat %{instroot}/$CMSARCH/etc/default-scramv1-version`
140 muzaffar 1.42 dir=`/bin/pwd`
141     while [ ! -d ${dir}/.SCRAM -a "$dir" != "/" ] ; do
142     dir=`dirname $dir`
143     done
144     if [ -f ${dir}/config/scram_version ] ; then
145     ver=`cat ${dir}/config/scram_version`
146     if [ -f %{instroot}/$CMSARCH/lcg/SCRAMV1/${ver}/etc/profile.d/init.sh ] ; then
147     SCRAM_VERSION=$ver
148     fi
149     fi
150 eulisse 1.39 source %{instroot}/$CMSARCH/lcg/SCRAMV1/$SCRAM_VERSION/etc/profile.d/init.sh
151     %{instroot}/$CMSARCH/lcg/SCRAMV1/$SCRAM_VERSION/bin/scramv1 $@
152     EOF_BIN_SCRAMV1
153     chmod +x $RPM_INSTALL_PREFIX/bin/scramv1
154     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/scramv1
155    
156 muzaffar 1.45 mkdir -p %instroot/%cmsplatf/lcg/SCRAMV1/scramdb
157 muzaffar 1.44 touch %instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup
158 muzaffar 1.45 if [ -f %instroot/share/scramdb/project.lookup ] ; then
159     dblinked=`grep "\!DB %instroot/share/scramdb/project.lookup" %instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup`
160     if [ "X$dblinked" == "X" ] ; then
161     echo "\!DB %instroot/share/scramdb/project.lookup" > %instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup.link
162     cat %instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup >> %instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup.link
163     mv %instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup.link %instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup
164     echo "Linked %instroot/share/scramdb/project.lookup SCRAM DB into %cmsplatf specific SCRAM-DB."
165     fi
166 muzaffar 1.44 fi
167    
168 argiro 1.1 %files
169     %i
170 muzaffar 1.42 %instroot/%cmsplatf/lcg/SCRAMV1/scramdb
171     %exclude %instroot/%cmsplatf/lcg/SCRAMV1/scramdb/project.lookup
172 eulisse 1.18 %exclude %i/scripts/DrDOC.sh