File apt.spec of Package apt
Summary: Debian's Advanced Packaging Tool with RPM support
Name: apt
%define lname lib%name
Version: 0
Release: 0
Group: System/Packages
URL: http://apt-rpm.org/
License: GPL-2.0+
Source0: %{name}-%{version}.tar.xz
# user editable template configs
Source1: %{name}.conf
Source3: vendors.list
Source4: %{name}_preferences
Source9: %{name}-rpmlintrc
Source19: comps2prio.xsl
# Sources 50-99 are for Lua-scripts not in contrib/
Source51: upgradevirt.lua
Source52: gpg-check.lua
# 150-199 for apt.conf.d
# "factory defaults"
Source150: default.conf
# band aid for mmap issues (#211254)
Patch1: %name-0.5.15lorg3.x-cache-corruption.patch
Patch2: %name-0.5.15lorg3.95-lua-5.2.patch
Patch3: %name-0.5.15lorg3.95.git522-suggest.patch
Patch4: %name-0.5.15lorg3.95.git522-genbasedir-fix-bashisms.patch
Patch5: %name-0.5.15lorg3.95.git416-sha256.patch
Patch6: big_id.patch
Patch7: release_string.patch
Patch8: lua_path.patch
Provides: apt-repo-tools = %{version}-%{release}
# TODO: verify the required minimum Python version
BuildRequires: python-devel >= 2.2
BuildRequires: autoconf automake libtool gcc-c++ gettext perl-base gawk git-core swig
BuildRequires: libxml2-devel rpm-devel zlib-devel libbz2-devel readline-devel ncurses-devel
BuildRequires: sqlite-devel >= 3
BuildRequires: pkgconfig
%if 0%{?suse_version} && 0%{?suse_version} <= 1320
BuildRequires: lua51-devel
%else
BuildRequires: lua-devel
%endif
Requires: gnupg bzip2
Requires: %lname = %version-%release
PreReq: rpm >= 4.8.1
%description
APT-RPM is a port of Debian's apt tools for RPM based distributions. It provides
the apt-get utility that provides a simple, safe way to install and upgrade
packages. APT features complete installation ordering, multiple source capability
and several other useful features.
%package -n %lname
Summary: Shared libraries for %name
Group: System/Libraries
Requires: %name-common = %version-%release
%description -n %lname
This package contains APT's libapt-pkg package manipulation library modified for
RPM.
%package -n %lname-devel
Summary: Development files for %name
Group: Development/C++
Requires: %lname = %version-%release
%description -n %lname-devel
This package contains the header files and static libraries for developing with
APT's libapt-pkg package manipulation library, modified for RPM.
%package python
Summary: Python bindings for libapt-pkg
Group: Development/Python
Requires: %lname = %version-%release
%description python
The apt-python package contains a module which allows python programs to access
the APT library interface.
%package common
Summary: Common file for %name frontend
Group: System/Packages
%description common
This package contains the needed files for various apt-frontend, such as
synaptic, aptitude.
%prep
%setup -q
%patch1 -p0 -b .mmap
%patch2 -p1 -b .lua-5.2
%patch3 -p1
%patch4 -p1
#patch5 -p1 -b .sha256
%patch6 -p1
%patch7 -p1
%patch8 -p1
install -p -m 0644 %{S:19} ./comps2prio.xsl
# don't require python, lua etc because of stuff in doc/contrib
find contrib -type f -exec chmod 0644 \{} \;
%build
autoreconf -fisv
%configure \
--disable-dependency-tracking \
--disable-static \
CPPFLAGS="-D_RPM_4_4_COMPAT -DLUA_COMPAT_ALL -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2"
%{__make} %{?_smp_mflags}
%{__make} %{?_smp_mflags} -C python PYTHON="%__python"
python -O -c "import py_compile; py_compile.compile('python/apt.py')"
%install
%{__make} install DESTDIR=/%{?buildroot}
rm -f %name.lang
%find_lang %name
# The state files
install -d -m 0755 %buildroot%_localstatedir/{lib/%name/lists/partial,cache/%name/{archives/partial,gen{pkg,src}list}}
# The config files
install -d -m 0755 %buildroot%_sysconfdir/%name/{%name.conf,{sources,vendors}.list}.d
install -p -m 0644 %{S:1} %buildroot/%_sysconfdir/%name/%name.conf
install -p -m 0644 %{S:3} %buildroot/%_sysconfdir/%name/vendors.list
install -p -m 0644 %{S:4} %buildroot/%_sysconfdir/%name/preferences
echo "Essential:" > %buildroot/%_sysconfdir/%name/rpmpriorities
# install config parts
install -p -m 0644 %{S:150} %buildroot%_sysconfdir/%name/%name.conf.d/
# Lua scripts
install -d -m 0755 %buildroot%_datadir/%name/scripts
install -p -m 0755 %{S:51} %{S:52} %buildroot%_datadir/%name/scripts
# The python bindings
install -d -m 0755 %buildroot%python_sitearch
install -p -m 0755 python/_%name.so %buildroot%python_sitearch/
install -p -m 0644 python/%name.py* %buildroot%python_sitearch/
touch %buildroot%python_sitearch/apt.pyo
%if 0
# Nightly updater scripts & default config
install -pD -m 0755 contrib/apt-cron/%name.init %buildroot/%_initrddir/%name
install -pD -m 0755 {contrib/apt-cron,%buildroot/%_sysconfdir/cron.daily}/%name.cron
install -pD -m 0644 contrib/apt-cron/%name.sysconfig %buildroot/%_sysconfdir/sysconfig/%name
%endif
# nuke .la files
rm -f %buildroot%_libdir/*.la
rm -rf %buildroot/usr/lib/debug
%if 0
%post
/sbin/chkconfig --add apt
%preun
if [ $1 -eq 0 ]; then
%_initrddir/%name stop &>/dev/null ||:
/sbin/chkconfig --del apt
fi
%endif
%post -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig
%files -f %name.lang
%defattr(-, root, root)
%doc AUTHORS* COPYING* ABOUT* TODO comps2prio.xsl doc/examples/ contrib/
#%doc ChangeLog
%_bindir/apt-cache
%_bindir/apt-cdrom
%_bindir/apt-config
%_bindir/apt-shell
%_bindir/apt-get
%_bindir/countpkglist
%_bindir/genpkglist
%_bindir/gensrclist
%_bindir/genbasedir
%_mandir/man5*
%_mandir/man8*
%files common
%defattr(-, root, root)
%_libdir/%name
%_localstatedir/cache/%name
%_localstatedir/lib/%name
%dir %_sysconfdir/%name
%config(noreplace) %_sysconfdir/%name/%name.conf
%config(noreplace) %_sysconfdir/%name/preferences
%config(noreplace) %_sysconfdir/%name/rpmpriorities
%config(noreplace) %_sysconfdir/%name/vendors.list
%dir %_sysconfdir/%name/%name.conf.d
%config %_sysconfdir/%name/%name.conf.d/*
%dir %_sysconfdir/%name/sources.list.d
%dir %_sysconfdir/%name/vendors.list.d
%if 0
%config(noreplace) %_sysconfdir/sysconfig/*
%_sysconfdir/cron.daily/*
%_initrddir/*
%endif
%dir %_datadir/%name
%dir %_datadir/%name/scripts
%_datadir/%name/scripts/gpg-check.lua
%_datadir/%name/scripts/upgradevirt.lua
%files -n %lname
%defattr(-,root,root)
%_libdir/*.so.*
%files -n %lname-devel
%defattr(-,root,root)
%_includedir/%name-pkg
%_libdir/*.so
%_libdir/pkgconfig/*
%files python
%defattr(-,root,root,-)
%python_sitearch/_%name.so
%python_sitearch/%name.py*
%changelog