diff --git a/source/app.d b/source/app.d index ba27cc3..65defb6 100644 --- a/source/app.d +++ b/source/app.d @@ -60,8 +60,8 @@ string arch; bool rdmd = false; bool print_platform, print_builds, print_configs; - bool install_system = false, install_local = false; - string install_version; + bool place_system_wide = false, place_locally = false; + string retrieved_version; string[] registry_urls; string[] debug_versions; string root_path = getcwd(); @@ -82,9 +82,9 @@ "print-builds", &print_builds, "print-configs", &print_configs, "print-platform", &print_platform, - "system", &install_system, - "local", &install_local, - "version", &install_version, + "system", &place_system_wide, + "local", &place_locally, + "version", &retrieved_version, "registry", ®istry_urls, "root", &root_path ); @@ -164,6 +164,11 @@ if (!loadCwdPackage(pack)) return false; if (!build_config.length) build_config = def_config; return true; + } + + static void warnRenamed(string prev, string curr) + { + logWarn("Command '%s' was renamed to '%s'. Old name is deprecated, please update your scripts", prev, curr); } // handle the command @@ -186,50 +191,65 @@ dub.update(UpdateOptions.Upgrade | (annotate ? UpdateOptions.JustAnnotate : UpdateOptions.None)); return 0; case "install": + warnRenamed(cmd, "fetch"); + goto case "fetch"; + case "fetch": enforce(args.length >= 2, "Missing package name."); - auto location = InstallLocation.userWide; + auto location = PlacementLocation.userWide; auto name = args[1]; - enforce(!install_local || !install_system, "Cannot install locally and system wide at the same time."); - if (install_local) location = InstallLocation.local; - else if (install_system) location = InstallLocation.systemWide; - if (install_version.length) dub.install(name, Dependency(install_version), location, true); + enforce(!place_locally || !place_system_wide, "Cannot place package locally and system wide at the same time."); + if (place_locally) location = PlacementLocation.local; + else if (place_system_wide) location = PlacementLocation.systemWide; + if (retrieved_version.length) dub.get(name, Dependency(retrieved_version), location, true); else { - try dub.install(name, Dependency(">=0.0.0"), location, true); + try { + dub.get(name, Dependency(">=0.0.0"), location, true); + logInfo( + "Please note that you need to use `dub run ` " ~ + "or add it to dependencies of your package to actually use/run it. " ~ + "dub does not do actual installation of packages outside of its own ecosystem."); + } catch(Exception e){ - logInfo("Installing a release version failed: %s", e.msg); + logInfo("Getting a release version failed: %s", e.msg); logInfo("Retry with ~master..."); - dub.install(name, Dependency("~master"), location, true); + dub.get(name, Dependency("~master"), location, true); } } break; case "uninstall": + warnRenamed(cmd, "remove"); + goto case "remove"; + case "remove": enforce(args.length >= 2, "Missing package name."); - auto location = InstallLocation.userWide; + auto location = PlacementLocation.userWide; auto package_id = args[1]; - enforce(!install_local || !install_system, "Cannot install locally and system wide at the same time."); - if( install_local ) location = InstallLocation.local; - else if( install_system ) location = InstallLocation.systemWide; - try dub.uninstall(package_id, install_version, location); - catch logError("Please specify a individual version or use the wildcard identifier '%s' (without quotes).", Dub.UninstallVersionWildcard); + enforce(!place_locally || !place_system_wide, "Cannot place package locally and system wide at the same time."); + if ( place_locally ) location = PlacementLocation.local; + else if( place_system_wide ) location = PlacementLocation.systemWide; + try dub.remove(package_id, retrieved_version, location); + catch logError("Please specify a individual version or use the wildcard identifier '%s' (without quotes).", Dub.RemoveVersionWildcard); break; case "add-local": enforce(args.length >= 3, "Missing arguments."); - dub.addLocalPackage(args[1], args[2], install_system); + dub.addLocalPackage(args[1], args[2], place_system_wide); break; case "remove-local": enforce(args.length >= 2, "Missing path to package."); - dub.removeLocalPackage(args[1], install_system); + dub.removeLocalPackage(args[1], place_system_wide); break; case "add-path": enforce(args.length >= 2, "Missing search path."); - dub.addSearchPath(args[1], install_system); + dub.addSearchPath(args[1], place_system_wide); break; case "remove-path": enforce(args.length >= 2, "Missing search path."); - dub.removeSearchPath(args[1], install_system); + dub.removeSearchPath(args[1], place_system_wide); break; case "list-installed": - logInfo("Installed packages:"); + warnRenamed(cmd, "list"); + goto case "list"; + case "list": + logInfo("Packages present in the system and known to dub:"); foreach (p; dub.packageManager.getPackageIterator()) logInfo(" %s %s: %s", p.name, p.ver, p.path.toNativeString()); logInfo(""); @@ -311,34 +331,38 @@ private void showHelp(string command) { - if(command == "uninstall" || command == "install") { + if(command == "remove" || command == "fetch") { logInfo( -`Usage: dub [] +`Usage: dub [] Note: use dependencies (package.json) if you want to add a dependency, you - don't have to fiddle with installation stuff. + don't have to fiddle with caching stuff. -(Un)Installation of packages is only needed when you want to put packages to a +Explicit retrieval/removal of packages is only needed when you want to put packages to a place where several applications can share these. If you just have an dependency to a package, just add it to your package.json, dub will do the rest for you. -Without specified options, (un)installation will default to a user wide shared +Without specified options, placement/removal will default to a user wide shared location. -Complete applications can be installed and run easily by e.g. - dub install vibelog --local +Complete applications can be retrieved and run easily by e.g. + dub fetch vibelog --local cd vibelog dub This will grab all needed dependencies and compile and run the application. -Install options: +Note: dub does not do any real "installation" of packages, those are registered +only within dub internal ecosystem. Generation of native system packages / installer +may be added later. + +Retrieval options: --version Use the specified version/branch instead of the latest - For the uninstall command, this may be a wildcard + For the remove command, this may be a wildcard string: "*", which will remove all packages from the specified location. - --system Install system wide instead of user local - --local Install as in a sub folder of the current directory + --system Put package into system wide dub cache instead of user local one + --local Put package to a sub folder of the current directory Note that system and local cannot be mixed. `); return; @@ -359,14 +383,14 @@ build [] Builds a package (uses the main package in the current working directory by default) upgrade Forces an upgrade of all dependencies - install Manually installs a package. See 'dub help install'. - uninstall Uninstalls a package. See 'dub help uninstall'. + fetch Manually retrieves a package. See 'dub help fetch'. + remove Removes present package. See 'dub help remove'. add-local Adds a local package directory (e.g. a git repository) remove-local Removes a local package directory add-path Adds a default package search path remove-path Removes a package search path - list-installed Prints a list of all installed packages + list Prints a list of all present packages dub is aware of generate [] Generates project files using the specified generator: visuald, visuald-combined, mono-d, build, rdmd @@ -374,7 +398,7 @@ dependencies General options: - --annotate Do not execute dependency installations, just print + --annotate Do not execute dependency retrieval, just print -v --verbose Also output debug messages --vverbose Also output trace messages (produces a lot of output) -q --quiet Only output warnings and errors @@ -407,10 +431,10 @@ --debug=NAME Define the specified debug version identifier when building - can be used multiple times -Install options: +Retrieval options: --version Use the specified version/branch instead of the latest - --system Install system wide instead of user local - --local Install as in a sub folder of the current directory + --system Put package into system wide dub cache instead of user local one + --local Put packahe to a sub folder of the current directory `); logInfo("DUB version %s", dubVersion); diff --git a/source/dub/dub.d b/source/dub/dub.d index 997cdf1..6ae7027 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -132,7 +132,7 @@ string getDefaultConfiguration(BuildPlatform platform) const { return m_project.getDefaultConfiguration(platform); } - /// Performs installation and uninstallation as necessary for + /// Performs retrieval and removal as necessary for /// the application. /// @param options bit combination of UpdateOptions void update(UpdateOptions options) @@ -161,13 +161,13 @@ if (conflictedOrFailed || options & UpdateOptions.JustAnnotate) return; - // Uninstall first - foreach(Action a; filter!((Action a) => a.type == Action.Type.uninstall)(actions)) { - assert(a.pack !is null, "No package specified for uninstall."); - uninstall(a.pack); + // Remove first + foreach(Action a; filter!((Action a) => a.type == Action.Type.remove)(actions)) { + assert(a.pack !is null, "No package specified for removal."); + remove(a.pack); } - foreach(Action a; filter!((Action a) => a.type == Action.Type.install)(actions)) { - install(a.packageId, a.vers, a.location, (options & UpdateOptions.Upgrade) != 0); + foreach(Action a; filter!((Action a) => a.type == Action.Type.get)(actions)) { + get(a.packageId, a.vers, a.location, (options & UpdateOptions.Upgrade) != 0); // never update the same package more than once masterVersionUpgrades[a.packageId] = true; } @@ -197,11 +197,11 @@ } - /// Gets all installed packages as a "packageId" = "version" associative array - string[string] installedPackages() const { return m_project.installedPackagesIDs(); } + /// Returns all cached packages as a "packageId" = "version" associative array + string[string] cachedPackages() const { return m_project.cachedPackagesIDs(); } - /// Installs the package matching the dependency into the application. - Package install(string packageId, const Dependency dep, InstallLocation location, bool force_branch_upgrade) + /// Gets the package matching the dependency into the application. + Package get(string packageId, const Dependency dep, PlacementLocation location, bool force_branch_upgrade) { Json pinfo; PackageSupplier supplier; @@ -215,77 +215,77 @@ enforce(pinfo.type != Json.Type.Undefined, "No package "~packageId~" was found matching the dependency "~dep.toString()); string ver = pinfo["version"].get!string; - Path install_path; + Path placement; final switch (location) { - case InstallLocation.local: install_path = m_rootPath; break; - case InstallLocation.userWide: install_path = m_userDubPath ~ "packages/"; break; - case InstallLocation.systemWide: install_path = m_systemDubPath ~ "packages/"; break; + case PlacementLocation.local: placement = m_rootPath; break; + case PlacementLocation.userWide: placement = m_userDubPath ~ "packages/"; break; + case PlacementLocation.systemWide: placement = m_systemDubPath ~ "packages/"; break; } // always upgrade branch based versions - TODO: actually check if there is a new commit available - if (auto pack = m_packageManager.getPackage(packageId, ver, install_path)) { - if (!ver.startsWith("~") || !force_branch_upgrade || location == InstallLocation.local) { + if (auto pack = m_packageManager.getPackage(packageId, ver, placement)) { + if (!ver.startsWith("~") || !force_branch_upgrade || location == PlacementLocation.local) { // TODO: support git working trees by performing a "git pull" instead of this - logInfo("Package %s %s (%s) is already installed with the latest version, skipping upgrade.", - packageId, ver, install_path); + logInfo("Package %s %s (%s) is already present with the latest version, skipping upgrade.", + packageId, ver, placement); return pack; } else { - logInfo("Removing current installation of %s %s", packageId, ver); - m_packageManager.uninstall(pack); + logInfo("Removing present package of %s %s", packageId, ver); + m_packageManager.remove(pack); } } - logInfo("Downloading %s %s...", packageId, ver); + logInfo("Getting %s %s...", packageId, ver); logDiagnostic("Acquiring package zip file"); auto dload = m_projectPath ~ ".dub/temp/downloads"; auto tempfname = packageId ~ "-" ~ (ver.startsWith('~') ? ver[1 .. $] : ver) ~ ".zip"; auto tempFile = m_tempPath ~ tempfname; string sTempFile = tempFile.toNativeString(); - if(exists(sTempFile)) remove(sTempFile); + if (exists(sTempFile)) std.file.remove(sTempFile); supplier.retrievePackage(tempFile, packageId, dep); // Q: continue on fail? - scope(exit) remove(sTempFile); + scope(exit) std.file.remove(sTempFile); - logInfo("Installing %s %s to %s...", packageId, ver, install_path.toNativeString()); + logInfo("Placing %s %s to %s...", packageId, ver, placement.toNativeString()); auto clean_package_version = ver[ver.startsWith("~") ? 1 : 0 .. $]; - Path dstpath = install_path ~ (packageId ~ "-" ~ clean_package_version); + Path dstpath = placement ~ (packageId ~ "-" ~ clean_package_version); - return m_packageManager.install(tempFile, pinfo, dstpath); + return m_packageManager.get(tempFile, pinfo, dstpath); } - /// Uninstalls a given package from the list of installed modules. + /// Removes a given package from the list of present/cached modules. /// @removeFromApplication: if true, this will also remove an entry in the /// list of dependencies in the application's package.json - void uninstall(in Package pack) + void remove(in Package pack) { - logInfo("Uninstalling %s in %s", pack.name, pack.path.toNativeString()); - m_packageManager.uninstall(pack); + logInfo("Removing %s in %s", pack.name, pack.path.toNativeString()); + m_packageManager.remove(pack); } - /// @see uninstall(string, string, InstallLocation) - enum UninstallVersionWildcard = "*"; + /// @see remove(string, string, RemoveLocation) + enum RemoveVersionWildcard = "*"; - /// This will uninstall a given package with a specified version from the + /// This will remove a given package with a specified version from the /// location. /// It will remove at most one package, unless @param version_ is /// specified as wildcard "*". /// @param package_id Package to be removed /// @param version_ Identifying a version or a wild card. An empty string /// may be passed into. In this case the package will be removed from the - /// location, if there is only one version installed. This will throw an - /// exception, if there are multiple versions installed. + /// location, if there is only one version retrieved. This will throw an + /// exception, if there are multiple versions retrieved. /// Note: as wildcard string only "*" is supported. /// @param location_ - void uninstall(string package_id, string version_, InstallLocation location_) { + void remove(string package_id, string version_, PlacementLocation location_) { enforce(!package_id.empty); - if(location_ == InstallLocation.local) { - logInfo("To uninstall a locally installed package, make sure you don't have any data" + if (location_ == PlacementLocation.local) { + logInfo("To remove a locally placed package, make sure you don't have any data" ~ "\nleft in it's directory and then simply remove the whole directory."); return; } Package[] packages; - const bool wildcardOrEmpty = version_ == UninstallVersionWildcard || version_.empty; + const bool wildcardOrEmpty = version_ == RemoveVersionWildcard || version_.empty; // Use package manager foreach(pack; m_packageManager.getPackageIterator(package_id)) { @@ -295,25 +295,25 @@ } if(packages.empty) { - logError("Cannot find package to uninstall. (id:%s, version:%s, location:%s)", package_id, version_, location_); + logError("Cannot find package to remove. (id:%s, version:%s, location:%s)", package_id, version_, location_); return; } if(version_.empty && packages.length > 1) { - logError("Cannot uninstall package '%s', there multiple possibilities at location '%s'.", package_id, location_); - logError("Installed versions:"); + logError("Cannot remove package '%s', there multiple possibilities at location '%s'.", package_id, location_); + logError("Retrieved versions:"); foreach(pack; packages) logError(to!string(pack.vers())); - throw new Exception("Failed to uninstall package."); + throw new Exception("Failed to remove package."); } - logDebug("Uninstalling %s packages.", packages.length); + logDebug("Removing %s packages.", packages.length); foreach(pack; packages) { try { - uninstall(pack); - logInfo("Uninstalled %s, version %s.", package_id, pack.vers); + remove(pack); + logInfo("Removing %s, version %s.", package_id, pack.vers); } - catch logError("Failed to uninstall %s, version %s. Continuing with other packages (if any).", package_id, pack.vers); + catch logError("Failed to remove %s, version %s. Continuing with other packages (if any).", package_id, pack.vers); } } @@ -398,8 +398,8 @@ auto ddox_pack = m_packageManager.getBestPackage("ddox", ">=0.0.0"); if (!ddox_pack) ddox_pack = m_packageManager.getBestPackage("ddox", "~master"); if (!ddox_pack) { - logInfo("DDOX is not installed, performing user wide installation."); - ddox_pack = install("ddox", Dependency(">=0.0.0"), InstallLocation.userWide, false); + logInfo("DDOX is not present, getting it and storing user wide"); + ddox_pack = get("ddox", Dependency(">=0.0.0"), PlacementLocation.userWide, false); } version(Windows) auto ddox_exe = "ddox.exe"; diff --git a/source/dub/package_.d b/source/dub/package_.d index 01ebe3b..ba018f2 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -27,20 +27,20 @@ enum PackageJsonFilename = "package.json"; -/// Indicates where a package has been or should be installed to. -enum InstallLocation { - /// Packages installed with 'local' will be placed in the current folder +/// Indicates where a package has been or should be placed to. +enum PlacementLocation { + /// Packages retrived with 'local' will be placed in the current folder /// using the package name as destination. local, /// Packages with 'userWide' will be placed in a folder accessible by /// all of the applications from the current user. userWide, - /// Packages installed with 'systemWide' will be placed in a shared folder, + /// Packages retrieved with 'systemWide' will be placed in a shared folder, /// which can be accessed by all users of the system. systemWide } -/// Representing an installed package, usually constructed from a json object. +/// Representing a downloded / cached package, usually constructed from a json object. /// Documentation of the package.json can be found at /// http://registry.vibed.org/package-format class Package { @@ -336,7 +336,7 @@ } /// Specifying package information without any connection to a certain -/// installed package, like Package class is doing. +/// retrived package, like Package class is doing. struct PackageInfo { string name; string version_; diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index 10f8e91..4d6ecad 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -48,7 +48,7 @@ system } -/// The PackageManager can retrieve installed packages and install / uninstall +/// The PackageManager can retrieve present packages and get / remove /// packages. class PackageManager { private { @@ -183,19 +183,20 @@ return &iterator; } - /// Installs the package supplied as a path to it's zip file to the + /// Retrieves the package supplied as a path to it's zip file to the /// destination. - Package install(Path zip_file_path, Json package_info, Path destination) + // FIXNAME + Package get(Path zip_file_path, Json package_info, Path destination) { auto package_name = package_info.name.get!string(); auto package_version = package_info["version"].get!string(); auto clean_package_version = package_version[package_version.startsWith("~") ? 1 : 0 .. $]; - logDiagnostic("Installing package '%s' version '%s' to location '%s' from file '%s'", + logDiagnostic("Placing package '%s' version '%s' to location '%s' from file '%s'", package_name, package_version, destination.toNativeString(), zip_file_path.toNativeString()); if( existsFile(destination) ){ - throw new Exception(format("%s (%s) needs to be uninstalled from '%s' prior installation.", package_name, package_version, destination)); + throw new Exception(format("%s (%s) needs to be removed from '%s' prior placement.", package_name, package_version, destination)); } // open zip file @@ -207,7 +208,7 @@ archive = new ZipArchive(f.readAll()); } - logDebug("Installing from zip."); + logDebug("Extracting from zip."); // In a github zip, the actual contents are in a subfolder Path zip_prefix; @@ -228,7 +229,7 @@ return path[zip_prefix.length..path.length]; } - // install + // extract & place mkdirRecurse(destination.toNativeString()); auto journal = new Journal; logDiagnostic("Copying all files..."); @@ -262,12 +263,12 @@ writeJsonFile(destination~PackageJsonFilename, pi); // Write journal - logDebug("Saving installation journal..."); + logDebug("Saving retrieval action journal..."); journal.add(Journal.Entry(Journal.Type.RegularFile, Path(JournalJsonFilename))); journal.save(destination ~ JournalJsonFilename); if( existsFile(destination~PackageJsonFilename) ) - logInfo("%s has been installed with version %s", package_name, package_version); + logInfo("%s is present with version %s", package_name, package_version); auto pack = new Package(destination); @@ -276,11 +277,11 @@ return pack; } - /// Uninstalls the given the package. - void uninstall(in Package pack) + /// Removes the given the package. + void remove(in Package pack) { - logDebug("Uninstall %s, version %s, path '%s'", pack.name, pack.vers, pack.path); - enforce(!pack.path.empty, "Cannot uninstall package "~pack.name~" without a path."); + logDebug("Remove %s, version %s, path '%s'", pack.name, pack.vers, pack.path); + enforce(!pack.path.empty, "Cannot remove package "~pack.name~" without a path."); // remove package from repositories' list bool found = false; @@ -306,13 +307,13 @@ } } } - enforce(found, "Cannot uninstall, package not found: '"~ pack.name ~"', path: " ~ to!string(pack.path)); + enforce(found, "Cannot remove, package not found: '"~ pack.name ~"', path: " ~ to!string(pack.path)); // delete package files physically logDebug("Looking up journal"); auto journalFile = pack.path~JournalJsonFilename; if( !existsFile(journalFile) ) - throw new Exception("Uninstall failed, no installation journal found for '"~pack.name~"'. Please uninstall manually."); + throw new Exception("Removal failed, no retrieval journal found for '"~pack.name~"'. Please remove manually."); auto packagePath = pack.path; auto journal = new Journal(journalFile); @@ -321,7 +322,7 @@ logDebug("Deleting file '%s'", e.relFilename); auto absFile = pack.path~e.relFilename; if(!existsFile(absFile)) { - logWarn("Previously installed file not found for uninstalling: '%s'", absFile); + logWarn("Previously retrieved file not found for removal: '%s'", absFile); continue; } @@ -355,7 +356,7 @@ throw new Exception("Alien files found in '"~pack.path.toNativeString()~"', needs to be deleted manually."); rmdir(pack.path.toNativeString()); - logInfo("Uninstalled package: '"~pack.name~"'"); + logInfo("Removed package: '"~pack.name~"'"); } Package addLocalPackage(in Path path, in Version ver, LocalPackageType type) @@ -584,7 +585,7 @@ /** - Installation journal for later uninstallation, keeping track of installed + Retrieval journal for later removal, keeping track of placed files files. Example Json: { diff --git a/source/dub/project.d b/source/dub/project.d index 29d4851..5b71bf3 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -72,21 +72,21 @@ return "-Unrecognized application in '"~m_root.toNativeString()~"' (probably no package.json in this directory)"; string s = "-Application identifier: " ~ m_main.name; s ~= "\n" ~ m_main.generateInfoString(); - s ~= "\n-Installed dependencies:"; + s ~= "\n-Retrieved dependencies:"; foreach(p; m_dependencies) s ~= "\n" ~ p.generateInfoString(); return s; } - /// Gets all installed packages as a "packageId" = "version" associative array - @property string[string] installedPackagesIDs() const { + /// Gets all retrieved packages as a "packageId" = "version" associative array + @property string[string] cachedPackagesIDs() const { string[string] pkgs; foreach(p; m_dependencies) pkgs[p.name] = p.vers; return pkgs; } - /// List of installed Packages + /// List of retrieved dependency Packages @property const(Package[]) dependencies() const { return m_dependencies; } /// Main package. @@ -464,39 +464,39 @@ return actions; } - // Gather installed - Package[string] installed; - installed[m_main.name] = m_main; + // Gather retrieved + Package[string] retrieved; + retrieved[m_main.name] = m_main; foreach(ref Package p; m_dependencies) { auto pbase = p.basePackage; - auto pexist = installed.get(pbase.name, null); + auto pexist = retrieved.get(pbase.name, null); if (pexist && pexist !is pbase){ logError("The same package is referenced in different paths:"); logError(" %s %s: %s", pexist.name, pexist.vers, pexist.path.toNativeString()); logError(" %s %s: %s", pbase.name, pbase.vers, pbase.path.toNativeString()); throw new Exception("Conflicting package multi-references."); } - installed[pbase.name] = pbase; + retrieved[pbase.name] = pbase; } - // Check against installed and add install actions + // Check against package list and add retrieval actions Action[] actions; int[string] upgradePackages; foreach( string pkg, d; graph.needed() ) { auto basepkg = pkg.getBasePackage(); - auto p = basepkg in installed; + auto p = basepkg in retrieved; // TODO: auto update to latest head revision if(!p || (!d.dependency.matches(p.vers) && !d.dependency.matches(Version.MASTER))) { - if(!p) logDiagnostic("Triggering installation of required package '"~basepkg~"', which is not installed."); - else logDiagnostic("Triggering installation of required package '"~basepkg~"', which doesn't match the required versionh. Required '%s', available '%s'.", d.dependency, p.vers); - actions ~= Action.install(basepkg, InstallLocation.userWide, d.dependency, d.packages); + if(!p) logDiagnostic("Triggering retrieval of required package '"~basepkg~"', which was not present."); + else logDiagnostic("Triggering retrieval of required package '"~basepkg~"', which doesn't match the required versionh. Required '%s', available '%s'.", d.dependency, p.vers); + actions ~= Action.get(basepkg, PlacementLocation.userWide, d.dependency, d.packages); } else { if( option & UpdateOptions.Upgrade ) { // Only add one upgrade action for each package. if(basepkg !in upgradePackages) { logDiagnostic("Required package '"~basepkg~"' found with version '"~p.vers~"', upgrading."); upgradePackages[basepkg] = 1; - actions ~= Action.install(basepkg, InstallLocation.userWide, d.dependency, d.packages); + actions ~= Action.get(basepkg, PlacementLocation.userWide, d.dependency, d.packages); } } else { @@ -567,12 +567,12 @@ // TODO: auto update and update interval by time logDebug("Adding package to graph: "~pkg); Package p = m_packageManager.getBestPackage(pkg, reqDep.dependency); - if( p ) logDebug("Found installed package %s %s", pkg, p.ver); + if( p ) logDebug("Found present package %s %s", pkg, p.ver); // Don't bother with not available optional packages. if( !p && reqDep.dependency.optional ) continue; - // Try an already installed package first + // Try an already present package first if( p && needsUpToDateCheck(p) ){ logInfo("Triggering update of package %s", pkg); p = null; @@ -662,8 +662,8 @@ /// Actions to be performed by the dub struct Action { enum Type { - install, - uninstall, + get, + remove, conflict, failure } @@ -671,33 +671,33 @@ immutable { Type type; string packageId; - InstallLocation location; + PlacementLocation location; Dependency vers; } const Package pack; const Dependency[string] issuer; - static Action install(string pkg, InstallLocation location, in Dependency dep, Dependency[string] context) + static Action get(string pkg, PlacementLocation location, in Dependency dep, Dependency[string] context) { - return Action(Type.install, pkg, location, dep, context); + return Action(Type.get, pkg, location, dep, context); } - static Action uninstall(Package pkg, Dependency[string] context) + static Action remove(Package pkg, Dependency[string] context) { - return Action(Type.uninstall, pkg, context); + return Action(Type.remove, pkg, context); } static Action conflict(string pkg, in Dependency dep, Dependency[string] context) { - return Action(Type.conflict, pkg, InstallLocation.userWide, dep, context); + return Action(Type.conflict, pkg, PlacementLocation.userWide, dep, context); } static Action failure(string pkg, in Dependency dep, Dependency[string] context) { - return Action(Type.failure, pkg, InstallLocation.userWide, dep, context); + return Action(Type.failure, pkg, PlacementLocation.userWide, dep, context); } - private this(Type id, string pkg, InstallLocation location, in Dependency d, Dependency[string] issue) + private this(Type id, string pkg, PlacementLocation location, in Dependency d, Dependency[string] issue) { this.type = id; this.packageId = pkg;