+#
+# Conditional build:
+%bcond_with static # don't use shared libraries
+%bcond_without imode # don't build interactive mode
+%bcond_with curl # link with curl
+#
+# required versions (forced to avoid SEGV with mixed db used by rpm and poldek)
+%define ver_db 4.2.50-1
+%define ver_rpm 4.3-0.20030610.29
Summary: RPM packages management helper tool
Summary(pl): Pomocnicze narzêdzie do zarz±dzania pakietami RPM
Name: poldek
-Version: 0.15.3
-Release: 1
-License: GPL
+Version: 0.18.1
+Release: 16
+License: GPL v2
Group: Applications/System
-Group(de): Applikationen/System
-Group(pl): Aplikacje/System
-Source0: ftp://ftp.pld.org.pl/software/%{name}/%{name}-%{version}.tar.gz
-Requires: /bin/rpm
-BuildRequires: db3-devel >= 3.1.14-2
-BuildRequires: rpm-devel >= 3.0.5
-BuildRequires: popt-static
-BuildRequires: zlib-devel
+Source0: http://team.pld.org.pl/~mis/poldek/download/%{name}-%{version}.tar.bz2
+# Source0-md5: 8af8090d401254939911e456e2f09e60
+Source1: %{name}.conf
+Patch0: %{name}-static.patch
+Patch1: %{name}-etc_dir.patch
+Patch2: %{name}-rpm4.2.patch
+Patch3: %{name}-rpm4.1-fix.patch
+Patch4: %{name}-retr_term.patch
+Patch5: %{name}-deps-fix.patch
+Patch6: %{name}-broken-rpmdb.patch
+Patch7: %{name}-epoch0.patch
+Patch8: %{name}-ldb4.patch
+URL: http://team.pld.org.pl/~mis/poldek/
+BuildRequires: automake
+BuildRequires: autoconf
BuildRequires: bzip2-devel
-BuildRequires: /usr/bin/pod2man
-BuildRequires: trurlib-devel >= 0.43.2
-BuildRequires: curl-devel >= 7.8
-BuildRequires: openssl-devel
-BuildRequires: readline-devel
+%{?with_curl:BuildRequires: curl-devel >= 7.8}
+BuildRequires: db-devel >= %{ver_db}
+BuildRequires: gettext-autopoint
+BuildRequires: openssl-devel >= 0.9.7c
BuildRequires: pcre-devel
-%{?BOOT:BuildRequires: zlib-static}
-%{?BOOT:BuildRequires: bzip2-static}
-%{?BOOT:BuildRequires: trurlib-static}
-%{?BOOT:BuildRequires: curl-static}
-%{?BOOT:BuildRequires: openssl-static}
+BuildRequires: popt-devel
+BuildRequires: readline-devel
+BuildRequires: rpm-devel >= %{ver_rpm}
+BuildRequires: zlib-devel
+BuildRequires: /usr/bin/pod2man
+%if %{with static}
+BuildRequires: bzip2-static
+%{?with_curl:BuildRequires: curl-static}
+BuildRequires: db-static >= %{ver_db}
+BuildRequires: ncurses-static
+BuildRequires: openssl-static
+BuildRequires: pcre-static
+BuildRequires: popt-static
+BuildRequires: readline-static
+BuildRequires: rpm-static
+BuildRequires: zlib-static
+BuildRequires: glibc-static
+%endif
+Requires: db >= %{ver_db}
+Requires: rpm >= %{ver_rpm}
+Requires: sed
+Requires: openssl >= 0.9.7c
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-poldek is a cmdline tool which can be used to verify, install and
-upgrade given package sets.
+poldek is an RPM package management tool which allows you to easily
+perform package verification, installation (including system
+installation from scratch), upgrading, and removal.
+
+Program can be used in batch (like apt-get from Debian's APT) or
+interactive mode. The interactive mode puts you into a readline
+interface with command line autocompletion and history, similar to the
+shell mode of Perl's CPAN.
+
+%{?with_static:This version is statically linked.}
+
+%{!?with_imode:This version hasn't got interactive mode.}
%description -l pl
-poldek jest narzêdziem linii poleceñ s³u¿±cym do weryfikacji, instalacji
-i aktualizacji pakietów.
+poldek jest narzêdziem linii poleceñ s³u¿±cym do weryfikacji,
+instalacji (w³±czaj±c instalacjê systemu od zera), aktualizacji i
+usuwania pakietów.
-%if %{?BOOT:1}%{!?BOOT:0}
-%package BOOT
-Summary: poldek for bootdisk
-Group: Applications/System
-Group(de): Applikationen/System
-Group(pl): Aplikacje/System
+Program mo¿e byæ u¿ywany w trybie wsadowym (jak debianowy apt-get) lub
+interaktywnym. Tryb interaktywny posiada interfejs readline z
+dope³nianiem komend i histori±, podobny do trybu shell perlowego
+modu³u CPAN.
-%description BOOT
-poldek is a cmdline tool which can be used to verify, install and
-upgrade given package sets.
-This version is for boot disk.
+%{?with_static:Ta wersja jest konsolidowana statycznie.}
-%endif
+%{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
-%prep
-%setup -q
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p0
+%patch4 -p1
+%patch5 -p0
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
%build
-%if %{?BOOT:1}%{!?BOOT:0}
-%configure --enable-static --disable-imode
-%{__make} CFLAGS="-O0 -g"
-mv -f %{name} %{name}-BOOT
-%{__make} clean
-%endif
-
-%configure
-%{__make}
+%{__autopoint}
+%{__aclocal} -I m4
+%{__autoconf}
+%{__automake}
+%configure \
+ %{?with_static:--enable-static} \
+ %{!?with_imode:--disable-imode} \
+ %{?with_curl:--with-curl}
+%{__make}
%install
rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_sysconfdir}
-%if %{?BOOT:1}%{!?BOOT:0}
-install -d $RPM_BUILD_ROOT%{_libdir}/bootdisk/sbin
-install %{name}-BOOT $RPM_BUILD_ROOT%{_libdir}/bootdisk/sbin/%{name}
-%endif
+%{__make} install \
+ DESTDIR=$RPM_BUILD_ROOT
-# no strip cause program's alpha stage and core may be useful
-%{__make} install DESTDIR=$RPM_BUILD_ROOT
+%{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
+sed "s|/i686/|/%{_target_cpu}/|g" < %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
-gzip -9nf README* *sample* NEWS TODO
+%find_lang %{name}
%clean
rm -rf $RPM_BUILD_ROOT
-%files
+%files -f %{name}.lang
%defattr(644,root,root,755)
+%doc README* NEWS TODO *sample* conf/poldekrc*
+%attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/%{name}.conf
%attr(755,root,root) %{_bindir}/*
%{_mandir}/man1/%{name}*
-%doc *.gz
-
-%if %{?BOOT:1}%{!?BOOT:0}
-%files BOOT
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/bootdisk/sbin/poldek
-%endif
+%lang(pl) %{_mandir}/pl/man1/%{name}*