Преглед изворни кода

Rename pkgadmin*() to pkg_infodb_get_*()

Guillem Jover пре 14 година
родитељ
комит
8e0c0d33d4
9 измењених фајлова са 33 додато и 30 уклоњено
  1. 9 8
      src/filesdb.c
  2. 3 3
      src/filesdb.h
  3. 2 2
      src/help.c
  4. 2 2
      src/infodb-access.c
  5. 3 3
      src/infodb-upgrade.c
  6. 4 4
      src/processarc.c
  7. 1 1
      src/querycmd.c
  8. 4 4
      src/remove.c
  9. 5 3
      src/trigproc.c

+ 9 - 8
src/filesdb.c

@@ -66,7 +66,7 @@
 static char *infodir;
 
 const char *
-pkgadmindir(void)
+pkg_infodb_get_dir(void)
 {
   if (infodir == NULL)
     infodir = dpkg_db_get_path(INFODIR);
@@ -75,7 +75,8 @@ pkgadmindir(void)
 }
 
 const char *
-pkgadminfile(struct pkginfo *pkg, struct pkgbin *pkgbin, const char *filetype)
+pkg_infodb_get_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
+                    const char *filetype)
 {
   static struct varbuf vb;
 
@@ -299,7 +300,7 @@ ensure_packagefiles_available(struct pkginfo *pkg)
     return;
   }
 
-  filelistfile = pkgadminfile(pkg, &pkg->installed, LISTFILE);
+  filelistfile = pkg_infodb_get_file(pkg, &pkg->installed, LISTFILE);
 
   onerr_abort++;
 
@@ -394,7 +395,7 @@ pkg_files_optimize_load(struct pkg_array *array)
   int i;
 
   /* Get the filesystem block size. */
