This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[[PATCH setup] 2/3] Bump the installed.db version to 4


Starting with the commit 'Remove the function filemanip.cc:base',
setup correctly parses version numbers of the form e:v-r in
installed.db.  Bump the version of installed.db to reflect the fact
that older setup doesn't parse filenames containing colons correctly.
---
 package_db.cc | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/package_db.cc b/package_db.cc
index dbec17e..c108757 100644
--- a/package_db.cc
+++ b/package_db.cc
@@ -70,7 +70,7 @@ packagedb::packagedb ()
 
 	  Log (LOG_BABBLE) << "INSTALLED.DB version " << dbver << endLog;
 
-	  if (dbver <= 3)
+	  if (dbver <= 4)
 	    {
 	      char inst[1000];
 
@@ -113,7 +113,7 @@ packagedb::packagedb ()
 		  pkg->set_installed (binary);
 		  pkg->desired = pkg->installed;
 
-		  if (dbver == 3)
+		  if (dbver >= 3)
 		    pkg->user_picked = (user_picked & 1);
 		}
 	      delete db;
@@ -144,7 +144,7 @@ packagedb::flush ()
   if (!ndb)
     return errno ? errno : 1;
 
-  ndb->write ("INSTALLED.DB 3\n", strlen ("INSTALLED.DB 3\n"));
+  ndb->write ("INSTALLED.DB 4\n", strlen ("INSTALLED.DB 4\n"));
   for (packagedb::packagecollection::iterator i = packages.begin ();
        i != packages.end (); ++i)
     {
@@ -152,10 +152,13 @@ packagedb::flush ()
       if (pkgm.installed)
 	{
 	  /*
-	    In INSTALLED.DB 3, lines are: 'packagename version flags', where
-	    version is encoded in a notional filename for backwards
-	    compatibility, and the only currently defined flag is user-picked
-	    (bit 0).
+	    Starting with INSTALLED.DB 3, lines are: 'packagename
+	    version flags', where version is encoded in a notional
+	    filename for backwards compatibility, and the only
+	    currently defined flag is user-picked (bit 0).  Starting
+	    with INSTALLED.DB 4, the version number can have the form
+	    e:v-r; earlier versions of setup will skip past the colon
+	    and not parse this correctly.
 	  */
 	  std::string line;
 	  line = pkgm.name + " " +
@@ -182,7 +185,7 @@ packagedb::upgrade()
       /* Guess which packages were user_picked.  This has to take place after
          setup.ini has been parsed as it needs dependency information. */
       guessUserPicked();
-      installeddbver = 3;
+      installeddbver = 4;
     }
 }
 
-- 
2.14.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]