Просмотр исходного кода

libdpkg: Move triglib declarations to a new triglib.h

Guillem Jover лет назад: 16
Родитель
Сommit
58a93c17fc
14 измененных файлов с 111 добавлено и 70 удалено
  1. 1 0
      lib/dpkg/Makefile.am
  2. 1 0
      lib/dpkg/dbmodify.c
  3. 0 70
      lib/dpkg/dpkg-db.h
  4. 1 0
      lib/dpkg/fields.c
  5. 1 0
      lib/dpkg/trigdeferred.l
  6. 1 0
      lib/dpkg/triglib.c
  7. 99 0
      lib/dpkg/triglib.h
  8. 1 0
      src/archives.c
  9. 1 0
      src/configure.c
  10. 1 0
      src/help.c
  11. 1 0
      src/processarc.c
  12. 1 0
      src/remove.c
  13. 1 0
      src/trigcmd.c
  14. 1 0
      src/trigproc.c

+ 1 - 0
lib/dpkg/Makefile.am

@@ -81,4 +81,5 @@ pkginclude_HEADERS = \
 	string.h \
 	subproc.h \
 	tarfn.h \
+	triglib.h \
 	varbuf.h

+ 1 - 0
lib/dpkg/dbmodify.c

@@ -43,6 +43,7 @@
 #include <dpkg/dpkg-db.h>
 #include <dpkg/file.h>
 #include <dpkg/dir.h>
+#include <dpkg/triglib.h>
 
 char *statusfile=NULL, *availablefile=NULL;
 

+ 0 - 70
lib/dpkg/dpkg-db.h

@@ -245,76 +245,6 @@ void trigdef_update_printf(const char *format, ...) DPKG_ATTR_PRINTF(1);
 int trigdef_yylex(void);
 void trigdef_process_done(void);
 
-/*** hooks for more sophisticated processing in dpkg proper ***/
-
-/* We do things like this so we can get most of the trigger tracking
- * in dpkg-query, dselect, and so on, but avoid the transitional
- * processing and deferred trigproc queue management other than when
- * we're actually doing real package management work. */
-
-struct trigfileint {
-  struct pkginfo *pkg;
-  struct filenamenode *fnn;
-  struct trigfileint *samefile_next;
-  struct {
-    struct trigfileint *next, *back;
-  } inoverall;
-};
-
-struct trig_hooks {
- /* The first two are normally NULL.
-  * If non-NULL, we're dpkg proper and we might need to invent trigger
-  * activations as the first run of a triggers-supporting dpkg.
-  */
-  void (*enqueue_deferred)(struct pkginfo *pend);
-  void (*transitional_activate)(enum modstatdb_rw cstatus);
-
-  struct filenamenode *(*namenode_find)(const char *filename, int nonew);
-  struct trigfileint **(*namenode_interested)(struct filenamenode *fnn);
-
-  /* Returns a pointer from nfmalloc. */
-  const char *(*namenode_name)(struct filenamenode *fnn);
-};
-
-#define TRIGHOOKS_DEFINE_NAMENODE_ACCESSORS				 \
-  static struct trigfileint **th_nn_interested(struct filenamenode *fnn) \
-    { return &fnn->trig_interested; }					 \
-  static const char *th_nn_name(struct filenamenode *fnn)		 \
-    { return fnn->name; }
-
-void trig_override_hooks(const struct trig_hooks *hooks);
-
-/*** from triglib.c ***/
-
-char *trig_get_triggersdir(const char *admindir);
-
-void trig_file_activate_byname(const char *trig, struct pkginfo *aw);
-void trig_file_activate(struct filenamenode *trig, struct pkginfo *aw);
-
-int trig_note_pend_core(struct pkginfo *pend, const char *trig /*not copied!*/);
-int trig_note_pend(struct pkginfo *pend, const char *trig /*not copied!*/);
-int trig_note_aw(struct pkginfo *pend, struct pkginfo *aw);
-void trig_clear_awaiters(struct pkginfo *notpend);
-
-void trig_enqueue_awaited_pend(struct pkginfo *pend);
-void trig_fixup_awaiters(enum modstatdb_rw cstatus);
-
-void trig_file_interests_ensure(void);
-void trig_file_interests_save(void);
-
-void trig_cicb_interest_delete(const char *trig, void *user);
-void trig_cicb_interest_add(const char *trig, void *user);
-typedef void trig_parse_cicb(const char *trig, void *user);
-void trig_parse_ci(const char *file, trig_parse_cicb *interest,
-                   trig_parse_cicb *activate, void *user);
-
-/* Called by process_archive. */
-void trig_cicb_statuschange_activate(const char *trig, void *user);
-
-void trig_incorporate(enum modstatdb_rw cstatus, const char *admindir);
-
-const char *illegal_triggername(const char *p);
-
 /*** from database.c ***/
 
 struct pkginfo *findpackage(const char *name);

+ 1 - 0
lib/dpkg/fields.c

@@ -31,6 +31,7 @@
 #include <dpkg/dpkg-db.h>
 #include <dpkg/path.h>
 #include <dpkg/parsedump.h>