-  if (statfs(pkgadmindir(), &fs) < 0)
+  if (statfs(pkg_infodb_get_dir(), &fs) < 0)
     return;
 
   /* Sort packages by the physical location of their list files, so that
@@ -416,7 +417,7 @@ pkg_files_optimize_load(struct pkg_array *array)
 
     pkg->clientdata->listfile_phys_offs = -1;
 
-    listfile = pkgadminfile(pkg, &pkg->installed, LISTFILE);
+    listfile = pkg_infodb_get_file(pkg, &pkg->installed, LISTFILE);
 
     fd = open(listfile, O_RDONLY);
     if (fd < 0)
@@ -449,7 +450,7 @@ pkg_files_optimize_load(struct pkg_array *array)
     const char *listfile;
     int fd;
 
-    listfile = pkgadminfile(pkg, &pkg->installed, LISTFILE);
+    listfile = pkg_infodb_get_file(pkg, &pkg->installed, LISTFILE);
 
     fd = open(listfile, O_RDONLY | O_NONBLOCK);
     if (fd != -1) {
@@ -520,7 +521,7 @@ write_filelist_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
   struct atomic_file *file;
   const char *listfile;
 
-  listfile = pkgadminfile(pkg, pkgbin, LISTFILE);
+  listfile = pkg_infodb_get_file(pkg, pkgbin, LISTFILE);
 
   file = atomic_file_new(listfile, 0);
   atomic_file_open(file);
@@ -538,7 +539,7 @@ write_filelist_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
   atomic_file_commit(file);
   atomic_file_free(file);
 
-  dir_sync_path(pkgadmindir());
+  dir_sync_path(pkg_infodb_get_dir());
 
   note_must_reread_files_inpackage(pkg);
 }

+ 3 - 3
src/filesdb.h

@@ -137,9 +137,9 @@ struct diversion {
   struct diversion *next;
 };
 
-const char *pkgadmindir(void);
-const char *pkgadminfile(struct pkginfo *pkg, struct pkgbin *pkgbin,
-                         const char *filetype);
+const char *pkg_infodb_get_dir(void);
+const char *pkg_infodb_get_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
+                                const char *filetype);
 
 struct filepackages_iterator;
 struct filepackages_iterator *filepackages_iter_new(struct filenamenode *fnn);

+ 2 - 2
src/help.c

@@ -322,7 +322,7 @@ vmaintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
   struct stat stab;
   char buf[100];
 
-  scriptpath = pkgadminfile(pkg, &pkg->installed, scriptname);
+  scriptpath = pkg_infodb_get_file(pkg, &pkg->installed, scriptname);
   sprintf(buf, _("installed %s script"), desc);
 
   command_init(&cmd, scriptpath, buf);
@@ -425,7 +425,7 @@ int maintainer_script_alternative(struct pkginfo *pkg,
   struct stat stab;
   char buf[100];
 
-  oldscriptpath = pkgadminfile(pkg, &pkg->installed, scriptname);
+  oldscriptpath = pkg_infodb_get_file(pkg, &pkg->installed, scriptname);
   sprintf(buf, _("old %s script"), desc);
 
   command_init(&cmd, oldscriptpath, buf);

+ 2 - 2
src/infodb-access.c

@@ -44,7 +44,7 @@ pkg_infodb_has_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
 	const char *filename;
 	struct stat stab;
 
-	filename = pkgadminfile(pkg, pkgbin, name);
+	filename = pkg_infodb_get_file(pkg, pkgbin, name);
 	if (lstat(filename, &stab) == 0)
 		return true;
 	else if (errno == ENOENT)
@@ -69,7 +69,7 @@ pkg_infodb_foreach(struct pkginfo *pkg, struct pkgbin *pkgbin,
 	else
 		pkgname = pkgbin_name(pkg, pkgbin, pnaw_never);
 
-	varbuf_add_str(&db_path, pkgadmindir());
+	varbuf_add_str(&db_path, pkg_infodb_get_dir());
 	varbuf_add_char(&db_path, '/');
 	db_path_len = db_path.used;
 	varbuf_add_char(&db_path, '\0');

+ 3 - 3
src/infodb-upgrade.c

@@ -80,7 +80,7 @@ pkg_infodb_link_multiarch_files(void)
 	struct varbuf newname = VARBUF_INIT;
 	size_t db_path_len;
 
-	varbuf_add_str(&oldname, pkgadmindir());
+	varbuf_add_str(&oldname, pkg_infodb_get_dir());
 	varbuf_add_char(&oldname, '/');
 	db_path_len = oldname.used;
 	varbuf_end_str(&oldname);
@@ -121,7 +121,7 @@ pkg_infodb_link_multiarch_files(void)
 				break;
 		if (!pkg) {
 			warning(_("Info file %s/%s not associated to any package"),
-			        pkgadmindir(), db_de->d_name);
+			        pkg_infodb_get_dir(), db_de->d_name);
 			continue;
 		}
 
@@ -220,7 +220,7 @@ pkg_infodb_upgrade_to_multiarch(void)
 
 	pkg_infodb_unlink_monoarch_files();
 	atomic_file_commit(db_file);
-	dir_sync_path(pkgadmindir());
+	dir_sync_path(pkg_infodb_get_dir());
 
 	pop_cleanup(ehflag_normaltidy);
 

+ 4 - 4
src/processarc.c

@@ -316,7 +316,7 @@ pkg_infodb_update(struct pkginfo *pkg, char *cidir, char *cidirrest)
     }
 
     /* Right, install it */
-    newinfofilename = pkgadminfile(pkg, &pkg->available, de->d_name);
+    newinfofilename = pkg_infodb_get_file(pkg, &pkg->available, de->d_name);
     if (rename(cidir, newinfofilename))
       ohshite(_("unable to install new info file `%.250s' as `%.250s'"),
               cidir, newinfofilename);
@@ -337,7 +337,7 @@ pkg_infodb_update(struct pkginfo *pkg, char *cidir, char *cidirrest)
     pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_remove_file);
   }
 
