From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43153 invoked by alias); 15 Jul 2018 12:58:58 -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 43096 invoked by uid 9795); 15 Jul 2018 12:58:57 -0000 Date: Sun, 15 Jul 2018 12:58:00 -0000 Message-ID: <20180715125857.43044.qmail@sourceware.org> From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [setup - the official Cygwin setup program] branch master, updated. release_2.892 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 5947bc929bc772bf067a6b457fc825bbbfc4b0e6 X-Git-Newrev: b510f2476bda8cda2857b72083f9a20940be1a6d X-SW-Source: 2018-q3/txt/msg00003.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=b510f2476bda8cda2857b72083f9a20940be1a6d commit b510f2476bda8cda2857b72083f9a20940be1a6d Author: Jon Turney Date: Sat Jul 14 16:48:07 2018 +0100 Remove uninitialized NetIO::ftp_auth flag This appears to be left over since f5d45c3b. NetIO::get_ftp_auth() doesn't appear to be used at all, but perhaps should by the NetIO_IE5 constructor for FTP auth. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=35e81facc1af583bfd62967286be5a0f92a97a98 commit 35e81facc1af583bfd62967286be5a0f92a97a98 Author: Jon Turney Date: Sat Jul 14 16:46:57 2018 +0100 Initialize file_size in NetIO constructor At the moment, this is not initialized anywhere. If it's value happens to be greater than zero, that will be used as the size to report download progress against. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=93b56849928f74f0e5cf646bb21448004e3cf17d commit 93b56849928f74f0e5cf646bb21448004e3cf17d Author: Jon Turney Date: Thu Mar 22 21:34:51 2018 +0000 Don't write dependency problems to log with CRLF line terminators Only transform line endings in the dependency problems string used in a Windows dialog text box, not in what's written to the log as well. https://cygwin.com/ml/cygwin/2018-03/msg00266.html https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=fa6e8a64b897468a1d8d7aff232dbbb76615a6f7 commit fa6e8a64b897468a1d8d7aff232dbbb76615a6f7 Author: Jon Turney Date: Mon Jul 9 19:15:10 2018 +0100 Keep track of all known sites for a given version of a package When adding a packageversion, extend it's packagesource::sites vector to include the sites from any similar packageversions previously processed. Also remove those packageversions from the libsolv pool so that libsolv will always find the one that lists all the sites. This is needed for: - Correct handling of local installs where required packages are spread between cache directories for more than one mirror - Correctly falling back to a second site when multiple mirrors are used and a problem occurs connecting to the first mirror tried. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=f158577dcc64e4393c07cce44f0af166799889bf commit f158577dcc64e4393c07cce44f0af166799889bf Author: Jon Turney Date: Sun Jul 8 16:26:45 2018 +0100 Add Vendor() accessor method to SolvableVersion https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=dc2d74cc281538f773be73781b5fa3f67924543a commit dc2d74cc281538f773be73781b5fa3f67924543a Author: Ken Brown Date: Sat Mar 17 10:59:54 2018 -0400 Internalize the libsolv repo attribute data after each setup.ini Call SolverPool::internalize() in the IniDBBuilderPackage destructor. This makes attribute data from all previously processed setup.ini files available when the next setup.ini is being processed. Remove the now unneeded call to SolverPool::internalize() at the beginning of packagedb::read(). https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=ffcd94d7c50dfcc36fd9cc6b19d3a3f4a7bc2794 commit ffcd94d7c50dfcc36fd9cc6b19d3a3f4a7bc2794 Author: Jon Turney Date: Sat Jul 7 09:09:02 2018 +0100 Propagate exit code of elevated process Propagate the exit code of elevated process, when --wait is used. This addresses part of the problem about exit code noted in [1], although we also need to audit that a non-zero exit code is reported in all error situations. [1] https://cygwin.com/ml/cygwin/2018-07/msg00020.html Also report if starting the elevated child process failed. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=51351b413132b7c334848e91d1bbaab4d9f6fbf9 commit 51351b413132b7c334848e91d1bbaab4d9f6fbf9 Author: Jon Turney Date: Fri Jul 6 17:45:42 2018 +0100 If setup-minimum-version: was checked, don't check setup-version: Don't check setup-version: to warn about potential setup.ini parsing problems if a setup-minimum-version: is specified. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=0955c7b05bdb50ae180e9ab5f9bfb3c8489a0242 commit 0955c7b05bdb50ae180e9ab5f9bfb3c8489a0242 Author: Ken Brown Date: Thu Jul 5 11:22:20 2018 -0400 Add --no-version-check option This suppresses the warning that a newer version of setup is available. This is intended to be used by shortcuts and scripts that run setup in a 'setup' package. This would also suppress any future auto-update feature. Diff: --- IniDBBuilderPackage.cc | 14 +++++++- IniDBBuilderPackage.h | 1 + ini.cc | 4 ++- libsolv.cc | 17 ++++++++++ libsolv.h | 1 + main.cc | 10 ++++-- netio.cc | 2 - netio.h | 3 +- package_db.cc | 16 ++------- package_meta.cc | 82 ++++++++++++++++++++++++++++++++++++------------ package_meta.h | 2 +- prereq.cc | 16 +++++----- 12 files changed, 118 insertions(+), 50 deletions(-) diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc index 48a5d4a..cde99a8 100644 --- a/IniDBBuilderPackage.cc +++ b/IniDBBuilderPackage.cc @@ -32,11 +32,13 @@ using namespace std; IniDBBuilderPackage::IniDBBuilderPackage (IniParseFeedback const &aFeedback) : -currentSpec (0), _feedback (aFeedback){} + currentSpec (0), _feedback (aFeedback), minimum_version_checked(FALSE) {} IniDBBuilderPackage::~IniDBBuilderPackage() { process(); + packagedb db; + db.solver.internalize(); } void @@ -49,6 +51,15 @@ void IniDBBuilderPackage::buildVersion (const std::string& aVersion) { version = aVersion; + + /* We shouldn't need to warn about potential setup.ini parse problems if we + exceed the version in setup-minimum-version: (we will still advise about a + possible setup upgrade in do_ini_thread()). If we don't exceed + setup-minimum-version:, we've already encountered a fatal error, so no need + to warn as well. */ + if (minimum_version_checked) + return; + if (version.size()) { if (version_compare(setup_version, version) < 0) @@ -68,6 +79,7 @@ IniDBBuilderPackage::buildVersion (const std::string& aVersion) const std::string IniDBBuilderPackage::buildMinimumVersion (const std::string& minimum) { + minimum_version_checked = TRUE; if (version_compare(setup_version, minimum) < 0) { char min_vers[256]; diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h index 79a864e..e5d3662 100644 --- a/IniDBBuilderPackage.h +++ b/IniDBBuilderPackage.h @@ -91,6 +91,7 @@ private: std::set replace_versions; IniParseFeedback const &_feedback; + bool minimum_version_checked; }; #endif /* SETUP_INIDBBUILDERPACKAGE_H */ diff --git a/ini.cc b/ini.cc index 7afeba2..78684a7 100644 --- a/ini.cc +++ b/ini.cc @@ -62,6 +62,7 @@ IniList setup_ext_list (setup_exts, setup_exts + (sizeof(setup_exts) / sizeof(*setup_exts))); static BoolOption NoVerifyOption (false, 'X', "no-verify", "Don't verify setup.ini signatures"); +static BoolOption NoVersionCheckOption (false, '\0', "no-version-check", "Suppress checking if a newer version of setup is available"); extern int yyparse (); @@ -401,7 +402,8 @@ do_ini_thread (HINSTANCE h, HWND owner) setup_version); if (ini_setup_version.size ()) { - if (version_compare (setup_version, ini_setup_version) < 0) + if ((version_compare (setup_version, ini_setup_version) < 0) + && !NoVersionCheckOption) note (owner, IDS_OLD_SETUP_VERSION, setup_version, ini_setup_version.c_str ()); } diff --git a/libsolv.cc b/libsolv.cc index 63942b2..955a1b2 100644 --- a/libsolv.cc +++ b/libsolv.cc @@ -209,6 +209,23 @@ SolvableVersion::sourcePackageName () const return std::string(pool_id2str(pool, spkg)); } +const std::string +SolvableVersion::Vendor () const +{ + if (!id) + return ""; + + // extract vendor + Solvable *solvable = pool_id2solvable(pool, id); + Id vendor = repo_lookup_id(solvable->repo, id, SOLVABLE_VENDOR); + + // has no such attribute + if (!vendor) + return ""; + + return std::string(pool_id2str(pool, vendor)); +} + SolvableVersion SolvableVersion::sourcePackage () const { diff --git a/libsolv.h b/libsolv.h index c218ab8..f394e65 100644 --- a/libsolv.h +++ b/libsolv.h @@ -73,6 +73,7 @@ class SolvableVersion SolvableVersion sourcePackage () const; // where this package archive can be obtained from packagesource *source() const; + const std::string Vendor () const; // fixup spkg_id void fixup_spkg_id(SolvableVersion spkg_id) const; diff --git a/main.cc b/main.cc index 9ca3f25..1374fb6 100644 --- a/main.cc +++ b/main.cc @@ -343,12 +343,16 @@ WinMain (HINSTANCE h, if (ShellExecuteEx(&sei)) { + DWORD exitcode = 0; /* Wait until child process is finished. */ if (WaitOption && sei.hProcess != NULL) - WaitForSingleObject (sei.hProcess, INFINITE); + if (!WaitForSingleObject (sei.hProcess, INFINITE)) + GetExitCodeProcess (sei.hProcess, &exitcode); + Logger ().setExitMsg (IDS_ELEVATED); + Logger ().exit (exitcode, false); } - Logger ().setExitMsg (IDS_ELEVATED); - Logger ().exit (0, false); + Log (LOG_PLAIN) << "Starting elevated child process failed" << endLog; + Logger ().exit (1, false); } else { diff --git a/netio.cc b/netio.cc index 9eb1e91..631532a 100644 --- a/netio.cc +++ b/netio.cc @@ -219,8 +219,6 @@ NetIO::get_ftp_auth (HWND owner) delete[] net_ftp_passwd; net_ftp_passwd = NULL; } - if (!ftp_auth) - return IDCANCEL; user = &net_ftp_user; passwd = &net_ftp_passwd; return auth_common (hinstance, IDD_FTP_AUTH, owner); diff --git a/netio.h b/netio.h index 6d0f044..f2ecfdd 100644 --- a/netio.h +++ b/netio.h @@ -24,8 +24,6 @@ class NetIO { protected: - BOOL ftp_auth; - static char *net_user; static char *net_passwd; static char *net_proxy_user; @@ -38,6 +36,7 @@ public: /* if nonzero, this is the estimated total file size */ int file_size; + NetIO () : file_size(0) {}; virtual ~ NetIO () {}; /* The user calls this function to create a suitable accessor for diff --git a/package_db.cc b/package_db.cc index 2c4757c..b74aafd 100644 --- a/package_db.cc +++ b/package_db.cc @@ -71,8 +71,6 @@ packagedb::read () { if (!installeddbread) { - solver.internalize(); - /* Read in the local installation database. */ io_stream *db = 0; db = io_stream::open ("cygfile:///etc/setup/installed.db", "rt", 0); @@ -247,11 +245,8 @@ packagedb::addBinary (const std::string &pkgname, packages.insert (packagedb::packagecollection::value_type(pkgname, pkg)); } - /* Create the SolvableVersion */ - SolvableVersion sv = solver.addPackage(pkgname, pkgdata); - - /* Register it in packagemeta */ - pkg->add_version (sv, pkgdata); + /* Create the SolvableVersion and register it in packagemeta */ + pkg->add_version (pkgdata); return pkg; } @@ -268,11 +263,8 @@ packagedb::addSource (const std::string &pkgname, sourcePackages.insert (packagedb::packagecollection::value_type(pkgname, pkg)); } - /* Create the SolvableVersion */ - SolvableVersion sv = solver.addPackage(pkgname, pkgdata); - - /* Register it in packagemeta */ - pkg->add_version (sv, pkgdata); + /* Create the SolvableVersion and register it in packagemeta */ + SolvableVersion sv = pkg->add_version (pkgdata); return sv; } diff --git a/package_meta.cc b/package_meta.cc index 7f8110d..f765baf 100644 --- a/package_meta.cc +++ b/package_meta.cc @@ -123,11 +123,26 @@ packagemeta::~packagemeta() versions.clear (); } -void -packagemeta::add_version (packageversion & thepkg, const SolverPool::addPackageData &pkgdata) +SolvableVersion +packagemeta::add_version (const SolverPool::addPackageData &inpkgdata) { + SolverPool::addPackageData pkgdata = inpkgdata; + + packageversion *v = NULL; + switch (pkgdata.stability) + { + case TRUST_CURR: + v = &(this->curr); + break; + case TRUST_TEST: + v = &(this->exp); + break; + default: + break; + } + /* - If a packageversion for the same version number is already present,allow + If a packageversion for the same version number is already present, allow this version to replace it. There is a problem where multiple repos provide a package. It's never been @@ -137,12 +152,52 @@ packagemeta::add_version (packageversion & thepkg, const SolverPool::addPackageD We rely on this by adding packages from installed.db last. */ - set ::iterator i = versions.find(thepkg); - if (i != versions.end()) + for (set ::iterator i = versions.begin(); + i != versions.end(); + i++) { + if (i->Canonical_version() != pkgdata.version) + continue; + + if (pkgdata.vendor == i->Vendor()) + { + /* Merge the site-list from any existing packageversion with the same + repository 'release:' label */ + pkgdata.archive.sites.insert(pkgdata.archive.sites.end(), + i->source()->sites.begin(), + i->source()->sites.end()); + + /* Installed packages do not supersede repo packages */ + if (pkgdata.reponame != "_installed") + { + /* Ensure a stability level doesn't point to a version we're about + to remove */ + if (v && (*v == *i)) + *v = packageversion(); + + i->remove(); + } + } + else + { + /* Otherwise... if we had a way to set repo priorities, that could be + used to control which packageversion the solver picks. For the + moment, just warn that you might not be getting what you think you + should... */ + Log (LOG_PLAIN) << "Version " << pkgdata.version << " of package " << + name << " is present in releases labelled " << pkgdata.vendor << + " and " << i->Vendor() << endLog; + } + versions.erase(i); + + break; } + /* Create the SolvableVersion */ + packagedb db; + SolvableVersion thepkg = db.solver.addPackage(name, pkgdata); + /* Add the version */ std::pair::iterator, bool> result = versions.insert (thepkg); @@ -154,21 +209,6 @@ packagemeta::add_version (packageversion & thepkg, const SolverPool::addPackageD #endif /* Record the highest version at a given stability level */ - /* (This has to be written somewhat carefully as attributes aren't - internalized yet so we can't look at them) */ - packageversion *v = NULL; - switch (pkgdata.stability) - { - case TRUST_CURR: - v = &(this->curr); - break; - case TRUST_TEST: - v = &(this->exp); - break; - default: - break; - } - if (v) { /* Any version is always greater than no version */ @@ -186,6 +226,8 @@ packagemeta::add_version (packageversion & thepkg, const SolverPool::addPackageD *v = thepkg; } } + + return thepkg; } bool diff --git a/package_meta.h b/package_meta.h index 600a163..8db10e2 100644 --- a/package_meta.h +++ b/package_meta.h @@ -43,7 +43,7 @@ public: ~packagemeta (); - void add_version (packageversion &, const SolverPool::addPackageData &); + SolvableVersion add_version (const SolverPool::addPackageData &); void set_installed_version (const std::string &); void addToCategoryBase(); bool hasNoCategories() const; diff --git a/prereq.cc b/prereq.cc index 033f654..a9aab21 100644 --- a/prereq.cc +++ b/prereq.cc @@ -70,6 +70,14 @@ PrereqPage::OnActivate() PrereqChecker p; p.getUnmetString (s); Log (LOG_PLAIN) << s << endLog; + + // convert to CRLF line endings for Windows text box + size_t pos = 0; + while ((pos = s.find("\n", pos)) != std::string::npos) + { + s.replace(pos, 1, "\r\n"); + pos += 2; + } SetDlgItemText (GetHWND (), IDC_PREREQ_EDIT, s.c_str ()); SetFocus (GetDlgItem (IDC_PREREQ_CHECK)); @@ -189,14 +197,6 @@ PrereqChecker::getUnmetString (std::string &s) { packagedb db; s = db.solution.report(); - - // - size_t pos = 0; - while ((pos = s.find("\n", pos)) != std::string::npos) - { - s.replace(pos, 1, "\r\n"); - pos += 2; - } } // ---------------------------------------------------------------------------