2 |
|
## INITENV SET APT_CONFIG %{i}/etc/apt/apt.conf |
3 |
|
|
4 |
|
Source: http://apt-rpm.org/releases/%n-%v.tar.bz2 |
5 |
+ |
Source1: bootstrap |
6 |
|
Patch0: apt-rpm449 |
7 |
|
Requires: libxml2 beecrypt rpm zlib bz2lib |
8 |
|
%if "%(echo %{cmsos} | cut -d_ -f 2 | sed -e 's|.*64.*|64|')" == "64" |
93 |
|
}; |
94 |
|
EOF_APT_CONF |
95 |
|
|
96 |
+ |
cat %_sourcedir/bootstrap | perl -p -e "s/\@CMSPLATF\@/%{cmsplatf}/; |
97 |
+ |
s/\@GCC_VERSION\@/$GCC_VERSION/; |
98 |
+ |
s/\@RPM_VERSION\@/$RPM_VERSION/; |
99 |
+ |
s/\@BEECRYPT_VERSION\@/$BEECRYPT_VERSION/; |
100 |
+ |
s/\@BZ2LIB_VERSION\@/$BZ2LIB_VERSION/; |
101 |
+ |
s/\@ZLIB_VERSION\@/$ZLIB_VERSION/; |
102 |
+ |
s/\@EXPAT_VERSION\@/$EXPAT_VERSION/; |
103 |
+ |
s/\@ELFUTILS_VERSION\@/$ELFUTILS_VERSION/; |
104 |
+ |
s/\@NEON_VERSION\@/$NEON_VERSION/; |
105 |
+ |
s/\@GCC_REVISION\@/$GCC_REVISION/; |
106 |
+ |
s/\@BEECRYPT_REVISION\@/$BEECRYPT_REVISION/; |
107 |
+ |
s/\@RPM_REVISION\@/$RPM_REVISION/; |
108 |
+ |
s/\@BZ2LIB_REVISION\@/$BZ2LIB_REVISION/; |
109 |
+ |
s/\@ZLIB_REVISION\@/$ZLIB_REVISION/; |
110 |
+ |
s/\@EXPAT_REVISION\@/$EXPAT_REVISION/; |
111 |
+ |
s/\@NEON_REVISION\@/$NEON_REVISION/; |
112 |
+ |
s/\@ELFUTILS_REVISION\@/$ELFUTILS_REVISION/; |
113 |
+ |
s/\@APT_VERSION\@/%{v}/; |
114 |
+ |
s/\@APT_REVISION\@/%{pkgrevision}/; |
115 |
+ |
" > %{instroot}/bootstrap-%{cmsplatf}.sh |
116 |
+ |
|
117 |
|
%post |
118 |
< |
mkdir -p %{cmsplatf}/var/lib/apt/lists/partial |
119 |
< |
mkdir -p %{cmsplatf}/var/lib/rpm |
120 |
< |
mkdir -p %{cmsplatf}/var/lib/cache/%{cmsplatf}/partial |
121 |
< |
mkdir -p %{cmsplatf}/etc/apt |
122 |
< |
mkdir -p %{cmsplatf}/etc/rpm |
123 |
< |
mkdir -p %{cmsplatf}/lib/apt/methods |
124 |
< |
mkdir -p %{cmsplatf}/var/lib/dpkg/status |
125 |
< |
mkdir -p bin |
126 |
< |
mkdir -p %{cmsplatf}/var/lib/cache/%{cmsplatf} |
118 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/apt/lists/partial |
119 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm |
120 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf}/partial |
121 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt |
122 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/rpm |
123 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/lib/apt/methods |
124 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/dpkg/status |
125 |
> |
mkdir -p $RPM_INSTALL_PREFIX/bin |
126 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/cache/%{cmsplatf} |
127 |
|
|
128 |
< |
cat << \EOF_BIN_APT_CACHE_WRAPPER > bin/apt-cache-wrapper |
128 |
> |
cat << \EOF_BIN_APT_CACHE_WRAPPER > $RPM_INSTALL_PREFIX/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 |
< |
chmod +x bin/apt-cache-wrapper |
134 |
> |
chmod +x $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper |
135 |
|
|
136 |
< |
cat << \EOF_BIN_APT_GET_WRAPPER > bin/apt-get-wrapper |
136 |
> |
cat << \EOF_BIN_APT_GET_WRAPPER > $RPM_INSTALL_PREFIX/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 |
< |
chmod +x bin/apt-get-wrapper |
142 |
> |
chmod +x $RPM_INSTALL_PREFIX/bin/apt-get-wrapper |
143 |
|
|
144 |
< |
mkdir -p %{cmsplatf}/etc/apt |
145 |
< |
cat << \EOF_RPMPRIORITIES > %{cmsplatf}/etc/apt/rpmpriorities |
144 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt |
145 |
> |
cat << \EOF_RPMPRIORITIES > $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt/rpmpriorities |
146 |
|
Essantial: |
147 |
|
|
148 |
|
EOF_RPMPRIORITIES |
149 |
|
|
150 |
< |
mkdir -p %{cmsplatf}/var/lib/rpm |
150 |
> |
cat << \EOF_SOURCES_LIST > $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt/sources.list |
151 |
> |
rpm http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
152 |
> |
rpm-src http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external |
153 |
> |
EOF_SOURCES_LIST |
154 |
> |
|
155 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm |
156 |
> |
|
157 |
> |
# FIXME: this is the ugliest trick ever found in a shell script. |
158 |
> |
# This is my understanding of the situation. |
159 |
> |
# apt runs internally as if --root != / while uses rpm with |
160 |
> |
# --root $rootdir but --dbpath is always passed as $rootdir/$rpmdb. |
161 |
> |
# This way the rpm db is sometimes in $rootdir/$rpmdb, sometimes in |
162 |
> |
# $rootdir/$rootdir/$rpmdb and files are scattered around, causing |
163 |
> |
# big confusion. The solution is.... to create a link so that $rootdir/$rootdir |
164 |
> |
# is actually $rootdir. Clear, isn't it? If not, I don't blame you, but |
165 |
> |
# this is the only way I could make it working. I need to look at the apt code to |
166 |
> |
# (and probably fix it) to understand it better. For the time being.... |
167 |
> |
# TODO: check if this still applies with this version of apt-get |
168 |
> |
# TODO: check if we can fix the problem by patching apt sources. |
169 |
> |
|
170 |
> |
firstdir=$(echo $RPM_INSTALL_PREFIX | cut -d/ -f1,2) |
171 |
> |
if [ -f $RPM_INSTALL_PREFIX$firstdir ] |
172 |
> |
then |
173 |
> |
echo "Hack to enable apt working as user" |
174 |
> |
ln -sf $firstdir $RPM_INSTALL_PREFIX$firstdir |
175 |
> |
fi |
176 |
|
|
177 |
|
%{relocateConfig}etc/profile.d/dependencies-setup.sh |
178 |
|
%{relocateConfig}etc/profile.d/dependencies-setup.csh |
179 |
< |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|" bin/apt-cache-wrapper bin/apt-get-wrapper |
179 |
> |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|" $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper $RPM_INSTALL_PREFIX/bin/apt-get-wrapper |
180 |
> |
%files |
181 |
> |
%{i} |
182 |
> |
%{instroot}/bootstrap-%{cmsplatf}.sh |
183 |
> |
%{instroot}/%{cmsplatf}/var/lib/rpm |