[setup - the official Cygwin setup program] branch master, updated. release_2.939

Jon Turney via Cygwin-apps-cvs <[email protected]> Thu, 4 Jun 2026 13:33:03 +0000 (GMT)
Newsgroups gmane.os.cygwin.cvs.apps
Message-ID <[email protected]>



Diff:
---
 IniDBBuilderPackage.cc | 103 ++++++++++++++++++++++++++++---------------------
 IniDBBuilderPackage.h  |   1 +
 choose.cc              |  38 ++++++++++++++----
 choose_cli.cc          |  15 ++-----
 choose_cli.h           |   2 +-
 inilex.ll              |   2 +-
 main.cc                |  13 +++++++
 7 files changed, 110 insertions(+), 64 deletions(-)

diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index 53c18f59..db50522f 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -190,64 +190,37 @@ IniDBBuilderPackage::buildPackageSource (const std::string& path,
                                          char *hash,
                                          hashType type)
 {
-  /* When there is a source: line along with an install: line, we invent a
+  /* When there is a source: line along with an install: line, we will invent a
      package to contain the source, and make it the source package for this
      package.
 
      When there's just a source: line, this is really a source package, which
-     will be referred to by a Source: line in other package(s).
+     will be referred to by a srcpkg: line in other package(s).
   */
 
-  /* create a source package version */
-  SolverPool::addPackageData cspv = cbpv;
-  cspv.type = package_source;
-  // erase dependency attributes only meaningful for an install package, but
-  // keep build_depends
-  cspv.requires = NULL;
-  cspv.obsoletes = NULL;
-  cspv.provides = NULL;
-  cspv.conflicts = NULL;
-
   /* set archive path, size, mirror, hash */
-  cspv.archive = packagesource();
-  cspv.archive.set_canonical(path.c_str());
-  cspv.archive.size = atoi(size.c_str());
-  cspv.archive.sites.push_back(site(parse_mirror));
+  source_archive = packagesource();
+  source_archive.set_canonical(path.c_str());
+  source_archive.size = atoi(size.c_str());
+  source_archive.sites.push_back(site(parse_mirror));
 
   switch (type) {
   case hashType::sha512:
-    if (hash && !cspv.archive.sha512_isSet)
+    if (hash && !source_archive.sha512_isSet)
       {
-        memcpy (cspv.archive.sha512sum, hash, sizeof(cspv.archive.sha512sum));
-        cspv.archive.sha512_isSet = true;
+        memcpy (source_archive.sha512sum, hash, sizeof(source_archive.sha512sum));
+        source_archive.sha512_isSet = true;
       }
     break;
 
   case hashType::md5:
-    if (hash && !cspv.archive.md5.isSet())
-      cspv.archive.md5.set((unsigned char *)hash);
+    if (hash && !source_archive.md5.isSet())
+      source_archive.md5.set((unsigned char *)hash);
     break;
 
   case hashType::none:
     break;
   }
-
-  /* We make the source package name by appending '-src', unless it's already
-     there.  This handles both cases above (assuming source package don't have
-     any install: lines, which should be true!) */
-  std::string source_name;
-  int pos = name.size() - src_suffix.size();
-  if ((pos > 0) && (name.compare(pos, src_suffix.size(), src_suffix) == 0))
-    source_name = name;
-  else
-    source_name = name + src_suffix;
-
-  packagedb db;
-  packageversion spkg_id = db.addSource (source_name, cspv);
-
-  /* create relationship between binary and source packageversions */
-  cbpv.spkg = PackageSpecification(source_name);
-  cbpv.spkg_id = spkg_id;
 }
 
 void
