1 |
< |
### RPM external apt 0.5.15lorg3.2 |
2 |
< |
## INITENV SET APT_CONFIG %{i}/etc/apt/apt.conf |
1 |
> |
### RPM external apt 0.5.15lorg3.2-CMS3 |
2 |
> |
## INITENV SET APT_CONFIG %{i}/etc/apt.conf |
3 |
|
|
4 |
< |
Source: http://apt-rpm.org/releases/%n-%v.tar.bz2 |
4 |
> |
Source: http://apt-rpm.org/releases/%n-%realversion.tar.bz2 |
5 |
|
Source1: bootstrap |
6 |
< |
Patch0: apt-rpm449 |
6 |
> |
Source2: cms-apt-migration |
7 |
|
Requires: libxml2 beecrypt rpm zlib bz2lib openssl |
8 |
+ |
Patch0: apt-rpm449 |
9 |
+ |
Patch1: apt-rpm446 |
10 |
+ |
Patch2: apt |
11 |
+ |
|
12 |
|
%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 |
|
|
18 |
+ |
|
19 |
|
%prep |
20 |
|
%setup -n %n-%{realversion} |
21 |
+ |
case $RPM_VERSION in |
22 |
+ |
4.4.9*) |
23 |
|
%patch0 -p0 |
24 |
+ |
;; |
25 |
+ |
4.4.6*) |
26 |
+ |
%patch1 -p0 |
27 |
+ |
;; |
28 |
+ |
esac |
29 |
+ |
|
30 |
+ |
# scandir has a different prototype between macosx and linux. |
31 |
+ |
%if "%(uname)" == "Darwin" |
32 |
+ |
%patch2 -p1 |
33 |
+ |
%endif |
34 |
+ |
|
35 |
|
%build |
36 |
< |
export CPPFLAGS="-I$BEECRYPT_ROOT/include -I$RPM_ROOT/include -I$RPM_ROOT/include/rpm" |
37 |
< |
export LDFLAGS="-L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}" |
36 |
> |
export CFLAGS="-O0 -g" |
37 |
> |
export CXXFLAGS="-O0 -g" |
38 |
> |
export CPPFLAGS="-I$BZ2LIB_ROOT/include -I$BEECRYPT_ROOT/include -I$RPM_ROOT/include -I$RPM_ROOT/include/rpm" |
39 |
> |
export LDFLAGS="-L$BZ2LIB_ROOT/lib -L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}" |
40 |
|
export LIBDIR="$LIBS" |
41 |
|
export LIBXML2_CFLAGS="-I$LIBXML2_ROOT/include/libxml2 -I$BEECRYPT_ROOT/include -I$RPM_ROOT/include" |
42 |
|
export LIBXML2_LIBS="-lxml2 -L$LIBXML2_ROOT/lib -L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}" |
45 |
|
--disable-nls \ |
46 |
|
--disable-dependency-tracking \ |
47 |
|
--without-libintl-prefix \ |
48 |
+ |
--disable-docs \ |
49 |
|
--disable-rpath |
50 |
|
make %makeprocesses |
51 |
|
|
60 |
|
echo "source $RPM_ROOT/etc/profile.d/init.csh"; \ |
61 |
|
echo "source $LIBXML2_ROOT/etc/profile.d/init.csh" ) > %{i}/etc/profile.d/dependencies-setup.csh |
62 |
|
|
63 |
+ |
|
64 |
|
mkdir -p %{i}/etc/apt |
65 |
< |
cat << \EOF_APT_CONF > %{i}/etc/apt/apt.conf |
65 |
> |
cat << \EOF_APT_CONF > %{i}/etc/apt.conf |
66 |
|
Dir "%{instroot}" |
67 |
|
{ |
68 |
|
// Location of the state dir |
84 |
|
|
85 |
|
// Locations of binaries |
86 |
|
Bin { |
87 |
< |
methods "%{i}%{libdir}/apt/methods/"; |
87 |
> |
methods "%{i}/lib/apt/methods/"; |
88 |
|
gzip "/bin/gzip"; |
89 |
|
dpkg "/usr/bin/dpkg"; |
90 |
|
dpkg-source "/usr/bin/dpkg-source"; |
91 |
|
dpkg-buildpackage "/usr/bin/dpkg-buildpackage"; |
92 |
< |
apt-get "%{instroot}/bin/apt-get-wrapper"; |
93 |
< |
apt-cache "%{instroot}/bin/apt-cache-wrapper"; |
94 |
< |
rpm "%{instroot}/bin/rpm-wrapper"; |
92 |
> |
apt-get "%{i}/bin/apt-get-wrapper"; |
93 |
> |
apt-cache "%{i}/bin/apt-cache-wrapper"; |
94 |
> |
rpm "%{i}/bin/rpm-wrapper"; |
95 |
|
}; |
96 |
|
|
97 |
|
|
98 |
|
// Config files |
99 |
< |
Etc "%{cmsplatf}/etc/apt/" { |
99 |
> |
Etc "%{cmsplatf}/external/apt/%{v}/etc/" { |
100 |
|
sourcelist "sources.list"; |
101 |
|
main "apt.conf"; |
102 |
|
preferences "preferences"; |
108 |
|
RPM |
109 |
|
{ |
110 |
|
PM "external"; |
111 |
< |
Options { "--define";"_rpmlock_path %{instroot}/%{cmsplatf}/var/lib/rpm/lock";"--dbpath";"%{instroot}/var/lib/rpm";"--nodeps";}; |
112 |
< |
Install-Options { "--define";"_rpmlock_path %{instroot}/%{cmsplatf}/var/lib/rpm/lock";"--nodeps";"--force";"--dbpath";"%{instroot}/%{cmsplatf}/var/lib/rpm";"--prefix";"%{instroot}";}; |
111 |
> |
Options { }; |
112 |
> |
Install-Options { "--force";"--prefix";"%{instroot}";"--ignoreos";"--ignorearch";}; |
113 |
|
RootDir "%{instroot}"; |
114 |
|
Architecture "%{cmsplatf}"; |
115 |
|
}; |
116 |
|
EOF_APT_CONF |
117 |
|
|
96 |
– |
cat %_sourcedir/bootstrap | perl -p -e "s/\@CMSPLATF\@/%{cmsplatf}/; |
97 |
– |
s/\@GCC_VERSION\@/$GCC_VERSION/; |
98 |
– |
s/\@RPM_VERSION\@/$RPM_VERSION/; |
99 |
– |
s/\@DB4_VERSION\@/$DB4_VERSION/; |
100 |
– |
s/\@LIBXML2_VERSION\@/$LIBXML2_VERSION/; |
101 |
– |
s/\@OPENSSL_VERSION\@/$OPENSSL_VERSION/; |
102 |
– |
s/\@BEECRYPT_VERSION\@/$BEECRYPT_VERSION/; |
103 |
– |
s/\@BZ2LIB_VERSION\@/$BZ2LIB_VERSION/; |
104 |
– |
s/\@ZLIB_VERSION\@/$ZLIB_VERSION/; |
105 |
– |
s/\@EXPAT_VERSION\@/$EXPAT_VERSION/; |
106 |
– |
s/\@ELFUTILS_VERSION\@/$ELFUTILS_VERSION/; |
107 |
– |
s/\@NEON_VERSION\@/$NEON_VERSION/; |
108 |
– |
s/\@GCC_REVISION\@/$GCC_REVISION/; |
109 |
– |
s/\@BEECRYPT_REVISION\@/$BEECRYPT_REVISION/; |
110 |
– |
s/\@RPM_REVISION\@/$RPM_REVISION/; |
111 |
– |
s/\@OPENSSL_REVISION\@/$OPENSSL_REVISION/; |
112 |
– |
s/\@DB4_REVISION\@/$DB4_REVISION/; |
113 |
– |
s/\@LIBXML2_REVISION\@/$LIBXML2_REVISION/; |
114 |
– |
s/\@BZ2LIB_REVISION\@/$BZ2LIB_REVISION/; |
115 |
– |
s/\@ZLIB_REVISION\@/$ZLIB_REVISION/; |
116 |
– |
s/\@EXPAT_REVISION\@/$EXPAT_REVISION/; |
117 |
– |
s/\@NEON_REVISION\@/$NEON_REVISION/; |
118 |
– |
s/\@ELFUTILS_REVISION\@/$ELFUTILS_REVISION/; |
119 |
– |
s/\@APT_VERSION\@/%{v}/; |
120 |
– |
s/\@APT_REVISION\@/%{pkgrevision}/; |
121 |
– |
" > %{instroot}/bootstrap-%{cmsplatf}.sh |
118 |
|
|
119 |
< |
%post |
120 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/apt/lists/partial |
121 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm |
122 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf}/partial |
123 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt |
124 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/rpm |
125 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/lib/apt/methods |
126 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/dpkg/status |
131 |
< |
mkdir -p $RPM_INSTALL_PREFIX/bin |
132 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf} |
119 |
> |
cat << \EOF_SOURCES_LIST > %{i}/etc/sources.list |
120 |
> |
rpm http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
121 |
> |
rpm-src http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
122 |
> |
# This are defined to support experimental repositories. The bootstrap file rewrites and uncomments |
123 |
> |
# them when passed the appropriate commandline option. |
124 |
> |
## rpm @SERVER@ @SERVER_PATH@/@REPOSITORY@/apt/%{cmsplatf} @GROUPS@ |
125 |
> |
## rpm-src @SERVER@ @SERVER_PATH@/@REPOSITORY@/apt/%{cmsplatf} @GROUPS@ |
126 |
> |
EOF_SOURCES_LIST |
127 |
|
|
128 |
< |
cat << \EOF_BIN_APT_CACHE_WRAPPER > $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper |
128 |
> |
cat << \EOF_RPMPRIORITIES > %{i}/etc/rpmpriorities |
129 |
> |
Essantial: |
130 |
> |
|
131 |
> |
EOF_RPMPRIORITIES |
132 |
> |
|
133 |
> |
cat << \EOF_BIN_APT_CACHE_WRAPPER > %{i}/bin/apt-cache-wrapper |
134 |
|
#!/bin/sh |
135 |
|
touch %{instroot}/log.txt |
136 |
|
echo $@ >> %{instroot}/log.txt |
137 |
< |
apt-cache $@ |
137 |
> |
apt-cache $@ |
138 |
|
EOF_BIN_APT_CACHE_WRAPPER |
139 |
< |
chmod +x $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper |
139 |
> |
chmod +x %{i}/bin/apt-cache-wrapper |
140 |
|
|
141 |
< |
cat << \EOF_BIN_APT_GET_WRAPPER > $RPM_INSTALL_PREFIX/bin/apt-get-wrapper |
141 |
> |
cat << \EOF_BIN_APT_GET_WRAPPER > %{i}/bin/apt-get-wrapper |
142 |
|
#!/bin/sh |
143 |
|
touch %{instroot}/log.txt |
144 |
|
echo $@ >> %{instroot}/log.txt |
145 |
< |
apt-get $@ |
145 |
> |
apt-get $@ |
146 |
|
EOF_BIN_APT_GET_WRAPPER |
147 |
< |
chmod +x $RPM_INSTALL_PREFIX/bin/apt-get-wrapper |
149 |
< |
|
150 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt |
151 |
< |
cat << \EOF_RPMPRIORITIES > $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt/rpmpriorities |
152 |
< |
Essantial: |
153 |
< |
|
154 |
< |
EOF_RPMPRIORITIES |
147 |
> |
chmod +x %{i}/bin/apt-get-wrapper |
148 |
|
|
149 |
< |
cat << \EOF_SOURCES_LIST > $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt/sources.list |
150 |
< |
rpm http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
151 |
< |
rpm-src http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
152 |
< |
EOF_SOURCES_LIST |
153 |
< |
|
154 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm |
155 |
< |
|
163 |
< |
# FIXME: this is the ugliest trick ever found in a shell script. |
164 |
< |
# This is my understanding of the situation. |
165 |
< |
# apt runs internally as if --root != / while uses rpm with |
166 |
< |
# --root $rootdir but --dbpath is always passed as $rootdir/$rpmdb. |
167 |
< |
# This way the rpm db is sometimes in $rootdir/$rpmdb, sometimes in |
168 |
< |
# $rootdir/$rootdir/$rpmdb and files are scattered around, causing |
169 |
< |
# big confusion. The solution is.... to create a link so that $rootdir/$rootdir |
170 |
< |
# is actually $rootdir. Clear, isn't it? If not, I don't blame you, but |
171 |
< |
# this is the only way I could make it working. I need to look at the apt code to |
172 |
< |
# (and probably fix it) to understand it better. For the time being.... |
173 |
< |
# TODO: check if this still applies with this version of apt-get |
174 |
< |
# TODO: check if we can fix the problem by patching apt sources. |
175 |
< |
|
176 |
< |
firstdir=$(echo $RPM_INSTALL_PREFIX | cut -d/ -f1,2) |
177 |
< |
if [ -f $RPM_INSTALL_PREFIX$firstdir ] |
178 |
< |
then |
179 |
< |
echo "Hack to enable apt working as user" |
180 |
< |
ln -sf $firstdir $RPM_INSTALL_PREFIX$firstdir |
149 |
> |
cat << \EOF_BIN_RPM > %{i}/bin/rpm-wrapper |
150 |
> |
#!/bin/sh |
151 |
> |
if [ X"$(id -u)" = X0 ]; then |
152 |
> |
echo "*** CMS SOFTWARE INSTALLATION ABORTED ***" 1>&2 |
153 |
> |
echo "CMS software cannot be installed as the super-user." 1>&2 |
154 |
> |
echo "(We recommend reading any standard unix security guide.)" 1>&2 |
155 |
> |
exit 1 |
156 |
|
fi |
157 |
+ |
touch %{instroot}/log.txt |
158 |
+ |
echo rpm ${1+"$@"} >> %{instroot}/log.txt |
159 |
+ |
exec rpm ${1+"$@"} |
160 |
+ |
EOF_BIN_RPM |
161 |
+ |
chmod +x %{i}/bin/rpm-wrapper |
162 |
+ |
|
163 |
+ |
cat %_sourcedir/bootstrap | perl -p -e "s!\@CMSPLATF\@!%{cmsplatf}!g; |
164 |
+ |
s!\@GCC_VERSION\@!$GCC_VERSION!g; |
165 |
+ |
s!\@RPM_VERSION\@!$RPM_VERSION!g; |
166 |
+ |
s!\@DB4_VERSION\@!$DB4_VERSION!g; |
167 |
+ |
s!\@LIBXML2_VERSION\@!$LIBXML2_VERSION!g; |
168 |
+ |
s!\@OPENSSL_VERSION\@!$OPENSSL_VERSION!g; |
169 |
+ |
s!\@BEECRYPT_VERSION\@!$BEECRYPT_VERSION!g; |
170 |
+ |
s!\@BZ2LIB_VERSION\@!$BZ2LIB_VERSION!g; |
171 |
+ |
s!\@ZLIB_VERSION\@!$ZLIB_VERSION!g; |
172 |
+ |
s!\@EXPAT_VERSION\@!$EXPAT_VERSION!g; |
173 |
+ |
s!\@ELFUTILS_VERSION\@!$ELFUTILS_VERSION!g; |
174 |
+ |
s!\@NEON_VERSION\@!$NEON_VERSION!g; |
175 |
+ |
s!\@GCC_REVISION\@!$GCC_REVISION!g; |
176 |
+ |
s!\@BEECRYPT_REVISION\@!$BEECRYPT_REVISION!g; |
177 |
+ |
s!\@RPM_REVISION\@!$RPM_REVISION!g; |
178 |
+ |
s!\@OPENSSL_REVISION\@!$OPENSSL_REVISION!g; |
179 |
+ |
s!\@DB4_REVISION\@!$DB4_REVISION!g; |
180 |
+ |
s!\@LIBXML2_REVISION\@!$LIBXML2_REVISION!g; |
181 |
+ |
s!\@BZ2LIB_REVISION\@!$BZ2LIB_REVISION!g; |
182 |
+ |
s!\@ZLIB_REVISION\@!$ZLIB_REVISION!g; |
183 |
+ |
s!\@EXPAT_REVISION\@!$EXPAT_REVISION!g; |
184 |
+ |
s!\@NEON_REVISION\@!$NEON_REVISION!g; |
185 |
+ |
s!\@ELFUTILS_REVISION\@!$ELFUTILS_REVISION!g; |
186 |
+ |
s!\@APT_VERSION\@!%{v}!g; |
187 |
+ |
s!\@APT_REVISION\@!%{pkgrevision}!g; |
188 |
+ |
s!\@INSTROOT\@!%{instroot}!g; |
189 |
+ |
" > %{i}/bin/bootstrap-%{cmsplatf}.sh |
190 |
+ |
|
191 |
+ |
cat %_sourcedir/cms-apt-migration | perl -p -i -e "s!\@CMSPLATF\@!%{cmsplatf}!g; |
192 |
+ |
s!\@GCC_VERSION\@!$GCC_VERSION!g; |
193 |
+ |
s!\@RPM_VERSION\@!$RPM_VERSION!g; |
194 |
+ |
s!\@DB4_VERSION\@!$DB4_VERSION!g; |
195 |
+ |
s!\@LIBXML2_VERSION\@!$LIBXML2_VERSION!g; |
196 |
+ |
s!\@OPENSSL_VERSION\@!$OPENSSL_VERSION!g; |
197 |
+ |
s!\@BEECRYPT_VERSION\@!$BEECRYPT_VERSION!g; |
198 |
+ |
s!\@BZ2LIB_VERSION\@!$BZ2LIB_VERSION!g; |
199 |
+ |
s!\@ZLIB_VERSION\@!$ZLIB_VERSION!g; |
200 |
+ |
s!\@EXPAT_VERSION\@!$EXPAT_VERSION!g; |
201 |
+ |
s!\@ELFUTILS_VERSION\@!$ELFUTILS_VERSION!g; |
202 |
+ |
s!\@NEON_VERSION\@!$NEON_VERSION!g; |
203 |
+ |
s!\@GCC_REVISION\@!$GCC_REVISION!g; |
204 |
+ |
s!\@BEECRYPT_REVISION\@!$BEECRYPT_REVISION!g; |
205 |
+ |
s!\@RPM_REVISION\@!$RPM_REVISION!g; |
206 |
+ |
s!\@OPENSSL_REVISION\@!$OPENSSL_REVISION!g; |
207 |
+ |
s!\@DB4_REVISION\@!$DB4_REVISION!g; |
208 |
+ |
s!\@LIBXML2_REVISION\@!$LIBXML2_REVISION!g; |
209 |
+ |
s!\@BZ2LIB_REVISION\@!$BZ2LIB_REVISION!g; |
210 |
+ |
s!\@ZLIB_REVISION\@!$ZLIB_REVISION!g; |
211 |
+ |
s!\@EXPAT_REVISION\@!$EXPAT_REVISION!g; |
212 |
+ |
s!\@NEON_REVISION\@!$NEON_REVISION!g; |
213 |
+ |
s!\@ELFUTILS_REVISION\@!$ELFUTILS_REVISION!g; |
214 |
+ |
s!\@APT_VERSION\@!%{v}!g; |
215 |
+ |
s!\@APT_REVISION\@!%{pkgrevision}!g; |
216 |
+ |
s!\@INSTROOT\@!%{instroot}!g;" %{i}/bin/cms-apt-migration-%{cmsplatf}.sh |
217 |
|
|
218 |
+ |
%post |
219 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/apt/lists/partial |
220 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm |
221 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf}/partial |
222 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc |
223 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/rpm |
224 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/lib/apt/methods |
225 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/dpkg/status |
226 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/bin |
227 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf} |
228 |
|
%{relocateConfig}etc/profile.d/dependencies-setup.sh |
229 |
|
%{relocateConfig}etc/profile.d/dependencies-setup.csh |
230 |
< |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|" $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper $RPM_INSTALL_PREFIX/bin/apt-get-wrapper |
231 |
< |
%files |
232 |
< |
%{i} |
233 |
< |
%{instroot}/bootstrap-%{cmsplatf}.sh |
189 |
< |
%{instroot}/%{cmsplatf}/var/lib/rpm |
230 |
> |
%{relocateConfig}bin/apt-cache-wrapper |
231 |
> |
%{relocateConfig}bin/apt-get-wrapper |
232 |
> |
%{relocateConfig}bin/rpm-wrapper |
233 |
> |
%{relocateConfig}etc/apt.conf |