public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 07/14] Store package stability in class packageversion
Date: Wed, 31 May 2017 10:57:00 -0000	[thread overview]
Message-ID: <20170531105015.162228-8-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20170531105015.162228-1-jon.turney@dronecode.org.uk>

---
 IniDBBuilderPackage.cc | 12 +++++++-----
 IniDBBuilderPackage.h  |  3 +--
 cygpackage.cc          |  7 -------
 cygpackage.h           | 10 +++++++++-
 package_version.cc     | 14 ++++++++++++++
 package_version.h      | 14 +++++---------
 6 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index 0e1be78..fb200a8 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -34,7 +34,7 @@
 using namespace std;
 
 IniDBBuilderPackage::IniDBBuilderPackage (IniParseFeedback const &aFeedback) :
-cp (0), cbpv (), cspv (), currentSpec (0), trust (0), _feedback (aFeedback){}
+cp (0), cbpv (), cspv (), currentSpec (0), _feedback (aFeedback){}
 
 IniDBBuilderPackage::~IniDBBuilderPackage()
 {
@@ -90,10 +90,10 @@ IniDBBuilderPackage::buildPackage (const std::string& name)
       db.packages.insert (packagedb::packagecollection::value_type(cp->name,cp));
     }
   cbpv = cygpackage::createInstance (name, package_binary);
+  cbpv.SetStability(TRUST_CURR);
   cspv = packageversion ();
   currentSpec = NULL;
   currentNodeList = PackageDepends();
-  trust = TRUST_CURR;
 #if DEBUG
   Log (LOG_BABBLE) << "Created package " << name << endLog;
 #endif
@@ -211,12 +211,12 @@ IniDBBuilderPackage::buildPackageSource (const std::string& path,
 }
 
 void
-IniDBBuilderPackage::buildPackageTrust (int newtrust)
+IniDBBuilderPackage::buildPackageTrust (package_stability_t newtrust)
 {
-  trust = newtrust;
   if (newtrust != TRUST_UNKNOWN)
     {
       cbpv = cygpackage::createInstance (cp->name, package_binary);
+      cbpv.SetStability(newtrust);
       cspv = packageversion ();
     }
 }
@@ -383,7 +383,7 @@ IniDBBuilderPackage::add_correct_version()
     databases, we should pick the one with the highest version number.
   */
   packageversion *v = NULL;
-  switch (trust)
+  switch (cbpv.Stability())
   {
     case TRUST_CURR:
       v = &(cp->curr);
@@ -391,6 +391,8 @@ IniDBBuilderPackage::add_correct_version()
     case TRUST_TEST:
       v = &(cp->exp);
     break;
+    default:
+    break;
   }
 
   if (v)
diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h
index dee65d4..8825add 100644
--- a/IniDBBuilderPackage.h
+++ b/IniDBBuilderPackage.h
@@ -48,7 +48,7 @@ public:
   void buildPackageSource (const std::string& path, const std::string& size)
   { buildPackageSource(path, size, NULL, hashType::none); }
 
-  void buildPackageTrust (int);
+  void buildPackageTrust (package_stability_t);
   void buildPackageCategory (const std::string& );
 
   void buildBeginDepends ();
@@ -80,7 +80,6 @@ private:
   packageversion cspv;
   PackageSpecification *currentSpec;
   PackageDepends currentNodeList;
-  int trust;
   IniParseFeedback const &_feedback;
 };
 
diff --git a/cygpackage.cc b/cygpackage.cc
index 32b9403..2724249 100644
--- a/cygpackage.cc
+++ b/cygpackage.cc
@@ -134,10 +134,3 @@ cygpackage::set_ldesc (const std::string& desc)
 {
   ldesc = desc;
 }
-
-#if 0
-package_stability_t cygpackage::Stability ()
-{
-  return stability;
-}
-#endif
diff --git a/cygpackage.h b/cygpackage.h
index c6d0657..720921d 100644
--- a/cygpackage.h
+++ b/cygpackage.h
@@ -31,6 +31,14 @@ public:
   virtual const std::string Vendor_version ();
   virtual const std::string Package_version ();
   virtual const std::string Canonical_version ();
