From 3ae542acffa62567d7f21b063d48cd124e864116 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 07:09:53 -0600 Subject: [PATCH 01/18] Refactor, put stuff in better place --- src/degasolv/cli.clj | 54 ++++++------------------------------ src/degasolv/pkgsys/core.clj | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 45 deletions(-) diff --git a/src/degasolv/cli.clj b/src/degasolv/cli.clj index 65804e3..f438b23 100644 --- a/src/degasolv/cli.clj +++ b/src/degasolv/cli.clj @@ -26,23 +26,6 @@ [this w] (tag/pr-tagged-record-on this w)) -(defn- read-card! - [card] - (let [card-data (tag/read-string (default-slurp card)) - vetted-card-data - (s/conform ::r/package card-data)] - (if (= vetted-card-data - ::s/invalid) - (throw (ex-info (str - "Invalid data in card file `" - card - "`: " - (s/explain ::r/package - card-data)) - (s/explain-data ::r/package - card-data))) - card-data))) - (defn aggregator [index-strat cmp] (cond @@ -63,36 +46,17 @@ "degasolv" {:genrepo degasolv-pkg/slurp-degasolv-repo :vercmp vers/maven-vercmp}}) -(defn- generate-repo-index! + + +(defn- generate-repo-index-cli! [options arguments] (let [{:keys [search-directory index-file - add-to]} options - output-file index-file - initial-repository - (if add-to - (tag/read-string - (default-slurp add-to)) - {})] - (default-spit - output-file - (into {} - (map - (fn [x] - [(first x) - (into [] - (sort #(- (vers/maven-vercmp (:version %1) - (:version %2))) - (second x)))]) - (reduce - (fn merg [c v] - (update-in c [(:id v)] conj v)) - initial-repository - (map - read-card! - (filter #(and (fs/file? %) - (= ".dscard" (fs/extension %))) - (file-seq (fs/file search-directory)))))))))) + add-to]} options] + (degasolv-pkg/generate-repo-index! + search-directory + index-file + add-to))) (defn exit [status msg] @@ -286,7 +250,7 @@ "Out file must not be empty."]]]} "generate-repo-index" {:description "Generate repository index based on degasolv package cards" - :function generate-repo-index! + :function generate-repo-index-cli! :cli [["-d" "--search-directory DIR" "Find degasolv cards here" :default "." :validate [#(and diff --git a/src/degasolv/pkgsys/core.clj b/src/degasolv/pkgsys/core.clj index 9353058..bdce5d4 100644 --- a/src/degasolv/pkgsys/core.clj +++ b/src/degasolv/pkgsys/core.clj @@ -3,8 +3,58 @@ [degasolv.util :refer :all] [clojure.spec :as s] [degasolv.resolver :as r :refer :all] + [serovers.core :as vers] + [me.raynes.fs :as fs] [miner.tagged :as tag])) +(defn- read-card! + [card] + (let [card-data (tag/read-string (default-slurp card)) + vetted-card-data + (s/conform ::r/package card-data)] + (if (= vetted-card-data + ::s/invalid) + (throw (ex-info (str + "Invalid data in card file `" + card + "`: " + (s/explain ::r/package + card-data)) + (s/explain-data ::r/package + card-data))) + card-data))) + +(defn generate-repo-index! + [search-directory + index-file + add-to] + (println "Honey, I'm home") + (let [output-file index-file + initial-repository + (if add-to + (tag/read-string + (default-slurp add-to)) + (hash-map))] + (default-spit + output-file + (into (hash-map) + (map + (fn [x] + [(first x) + (into [] + (sort #(- (vers/maven-vercmp (:version %1) + (:version %2))) + (second x)))]) + (reduce + (fn merg [c v] + (update-in c [(:id v)] conj v)) + initial-repository + (map + read-card! + (filter #(and (fs/file? %) + (= ".dscard" (fs/extension %))) + (file-seq (fs/file search-directory)))))))))) + (defn slurp-degasolv-repo [url] (let From aaa57a9fa04fe283469073cbba535d341c7e4f8a Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 07:11:10 -0600 Subject: [PATCH 02/18] An experiment I ran with --- artifactory-plugin/degasolv.groovy | 87 ++++++++++++++---------------- artifactory-plugin/run | 2 +- 2 files changed, 40 insertions(+), 49 deletions(-) diff --git a/artifactory-plugin/degasolv.groovy b/artifactory-plugin/degasolv.groovy index 08ffe35..1aa98c0 100644 --- a/artifactory-plugin/degasolv.groovy +++ b/artifactory-plugin/degasolv.groovy @@ -1,59 +1,50 @@ -// Plugins Lib Directory -// If your plugin requires any external dependencies, you can place them under -// the ${ARTIFACTORY_HOME}/etc/plugins/lib directory. -// -- https://www.jfrog.com/confluence/display/RTF/User+Plugins -// So, you need to put these there: -// https://mvnrepository.com/artifact/us.bpsm/edn-java/0.5.0 -// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3/3.6 -// https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-utils/3.0.24 -// https://mvnrepository.com/artifact/org.apache.maven/maven-artifact/3.5.0 -import us.bpsm.edn.parser.Parseable -import us.bpsm.edn.parser.Parser -import us.bpsm.edn.parser.Parsers -import us.bpsm.edn.TaggedValue -import static us.bpsm.edn.Keyword.newKeyword -import static us.bpsm.edn.parser.Parsers.defaultConfiguration; -import java.util.Map -import java.util.List -import java.util.HashMap -import java.util.ArrayList -import groovy.io.FileType -import us.bpsm.edn.printer.Printers + +import clojure.java.api.Clojure +import clojure.lang.IFn def recalculateIndex(dir) { + IFn require = Clojure.var("clojure.core", "require") + require.invoke(Clojure.read("degasolv.pkgsys.core")) + IFn generateRepoIndex = Clojure.var("degasolv.pkgsys.core", + "generate-repo-index!") + generateRepoIndex.invoke(dir, dir + "/index.dsrepo", null); +} - Map> repoInfo = - new HashMap>(); - - findDSCards = ~/\.dscard$/ - idKeyword = newKeyword("id") - - Parser p = Parsers.newParser(defaultConfiguration()) - baseDir = new File(dir); - baseDir.eachFileRecurse (FileType.FILES) { file -> - m = (file =~ findDSCards) - if (m.find()) { - String cardContents = file.getText('UTF-8') - println cardContents - Parseable pbr = Parsers.newParseable(cardContents) - t = p.nextValue(pbr) - Map m = t.getValue() - String id = m.get(idKeyword) - if (!repoInfo.containsKey(id)) { - repoInfo.put(id, new ArrayList()) +download { + /** + * Artifactory caches remote artifacts after initial download. By default, + * Artifactory doesn't recognize repodata.json as metadata that must be + * expired, rather than cached. + */ + beforeDownloadRequest { Request request, RepoPath repoPath -> + if (repositories.getRemoteRepositories().contains(repoPath.getRepoKey())) { + if (repoPath.getName().equalsIgnoreCase("index.dsrepo")) { + log.warn("Expiring repodata at " + repoPath) + expired = true } - lst = repoInfo.get(id) - lst.add(t) } } - // for each here that sorts each list using magics +} + - indexFile = new File('index.dsrepo') - indexFile.withWriter('UTF-8') { writer -> - writer.write(Printers.printString( - Printers.defaultPrinterProtocol(), - repoInfo)) + +/** + * Support for local repositories as conda channels. + */ +jobs { + /** + * Every 10 seconds, index all local repositories that have the "conda" property. + */ + indexPackages(delay: 0, interval: 10000) { + log.info("Executing indexPackages") + long start = System.currentTimeMillis() + for (RepoPath repo : getCondaRepos()) { + indexPackagesRecursive(repo) + } + long end = System.currentTimeMillis() + log.info("Took " + (end-start) + "ms to execute indexPackages") } } + recalculateIndex("./") diff --git a/artifactory-plugin/run b/artifactory-plugin/run index 2b2e4a9..57ba8ba 100755 --- a/artifactory-plugin/run +++ b/artifactory-plugin/run @@ -1,3 +1,3 @@ #!/bin/sh -groovy -cp commons-lang3-3.6.jar:edn-java-0.5.0.jar:maven-artifact-3.5.0.jar:plexus-utils-3.0.24.jar:edn-java-0.5.0.jar degasolv.groovy +groovy -cp degasolv-1.5.2-SNAPSHOT-standalone.jar degasolv2.groovy From fafdb7356abef54b17bb2dcd775930e7cbaaa7c0 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 07:18:57 -0600 Subject: [PATCH 03/18] Revert "An experiment I ran with" This reverts commit aaa57a9fa04fe283469073cbba535d341c7e4f8a. --- artifactory-plugin/degasolv.groovy | 87 ++++++++++++++++-------------- artifactory-plugin/run | 2 +- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/artifactory-plugin/degasolv.groovy b/artifactory-plugin/degasolv.groovy index 1aa98c0..08ffe35 100644 --- a/artifactory-plugin/degasolv.groovy +++ b/artifactory-plugin/degasolv.groovy @@ -1,50 +1,59 @@ - -import clojure.java.api.Clojure -import clojure.lang.IFn +// Plugins Lib Directory +// If your plugin requires any external dependencies, you can place them under +// the ${ARTIFACTORY_HOME}/etc/plugins/lib directory. +// -- https://www.jfrog.com/confluence/display/RTF/User+Plugins +// So, you need to put these there: +// https://mvnrepository.com/artifact/us.bpsm/edn-java/0.5.0 +// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3/3.6 +// https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-utils/3.0.24 +// https://mvnrepository.com/artifact/org.apache.maven/maven-artifact/3.5.0 +import us.bpsm.edn.parser.Parseable +import us.bpsm.edn.parser.Parser +import us.bpsm.edn.parser.Parsers +import us.bpsm.edn.TaggedValue +import static us.bpsm.edn.Keyword.newKeyword +import static us.bpsm.edn.parser.Parsers.defaultConfiguration; +import java.util.Map +import java.util.List +import java.util.HashMap +import java.util.ArrayList +import groovy.io.FileType +import us.bpsm.edn.printer.Printers def recalculateIndex(dir) { - IFn require = Clojure.var("clojure.core", "require") - require.invoke(Clojure.read("degasolv.pkgsys.core")) - IFn generateRepoIndex = Clojure.var("degasolv.pkgsys.core", - "generate-repo-index!") - generateRepoIndex.invoke(dir, dir + "/index.dsrepo", null); -} -download { - /** - * Artifactory caches remote artifacts after initial download. By default, - * Artifactory doesn't recognize repodata.json as metadata that must be - * expired, rather than cached. - */ - beforeDownloadRequest { Request request, RepoPath repoPath -> - if (repositories.getRemoteRepositories().contains(repoPath.getRepoKey())) { - if (repoPath.getName().equalsIgnoreCase("index.dsrepo")) { - log.warn("Expiring repodata at " + repoPath) - expired = true + Map> repoInfo = + new HashMap>(); + + findDSCards = ~/\.dscard$/ + idKeyword = newKeyword("id") + + Parser p = Parsers.newParser(defaultConfiguration()) + baseDir = new File(dir); + baseDir.eachFileRecurse (FileType.FILES) { file -> + m = (file =~ findDSCards) + if (m.find()) { + String cardContents = file.getText('UTF-8') + println cardContents + Parseable pbr = Parsers.newParseable(cardContents) + t = p.nextValue(pbr) + Map m = t.getValue() + String id = m.get(idKeyword) + if (!repoInfo.containsKey(id)) { + repoInfo.put(id, new ArrayList()) } + lst = repoInfo.get(id) + lst.add(t) } } -} - + // for each here that sorts each list using magics - -/** - * Support for local repositories as conda channels. - */ -jobs { - /** - * Every 10 seconds, index all local repositories that have the "conda" property. - */ - indexPackages(delay: 0, interval: 10000) { - log.info("Executing indexPackages") - long start = System.currentTimeMillis() - for (RepoPath repo : getCondaRepos()) { - indexPackagesRecursive(repo) - } - long end = System.currentTimeMillis() - log.info("Took " + (end-start) + "ms to execute indexPackages") + indexFile = new File('index.dsrepo') + indexFile.withWriter('UTF-8') { writer -> + writer.write(Printers.printString( + Printers.defaultPrinterProtocol(), + repoInfo)) } } - recalculateIndex("./") diff --git a/artifactory-plugin/run b/artifactory-plugin/run index 57ba8ba..2b2e4a9 100755 --- a/artifactory-plugin/run +++ b/artifactory-plugin/run @@ -1,3 +1,3 @@ #!/bin/sh -groovy -cp degasolv-1.5.2-SNAPSHOT-standalone.jar degasolv2.groovy +groovy -cp commons-lang3-3.6.jar:edn-java-0.5.0.jar:maven-artifact-3.5.0.jar:plexus-utils-3.0.24.jar:edn-java-0.5.0.jar degasolv.groovy From 1b254afb2e9a6d5f232d8f25a41e9fa1f4122947 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 08:34:42 -0600 Subject: [PATCH 04/18] Degasolv.groovy plugin is getting very very close --- artifactory-plugin/degasolv.groovy | 66 +++++++++++++++++------------- artifactory-plugin/run | 2 +- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/artifactory-plugin/degasolv.groovy b/artifactory-plugin/degasolv.groovy index 08ffe35..84cb542 100644 --- a/artifactory-plugin/degasolv.groovy +++ b/artifactory-plugin/degasolv.groovy @@ -2,57 +2,65 @@ // If your plugin requires any external dependencies, you can place them under // the ${ARTIFACTORY_HOME}/etc/plugins/lib directory. // -- https://www.jfrog.com/confluence/display/RTF/User+Plugins -// So, you need to put these there: -// https://mvnrepository.com/artifact/us.bpsm/edn-java/0.5.0 -// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3/3.6 -// https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-utils/3.0.24 -// https://mvnrepository.com/artifact/org.apache.maven/maven-artifact/3.5.0 -import us.bpsm.edn.parser.Parseable -import us.bpsm.edn.parser.Parser -import us.bpsm.edn.parser.Parsers -import us.bpsm.edn.TaggedValue -import static us.bpsm.edn.Keyword.newKeyword -import static us.bpsm.edn.parser.Parsers.defaultConfiguration; +// So, you simply need to put the degasolv jar file there. + import java.util.Map import java.util.List import java.util.HashMap import java.util.ArrayList import groovy.io.FileType -import us.bpsm.edn.printer.Printers + +import clojure.java.api.Clojure +import clojure.lang.IFn +import degasolv.resolver.PackageInfo + +IFn require = Clojure.var("clojure.core", "require") +require.invoke(Clojure.read("miner.tagged")) +require.invoke(Clojure.read("serovers.core")) +require.invoke(Clojure.read("degasolv.resolver")) +require.invoke(Clojure.read("degasolv.util")) + +readString = Clojure.var("miner.tagged", "read-string") +verCmp = Clojure.var("serovers.core", "maven-vercmp") +prStr = Clojure.var("clojure.core", "pr-str") + +sortBy = { a, b -> + versKeyword = Clojure.read(":version") + return -(verCmp.invoke(a.get(versKeyword), b.get(versKeyword))) +} def recalculateIndex(dir) { - Map> repoInfo = - new HashMap>(); + Map> repoInfo = + new HashMap>() findDSCards = ~/\.dscard$/ - idKeyword = newKeyword("id") - Parser p = Parsers.newParser(defaultConfiguration()) baseDir = new File(dir); baseDir.eachFileRecurse (FileType.FILES) { file -> + println file m = (file =~ findDSCards) if (m.find()) { - String cardContents = file.getText('UTF-8') - println cardContents - Parseable pbr = Parsers.newParseable(cardContents) - t = p.nextValue(pbr) - Map m = t.getValue() - String id = m.get(idKeyword) - if (!repoInfo.containsKey(id)) { - repoInfo.put(id, new ArrayList()) + String cardContents = file.getText("UTF-8") + cardData = readString.invoke(cardContents) + cardID = cardData.get(Clojure.read(":id")) + + if (!repoInfo.containsKey(cardID)) { + repoInfo.put(cardID, new ArrayList()) } - lst = repoInfo.get(id) - lst.add(t) + lst = repoInfo.get(cardID) + lst.add(cardData) } } + repoInfo.each{k,v -> + v.sort(sortBy) + } + // for each here that sorts each list using magics indexFile = new File('index.dsrepo') indexFile.withWriter('UTF-8') { writer -> - writer.write(Printers.printString( - Printers.defaultPrinterProtocol(), - repoInfo)) + writer.write(prStr.invoke(repoInfo)) } } diff --git a/artifactory-plugin/run b/artifactory-plugin/run index 2b2e4a9..57ba8ba 100755 --- a/artifactory-plugin/run +++ b/artifactory-plugin/run @@ -1,3 +1,3 @@ #!/bin/sh -groovy -cp commons-lang3-3.6.jar:edn-java-0.5.0.jar:maven-artifact-3.5.0.jar:plexus-utils-3.0.24.jar:edn-java-0.5.0.jar degasolv.groovy +groovy -cp degasolv-1.5.2-SNAPSHOT-standalone.jar degasolv2.groovy From ecabab270774371225f9f0394778296cef02e8f7 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 08:35:00 -0600 Subject: [PATCH 05/18] Fix run script for artifactory plugin --- artifactory-plugin/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifactory-plugin/run b/artifactory-plugin/run index 57ba8ba..ec34074 100755 --- a/artifactory-plugin/run +++ b/artifactory-plugin/run @@ -1,3 +1,3 @@ #!/bin/sh -groovy -cp degasolv-1.5.2-SNAPSHOT-standalone.jar degasolv2.groovy +groovy -cp degasolv-1.5.2-SNAPSHOT-standalone.jar degasolv.groovy From b34d9ddc35b7f5594a92927150503de4b52482b1 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 08:35:55 -0600 Subject: [PATCH 06/18] whitespace, remove silly print statement --- src/degasolv/cli.clj | 20 ++++---------------- src/degasolv/pkgsys/core.clj | 1 - 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/degasolv/cli.clj b/src/degasolv/cli.clj index f438b23..3dc4c4c 100644 --- a/src/degasolv/cli.clj +++ b/src/degasolv/cli.clj @@ -14,18 +14,6 @@ [serovers.core :as vers]) (:gen-class)) -(defmethod - print-method - degasolv.resolver.VersionPredicate - [this w] - (tag/pr-tagged-record-on this w)) - -(defmethod - print-method - degasolv.resolver.Requirement - [this w] - (tag/pr-tagged-record-on this w)) - (defn aggregator [index-strat cmp] (cond @@ -516,10 +504,10 @@ (reduce merge (map - tag/read-string - (map - default-slurp - (:config-files global-options)))) + tag/read-string + (map + default-slurp + (:config-files global-options)))) (catch Exception e (binding [*out* *err*] (println "Warning: problem reading config files, they were not used:" diff --git a/src/degasolv/pkgsys/core.clj b/src/degasolv/pkgsys/core.clj index bdce5d4..be608cd 100644 --- a/src/degasolv/pkgsys/core.clj +++ b/src/degasolv/pkgsys/core.clj @@ -28,7 +28,6 @@ [search-directory index-file add-to] - (println "Honey, I'm home") (let [output-file index-file initial-repository (if add-to From 1251507fba3ba7443308e8fefa94765af295a2ae Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 14:17:49 -0600 Subject: [PATCH 07/18] Fix changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3139a0..700f359 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,5 +17,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Changed apt reop function from filtering a list to lookup in a map, increasing its speed -[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/1.6.0...HEAD -[1.6.0]: https://github.com/olivierlacan/keep-a-changelog/compare/1.5.1...1.6.0 +[Unreleased]: https://github.com/djhaskin987/degasolv/compare/1.6.0...HEAD +[1.6.0]: https://github.com/djhaskin987/degasolv/compare/1.5.1...1.6.0 From a4a8bf0bc0ec07a29d7753912f3a901cb926b790 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 14:18:21 -0600 Subject: [PATCH 08/18] Bump version number to 1.6.1-SNAPSHOT --- docs/conf.py | 2 +- project.clj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index f91066c..8b01047 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -60,7 +60,7 @@ # The short X.Y version. version = '1.6' # The full version, including alpha/beta/rc tags. -release = '1.6.0' +release = '1.6.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/project.clj b/project.clj index 30f9567..a56e5c3 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject degasolv/degasolv "1.6.0" +(defproject degasolv/degasolv "1.6.1-SNAPSHOT" :description "Dependency tracker with an eye toward building and shipping software." :url "http://github.com/djhaskin987/degasolv" :license {:name "Eclipse Public License" From 377949855960ae5f94f611f94bb5bc21f4a01e84 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 16:33:29 -0600 Subject: [PATCH 09/18] Make changelog part of the formal docs --- CHANGELOG.md | 21 --------------------- changelog.rst | 1 + docs/changelog.rst | 31 +++++++++++++++++++++++++++++++ docs/index.rst | 1 + 4 files changed, 33 insertions(+), 21 deletions(-) delete mode 100644 CHANGELOG.md create mode 120000 changelog.rst create mode 100644 docs/changelog.rst diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 700f359..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,21 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [1.6.0] -### Added -- Formatted docs better on the front page for PDF purposes -- Add ability to use any (long) option on the command line in display-config - -### Improved -- Memoized core Degasolv package system repository function (should - speed the resolver up a bit) -- Changed apt reop function from filtering a list to lookup in a map, - increasing its speed - -[Unreleased]: https://github.com/djhaskin987/degasolv/compare/1.6.0...HEAD -[1.6.0]: https://github.com/djhaskin987/degasolv/compare/1.5.1...1.6.0 diff --git a/changelog.rst b/changelog.rst new file mode 120000 index 0000000..6f0024c --- /dev/null +++ b/changelog.rst @@ -0,0 +1 @@ +docs/changelog.rst \ No newline at end of file diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 0000000..913dc55 --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1,31 @@ +Changelog +========= + +All notable changes to this project will be documented in this file. + +The format is based on `Keep a Changelog`_ +and this project adheres to `Semantic Versioning`_. + +.. _Semantic Versioning: http://semver.org/spec/v2.0.0.html +.. _Keep a Changelog: http://keepachangelog.com/en/1.0.0/ + +`Unreleased`_ +------------- + +`1.6.0`_ +-------- + +Added ++++++ +- Formatted docs better on the front page for PDF purposes +- Add ability to use any (long) option on the command line in display-config + +Improved +++++++++ +- Memoized core Degasolv package system repository function (should + speed the resolver up a bit) +- Changed apt reop function from filtering a list to lookup in a map, + increasing its speed + +.. _Unreleased: https://github.com/djhaskin987/degasolv/compare/1.6.0...HEAD +.. _1.6.0: https://github.com/djhaskin987/degasolv/compare/1.5.1...1.6.0 diff --git a/docs/index.rst b/docs/index.rst index 57dec5a..77bdf90 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,6 +9,7 @@ Degasolv Introduction A Longer Example Command Reference + Changelog Indices and tables ****************** From ae8d0891123182bea195aa2763858d68f98f19b7 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 18:43:58 -0600 Subject: [PATCH 10/18] IP complete on degasolv.groovy, except adding scheduled jobs and groups --- artifactory-plugin/degasolv.groovy | 121 ++++++++++++++++++++++++++--- 1 file changed, 109 insertions(+), 12 deletions(-) diff --git a/artifactory-plugin/degasolv.groovy b/artifactory-plugin/degasolv.groovy index 84cb542..2999791 100644 --- a/artifactory-plugin/degasolv.groovy +++ b/artifactory-plugin/degasolv.groovy @@ -3,11 +3,15 @@ // the ${ARTIFACTORY_HOME}/etc/plugins/lib directory. // -- https://www.jfrog.com/confluence/display/RTF/User+Plugins // So, you simply need to put the degasolv jar file there. +// This is why we call clojure from groovy: so that the user's only +// dependency is the degasolv jar itself. import java.util.Map import java.util.List import java.util.HashMap import java.util.ArrayList +import java.io.ByteArrayInputStream + import groovy.io.FileType import clojure.java.api.Clojure @@ -29,39 +33,132 @@ sortBy = { a, b -> return -(verCmp.invoke(a.get(versKeyword), b.get(versKeyword))) } -def recalculateIndex(dir) { +List getDirs(RepoPath dir) { + return repositories.getChildren(dir) + .findAll { finfo -> + finfo.isFolder() + } + .collect { finfo -> + finfo.getRepoPath() + } +} + +List getFiles(RepoPath dir) { + return repositories.getChildren(dir) + .findAll { finfo -> + !finfo.isFolder() + } + .collect { finfo -> + finfo.getRepoPath() + } +} + +//String getContent(file) { +// return file.getText("UTF-8") +//} + +String getContent(RepoPath p) { + return p.getContent() + .getInputStream() + .getText("UTF-8") +} + +Map> mergeRepoInfo( + Map> a, + Map> b) { + b.each{ k, v -> + if (!a.containsKey(k)) { + a.put(k, new ArrayList()) + } + lst = a.get(k) + lst.add(v) + } + return a +} + +def gatherRepoInfo(RepoPath dir) { Map> repoInfo = new HashMap>() findDSCards = ~/\.dscard$/ - baseDir = new File(dir); - baseDir.eachFileRecurse (FileType.FILES) { file -> - println file + getFiles(dir).each { file -> m = (file =~ findDSCards) if (m.find()) { - String cardContents = file.getText("UTF-8") + String cardContents = getContents(file) cardData = readString.invoke(cardContents) cardID = cardData.get(Clojure.read(":id")) + cardVersion = cardData.get(Clojure.read(":version")) + cardLocation = cardData.get(Clojure.read(":location")) if (!repoInfo.containsKey(cardID)) { repoInfo.put(cardID, new ArrayList()) } lst = repoInfo.get(cardID) lst.add(cardData) + + // maybe? + repositories.setProperty(file, "degasolv.id", cardID) + repositories.setProperty(file, "degasolv.version", cardVersion) + repositories.setProperty(file, "degasolv.location", cardLocation) } } - repoInfo.each{k,v -> - v.sort(sortBy) + getDirs(dir).each { cdir -> + gatherRepoInfo(cdir).each { subRepoInfo -> + repoInfo = mergeRepoInfo(repoInfo, subRepoInfo) + } } + return repoInfo +} + +def recalculateIndex(RepoPath dir) { + logger.info("Recalculating degasolv index `" + dir + "`.") - // for each here that sorts each list using magics + logger.info("Gathering repository info...") + repoInfo = gatherRepoInfo(dir) - indexFile = new File('index.dsrepo') - indexFile.withWriter('UTF-8') { writer -> - writer.write(prStr.invoke(repoInfo)) + logger.info("Done. Sorting repository info...") + repoInfo.each{ k, v -> + v.sort(sortBy) } + + logger.info("Done. Writing out ``index.dsrepo``...") + indexPathStr = dir.toPath() + indexPathStr += (path[-1] == "/" ? "" : "/") + indexPathStr += "index.dsrepo" + + indexAsStr = prStr.invoke(repoInfo) + indexStream = new ByteArrayInputStream(indexAsStr.getBytes("UTF-8")) + + indexPath = RepoPathFactory.create(indexPathStr) + repositories.deploy(indexPath, indexStream) + logger.info("Done recalculating degasolv index") } -recalculateIndex("./") + +name = "degasolv" +version = "1.6.0" +description = "Degasolv artifactory plugin for recalculating the ``index.dsrepo`` file." + +executions { + degasolvReindex (version:version, description:description, httpMethod: 'GET', users:[], groups:[], params:[:]) { params -> + if (! params.get("repo")) + { + logger.warning("The ``repo`` key was not given in ``params`` query value, refusing to recalculate an unspecified degasolv repository.") + } + else + { + repoLoc = params.get("repo") + repoPath = RepoPathFactory.create(repoLoc) + if (! repoPath) + { + logger.warning("The ``repo`` key was not valid in the ``params`` query value, refusing to recalculate an unspecified degasolv repository.") + } + else + { + recalculateIndex(repoPath) + } + } + } +} \ No newline at end of file From 98c5b6d1bd00c657d0f7630039341a00fe7cae55 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Sat, 1 Jul 2017 16:33:29 -0600 Subject: [PATCH 11/18] Make changelog part of the formal docs --- CHANGELOG.md | 21 --------------------- changelog.rst | 1 + docs/changelog.rst | 31 +++++++++++++++++++++++++++++++ docs/index.rst | 1 + 4 files changed, 33 insertions(+), 21 deletions(-) delete mode 100644 CHANGELOG.md create mode 120000 changelog.rst create mode 100644 docs/changelog.rst diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 700f359..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,21 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [1.6.0] -### Added -- Formatted docs better on the front page for PDF purposes -- Add ability to use any (long) option on the command line in display-config - -### Improved -- Memoized core Degasolv package system repository function (should - speed the resolver up a bit) -- Changed apt reop function from filtering a list to lookup in a map, - increasing its speed - -[Unreleased]: https://github.com/djhaskin987/degasolv/compare/1.6.0...HEAD -[1.6.0]: https://github.com/djhaskin987/degasolv/compare/1.5.1...1.6.0 diff --git a/changelog.rst b/changelog.rst new file mode 120000 index 0000000..6f0024c --- /dev/null +++ b/changelog.rst @@ -0,0 +1 @@ +docs/changelog.rst \ No newline at end of file diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 0000000..913dc55 --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1,31 @@ +Changelog +========= + +All notable changes to this project will be documented in this file. + +The format is based on `Keep a Changelog`_ +and this project adheres to `Semantic Versioning`_. + +.. _Semantic Versioning: http://semver.org/spec/v2.0.0.html +.. _Keep a Changelog: http://keepachangelog.com/en/1.0.0/ + +`Unreleased`_ +------------- + +`1.6.0`_ +-------- + +Added ++++++ +- Formatted docs better on the front page for PDF purposes +- Add ability to use any (long) option on the command line in display-config + +Improved +++++++++ +- Memoized core Degasolv package system repository function (should + speed the resolver up a bit) +- Changed apt reop function from filtering a list to lookup in a map, + increasing its speed + +.. _Unreleased: https://github.com/djhaskin987/degasolv/compare/1.6.0...HEAD +.. _1.6.0: https://github.com/djhaskin987/degasolv/compare/1.5.1...1.6.0 diff --git a/docs/index.rst b/docs/index.rst index 57dec5a..77bdf90 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,6 +9,7 @@ Degasolv Introduction A Longer Example Command Reference + Changelog Indices and tables ****************** From aa113ca10e98be61efa26c53eb461c8e7e41f8af Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Mon, 3 Jul 2017 08:20:15 -0600 Subject: [PATCH 12/18] Add option packs TODO --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index d26c108..dce47fe 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ - [ ] Add ``--remove-from`` +- [ ] Options imply other options, but these can be turned off - [ ] Make display-config work with ALL cmdline options. - [ ] Disable alternatives option - [ ] Add docs URL to help page. From 64be04a01d18fad573dd80e60524f362d09fd6bc Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Mon, 3 Jul 2017 14:19:37 -0600 Subject: [PATCH 13/18] Add option pack logic --- src/degasolv/cli.clj | 72 ++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 22 deletions(-) diff --git a/src/degasolv/cli.clj b/src/degasolv/cli.clj index 4098c85..a314c7d 100644 --- a/src/degasolv/cli.clj +++ b/src/degasolv/cli.clj @@ -469,8 +469,23 @@ "` key in the config file,") (str " or use `" small-arg "` or `" large-arg "` at the command line.")]))) +(def available-option-packs + { + "debian" + {:package-system + "apt"}}) + (def cli-options - [["-c" "--config-file FILE" "config file" + [["-k" "--option-pack PACK" "Specify option pack **" + :id :option-packs + :default [] + :validate [#(get option-packs %) + (str + "Must be one of: " + (string/join "," (keys option-packs)))] + :assoc-fn + (fn [m k v] (update-in m [k] #(conj % v)))] + ["-c" "--config-file FILE" "config file" :id :config-files :default [] :default-desc "./degasolv.edn" @@ -487,6 +502,24 @@ :else y)) a b)) +(defn get-config [configs] + (try + (reduce + merge + (map + tag/read-string + (map + default-slurp + configs))) + (catch Exception e + (binding [*out* *err*] + (println "Warning: problem reading config files, they were not used:" + (str (string/join + \newline + (map #(str " - " %) + configs))))) + (hash-map)))) + (defn -main [& args] (let [{:keys [options arguments errors summary]} (parse-opts args (concat @@ -561,28 +594,23 @@ "" (usage summary :sub-command subcommand) ""]))) - (let [config-files (if (empty? (:config-files global-options)) - [(fs/file (fs/expand-home "./degasolv.edn"))] - (:config-files global-options)) + (let [config-files + (if (empty? (:config-files global-options)) + [(fs/file (fs/expand-home "./degasolv.edn"))] + (:config-files global-options)) + config + (get-config config-files) + selected-option-packs + (if (empty? option-packs) + (into [] (:option-packs config)) + (:option-packs options)) effective-options - (merge - (try - (reduce - merge - (map - tag/read-string - (map - default-slurp - (:config-files global-options)))) - (catch Exception e - (binding [*out* *err*] - (println "Warning: problem reading config files, they were not used:" - (str (string/join - \newline - (map #(str " - " %) - (:config-files global-options)))))) - {})) - options) + (t/it-> + selected-option-packs + (mapv available-option-packs it) + (conj it (dissoc config :option-packs)) + (conj it options) + (reduce merge (hash-map) it)) required-keys (set (keys (:required-arguments subcmd-cli))) present-keys (set (keys effective-options))] (when (not (st/subset? required-keys present-keys)) From 01078a9042b27665f5a467c98d1ff6c6a854aa44 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Mon, 3 Jul 2017 16:32:21 -0600 Subject: [PATCH 14/18] Add option packs, fix problem between config file and default options --- src/degasolv/cli.clj | 54 ++++++++++++++---------- test/resources/scripts/test-option-packs | 19 +++++++++ 2 files changed, 51 insertions(+), 22 deletions(-) create mode 100755 test/resources/scripts/test-option-packs diff --git a/src/degasolv/cli.clj b/src/degasolv/cli.clj index a314c7d..1b2187e 100644 --- a/src/degasolv/cli.clj +++ b/src/degasolv/cli.clj @@ -249,13 +249,26 @@ explain-package results)))))) +(def subcommand-option-defaults + { + :card-file "./out.dscard" + :search-directory "." + :index-file "index.dsrepo" + :alternatives true + :conflict-strat "exclusive" + :resolve-strat "thorough" + :index-strat "priority" + :package-system "degasolv" + }) + (def subcommand-cli {"display-config" {:description "Print the effective combined configuration (and arguments) of all the given config files." :function display-config! } "generate-card" - {:description "Generate dscard file based on arguments given" + { + :description "Generate dscard file based on arguments given" :function generate-card! :required-arguments {:id ["-i" "--id"] :version ["-v" "--version"] @@ -284,21 +297,19 @@ (fn [m k v] (update-in m [k] #(conj % v)))] ["-C" "--card-file FILE" (str "The name of the card file") - :default "./out.dscard" + :validate [#(not (empty? %)) "Out file must not be empty."]]]} "generate-repo-index" {:description "Generate repository index based on degasolv package cards" :function generate-repo-index! :cli [["-d" "--search-directory DIR" "Find degasolv cards here" - :default "." :validate [#(and (fs/directory? %) (fs/exists? %)) "Must be a directory which exists on the file system."]] ["-I" "--index-file FILE" - "The name of the repo file" - :default "index.dsrepo"] + "The name of the repo file"] ["-a" "--add-to INDEX" "Add to repo index INDEX"]]} @@ -309,15 +320,11 @@ :requirements ["-r" "--requirement"]} :cli [ ["-a" "--enable-alternatives" "Consider all alternatives" - :id :alternatives - :default true - :assoc-fn (fn [m k v] (assoc m k true))] + :assoc-fn (fn [m k v] (assoc m :alternatives true))] ["-A" "--disable-alternatives" "Consider only first alternatives" - :id :alternatives - :assoc-fn (fn [m k v] (assoc m k false))] + :assoc-fn (fn [m k v] (assoc m :alternatives false))] ["-f" "--conflict-strat STRAT" "May be 'exclusive', 'inclusive' or 'prioritized'." - :default "exclusive" :validate [#(or (= "exclusive" %) (= "inclusive" %) (= "prioritized" %)) @@ -345,17 +352,14 @@ (fn [m k v] (update-in m [k] #(conj % v)))] ["-s" "--resolve-strat STRAT" "May be 'fast' or 'thorough'." - :default "thorough" :validate [#(or (= "thorough" %) (= "fast" %)) "Resolve strategy must either be 'thorough' or 'fast'."]] ["-S" "--index-strat STRAT" "May be 'priority' or 'global'." - :default "priority" :validate [#(or (= "priority" %) (= "global" %)) "Strategy must either be 'priority' or 'global'."]] ["-t" "--package-system SYS" "May be 'degasolv' or 'apt'." - :default "degasolv" :validate [#(or (= "degasolv" %) (= "apt" %)) "Package system must be either 'degasolv' or 'apt'."]] ]} @@ -378,12 +382,10 @@ (fn [m k v] (update-in m [k] #(conj % v)))] ["-S" "--index-strat STRAT" "May be 'priority' or 'global'." - :default "priority" :validate [#(or (= "priority" %) (= "global" %)) "Strategy must either be 'priority' or 'global'."]] ["-t" "--package-system SYS" "May be 'degasolv' or 'apt'." - :default "degasolv" :validate [#(or (= "degasolv" %) (= "apt" %)) "Package system must be either 'degasolv' or 'apt'."]]]}}) @@ -473,16 +475,19 @@ { "debian" {:package-system - "apt"}}) + "apt" + } + } + ) (def cli-options [["-k" "--option-pack PACK" "Specify option pack **" :id :option-packs :default [] - :validate [#(get option-packs %) + :validate [#(get available-option-packs %) (str "Must be one of: " - (string/join "," (keys option-packs)))] + (string/join "," (keys available-option-packs)))] :assoc-fn (fn [m k v] (update-in m [k] #(conj % v)))] ["-c" "--config-file FILE" "config file" @@ -600,17 +605,22 @@ (:config-files global-options)) config (get-config config-files) + cli-option-packs (:option-packs options) selected-option-packs - (if (empty? option-packs) + (if (empty? cli-option-packs) (into [] (:option-packs config)) - (:option-packs options)) + cli-option-packs) effective-options (t/it-> selected-option-packs (mapv available-option-packs it) + (into [subcommand-option-defaults] it) (conj it (dissoc config :option-packs)) (conj it options) - (reduce merge (hash-map) it)) + (t/spy :msg "this" it) + (reduce merge (hash-map) it) + (t/spy :msg "now" it) + ) required-keys (set (keys (:required-arguments subcmd-cli))) present-keys (set (keys effective-options))] (when (not (st/subset? required-keys present-keys)) diff --git a/test/resources/scripts/test-option-packs b/test/resources/scripts/test-option-packs new file mode 100755 index 0000000..19a1c95 --- /dev/null +++ b/test/resources/scripts/test-option-packs @@ -0,0 +1,19 @@ +#!/bin/sh + +set -ex + +root_path=${PWD} +test_home=test/resources/data/grill + +name=$(lein print :name | sed 's|"||g' ) +version=$(lein print :version | sed 's|"||g') + +cat > ${test_home}/test-option-packs.edn < Date: Mon, 3 Jul 2017 16:46:50 -0600 Subject: [PATCH 15/18] Update changelog --- docs/changelog.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 913dc55..7a9f888 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,6 +12,16 @@ and this project adheres to `Semantic Versioning`_. `Unreleased`_ ------------- +Added ++++++ +- Added ``--option-pack`, the ability to specify multiple options + +Fixed ++++++ +- Fixed how default options work, they no longer override stuff + found in the config file (ouch) + + `1.6.0`_ -------- From c45974984946e5bafa71f4fbe8191b37784e8cd3 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Tue, 4 Jul 2017 13:04:25 -0600 Subject: [PATCH 16/18] Fix option pack CLI --- src/degasolv/cli.clj | 22 ++++++++++++++-------- test/resources/scripts/test-option-packs | 14 ++++++++++++-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/degasolv/cli.clj b/src/degasolv/cli.clj index 1b2187e..1caeae9 100644 --- a/src/degasolv/cli.clj +++ b/src/degasolv/cli.clj @@ -473,12 +473,19 @@ (def available-option-packs { - "debian" - {:package-system - "apt" + "multi-version-mode" + { + :conflict-strat "inclusive" + :resolve-strat "fast" + :alternatives false + } + "firstfound-version-mode" + { + :conflict-strat "prioritized" + :resolve-strat "fast" + :alternatives false } - } - ) + }) (def cli-options [["-k" "--option-pack PACK" "Specify option pack **" @@ -519,7 +526,8 @@ (catch Exception e (binding [*out* *err*] (println "Warning: problem reading config files, they were not used:" - (str (string/join + (str "\n" + (string/join \newline (map #(str " - " %) configs))))) @@ -617,9 +625,7 @@ (into [subcommand-option-defaults] it) (conj it (dissoc config :option-packs)) (conj it options) - (t/spy :msg "this" it) (reduce merge (hash-map) it) - (t/spy :msg "now" it) ) required-keys (set (keys (:required-arguments subcmd-cli))) present-keys (set (keys effective-options))] diff --git a/test/resources/scripts/test-option-packs b/test/resources/scripts/test-option-packs index 19a1c95..76679fc 100755 --- a/test/resources/scripts/test-option-packs +++ b/test/resources/scripts/test-option-packs @@ -10,10 +10,20 @@ version=$(lein print :version | sed 's|"||g') cat > ${test_home}/test-option-packs.edn < Date: Thu, 6 Jul 2017 08:23:04 -0600 Subject: [PATCH 17/18] Doc touch-up pre-release --- docs/changelog.rst | 4 +-- docs/command-reference.rst | 56 ++++++++++++++++++++++++++------------ src/degasolv/cli.clj | 21 +++++++------- 3 files changed, 51 insertions(+), 30 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 7a9f888..a449873 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -14,13 +14,13 @@ and this project adheres to `Semantic Versioning`_. Added +++++ -- Added ``--option-pack`, the ability to specify multiple options +- Added ``--option-pack``, the ability to specify multiple options Fixed +++++ - Fixed how default options work, they no longer override stuff found in the config file (ouch) - +- Fixed output of printed warning when configuration file is not used `1.6.0`_ -------- diff --git a/docs/command-reference.rst b/docs/command-reference.rst index fd2683c..6ce685b 100644 --- a/docs/command-reference.rst +++ b/docs/command-reference.rst @@ -16,7 +16,8 @@ a page that looks something like this:: descriptions. Options marked with `**` may be used more than once. - -c, --config-file FILE ./degasolv.edn config file + -c, --config-file FILE ./degasolv.edn Config file location ** + -k, --option-pack PACK Specify option pack ** -h, --help Print this help page Commands are: @@ -54,17 +55,14 @@ Explanation of options: --config-file "$PWD/config.edn" \ generate-repo-index [...] - A few notable exceptions to this rule is the ``--repository`` and - ``--present-package`` options of the ``resolve-locations`` and ``query-repo`` - commands, and the ``--requirement`` option of the ``generate-card`` and - ``resolve-locations`` commands. This is because these options can be - specified multiple times, and so their configuration file key equivalents are - named ``:repositories``, ``:present-packages`` and ``:requirements`` - respectively, and they show up in the configuration file as a list of - strings. Finally, the ``--enable-alternatives`` and - ``--disable-alternatives`` options of the ``resolve-locations`` command map a - boolean value to the ``alternatives`` config file key. So, instead of using - this command:: + Notable exceptions to this rule include options which may be + specified multiple times. These options are named using singular + nouns (e.g. ``--repository REPO``), but their corresponding + configuration file keys are specified using plural nouns (e.g., + ``:repositories ["REPO1",...]``). + + So, instead of using this + command:: java -jar degasolv--standalone.jar \ resolve-locations \ @@ -103,7 +101,7 @@ Explanation of options: URL. As of version 1.2.0, the ``--config-file`` option may be specified multiple - times. Each config file specified will get its configuration + times. Each configuration file specified will get its configuration merged into the previously specified configuration files. If both configuration files contain the same option, the option specified in the latter specified configuration file will be used. @@ -165,6 +163,27 @@ Explanation of options: --config-file "./degasolv.edn" \ generate-card +.. _option pack: + +- ``-k PACK``, ``--option-pack PACK``, ``:option-packs ["PACK1",...]``: Specify + one or more option packs. + + Degasolv ships with several "option packs", each of which imply several degasolv + options at once. When an + option pack is specified, degasolv looks up which option pack is used and what + options are implied by using it. More than one option pack may be specified. + If option packs are specified both on the command line and in the config file, + the option packs on the command line are used and the ones in the config file + are ignored. + + The following option packs are supported in the current version: + - ``multi-version-mode``: Added as of version 1.7.0 . Implies + ``--conflict-strat inclusive``, + ``--resolve-strat fast``, and ``--disable-alternatives``. + - ``firstfound-version-mode``: Added as of version 1.7.0 . Implies + ``--conflic-strat prioritized``, + ``--resolve-strat fast``, and ``--disable-alternatives``. + - ``-h``, ``--help``: Prints the help page. This can be used on every sub-command as well. @@ -468,7 +487,8 @@ Explanation of options: of each package are allowed to be part of the solution. To call for similar behavior to ruby's gem or node's npm, for example, set ``--conflict-strat`` to ``inclusive`` and set ``--resolve-strat`` - to ``fast``. + to ``fast``. This can be easily and cleanly specified done by using the + ``multi-version-mode`` `option pack`_. - If set to ``prioritized``, then the first time a package is required and is found at a particular version, it will be considered to fulfill the @@ -485,8 +505,10 @@ Explanation of options: ``1`` and that version was assumed to fulfill all requirements asking for package ``b``. - To mimic the behavior of maven, set ``--conflict-strat`` to ``prioritized`` - and ``--resolve-strat`` to ``fast``. + To mimic the behavior of maven, set ``--conflict-strat`` to + ``prioritized`` and ``--resolve-strat`` to ``fast``. This can be + easily and cleanly specified done by using the + ``firstfound-version-mode`` `option pack`_. .. _present package: @@ -835,8 +857,6 @@ interpretations. | | the absence of the ``pine`` package. | +-------------------------+---------------------------------------------------+ - .. _maven: https://maven.apache.org/ - .. _managed dependency: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management diff --git a/src/degasolv/cli.clj b/src/degasolv/cli.clj index 1caeae9..9a80c96 100644 --- a/src/degasolv/cli.clj +++ b/src/degasolv/cli.clj @@ -488,16 +488,7 @@ }) (def cli-options - [["-k" "--option-pack PACK" "Specify option pack **" - :id :option-packs - :default [] - :validate [#(get available-option-packs %) - (str - "Must be one of: " - (string/join "," (keys available-option-packs)))] - :assoc-fn - (fn [m k v] (update-in m [k] #(conj % v)))] - ["-c" "--config-file FILE" "config file" + [["-c" "--config-file FILE" "Config file location **" :id :config-files :default [] :default-desc "./degasolv.edn" @@ -505,6 +496,16 @@ (fs/file? %)) "Must be a regular file (which hopefully contains config info."] :assoc-fn + (fn [m k v] (update-in m [k] #(conj % v)))] + ["-k" "--option-pack PACK" "Specify option pack **" + :id :option-packs + :default [] + :default-desc "" + :validate [#(get available-option-packs %) + (str + "Must be one of: " + (string/join "," (keys available-option-packs)))] + :assoc-fn (fn [m k v] (update-in m [k] #(conj % v)))]]) (defn- deep-merge [a b] From c7dc3938a11517e1e021fdf59ecee9be9e06fc30 Mon Sep 17 00:00:00 2001 From: Daniel Haskin Date: Thu, 6 Jul 2017 08:35:23 -0600 Subject: [PATCH 18/18] Bump version number to 1.7.0 --- docs/changelog.rst | 6 +++++- docs/conf.py | 4 ++-- project.clj | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a449873..11209a1 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,6 +12,9 @@ and this project adheres to `Semantic Versioning`_. `Unreleased`_ ------------- +`1.7.0`_ +-------- + Added +++++ - Added ``--option-pack``, the ability to specify multiple options @@ -37,5 +40,6 @@ Improved - Changed apt reop function from filtering a list to lookup in a map, increasing its speed -.. _Unreleased: https://github.com/djhaskin987/degasolv/compare/1.6.0...HEAD +.. _Unreleased: https://github.com/djhaskin987/degasolv/compare/1.7.0...HEAD +.. _1.7.0: https://github.com/djhaskin987/degasolv/compare/1.6.0...1.7.0 .. _1.6.0: https://github.com/djhaskin987/degasolv/compare/1.5.1...1.6.0 diff --git a/docs/conf.py b/docs/conf.py index 8b01047..3a92f03 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -58,9 +58,9 @@ # built documents. # # The short X.Y version. -version = '1.6' +version = '1.7' # The full version, including alpha/beta/rc tags. -release = '1.6.1' +release = '1.7.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/project.clj b/project.clj index a56e5c3..a6f33bb 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject degasolv/degasolv "1.6.1-SNAPSHOT" +(defproject degasolv/degasolv "1.7.0" :description "Dependency tracker with an eye toward building and shipping software." :url "http://github.com/djhaskin987/degasolv" :license {:name "Eclipse Public License"