From 8a62de731f628fec81edb795195638cf08a778ad Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Fri, 26 Oct 2012 10:16:38 +0000 Subject: [PATCH] - merged changes from PLD --- poldek-git.patch | 167 ++++++++++++++++++++++++++++++++++++++++ poldek-link-rpmio.patch | 14 ++++ poldek-vrpmlog.patch | 74 ++++++++++++++++++ poldek.spec | 110 ++++++++++++++++---------- 4 files changed, 326 insertions(+), 39 deletions(-) create mode 100644 poldek-git.patch create mode 100644 poldek-link-rpmio.patch create mode 100644 poldek-vrpmlog.patch diff --git a/poldek-git.patch b/poldek-git.patch new file mode 100644 index 0000000..81d7b7a --- /dev/null +++ b/poldek-git.patch @@ -0,0 +1,167 @@ +commit 2f6b86835cbbad530f838bcf5d3e183f92eb3396 +Author: Marcin Banasiak +Date: Thu Sep 27 17:44:19 2012 +0200 + + Change the way how / is stored in dirindex + + Previously, / was stored in dirindex with leading slash (i.e. as //) + what caused various side effects as: + + filesystem-4.0-12.x86_64 obsoleted by filesystem-4.0-13.x86_64 + filesystem-4.0-13.x86_64 marks FHS-2.3-35.x86_64 (cap //) + error: FHS-2.3-35.x86_64: equal version installed, give up + +diff --git a/pkgdir/pkgdir_dirindex.c b/pkgdir/pkgdir_dirindex.c +index a6f422f..abfd05c 100644 +--- a/pkgdir/pkgdir_dirindex.c ++++ b/pkgdir/pkgdir_dirindex.c +@@ -103,10 +103,14 @@ static int package_key(char *key, int size, const struct pkg *pkg, int prefix) + static tn_buf *dirarray_join(tn_buf *nbuf, tn_array *arr, char *sep) + { + int i, size = n_array_size(arr); ++ + for (i=0; i < size; i++) { +- n_buf_printf(nbuf, "%s%s", (char*)n_array_nth(arr, i), +- i < size - 1 ? sep : ""); ++ const char *dirname = n_array_nth(arr, i); ++ ++ n_buf_printf(nbuf, "%s%s%s", *dirname != '/' ? "/" : "", ++ dirname, i < size - 1 ? sep : ""); + } ++ + return nbuf; + } + +@@ -179,7 +183,8 @@ static int store_from_previous(uint32_t package_no, struct pkg *pkg, struct tndb + + while (*tl) { + const char *dir = *tl; +- dir = dir + 1; /* skip '/' */ ++ if (dir[1] != '\0') ++ dir = dir + 1; /* skip '/' only when strlen(dir) > 1 */ + add_to_path_index(path_index, dir, package_no); + tl++; + } +@@ -238,15 +243,13 @@ void store_package(uint32_t package_no, struct pkg *pkg, struct tndb *db, + + if (required) { + n_buf_clean(nbuf); +- n_buf_printf(nbuf, "/"); /* prefix all by '/' */ +- nbuf = dirarray_join(nbuf, required, ":/"); ++ nbuf = dirarray_join(nbuf, required, ":"); + tndb_put(db, key, klen, n_buf_ptr(nbuf), n_buf_size(nbuf)); + } + + if (owned) { + n_buf_clean(nbuf); +- n_buf_printf(nbuf, "/"); /* prefix all by '/' */ +- nbuf = dirarray_join(nbuf, owned, ":/"); ++ nbuf = dirarray_join(nbuf, owned, ":"); + + /* ugly, but what for another package_key() call */ + key[1] = PREFIX_PKGKEY_OWNDIR; +@@ -323,9 +326,13 @@ static int dirindex_create(const struct pkgdir *pkgdir, const char *path, + for (i=0; i < n_array_size(directories); i++) { + const char *path = n_array_nth(directories, i); + tn_array *ids = n_hash_get(path_index, path); ++ int j; + + n_buf_clean(nbuf); +- nbuf = dirarray_join(nbuf, ids, ":"); ++ for (j = 0; j < n_array_size(ids); j++) { ++ n_buf_printf(nbuf, "%s%s", (char *)n_array_nth(ids, j), ++ j < n_array_size(ids) - 1 ? ":" : ""); ++ } + + DBGF(" dir %s %s\n", path, (char*)n_buf_ptr(nbuf)); + +@@ -774,11 +781,11 @@ tn_array *get_package_directories_as_array(const struct pkgdir *pkgdir, + + dirs = n_array_new(n, free, (tn_fn_cmp)strcmp); + while (*tl) { +- if (**tl) ++ if (**tl) + n_array_push(dirs, n_strdup(*tl)); + tl++; + } +- ++ + n_str_tokl_free(tl_save); + n_free(val); + +@@ -809,7 +816,7 @@ static tn_array *do_dirindex_get(const struct pkgdir_dirindex *dirindex, + unsigned char val[8192]; + int n, found, pkgs_passsed = 1; + +- if (*path == '/') ++ if (*path == '/' && path[1] != '\0') + path++; + + if (!tndb_get_str(dirindex->db, path, val, sizeof(val))) +@@ -877,7 +884,7 @@ int pkgdir_dirindex_pkg_has_path(const struct pkgdir *pkgdir, + + DBGF("%s %s\n", pkg_id(pkg), path); + +- if (*path == '/') ++ if (*path == '/' && path[1] != '\0') + path++; + + if (!tndb_get_str(dirindex->db, path, val, sizeof(val))) +commit f575c9bbe3cdd8f2d6ef27eb73dcc270c1a8a3f2 +Author: Marcin Banasiak +Date: Sun Oct 7 12:41:42 2012 +0200 + + Provide function body for inlined pkg_id + +diff --git a/pkg.c b/pkg.c +index 6e83694..227fe14 100644 +--- a/pkg.c ++++ b/pkg.c +@@ -1463,11 +1463,6 @@ struct pkg *pkg_link(struct pkg *pkg) + return pkg; + } + +-const char *pkg_id(const struct pkg *p) +-{ +- return p->_nvr; +-} +- + int pkg_id_snprintf(char *str, size_t size, const struct pkg *pkg) + { + return n_snprintf(str, size, "%s", pkg_id(pkg)); +diff --git a/pkg.h b/pkg.h +index f0d71ac..ec6cc6d 100644 +--- a/pkg.h ++++ b/pkg.h +@@ -231,7 +231,11 @@ EXPORT const char *pkg_pkgdirpath(const struct pkg *pkg); + EXPORT unsigned pkg_file_url_type(const struct pkg *pkg); + + +-EXPORT extern__inline const char *pkg_id(const struct pkg *p); ++static inline const char *pkg_id(const struct pkg *p) ++{ ++ return p->_nvr; ++} ++ + EXPORT int pkg_id_snprintf(char *str, size_t size, const struct pkg *pkg); + EXPORT int pkg_idevr_snprintf(char *str, size_t size, const struct pkg *pkg); + +commit ce00c5a5311fb6d77fcf96b04bca5cf2904d90ae +Author: Marcin Banasiak +Date: Sun Oct 7 12:46:36 2012 +0200 + + Kill redundant EXPORT in pm.h + +diff --git a/pm/pm.h b/pm/pm.h +index 9913168..a20c305 100644 +--- a/pm/pm.h ++++ b/pm/pm.h +@@ -204,7 +204,7 @@ EXPORT int pm_get_dbdepdirs(struct pm_ctx *ctx, + + EXPORT struct pkg *pm_load_package(struct pm_ctx *ctx, + tn_alloc *na, const char *path, unsigned ldflags); +-EXPORT struct pkgdir; ++struct pkgdir; + EXPORT struct pkgdir *pkgdb_to_pkgdir(struct pm_ctx *ctx, const char *rootdir, + const char *path, unsigned pkgdir_ldflags, + const char *key, ...); diff --git a/poldek-link-rpmio.patch b/poldek-link-rpmio.patch new file mode 100644 index 0000000..9b6d993 --- /dev/null +++ b/poldek-link-rpmio.patch @@ -0,0 +1,14 @@ +--- poldek-0.30/configure.ac~ 2012-09-13 15:34:00.000000000 +0200 ++++ poldek-0.30/configure.ac 2012-09-14 23:02:24.729923159 +0200 +@@ -329,10 +329,7 @@ + have_beecrypt=yes, have_beecrypt=no) + fi + +-if test "${is_rpm4}." = "yes." ; then +- AC_CHECK_LIB(rpmio, rpmCleanPath,,AC_MSG_ERROR(["rpmio not found"])) +-fi +- ++AC_CHECK_LIB(rpmio, rpmCleanPath,,AC_MSG_ERROR(["rpmio not found"])) + + AC_CHECK_LIB(rpm, rpmReadPackageInfo,[LIBS="-lrpm $DBLIB $LIBS"], + AC_CHECK_LIB(rpm, rpmReadPackageHeader, diff --git a/poldek-vrpmlog.patch b/poldek-vrpmlog.patch new file mode 100644 index 0000000..ae07f82 --- /dev/null +++ b/poldek-vrpmlog.patch @@ -0,0 +1,74 @@ +diff -ur poldek-0.30/config.h.in poldek-0.30-vrpmlog/config.h.in +--- poldek-0.30/config.h.in 2012-09-13 15:34:44.000000000 +0200 ++++ poldek-0.30-vrpmlog/config.h.in 2012-09-17 21:07:20.000000000 +0200 +@@ -359,6 +359,9 @@ + /* Define to 1 if you have the `vprintf' function. */ + #undef HAVE_VPRINTF + ++/* Define to 1 if you have the `vrpmlog' function. */ ++#undef HAVE_VRPMLOG ++ + /* Define to 1 if you have the `_rpmvercmp' function. */ + #undef HAVE__RPMVERCMP + +diff -ur poldek-0.30/configure.ac poldek-0.30-vrpmlog/configure.ac +--- poldek-0.30/configure.ac 2012-09-17 21:11:07.933745548 +0200 ++++ poldek-0.30-vrpmlog/configure.ac 2012-09-17 21:06:52.533754558 +0200 +@@ -343,7 +343,7 @@ + [$DBLIB -lrpmdb]), + [$DBLIB]) + +-AC_CHECK_FUNCS(rpmlog rpmCheckSig rpmVerifySignature) ++AC_CHECK_FUNCS(rpmlog vrpmlog rpmCheckSig rpmVerifySignature) + + dnl rpm 4.2? + AC_CHECK_FUNCS(rpmtsColor, [LIBS="$LIBS -lpthread" +diff -ur poldek-0.30/pm/rpm/rpm.c poldek-0.30-vrpmlog/pm/rpm/rpm.c +--- poldek-0.30/pm/rpm/rpm.c 2012-09-13 15:26:29.000000000 +0200 ++++ poldek-0.30-vrpmlog/pm/rpm/rpm.c 2012-09-17 21:08:55.423750223 +0200 +@@ -317,14 +317,20 @@ + return dir; + } + +- +-#if defined HAVE_RPMLOG && !defined ENABLE_STATIC ++#if !defined ENABLE_STATIC && (defined HAVE_RPMLOG || defined HAVE_VRPMLOG) + /* XXX hack: rpmlib dumps messges to stdout only... (AFAIK) */ ++#if defined HAVE_RPMLOG + void rpmlog(int prii, const char *fmt, ...) __attribute__ ((visibility("default"))); + +-void rpmlog(int prii, const char *fmt, ...) ++void rpmlog(int prii, const char *fmt, ...) + { + va_list args; ++#elif defined HAVE_VRPMLOG ++void vrpmlog(unsigned prii, const char *fmt, va_list args) __attribute__ ((visibility("default"))); ++ ++void vrpmlog(unsigned prii, const char *fmt, va_list args) ++{ ++#endif + int pri, mask; + int rpmlogMask, logpri = LOGERR, verbose_level = -1; + +@@ -350,7 +356,9 @@ + verbose_level = 2; + } + ++#if defined HAVE_RPMLOG + va_start(args, fmt); ++#endif + + #if 0 + printf("%d, v = %d, verbose = %d, pm_rpm_verbose = %d\n", pri, +@@ -389,9 +397,10 @@ + log(logpri | LOGWARN, "%s\n", p); + } + ++#if defined HAVE_RPMLOG + va_end(args); ++#endif + } +- + #endif /* HAVE_RPMLOG */ + + int pm_rpm_vercmp(const char *one, const char *two) diff --git a/poldek.spec b/poldek.spec index 9feb351..9f1dfc4 100644 --- a/poldek.spec +++ b/poldek.spec @@ -1,20 +1,15 @@ -# -# TODO: -# -# - fails to build without poldek-devel - fix it ! -# # Conditional build: %bcond_with static # don't use shared libraries %bcond_without imode # don't build interactive mode %bcond_without python # don't build python bindings # required versions (forced to avoid SEGV with mixed db used by rpm and poldek) -%define ver_db 4.5.20 +%define ver_db 4.5.20 %define ver_db_rel 8 -%define ver_rpm 4.5-49 +%define ver_rpm 4.5-49 -%define snap rc2 -%define rel 7 +%define snap rc6 +%define rel 4 Summary: RPM packages management helper tool Summary(hu.UTF-8): RPM csomagkezelést segítő eszköz Summary(pl.UTF-8): Pomocnicze narzędzie do zarządzania pakietami RPM @@ -24,17 +19,20 @@ Release: 0.%{snap}.%{rel} License: GPL v2 Group: Applications/System #Source0: http://poldek.pld-linux.org/download/snapshots/%{name}-%{version}-cvs%{snap}.tar.bz2 -Source0: http://carme.pld-linux.org/~cactus/snaps/poldek/%{name}-%{version}%{snap}.tar.bz2 -# Source0-md5: 14135ae2960da09990c50d5b5342be64 +Source0: http://carme.pld-linux.org/~megabajt/snaps/poldek/%{name}-%{version}%{snap}.tar.xz +# Source0-md5: 4b528ad356b02efdd72b81f1ecaceb83 Source1: %{name}.conf Source2: %{name}-multilib.conf -Source3: %{name}-aliases.conf -Source4: %{name}.desktop -Source5: %{name}.png +Source5: %{name}-aliases.conf +Source6: %{name}.desktop +Source7: %{name}.png Patch0: %{name}-vserver-packages.patch Patch1: %{name}-config.patch Patch2: %{name}-size-type.patch Patch3: %{name}-Os-fail-workaround.patch +Patch4: %{name}-link-rpmio.patch +Patch5: %{name}-vrpmlog.patch +Patch6: %{name}-git.patch URL: http://poldek.pld-linux.org/ BuildRequires: autoconf BuildRequires: automake @@ -196,8 +194,11 @@ Moduły języka Python dla poldka. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 -rm -f m4/libtool.m4 m4/lt*.m4 +%{__rm} m4/libtool.m4 m4/lt*.m4 # cleanup backups after patching find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f @@ -209,33 +210,45 @@ chmod u+x ./configure ./doc/conf-xml2.sh %{__autoheader} %{__autoconf} %{__automake} -cp -f config.sub trurlib +cd tndb +%{__libtoolize} +%{__aclocal} +%{__autoheader} +%{__autoconf} +%{__automake} +cd ../trurlib +%{__libtoolize} +%{__aclocal} +%{__autoheader} +%{__autoconf} +%{__automake} +cd .. -CPPFLAGS="-std=gnu99" +CPPFLAGS="%{rpmcppflags} -std=gnu99" %configure \ %{?with_static:--enable-static --disable-shared} \ %{!?with_imode:--disable-imode} \ --enable-nls \ %{?with_python:--with-python} -%{__make} +%{__make} -j1 # --enable-trace %install rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d +install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name}/repos.d,/var/cache/%{name}} -%{__make} install \ +%{__make} install -j1 \ DESTDIR=$RPM_BUILD_ROOT %if %{with python} -%{__make} -C python install \ +%{__make} -C python -j1 install \ DESTDIR=$RPM_BUILD_ROOT \ libdir=%{py_sitedir} %endif -%{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp} +%{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp} -%ifarch i486 i686 ppc sparc alpha athlon +%ifarch i586 i686 ppc sparc alpha athlon %define _ftp_arch %{_target_cpu} %endif %ifarch %{x8664} @@ -250,35 +263,36 @@ install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d %endif %define tld_conf %{SOURCE1} + %ifarch %{x8664} %define tld_multilib_conf %{SOURCE2} %endif -sed -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{tld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld.conf +%{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{tld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld.conf %if 0%{?tld_multilib_conf:1} - sed 's|%%ARCH%%|%{_ftp_alt_arch}|g' < %{tld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-multilib.conf + %{__sed} 's|%%ARCH%%|%{_ftp_alt_arch}|g' < %{tld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-multilib.conf %endif -cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf +cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf %if %{with imode} # add desktop file and icon install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}} -cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop -cp -a %{SOURCE5} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png +cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop +cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png %endif # sources we don't package -rm -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{{rh,pld,fedora,centos}-source,repos.d/pld}.conf +%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{{rh,fedora,centos}-source,repos.d/pld}.conf # include them in %doc -rm -rf configs +%{__rm} -rf configs cp -a conf configs -rm -f configs/Makefile* +%{__rm} -f configs/Makefile* %if %{with python} %py_postclean -rm -f $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la +%{__rm} $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la %endif %find_lang %{name} @@ -351,7 +365,7 @@ if [ -f /etc/poldek.conf.rpmsave ]; then # copy hold= hold=$(grep ^hold /etc/poldek.conf.rpmsave) if [ "$hold" ]; then - sed -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf + %{__sed} -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf fi fi @@ -386,16 +400,19 @@ fi %dir %{_sysconfdir}/%{name}/repos.d %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf -%attr(755,root,root) %{_bindir}/* +%attr(755,root,root) %{_bindir}/ipoldek +%attr(755,root,root) %{_bindir}/poldek +%attr(755,root,root) %{_bindir}/rpmvercmp %dir %{_libdir}/%{name} %attr(755,root,root) %{_libdir}/%{name}/* -%{_mandir}/man1/%{name}* +%{_mandir}/man1/%{name}*.1* %lang(pl) %{_mandir}/pl/man1/%{name}* %{_infodir}/poldek.info* %if %{with imode} %{_desktopdir}/%{name}.desktop %{_pixmapsdir}/%{name}.png %endif +%dir /var/cache/%{name} %if %{without static} %files libs @@ -414,13 +431,28 @@ fi %files devel %defattr(644,root,root,755) -%{!?with_static:%attr(755,root,root) %{_libdir}/lib*.so} -%{_libdir}/lib*.la -%{_includedir}/* +%if %{without static} +%attr(755,root,root) %{_libdir}/libpoclidek.so +%attr(755,root,root) %{_libdir}/libpoldek.so +%attr(755,root,root) %{_libdir}/libtndb.so +%attr(755,root,root) %{_libdir}/libtrurl.so +%attr(755,root,root) %{_libdir}/libvfile.so +%endif +%{_libdir}/libpoclidek.la +%{_libdir}/libpoldek.la +%{_libdir}/libtndb.la +%{_libdir}/libtrurl.la +%{_libdir}/libvfile.la +%{_includedir}/poldek +%{_includedir}/tndb +%{_includedir}/trurl +%{_includedir}/vfile +%{_pkgconfigdir}/tndb.pc %files static %defattr(644,root,root,755) -%{_libdir}/lib*.a +%{_libdir}/libtndb.a +%{_libdir}/libtrurl.a %if %{with python} %files -n python-poldek -- 2.37.3