RFC: [PATCH] Simplify installed.db format

Igor Peshansky pechtcha@cs.nyu.edu
Sun Jan 22 05:24:00 GMT 2006


Hi,

The current format for installed.db is (except the first line)

PKG-NAME TARBALL-NAME 0

which setup tries to parse as

package-name filename filesize src-filename srcsize

(with src-filename and srcsize never used, and the filesize field never
accessed).  I propose to remove the unused fields, with the intention of
later reusing the (always 0) for something else.

The attached patch fixes the parsing of installed.db package lines.
Comments welcome.
	Igor
==============================================================================
ChangeLog:
2006-01-22  Igor Peshansky  <pechtcha@cs.nyu.edu>

	* cygpackage.h (filesize): Remove unused field.
	* cygpackage.cc (cygpackage::createInstance): Ditto.
	* package_db.cc (packagedb::packagedb): Remove unused variables.
	Simplify parsing of installed.db.

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"
-------------- next part --------------
Index: setup/cygpackage.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/cygpackage.cc,v
retrieving revision 2.15
diff -u -p -r2.15 cygpackage.cc
--- setup/cygpackage.cc	14 May 2005 15:57:29 -0000	2.15
+++ setup/cygpackage.cc	22 Jan 2006 05:18:25 -0000
@@ -66,7 +66,7 @@ cygpackage::createInstance (const String
 
 packageversion
 cygpackage::createInstance (String const &pkgname, String const &filename,
-			    size_t const fs, String const &version,
+			    String const &version,
 			    package_status_t const newstatus,
 			    package_type_t const newtype)
 {
@@ -75,7 +75,6 @@ cygpackage::createInstance (String const
   temp->fn = filename;
   temp->status = newstatus;
   temp->type = newtype;
-  temp->filesize = fs;
   temp->setCanonicalVersion (version);
   return packageversion(temp);
 }
Index: setup/cygpackage.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/cygpackage.h,v
retrieving revision 2.15
diff -u -p -r2.15 cygpackage.h
--- setup/cygpackage.h	14 May 2005 15:57:29 -0000	2.15
+++ setup/cygpackage.h	22 Jan 2006 05:18:25 -0000
@@ -92,7 +92,6 @@ private:
   package_type_t type;
 
   io_stream *listdata, *listfile;
-  size_t filesize;
 };
 
 #endif /* SETUP_CYGPACKAGE_H */
Index: setup/package_db.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/package_db.cc,v
retrieving revision 2.30
diff -u -p -r2.30 package_db.cc
--- setup/package_db.cc	14 Oct 2005 04:10:26 -0000	2.30
+++ setup/package_db.cc	22 Jan 2006 05:18:26 -0000
@@ -57,8 +57,8 @@ packagedb::packagedb ()
       if (!db)
 	return;
       /* flush_local_db_package_data */
-      char line[1000], pkgname[1000], inst[1000], src[1000];
-      int instsz, srcsz;
+      char line[1000], pkgname[1000], inst[1000];
+      int instsz;
 
       if (db->gets (line, 1000))
 	{
@@ -80,14 +80,10 @@ packagedb::packagedb ()
 	      while (db->gets (line, 1000))
 		{
 		  int parseable;
-		  src[0] = '\0';
 		  pkgname[0] = '\0';
 		  inst[0] = '\0';
-		  srcsz = 0;
-		  instsz = 0;
 
-		  sscanf (line, "%s %s %d %s %d", pkgname, inst, &instsz, src,
-			  &srcsz);
+		  sscanf (line, "%s %s", pkgname, inst);
 
 		  if (pkgname[0] == '\0' || inst[0] == '\0')
 			continue;
@@ -109,7 +105,7 @@ packagedb::packagedb ()
 		    }
 
 		  packageversion binary = 
-		    cygpackage::createInstance (pkgname, inst, instsz, f.ver,
+		    cygpackage::createInstance (pkgname, inst, f.ver,
 	    					package_installed,
 	    					package_binary);
 


More information about the Cygwin-apps mailing list