-  dir_sync_path(pkgadmindir());
+  dir_sync_path(pkg_infodb_get_dir());
 }
 
 static void
@@ -362,7 +362,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->installed, pkg_infodb_remove_file);
-  dir_sync_path(pkgadmindir());
+  dir_sync_path(pkg_infodb_get_dir());
 
   pkg_set_status(pkg, stat_notinstalled);
   pkg_set_want(pkg, want_unknown);
@@ -1105,7 +1105,7 @@ void process_archive(const char *filename) {
    * 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, &pkg->installed, TRIGGERSCIFILE),
+  trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed, TRIGGERSCIFILE),
                 trig_cicb_interest_delete, NULL, pkg, &pkg->installed);
   trig_parse_ci(cidir, trig_cicb_interest_add, NULL, pkg, &pkg->available);
   trig_file_interests_save();

+ 1 - 1
src/querycmd.c

@@ -585,7 +585,7 @@ control_path_file(struct pkginfo *pkg, const char *control_file)
   const char *control_path;
   struct stat st;
 
-  control_path = pkgadminfile(pkg, &pkg->installed, control_file);
+  control_path = pkg_infodb_get_file(pkg, &pkg->installed, control_file);
   if (stat(control_path, &st) < 0)
     return;
   if (!S_ISREG(st.st_mode))

+ 4 - 4
src/remove.c

@@ -344,13 +344,13 @@ removal_bulk_remove_files(struct pkginfo *pkg)
     maintainer_script_installed(pkg, POSTRMFILE, "post-removal",
                                 "remove", NULL);
 
-    trig_parse_ci(pkgadminfile(pkg, &pkg->installed, TRIGGERSCIFILE),
+    trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed, TRIGGERSCIFILE),
                   trig_cicb_interest_delete, NULL, pkg, &pkg->installed);
     trig_file_interests_save();
 
     debug(dbg_general, "removal_bulk cleaning info directory");
     pkg_infodb_foreach(pkg, &pkg->installed, removal_bulk_remove_file);
-    dir_sync_path(pkgadmindir());
+    dir_sync_path(pkg_infodb_get_dir());
 
     pkg_set_status(pkg, stat_configfiles);
     pkg->installed.essential = false;
@@ -618,13 +618,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, &pkg->installed, LISTFILE);
+    filename = pkg_infodb_get_file(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, &pkg->installed, POSTRMFILE);
+    filename = pkg_infodb_get_file(pkg, &pkg->installed, POSTRMFILE);
     debug(dbg_general, "removal_bulk purge done, removing postrm '%s'",
           filename);
     if (unlink(filename) && errno != ENOENT)

+ 5 - 3
src/trigproc.c

@@ -138,8 +138,9 @@ trig_activate_packageprocessing(struct pkginfo *pkg)
 	debug(dbg_triggersdetail, "trigproc_activate_packageprocessing pkg=%s",
 	      pkg_name(pkg, pnaw_always));
 
-	trig_parse_ci(pkgadminfile(pkg, &pkg->installed, TRIGGERSCIFILE), NULL,
-	              trig_cicb_statuschange_activate, pkg, &pkg->installed);
+	trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed, TRIGGERSCIFILE),
+	              NULL, trig_cicb_statuschange_activate,
+	              pkg, &pkg->installed);
 }
 
 /*========== Actual trigger processing. ==========*/
@@ -406,7 +407,8 @@ trig_transitional_activate(enum modstatdb_rw cstatus)
 		      pkg_name(pkg, pnaw_always),
 		      statusinfos[pkg->status].name);
 		pkg->trigpend_head = NULL;
-		trig_parse_ci(pkgadminfile(pkg, &pkg->installed, TRIGGERSCIFILE),
+		trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed,
+		                                  TRIGGERSCIFILE),
 		              cstatus >= msdbrw_write ?
 		              transitional_interest_callback :
 		              transitional_interest_callback_ro, NULL,