1 |
< |
### RPM external apt 0.5.15lorg3.2 |
2 |
< |
## INITENV SET APT_CONFIG %{i}/etc/apt/apt.conf |
3 |
< |
|
4 |
< |
Source: http://apt-rpm.org/releases/%n-%v.tar.bz2 |
1 |
> |
### RPM external apt 0.5.15lorg3.2-CMS18 |
2 |
> |
## INITENV SET APT_CONFIG %{i}/etc/apt.conf |
3 |
> |
Source: http://apt-rpm.org/releases/%n-%realversion.tar.bz2 |
4 |
|
Source1: bootstrap |
5 |
+ |
|
6 |
+ |
%define requires libxml2 beecrypt rpm zlib bz2lib openssl |
7 |
+ |
|
8 |
+ |
%if "%(echo %{cmsos} | sed -e 's|slc.online_.*|online|')" == "online" |
9 |
+ |
%define requires libxml2 beecrypt rpm bz2lib |
10 |
+ |
%endif |
11 |
+ |
|
12 |
+ |
Requires: %requires |
13 |
+ |
|
14 |
|
Patch0: apt-rpm449 |
15 |
< |
Requires: libxml2 beecrypt rpm zlib bz2lib openssl |
15 |
> |
Patch1: apt-rpm446 |
16 |
> |
Patch2: apt |
17 |
> |
Patch3: apt-multiarch |
18 |
|
%if "%(echo %{cmsos} | cut -d_ -f 2 | sed -e 's|.*64.*|64|')" == "64" |
19 |
|
%define libdir lib64 |
20 |
|
%else |
23 |
|
|
24 |
|
%prep |
25 |
|
%setup -n %n-%{realversion} |
26 |
+ |
case $RPM_VERSION in |
27 |
+ |
4.4.9*) |
28 |
|
%patch0 -p0 |
29 |
+ |
;; |
30 |
+ |
4.4.6*) |
31 |
+ |
%patch1 -p0 |
32 |
+ |
;; |
33 |
+ |
esac |
34 |
+ |
|
35 |
+ |
# scandir has a different prototype between macosx and linux. |
36 |
+ |
case %cmsplatf in |
37 |
+ |
osx*) |
38 |
+ |
%patch2 -p1 |
39 |
+ |
;; |
40 |
+ |
esac |
41 |
+ |
|
42 |
+ |
%patch3 -p1 |
43 |
+ |
|
44 |
|
%build |
45 |
< |
export CPPFLAGS="-I$BEECRYPT_ROOT/include -I$RPM_ROOT/include -I$RPM_ROOT/include/rpm" |
46 |
< |
export LDFLAGS="-L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}" |
45 |
> |
export CFLAGS="-O0 -g" |
46 |
> |
export CXXFLAGS="-O0 -g" |
47 |
> |
export CPPFLAGS="-I$BZ2LIB_ROOT/include -I$BEECRYPT_ROOT/include -I$RPM_ROOT/include -I$RPM_ROOT/include/rpm" |
48 |
> |
export LDFLAGS="-L$BZ2LIB_ROOT/lib -L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}" |
49 |
|
export LIBDIR="$LIBS" |
50 |
|
export LIBXML2_CFLAGS="-I$LIBXML2_ROOT/include/libxml2 -I$BEECRYPT_ROOT/include -I$RPM_ROOT/include" |
51 |
|
export LIBXML2_LIBS="-lxml2 -L$LIBXML2_ROOT/lib -L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}" |
54 |
|
--disable-nls \ |
55 |
|
--disable-dependency-tracking \ |
56 |
|
--without-libintl-prefix \ |
57 |
+ |
--disable-docs \ |
58 |
|
--disable-rpath |
59 |
|
make %makeprocesses |
60 |
|
|
62 |
|
%install |
63 |
|
make install |
64 |
|
mkdir -p %{i}/etc/profile.d |
65 |
+ |
|
66 |
|
(echo "#!/bin/sh"; \ |
67 |
|
echo "source $RPM_ROOT/etc/profile.d/init.sh"; \ |
68 |
|
echo "source $LIBXML2_ROOT/etc/profile.d/init.sh" ) > %{i}/etc/profile.d/dependencies-setup.sh |
70 |
|
echo "source $RPM_ROOT/etc/profile.d/init.csh"; \ |
71 |
|
echo "source $LIBXML2_ROOT/etc/profile.d/init.csh" ) > %{i}/etc/profile.d/dependencies-setup.csh |
72 |
|
|
73 |
+ |
cp %_sourcedir/bootstrap %{i}/bin/bootstrap.sh |
74 |
+ |
|
75 |
|
mkdir -p %{i}/etc/apt |
76 |
< |
cat << \EOF_APT_CONF > %{i}/etc/apt/apt.conf |
76 |
> |
cat << \EOF_APT_CONF > %{i}/etc/apt.conf |
77 |
|
Dir "%{instroot}" |
78 |
|
{ |
79 |
|
// Location of the state dir |
95 |
|
|
96 |
|
// Locations of binaries |
97 |
|
Bin { |
98 |
< |
methods "%{i}%{libdir}/apt/methods/"; |
98 |
> |
methods "%{i}/lib/apt/methods/"; |
99 |
|
gzip "/bin/gzip"; |
100 |
|
dpkg "/usr/bin/dpkg"; |
101 |
|
dpkg-source "/usr/bin/dpkg-source"; |
102 |
|
dpkg-buildpackage "/usr/bin/dpkg-buildpackage"; |
103 |
< |
apt-get "%{instroot}/bin/apt-get-wrapper"; |
104 |
< |
apt-cache "%{instroot}/bin/apt-cache-wrapper"; |
105 |
< |
rpm "%{instroot}/bin/rpm-wrapper"; |
103 |
> |
apt-get "%{i}/bin/apt-get-wrapper"; |
104 |
> |
apt-cache "%{i}/bin/apt-cache-wrapper"; |
105 |
> |
rpm "%{i}/bin/rpm-wrapper"; |
106 |
|
}; |
107 |
|
|
108 |
|
|
109 |
|
// Config files |
110 |
< |
Etc "%{cmsplatf}/etc/apt/" { |
110 |
> |
Etc "%{cmsplatf}/external/apt/%{v}/etc/" { |
111 |
|
sourcelist "sources.list"; |
112 |
|
main "apt.conf"; |
113 |
|
preferences "preferences"; |
119 |
|
RPM |
120 |
|
{ |
121 |
|
PM "external"; |
122 |
< |
Options { "--define";"_rpmlock_path %{instroot}/%{cmsplatf}/var/lib/rpm/lock";"--dbpath";"%{instroot}/var/lib/rpm";"--nodeps";}; |
123 |
< |
Install-Options { "--define";"_rpmlock_path %{instroot}/%{cmsplatf}/var/lib/rpm/lock";"--nodeps";"--force";"--dbpath";"%{instroot}/%{cmsplatf}/var/lib/rpm";"--prefix";"%{instroot}";}; |
122 |
> |
Options { }; |
123 |
> |
Install-Options { "--force";"--prefix";"%{instroot}";"--ignoreos";"--ignorearch";}; |
124 |
|
RootDir "%{instroot}"; |
125 |
|
Architecture "%{cmsplatf}"; |
126 |
|
}; |
127 |
|
EOF_APT_CONF |
128 |
|
|
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 |
122 |
– |
|
123 |
– |
%post |
124 |
– |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/apt/lists/partial |
125 |
– |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm |
126 |
– |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf}/partial |
127 |
– |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt |
128 |
– |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/rpm |
129 |
– |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/lib/apt/methods |
130 |
– |
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} |
129 |
|
|
130 |
< |
cat << \EOF_BIN_APT_CACHE_WRAPPER > $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper |
131 |
< |
#!/bin/sh |
132 |
< |
touch %{instroot}/log.txt |
133 |
< |
echo $@ >> %{instroot}/log.txt |
134 |
< |
apt-cache $@ |
135 |
< |
EOF_BIN_APT_CACHE_WRAPPER |
136 |
< |
chmod +x $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper |
137 |
< |
|
142 |
< |
cat << \EOF_BIN_APT_GET_WRAPPER > $RPM_INSTALL_PREFIX/bin/apt-get-wrapper |
143 |
< |
#!/bin/sh |
144 |
< |
touch %{instroot}/log.txt |
145 |
< |
echo $@ >> %{instroot}/log.txt |
146 |
< |
apt-get $@ |
147 |
< |
EOF_BIN_APT_GET_WRAPPER |
148 |
< |
chmod +x $RPM_INSTALL_PREFIX/bin/apt-get-wrapper |
130 |
> |
cat << \EOF_SOURCES_LIST > %{i}/etc/sources.list |
131 |
> |
rpm http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
132 |
> |
rpm-src http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
133 |
> |
# This are defined to support experimental repositories. The bootstrap file rewrites and uncomments |
134 |
> |
# them when passed the appropriate commandline option. |
135 |
> |
##rpm http://@SERVER@ @SERVER_PATH@@REPOSITORY@/apt/%{cmsplatf} @GROUPS@ |
136 |
> |
##rpm-src http://@SERVER@ @SERVER_PATH@@REPOSITORY@/apt/%{cmsplatf} @GROUPS@ |
137 |
> |
EOF_SOURCES_LIST |
138 |
|
|
139 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt |
151 |
< |
cat << \EOF_RPMPRIORITIES > $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt/rpmpriorities |
139 |
> |
cat << \EOF_RPMPRIORITIES > %{i}/etc/rpmpriorities |
140 |
|
Essantial: |
141 |
|
|
142 |
|
EOF_RPMPRIORITIES |
143 |
|
|
144 |
< |
cat << \EOF_SOURCES_LIST > $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt/sources.list |
145 |
< |
rpm http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
146 |
< |
rpm-src http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
147 |
< |
EOF_SOURCES_LIST |
144 |
> |
cat << \EOF_BIN_APT_CACHE_WRAPPER > %{i}/bin/apt-cache-wrapper |
145 |
> |
#!/bin/sh |
146 |
> |
mkdir -p %{instroot}/var/log/rpm |
147 |
> |
touch %{instroot}/var/log/rpm/log.txt |
148 |
> |
echo $@ >> %{instroot}/var/log/rpm/log.txt |
149 |
> |
apt-cache $@ |
150 |
> |
EOF_BIN_APT_CACHE_WRAPPER |
151 |
> |
chmod +x %{i}/bin/apt-cache-wrapper |
152 |
|
|
153 |
< |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm |
153 |
> |
cat << \EOF_BIN_APT_GET_WRAPPER > %{i}/bin/apt-get-wrapper |
154 |
> |
#!/bin/sh |
155 |
> |
mkdir -p %{instroot}/var/log/rpm |
156 |
> |
touch %{instroot}/var/log/rpm/log.txt |
157 |
> |
echo $@ >> %{instroot}/var/log/rpm/log.txt |
158 |
> |
apt-get $@ |
159 |
> |
EOF_BIN_APT_GET_WRAPPER |
160 |
> |
chmod +x %{i}/bin/apt-get-wrapper |
161 |
|
|
162 |
< |
# FIXME: this is the ugliest trick ever found in a shell script. |
163 |
< |
# This is my understanding of the situation. |
164 |
< |
# apt runs internally as if --root != / while uses rpm with |
165 |
< |
# --root $rootdir but --dbpath is always passed as $rootdir/$rpmdb. |
166 |
< |
# This way the rpm db is sometimes in $rootdir/$rpmdb, sometimes in |
167 |
< |
# $rootdir/$rootdir/$rpmdb and files are scattered around, causing |
168 |
< |
# 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 |
162 |
> |
cat << \EOF_BIN_RPM > %{i}/bin/rpm-wrapper |
163 |
> |
#!/bin/sh |
164 |
> |
if [ X"$(id -u)" = X0 ]; then |
165 |
> |
echo "*** CMS SOFTWARE INSTALLATION ABORTED ***" 1>&2 |
166 |
> |
echo "CMS software cannot be installed as the super-user." 1>&2 |
167 |
> |
echo "(We recommend reading any standard unix security guide.)" 1>&2 |
168 |
> |
exit 1 |
169 |
|
fi |
170 |
+ |
mkdir -p %{instroot}/var/log/rpm |
171 |
+ |
touch %{instroot}/var/log/rpm/log.txt |
172 |
+ |
echo rpm ${1+"$@"} >> %{instroot}/var/log/rpm/log.txt |
173 |
+ |
exec rpm ${1+"$@"} |
174 |
+ |
EOF_BIN_RPM |
175 |
+ |
chmod +x %{i}/bin/rpm-wrapper |
176 |
|
|
177 |
+ |
%post |
178 |
+ |
ln -sf %{v} $RPM_INSTALL_PREFIX/%{cmsplatf}/external/apt/latest |
179 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/apt/lists/partial |
180 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm |
181 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf}/partial |
182 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc |
183 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/rpm |
184 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/lib/apt/methods |
185 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/dpkg/status |
186 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/bin |
187 |
+ |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf} |
188 |
|
%{relocateConfig}etc/profile.d/dependencies-setup.sh |
189 |
|
%{relocateConfig}etc/profile.d/dependencies-setup.csh |
190 |
< |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|" $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper $RPM_INSTALL_PREFIX/bin/apt-get-wrapper |
191 |
< |
%files |
192 |
< |
%{i} |
193 |
< |
%{instroot}/bootstrap-%{cmsplatf}.sh |
189 |
< |
%{instroot}/%{cmsplatf}/var/lib/rpm |
190 |
> |
%{relocateConfig}bin/apt-cache-wrapper |
191 |
> |
%{relocateConfig}bin/apt-get-wrapper |
192 |
> |
%{relocateConfig}bin/rpm-wrapper |
193 |
> |
%{relocateConfig}etc/apt.conf |