+  virtual package_stability_t Stability ()
+  {
+    return stability;
+  }
+  virtual void SetStability (package_stability_t newstability)
+  {
+    stability = newstability;
+  }
   virtual package_type_t Type ()
   {
     return type;
@@ -67,7 +75,7 @@ private:
   std::string canonical;
   std::string sdesc, ldesc;
 
-//  package_stability_t stability;
+  package_stability_t stability;
   package_type_t type;
 };
 
diff --git a/package_version.cc b/package_version.cc
index 6e8f692..2d4416e 100644
--- a/package_version.cc
+++ b/package_version.cc
@@ -43,6 +43,8 @@ public:
   const std::string Package_version() {return std::string();}
   const std::string Canonical_version() {return std::string();}
   void setCanonicalVersion (const std::string& ) {}
+  package_stability_t Stability (){return TRUST_UNKNOWN;}
+  void SetStability (package_stability_t) {}
   package_type_t Type () {return package_binary;}
   const std::string SDesc () {return std::string();}
   void set_sdesc (const std::string& ) {}
@@ -158,6 +160,18 @@ packageversion::setCanonicalVersion (const std::string& ver)
   data->setCanonicalVersion (ver);
 }
 
+package_stability_t
+packageversion::Stability () const
+{
+  return data->Stability ();
+}
+
+void
+packageversion::SetStability (package_stability_t stability)
+{
+  data->SetStability (stability);
+}
+
 package_type_t
 packageversion::Type () const
 {
diff --git a/package_version.h b/package_version.h
index 4c04d77..21d053e 100644
--- a/package_version.h
+++ b/package_version.h
@@ -45,14 +45,7 @@ class CategoryList;
 #include "PackageTrust.h"
 #include "package_depends.h"
 
-typedef enum
-{
-  package_invalid,
-  package_old,
-  package_current,
-  package_experimental
-}
-package_stability_t;
+typedef trusts package_stability_t;
 
 typedef enum
 {
@@ -97,6 +90,8 @@ public:
   const std::string Package_version () const;
   const std::string Canonical_version () const;
   void setCanonicalVersion (const std::string& );
+  package_stability_t Stability () const;
+  void SetStability (package_stability_t);
   package_type_t Type () const;
   const std::string SDesc () const;
   void set_sdesc (const std::string& );
@@ -138,7 +133,8 @@ public:
   virtual const std::string Package_version () = 0;
   virtual const std::string Canonical_version () = 0;
   virtual void setCanonicalVersion (const std::string& ) = 0;
-//  virtual package_stability_t Stability () = 0;
+  virtual package_stability_t Stability () = 0;
+  virtual void SetStability (package_stability_t) = 0;
   virtual package_type_t Type () = 0;
   virtual const std::string SDesc () = 0;
   virtual void set_sdesc (const std::string& ) = 0;
-- 
2.12.3

  parent reply	other threads:[~2017-05-31 10:57 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 10:53 [PATCH setup 00/14] Use libsolv, solve all our problems... (WIP) Jon Turney
2017-05-31 10:53 ` [PATCH setup 04/14] Hoist pick() up to packagemeta Jon Turney
2017-05-31 10:53 ` [PATCH setup 05/14] Hoist uninstall up to Installer::uninstallOne() Jon Turney
2017-05-31 10:53 ` [PATCH setup 03/14] Hoist addScript() etc. up from packageversion to packagemeta Jon Turney
2017-05-31 10:53 ` [PATCH setup 01/14] Opaque how PackageDepends is stored Jon Turney
2017-05-31 10:53 ` [PATCH setup 02/14] Factor out reading installed.db Jon Turney
2017-05-31 10:57 ` [PATCH setup 10/14] Remove packageversion class Jon Turney
2017-05-31 10:57 ` [PATCH setup 08/14] Change to using a libsolv pool for storing package information Jon Turney
2017-05-31 10:57 ` [PATCH setup 09/14] Remove cygpackage class Jon Turney
2017-05-31 10:57 ` [PATCH setup 06/14] Hoist scan() up from packageversion to packagemeta Jon Turney
2017-05-31 10:57 ` Jon Turney [this message]
2017-05-31 11:05 ` [PATCH setup 11/14] Drop in SolvableVersion as a replacement for packageversion Jon Turney
2017-05-31 11:05   ` [PATCH setup 12/14] Use solver to check for problems and produce a list of package transactions Jon Turney
2017-05-31 11:05   ` [PATCH setup 13/14] Download/checksum/install/uninstall what transaction wants Jon Turney
2017-05-31 11:05   ` [PATCH setup 14/14] Add obsoletes: support Jon Turney
2017-08-29 13:37 ` [PATCH setup 00/14] Use libsolv, solve all our problems... (WIP) Ken Brown
2017-08-30 21:47   ` Ken Brown
2017-09-01 15:01 ` Ken Brown
2017-09-02 16:57   ` Ken Brown
2017-09-05 13:34     ` Jon Turney
2017-09-05 18:40       ` Achim Gratz
2017-09-06  2:52         ` Ken Brown
2017-11-23 18:10           ` Jon Turney
2017-11-23 20:32             ` Ken Brown
2017-11-23 20:54             ` Achim Gratz
2017-09-08 18:54 ` Ken Brown
2017-09-11 20:40   ` Ken Brown
2017-09-13 19:17     ` Achim Gratz
2017-09-13 21:16       ` Ken Brown
2017-09-14 17:26         ` Achim Gratz
2017-09-14 20:46           ` Ken Brown
2017-09-15 19:24             ` Jon Turney
2017-09-16 16:21               ` Ken Brown
2017-09-19 12:24                 ` Ken Brown
2017-09-19 16:46                   ` Jon Turney
2017-09-19 16:58                     ` Ken Brown
2017-12-05 14:32             ` Jon Turney
2017-12-05 17:36               ` Ken Brown
2017-12-13 17:31               ` Ken Brown
2017-12-13 18:06                 ` Achim Gratz
2017-12-13 22:31                   ` Ken Brown
2017-12-14 14:12                     ` Ken Brown
2017-12-24 15:00                     ` Ken Brown
2018-01-09 13:25                       ` Jon Turney
2018-01-09 15:37                         ` Ken Brown
2018-01-09 15:49                           ` Ken Brown
2018-01-13 14:14                             ` Jon Turney
2018-01-13 19:56                               ` Ken Brown
2018-01-13 21:29                                 ` Brian Inglis
2018-01-13 22:55                                   ` Ken Brown
2018-01-14  0:00                                     ` Ken Brown
2018-01-14  1:52                                       ` Brian Inglis
2018-01-14  2:37                                         ` Ken Brown
2018-01-15 19:02                                 ` Jon Turney
2018-01-15 21:50                                   ` Ken Brown
2018-01-18 19:14                                     ` Jon Turney
2017-09-15 15:15   ` Jon Turney
2017-09-15 16:53     ` Ken Brown
2017-09-15 20:56       ` cyg Simple
2017-09-17 16:02         ` Ken Brown
2017-09-26 14:50       ` Jon Turney
2017-09-26 16:07         ` Ken Brown
2017-09-27 19:14           ` Jon Turney
2017-09-27 20:33             ` Ken Brown
2017-09-29 17:38               ` Jon Turney
2017-09-29 20:34                 ` Ken Brown
2017-10-02 14:07                   ` Jon Turney
2017-10-02 15:17                     ` Marco Atzeri
2017-10-04 14:43                       ` Jon Turney
2017-10-10 11:18                   ` Ken Brown
2017-10-10 15:49                     ` Jon Turney
2017-10-17 12:45                     ` Ken Brown
2017-10-17 18:47                       ` Jon Turney
2017-10-18 15:28                         ` Ken Brown
2017-10-18 15:57                           ` Ken Brown

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=20170531105015.162228-8-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /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).