From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101010 invoked by alias); 30 May 2017 11:27:17 -0000 Mailing-List: contact cygwin-apps-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-apps-cvs-owner@sourceware.org Received: (qmail 100909 invoked by uid 9795); 30 May 2017 11:27:16 -0000 Date: Tue, 30 May 2017 11:27:00 -0000 Message-ID: <20170530112716.100849.qmail@sourceware.org> From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [setup - the official Cygwin setup program used to install Cygwin and keep it up to date] branch master, updated. release_2.879-25-g325ac0c X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 9b4b982d5548c60547f6a2593157146e1784fa1d X-Git-Newrev: 325ac0c243127855a7ef8143f12e77007a11075a X-SW-Source: 2017-q2/txt/msg00041.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=325ac0c243127855a7ef8143f12e77007a11075a commit 325ac0c243127855a7ef8143f12e77007a11075a Author: Jon Turney Date: Mon May 22 22:04:21 2017 +0100 Remove OR from grammar Unused since removal of complex dependency rules in 60b4f6ca https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=fa78304da64a5e232e7ca36e1243c7656efb0738 commit fa78304da64a5e232e7ca36e1243c7656efb0738 Author: Jon Turney Date: Mon May 22 19:22:45 2017 +0100 Improve error recovery in setup.ini parsing Following the error token with a NL allows the parser to discard tokens until a NL is found to resynchronize, rather than aborting. This doesn't help hugely, as *any* parse errors are considered fatal by do_remote_ini()/do_local_ini() and won't let us proceed. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=b7579b94c06affa95e1d7af6855fd861e54ff824 commit b7579b94c06affa95e1d7af6855fd861e54ff824 Author: Jon Turney Date: Mon May 22 16:18:04 2017 +0100 Fix infinite recursion in grammar for depends Allowing listseparator to be empty allows an infinite recursion in the versionedpackagelist rule Also make the comment documenting versionedpackageentry is non-empty consistent with all other similar comments Also allow lower-case depends: https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=419e12a1986f0861874b3f172536c248d49b194b commit 419e12a1986f0861874b3f172536c248d49b194b Author: Jon Turney Date: Fri Apr 28 22:11:47 2017 +0100 Fold build(Install|Source)(MD5|SHA512) into buildPackage(Install|Source) Fold build(Install|Source)(MD5|SHA512) into buildPackage(Install|Source), so the (pathname, size, hash) information from an install: or source: line is all processed together. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=9a1a53fce94a6d9ad0fe8eb622246904bbc360a3 commit 9a1a53fce94a6d9ad0fe8eb622246904bbc360a3 Author: Jon Turney Date: Fri Apr 28 21:35:29 2017 +0100 Fold IniDBBuilderPackage::buildInstallSize() into buildPackageInstall() As mentioned in 5a3799dc, this ripples through into ScanFindVisitor as well. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=4cd7113195b9b8e2b85cd30a128e94120dddfc18 commit 4cd7113195b9b8e2b85cd30a128e94120dddfc18 Author: Jon Turney Date: Tue May 16 18:53:55 2017 +0100 Move and rename dumpAndList() https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=6f944309fc11fa70b7e203e8dd2dc69bc2d598ed commit 6f944309fc11fa70b7e203e8dd2dc69bc2d598ed Author: Jon Turney Date: Thu May 18 16:33:26 2017 +0100 Make PrereqChecker::setTrust() a static method Rather than instantiating PrereqChecker just to call an accessor method which changes a static data member, make that method static as well. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=fb5ecc5d154a70a05c0388c3cc3ee3016a92763f commit fb5ecc5d154a70a05c0388c3cc3ee3016a92763f Author: Jon Turney Date: Sun May 21 19:45:29 2017 +0100 Rename category "Misc" to "Orphaned" Packages which have no category are placed into this category. Since a category is mandatory for all packages in setup.ini, this effectively means packages which are "orphaned" in the sense that they are installed, but don't appear in any setup.ini. Usually it's safe to uninstall such packages (with --delete-orphans), unless you are actually using them, or have locally built packages which rely on them. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=c81e2996055b09aeb7b9cc220890809461e45e91 commit c81e2996055b09aeb7b9cc220890809461e45e91 Author: Jon Turney Date: Sun May 21 19:40:32 2017 +0100 Correctly calculate total data to checksum when using IncludeSource Correctly account for source packages installed due to IncludeSource in the total amount of data to checksum. The fact that this obvious bug is unreported kind of suggests that no-one is actually using this option... https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=afba8f1426d478a85378be4352f7773556f3a3e6 commit afba8f1426d478a85378be4352f7773556f3a3e6 Author: Jon Turney Date: Sat May 20 16:46:53 2017 +0100 isBinary() should return true for orphaned packages Test added in c23d96d6 is incorrect and results in orphaned packages being omitted from picker. Diff: --- IniDBBuilderPackage.cc | 88 +++++++++++++++++++++++++----------------------- IniDBBuilderPackage.h | 21 ++++++++---- Makefile.am | 1 + ScanFindVisitor.cc | 4 +- choose.cc | 5 +-- inilex.ll | 3 +- iniparse.yy | 26 +++++--------- install.cc | 2 +- package_db.cc | 2 +- package_depends.cc | 33 ++++++++++++++++++ package_depends.h | 3 ++ package_meta.cc | 8 ++-- package_version.cc | 18 ---------- package_version.h | 3 -- prereq.h | 2 +- 15 files changed, 118 insertions(+), 101 deletions(-) diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc index 7f500d6..ad1cc88 100644 --- a/IniDBBuilderPackage.cc +++ b/IniDBBuilderPackage.cc @@ -77,7 +77,7 @@ IniDBBuilderPackage::buildPackage (const std::string& name) { Log (LOG_BABBLE) << "Version " << cbpv.Canonical_version() << endLog; Log (LOG_BABBLE) << "Depends:"; - dumpAndList (cbpv.depends(), Log (LOG_BABBLE)); + dumpPackageDepends (cbpv.depends(), Log (LOG_BABBLE)); Log (LOG_BABBLE) << endLog; } } @@ -119,14 +119,38 @@ IniDBBuilderPackage::buildPackageLDesc (const std::string& theDesc) } void -IniDBBuilderPackage::buildPackageInstall (const std::string& path) +IniDBBuilderPackage::buildPackageInstall (const std::string& path, + const std::string& size, + char *hash, + hashType type) { process_src (*cbpv.source(), path); + setSourceSize (*cbpv.source(), size); + + switch (type) { + case hashType::sha512: + if (hash && !cbpv.source()->sha512_isSet) + { + memcpy (cbpv.source()->sha512sum, hash, sizeof(cbpv.source()->sha512sum)); + cbpv.source()->sha512_isSet = true; + } + break; + + case hashType::md5: + if (hash && !cbpv.source()->md5.isSet()) + cbpv.source()->md5.set((unsigned char *)hash); + break; + + case hashType::none: + break; + } } void IniDBBuilderPackage::buildPackageSource (const std::string& path, - const std::string& size) + const std::string& size, + char *hash, + hashType type) { packagedb db; /* get an appropriate metadata */ @@ -166,6 +190,24 @@ IniDBBuilderPackage::buildPackageSource (const std::string& path, spec.setVersion (cbpv.Canonical_version()); setSourceSize (*cspv.source(), size); + + switch (type) { + case hashType::sha512: + if (hash && !cspv.source()->sha512_isSet) + { + memcpy (cspv.source()->sha512sum, hash, sizeof(cspv.source()->sha512sum)); + cspv.source()->sha512_isSet = true; + } + break; + + case hashType::md5: + if (hash && !cspv.source()->md5.isSet()) + cspv.source()->md5.set((unsigned char *)hash); + break; + + case hashType::none: + break; + } } void @@ -191,51 +233,13 @@ IniDBBuilderPackage::buildBeginDepends () #if DEBUG Log (LOG_BABBLE) << "Beginning of a depends statement for " << cp->name << endLog; - dumpAndList (currentNodeList, Log (LOG_BABBLE)); + dumpPackageDepends (currentNodeList, Log (LOG_BABBLE)); #endif currentSpec = NULL; currentNodeList = cbpv.depends(); } void -IniDBBuilderPackage::buildInstallSize (const std::string &size) -{ - setSourceSize (*cbpv.source(), size); -} - -void -IniDBBuilderPackage::buildInstallSHA512 (unsigned char const *sha512) -{ - if (sha512 && !cbpv.source()->sha512_isSet) { - memcpy (cbpv.source()->sha512sum, sha512, sizeof cbpv.source()->sha512sum); - cbpv.source()->sha512_isSet = true; - } -} - -void -IniDBBuilderPackage::buildSourceSHA512 (unsigned char const *sha512) -{ - if (sha512 && !cspv.source()->sha512_isSet) { - memcpy (cspv.source()->sha512sum, sha512, sizeof cspv.source()->sha512sum); - cspv.source()->sha512_isSet = true; - } -} - -void -IniDBBuilderPackage::buildInstallMD5 (unsigned char const *md5) -{ - if (md5 && !cbpv.source()->md5.isSet()) - cbpv.source()->md5.set(md5); -} - -void -IniDBBuilderPackage::buildSourceMD5 (unsigned char const *md5) -{ - if (md5 && !cspv.source()->md5.isSet()) - cspv.source()->md5.set(md5); -} - -void IniDBBuilderPackage::buildBeginBuildDepends () { #if DEBUG diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h index 4df1bdb..766a5ef 100644 --- a/IniDBBuilderPackage.h +++ b/IniDBBuilderPackage.h @@ -18,10 +18,13 @@ #include #include "package_version.h" + class IniParseFeedback; class packagesource; class packagemeta; +enum class hashType { none, md5, sha512 }; + class IniDBBuilderPackage { public: @@ -34,17 +37,21 @@ public: void buildPackageVersion (const std::string& ); void buildPackageSDesc (const std::string& ); void buildPackageLDesc (const std::string& ); - void buildPackageInstall (const std::string& ); - void buildPackageSource (const std::string&, const std::string&); + void buildPackageInstall (const std::string&, const std::string&, + char *, hashType); + void buildPackageSource (const std::string&, const std::string&, + char *, hashType); + + // helpers for ScanFindVisitor + void buildPackageInstall (const std::string& path, const std::string& size) + { buildPackageInstall(path, size, NULL, hashType::none); } + void buildPackageSource (const std::string& path, const std::string& size) + { buildPackageSource(path, size, NULL, hashType::none); } + void buildPackageTrust (int); void buildPackageCategory (const std::string& ); void buildBeginDepends (); - void buildInstallSize (const std::string& ); - void buildInstallSHA512 (unsigned char const[64]); - void buildSourceSHA512 (unsigned char const[64]); - void buildInstallMD5 (unsigned char const[16]); - void buildSourceMD5 (unsigned char const[16]); void buildBeginBuildDepends (); void buildMessage (const std::string&, const std::string&); void buildSourceName (const std::string& ); diff --git a/Makefile.am b/Makefile.am index af89af5..d4c8472 100644 --- a/Makefile.am +++ b/Makefile.am @@ -203,6 +203,7 @@ inilint_SOURCES = \ package_db.cc \ package_db.h \ package_depends.h \ + package_depends.cc \ package_meta.cc \ package_meta.h \ package_source.cc \ diff --git a/ScanFindVisitor.cc b/ScanFindVisitor.cc index 02cd6e8..14c3722 100644 --- a/ScanFindVisitor.cc +++ b/ScanFindVisitor.cc @@ -46,8 +46,8 @@ ScanFindVisitor::visitFile(const std::string& basePath, if (!f.what.size()) { //assume binary - _Builder.buildPackageInstall (basePath + theFile->cFileName); - _Builder.buildInstallSize(stringify(theFile->nFileSizeLow)); + _Builder.buildPackageInstall (basePath + theFile->cFileName, + stringify(theFile->nFileSizeLow)); } else // patch or src, assume src until someone complains diff --git a/choose.cc b/choose.cc index 2016caa..1bc4c0b 100644 --- a/choose.cc +++ b/choose.cc @@ -260,7 +260,7 @@ ChooserPage::OnInit () bool wanted = pkg.isManuallyWanted(); bool deleted = pkg.isManuallyDeleted(); bool basemisc = (pkg.categories.find ("Base") != pkg.categories.end () - || pkg.categories.find ("Misc") != pkg.categories.end ()); + || pkg.categories.find ("Orphaned") != pkg.categories.end ()); bool upgrade = wanted || (!pkg.installed && basemisc) || UpgradeAlsoOption || !hasManualSelections; bool install = wanted && !deleted && !pkg.installed; @@ -373,8 +373,7 @@ ChooserPage::changeTrust(trusts aTrust) SetBusy (); chooser->defaultTrust (aTrust); chooser->refresh(); - PrereqChecker p; - p.setTrust (aTrust); + PrereqChecker::setTrust (aTrust); ClearBusy (); } diff --git a/inilex.ll b/inilex.ll index 798a04b..13422b1 100644 --- a/inilex.ll +++ b/inilex.ll @@ -121,7 +121,7 @@ B64 [a-zA-Z0-9_-] "category:"|"Section:" return CATEGORY; "requires:" return REQUIRES; -"Depends:" return DEPENDS; +[dD]"epends:" return DEPENDS; ^{STR}":" ignore_line (); @@ -141,7 +141,6 @@ B64 [a-zA-Z0-9_-] "<" return LT; "=" return EQUAL; \, return COMMA; -"|" return OR; "@" return AT; {STR} { yylval = new char [strlen(yytext) + 1]; diff --git a/iniparse.yy b/iniparse.yy index 2480cc6..18ebe2a 100644 --- a/iniparse.yy +++ b/iniparse.yy @@ -42,7 +42,7 @@ extern int yylineno; %token MD5 SHA512 %token SOURCEPACKAGE %token PACKAGENAME -%token COMMA OR NL AT +%token COMMA NL AT %token OPENBRACE CLOSEBRACE EQUAL GT LT GTEQUAL LTEQUAL %token BUILDDEPENDS %token MESSAGE @@ -96,13 +96,15 @@ singleitem /* non-empty */ | T_OTHER NL { iniBuilder->buildPackageTrust (TRUST_OTHER); } | SOURCEPACKAGE source NL | CATEGORY categories NL - | INSTALL STRING STRING { iniBuilder->buildPackageInstall ($2); iniBuilder->buildInstallSize($3);} installchksum NL - | SOURCE STRING STRING sourcechksum NL {iniBuilder->buildPackageSource ($2, $3);} + | INSTALL STRING STRING MD5 NL { iniBuilder->buildPackageInstall ($2, $3, $4, hashType::md5); } + | INSTALL STRING STRING SHA512 NL { iniBuilder->buildPackageInstall ($2, $3, $4, hashType::sha512); } + | SOURCE STRING STRING MD5 NL {iniBuilder->buildPackageSource ($2, $3, $4, hashType::md5); } + | SOURCE STRING STRING SHA512 NL {iniBuilder->buildPackageSource ($2, $3, $4, hashType::sha512); } | DEPENDS { iniBuilder->buildBeginDepends(); } versionedpackagelist NL | REQUIRES { iniBuilder->buildBeginDepends(); } versionedpackagelistsp NL | BUILDDEPENDS { iniBuilder->buildBeginBuildDepends(); } versionedpackagelist NL | MESSAGE STRING STRING NL { iniBuilder->buildMessage ($2, $3); } - | error { yyerror (std::string("unrecognized line ") + | error NL { yyerror (std::string("unrecognized line ") + stringify(yylineno) + " (do you have the latest setup?)"); } @@ -112,16 +114,6 @@ categories: /* empty */ | categories STRING { iniBuilder->buildPackageCategory ($2); } ; -installchksum /* non-empty */ - : MD5 { iniBuilder->buildInstallMD5 ((unsigned char *)$1);} - | SHA512 { iniBuilder->buildInstallSHA512 ((unsigned char *)$1);} - ; - -sourcechksum /* non-empty */ - : MD5 { iniBuilder->buildSourceMD5 ((unsigned char *)$1); } - | SHA512 { iniBuilder->buildSourceSHA512 ((unsigned char *)$1); } - ; - source /* non-empty */ : STRING { iniBuilder->buildSourceName ($1); } versioninfo ; @@ -140,12 +132,12 @@ versionedpackagelistsp /* non-empty */ | versionedpackagelistsp versionedpackageentry ; -listseparator: /* empty */ - | COMMA +listseparator /* non-empty */ + : COMMA | COMMA NL ; -versionedpackageentry /* empty not allowed */ +versionedpackageentry /* non-empty */ : STRING { iniBuilder->buildPackageListNode($1); } versioncriteria ; diff --git a/install.cc b/install.cc index 3721047..79ddd20 100644 --- a/install.cc +++ b/install.cc @@ -745,7 +745,7 @@ do_install_thread (HINSTANCE h, HWND owner) md5sum_total_bytes += pkg.desired.source()->size; } - if (pkg.desired.sourcePackage ().picked()) + if (pkg.desired.sourcePackage ().picked() || IncludeSource) { md5sum_total_bytes += pkg.desired.sourcePackage ().source()->size; } diff --git a/package_db.cc b/package_db.cc index 3978421..dbec17e 100644 --- a/package_db.cc +++ b/package_db.cc @@ -435,7 +435,7 @@ packagedb::defaultTrust (trusts trust) packagemeta & pkg = *(i->second); if (pkg.installed || pkg.categories.find ("Base") != pkg.categories.end () - || pkg.categories.find ("Misc") != pkg.categories.end ()) + || pkg.categories.find ("Orphaned") != pkg.categories.end ()) { pkg.desired = pkg.trustp (true, trust); if (pkg.desired) diff --git a/package_depends.cc b/package_depends.cc new file mode 100644 index 0000000..e288c0b --- /dev/null +++ b/package_depends.cc @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2017 Jon Turney + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + */ + +#include +#include + +void +dumpPackageDepends (PackageDepends const *currentList, + std::ostream &logger) +{ + if (currentList) + { + Log (LOG_BABBLE) << "( "; + PackageDepends::const_iterator i = currentList->begin(); + while (true) + { + if (i == currentList->end()) break; + Log (LOG_BABBLE) << **i << " "; + ++i; + } + Log (LOG_BABBLE) << ")"; + } +} diff --git a/package_depends.h b/package_depends.h index 05e0dc6..af3fa01 100644 --- a/package_depends.h +++ b/package_depends.h @@ -14,8 +14,11 @@ #ifndef PACKAGE_DEPENDS_H #define PACKAGE_DEPENDS_H +#include #include typedef std::vector PackageDepends; +void dumpPackageDepends (PackageDepends const *currentList, std::ostream &); + #endif // PACKAGE_DEPENDS_H diff --git a/package_meta.cc b/package_meta.cc index cffb5b7..b35b554 100644 --- a/package_meta.cc +++ b/package_meta.cc @@ -464,7 +464,7 @@ packagemeta::set_action (_actions action, packageversion const &default_version) { if (installed || categories.find ("Base") != categories.end () - || categories.find ("Misc") != categories.end ()) + || categories.find ("Orphaned") != categories.end ()) { desired = default_version; if (desired) @@ -546,7 +546,7 @@ packagemeta::isBinary () const { for (set::iterator i=versions.begin(); i != versions.end(); ++i) - if ((i->Type() == package_binary) && i->accessible()) + if ((i->Type() == package_binary) && (i->accessible() || (*i == installed))) return true; return false; @@ -564,7 +564,7 @@ packagemeta::logAllVersions () const { std::ostream & logger = Log (LOG_BABBLE); logger << " depends="; - dumpAndList(i->depends(), logger); + dumpPackageDepends(i->depends(), logger); logger << endLog; } } @@ -688,7 +688,7 @@ packagemeta::hasNoCategories() const void packagemeta::setDefaultCategories() { - add_category ("Misc"); + add_category ("Orphaned"); } void diff --git a/package_version.cc b/package_version.cc index 6a903c5..f022e70 100644 --- a/package_version.cc +++ b/package_version.cc @@ -412,21 +412,3 @@ _packageversion::scripts() { return scripts_; } - -void -dumpAndList (PackageDepends const *currentList, - std::ostream &logger) -{ - if (currentList) - { - Log (LOG_BABBLE) << "( "; - PackageDepends::const_iterator i = currentList->begin(); - while (true) - { - if (i == currentList->end()) break; - Log (LOG_BABBLE) << **i << " "; - ++i; - } - Log (LOG_BABBLE) << ")"; - } -} diff --git a/package_version.h b/package_version.h index ff16eb8..d70eda0 100644 --- a/package_version.h +++ b/package_version.h @@ -196,7 +196,4 @@ protected: std::vector