This is the mail archive of the cygwin 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]

Re: Package choosing algorithm ...


Title: Re: Package choosing agorithm ...

Hi Corinna,

(Of course I am formally addressing the project leader, but Achim, Jon, Yaakov,
 others? are welcome to correct me if I am wrong below).

D w/o I = Download without Install
I f LD  = Install from Local Directory

As a reminder: I reported that a new test release of Cygwin is NOT offered
for install (having installed the previous test release) in my case.

    https://cygwin.com/ml/cygwin/2016-03/msg00425.html

Relevant in my case is:

 - I am not using a local mirror ...
     - but a "partially populated Local Directory"
 - I do not invoke setup.exe with the -m option
 - my local directory does not have the current release of Cygwin

As you replied "it works for me" and "not using the -m option should not
make a difference", I decided to study the source code of setup.exe.

As I had never seen the source code of setup before, I started my study where
you had "left off" modifying (about a year ago).

Subsequently, I reported back to the list, announcing that I found the bug,
but was not sure I had.

   https://cygwin.com/ml/cygwin/2016-03/msg00480.html

I was wrong.

My patch did work, but for the wrong reasons.

So does your modification of packagemeta::trustp ...

Here is another attempt of mine (attempt? I seriously doubt whether there is
someone which fully understands the source code in all its details ...)

You will find 2 patch files attached. These patch files modify (correct):

 1. packagemeta::ScanDownLoadedFiles and
 2. packagemeta::trustp

(yes, I do realize, that this correction to setup, is NOT important enough to most of you - using a local mirror and all that; consequently, do whatever you
 like with my post - I am merely providing info to the list).

My argument for the correction is as follows:

- packagedb::packages, a class variable, is the "package database" that is
   used by setup.
- basically, it is a list of pairs (mapping between the packagename and its
   entry in setup.ini) (one where installed.db has been "integrated").
 - formally:
    - typedef std::map <std::string, packagemeta *> packagecollection;
    - static packagecollection packages;
- packagemeta is the type that describes a "package entry" from setup.ini - an object of type packagemeta does not only describe the previous, current and experimental (if applicable) lines from a package entry in setup.ini, it also describes the installed version of a package, as if installed.db is
   part of setup.ini.
--
- bottom-line: the prev, curr, exp and installed data member of packagemeta are "static": these data members represent the info from setup.ini (and
   installed.db) and they should never be "nullified".
- yet, that is exactly what happens in metapackage::ScanDownLoadedFiles.
--
- packagemeta ALSO has a "not so static" data member, called versions; like
   packages, the contents of versions is "variable"
- versions, a set of type packageversion, contains the versions of the package that are available (the source code speaks about "accessible") - available (in my simplistic view) means whether or not the tarball is
      present in the (local) repo
- unfortunately, though versions specifies which versions are available,
      it does not tell us whether the previous, current or experimental
      version of a package is available or not
--
- bottom-line: version numbers can be compared if that info is present in setup.ini; however, although the info may be present, it does not tell us
   that the associated tarball is available (neither does versions).
 - consequently, metapackage:trustp does not only have to verify that
setup.ini has the required info, it also has to verify that the tarball
   is available, before it can give the "go-ahead".

Lastly: No, I have not tested (been able) my modification for each possible configuration out there (for instance, I do not install source tarballs).

Regards,
Henri

=====
diff --git a/package_meta.cc b/package_meta.cc
index 34ff78c..ff787a8 100644
--- a/package_meta.cc
+++ b/../src2/package_meta.cc
@@ -683,15 +683,18 @@ packagemeta::ScanDownloadedFiles (bool mirror_mode)
 	  /* For local installs, if there is no src and no bin, the version
 	   * is unavailable
 	   */
-	  if (!i->accessible () && !pkgsrcver.accessible ()
-	      && *i != pkg.installed)
+	  if (*i != pkg.installed
+	      && !i->accessible () && !pkgsrcver.accessible () )
 	    {
+// Henri: innihilate the info that has been collected from setup.ini? DO NOT!
+	      #if 0
 	      if (pkg.prev == *i)
 		pkg.prev = packageversion ();
 	      if (pkg.curr == *i)
 		pkg.curr = packageversion ();
 	      if (pkg.exp == *i)
 		pkg.exp = packageversion ();
+	      #endif
 	      pkg.versions.erase (i++);
 	      /* For now, leave the source version alone */
 	    }
diff --git a/package_meta.h b/package_meta.h
index b24d4fc..3d2b775 100644
--- a/package_meta.h
+++ b/../src2/package_meta.h
@@ -105,12 +105,14 @@ public:
     if (_default && curr && installed
 	&& packageversion::compareVersions (curr, installed) < 0)
       {
-	if (exp && packageversion::compareVersions (installed, exp) < 0)
+// Henri: no, no, no ... first check whether the associated tarball is in the repo or not!
+	if (exp.accessible() && exp && packageversion::compareVersions (installed, exp) < 0)
 	  return exp;
 	return installed;
       }
     /* Otherwise, if a "curr" version exists, return "curr". */
-    if (curr)
+// Henri: no, no, no ... first check whether the associated tarball is in the repo or not!
+    if (curr.accessible() && curr)
       return curr;
     /* Otherwise return the installed version. */
     return installed;
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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