@@ -326,7 +299,7 @@ IniDBBuilderPackage::buildBeginConflicts ()
 void
 IniDBBuilderPackage::buildSourceName (const std::string& _name)
 {
-  // When there is a Source: line, that names a real source package
+  // When there is a srcpkg: line, that names a real source package
   packagedb db;
   cbpv.spkg = PackageSpecification(_name);
   cbpv.spkg_id = db.findSourceVersion (PackageSpecification(_name, cbpv.version));
@@ -406,19 +379,63 @@ IniDBBuilderPackage::process ()
   if (cbpv.version.empty())
     return;
 
-  // no install: line, no package
-  if (!cbpv.archive.Canonical())
-    return;
-
 #if DEBUG
   Log (LOG_BABBLE) << "Finished with package " << name << endLog;
   Log (LOG_BABBLE) << "Version " << cbpv.version << endLog;
 #endif
 
+  // if we have source: but no install:, this is a real source package
+  // if we have source: and install:, but no srcpkg:, we need to invent the source package
+  if (source_archive.Canonical() &&
+      (!cbpv.archive.Canonical() || cbpv.spkg.packageName().empty()))
+    {
+      /* create a source package version */
+      SolverPool::addPackageData cspv = cbpv;
+      cspv.type = package_source;
+
+      // erase dependency attributes only meaningful for an install package, but
+      // keep build_depends
+      cspv.requires = NULL;
+      cspv.obsoletes = NULL;
+      cspv.provides = NULL;
+      cspv.conflicts = NULL;
+
+      /* We make the source package name by appending '-src', unless it's
+         already there.  This handles both cases identified in
+         buildPackageSource (assuming source package don't have any install:
+         lines, which should be true!) */
+      std::string source_name;
+      int pos = name.size() - src_suffix.size();
+      if ((pos > 0) && (name.compare(pos, src_suffix.size(), src_suffix) == 0))
+        source_name = name;
+      else
+        source_name = name + src_suffix;
+
+      /* Transfer accumulated source package information to packagedb */
+      packagedb db;
+      packageversion spkg_id = db.addSource (source_name, cspv);
+
+      /* create relationship between binary and source packageversions */
+      cbpv.spkg = PackageSpecification(source_name);
+      cbpv.spkg_id = spkg_id;
+
+      // reset for next version
+      cspv.version = "";
+      source_archive = packagesource();
+      buildDependsNodeList = PackageDepends();
+    }
+
+  // no install: line, no package
+  if (!cbpv.archive.Canonical())
+    return;
+
   /* Transfer the accumulated package information to packagedb */
   packagedb db;
   packagemeta *pkg = db.addBinary (name, cbpv);
 
+  // erase dependency attributes only meaningful for a source package
+  cbpv.build_depends = NULL;
+
   // For no good historical reason, some data lives in packagemeta rather than
   // the packageversion
   for (auto i = categories.begin(); i != categories.end(); i++)
diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h
index a985d1a0..a6cd4784 100644
--- a/IniDBBuilderPackage.h
+++ b/IniDBBuilderPackage.h
@@ -87,6 +87,7 @@ private:
   PackageDepends conflictsNodeList;
   PackageDepends buildDependsNodeList;
   SolverPool::addPackageData cbpv;
+  packagesource source_archive;
   std::set <std::string> replace_versions;
 
   Feedback const &_feedback;
diff --git a/choose.cc b/choose.cc
index 48418b54..f1bdd9f0 100644
--- a/choose.cc
+++ b/choose.cc
@@ -315,21 +315,42 @@ ChooserPage::applyCommandLinePackageSelection()
 	pkg.set_action (packagemeta::NoChange_action, pkg.installed);
     }
 
-  for (packagedb::packagecollection::iterator i = db.packages.begin ();
-       i != db.packages.end (); ++i)
+  std::set<std::string> &build_deps_for = buildDependenciesWanted();
+  for (auto i = build_deps_for.begin();
+       i != build_deps_for.end ();
+       ++i)
     {
       // The 'build-depends' option can only specify source package names
-      // presently. (perhaps if name is not found, instead look for binary
-      // package and navigate to the corresponding source?)
+      // presently.
+      std::string pn = *i;
+      std::string src_pn = *i + "-src";
 
-      packagemeta &pkg = *(i->second);
-      if (areBuildDependenciesWanted(pkg))
+      packagedb::packagecollection::iterator n = db.sourcePackages.find(src_pn);
+
+      // if name is not found, instead look it up as a binary package name and
+      // navigate to the corresponding source
+      if (n == db.sourcePackages.end())
         {
-          Log (LOG_BABBLE) << "Examining build-deps for package " << pkg.name << endLog;
+          Log(LOG_PLAIN) << "No source package named '" << pn << "' found, looking for install package instead." << endLog;
+
+          const packagedb::packagecollection::iterator b = db.packages.find(pn);
+
+          if (b != db.packages.end())
+            {
+              src_pn = b->second->trustp(false, chooser->deftrust).sourcePackageName();
+              n = db.sourcePackages.find(src_pn);
+            }
+        }
+
+      if (n != db.sourcePackages.end())
+        {
+          packagemeta &pkg = *(n->second);
+          Log (LOG_PLAIN) << "Installing build-depends for package " << pkg.name << endLog;
           packageversion pv = pkg.trustp(false, chooser->deftrust);
           if (pv)
             {
               PackageDepends bdp = pv.build_depends();
+
               std::ostream & logger = Log (LOG_BABBLE);
               logger << "      build-depends=";
               dumpPackageDepends(bdp, logger);
@@ -339,7 +360,6 @@ ChooserPage::applyCommandLinePackageSelection()
                    j != bdp.end();
                    j++)
                 {
-                  Log (LOG_BABBLE) << "looking for " << (*j)->packageName() << endLog;
                   const packagedb::packagecollection::iterator n = db.packages.find((*j)->packageName());
                   if (n != db.packages.end())
                     {
@@ -349,6 +369,8 @@ ChooserPage::applyCommandLinePackageSelection()
                 }
             }
         }
+      else
+        Log(LOG_PLAIN) << "Package '" << *i << "' not found." << endLog;
     }
 }
 
