[PATCH] Setup: completely specify source version when parsing setup.ini

Cesar Strauss cstrauss@cea.inpe.br
Tue Jan 16 10:11:00 GMT 2007


This patch fixes the following issue, present in the current
(2.510.2.2), snapshot (2.553) and CVS versions of setup.exe. The problem
is, when I download a source package, setup.exe will always choose the
version which is greater in text order, regardless of the version I
selected. For example:

When selecting libiconv-1.11-1 (source), I get libiconv-1.9.2-2.
When selecting atk-1.10.3-1 (source), I get atk-1.9.1-1.
When selecting gettext-0.14.5-1 (source), I get gettext-0.15-1.

In text (dictionary) order, "15" is greater than "14", but "9" is
greater than "11".

This is my analysis:

(note: numbers embedded in the text correspond to source references
given below)

As setup.ini is parsed [1], two lists of packages are built: binary and
source. To link the binary version to the corresponding source version,
a relationship class is used (PackageSpecification) [2]. It contains the
package name, version and a constraint ( = , > , < , <= , >= ).

However, when the relationship is created [3], only the name field is
being initialized. So, when the source list is searched for a
corresponding binary version [4], any source version with that name will

So, the end result is actually implementation dependent. In this
particular case, the source versions are stored in a std::set [5],
ordered by the version text [6], which gives the observed results.

A solution is to initialize the remaining fields of the
PackageSpecification (version and operator), so the source version is
completely specified. My patch does just that.


[1] IniDBBuilderPackage.cc
[2] PackageSpecification.h
[3] IniDBBuilderPackage.cc (IniDBBuilderPackage::buildPackageSource)
[4] package_version.cc (_packageversion::sourcePackage)
[5] package_meta.h (packagemeta::versions)
[6] package_version.cc (packageversion::operator <)

2007-01-16  Cesar Strauss  <cstrauss@cea.inpe.br>

	* IniDBBuilderPackage.cc (IniDBBuilderPackage::buildPackageSource):
	Initialize the version and operator fields of the newly created
	PackageSpecification object, so setup can pick the correct source
	version later on.

Index: IniDBBuilderPackage.cc
RCS file: /cvs/cygwin-apps/setup/IniDBBuilderPackage.cc,v
retrieving revision 2.21
diff -u -p -r2.21 IniDBBuilderPackage.cc
--- IniDBBuilderPackage.cc	16 Apr 2006 23:07:44 -0000	2.21
+++ IniDBBuilderPackage.cc	16 Jan 2007 02:33:06 -0000
@@ -159,7 +159,11 @@ IniDBBuilderPackage::buildPackageSource 
     cspv.source()->set_canonical (path.c_str());
+  /* creates the relationship between binary and source packageversions */
   cbpv.setSourcePackageSpecification (PackageSpecification (cspv.Name()));
+  PackageSpecification &spec = cbpv.sourcePackageSpecification();
+  spec.setOperator (PackageSpecification::Equals);
+  spec.setVersion (cbpv.Canonical_version());
   // process_src (*cspv.source(), path);
   setSourceSize (*cspv.source(), size);

This mail sent through IMP: http://horde.org/imp/

More information about the Cygwin-apps mailing list