From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77210 invoked by alias); 15 Mar 2018 21:02:40 -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 77189 invoked by uid 9795); 15 Mar 2018 21:02:39 -0000 Date: Thu, 15 Mar 2018 21:02:00 -0000 Message-ID: <20180315210239.77145.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.889-17-g5fa727e X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 9408563544dc3e8f17a1de13b33ea17aab630cd2 X-Git-Newrev: 5fa727e1cf705ad7564a9b3ee0b6f33c740970ab X-SW-Source: 2018-q1/txt/msg00052.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=5fa727e1cf705ad7564a9b3ee0b6f33c740970ab commit 5fa727e1cf705ad7564a9b3ee0b6f33c740970ab Author: Ken Brown Date: Sun Mar 11 10:43:06 2018 -0400 Make SolvableVersion::accessible() useful for local installs For local installs, we need SolvableVersion::accessible() indicate whether or not there is an archive available in the local cache. This is used in packagemeta::set_action() to prevent the chooser from offering unavailable versions for re-installation. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=972b2d9a1519183cfb697d1f2de1f071f15c9e02 commit 972b2d9a1519183cfb697d1f2de1f071f15c9e02 Author: Jon Turney Date: Wed Mar 14 14:52:57 2018 +0000 Remove packages not found by scan from solver Remove not-installed packages not found by scan from solver, as well as from packagemeta, to avoid solutions including them from being proposed. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=79438590ed53d2d6e34b939fdfbbc59dd7d25adb commit 79438590ed53d2d6e34b939fdfbbc59dd7d25adb Author: Jon Turney Date: Wed Mar 7 14:47:45 2018 +0000 Add a --version option Add a --version option, and make some related tweaks to output https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=e6433da618859ee351fb98c8cc2c240c482e6482 commit e6433da618859ee351fb98c8cc2c240c482e6482 Author: Jon Turney Date: Wed Mar 7 15:28:12 2018 +0000 Add conflicts: support https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=9c3e325621f42d5a1bbb84b5edf5f3d4b30726bd commit 9c3e325621f42d5a1bbb84b5edf5f3d4b30726bd Author: Jon Turney Date: Wed Mar 7 15:20:56 2018 +0000 Add provides: support Diff: --- .gitignore | 16 +++++++++----- IniDBBuilderPackage.cc | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ IniDBBuilderPackage.h | 5 ++++ choose.cc | 7 +---- inilex.ll | 4 +++ iniparse.yy | 24 ++++++++++++++++++---- libsolv.cc | 41 ++++++++++++++++++++++++++++----------- libsolv.h | 4 +++ main.cc | 21 +++++++++++++++---- package_db.cc | 4 +++ package_meta.cc | 30 ++++++++++++++-------------- package_meta.h | 2 +- splash.cc | 2 +- 13 files changed, 159 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index b5ae865..6241d8e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,19 @@ +.dirstamp +.libs aclocal.m4 +autoconf.h* autom4te.cache cfgaux +config.cache +config.status configure configure.lineno +libtool +Makefile Makefile.in -GNUmakefile -make.out -CVS -tags -TAGS -autoconf.h.in* +stamp-h1 + inilex.cc iniparse.cc iniparse.hh +setup_version.c diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc index 8fa6ad9..d560cb7 100644 --- a/IniDBBuilderPackage.cc +++ b/IniDBBuilderPackage.cc @@ -65,6 +65,22 @@ IniDBBuilderPackage::buildVersion (const std::string& aVersion) } } +const std::string +IniDBBuilderPackage::buildMinimumVersion (const std::string& minimum) +{ + if (version_compare(setup_version, minimum) < 0) + { + char min_vers[256]; + snprintf (min_vers, sizeof(min_vers), + "The current ini file requires at least version %s of setup.\n" + "Please download a newer version from http://www.cygwin.com/setup-%s.exe", + minimum.c_str(), + is_64bit ? "x86_64" : "x86"); + return min_vers; + } + return ""; +} + void IniDBBuilderPackage::buildPackage (const std::string& _name) { @@ -88,12 +104,16 @@ IniDBBuilderPackage::buildPackage (const std::string& _name) cbpv.spkg_id = packageversion(); cbpv.requires = NULL; cbpv.obsoletes = NULL; + cbpv.provides = NULL; + cbpv.conflicts = NULL; cbpv.archive = packagesource(); currentSpec = NULL; currentNodeList = NULL; dependsNodeList = PackageDepends(); obsoletesNodeList = PackageDepends(); + providesNodeList = PackageDepends(); + conflictsNodeList = PackageDepends(); #if DEBUG Log (LOG_BABBLE) << "Created package " << name << endLog; #endif @@ -161,6 +181,8 @@ IniDBBuilderPackage::buildPackageSource (const std::string& path, cspv.type = package_source; cspv.requires = NULL; cspv.obsoletes = NULL; + cspv.provides = NULL; + cspv.conflicts = NULL; /* set archive path, size, mirror, hash */ cspv.archive = packagesource(); @@ -243,6 +265,30 @@ IniDBBuilderPackage::buildBeginObsoletes () } void +IniDBBuilderPackage::buildBeginProvides () +{ +#if DEBUG + Log (LOG_BABBLE) << "Beginning of a provides statement" << endLog; +#endif + currentSpec = NULL; + providesNodeList = PackageDepends(); + currentNodeList = &providesNodeList; + cbpv.provides = &providesNodeList; +} + +void +IniDBBuilderPackage::buildBeginConflicts () +{ +#if DEBUG + Log (LOG_BABBLE) << "Beginning of a conflicts statement" << endLog; +#endif + currentSpec = NULL; + conflictsNodeList = PackageDepends(); + currentNodeList = &conflictsNodeList; + cbpv.conflicts = &conflictsNodeList; +} + +void IniDBBuilderPackage::buildSourceName (const std::string& _name) { // When there is a Source: line, that names a real source package @@ -341,4 +387,7 @@ IniDBBuilderPackage::process () cbpv.spkg = PackageSpecification(); cbpv.spkg_id = packageversion(); cbpv.archive = packagesource(); + obsoletesNodeList = PackageDepends(); + providesNodeList = PackageDepends(); + conflictsNodeList = PackageDepends(); } diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h index da2d97d..79a864e 100644 --- a/IniDBBuilderPackage.h +++ b/IniDBBuilderPackage.h @@ -37,6 +37,7 @@ public: void buildTimestamp (const std::string& ); void buildVersion (const std::string& ); + const std::string buildMinimumVersion(const std::string &); void buildPackage (const std::string& ); void buildPackageVersion (const std::string& ); void buildPackageSDesc (const std::string& ); @@ -52,6 +53,8 @@ public: void buildBeginDepends (); void buildBeginBuildDepends (); void buildBeginObsoletes (); + void buildBeginProvides (); + void buildBeginConflicts (); void buildMessage (const std::string&, const std::string&); void buildSourceName (const std::string& ); void buildSourceNameVersion (const std::string& ); @@ -82,6 +85,8 @@ private: PackageDepends *currentNodeList; PackageDepends dependsNodeList; PackageDepends obsoletesNodeList; + PackageDepends providesNodeList; + PackageDepends conflictsNodeList; SolverPool::addPackageData cbpv; std::set replace_versions; diff --git a/choose.cc b/choose.cc index 9cf3a50..5a4d3ad 100644 --- a/choose.cc +++ b/choose.cc @@ -137,11 +137,8 @@ ChooserPage::createListview () { SetBusy (); static std::vector empty_cat; - static Category dummy_cat (std::string ("No packages found."), empty_cat); - packagedb db; - packagedb::categoriesType::iterator it = db.categories.find("All"); - Category &cat = (it == db.categories.end ()) ? dummy_cat : *it; - chooser = new PickView (cat); + static Category dummy_cat (std::string ("All"), empty_cat); + chooser = new PickView (dummy_cat); RECT r = getDefaultListViewSize(); if (!chooser->Create(this, WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,&r)) throw new Exception (TOSTRING(__LINE__) " " __FILE__, diff --git a/inilex.ll b/inilex.ll index 95888cf..209152f 100644 --- a/inilex.ll +++ b/inilex.ll @@ -107,7 +107,9 @@ B64 [a-zA-Z0-9_-] "setup-timestamp:" return SETUP_TIMESTAMP; "setup-version:" return SETUP_VERSION; +"setup-minimum-version:" return SETUP_MINIMUM_VERSION; "arch:" return ARCH; + "release:" return RELEASE; "Package:" return PACKAGENAME; [vV]"ersion:" return PACKAGEVERSION; @@ -125,6 +127,8 @@ B64 [a-zA-Z0-9_-] [dD]"epends:" return DEPENDS; [dD]"epends2:" return DEPENDS; [oO]"bsoletes:" return OBSOLETES; +[pP]"rovides:" return PROVIDES; +[cC]"onflicts:" return CONFLICTS; ^{STR}":" ignore_line (); diff --git a/iniparse.yy b/iniparse.yy index 1999536..f85fe13 100644 --- a/iniparse.yy +++ b/iniparse.yy @@ -35,10 +35,21 @@ IniDBBuilderPackage *iniBuilder; extern int yylineno; %} -%token STRING -%token SETUP_TIMESTAMP SETUP_VERSION PACKAGEVERSION INSTALL SOURCE SDESC LDESC +%token STRING +%token SETUP_TIMESTAMP +%token SETUP_VERSION +%token SETUP_MINIMUM_VERSION +%token PACKAGEVERSION +%token INSTALL +%token SOURCE +%token SDESC +%token LDESC %token REPLACE_VERSIONS -%token CATEGORY DEPENDS REQUIRES +%token CATEGORY +%token DEPENDS +%token REQUIRES +%token PROVIDES +%token CONFLICTS %token T_PREV T_CURR T_TEST T_OTHER %token MD5 SHA512 %token SOURCEPACKAGE @@ -59,12 +70,13 @@ whole_file setup_headers: /* empty */ | setup_headers header ; - + header /* non-empty */ : SETUP_TIMESTAMP STRING { iniBuilder->buildTimestamp ($2); } NL | SETUP_VERSION STRING { iniBuilder->buildVersion ($2); } NL | RELEASE STRING { iniBuilder->set_release ($2); } NL - | ARCH STRING { iniBuilder->set_arch ($2); } NL + | ARCH STRING { iniBuilder->set_arch ($2); } NL + | SETUP_MINIMUM_VERSION STRING { std::string e = iniBuilder->buildMinimumVersion ($2); if (!e.empty()) { yyerror(e); } } NL ; packages: /* empty */ @@ -106,6 +118,8 @@ singleitem /* non-empty */ | REQUIRES { iniBuilder->buildBeginDepends(); } versionedpackagelistsp NL | BUILDDEPENDS { iniBuilder->buildBeginBuildDepends(); } versionedpackagelist NL | OBSOLETES { iniBuilder->buildBeginObsoletes(); } versionedpackagelist NL + | PROVIDES { iniBuilder->buildBeginProvides(); } versionedpackagelist NL + | CONFLICTS { iniBuilder->buildBeginConflicts(); } versionedpackagelist NL | REPLACE_VERSIONS versionlist NL | MESSAGE STRING STRING NL { iniBuilder->buildMessage ($2, $3); } diff --git a/libsolv.cc b/libsolv.cc index 0dc7557..2eb04e2 100644 --- a/libsolv.cc +++ b/libsolv.cc @@ -14,6 +14,7 @@ #include "libsolv.h" #include "package_db.h" #include "package_meta.h" +#include "resource.h" #include "solv/solver.h" #include "solv/solverdebug.h" @@ -242,18 +243,20 @@ SolvableVersion::source() const bool SolvableVersion::accessible () const { - // The 'accessible' check used to test if an archive was available locally or - // from a mirror. - // - // This seems utterly pointless. as binary packages which aren't 'accessible' - // never get to appear in the package list. - // - // For source packages, it's equivalent to the bool conversion operator.) + // empty packages are never accessible + if (id == 0) + return false; + + // If we're doing a local re-install, is there an archive available? // - if (id != 0) - return TRUE; - else - return FALSE; + // (This assumes that packagemeta::ScanDownloadedFiles() has already been + // called to check for presence in the package cache, which would have removed + // the version if not available, unless it is already installed) + if (::source == IDC_SOURCE_LOCALDIR) + return source ()->Cached (); + + // Otherwise, package is (presumably) retrievable + return true; } package_stability_t @@ -304,6 +307,16 @@ SolvableVersion::compareVersions(const SolvableVersion &a, return pool_evrcmp(pool, evra, evrb, EVRCMP_COMPARE); } +void +SolvableVersion::remove() const +{ + if (!id) + return; + + Solvable *solvable = pool_id2solvable(pool, id); + repo_free_solvable(solvable->repo, id, 0); +} + // --------------------------------------------------------------------------- // implements class SolverPool // @@ -438,8 +451,10 @@ SolverPool::addPackage(const std::string& pkgname, const addPackageData &pkgdata solvable->arch = (pkgdata.type == package_binary) ? ARCH_ANY : ARCH_SRC; solvable->evr = pool_str2id(repo->pool, pkgdata.version.c_str(), 1); solvable->vendor = pool_str2id(repo->pool, pkgdata.vendor.c_str(), 1); + if (pkgdata.provides) + solvable->provides = makedeps(repo, pkgdata.provides); /* in the absence of specific provides, we provide what we obsolete */ - if (pkgdata.obsoletes) + else if (pkgdata.obsoletes) solvable->provides = makedeps(repo, pkgdata.obsoletes); /* we always provide ourselves */ solvable->provides = repo_addid_dep(repo, solvable->provides, pool_rel2id(pool, solvable->name, solvable->evr, REL_EQ, 1), 0); @@ -447,6 +462,8 @@ SolverPool::addPackage(const std::string& pkgname, const addPackageData &pkgdata solvable->requires = makedeps(repo, pkgdata.requires); if (pkgdata.obsoletes) solvable->obsoletes = makedeps(repo, pkgdata.obsoletes); + if (pkgdata.conflicts) + solvable->conflicts = makedeps(repo, pkgdata.conflicts); /* a solvable can also store arbitrary attributes not needed for dependency resolution, if we need them */ diff --git a/libsolv.h b/libsolv.h index 6a6e0b3..7bb0be2 100644 --- a/libsolv.h +++ b/libsolv.h @@ -88,6 +88,8 @@ class SolvableVersion bool operator > (SolvableVersion const &) const; bool operator >= (SolvableVersion const &) const; + void remove() const; + private: Id id; Pool *pool; @@ -148,6 +150,8 @@ public: SolvableVersion spkg_id; PackageDepends *requires; PackageDepends *obsoletes; + PackageDepends *provides; + PackageDepends *conflicts; }; SolvableVersion addPackage(const std::string& pkgname, diff --git a/main.cc b/main.cc index 2e57f94..9ca3f25 100644 --- a/main.cc +++ b/main.cc @@ -94,6 +94,7 @@ static BoolOption PackageManagerOption (false, 'M', "package-manager", "Semi-att static BoolOption NoAdminOption (false, 'B', "no-admin", "Do not check for and enforce running as Administrator"); static BoolOption WaitOption (false, 'W', "wait", "When elevating, wait for elevated child process"); static BoolOption HelpOption (false, 'h', "help", "Print help"); +static BoolOption VersionOption (false, 'V', "version", "Show version"); static StringOption SetupBaseNameOpt ("setup", 'i', "ini-basename", "Use a different basename, e.g. \"foo\", instead of \"setup\"", false); BoolOption UnsupportedOption (false, '\0', "allow-unsupported-windows", "Allow old, unsupported Windows versions"); std::string SetupBaseName; @@ -262,7 +263,9 @@ WinMain (HINSTANCE h, unattended_mode = PackageManagerOption ? chooseronly : (UnattendedOption ? unattended : attended); - if (unattended_mode || help_option) + bool output_only = help_option || VersionOption; + + if (unattended_mode || output_only) set_cout (); SetupBaseName = SetupBaseNameOpt; @@ -273,7 +276,7 @@ WinMain (HINSTANCE h, supposed to elevate. */ nt_sec.initialiseWellKnownSIDs (); /* Check if we have to elevate. */ - bool elevate = !help_option && OSMajorVersion () >= 6 + bool elevate = !output_only && OSMajorVersion () >= 6 && !NoAdminOption && !nt_sec.isRunAsAdmin (); /* Start logging only if we don't elevate. Same for setting default @@ -281,8 +284,8 @@ WinMain (HINSTANCE h, LogSingleton::SetInstance (*LogFile::createLogFile ()); const char *sep = isdirsep (local_dir[local_dir.size () - 1]) ? "" : "\\"; - /* Don't create log files for help output only. */ - if (!elevate && !help_option) + /* Don't create log files for help or version output only. */ + if (!elevate && !output_only) { Logger ().setFile (LOG_BABBLE, local_dir + sep + "setup.log.full", false); @@ -294,7 +297,8 @@ WinMain (HINSTANCE h, if (help_option) { if (invalid_option) - Log (LOG_PLAIN) << "\nError during option processing." << endLog; + Log (LOG_PLAIN) << "\nError during option processing.\n" << endLog; + Log (LOG_PLAIN) << "Cygwin setup " << setup_version << endLog; Log (LOG_PLAIN) << "\nCommand Line Options:\n" << endLog; GetOption::GetInstance ().ParameterUsage (Log (LOG_PLAIN)); Log (LOG_PLAIN) << endLog; @@ -303,6 +307,13 @@ WinMain (HINSTANCE h, goto finish_up; } + if (VersionOption) + { + Log (LOG_PLAIN) << "Cygwin setup " << setup_version << endLog; + Logger ().exit (0, false); + goto finish_up; + } + /* Check if Cygwin works on this Windows version */ if (!UnsupportedOption && (OSMajorVersion () < 6)) { diff --git a/package_db.cc b/package_db.cc index 730cb78..072b419 100644 --- a/package_db.cc +++ b/package_db.cc @@ -134,6 +134,8 @@ packagedb::read () data.vendor = "cygwin"; data.requires = NULL; data.obsoletes = NULL; + data.provides = NULL; + data.conflicts = NULL; data.sdesc = ""; data.ldesc = ""; data.stability = TRUST_UNKNOWN; @@ -206,6 +208,8 @@ packagedb::makeBase() data.sdesc = "Ficitious package that requires all Base packages"; data.ldesc = "Ficitious package that requires all Base packages"; data.obsoletes = NULL; + data.provides = NULL; + data.conflicts = NULL; data.stability = TRUST_CURR; // data.spkg = PackageSpecification(); // data.spkg_id = packageversion(); diff --git a/package_meta.cc b/package_meta.cc index c488e35..7f8110d 100644 --- a/package_meta.cc +++ b/package_meta.cc @@ -664,33 +664,30 @@ packagemeta::logSelectionStatus() const } /* scan for local copies of package */ -void +bool packagemeta::scan (const packageversion &pkg, bool mirror_mode) { - /* Already have something */ + /* empty version */ if (!pkg) - return; + return false; - /* Remove mirror sites. - * FIXME: This is a bit of a hack. - */ try { if (!check_for_cached (*(pkg.source ()), NULL, mirror_mode, false) - && ::source == IDC_SOURCE_LOCALDIR) - pkg.source ()->sites.clear (); + && ::source == IDC_SOURCE_LOCALDIR) + return false; } catch (Exception * e) { // We can ignore these, since we're clearing the source list anyway if (e->errNo () == APPERR_CORRUPT_PACKAGE) - { - pkg.source ()->sites.clear (); - return; - } + return false; + // Unexpected exception. throw e; } + + return true; } void @@ -712,22 +709,25 @@ packagemeta::ScanDownloadedFiles (bool mirror_mode) && (*i != pkg.installed || pkg.installed == pkg.curr || pkg.installed == pkg.exp); - scan (*i, lazy_scan); + bool accessible = scan (*i, lazy_scan); packageversion foo = *i; packageversion pkgsrcver = foo.sourcePackage (); - scan (pkgsrcver, lazy_scan); + bool src_accessible = scan (pkgsrcver, lazy_scan); /* For local installs, if there is no src and no bin, the version * is unavailable */ - if (!i->accessible () && !pkgsrcver.accessible () + if (!accessible && !src_accessible && *i != pkg.installed) { if (pkg.curr == *i) pkg.curr = packageversion (); if (pkg.exp == *i) pkg.exp = packageversion (); + + i->remove(); pkg.versions.erase (i++); + /* For now, leave the source version alone */ } else diff --git a/package_meta.h b/package_meta.h index 32372e2..600a163 100644 --- a/package_meta.h +++ b/package_meta.h @@ -170,7 +170,7 @@ protected: private: std::string trustLabel(packageversion const &) const; std::vector