From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87657 invoked by alias); 30 Oct 2017 15:36:32 -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 87639 invoked by uid 9795); 30 Oct 2017 15:36:31 -0000 Date: Mon, 30 Oct 2017 15:36:00 -0000 Message-ID: <20171030153631.87595.qmail@sourceware.org> From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [setup - the official Cygwin setup program] branch topic/libsolv, updated. release_2.882-49-gcc8b056 X-Git-Refname: refs/heads/topic/libsolv X-Git-Reftype: branch X-Git-Oldrev: 2d8c6a516831b9cf1d658f8475d6c4cd7d606fac X-Git-Newrev: cc8b056380f8ec6132bc4de9c5063da445e39e6d X-SW-Source: 2017-q4/txt/msg00018.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=cc8b056380f8ec6132bc4de9c5063da445e39e6d commit cc8b056380f8ec6132bc4de9c5063da445e39e6d Author: Jon Turney Date: Mon Oct 30 15:09:33 2017 +0000 Revert "Bump the installed.db version to 4" This reverts commit cbf84482f992011eca70c560a0584bc588db80d6. Do this temporarily so people can test but go back to using setup 2.882 without too much inconvenience... https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=00a9b3d23849faca898e83f94224c020fd90605f commit 00a9b3d23849faca898e83f94224c020fd90605f Author: Ken Brown Date: Fri Oct 27 14:47:23 2017 -0400 Remove the ScanFindVisitor class This class was used for local installs in which the repository contains no setup.ini file. It didn't correctly handle filenames with colons, and it could become a maintenance burden to continue to support it. There are now good instructions at https://cygwin.com/package-server.html#overlay for creating a valid repository, so we just remove the class instead of fixing it. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=cbf84482f992011eca70c560a0584bc588db80d6 commit cbf84482f992011eca70c560a0584bc588db80d6 Author: Ken Brown Date: Fri Oct 27 14:47:22 2017 -0400 Bump the installed.db version to 4 Starting with the commit 'Remove the function filemanip.cc:base', setup correctly parses version numbers of the form e:v-r in installed.db. Bump the version of installed.db to reflect the fact that older setup doesn't parse filenames containing colons correctly. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=6246390790c3a400f4dbc598b87e33eaa24449fe commit 6246390790c3a400f4dbc598b87e33eaa24449fe Author: Ken Brown Date: Fri Oct 27 14:47:21 2017 -0400 Remove the function filemanip.cc:base() This was called only on plain filenames, not full pathnames, so it was not needed. Moreover, it wasn't correctly handling filenames containing colons. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=9e862be86305feec1bedb4179959872c9c02a790 commit 9e862be86305feec1bedb4179959872c9c02a790 Author: Jon Turney Date: Sun Oct 29 17:20:51 2017 +0000 Fix invalid iterator use in packagedb::removeEmptyCategories() https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=3f0ec4a27751a60d77de1d8bb21798785e521054 commit 3f0ec4a27751a60d77de1d8bb21798785e521054 Author: Ken Brown Date: Sat Oct 28 13:46:19 2017 -0400 Avoid clobbering installed.db when no setup.ini is found If no setup.ini is found, do_ini_thread is never called. But we need to ensure that packagedb::read is called, or else installed.db gets emptied. Move the calls to packagedb::read and other packagedb functions from do_ini_thread to ChooserPage::OnInit. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=91a1c422c59dd0b2ecd00672dc6a68ad11535206 commit 91a1c422c59dd0b2ecd00672dc6a68ad11535206 Author: Jon Turney Date: Thu Oct 26 19:13:45 2017 +0100 Check for libregex at configure time Done properly this should use PKG_CHECK_MODULES, rather than checking for the header... Diff: --- IniDBBuilderPackage.h | 6 ----- Makefile.am | 2 - ScanFindVisitor.cc | 57 ------------------------------------------------- ScanFindVisitor.h | 36 ------------------------------- choose.cc | 8 ++++++- configure.ac | 1 + filemanip.cc | 18 +-------------- filemanip.h | 1 - fromcwd.cc | 8 +------ ini.cc | 7 ------ package_db.cc | 13 +++++++++- 11 files changed, 21 insertions(+), 136 deletions(-) diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h index 4e34680..1cd3412 100644 --- a/IniDBBuilderPackage.h +++ b/IniDBBuilderPackage.h @@ -46,12 +46,6 @@ public: 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 (trusts); void buildPackageCategory (const std::string& ); diff --git a/Makefile.am b/Makefile.am index 84b8b92..584098d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -235,8 +235,6 @@ inilint_SOURCES = \ resource.h \ root.cc \ root.h \ - ScanFindVisitor.cc \ - ScanFindVisitor.h \ script.cc \ script.h \ setup_version.h \ diff --git a/ScanFindVisitor.cc b/ScanFindVisitor.cc deleted file mode 100644 index 14c3722..0000000 --- a/ScanFindVisitor.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002 Robert Collins. - * - * 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/ - * - * Written by Robert Collins - * - */ - -#include "ScanFindVisitor.h" -#include "filemanip.h" -#include "IniDBBuilderPackage.h" - -ScanFindVisitor::ScanFindVisitor(IniDBBuilderPackage &aBuilder) : _Builder (aBuilder) {} -ScanFindVisitor::~ScanFindVisitor(){} - -/* look for potential packages we can add to the in-memory package - * database - */ -void -ScanFindVisitor::visitFile(const std::string& basePath, - const WIN32_FIND_DATA *theFile) -{ - // Sanity check: Does the file look like a package ? - fileparse f; - if (!parse_filename (theFile->cFileName, f)) - return; - - // Sanity check: Zero length package files get thrown out. - if (!(theFile->nFileSizeLow || theFile->nFileSizeHigh)) - return; - - // Build a new package called f.pkg - _Builder.buildPackage (f.pkg); - - // Set the version we are bulding - _Builder.buildPackageVersion (f.ver); - - // Add the file as a installable package - if (!f.what.size()) - { - //assume binary - _Builder.buildPackageInstall (basePath + theFile->cFileName, - stringify(theFile->nFileSizeLow)); - } - else - // patch or src, assume src until someone complains - _Builder.buildPackageSource (basePath + theFile->cFileName, - stringify(theFile->nFileSizeLow)); - -} diff --git a/ScanFindVisitor.h b/ScanFindVisitor.h deleted file mode 100644 index b4c93d9..0000000 --- a/ScanFindVisitor.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2002 Robert Collins. - * - * 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/ - * - * Written by Robert Collins - * - */ - -#ifndef SETUP_SCANFINDVISITOR_H -#define SETUP_SCANFINDVISITOR_H - -#include "FindVisitor.h" - -class IniDBBuilderPackage ; -/* Scan files and create a package db when no cached .ini exists */ -class ScanFindVisitor : public FindVisitor -{ -public: - ScanFindVisitor (IniDBBuilderPackage &aBuilder); - virtual void visitFile(const std::string& basePath, const WIN32_FIND_DATA *); - virtual ~ ScanFindVisitor (); -protected: - ScanFindVisitor (ScanFindVisitor const &); - ScanFindVisitor & operator= (ScanFindVisitor const &); -private: - IniDBBuilderPackage &_Builder; -}; - -#endif /* SETUP_SCANFINDVISITOR_H */ diff --git a/choose.cc b/choose.cc index 619d7db..3a990d5 100644 --- a/choose.cc +++ b/choose.cc @@ -264,10 +264,16 @@ ChooserPage::OnInit () } SetBusy (); + packagedb db; + db.makeBase(); + db.read(); + db.upgrade(); + db.fixup_source_package_ids(); + db.removeEmptyCategories(); + if (source == IDC_SOURCE_DOWNLOAD || source == IDC_SOURCE_LOCALDIR) packagemeta::ScanDownloadedFiles (MirrorOption); - packagedb db; db.setExistence (); db.fillMissingCategory (); diff --git a/configure.ac b/configure.ac index 421b9b4..ba4c10b 100644 --- a/configure.ac +++ b/configure.ac @@ -61,6 +61,7 @@ AC_CHECK_HEADER(bzlib.h, , missing_deps="$missing_deps libbz2") AC_CHECK_HEADER(lzma.h, , missing_deps="$missing_deps liblzma") AC_CHECK_HEADER(gcrypt.h, , missing_deps="$missing_deps libgcrypt") AC_CHECK_HEADER(solv/pool.h, , missing_deps="$missing_deps libsolv") +AC_CHECK_HEADER(regex.h, , missing_deps="$missing_deps libregex") if test -n "$missing_deps"; then AC_MSG_ERROR([missing prerequisites: $missing_deps]) diff --git a/filemanip.cc b/filemanip.cc index d1d27be..265a2a7 100644 --- a/filemanip.cc +++ b/filemanip.cc @@ -43,22 +43,6 @@ get_file_size (const std::string& name) return rv; } -std::string -base (const std::string& aString) -{ - if (!aString.size()) - return ""; - const char *s = aString.c_str(); - std::string rv = s; - while (*s) - { - if ((*s == '/' || *s == ':' || *s == '\\') && s[1]) - rv = s + 1; - s++; - } - return rv; -} - /* returns the number of characters of path that * precede the extension */ @@ -89,7 +73,7 @@ parse_filename (const string &fn, fileparse & f) f.tail = fn.substr (n, string::npos); - p = new_cstr_char_array (base (fn.substr (0, n))); + p = new_cstr_char_array (fn.substr (0, n)); char const *ext; /* TODO: make const and non-const trail variant. */ if ((ext = trail (p, "-src"))) diff --git a/filemanip.h b/filemanip.h index 5594519..451211f 100644 --- a/filemanip.h +++ b/filemanip.h @@ -30,7 +30,6 @@ struct fileparse }; int parse_filename (const std::string& fn, fileparse & f); -std::string base (const std::string& ); size_t get_file_size (const std::string& ); std::string backslash (const std::string& s); const char * trail (const char *, const char *); diff --git a/fromcwd.cc b/fromcwd.cc index 791744e..3e77ad3 100644 --- a/fromcwd.cc +++ b/fromcwd.cc @@ -30,7 +30,7 @@ #include "find.h" #include "ini.h" -#include "ScanFindVisitor.h" +#include "FindVisitor.h" #include "IniDBBuilderPackage.h" #include "IniParseFeedback.h" @@ -111,7 +111,6 @@ IniList found_ini_list; bool do_from_local_dir (HINSTANCE h, HWND owner, std::string &local_dir) { - // Assume we won't find the INI file. SetupFindVisitor found; // single mirror? Find (local_dir.c_str ()).accept (found, 1); @@ -121,10 +120,5 @@ do_from_local_dir (HINSTANCE h, HWND owner, std::string &local_dir) Find (local_dir.c_str ()).accept (found, 2); if (found) return true; - // nope, do full scan. - IniParseFeedback myFeedback; - IniDBBuilderPackage myBuilder (myFeedback); - ScanFindVisitor myVisitor (myBuilder); - Find (local_dir.c_str ()).accept (myVisitor); return false; } diff --git a/ini.cc b/ini.cc index 5089e8b..0f8b927 100644 --- a/ini.cc +++ b/ini.cc @@ -352,13 +352,6 @@ do_ini_thread (HINSTANCE h, HWND owner) else ini_count = do_remote_ini (owner); - packagedb db; - db.makeBase(); - db.read(); - db.upgrade(); - db.fixup_source_package_ids(); - db.removeEmptyCategories(); - if (ini_count == 0) return false; diff --git a/package_db.cc b/package_db.cc index a9f6905..66e7f0a 100644 --- a/package_db.cc +++ b/package_db.cc @@ -591,13 +591,22 @@ packagedb::defaultTrust (SolverTasks &q, SolverSolution::updateMode mode, bool t void packagedb::removeEmptyCategories() { + std::vector empty; + for (packagedb::categoriesType::iterator n = packagedb::categories.begin(); n != packagedb::categories.end(); ++n) if (!n->second.size()) { - Log (LOG_BABBLE) << "Removing empty category " << n->first << endLog; - packagedb::categories.erase (n++); + empty.push_back(n->first); } + + for (unsigned int i = 0; i < empty.size(); ++i) + { + packagedb::categoriesType::iterator n = packagedb::categories.find(empty[i]); + Log (LOG_BABBLE) << "Removing empty category " << empty[i] << endLog; + if (n != packagedb::categories.end()) + packagedb::categories.erase(n); + } } void