public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: jturney@sourceware.org
To: cygwin-apps-cvs@sourceware.org
Subject: [setup - the official Cygwin setup program] branch master, updated. release_2.898
Date: Sat, 28 Dec 2019 12:43:00 -0000	[thread overview]
Message-ID: <20191228124310.74116.qmail@sourceware.org> (raw)




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();


                 reply	other threads:[~2019-12-28 12:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191228124310.74116.qmail@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).