ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/apt.spec
Revision: 1.48
Committed: Thu Jul 12 09:26:21 2007 UTC (17 years, 9 months ago) by eulisse
Branch: MAIN
Changes since 1.47: +28 -0 lines
Log Message:
* Now creates also the cms-apt-migration script which allows to move from
  the old SLC apt/rpm to the cms provided one.

File Contents

# User Rev Content
1 elmer 1.40 ### RPM external apt 0.5.15lorg3.2-CMS3
2 eulisse 1.24 ## INITENV SET APT_CONFIG %{i}/etc/apt.conf
3 eulisse 1.7
4 eulisse 1.10 Source: http://apt-rpm.org/releases/%n-%realversion.tar.bz2
5 eulisse 1.8 Source1: bootstrap
6 eulisse 1.48 Source2: cms-apt-migration
7 eulisse 1.32 Requires: libxml2 beecrypt rpm zlib bz2lib openssl
8 eulisse 1.5 Patch0: apt-rpm449
9 eulisse 1.32 Patch1: apt-rpm446
10 eulisse 1.45 Patch2: apt
11    
12 eulisse 1.5 %if "%(echo %{cmsos} | cut -d_ -f 2 | sed -e 's|.*64.*|64|')" == "64"
13     %define libdir lib64
14     %else
15     %define libdir lib
16     %endif
17 ratnik 1.1
18 eulisse 1.5 %prep
19     %setup -n %n-%{realversion}
20 eulisse 1.32 case $RPM_VERSION in
21     4.4.9*)
22 eulisse 1.5 %patch0 -p0
23 eulisse 1.32 ;;
24     4.4.6*)
25     %patch1 -p0
26     ;;
27     esac
28 eulisse 1.45 %patch2 -p1
29    
30 ratnik 1.1 %build
31 eulisse 1.34 export CFLAGS="-O0 -g"
32     export CXXFLAGS="-O0 -g"
33 eulisse 1.39 export CPPFLAGS="-I$BZ2LIB_ROOT/include -I$BEECRYPT_ROOT/include -I$RPM_ROOT/include -I$RPM_ROOT/include/rpm"
34     export LDFLAGS="-L$BZ2LIB_ROOT/lib -L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}"
35 eulisse 1.2 export LIBDIR="$LIBS"
36     export LIBXML2_CFLAGS="-I$LIBXML2_ROOT/include/libxml2 -I$BEECRYPT_ROOT/include -I$RPM_ROOT/include"
37 eulisse 1.5 export LIBXML2_LIBS="-lxml2 -L$LIBXML2_ROOT/lib -L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}"
38 ratnik 1.1
39 eulisse 1.2 ./configure --prefix=%{i} --exec-prefix=%{i} \
40     --disable-nls \
41     --disable-dependency-tracking \
42     --without-libintl-prefix \
43 eulisse 1.31 --disable-docs \
44 eulisse 1.2 --disable-rpath
45 eulisse 1.6 make %makeprocesses
46 eulisse 1.7
47    
48 eulisse 1.6 %install
49     make install
50     mkdir -p %{i}/etc/profile.d
51     (echo "#!/bin/sh"; \
52     echo "source $RPM_ROOT/etc/profile.d/init.sh"; \
53     echo "source $LIBXML2_ROOT/etc/profile.d/init.sh" ) > %{i}/etc/profile.d/dependencies-setup.sh
54     (echo "#!/bin/tcsh"; \
55     echo "source $RPM_ROOT/etc/profile.d/init.csh"; \
56     echo "source $LIBXML2_ROOT/etc/profile.d/init.csh" ) > %{i}/etc/profile.d/dependencies-setup.csh
57 eulisse 1.7
58 eulisse 1.47
59 eulisse 1.25 mkdir -p %{i}/etc/apt
60 eulisse 1.24 cat << \EOF_APT_CONF > %{i}/etc/apt.conf
61 eulisse 1.7 Dir "%{instroot}"
62     {
63     // Location of the state dir
64     State "%{cmsplatf}/var/lib/apt/"
65     {
66     lists "lists/";
67     xstatus "xstatus";
68     userstatus "status.user";
69     status "var/lib/dpkg/status";
70     cdroms "cdroms.list";
71     };
72    
73     // Location of the cache dir
74     Cache "%{cmsplatf}/var/lib/cache" {
75     archives "%{cmsplatf}";
76     srcpkgcache "srcpkgcache.bin";
77     pkgcache "pkgcache.bin";
78     };
79    
80     // Locations of binaries
81     Bin {
82 eulisse 1.28 methods "%{i}/lib/apt/methods/";
83 eulisse 1.7 gzip "/bin/gzip";
84     dpkg "/usr/bin/dpkg";
85     dpkg-source "/usr/bin/dpkg-source";
86     dpkg-buildpackage "/usr/bin/dpkg-buildpackage";
87 eulisse 1.25 apt-get "%{i}/bin/apt-get-wrapper";
88     apt-cache "%{i}/bin/apt-cache-wrapper";
89     rpm "%{i}/bin/rpm-wrapper";
90 eulisse 1.7 };
91    
92    
93     // Config files
94 eulisse 1.28 Etc "%{cmsplatf}/external/apt/%{v}/etc/" {
95 eulisse 1.7 sourcelist "sources.list";
96     main "apt.conf";
97     preferences "preferences";
98     };
99     };
100    
101     Debug::pkgProblemResolver="1";
102    
103     RPM
104     {
105     PM "external";
106 eulisse 1.43 Options { };
107     Install-Options { "--force";"--prefix";"%{instroot}";"--ignoreos";"--ignorearch";};
108 eulisse 1.7 RootDir "%{instroot}";
109     Architecture "%{cmsplatf}";
110     };
111     EOF_APT_CONF
112    
113 eulisse 1.44
114 eulisse 1.25 cat << \EOF_SOURCES_LIST > %{i}/etc/sources.list
115 eulisse 1.41 rpm http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external
116     rpm-src http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external
117 eulisse 1.25 # This are defined to support experimental repositories. The bootstrap file rewrites and uncomments
118     # them when passed the appropriate commandline option.
119     ## rpm @SERVER@ @SERVER_PATH@/@REPOSITORY@/apt/%{cmsplatf} @GROUPS@
120     ## rpm-src @SERVER@ @SERVER_PATH@/@REPOSITORY@/apt/%{cmsplatf} @GROUPS@
121     EOF_SOURCES_LIST
122    
123     cat << \EOF_RPMPRIORITIES > %{i}/etc/rpmpriorities
124     Essantial:
125    
126     EOF_RPMPRIORITIES
127    
128     cat << \EOF_BIN_APT_CACHE_WRAPPER > %{i}/bin/apt-cache-wrapper
129     #!/bin/sh
130     touch %{instroot}/log.txt
131     echo $@ >> %{instroot}/log.txt
132     apt-cache $@
133     EOF_BIN_APT_CACHE_WRAPPER
134 eulisse 1.26 chmod +x %{i}/bin/apt-cache-wrapper
135 eulisse 1.25
136     cat << \EOF_BIN_APT_GET_WRAPPER > %{i}/bin/apt-get-wrapper
137     #!/bin/sh
138     touch %{instroot}/log.txt
139     echo $@ >> %{instroot}/log.txt
140     apt-get $@
141     EOF_BIN_APT_GET_WRAPPER
142 eulisse 1.26 chmod +x %{i}/bin/apt-get-wrapper
143 eulisse 1.25
144     cat << \EOF_BIN_RPM > %{i}/bin/rpm-wrapper
145     #!/bin/sh
146     if [ X"$(id -u)" = X0 ]; then
147     echo "*** CMS SOFTWARE INSTALLATION ABORTED ***" 1>&2
148     echo "CMS software cannot be installed as the super-user." 1>&2
149     echo "(We recommend reading any standard unix security guide.)" 1>&2
150     exit 1
151     fi
152     touch %{instroot}/log.txt
153     echo rpm ${1+"$@"} >> %{instroot}/log.txt
154     exec rpm ${1+"$@"}
155     EOF_BIN_RPM
156     chmod +x %{i}/bin/rpm-wrapper
157    
158 eulisse 1.16 cat %_sourcedir/bootstrap | perl -p -e "s!\@CMSPLATF\@!%{cmsplatf}!g;
159 eulisse 1.15 s!\@GCC_VERSION\@!$GCC_VERSION!g;
160     s!\@RPM_VERSION\@!$RPM_VERSION!g;
161     s!\@DB4_VERSION\@!$DB4_VERSION!g;
162     s!\@LIBXML2_VERSION\@!$LIBXML2_VERSION!g;
163     s!\@OPENSSL_VERSION\@!$OPENSSL_VERSION!g;
164     s!\@BEECRYPT_VERSION\@!$BEECRYPT_VERSION!g;
165     s!\@BZ2LIB_VERSION\@!$BZ2LIB_VERSION!g;
166     s!\@ZLIB_VERSION\@!$ZLIB_VERSION!g;
167     s!\@EXPAT_VERSION\@!$EXPAT_VERSION!g;
168     s!\@ELFUTILS_VERSION\@!$ELFUTILS_VERSION!g;
169     s!\@NEON_VERSION\@!$NEON_VERSION!g;
170     s!\@GCC_REVISION\@!$GCC_REVISION!g;
171     s!\@BEECRYPT_REVISION\@!$BEECRYPT_REVISION!g;
172     s!\@RPM_REVISION\@!$RPM_REVISION!g;
173     s!\@OPENSSL_REVISION\@!$OPENSSL_REVISION!g;
174     s!\@DB4_REVISION\@!$DB4_REVISION!g;
175     s!\@LIBXML2_REVISION\@!$LIBXML2_REVISION!g;
176     s!\@BZ2LIB_REVISION\@!$BZ2LIB_REVISION!g;
177     s!\@ZLIB_REVISION\@!$ZLIB_REVISION!g;
178     s!\@EXPAT_REVISION\@!$EXPAT_REVISION!g;
179     s!\@NEON_REVISION\@!$NEON_REVISION!g;
180     s!\@ELFUTILS_REVISION\@!$ELFUTILS_REVISION!g;
181     s!\@APT_VERSION\@!%{v}!g;
182     s!\@APT_REVISION\@!%{pkgrevision}!g;
183     s!\@INSTROOT\@!%{instroot}!g;
184 eulisse 1.26 " > %{i}/bin/bootstrap-%{cmsplatf}.sh
185 eulisse 1.8
186 eulisse 1.48 cat %_sourcedir/cms-apt-migration | perl -p -i -e "s!\@CMSPLATF\@!%{cmsplatf}!g;
187     s!\@GCC_VERSION\@!$GCC_VERSION!g;
188     s!\@RPM_VERSION\@!$RPM_VERSION!g;
189     s!\@DB4_VERSION\@!$DB4_VERSION!g;
190     s!\@LIBXML2_VERSION\@!$LIBXML2_VERSION!g;
191     s!\@OPENSSL_VERSION\@!$OPENSSL_VERSION!g;
192     s!\@BEECRYPT_VERSION\@!$BEECRYPT_VERSION!g;
193     s!\@BZ2LIB_VERSION\@!$BZ2LIB_VERSION!g;
194     s!\@ZLIB_VERSION\@!$ZLIB_VERSION!g;
195     s!\@EXPAT_VERSION\@!$EXPAT_VERSION!g;
196     s!\@ELFUTILS_VERSION\@!$ELFUTILS_VERSION!g;
197     s!\@NEON_VERSION\@!$NEON_VERSION!g;
198     s!\@GCC_REVISION\@!$GCC_REVISION!g;
199     s!\@BEECRYPT_REVISION\@!$BEECRYPT_REVISION!g;
200     s!\@RPM_REVISION\@!$RPM_REVISION!g;
201     s!\@OPENSSL_REVISION\@!$OPENSSL_REVISION!g;
202     s!\@DB4_REVISION\@!$DB4_REVISION!g;
203     s!\@LIBXML2_REVISION\@!$LIBXML2_REVISION!g;
204     s!\@BZ2LIB_REVISION\@!$BZ2LIB_REVISION!g;
205     s!\@ZLIB_REVISION\@!$ZLIB_REVISION!g;
206     s!\@EXPAT_REVISION\@!$EXPAT_REVISION!g;
207     s!\@NEON_REVISION\@!$NEON_REVISION!g;
208     s!\@ELFUTILS_REVISION\@!$ELFUTILS_REVISION!g;
209     s!\@APT_VERSION\@!%{v}!g;
210     s!\@APT_REVISION\@!%{pkgrevision}!g;
211     s!\@INSTROOT\@!%{instroot}!g;" %{i}/bin/cms-apt-migration-%{cmsplatf}.sh
212    
213 eulisse 1.6 %post
214 eulisse 1.8 mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/apt/lists/partial
215     mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm
216     mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf}/partial
217 eulisse 1.24 mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc
218 eulisse 1.8 mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/rpm
219     mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/lib/apt/methods
220     mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/dpkg/status
221     mkdir -p $RPM_INSTALL_PREFIX/bin
222     mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf}
223 eulisse 1.6 %{relocateConfig}etc/profile.d/dependencies-setup.sh
224     %{relocateConfig}etc/profile.d/dependencies-setup.csh
225 eulisse 1.25 %{relocateConfig}bin/apt-cache-wrapper
226     %{relocateConfig}bin/apt-get-wrapper
227     %{relocateConfig}bin/rpm-wrapper
228 eulisse 1.29 %{relocateConfig}etc/apt.conf