+#include <dpkg/triglib.h>
 
 static int
 convert_string(struct parsedb_state *ps, const char *what, int otherwise,

+ 1 - 0
lib/dpkg/trigdeferred.l

@@ -45,6 +45,7 @@
 #include <dpkg/dpkg-db.h>
 #include <dpkg/file.h>
 #include <dpkg/dir.h>
+#include <dpkg/triglib.h>
 
 #define YY_NO_INPUT
 

+ 1 - 0
lib/dpkg/triglib.c

@@ -36,6 +36,7 @@
 #include <dpkg/pkg-list.h>
 #include <dpkg/dlist.h>
 #include <dpkg/dir.h>
+#include <dpkg/triglib.h>
 
 const char *
 illegal_triggername(const char *p)

+ 99 - 0
lib/dpkg/triglib.h

@@ -0,0 +1,99 @@
+/*
+ * libdpkg - Debian packaging suite library routines
+ * triglib.h - declarations for trigger handling
+ *
+ * Copyright © 2007 Canonical, Ltd.
+ *   written by Ian Jackson <ian@chiark.greenend.org.uk>
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBDPKG_TRIGLIB_H
+#define LIBDPKG_TRIGLIB_H
+
+#include <dpkg/macros.h>
+#include <dpkg/dpkg-db.h>
+
+DPKG_BEGIN_DECLS
+
+/*
+ * Hooks for more sophisticated processing in dpkg proper.
+ *
+ * We do things like this so we can get most of the trigger tracking
+ * in dpkg-query, dselect, and so on, but avoid the transitional
+ * processing and deferred trigproc queue management other than when
+ * we're actually doing real package management work.
+ */
+
+const char *illegal_triggername(const char *p);
+
+struct trigfileint {
+	struct pkginfo *pkg;
+	struct filenamenode *fnn;
+	struct trigfileint *samefile_next;
+	struct {
+		struct trigfileint *next, *back;
+	} inoverall;
+};
+
+/* The first two hooks are normally NULL.
+ * If non-NULL, we're dpkg proper and we might need to invent trigger
+ * activations as the first run of a triggers-supporting dpkg. */
+struct trig_hooks {
+	void (*enqueue_deferred)(struct pkginfo *pend);
+	void (*transitional_activate)(enum modstatdb_rw cstatus);
+
+	struct filenamenode *(*namenode_find)(const char *filename, int nonew);
+	struct trigfileint **(*namenode_interested)(struct filenamenode *fnn);
+
+	/* Returns a pointer from nfmalloc. */
+	const char *(*namenode_name)(struct filenamenode *fnn);
+};
+
+#define TRIGHOOKS_DEFINE_NAMENODE_ACCESSORS				 \
+  static struct trigfileint **th_nn_interested(struct filenamenode *fnn) \
+    { return &fnn->trig_interested; }					 \
+  static const char *th_nn_name(struct filenamenode *fnn)		 \
+    { return fnn->name; }
+
+void trig_override_hooks(const struct trig_hooks *hooks);
+
+char *trig_get_triggersdir(const char *admindir);
+
+void trig_file_activate_byname(const char *trig, struct pkginfo *aw);
+void trig_file_activate(struct filenamenode *trig, struct pkginfo *aw);
+
+int trig_note_pend_core(struct pkginfo *pend, const char *trig /*not copied!*/);
+int trig_note_pend(struct pkginfo *pend, const char *trig /*not copied!*/);
+int trig_note_aw(struct pkginfo *pend, struct pkginfo *aw);
+void trig_clear_awaiters(struct pkginfo *notpend);
+
+void trig_enqueue_awaited_pend(struct pkginfo *pend);
+void trig_fixup_awaiters(enum modstatdb_rw cstatus);
+
+void trig_file_interests_ensure(void);
+void trig_file_interests_save(void);
+
+typedef void trig_parse_cicb(const char *trig, void *user);
+void trig_cicb_interest_delete(const char *trig, void *user);
+void trig_cicb_interest_add(const char *trig, void *user);
+void trig_cicb_statuschange_activate(const char *trig, void *user);
+void trig_parse_ci(const char *file, trig_parse_cicb *interest,
+                   trig_parse_cicb *activate, void *user);
+
+void trig_incorporate(enum modstatdb_rw cstatus, const char *admindir);
+
+DPKG_END_DECLS
+
+#endif /* LIBDPKG_TRIGLIB_H */

+ 1 - 0
src/archives.c

@@ -48,6 +48,7 @@
 #include <dpkg/command.h>
 #include <dpkg/tarfn.h>
 #include <dpkg/myopt.h>
+#include <dpkg/triglib.h>
 
 #ifdef WITH_SELINUX
 #include <selinux/selinux.h>

+ 1 - 0
src/configure.c

@@ -45,6 +45,7 @@
 #include <dpkg/buffer.h>
 #include <dpkg/file.h>
 #include <dpkg/subproc.h>
+#include <dpkg/triglib.h>
 
 #include "filesdb.h"
 #include "main.h"

+ 1 - 0
src/help.c

@@ -39,6 +39,7 @@
 #include <dpkg/path.h>
 #include <dpkg/subproc.h>
 #include <dpkg/command.h>
+#include <dpkg/triglib.h>
 
 #include "filesdb.h"
 #include "main.h"

+ 1 - 0
src/processarc.c

@@ -46,6 +46,7 @@
 #include <dpkg/dir.h>
 #include <dpkg/tarfn.h>
 #include <dpkg/myopt.h>
+#include <dpkg/triglib.h>
 
 #include "filesdb.h"
 #include "main.h"

+ 1 - 0
src/remove.c

@@ -39,6 +39,7 @@
 #include <dpkg/dpkg-db.h>
 #include <dpkg/dir.h>
 #include <dpkg/myopt.h>
+#include <dpkg/triglib.h>
 
 #include "filesdb.h"
 #include "main.h"

+ 1 - 0
src/trigcmd.c

@@ -39,6 +39,7 @@
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
 #include <dpkg/myopt.h>
+#include <dpkg/triglib.h>
 
 const char thisname[] = "dpkg-trigger";
 

+ 1 - 0
src/trigproc.c

@@ -32,6 +32,7 @@
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
 #include <dpkg/pkg-queue.h>
+#include <dpkg/triglib.h>
 
 #include "main.h"
 #include "filesdb.h"