forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apt.spec
214 lines (185 loc) · 7.49 KB
/
apt.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
### RPM external apt 429
## INITENV SET APT_CONFIG %{i}/etc/apt.conf
## INITENV CMD_SH if [ -f %{instroot}/common/apt-site-env.sh ]; then . %{instroot}/common/apt-site-env.sh; fi
## INITENV CMD_CSH if ( -f %{instroot}/common/apt-site-env.csh ) source %{instroot}/common/apt-site-env.csh; endif
Source0: http://cmsrep.cern.ch/cmssw/apt-mirror/apt-rpm-%realversion.tar.gz
# svn://svn.github.com/ktf/apt-rpm.git?scheme=http&revision=%{realversion}&module=apt-rpm&output=/apt-rpm.tar.gz
Source1: bootstrap
Source2: http://search.cpan.org/CPAN/authors/id/T/TL/TLBDK/RPM-Header-PurePerl-1.0.2.tar.gz
Patch0: apt-429-fix-gcc-461
Patch1: apt-429-fix-gcc-47
Patch2: apt-429-less-dependencies
Patch3: apt-429-add-support-osx108
%define online %(case %cmsplatf in (*onl_*_*) echo true;; (*) echo false;; esac)
Requires: libxml2 rpm db4 openssl
%prep
%setup -T -b 2 -n RPM-Header-PurePerl-1.0.2
cd ..
%setup -n apt-rpm-%realversion
%patch0 -p1
%patch1 -p1
%patch2 -p1
case %cmsplatf in
osx108_*)
%patch3 -p1
;;
esac
%build
case %cmsplatf in
slc*)
export USER_CFLAGS="-pthread"
export USER_CXXFLAGS="-pthread"
export USER_LDFLAGS="-pthread"
export USER_LIBS="-pthread"
;;
*) ;;
esac
chmod +x buildlib/install-sh
# Avoid picking up sqlite3 from the system.
perl -p -i -e 's|sqlite3|sqlite3disabled|' configure
./configure --prefix=%{i} --exec-prefix=%{i} \
--disable-static \
--disable-nls \
--disable-dependency-tracking \
--without-libintl-prefix \
--disable-docs \
--disable-selinux \
--disable-rpath \
CXXFLAGS="-fPIC $USER_CXXFLAGS" \
CFLAGS="-fPIC $USER_CFLAGS" \
CPPFLAGS="-DAPT_DISABLE_MULTIARCH -D_RPM_4_4_COMPAT -I$POPT_ROOT/include -I$DB4_ROOT/include -I$BZ2LIB_ROOT/include -I$LUA_ROOT/include -I$RPM_ROOT/include -I$RPM_ROOT/include/rpm $USER_CPPFLAGS" \
LDFLAGS="-L$BZ2LIB_ROOT/lib -L$DB4_ROOT/lib -L$LUA_ROOT/lib -L$RPM_ROOT/lib $USER_LDFLAGS" \
LIBS="-llua $USER_LIBS" \
LIBXML2_CFLAGS="-I$LIBXML2_ROOT/include/libxml2 -I$DB4_ROOT/include -I$LUA_ROOT/include -I$RPM_ROOT/include" \
LIBXML2_LIBS="-lxml2 -L$DB4_ROOT/lib -L$LIBXML2_ROOT/lib -L$LUA_ROOT/lib -L$RPM_ROOT/lib" \
RPM_LIBS="-L$RPM_ROOT/lib -lrpm -lrpmio -lrpmbuild"
chmod +x buildlib/install-sh
make %makeprocesses
%install
make install
case %cmsos in
osx*) SONAME=dylib ;;
*) SONAME=so ;;
esac
# Drop documentation and developer files, since we do not need it.
%define drop_files %i/{share,include}
# Strip executables and libraries.
%define strip_files %i/lib %i/bin/{apt-config,genpkglist,apt-get,countpkglist,gensrclist,apt-cache,apt-shell} %i/lib/apt/methods/*
# Remove pkg-config to avoid rpm-generated dependency on /usr/bin/pkg-config
# which we neither need nor use at this time.
rm -rf %i/lib/pkgconfig
mkdir -p %{i}/etc/profile.d
(echo "#!/bin/sh"; \
echo "source $RPM_ROOT/etc/profile.d/init.sh"; \
echo "source $LIBXML2_ROOT/etc/profile.d/init.sh" ) > %{i}/etc/profile.d/dependencies-setup.sh
(echo "#!/bin/tcsh"; \
echo "source $RPM_ROOT/etc/profile.d/init.csh"; \
echo "source $LIBXML2_ROOT/etc/profile.d/init.csh" ) > %{i}/etc/profile.d/dependencies-setup.csh
cp %_sourcedir/bootstrap %{i}/bin/bootstrap.sh
pwd
perl -p -i -e 'my $s = `cat ../RPM-Header-PurePerl-1.0.2/lib/RPM/Header/PurePerl.pm`;\
s|\@RPM_HEADER_PUREPERL_PM\@|$s|' %{i}/bin/bootstrap.sh
perl -p -i -e 'my $s = `cat ../RPM-Header-PurePerl-1.0.2/lib/RPM/Header/PurePerl/Tagtable.pm`;\
s|\@RPM_HEADER_PUREPERL_TAGSTABLE_PM\@|$s|' %{i}/bin/bootstrap.sh
mkdir -p %{i}/etc/apt
cat << \EOF_APT_CONF > %{i}/etc/apt.conf
Dir "%{instroot}"
{
// Location of the state dir
State "%{cmsplatf}/var/lib/apt/"
{
lists "lists/";
xstatus "xstatus";
userstatus "status.user";
status "var/lib/dpkg/status";
cdroms "cdroms.list";
};
// Location of the cache dir
Cache "%{cmsplatf}/var/lib/cache" {
archives "%{cmsplatf}";
srcpkgcache "srcpkgcache.bin";
pkgcache "pkgcache.bin";
};
// Locations of binaries
Bin {
methods "%{i}/lib/apt/methods/";
gzip "/bin/gzip";
dpkg "/usr/bin/dpkg";
dpkg-source "/usr/bin/dpkg-source";
dpkg-buildpackage "/usr/bin/dpkg-buildpackage";
apt-get "%{i}/bin/apt-get-wrapper";
apt-cache "%{i}/bin/apt-cache-wrapper";
rpm "%{i}/bin/rpm-wrapper";
};
// Config files
Etc "%{cmsplatf}/external/apt/%{v}/etc/" {
sourcelist "sources.list";
main "apt.conf";
preferences "preferences";
};
};
Debug::pkgProblemResolver="1";
RPM
{
PM "external";
Options { };
Install-Options { "--force";"--prefix";"%{instroot}";"--ignoreos";"--ignorearch";};
RootDir "%{instroot}";
Architecture "%{cmsplatf}";
};
APT::Cache-Limit 33554432;
APT::http::Max-Age 0;
EOF_APT_CONF
cat << \EOF_SOURCES_LIST > %{i}/etc/sources.list
rpm http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external
# rpm-src http://cmsrep.cern.ch cms/cpt/Software/download/cms/apt/%{cmsplatf} cms lcg external
# This are defined to support experimental repositories. The bootstrap file rewrites and uncomments
# them when passed the appropriate commandline option.
#;rpm http://@SERVER@ @SERVER_PATH@@REPOSITORY@/apt/%{cmsplatf} @GROUPS@
# rpm-src http://@SERVER@ @SERVER_PATH@@REPOSITORY@/apt/%{cmsplatf} @GROUPS@
EOF_SOURCES_LIST
cat << \EOF_RPMPRIORITIES > %{i}/etc/rpmpriorities
Essantial:
EOF_RPMPRIORITIES
cat << \EOF_BIN_APT_CACHE_WRAPPER > %{i}/bin/apt-cache-wrapper
#!/bin/sh
mkdir -p %{instroot}/var/log/rpm
touch %{instroot}/var/log/rpm/log.txt
echo $@ >> %{instroot}/var/log/rpm/log.txt
apt-cache $@
EOF_BIN_APT_CACHE_WRAPPER
chmod +x %{i}/bin/apt-cache-wrapper
cat << \EOF_BIN_APT_GET_WRAPPER > %{i}/bin/apt-get-wrapper
#!/bin/sh
mkdir -p %{instroot}/var/log/rpm
touch %{instroot}/var/log/rpm/log.txt
echo $@ >> %{instroot}/var/log/rpm/log.txt
apt-get $@
EOF_BIN_APT_GET_WRAPPER
chmod +x %{i}/bin/apt-get-wrapper
cat << \EOF_BIN_RPM > %{i}/bin/rpm-wrapper
#!/bin/sh
if [ X"$(id -u)" = X0 ]; then
echo "*** CMS SOFTWARE INSTALLATION ABORTED ***" 1>&2
echo "CMS software cannot be installed as the super-user." 1>&2
echo "(We recommend reading any standard unix security guide.)" 1>&2
exit 1
fi
mkdir -p %{instroot}/var/log/rpm
touch %{instroot}/var/log/rpm/log.txt
echo rpm ${1+"$@"} >> %{instroot}/var/log/rpm/log.txt
exec rpm ${1+"$@"}
EOF_BIN_RPM
chmod +x %{i}/bin/rpm-wrapper
mkdir -p %{instroot}/%{cmsplatf}/var/lib/apt/lists/partial
mkdir -p %{instroot}/%{cmsplatf}/var/lib/rpm
mkdir -p %{instroot}/%{cmsplatf}/var/lib/cache/%{cmsplatf}/partial
mkdir -p %{instroot}/%{cmsplatf}/var/lib/dpkg/status
mkdir -p %{instroot}/%{cmsplatf}/etc/rpm
mkdir -p %{instroot}/%{cmsplatf}/lib/apt/methods
%post
%{relocateRpmPkg}etc/profile.d/dependencies-setup.*
%{relocateRpmPkg}bin/apt-cache-wrapper
%{relocateRpmPkg}bin/apt-get-wrapper
%{relocateRpmPkg}bin/rpm-wrapper
%{relocateRpmPkg}etc/apt.conf