And finally split the signing support into a separate library
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 29 Sep 2010 09:01:49 +0000 (12:01 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 29 Sep 2010 09:12:58 +0000 (12:12 +0300)
- For a library with just one public function this might seem like
  a huge overkill but it permits cleanly separating dependencies:
  nothing but package signing requires GnuPG. This lets the signing
  support be stuffed into a separate package, avoiding having to
  drag gpg in on every installation (signing isn't something everybody
  does) and without having potentially broken interfaces in the API,
  essentially solving RhBug:624585.

  It also liberates signing to use libraries that might be off-limits
  for the core rpm, such as perhaps in the future doing signing
  by ourselves with the help of something like gpgme (which requires
  far too many things to drag into core rpm).

Makefile.am
lib/Makefile.am
lib/rpmcli.h
lib/rpmgensig.c
lib/rpmsign.h [new file with mode: 0644]
preinstall.am

index 4102e6a..ece4a71 100644 (file)
@@ -70,6 +70,8 @@ pkginclude_HEADERS += lib/rpmtypes.h
 pkginclude_HEADERS += lib/rpmvf.h
 pkginclude_HEADERS += lib/rpmplugins.h
 
+pkginclude_HEADERS += lib/rpmsign.h
+
 pkginclude_HEADERS += build/rpmbuild.h
 pkginclude_HEADERS += build/rpmfc.h
 pkginclude_HEADERS += build/rpmspec.h
@@ -113,7 +115,7 @@ rpmkeys_LDADD +=    @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
 rpmsign_SOURCES =      rpmsign.c debug.h system.h
 rpmsign_CPPFLAGS =     $(AM_CPPFLAGS)
 rpmsign_LDADD =                libcliutils.la
-rpmsign_LDADD +=       lib/librpm.la rpmio/librpmio.la
+rpmsign_LDADD +=       lib/librpmsign.la lib/librpm.la rpmio/librpmio.la
 rpmsign_LDADD +=       @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
 
 rpmbuild_SOURCES =     rpmbuild.c debug.h system.h
index 44938a9..10b3938 100644 (file)
@@ -11,13 +11,15 @@ AM_CPPFLAGS += -DSYSCONFDIR="\"$(sysconfdir)\""
 AM_CPPFLAGS += -DLOCALSTATEDIR="\"$(localstatedir)\""
 AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"rpmpopt-${VERSION}\""
 
+usrlibdir = $(libdir)
+
 check_PROGRAMS =
 CLEANFILES =
 EXTRA_DIST = gentagtbl.sh tagtbl.C rpmhash.C rpmhash.H
 EXTRA_PROGRAMS =
+usrlib_LTLIBRARIES =
 
-usrlibdir = $(libdir)
-usrlib_LTLIBRARIES = librpm.la
+usrlib_LTLIBRARIES += librpm.la
 librpm_la_SOURCES = \
        backend/dbconfig.c backend/db3.c backend/dbi.h \
        headerutil.c header.c headerfmt.c header_internal.h \
@@ -34,7 +36,7 @@ librpm_la_SOURCES = \
        verify.c rpmlock.c rpmlock.h misc.h \
        rpmscript.h rpmscript.c legacy.c merge.c \
        rpmliblua.c rpmliblua.h rpmchroot.c rpmchroot.h \
-       rpmplugins.c rpmplugins.h rpmgensig.c
+       rpmplugins.c rpmplugins.h
 
 librpm_la_LDFLAGS = -version-info 1:0:0
 
@@ -58,6 +60,15 @@ tagtbl.C: Makefile.am $(srcdir)/rpmtag.h gentagtbl.sh
         mv -f $@.new $@
 BUILT_SOURCES = tagtbl.C
 
+usrlib_LTLIBRARIES += librpmsign.la
+librpmsign_la_SOURCES = rpmgensig.c
+librpmsign_la_LDFLAGS = -version-info 0:0:0
+librpmsign_la_LIBADD = \
+       librpm.la \
+       $(top_builddir)/rpmio/librpmio.la \
+       @WITH_POPT_LIB@ \
+       @LIBINTL@
+
 if WITH_INTERNAL_DB
 # XXX watchout, $(top_builddir)/db3/libdb.la created by this Makefile may surprise
 libdb_la = $(top_builddir)/db3/libdb.la
@@ -71,6 +82,7 @@ $(libdb_la): $(top_builddir)/db3/libdb-$(BDBVER).la
          < $(top_builddir)/db3/libdb-$(BDBVER).la > $(libdb_la)
 CLEANFILES += $(libdb_la)
 
+
 rpmlibexec_PROGRAMS =
 
 rpmlibexec_PROGRAMS += rpmdb_archive
index 550f383..1637942 100644 (file)
@@ -378,15 +378,6 @@ extern struct poptOption rpmInstallPoptTable[];
 /* ==================================================================== */
 /** \name RPMK */
 
-/** \ingroup rpmcli
- * Create/delete package signatures.
- * @param argv         array of package path arguments (NULL terminated)
- * @param deleting     adding or deleting signature(s)
- * @param passPhrase   passphrase (ignored when deleting)
- * @return             0 on success
- */
-int rpmcliSign(ARGV_const_t argv, int deleting, const char *passPhrase);
-
 /** Import public key(s) to rpm keyring
  * @param ts           transaction set
  * @param argv         array of pubkey path arguments (NULL terminated)
index 4bc22ca..0f8e097 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <rpm/rpmlib.h>                        /* RPMSIGTAG & related */
 #include <rpm/rpmpgp.h>
-#include <rpm/rpmcli.h>
+#include <rpm/rpmsign.h>
 #include <rpm/rpmfileutil.h>   /* rpmMkTemp() */
 #include <rpm/rpmlog.h>
 #include <rpm/rpmstring.h>
diff --git a/lib/rpmsign.h b/lib/rpmsign.h
new file mode 100644 (file)
index 0000000..f961b19
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef _RPMSIGN_H
+#define _RPMSIGN_H
+
+#include <rpm/argv.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \ingroup rpmsign
+ * Create/delete package signatures.
+ * @param argv         array of package path arguments (NULL terminated)
+ * @param deleting     adding or deleting signature(s)
+ * @param passPhrase   passphrase (ignored when deleting)
+ * @return             0 on success
+ */
+int rpmcliSign(ARGV_const_t argv, int deleting, const char *passPhrase);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RPMSIGN_H */
index 39cf3f8..00687c7 100644 (file)
@@ -118,6 +118,10 @@ include/rpm/rpmplugins.h: lib/rpmplugins.h include/rpm/$(dirstamp)
        $(INSTALL_DATA) $(top_srcdir)/lib/rpmplugins.h include/rpm/rpmplugins.h
 BUILT_SOURCES += include/rpm/rpmplugins.h
 CLEANFILES += include/rpm/rpmplugins.h
+include/rpm/rpmsign.h: lib/rpmsign.h include/rpm/$(dirstamp)
+       $(INSTALL_DATA) $(top_srcdir)/lib/rpmsign.h include/rpm/rpmsign.h
+BUILT_SOURCES += include/rpm/rpmsign.h
+CLEANFILES += include/rpm/rpmsign.h
 include/rpm/rpmbuild.h: build/rpmbuild.h include/rpm/$(dirstamp)
        $(INSTALL_DATA) $(top_srcdir)/build/rpmbuild.h include/rpm/rpmbuild.h
 BUILT_SOURCES += include/rpm/rpmbuild.h