From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114914 invoked by alias); 31 May 2017 10:57:28 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 114844 invoked by uid 89); 31 May 2017 10:57:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: rgout04.bt.lon5.cpcloud.co.uk Received: from rgout0401.bt.lon5.cpcloud.co.uk (HELO rgout04.bt.lon5.cpcloud.co.uk) (65.20.0.214) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 31 May 2017 10:57:26 +0000 X-OWM-Source-IP: 86.141.128.130 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-Junkmail-Premium-Raw: score=8/50,refid=2.7.2:2017.5.13.91815:17:8.707,ip=,rules=NO_URI_FOUND, NO_CTA_URI_FOUND, NO_MESSAGE_ID, NO_URI_HTTPS, TO_MALFORMED Received: from localhost.localdomain (86.141.128.130) by rgout04.bt.lon5.cpcloud.co.uk (9.0.019.13-1) (authenticated as jonturney@btinternet.com) id 58482DA21281BACE; Wed, 31 May 2017 11:57:28 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 07/14] Store package stability in class packageversion Date: Wed, 31 May 2017 10:57:00 -0000 Message-Id: <20170531105015.162228-8-jon.turney@dronecode.org.uk> In-Reply-To: <20170531105015.162228-1-jon.turney@dronecode.org.uk> References: <20170531105015.162228-1-jon.turney@dronecode.org.uk> X-SW-Source: 2017-05/txt/msg00168.txt.bz2 --- 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