public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: cygwin-apps@cygwin.com
Subject: [[PATCH setup] 2/3] Bump the installed.db version to 4
Date: Fri, 27 Oct 2017 18:47:00 -0000	[thread overview]
Message-ID: <20171027184723.9324-3-kbrown@cornell.edu> (raw)
In-Reply-To: <20171027184723.9324-1-kbrown@cornell.edu>

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

  reply	other threads:[~2017-10-27 18:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27 18:47 [[PATCH setup] 0/3] Prepare for colons in version numbers Ken Brown
2017-10-27 18:47 ` Ken Brown [this message]
2017-10-27 18:47 ` [[PATCH setup] 3/3] Remove the ScanFindVisitor class Ken Brown
2017-10-27 18:47 ` [[PATCH setup] 1/3] Remove the function filemanip.cc:base Ken Brown
2017-10-27 19:27 ` [[PATCH setup] 0/3] Prepare for colons in version numbers Achim Gratz
2017-10-27 19:33   ` Ken Brown
2017-10-27 19:48   ` Brian Inglis
2017-10-27 20:31   ` Yaakov Selkowitz
2017-10-30 15:58   ` Jon Turney
2017-10-31 10:06     ` Achim Gratz
2017-10-31 11:21       ` Corinna Vinschen
2017-10-31 16:22         ` Brian Inglis
2017-10-31 18:16         ` Achim Gratz
2017-10-31 18:32           ` Brian Inglis
2017-10-30 15:55 ` Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171027184723.9324-3-kbrown@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).