This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=6a5b37e98d8c0273203fc000a2539bc97101250f commit 6a5b37e98d8c0273203fc000a2539bc97101250f Author: Guillem Jover <[email protected]> AuthorDate: Fri May 4 05:32:36 2018 +0200 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. --- debian/changelog | 1 + po/POTFILES.in | 1 + src/Makefile.am | 1 + src/filesdb.c | 14 -------- src/filesdb.h | 2 -- src/main.h | 4 +++ lib/dpkg/cleanup.c => src/perpkgstate.c | 58 +++++++++------------------------ 7 files changed, 23 insertions(+), 58 deletions(-) diff --git a/debian/changelog b/debian/changelog index bec8355b6..d9985ff11 100644 --- a/debian/changelog +++ b/debian/changelog @@ -181,6 +181,7 @@ dpkg (1.19.1) UNRELEASED; urgency=medium - dpkg: For read-only state functions, check that clientdata is allocated before using it. - libdpkg: Move files list information from dpkg clientdata to pkginfo. + - dpkg: Move ensure_package_clientdata() into its own file. * Build system: - Set distribution tarball format to ustar, instead of default v7 format. - Mark PO4A and POD2MAN as precious variables. diff --git a/po/POTFILES.in b/po/POTFILES.in index 1a8cbc2ae..bc549a21c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -80,6 +80,7 @@ src/filters.c src/help.c src/main.c src/packages.c +src/perpkgstate.c src/querycmd.c src/remove.c src/script.c 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/lib/dpkg/cleanup.c b/src/perpkgstate.c similarity index 54% copy from lib/dpkg/cleanup.c copy to src/perpkgstate.c index ff9d6faee..8a0667a68 100644 --- a/lib/dpkg/cleanup.c +++ b/src/perpkgstate.c @@ -1,8 +1,10 @@ /* - * libdpkg - Debian packaging suite library routines - * cleanup.c - cleanup functions, used when we need to unwind + * dpkg - main program for package management + * perpkgstate.c - struct perpackagestate and function handling * * Copyright © 1995 Ian Jackson <[email protected]> + * Copyright © 2000,2001 Wichert Akkerman <[email protected]> + * Copyright © 2008-2014 Guillem Jover <[email protected]> * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,49 +23,21 @@ #include <config.h> #include <compat.h> -#include <dirent.h> -#include <unistd.h> -#include <stdio.h> - #include <dpkg/dpkg.h> +#include <dpkg/dpkg-db.h> -void -cu_closepipe(int argc, void **argv) -{ - int *p1 = (int *)argv[0]; - - close(p1[0]); - close(p1[1]); -} +#include "main.h" void -cu_closestream(int argc, void **argv) +ensure_package_clientdata(struct pkginfo *pkg) { - FILE *f = (FILE *)(argv[0]); - - fclose(f); -} - -void -cu_closedir(int argc, void **argv) -{ - DIR *d = (DIR *)(argv[0]); - - closedir(d); -} - -void -cu_closefd(int argc, void **argv) -{ - int ip = *(int *)argv[0]; - - close(ip); -} - -void -cu_filename(int argc, void **argv) -{ - const char *filename = argv[0]; - - (void)unlink(filename); + 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; } -- Dpkg.Org's dpkg

