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: completely specify source version when parsing setup.ini


Hi,

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
match.

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.

Regards,
Cesar

[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 <)

==============================================================================
ChangeLog:
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());
   cspv.source()->sites.push_back(site(parse_mirror));
 
+  /* 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/


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