From dd15057d785045dfc1395ed5f39c84bcdcb88b13 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 12 Jul 2013 20:23:07 +0000 Subject: [PATCH] * IniDBBuilder.h (IniDBBuilder::set_arch): New function. (IniDBBuilder::set_release): New function. (IniDBBuilder::arch): New storage for arch:. (IniDBBuilder::arch): New storage for release:. * IniDBBuilderPackage.cc (IniDBBuilderPackage::autodep): Fix cut/paste error which ended up calling the wrong thing. * ScanFindVisitor.cc (ScanFindVisitor::visitFile): Remove old code. * cygpackage.cc (cygpackage::set_autodep): Implement to satisfy setup's insane class hierarchy. * cygpackage.h (cygpackage::set_autodep): See above. (std::string autodep_regex): Ditto. * package_version.cc (packageversion::set_autodep): Ditto. * package_version.h (packageversion::set_autodep): Ditto. * inilex.ll: Tokenize "arch:" and "release:". * iniparse.yy: Parse ARCH and RELEASE. --- ChangeLog | 18 +++++++++ IniDBBuilder.h | 4 ++ IniDBBuilderPackage.cc | 4 +- ScanFindVisitor.cc | 89 ------------------------------------------ cygpackage.cc | 6 +++ cygpackage.h | 2 + inilex.ll | 2 + iniparse.yy | 3 ++ package_version.cc | 7 ++++ package_version.h | 2 + 10 files changed, 46 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index a37e0a7d..548514c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2013-07-12 Christopher Faylor + + * IniDBBuilder.h (IniDBBuilder::set_arch): New function. + (IniDBBuilder::set_release): New function. + (IniDBBuilder::arch): New storage for arch:. + (IniDBBuilder::arch): New storage for release:. + * IniDBBuilderPackage.cc (IniDBBuilderPackage::autodep): Fix cut/paste + error which ended up calling the wrong thing. + * ScanFindVisitor.cc (ScanFindVisitor::visitFile): Remove old code. + * cygpackage.cc (cygpackage::set_autodep): Implement to satisfy setup's + insane class hierarchy. + * cygpackage.h (cygpackage::set_autodep): See above. + (std::string autodep_regex): Ditto. + * package_version.cc (packageversion::set_autodep): Ditto. + * package_version.h (packageversion::set_autodep): Ditto. + * inilex.ll: Tokenize "arch:" and "release:". + * iniparse.yy: Parse ARCH and RELEASE. + 2013-07-03 Christopher Faylor * win32.h (struct acl_t): Just enforce alignment using attribute. diff --git a/IniDBBuilder.h b/IniDBBuilder.h index cea5304b..719e0bfa 100644 --- a/IniDBBuilder.h +++ b/IniDBBuilder.h @@ -59,8 +59,12 @@ public: virtual void buildPackageListOperatorVersion (const std::string& ) = 0; virtual void buildMessage (const std::string&, const std::string&) = 0; virtual void autodep (const std::string&, const std::string&) = 0; + void set_arch (const std::string& a) { arch = a; } + void set_release (const std::string& rel) { release = rel; } unsigned int timestamp; + std::string arch; + std::string release; std::string version; std::string parse_mirror; }; diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc index 4c37fa14..7bb126c1 100644 --- a/IniDBBuilderPackage.cc +++ b/IniDBBuilderPackage.cc @@ -599,7 +599,7 @@ IniDBBuilderPackage::buildMessage (const std::string& message_id, const std::str } void -IniDBBuilderPackage::autodep (const std::string& message_id, const std::string& message) +IniDBBuilderPackage::autodep (const std::string& file_regex, const std::string& message) { - cp->set_message (message_id, message); + cbpv.set_autodep (file_regex); } diff --git a/ScanFindVisitor.cc b/ScanFindVisitor.cc index 9b7e1ebc..11f0a166 100644 --- a/ScanFindVisitor.cc +++ b/ScanFindVisitor.cc @@ -58,94 +58,5 @@ ScanFindVisitor::visitFile(const std::string& basePath, // patch or src, assume src until someone complains _Builder.buildPackageSource (basePath + theFile->cFileName, stringify(theFile->nFileSizeLow)); - - // TODO: Review the below code. We may wish to reinstate it *somewhere*. -#if 0 - /* Scan existing package list looking for a match between a known - package and a tar archive on disk. - While scanning, keep track of appropriate "holes" in the trust - table where a tar file could be put if no known entry - exists. - - We have 4 specific insertion points and one generic point. - The generic point is in versioned order in the package version array. - The specific points are - *installed - *prev - *curr - *exp. - - if the version number matches a version in the db, - we simply add this as a mirror source to that version. - If it matches no version, we add a new version to the db. - - Lastly if the version number does not matche one of installed/prev/current/exp - AND we had to create a new version entry - we apply the following heuristic: - if there is no exp, we link this in exp. - If there is an exp and this is higher, we link this in exp, and - if there is no curr, bump what was in exp to curr. If there was a curr, we leave it be. - if this is lower than exp, and there is no curr, link as curr. If there is a curr, leave it be. - If this is lower than curr, and there is no prev, link as prev, if there is a prev, leave it be. - - Whilst this logic is potentially wrong from time to time, it guarantees that - setup.ini defined stability won't be altered unintentially. An alternative is to - mark setup.ini defined prev/curr/exp packages as such, when this algorithm, can - get smarter. - - So, if setup.ini knows that ash-20010425-1.tar.gz is the current - version and there is an ash-20010426-1.tar.gz in the current directory, - the 20010426 version will be placed in the "test" slot, assuming that - there is no test version listed in setup.ini. */ - - int added = 0; - for (size_t n = 1; n <= pkg->versions.number (); n++) - { - if (!f.ver.casecompare (pkg->versions[n]->Canonical_version ())) - { - if (f.what == String ()) - { - //bin package - pkg->versions[n]->bin.set_cached (String ("file://") + basePath + theFile->cFileName); - } - else if (f.what == "src") - { - //src package - pkg->versions[n]->src.set_cached (String ("file://") + basePath + theFile->cFileName); - } - added = 1; - } - } - if (!added) - { -#if 0 - // Do we want old versions to show up - packageversion *pv = new cygpackage (f.pkg); - ((cygpackage *) pv)->set_canonical_version (f.ver); - if (!f.what.size ()) - pv->bin.set_cached (String ("file://") + path); - else - // patch or src, assume src until someone complains - pv->src.set_cached (String ("file://") + path); - pkg->add_version (*pv); - -#endif - - /* And now the hole finder */ -#if 0 - if (!pkg->exp) - pkg->exp = thenewver; - else if (strcasecmp (f.ver, pkg->versions[n]->Canonicalversion ()) < 0) - /* try curr */ - if (!pkg->curr) - pkg->curr = thenewver; - else if (strcasecmp (f.ver, pkg->versions[n]->Canonicalversion ()) < - 0) - /* try prev */ - if (!pkg->prev) - pkg->prev = thenewver; -#endif - } -#endif } diff --git a/cygpackage.cc b/cygpackage.cc index bcc80a6d..1c33936a 100644 --- a/cygpackage.cc +++ b/cygpackage.cc @@ -192,6 +192,12 @@ cygpackage::set_sdesc (const std::string& desc) sdesc = desc; } +void +cygpackage::set_autodep (const std::string& autodep) +{ + autodep_regex = autodep; +} + void cygpackage::set_ldesc (const std::string& desc) { diff --git a/cygpackage.h b/cygpackage.h index afe16254..24bd9c91 100644 --- a/cygpackage.h +++ b/cygpackage.h @@ -52,6 +52,7 @@ public: { return ldesc; }; + virtual void set_autodep (const std::string& ); virtual void uninstall (); @@ -85,6 +86,7 @@ private: std::string canonical; std::string fn; std::string sdesc, ldesc; + std::string autodep_regex; char getfilenamebuffer[MAX_PATH]; // package_stability_t stability; diff --git a/inilex.ll b/inilex.ll index cc0723d9..bc5909ce 100644 --- a/inilex.ll +++ b/inilex.ll @@ -70,6 +70,8 @@ STR [!a-zA-Z0-9_./:\+~-]+ "setup-timestamp:" return SETUP_TIMESTAMP; "setup-version:" return SETUP_VERSION; +"arch:" return ARCH; +"release:" return RELEASE; "Package:" return PACKAGENAME; [vV]"ersion:" return PACKAGEVERSION; "install:"|"Filename:" return INSTALL; diff --git a/iniparse.yy b/iniparse.yy index 6e921bbe..f154de77 100644 --- a/iniparse.yy +++ b/iniparse.yy @@ -51,6 +51,7 @@ void add_correct_version(); %token OPENSQUARE CLOSESQUARE %token BINARYPACKAGE BUILDDEPENDS STANDARDSVERSION FORMAT DIRECTORY FILES %token MESSAGE AUTODEP +%token ARCH RELEASE %% @@ -121,6 +122,8 @@ singleitem /* non-empty */ | FILES NL SourceFilesList | MESSAGE STRING STRING NL { iniBuilder->buildMessage ($2, $3); } | AUTODEP STRING STRING NL { iniBuilder->autodep ($2, $3); } + | ARCH STRING { iniBuilder->set_arch ($2); } + | RELEASE STRING { iniBuilder->set_release ($2); } | DESCTAG mlinedesc | error { yyerror (std::string("unrecognized line ") + stringify(yylineno) diff --git a/package_version.cc b/package_version.cc index 29c6175b..7ba602b3 100644 --- a/package_version.cc +++ b/package_version.cc @@ -58,6 +58,7 @@ public: void set_sdesc (const std::string& ) {} const std::string LDesc () {return std::string();} void set_ldesc (const std::string& ) {} + void set_autodep (const std::string& ) {} void uninstall (){} void pick(bool const &newValue){/* Ignore attempts to pick this!. Throw an exception here if you want to detect such attemtps instead */} virtual void addScript(Script const &) {} @@ -217,6 +218,12 @@ packageversion::set_ldesc (const std::string& ldesc) data->set_ldesc (ldesc); } +void +packageversion::set_autodep (const std::string& regex) +{ + data->set_autodep (regex); +} + packageversion packageversion::sourcePackage() const { diff --git a/package_version.h b/package_version.h index 7c6590c8..2c0f4eb3 100644 --- a/package_version.h +++ b/package_version.h @@ -113,6 +113,7 @@ public: void set_sdesc (const std::string& ); const std::string LDesc () const; void set_ldesc (const std::string& ); + void set_autodep (const std::string& ); packageversion sourcePackage () const; PackageSpecification & sourcePackageSpecification (); void setSourcePackageSpecification (PackageSpecification const &); @@ -178,6 +179,7 @@ public: virtual void set_sdesc (const std::string& ) = 0; virtual const std::string LDesc () = 0; virtual void set_ldesc (const std::string& ) = 0; + virtual void set_autodep (const std::string& ) = 0; /* only semantically meaningful for binary packages */ /* direct link to the source package for this binary */ /* if multiple versions exist and the source doesn't discriminate -- 2.43.5