The following commit has been merged in the master branch:
commit 47181583fcb738c7873e1bc54f5ea8cf54bc8023
Author: Guillem Jover <[email protected]>
Date: Tue Feb 15 07:00:16 2011 +0100
Switch pkgadminfile() to get an explicit pkgbin as argument
The code does not do anything yet with this new argument, but it will
allow it to access the multiarch information, once the on-disk layout
is changed.
diff --git a/src/depcon.c b/src/depcon.c
index 8322fba..c577b3a 100644
--- a/src/depcon.c
+++ b/src/depcon.c
@@ -75,7 +75,7 @@ foundcyclebroken(struct cyclesofarlink *thislink, struct
cyclesofarlink *sofar,
* able to do something straight away when findbreakcycle returns. */
sofar= thislink;
for (sol = sofar; !(sol != sofar && sol->pkg == dependedon); sol =
sol->prev) {
- if (!pkg_infodb_has_file(sol->pkg, POSTINSTFILE))
+ if (!pkg_infodb_has_file(sol->pkg, &sol->pkg->installed, POSTINSTFILE))
break;
}
diff --git a/src/filesdb.c b/src/filesdb.c
index 68b9986..2a602a4 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -77,7 +77,7 @@ pkgadmindir(void)
}
const char *
-pkgadminfile(struct pkginfo *pkg, const char *filetype)
+pkgadminfile(struct pkginfo *pkg, struct pkgbin *pkgbin, const char *filetype)
{
static struct varbuf vb;
@@ -297,7 +297,7 @@ ensure_packagefiles_available(struct pkginfo *pkg)
return;
}
- filelistfile= pkgadminfile(pkg,LISTFILE);
+ filelistfile = pkgadminfile(pkg, &pkg->installed, LISTFILE);
onerr_abort++;
@@ -404,7 +404,7 @@ pkg_files_optimize_load(struct pkg_array *array)
pkg->clientdata->listfile_phys_offs = -1;
- listfile = pkgadminfile(pkg, LISTFILE);
+ listfile = pkgadminfile(pkg, &pkg->installed, LISTFILE);
fd = open(listfile, O_RDONLY);
if (fd < 0)
@@ -437,7 +437,7 @@ pkg_files_optimize_load(struct pkg_array *array)
const char *listfile;
int fd;
- listfile = pkgadminfile(pkg, LISTFILE);
+ listfile = pkgadminfile(pkg, &pkg->installed, LISTFILE);
fd = open(listfile, O_RDONLY | O_NONBLOCK);
if (fd != -1) {
@@ -502,14 +502,14 @@ void ensure_allinstfiles_available_quiet(void) {
* has any flag bits set in mask.
*/
void
-write_filelist_except(struct pkginfo *pkg, struct fileinlist *list,
- enum fnnflags mask)
+write_filelist_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
+ struct fileinlist *list, enum fnnflags mask)
{
static struct varbuf newvb;
const char *listfile;
FILE *file;
- listfile = pkgadminfile(pkg, LISTFILE);
+ listfile = pkgadminfile(pkg, pkgbin, LISTFILE);
varbuf_reset(&newvb);
varbuf_add_str(&newvb, listfile);
diff --git a/src/filesdb.h b/src/filesdb.h
index 30dae88..21d14b0 100644
--- a/src/filesdb.h
+++ b/src/filesdb.h
@@ -133,7 +133,8 @@ struct diversion {
};
const char *pkgadmindir(void);
-const char *pkgadminfile(struct pkginfo *pkg, const char *filetype);
+const char *pkgadminfile(struct pkginfo *pkg, struct pkgbin *pkgbin,
+ const char *filetype);
struct filepackages_iterator;
struct filepackages_iterator *filepackages_iter_new(struct filenamenode *fnn);
@@ -163,8 +164,8 @@ void ensure_allinstfiles_available(void);
void ensure_allinstfiles_available_quiet(void);
void note_must_reread_files_inpackage(struct pkginfo *pkg);
struct filenamenode *findnamenode(const char *filename, enum fnnflags flags);
-void write_filelist_except(struct pkginfo *pkg, struct fileinlist *list,
- enum fnnflags mask);
+void write_filelist_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
+ struct fileinlist *list, enum fnnflags mask);
struct reversefilelistiter { struct fileinlist *todo; };
diff --git a/src/help.c b/src/help.c
index db78c10..c43dcc3 100644
--- a/src/help.c
+++ b/src/help.c
@@ -296,7 +296,7 @@ vmaintainer_script_installed(struct pkginfo *pkg, const
char *scriptname,
struct stat stab;
char buf[100];
- scriptpath= pkgadminfile(pkg,scriptname);
+ scriptpath = pkgadminfile(pkg, &pkg->installed, scriptname);
sprintf(buf, _("installed %s script"), desc);
command_init(&cmd, scriptpath, buf);
@@ -398,7 +398,7 @@ int maintainer_script_alternative(struct pkginfo *pkg,
struct stat stab;
char buf[100];
- oldscriptpath= pkgadminfile(pkg,scriptname);
+ oldscriptpath = pkgadminfile(pkg, &pkg->installed, scriptname);
sprintf(buf, _("old %s script"), desc);
command_init(&cmd, oldscriptpath, buf);
diff --git a/src/infodb.c b/src/infodb.c
index 3eedf75..31dcbf1 100644
--- a/src/infodb.c
+++ b/src/infodb.c
@@ -38,12 +38,13 @@
#include "infodb.h"
bool
-pkg_infodb_has_file(struct pkginfo *pkg, const char *name)
+pkg_infodb_has_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
+ const char *name)
{
const char *filename;
struct stat stab;
- filename = pkgadminfile(pkg, name);
+ filename = pkgadminfile(pkg, pkgbin, name);
if (lstat(filename, &stab) == 0)
return true;
else if (errno == ENOENT)
@@ -53,7 +54,8 @@ pkg_infodb_has_file(struct pkginfo *pkg, const char *name)
}
void
-pkg_infodb_foreach(struct pkginfo *pkg, pkg_infodb_file_func *func)
+pkg_infodb_foreach(struct pkginfo *pkg, struct pkgbin *pkgbin,
+ pkg_infodb_file_func *func)
{
DIR *db_dir;
struct dirent *db_de;
diff --git a/src/infodb.h b/src/infodb.h
index 8ab5fe5..338b5bc 100644
--- a/src/infodb.h
+++ b/src/infodb.h
@@ -25,10 +25,12 @@
#include <dpkg/dpkg-db.h>
-bool pkg_infodb_has_file(struct pkginfo *pkg, const char *name);
+bool pkg_infodb_has_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
+ const char *name);
typedef void pkg_infodb_file_func(const char *filename, const char *filetype);
-void pkg_infodb_foreach(struct pkginfo *pkg, pkg_infodb_file_func *func);
+void pkg_infodb_foreach(struct pkginfo *pkg, struct pkgbin *pkgbin,
+ pkg_infodb_file_func *func);
#endif /* DPKG_INFODB_H */
diff --git a/src/processarc.c b/src/processarc.c
index af9d48b..cfda85e 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -242,7 +242,7 @@ pkg_infodb_update(struct pkginfo *pkg, char *cidir, char
*cidirrest)
match_node_free(match_node);
}
- pkg_infodb_foreach(pkg, pkg_infodb_update_file);
+ pkg_infodb_foreach(pkg, &pkg->available, pkg_infodb_update_file);
while ((match_node = match_head)) {
strcpy(cidirrest, match_node->filetype);
@@ -303,7 +303,7 @@ pkg_infodb_update(struct pkginfo *pkg, char *cidir, char
*cidirrest)
}
/* Right, install it */
- newinfofilename = pkgadminfile(pkg,de->d_name);
+ newinfofilename = pkgadminfile(pkg, &pkg->available, de->d_name);
if (rename(cidir, newinfofilename))
ohshite(_("unable to install new info file `%.250s' as `%.250s'"),
cidir, newinfofilename);
@@ -356,7 +356,7 @@ pkg_disappear(struct pkginfo *pkg, struct pkginfo *infavour)
/* OK, now we delete all the stuff in the ‘info’ directory .. */
debug(dbg_general, "pkg_disappear cleaning info directory");
- pkg_infodb_foreach(pkg, pkg_infodb_remove_file);
+ pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_remove_file);
dir_sync_path(pkgadmindir());
pkg->status = stat_notinstalled;
@@ -1041,13 +1041,13 @@ void process_archive(const char *filename) {
/* OK, now we can write the updated files-in-this package list,
* since we've done away (hopefully) with all the old junk. */
- write_filelist_except(pkg,newfileslist,0);
+ write_filelist_except(pkg, &pkg->available, newfileslist, 0);
/* Trigger interests may have changed.
* Firstly we go through the old list of interests deleting them.
* Then we go through the new list adding them. */
strcpy(cidirrest, TRIGGERSCIFILE);
- trig_parse_ci(pkgadminfile(pkg, TRIGGERSCIFILE),
+ trig_parse_ci(pkgadminfile(pkg, &pkg->installed, TRIGGERSCIFILE),
trig_cicb_interest_delete, NULL, pkg);
trig_parse_ci(cidir, trig_cicb_interest_add, NULL, pkg);
trig_file_interests_save();
@@ -1263,8 +1263,8 @@ void process_archive(const char *filename) {
/* Found one. We delete remove the list entry for this file,
* (and any others in the same package) and then mark the package
* as requiring a reread. */
- write_filelist_except(otherpkg, otherpkg->clientdata->files,
- fnnf_elide_other_lists);
+ write_filelist_except(otherpkg, &otherpkg->installed,
+ otherpkg->clientdata->files,
fnnf_elide_other_lists);
ensure_package_clientdata(otherpkg);
debug(dbg_veryverbose, "process_archive overwrote from %s",
otherpkg->set->name);
}
diff --git a/src/querycmd.c b/src/querycmd.c
index d16df69..054435e 100644
--- a/src/querycmd.c
+++ b/src/querycmd.c
@@ -545,7 +545,7 @@ control_path_file(struct pkginfo *pkg, const char
*control_file)
const char *control_path;
struct stat st;
- control_path = pkgadminfile(pkg, control_file);
+ control_path = pkgadminfile(pkg, &pkg->installed, control_file);
if (stat(control_path, &st) < 0)
return;
if (!S_ISREG(st.st_mode))
@@ -588,7 +588,7 @@ control_path(const char *const *argv)
if (control_file)
control_path_file(pkg, control_file);
else
- pkg_infodb_foreach(pkg, pkg_infodb_print_filename);
+ pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_print_filename);
modstatdb_shutdown();
diff --git a/src/remove.c b/src/remove.c
index 4416b3a..6e81215 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -288,16 +288,16 @@ removal_bulk_remove_files(struct pkginfo *pkg)
if (secure_unlink(fnvb.buf))
ohshite(_("unable to securely remove '%.250s'"), fnvb.buf);
}
- write_filelist_except(pkg,leftover,0);
+ write_filelist_except(pkg, &pkg->installed, leftover, 0);
maintainer_script_installed(pkg, POSTRMFILE, "post-removal",
"remove", NULL);
- trig_parse_ci(pkgadminfile(pkg, TRIGGERSCIFILE),
+ trig_parse_ci(pkgadminfile(pkg, &pkg->installed, TRIGGERSCIFILE),
trig_cicb_interest_delete, NULL, pkg);
trig_file_interests_save();
debug(dbg_general, "removal_bulk cleaning info directory");
- pkg_infodb_foreach(pkg, removal_bulk_remove_file);
+ pkg_infodb_foreach(pkg, &pkg->installed, removal_bulk_remove_file);
dir_sync_path(pkgadmindir());
pkg->status= stat_configfiles;
@@ -388,7 +388,7 @@ static void removal_bulk_remove_leftover_dirs(struct
pkginfo *pkg) {
push_leftover(&leftover,namenode);
continue;
}
- write_filelist_except(pkg,leftover,0);
+ write_filelist_except(pkg, &pkg->installed, leftover, 0);
modstatdb_note(pkg);
push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
@@ -514,7 +514,8 @@ static void removal_bulk_remove_configfiles(struct pkginfo
*pkg) {
}
/* Remove the conffiles from the file list file. */
- write_filelist_except(pkg, pkg->clientdata->files, fnnf_old_conff);
+ write_filelist_except(pkg, &pkg->installed, pkg->clientdata->files,
+ fnnf_old_conff);
pkg->installed.conffiles = NULL;
modstatdb_note(pkg);
@@ -537,7 +538,7 @@ void removal_bulk(struct pkginfo *pkg) {
removal_bulk_remove_files(pkg);
}
- foundpostrm = pkg_infodb_has_file(pkg, POSTRMFILE);
+ foundpostrm = pkg_infodb_has_file(pkg, &pkg->installed, POSTRMFILE);
debug(dbg_general, "removal_bulk purging? foundpostrm=%d",foundpostrm);
@@ -561,13 +562,13 @@ void removal_bulk(struct pkginfo *pkg) {
/* Retry empty directories, and warn on any leftovers that aren't. */
removal_bulk_remove_leftover_dirs(pkg);
- filename = pkgadminfile(pkg, LISTFILE);
+ filename = pkgadminfile(pkg, &pkg->installed, LISTFILE);
debug(dbg_general, "removal_bulk purge done, removing list `%s'",
filename);
if (unlink(filename) && errno != ENOENT)
ohshite(_("cannot remove old files list"));
- filename = pkgadminfile(pkg, POSTRMFILE);
+ filename = pkgadminfile(pkg, &pkg->installed, POSTRMFILE);
debug(dbg_general, "removal_bulk purge done, removing postrm `%s'",
filename);
if (unlink(filename) && errno != ENOENT)
diff --git a/src/trigproc.c b/src/trigproc.c
index 63fb00e..c81a023 100644
--- a/src/trigproc.c
+++ b/src/trigproc.c
@@ -135,7 +135,7 @@ trig_activate_packageprocessing(struct pkginfo *pkg)
debug(dbg_triggersdetail, "trigproc_activate_packageprocessing pkg=%s",
pkg->set->name);
- trig_parse_ci(pkgadminfile(pkg, TRIGGERSCIFILE), NULL,
+ trig_parse_ci(pkgadminfile(pkg, &pkg->installed, TRIGGERSCIFILE), NULL,
trig_cicb_statuschange_activate, pkg);
}
@@ -390,7 +390,7 @@ trig_transitional_activate(enum modstatdb_rw cstatus)
debug(dbg_triggersdetail, "trig_transitional_activate %s %s",
pkg->set->name, statusinfos[pkg->status].name);
pkg->trigpend_head = NULL;
- trig_parse_ci(pkgadminfile(pkg, TRIGGERSCIFILE),
+ trig_parse_ci(pkgadminfile(pkg, &pkg->installed,
TRIGGERSCIFILE),
cstatus >= msdbrw_write ?
transitional_interest_callback :
transitional_interest_callback_ro, NULL, pkg);
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]