diff --git a/choose_cli.cc b/choose_cli.cc
index 953cb6b5..8d3a86d2 100644
--- a/choose_cli.cc
+++ b/choose_cli.cc
@@ -215,13 +215,11 @@ isManuallyDeleted(packagemeta &pkg)
   return bReturn;
 }
 
-bool
-areBuildDependenciesWanted(packagemeta &pkg)
+std::set<std::string> &
+buildDependenciesWanted(void)
 {
   static bool parsed_yet = false;
   static std::set<std::string> parsed_build_depend;
-  hasManualSelections |= parsed_build_depend.size ();
-  bool bReturn = false;
 
   /* First time through, we parse all the names out from the
     option string and store them away in an STL set.  */
@@ -234,15 +232,10 @@ areBuildDependenciesWanted(packagemeta &pkg)
       {
         parseNames (parsed_build_depend, *n);
       }
-    validatePackageNames (parsed_build_depend);
     parsed_yet = true;
   }
 
-  /* Once we've already parsed the option string, just do
-     a lookup in the cache of already-parsed names.  */
-  bReturn = parsed_build_depend.find(pkg.name) != parsed_build_depend.end();
+  hasManualSelections |= parsed_build_depend.size ();
 
-  if (bReturn)
-    Log (LOG_BABBLE) << "Adding build-deps for package " << pkg.name << endLog;
-  return bReturn;
+  return parsed_build_depend;
 }
diff --git a/choose_cli.h b/choose_cli.h
index fc6297f2..7b33dc45 100644
--- a/choose_cli.h
+++ b/choose_cli.h
@@ -16,7 +16,7 @@
 
 bool isManuallyWanted(packagemeta &pkg, packageversion &version);
 bool isManuallyDeleted(packagemeta &pkg);
-bool areBuildDependenciesWanted(packagemeta &pkg);
+std::set<std::string> &buildDependenciesWanted(void);
 
 extern bool hasManualSelections;
 
diff --git a/inilex.ll b/inilex.ll
index 8ee92935..40f8c5ba 100644
--- a/inilex.ll
+++ b/inilex.ll
@@ -118,7 +118,7 @@ B64	[a-zA-Z0-9_-]
 "sdesc:"		return SDESC;
 "ldesc:"		return LDESC;
 "message:"		return MESSAGE;
-"Source:"		return SOURCEPACKAGE;
+"srcpkg:"|"Source:"	return SOURCEPACKAGE;
 [bB]"uild-"[dD]"epends:"	return BUILDDEPENDS;
 "replace-versions:"	return REPLACE_VERSIONS;
 
diff --git a/main.cc b/main.cc
index bedf3ec0..d1101a93 100644
--- a/main.cc
+++ b/main.cc
@@ -101,6 +101,7 @@ static StringChoiceOption::StringChoices quiet_types({
 
 static StringChoiceOption::StringChoices arch_choices({
     {"64", IMAGE_FILE_MACHINE_AMD64},
+    {"x64", IMAGE_FILE_MACHINE_AMD64},
     {"x86_64", IMAGE_FILE_MACHINE_AMD64},
     {"amd64", IMAGE_FILE_MACHINE_AMD64},
     {"32", IMAGE_FILE_MACHINE_I386},
@@ -305,6 +306,7 @@ WinMain (HINSTANCE h,
     LogSingleton::SetInstance (*LogFile::createLogFile ());
     const char *sep = isdirsep (local_dir[local_dir.size () - 1])
 				? "" : "\\";
+
     /* Don't create log files for help or version output only. */
     if (!elevate && !output_only)
       {
@@ -315,6 +317,17 @@ WinMain (HINSTANCE h,
 			<< setup_version << endLog;
       }
 
+    std::vector<std::string> nonoptions = GetOption::GetInstance().nonOptions();
+    if (!nonoptions.empty())
+      {
+        for (auto i = nonoptions.begin();
+             i != nonoptions.end();
+             i++)
+          {
+            Log (LOG_PLAIN) << "Ignoring non-option argument: " << *i << endLog;
+          }
+      }
+
     /* Some confusion of interfaces here: Normally we try to write un-localized
        strings to the log. However, if output_only is true, then we know that
        Log() is only outputting to console, not a logfile, so using localized