+#
+# Conditional build:
+%bcond_with alternatives # build alternatives package
+
Summary: Package maintenance system for Debian Linux
-Summary(pl): Program do obs³ugi pakietów Debiana
+Summary(pl.UTF-8): Program do obsługi pakietów Debiana
Name: dpkg
-Version: 1.10.23
+Version: 1.22.2
Release: 2
-License: GPL
+License: GPL v2+
Group: Applications/File
-Source0: ftp://ftp.debian.org/debian/pool/main/d/dpkg/%{name}_%{version}.tar.gz
-# Source0-md5: 94a845ab0e14deb196d43e03c48a16b9
-Source1: http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-pl-man-pages.tar.bz2
-# Source1-md5: 55b735ac489c7db709c9e7b3ca535f97
-#Patch0: %{name}-no-debiandoc.patch
-#Patch1: %{name}-opt.patch
-#Patch2: %{name}-acfix.patch
-#Patch3: %{name}-no_man_section.patch
-#Patch4: %{name}-gcc33.patch
-#Patch5: %{name}-po.patch
-BuildRequires: autoconf
+Source0: http://ftp.debian.org/debian/pool/main/d/dpkg/%{name}_%{version}.tar.xz
+# Source0-md5: 591fe669ae36c1c93a8658bd650e38a6
+URL: https://packages.debian.org/search?keywords=dpkg
BuildRequires: automake
-BuildRequires: gettext-devel
-BuildRequires: libtool
-BuildRequires: perl-tools-pod
+BuildRequires: bzip2-devel
+BuildRequires: gettext-tools >= 0.19.8
+BuildRequires: libmd-devel
+BuildRequires: libselinux-devel >= 2.3
+BuildRequires: libstdc++-devel >= 6:4.7
+BuildRequires: ncurses-devel >= 5
+BuildRequires: perl-base >= 1:5.32.1
+BuildRequires: perl-tools-pod >= 1:5.32.1
+BuildRequires: pkgconfig
+BuildRequires: po4a >= 0.59
+BuildRequires: rpm-build >= 4.6
+BuildRequires: rpm-perlprov
+BuildRequires: rpmbuild(macros) >= 1.754
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
+BuildRequires: xz-devel
BuildRequires: zlib-devel
+BuildRequires: zstd-devel
+Requires: perl-base
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# blacklist false positives
+%define _noautoreq_perl at extra file
+
%description
-This package contains the programs which handle the installation and
-removal of packages on your system.
+This package contains the programs to handle deb packages known from
+Debian.
+
+%description -l pl.UTF-8
+Ten pakiet zawiera narzędzia do obsługi pakietów deb znanych z
+Debiana.
+
+%package -n libdpkg-devel
+Summary: dpkg library and header files
+Summary(pl.UTF-8): Biblioteka i pliki nagłówkowe dpkg
+Group: Development/Libraries
+Requires: bzip2-devel
+Requires: xz-devel
+Requires: zlib-devel
+
+%description -n libdpkg-devel
+dpkg library and header files.
+
+%description -n libdpkg-devel -l pl.UTF-8
+Biblioteka i pliki nagłówkowe dpkg.
-The primary interface for the dpkg suite is the `dselect' program; a
-more low-level and less user-friendly interface is available in the
-form of the `dpkg' command.
+%package alternatives
+Summary: Maintain symbolic links determining default commands
+Summary(pl.UTF-8): Utrzymywanie dowiązań symbolicznych określających domyślne polecenia
+Group: Applications/System
+Requires: %{name} = %{version}-%{release}
-In order to unpack and build Debian source packages you will need to
-install the developers' package `dpkg-dev' as well as this one.
+%description alternatives
+alternatives creates, removes, maintains and displays information
+about the symbolic links comprising the alternatives system. The
+alternatives system is a reimplementation of the Debian alternatives
+system.
-%description -l pl
-Ten pakiet zawiera narzêdzia do obs³ugi pakietów deb znanych z
+%description alternatives -l pl.UTF-8
+alternatives tworzy, usuwa, utrzymuje i wyświetla informacje o
+dowiązaniach symbolicznych obejmujących system alternatyw. System
+alternatyw to reimplementacja systemu alternatyw ("alternatives") z
Debiana.
+%package -n zsh-completion-dpkg
+Summary: ZSH completion for dpkg command
+Summary(pl.UTF-8): Dopełnianianie parametrów w ZSH dla polecenia dpkg
+Group: Applications/Shells
+Requires: %{name} = %{version}-%{release}
+Requires: zsh
+BuildArch: noarch
+
+%description -n zsh-completion-dpkg
+ZSH completion for dpkg command.
+
+%description -n zsh-completion-dpkg -l pl.UTF-8
+Dopełnianianie parametrów w ZSH dla polecenia dpkg.
+
%prep
%setup -q
-#%patch0 -p1
-#%patch1 -p1
-#%patch2 -p1
-#%patch3 -p0
-#%patch4 -p1
-#%patch5 -p1
%build
-cp -f /usr/share/automake/config.sub .
-#%%{__libtoolize}
-#%%{__gettextize}
-#%%{__aclocal}
-#%%{__autoconf}
+# dpkg expects <md5.h> from FreeBSD-compatible libmd (not libmd5)
+CPPFLAGS="%{rpmcppflags} -I/usr/include/libmd"
%configure \
- --enable-shared \
- --without-dselect \
- --without-sgml-doc \
- --with-admindir=/var/lib/%{name}
+ PO4A="true" \
+ --disable-devel-docs \
+ --disable-dselect \
+ --disable-silent-rules \
+ --disable-start-stop-daemon \
+ %{!?with_alternatives:--disable-update-alternatives} \
+ --with-admindir=/var/lib/%{name} \
+ --with-zshcompletionsdir=%{zsh_compdir}
-%{__make} docdir=%{_defaultdocdir}/%{name}-%{version} \
- CFLAGS="%{rpmcflags} -DSYS_SIGLIST_DECLARED"
+%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_defaultdocdir}/dpkg
-
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-bzip2 -dc %{SOURCE1} | tar xf - -C $RPM_BUILD_ROOT%{_mandir}
+%if %{with alternatives}
+%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/alternatives/README
+%endif
+
+# packaged as doc
+%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/doc/dpkg
+
+# obsoleted by pkg-config
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libdpkg.la
+# dpkg for main part, dpkg-dev for perl-based build script
+# don't use --all-name to avoid e.g. dselect inclusion
%find_lang dpkg
+%find_lang dpkg-dev
+cat dpkg-dev.lang >>dpkg.lang
%clean
rm -rf $RPM_BUILD_ROOT
%files -f dpkg.lang
%defattr(644,root,root,755)
-%doc doc/database-structure.fig doc/internals.sgml
-%doc $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/*
-%attr(755,root,root) %{_bindir}/822-date
+%doc AUTHORS ChangeLog README THANKS TODO
%attr(755,root,root) %{_bindir}/dpkg*
-%dir %{_libdir}/dpkg
-%dir %{_libdir}/dpkg/methods
-%dir %{_libdir}/dpkg/parsechangelog
-%dir %{_libdir}/dpkg/methods/disk
-%dir %{_libdir}/dpkg/methods/floppy
-%{_libdir}/dpkg/controllib.pl
-%attr(755,root,root) %{_libdir}/dpkg/mksplit
-%dir %{_libdir}/dpkg/methods/*/desc*
-%dir %{_libdir}/dpkg/methods/*/names
-%attr(755,root,root) %dir %{_libdir}/dpkg/methods/*/install
-%attr(755,root,root) %dir %{_libdir}/dpkg/methods/*/setup
-%attr(755,root,root) %dir %{_libdir}/dpkg/methods/*/update
-%attr(755,root,root) %dir %{_libdir}/dpkg/parsechangelog/debian
-#%attr(755,root,root) %{_sbindir}/start-stop-daemon
-%attr(755,root,root) %{_sbindir}/dpkg-divert
-%attr(755,root,root) %{_sbindir}/update-alternatives
+%attr(755,root,root) %{_sbindir}/dpkg-fsys-usrunmess
+%dir %{_sysconfdir}/dpkg
+%dir %{_sysconfdir}/dpkg/dpkg.cfg.d
+
+%dir %{_datadir}/dpkg
+%{_datadir}/dpkg/abitable
+%{_datadir}/dpkg/cputable
+%{_datadir}/dpkg/ostable
+%{_datadir}/dpkg/tupletable
+%{_datadir}/dpkg/*.mk
+%{_datadir}/dpkg/*.specs
+
+%dir %{_datadir}/dpkg/sh
+%{_datadir}/dpkg/sh/dpkg-error.sh
+
+%dir %{_libexecdir}/dpkg
+%attr(755,root,root) %{_libexecdir}/dpkg/dpkg-db-backup
+%attr(755,root,root) %{_libexecdir}/dpkg/dpkg-db-keeper
+
+%{perl_vendorlib}/Dpkg.pm
+%{perl_vendorlib}/Dpkg
+
%dir /var/lib/dpkg
-/var/lib/dpkg/*
-%{_mandir}/man1/822-date.1*
-%{_mandir}/man1/dpkg*
-%{_mandir}/man5/*
-%{_mandir}/man8/dpkg*
-#%{_mandir}/man8/start-stop*
-%{_mandir}/man8/update*
-%lang(es) %{_mandir}/es/man1/dpkg*
-%lang(es) %{_mandir}/es/man5/*
-%lang(es) %{_mandir}/es/man8/dpkg*
-%lang(fr) %{_mandir}/fr/man1/dpkg*
-%lang(fr) %{_mandir}/fr/man5/*
-%lang(fr) %{_mandir}/fr/man8/dpkg*
-%lang(ja) %{_mandir}/ja/man1/dpkg*
-%lang(ja) %{_mandir}/ja/man5/*
-%lang(ja) %{_mandir}/ja/man8/dpkg*
-#%lang(ja) %{_mandir}/ja/man8/start-stop*
-%lang(ja) %{_mandir}/ja/man8/update*
-%lang(pl) %{_mandir}/pl/man1/dpkg*
-%lang(pl) %{_mandir}/pl/man8/dpkg*
-%lang(pt_BR) %{_mandir}/pt_BR/man8/dpkg*
-%lang(ru) %{_mandir}/ru/man1/dpkg*
-%lang(ru) %{_mandir}/ru/man5/*
-%lang(ru) %{_mandir}/ru/man8/dpkg*
-%lang(sv) %{_mandir}/sv/man1/dpkg*
-%lang(sv) %{_mandir}/sv/man5/*
-%lang(sv) %{_mandir}/sv/man8/dpkg*
+%dir /var/lib/dpkg/info
+%dir /var/lib/dpkg/parts
+%dir /var/lib/dpkg/updates
+
+%{_mandir}/man1/dpkg*.1*
+%{_mandir}/man3/Dpkg.3*
+%{_mandir}/man3/Dpkg::*.3*
+%{_mandir}/man5/deb*.5*
+%{_mandir}/man5/dpkg.cfg.5*
+%{_mandir}/man5/dsc.5*
+%{_mandir}/man7/deb-version.7*
+%{_mandir}/man7/dpkg-build-api.7*
+%{_mandir}/man8/dpkg-fsys-usrunmess.8.*
+%lang(de) %{_mandir}/de/man1/dpkg*.1*
+%lang(de) %{_mandir}/de/man5/deb*.5*
+%lang(de) %{_mandir}/de/man5/dpkg.cfg.5*
+%lang(de) %{_mandir}/de/man5/dsc.5*
+%lang(de) %{_mandir}/de/man7/deb-version.7*
+%lang(de) %{_mandir}/de/man7/dpkg-build-api.7*
+%lang(de) %{_mandir}/de/man8/dpkg-fsys-usrunmess.8.*
+%lang(es) %{_mandir}/es/man1/dpkg*.1*
+%lang(es) %{_mandir}/es/man5/deb*.5*
+%lang(es) %{_mandir}/es/man5/dpkg.cfg.5*
+%lang(fr) %{_mandir}/fr/man1/dpkg*.1*
+%lang(fr) %{_mandir}/fr/man5/deb*.5*
+%lang(fr) %{_mandir}/fr/man5/dpkg.cfg.5*
+%lang(fr) %{_mandir}/fr/man5/dsc.5*
+%lang(fr) %{_mandir}/fr/man7/deb-version.7*
+%lang(fr) %{_mandir}/fr/man8/dpkg-fsys-usrunmess.8.*
+%lang(it) %{_mandir}/it/man1/dpkg*.1*
+%lang(it) %{_mandir}/it/man5/deb*.5*
+%lang(it) %{_mandir}/it/man5/dpkg.cfg.5*
+%lang(ja) %{_mandir}/ja/man1/dpkg*.1*
+%lang(ja) %{_mandir}/ja/man5/deb*.5*
+%lang(ja) %{_mandir}/ja/man5/dpkg.cfg.5*
+%lang(nl) %{_mandir}/nl/man1/dpkg*.1*
+%lang(nl) %{_mandir}/nl/man5/deb*.5*
+%lang(nl) %{_mandir}/nl/man5/dpkg.cfg.5*
+%lang(nl) %{_mandir}/nl/man5/dsc.5*
+%lang(nl) %{_mandir}/nl/man7/deb-version.7*
+%lang(nl) %{_mandir}/nl/man7/dpkg-build-api.7*
+%lang(nl) %{_mandir}/nl/man8/dpkg-fsys-usrunmess.8.*
+%lang(pl) %{_mandir}/pl/man1/dpkg*.1*
+%lang(pl) %{_mandir}/pl/man5/deb*.5*
+%lang(pl) %{_mandir}/pl/man5/dpkg.cfg.5*
+%lang(pt) %{_mandir}/pt/man1/dpkg*.1*
+%lang(pt) %{_mandir}/pt/man5/deb*.5*
+%lang(pt) %{_mandir}/pt/man5/dpkg.cfg.5*
+%lang(pt) %{_mandir}/pt/man5/dsc.5*
+%lang(pt) %{_mandir}/pt/man7/deb-version.7*
+%lang(pt) %{_mandir}/pt/man7/dpkg-build-api.7*
+%lang(pt) %{_mandir}/pt/man8/dpkg-fsys-usrunmess.8.*
+%lang(sv) %{_mandir}/sv/man1/dpkg*.1*
+%lang(sv) %{_mandir}/sv/man5/deb*.5*
+%lang(sv) %{_mandir}/sv/man5/dpkg.cfg.5*
+%lang(sv) %{_mandir}/sv/man5/dsc.5*
+%lang(sv) %{_mandir}/sv/man7/deb-version.7*
+%lang(sv) %{_mandir}/sv/man7/dpkg-build-api.7*
+%lang(sv) %{_mandir}/sv/man8/dpkg-fsys-usrunmess.8.*
+
+%files -n libdpkg-devel
+%defattr(644,root,root,755)
+%doc doc/README.* doc/*.txt
+%{_libdir}/libdpkg.a
+%{_includedir}/dpkg
+%{_aclocaldir}/dpkg*.m4
+%{_pkgconfigdir}/libdpkg.pc
+
+%if %{with alternatives}
+%files alternatives
+%defattr(644,root,root,755)
+%dir %{_sysconfdir}/alternatives
+%attr(755,root,root) %{_bindir}/update-alternatives
+%{_mandir}/man1/update-alternatives.1*
+%lang(de) %{_mandir}/de/man1/update-alternatives.1*
+%lang(es) %{_mandir}/es/man1/update-alternatives.1*
+%lang(fr) %{_mandir}/fr/man1/update-alternatives.1*
+%lang(it) %{_mandir}/it/man1/update-alternatives.1*
+%lang(ja) %{_mandir}/ja/man1/update-alternatives.1*
+%lang(pl) %{_mandir}/pl/man1/update-alternatives.1*
+%lang(sv) %{_mandir}/sv/man1/update-alternatives.1*
+%dir /var/lib/dpkg/alternatives
+%endif
+
+%files -n zsh-completion-dpkg
+%defattr(644,root,root,755)
+%{zsh_compdir}/_dpkg-parsechangelog