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