public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [setup - the official Cygwin setup program] branch master, updated. release_2.898
@ 2019-12-28 12:43 jturney
  0 siblings, 0 replies; only message in thread
From: jturney @ 2019-12-28 12:43 UTC (permalink / raw)
  To: cygwin-apps-cvs




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=45d605870a01b9097c16f7d1bfc7b041fe61fb90

commit 45d605870a01b9097c16f7d1bfc7b041fe61fb90
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Dec 20 14:22:27 2019 +0000

    Generate a pseudo-package with the Windows version
    
    Generate a pseudo-package with the Windows version, so packages can have
    a requires with a version relation upon it.


Diff:
---
 package_db.cc |   26 ++++++++++++++++++++++++++
 package_db.h  |    1 +
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/package_db.cc b/package_db.cc
index 847f44e..5498ec0 100644
--- a/package_db.cc
+++ b/package_db.cc
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <strings.h>
 #include <algorithm>
+#include <sstream>
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
@@ -232,6 +233,30 @@ packagedb::makeBase()
   /* We don't register this in packagemeta */
 }
 
+/* Create the fictitious windows package */
+void
+packagedb::makeWindows()
+{
+  std::stringstream v;
+  v << OSMajorVersion() << "." << OSMinorVersion() << "." << OSBuildNumber();
+
+  SolverPool::addPackageData data;
+  data.reponame = "_installed";
+  data.version = v.str();
+  data.type = package_binary;
+  data.vendor = "cygwin";
+  data.sdesc = "Ficitious package indicating Windows version";
+  data.ldesc = "Ficitious package indicating Windows version";
+  data.requires = NULL;
+  data.obsoletes = NULL;
+  data.provides = NULL;
+  data.conflicts = NULL;
+  data.stability = TRUST_CURR;
+
+  solver.addPackage("_windows", data);
+  /* We don't register this in packagemeta */
+}
+
 /* Add a package version to the packagedb */
 packagemeta *
 packagedb::addBinary (const std::string &pkgname,
@@ -735,6 +760,7 @@ packagedb::prep()
     return;
 
   makeBase();
+  makeWindows();
   read();
   upgrade();
   fixup_source_package_ids();
diff --git a/package_db.h b/package_db.h
index da73171..3886bf2 100644
--- a/package_db.h
+++ b/package_db.h
@@ -100,6 +100,7 @@ public:
 
 private:
   void makeBase();
+  void makeWindows();
   void read();
   void upgrade ();
   void fixup_source_package_ids();


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-28 12:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-28 12:43 [setup - the official Cygwin setup program] branch master, updated. release_2.898 jturney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).