summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2018-05-04 05:32:36 +0200
committerGuillem Jover <guillem@debian.org>2018-08-30 03:14:08 +0200
commit6a5b37e98d8c0273203fc000a2539bc97101250f (patch)
tree87a8f4b34e0617fb182f1e2151220fae14c21c38 /src
parenta9663b000b9c96030c7062fa01c0bee038cd11f9 (diff)
downloaddpkg-6a5b37e98d8c0273203fc000a2539bc97101250f.tar.gz
dpkg: Move struct perpackagestate handling into its own file
This is not really part of the fsys db handling, and we are not making use of it anymore in it, so let's move it somewhere else more appropriate.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/filesdb.c14
-rw-r--r--src/filesdb.h2
-rw-r--r--src/main.h4
-rw-r--r--src/perpkgstate.c43
5 files changed, 48 insertions, 16 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 1e9735acd..38b725169 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,6 +45,7 @@ dpkg_SOURCES = \
help.c \
main.c main.h \
packages.c \
+ perpkgstate.c \
remove.c \
script.c \
select.c \
diff --git a/src/filesdb.c b/src/filesdb.c
index 22aad89e0..8421d327e 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -58,20 +58,6 @@
static bool allpackagesdone = false;
-void
-ensure_package_clientdata(struct pkginfo *pkg)
-{
- if (pkg->clientdata)
- return;
- pkg->clientdata = nfmalloc(sizeof(struct perpackagestate));
- pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
- pkg->clientdata->color = PKG_CYCLE_WHITE;
- pkg->clientdata->enqueued = false;
- pkg->clientdata->replacingfilesandsaid = 0;
- pkg->clientdata->cmdline_seen = 0;
- pkg->clientdata->trigprocdeferred = NULL;
-}
-
void note_must_reread_files_inpackage(struct pkginfo *pkg) {
allpackagesdone = false;
pkg->files_list_valid = false;
diff --git a/src/filesdb.h b/src/filesdb.h
index 4fbe6b0a7..f38fdd245 100644
--- a/src/filesdb.h
+++ b/src/filesdb.h
@@ -47,8 +47,6 @@
struct pkginfo;
-void ensure_package_clientdata(struct pkginfo *pkg);
-
void ensure_diversions(void);
enum statdb_parse_flags {
diff --git a/src/main.h b/src/main.h
index f5695aeea..bc3f07a65 100644
--- a/src/main.h
+++ b/src/main.h
@@ -148,6 +148,10 @@ struct invoke_list {
struct invoke_hook *head, **tail;
};
+/* from perpkgstate.c */
+
+void ensure_package_clientdata(struct pkginfo *pkg);
+
/* from archives.c */
int archivefiles(const char *const *argv);
diff --git a/src/perpkgstate.c b/src/perpkgstate.c
new file mode 100644
index 000000000..8a0667a68
--- /dev/null
+++ b/src/perpkgstate.c
@@ -0,0 +1,43 @@
+/*
+ * dpkg - main program for package management
+ * perpkgstate.c - struct perpackagestate and function handling
+ *
+ * Copyright © 1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ * Copyright © 2000,2001 Wichert Akkerman <wakkerma@debian.org>
+ * Copyright © 2008-2014 Guillem Jover <guillem@debian.org>
+ *
+ * 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 <https://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <compat.h>
+
+#include <dpkg/dpkg.h>
+#include <dpkg/dpkg-db.h>
+
+#include "main.h"
+
+void
+ensure_package_clientdata(struct pkginfo *pkg)
+{
+ if (pkg->clientdata)
+ return;
+ pkg->clientdata = nfmalloc(sizeof(struct perpackagestate));
+ pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
+ pkg->clientdata->color = PKG_CYCLE_WHITE;
+ pkg->clientdata->enqueued = false;
+ pkg->clientdata->replacingfilesandsaid = 0;
+ pkg->clientdata->cmdline_seen = 0;
+ pkg->clientdata->trigprocdeferred = NULL;
+}