[setup - the official Cygwin setup program] branch master, updated. release_2.898
jturney-9JcytcrH/[email protected]
| Newsgroups | gmane.os.cygwin.cvs.apps |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=45d605870a01b9097c16f7d1bfc7b041fe61fb90 commit 45d605870a01b9097c16f7d1bfc7b041fe61fb90 Author: Jon Turney <[email protected]> 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();