Explorar el Código

Add --force-bad-version to allow installing packages with bogus versions

This allows to install old packages with such versions, to ease
debugging, testing, etc.
Guillem Jover hace 15 años
padre
commit
6d50a5ac6a
Se han modificado 5 ficheros con 11 adiciones y 2 borrados
  1. 2 0
      debian/changelog
  2. 3 0
      man/dpkg.1
  3. 3 0
      src/main.c
  4. 1 0
      src/main.h
  5. 2 2
      src/processarc.c

+ 2 - 0
debian/changelog

@@ -30,6 +30,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
     by including the architecture in the debian-split member of a split
     package and using underscores to separate filename parts.
   * Support conffiles with spaces when diffing them. Closes: #147583
+  * Allow installing packages with bogus versions with new
+    --force-bad-version.
 
   [ Updated man page translations ]
   * German (Helge Kreutzmann).

+ 3 - 0
man/dpkg.1

@@ -465,6 +465,9 @@ losing data, use with care.\fP
 \fBarchitecture\fP:
 Process even packages with wrong or no architecture.
 
+\fBbad\-version\fP:
+Process even packages with wrong versions.
+
 \fBbad\-path\fP:
 \fBPATH\fP is missing important programs, so problems are likely.
 

+ 3 - 0
src/main.c

@@ -187,6 +187,7 @@ int fc_conff_old=0, fc_conff_def=0;
 int fc_conff_ask = 0;
 int fc_unsafe_io = 0;
 int fc_badverify = 0;
+int fc_badversion = 0;
 
 int errabort = 50;
 static const char *admindir = ADMINDIR;
@@ -229,6 +230,8 @@ static const struct forceinfo {
     ' ', N_("PATH is missing important programs, problems likely") },
   { "bad-verify",          &fc_badverify,
     ' ', N_("Install a package even if it fails authenticity check") },
+  { "bad-version",         &fc_badversion,
+    ' ', N_("Process even packages with wrong versions") },
   { "overwrite",           &fc_overwrite,
     ' ', N_("Overwrite a file from one package with another") },
   { "overwrite-diverted",  &fc_overwritediverted,

+ 1 - 0
src/main.h

@@ -132,6 +132,7 @@ extern int fc_nonroot, fc_overwritedir, fc_conff_new, fc_conff_miss;
 extern int fc_conff_old, fc_conff_def;
 extern int fc_conff_ask;
 extern int fc_badverify;
+extern int fc_badversion;
 extern int fc_unsafe_io;
 
 extern bool abort_processing;

+ 2 - 2
src/processarc.c

@@ -421,8 +421,8 @@ void process_archive(const char *filename) {
 
   strcpy(cidirrest,CONTROLFILE);
 
-  parsedb(cidir, pdb_recordavailable | pdb_rejectstatus | pdb_ignorefiles,
-          &pkg);
+  parsedb(cidir, pdb_recordavailable | pdb_rejectstatus | pdb_ignorefiles |
+          fc_badversion ? pdb_lax_version_parser : 0, &pkg);
   if (!pkg->files) {
     pkg->files= nfmalloc(sizeof(struct filedetails));
     pkg->files->next = NULL;