[Reproducible-commits] [dpkg] 29/63: dpkg: Refactor pkg_remove_backup_files()
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Mar 4 17:44:43 UTC 2016
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/buildinfo
in repository dpkg.
commit b482ce05b80a1cc27f23a3a6ad7887ae589fbe56
Author: Guillem Jover <guillem at debian.org>
Date: Mon Feb 15 17:41:16 2016 +0100
dpkg: Refactor pkg_remove_backup_files()
---
src/unpack.c | 43 ++++++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 17 deletions(-)
diff --git a/src/unpack.c b/src/unpack.c
index 7180982..5858d0b 100644
--- a/src/unpack.c
+++ b/src/unpack.c
@@ -562,6 +562,31 @@ pkg_remove_files_from_others(struct pkginfo *pkg, struct fileinlist *newfileslis
}
}
+static void
+pkg_remove_backup_files(struct pkginfo *pkg, struct fileinlist *newfileslist)
+{
+ struct fileinlist *cfile;
+
+ for (cfile = newfileslist; cfile; cfile = cfile->next) {
+ struct filenamenode *usenode;
+
+ if (cfile->namenode->flags & fnnf_new_conff)
+ continue;
+
+ usenode = namenodetouse(cfile->namenode, pkg, &pkg->installed);
+
+ /* Do not try to remove backups for the root directory. */
+ if (strcmp(usenode->name, "/.") == 0)
+ continue;
+
+ varbuf_rollback(&fnametmpvb, &fname_state);
+ varbuf_add_str(&fnametmpvb, usenode->name);
+ varbuf_add_str(&fnametmpvb, DPKGTEMPEXT);
+ varbuf_end_str(&fnametmpvb);
+ path_remove_tree(fnametmpvb.buf);
+ }
+}
+
void process_archive(const char *filename) {
static const struct tar_operations tf = {
.read = tarfileread,
@@ -1457,23 +1482,7 @@ void process_archive(const char *filename) {
* package as a conffile and don't appear at all in the new.
* They stay recorded as obsolete conffiles and will eventually
* (if not taken over by another package) be forgotten. */
- for (cfile = newfiles_queue.head; cfile; cfile = cfile->next) {
- struct filenamenode *usenode;
-
- if (cfile->namenode->flags & fnnf_new_conff) continue;
-
- usenode = namenodetouse(cfile->namenode, pkg, &pkg->installed);
-
- /* Do not try to remove backups for the root directory. */
- if (strcmp(usenode->name, "/.") == 0)
- continue;
-
- varbuf_rollback(&fnametmpvb, &fname_state);
- varbuf_add_str(&fnametmpvb, usenode->name);
- varbuf_add_str(&fnametmpvb, DPKGTEMPEXT);
- varbuf_end_str(&fnametmpvb);
- path_remove_tree(fnametmpvb.buf);
- }
+ pkg_remove_backup_files(pkg, newfiles_queue.head);
/* OK, we're now fully done with the main package.
* This is quite a nice state, so we don't unwind past here. */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list