1 |
< |
### RPM external apt 0.5.15lorg3.2 |
2 |
< |
Source: http://apt-rpm.org/releases/%n-%v.tar.bz2 |
3 |
< |
Requires: libxml2 beecrypt rpm zlib bz2lib |
1 |
> |
### RPM external apt 0.5.15lorg3.2-wt1 |
2 |
> |
## INITENV SET APT_CONFIG %{i}/etc/apt/apt.conf |
3 |
|
|
4 |
+ |
Source: http://apt-rpm.org/releases/%n-%realversion.tar.bz2 |
5 |
+ |
Source1: bootstrap |
6 |
+ |
Patch0: apt-rpm449 |
7 |
+ |
Requires: libxml2 beecrypt rpm zlib bz2lib openssl |
8 |
+ |
%if "%(echo %{cmsos} | cut -d_ -f 2 | sed -e 's|.*64.*|64|')" == "64" |
9 |
+ |
%define libdir lib64 |
10 |
+ |
%else |
11 |
+ |
%define libdir lib |
12 |
+ |
%endif |
13 |
+ |
|
14 |
+ |
%prep |
15 |
+ |
%setup -n %n-%{realversion} |
16 |
+ |
%patch0 -p0 |
17 |
|
%build |
18 |
< |
export CFLAGS="-I$BEECRYPT_ROOT/include -I$RPM_ROOT/include" |
19 |
< |
export LDFLAGS="-L$BEECRYPT_ROOT/lib -L$RPM_ROOT/lib" |
8 |
< |
export LIBS="$LDFLAGS" |
18 |
> |
export CPPFLAGS="-I$BEECRYPT_ROOT/include -I$RPM_ROOT/include -I$RPM_ROOT/include/rpm" |
19 |
> |
export LDFLAGS="-L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}" |
20 |
|
export LIBDIR="$LIBS" |
21 |
|
export LIBXML2_CFLAGS="-I$LIBXML2_ROOT/include/libxml2 -I$BEECRYPT_ROOT/include -I$RPM_ROOT/include" |
22 |
< |
export LIBXML2_LIBS="-lxml2 -L$LIBXML2_ROOT/lib -L$BEECRYPT_ROOT/lib -L$RPM_ROOT/lib" |
22 |
> |
export LIBXML2_LIBS="-lxml2 -L$LIBXML2_ROOT/lib -L$BEECRYPT_ROOT/%{libdir} -L$RPM_ROOT/%{libdir}" |
23 |
|
|
24 |
|
./configure --prefix=%{i} --exec-prefix=%{i} \ |
25 |
|
--disable-nls \ |
26 |
|
--disable-dependency-tracking \ |
27 |
|
--without-libintl-prefix \ |
28 |
|
--disable-rpath |
29 |
< |
make %makeprocesses |
29 |
> |
make %makeprocesses |
30 |
> |
|
31 |
> |
|
32 |
> |
%install |
33 |
> |
make install |
34 |
> |
mkdir -p %{i}/etc/profile.d |
35 |
> |
(echo "#!/bin/sh"; \ |
36 |
> |
echo "source $RPM_ROOT/etc/profile.d/init.sh"; \ |
37 |
> |
echo "source $LIBXML2_ROOT/etc/profile.d/init.sh" ) > %{i}/etc/profile.d/dependencies-setup.sh |
38 |
> |
(echo "#!/bin/tcsh"; \ |
39 |
> |
echo "source $RPM_ROOT/etc/profile.d/init.csh"; \ |
40 |
> |
echo "source $LIBXML2_ROOT/etc/profile.d/init.csh" ) > %{i}/etc/profile.d/dependencies-setup.csh |
41 |
> |
|
42 |
> |
mkdir -p %{i}/etc/apt |
43 |
> |
cat << \EOF_APT_CONF > %{i}/etc/apt/apt.conf |
44 |
> |
Dir "%{instroot}" |
45 |
> |
{ |
46 |
> |
// Location of the state dir |
47 |
> |
State "%{cmsplatf}/var/lib/apt/" |
48 |
> |
{ |
49 |
> |
lists "lists/"; |
50 |
> |
xstatus "xstatus"; |
51 |
> |
userstatus "status.user"; |
52 |
> |
status "var/lib/dpkg/status"; |
53 |
> |
cdroms "cdroms.list"; |
54 |
> |
}; |
55 |
> |
|
56 |
> |
// Location of the cache dir |
57 |
> |
Cache "%{cmsplatf}/var/lib/cache" { |
58 |
> |
archives "%{cmsplatf}"; |
59 |
> |
srcpkgcache "srcpkgcache.bin"; |
60 |
> |
pkgcache "pkgcache.bin"; |
61 |
> |
}; |
62 |
> |
|
63 |
> |
// Locations of binaries |
64 |
> |
Bin { |
65 |
> |
methods "%{i}%{libdir}/apt/methods/"; |
66 |
> |
gzip "/bin/gzip"; |
67 |
> |
dpkg "/usr/bin/dpkg"; |
68 |
> |
dpkg-source "/usr/bin/dpkg-source"; |
69 |
> |
dpkg-buildpackage "/usr/bin/dpkg-buildpackage"; |
70 |
> |
apt-get "%{instroot}/bin/apt-get-wrapper"; |
71 |
> |
apt-cache "%{instroot}/bin/apt-cache-wrapper"; |
72 |
> |
rpm "%{instroot}/bin/rpm-wrapper"; |
73 |
> |
}; |
74 |
> |
|
75 |
> |
|
76 |
> |
// Config files |
77 |
> |
Etc "%{cmsplatf}/etc/apt/" { |
78 |
> |
sourcelist "sources.list"; |
79 |
> |
main "apt.conf"; |
80 |
> |
preferences "preferences"; |
81 |
> |
}; |
82 |
> |
}; |
83 |
> |
|
84 |
> |
Debug::pkgProblemResolver="1"; |
85 |
> |
|
86 |
> |
RPM |
87 |
> |
{ |
88 |
> |
PM "external"; |
89 |
> |
Options { "--define";"_rpmlock_path %{instroot}/%{cmsplatf}/var/lib/rpm/lock";"--dbpath";"%{instroot}/var/lib/rpm";"--nodeps";}; |
90 |
> |
Install-Options { "--define";"_rpmlock_path %{instroot}/%{cmsplatf}/var/lib/rpm/lock";"--nodeps";"--force";"--dbpath";"%{instroot}/%{cmsplatf}/var/lib/rpm";"--prefix";"%{instroot}";}; |
91 |
> |
RootDir "%{instroot}"; |
92 |
> |
Architecture "%{cmsplatf}"; |
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/\@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} |
133 |
> |
|
134 |
> |
cat << \EOF_BIN_APT_CACHE_WRAPPER > $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper |
135 |
> |
#!/bin/sh |
136 |
> |
touch %{instroot}/log.txt |
137 |
> |
echo $@ >> %{instroot}/log.txt |
138 |
> |
apt-cache $@ |
139 |
> |
EOF_BIN_APT_CACHE_WRAPPER |
140 |
> |
chmod +x $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper |
141 |
> |
|
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 |
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 |
155 |
> |
|
156 |
> |
cat << \EOF_SOURCES_LIST > $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/apt/sources.list |
157 |
> |
rpm http://cmsrep.cern.ch cms/cpt/Software/download/cms.eulisse/apt/%{cmsplatf} cms lcg external |
158 |
> |
rpm-src http://cmsrep.cern.ch cms/cpt/Software/download/cms.eulisse/apt/%{cmsplatf} cms lcg external |
159 |
> |
# This are defined to support experimental repositories. The bootstrap file rewrites and uncomments |
160 |
> |
# them when passed the appropriate commandline option. |
161 |
> |
## rpm @SERVER@ @SERVER_PATH@/@REPOSITORY@/apt/%{cmsplatf} @GROUPS@ |
162 |
> |
## rpm-src @SERVER@ @SERVER_PATH@/@REPOSITORY@/apt/%{cmsplatf} @GROUPS@ |
163 |
> |
EOF_SOURCES_LIST |
164 |
> |
|
165 |
> |
mkdir -p $RPM_INSTALL_PREFIX/%{cmsplatf}/var/lib/rpm |
166 |
> |
|
167 |
> |
# FIXME: this is the ugliest trick ever found in a shell script. |
168 |
> |
# This is my understanding of the situation. |
169 |
> |
# apt runs internally as if --root != / while uses rpm with |
170 |
> |
# --root $rootdir but --dbpath is always passed as $rootdir/$rpmdb. |
171 |
> |
# This way the rpm db is sometimes in $rootdir/$rpmdb, sometimes in |
172 |
> |
# $rootdir/$rootdir/$rpmdb and files are scattered around, causing |
173 |
> |
# big confusion. The solution is.... to create a link so that $rootdir/$rootdir |
174 |
> |
# is actually $rootdir. Clear, isn't it? If not, I don't blame you, but |
175 |
> |
# this is the only way I could make it working. I need to look at the apt code to |
176 |
> |
# (and probably fix it) to understand it better. For the time being.... |
177 |
> |
# TODO: check if this still applies with this version of apt-get |
178 |
> |
# TODO: check if we can fix the problem by patching apt sources. |
179 |
> |
|
180 |
> |
firstdir=$(echo $RPM_INSTALL_PREFIX | cut -d/ -f1,2) |
181 |
> |
if [ -f $RPM_INSTALL_PREFIX$firstdir ] |
182 |
> |
then |
183 |
> |
echo "Hack to enable apt working as user" |
184 |
> |
ln -sf $firstdir $RPM_INSTALL_PREFIX$firstdir |
185 |
> |
fi |
186 |
> |
|
187 |
> |
%{relocateConfig}etc/profile.d/dependencies-setup.sh |
188 |
> |
%{relocateConfig}etc/profile.d/dependencies-setup.csh |
189 |
> |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|" $RPM_INSTALL_PREFIX/bin/apt-cache-wrapper $RPM_INSTALL_PREFIX/bin/apt-get-wrapper |
190 |
> |
%files |
191 |
> |
%{i} |
192 |
> |
%{instroot}/bootstrap-%{cmsplatf}.sh |
193 |
> |
%{instroot}/%{cmsplatf}/var/lib/rpm |
194 |
> |
# |
195 |
> |
# |