[jenkinscat-docs] master: Handler for third step for adding book to Jenkins. (ade437a)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit ade437a6026fd253029fd4779da85bd57bfc9013
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Mon Feb 2 10:56:39 2015 +0100
Handler for third step for adding book to Jenkins.
>---------------------------------------------------------------
ChangeLog | 5 +++++
src/jenkinscat/server.clj | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b939888..db62429 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-02 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
+ Handler for third step for adding book to Jenkins.
+
2015-01-23 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index dbe6e41..f284878 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -63,6 +63,12 @@
(def not-available-message
"<span style='color:red'>N/A</span>")
+(def gerrit-repo-prefix
+ "")
+
+(def internal-svn-repo-prefix
+ "")
+
(def github-repo-prefix
"https://github.com/")
@@ -944,6 +950,40 @@
(generate-response-html (add-book-step-2-renderer/render-add-book-step-2-already-have-bookinfo repository-type repository-name repository-url book-info config/devel-version) session))
))
+(defn add-book-step-3-handler
+ "Handler for the 'Add book -> Continue -> Continue' command."
+ [uri params session]
+ (let [repository-type (read-trimmed-parameter-default-nil params "repository-type")
+ repository-name (read-trimmed-parameter-default-nil params "repository-name")
+ repository-url (read-trimmed-parameter-default-nil params "repository-url")
+ document-title (read-trimmed-parameter-default-nil params "document-title")
+ product-name (read-trimmed-parameter-default-nil params "product-name")
+ product-number (read-trimmed-parameter-default-nil params "product-number")
+ component-name (read-trimmed-parameter-default-nil params "component-name")
+ component-product (read-trimmed-parameter-default-nil params "component-product")
+ ]
+ (cond
+ (not repository-type)
+ (generate-response-html (add-book-step-2-error-pages-renderer/render-add-book-step-2-missing-repository-type) session)
+ (not repository-name)
+ (generate-response-html (add-book-step-2-error-pages-renderer/render-add-book-step-2-missing-repository-name) session)
+ (not repository-url)
+ (generate-response-html (add-book-step-2-error-pages-renderer/render-add-book-step-2-missing-repository-url) session)
+ (not document-title)
+ (generate-response-html (add-book-step-2-error-pages-renderer/render-add-book-step-2-missing-document-title) session)
+ (not product-name)
+ (generate-response-html (add-book-step-2-error-pages-renderer/render-add-book-step-2-missing-product-name) session)
+ (not product-number)
+ (generate-response-html (add-book-step-2-error-pages-renderer/render-add-book-step-2-missing-product-number) session)
+ :else
+ (generate-response-html (add-book-step-3-renderer/render-add-book-step-3 document-title product-name product-number component-name component-product repository-type repository-name repository-url) session))))
+
+(defn build-configuration-help-handler
+ ""
+ [uri params session]
+ (let [page-content (render-build-configuration-help-page)]
+ (generate-response-html page-content session)))
+
(defn count-books
[books]
(let [out-data (new java.util.TreeSet)]
9 years, 3 months
[jenkinscat-docs] master: Handler for the second step for adding book to Jenkins. (3dec4f1)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 3dec4f103faffef252c6f9fad3739974d8b924ab
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Fri Jan 23 10:26:40 2015 +0100
Handler for the second step for adding book to Jenkins.
>---------------------------------------------------------------
ChangeLog | 5 +++++
src/jenkinscat/server.clj | 30 ++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 291b11b..b939888 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
2015-01-23 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
+ Handler for the second step for adding book to Jenkins.
+
+2015-01-23 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
Added functions to read book metainformations.
2015-01-22 Pavel Tisnovsky <ptisnovs(a)redhat.com>
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index 1c6bf5a..dbe6e41 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -914,6 +914,36 @@
nil)
nil))
+(defn add-book-step-2-handler
+ "Handler for the 'Add book -> Continue' command."
+ [uri params session]
+ (let [repository-type (read-trimmed-parameter-default-string params "repository-type")
+ repository-name (read-trimmed-parameter-default-string params "repository-url")
+ repository-exists (repository-exists? repository-type repository-name)
+ repository-url (get-full-repository-url repository-type repository-name)
+ book-info (if repository-exists (clone-repo-and-read-book-info repository-type repository-name) nil)
+ ]
+ (when config/devel-version
+ (println "Book info: " book-info)
+ (println (not book-info))
+ (println (empty-book-info? book-info)))
+ (cond
+ (= repository-type "")
+ (generate-response-html (add-book-step-1-error-pages-renderer/render-add-book-step-1-wrong-repotype) session)
+ (= repository-type "Please select repository type")
+ (generate-response-html (add-book-step-1-error-pages-renderer/render-add-book-step-1-wrong-repotype) session)
+ (= repository-name "")
+ (generate-response-html (add-book-step-1-error-pages-renderer/render-add-book-step-1-empty-reponame) session)
+ (not repository-exists)
+ (generate-response-html (add-book-step-1-error-pages-renderer/render-add-book-step-1-wrong-reponame repository-name) session)
+ (not book-info)
+ (generate-response-html (add-book-step-2-renderer/render-add-book-step-2-enter-some-bookinfo repository-type repository-name repository-url nil config/devel-version) session)
+ (empty-book-info? book-info)
+ (generate-response-html (add-book-step-2-renderer/render-add-book-step-2-enter-some-bookinfo repository-type repository-name repository-url book-info config/devel-version) session)
+ :else
+ (generate-response-html (add-book-step-2-renderer/render-add-book-step-2-already-have-bookinfo repository-type repository-name repository-url book-info config/devel-version) session))
+ ))
+
(defn count-books
[books]
(let [out-data (new java.util.TreeSet)]
9 years, 3 months
[jenkinscat-docs] master: Added functions to read book metainformations. (979f0a5)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 979f0a571e79838aeebca0f164c45451fb1c802b
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Fri Jan 23 10:25:44 2015 +0100
Added functions to read book metainformations.
>---------------------------------------------------------------
ChangeLog | 5 ++
src/jenkinscat/server.clj | 100 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 105 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e7973ca..291b11b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-23 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
+ Added functions to read book metainformations.
+
2015-01-22 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* tools/create_books_clj_file.lua:
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index 496246e..1c6bf5a 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -814,6 +814,106 @@
(= document-type "Article") "Article"
:else "Book")))
+(defn exec-read-product-name-script
+ "Call the script that read product name from the given book and stores this string in temporary file."
+ [temp-dir-name document-type]
+ (exec/exec "./tools/new_book_scripts/read_product_name.sh" temp-dir-name document-type))
+
+(defn exec-read-product-number-script
+ "Call the script that read product number from the given book and stores this string in temporary file."
+ [temp-dir-name document-type]
+ (exec/exec "./tools/new_book_scripts/read_product_number.sh" temp-dir-name document-type))
+
+(defn exec-read-document-title-script
+ "Call the script that read document title from the given book and stores this string in temporary file."
+ [temp-dir-name document-type]
+ (exec/exec "./tools/new_book_scripts/read_document_title.sh" temp-dir-name document-type))
+
+(defn read-product-name
+ "Read product name (applicable for all DocBook guides)."
+ [temp-dir-name document-type]
+ (if document-type
+ (do
+ (exec-read-product-name-script temp-dir-name document-type)
+ (try
+ (fileutils/slurp- (str temp-dir-name "/product_name"))
+ (catch Exception e (println "Warning: cannot read product_name file"))))
+ nil))
+
+(defn read-product-number
+ "Read product number (applicable for all DocBook guides)."
+ [temp-dir-name document-type]
+ (if document-type
+ (do
+ (exec-read-product-number-script temp-dir-name document-type)
+ (try
+ (fileutils/slurp- (str temp-dir-name "/product_number"))
+ (catch Exception e (println "Warning: cannot read product_number file"))))
+ nil))
+
+(defn read-document-title
+ "Read document title (applicable for all DocBook guides)."
+ [temp-dir-name document-type]
+ (if document-type
+ (do
+ (exec-read-document-title-script temp-dir-name document-type)
+ (try
+ (fileutils/slurp- (str temp-dir-name "/document_title"))
+ (catch Exception e (println "Warning: cannot read document_title file"))))
+ nil))
+
+(defn read-docbook-info
+ "Read all relevant DocBook-related information from the DocBook book stored in given temporary directory."
+ [temp-dir-name]
+ (let [publican-cfg (read-publican-cfg temp-dir-name)
+ document-type (get-document-type publican-cfg)
+ document-title (empty-string-to-nil (read-document-title temp-dir-name document-type))
+ product-name (empty-string-to-nil (read-product-name temp-dir-name document-type))
+ product-number (empty-string-to-nil (read-product-number temp-dir-name document-type))]
+ {:document-title document-title
+ :product-name product-name
+ :product-number product-number}))
+
+(defn read-book-info
+ "Try to read ChesshireCat-related and DocBook-related information from the book stored in given temporary directory."
+ [temp-dir-name]
+ (println "Repository cloned sucesfully!")
+ (let [cheshirecat (read-cheshirecat-edn temp-dir-name)
+ docbook-info (read-docbook-info temp-dir-name)]
+ (fileutils/remove-temporary-directory temp-dir-name)
+ (merge docbook-info {:component-name (:component (:article cheshirecat))
+ :component-product (:product (:article cheshirecat))})))
+
+(defn clone-repo-and-read-book-info
+ [repo-type url]
+ (println "Repository exists, let's clone it.")
+ (let [temp-dir-name (fileutils/make-temporary-directory-name)
+ dvcs (get-dvcs repo-type)]
+ (println "Temporary directory: " temp-dir-name)
+ (if (clone-repo repo-type dvcs url temp-dir-name)
+ (read-book-info temp-dir-name)
+ (println "Clone error!"))))
+
+(defn empty-book-info?
+ [book-info]
+ (not (and (:component-name book-info)
+ (:component-product book-info)
+ (:document-title book-info)
+ (:product-name book-info)
+ (:product-number book-info))))
+
+(defn read-trimmed-parameter-default-string
+ [params param-name]
+ (.trim (get params param-name "")))
+
+(defn read-trimmed-parameter-default-nil
+ [params param-name]
+ (if params
+ (if (get params param-name)
+ (empty-string-to-nil (.trim (get params param-name)))
+ nil)
+ nil))
+
(defn count-books
[books]
(let [out-data (new java.util.TreeSet)]
9 years, 3 months
[jenkinscat-docs] master: Further updates - special books handling etc. (6183587)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 6183587cd3c4364e1274911f8b835e26bab5850e
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Thu Jan 22 10:22:36 2015 +0100
Further updates - special books handling etc.
>---------------------------------------------------------------
ChangeLog | 5 +++++
tools/create_books_clj_file.lua | 22 ++++++++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f4c797f..e7973ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-01-22 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+ * tools/create_books_clj_file.lua:
+ Further updates - special books handling etc.
+
+2015-01-22 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
* src/jenkinscat/server.clj:
Support for reading publican.cfg files stored in book repository.
diff --git a/tools/create_books_clj_file.lua b/tools/create_books_clj_file.lua
index f9f7d75..0a3fe0f 100644
--- a/tools/create_books_clj_file.lua
+++ b/tools/create_books_clj_file.lua
@@ -18,6 +18,8 @@ local bug_description = ""
local bug_template = ""
+local fuseSourceSpecialJobs = "FuseSource" -- jobs that contain this string in its names are handled specifically
+
--
-- An implementation of common String.trim() method/function.
--
@@ -168,6 +170,7 @@ function readGitConfig(gitConfigFileName)
-- we are interested only in the URL configuration
if line:startsWith("url = ") then
result = line:sub(6):trim()
+ break
end
end
@@ -338,13 +341,18 @@ end
--
function fetchProductVersionFromHTML(docname)
-- <p xmlns="http://www.w3.org/1999/xhtml" class="releaseinfo">Version 6.1</p>
- local command = "cat " .. docname .. " | xmlstarlet sel -t -v \"(//*[@class='releaseinfo'])[1]\" 2>/dev/null"
+ --local command = "cat " .. docname .. " | xmlstarlet sel -t -v \"(//*[@class='releaseinfo'])[1]\" 2>/dev/null"
+ local command = "cat " .. docname .. " | xmlstarlet sel -t -v \"(//*[@class='para'])[1]\" 2>/dev/null"
local handle = io.popen(command)
local result = handle:read("*a")
handle:close()
if result:startsWith("Version ") then
result = result:sub(8):trim()
end
+ -- in some cases the HTML contain some garbage instead of version information, let's ignore it
+ if string.len(result) > 10 then
+ result = ""
+ end
return result
end
@@ -622,7 +630,7 @@ function selectNormalJobs(allJobs)
local normalJobs = {}
for i,job in ipairs(allJobs) do
local jobName = job.name
- if job.name ~= "doc-FuseSource-ActiveMQDocs" and
+ if not string.find(job.name, fuseSourceSpecialJobs) and
not string.endsWith(job.name, "(test)") and
not (string.startsWith(job.name, "doc-") and string.endsWith(job.name, "(html)")) then
table.insert(normalJobs, job)
@@ -672,7 +680,7 @@ end
--
--
function getSpecialJobWorkDir(jobName)
- return jenkins_dir .. "jobs/" .. jobName .. "/lastSuccessful/archive/output/"
+ return jenkins_dir .. "jobs/" .. jobName .. "/lastSuccessful/archive/publican/"
end
@@ -704,7 +712,9 @@ function processSpecialJob(specialJobs, job)
for filename in io.popen('cd "'..workdir ..'"; ls -1 -d */'):lines() do
-- remove trailing "/"
local dirname = filename:sub(1, -2)
- local htmlFile = workdir .. dirname .. "/" .. dirname .. ".html"
+ print(dirname)
+ local htmlFile = workdir .. dirname .. "/tmp/en-US/html-single/index.html"
+ print(htmlFile)
if fileExists(htmlFile) then
local formattedHtml = "./work/" .. dirname .. ".html"
formatHTML(htmlFile, formattedHtml)
@@ -727,7 +737,7 @@ function processSpecialJobs(allJobs)
local specialJobs = {}
for i,job in ipairs(allJobs) do
local jobName = job.name
- if job.name == "doc-FuseSource-ActiveMQDocs" then
+ if string.find(job.name, fuseSourceSpecialJobs) then
processSpecialJob(specialJobs, job)
end
end
@@ -879,7 +889,7 @@ function main()
local knownBooks = readKnownBooks()
--printDisabledJobs(disabledJobs)
- printKnownBooks(knownBooks)
+ --printKnownBooks(knownBooks)
-- we need to filter out all disabled books
normalJobs = filterOutDisabledJobs(normalJobs, disabledJobs)
9 years, 3 months
[jenkinscat-docs] master: Support for reading publican.cfg files stored in book repository. (7d393f4)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 7d393f429a186a9962841c6923d72da2aae93c9c
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Thu Jan 22 10:20:33 2015 +0100
Support for reading publican.cfg files stored in book repository.
>---------------------------------------------------------------
ChangeLog | 5 +++++
src/jenkinscat/server.clj | 33 +++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bff10c8..f4c797f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
2015-01-22 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
+ Support for reading publican.cfg files stored in book repository.
+
+2015-01-22 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
Support for reading .edn files stored in book repository.
2015-01-21 Pavel Tisnovsky <ptisnovs(a)redhat.com>
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index 49641ef..496246e 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -781,6 +781,39 @@
(println "Result: " result)
result)))
+(defn perform-reading-from-publican-cfg
+ "Read all informations stored in a given publican.cfg file."
+ [publican-cfg-filename]
+ (if (file-exists? publican-cfg-filename)
+ (.split (fileutils/slurp- publican-cfg-filename) "\n")
+ nil))
+
+(defn read-publican-cfg
+ "Try to read all informations stored in a given publican.cfg file."
+ [temp-dir-name]
+ (let [publican-cfg-filename (str temp-dir-name "/publican.cfg")]
+ (println "Trying to read info from the file " publican-cfg-filename)
+ (let [result (perform-reading-from-publican-cfg publican-cfg-filename)]
+ (println "Result: " result)
+ result)))
+
+(defn read-publican-cfg-value
+ [publican-cfg key]
+ (first
+ (for [line publican-cfg :when (= key (first (.split line ":")))]
+ (.trim (second (.split line ":"))))))
+
+(defn get-document-type
+ "Returns document type - 'Article' or 'Book'."
+ [publican-cfg]
+ (let [document-type (if publican-cfg
+ (read-publican-cfg-value publican-cfg "type")
+ "Book")]
+ (cond
+ (empty? document-type) "Book"
+ (= document-type "Article") "Article"
+ :else "Book")))
+
(defn count-books
[books]
(let [out-data (new java.util.TreeSet)]
9 years, 3 months
[jenkinscat-docs] master: Support for reading .edn files stored in book repository. (3833e21)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 3833e2153f8bf1c333aa8db6e46544498a734ce7
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Thu Jan 22 10:19:30 2015 +0100
Support for reading .edn files stored in book repository.
>---------------------------------------------------------------
ChangeLog | 5 +++++
src/jenkinscat/server.clj | 16 ++++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ec6bd7b..bff10c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-22 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
+ Support for reading .edn files stored in book repository.
+
2015-01-21 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* tools/create_books_clj_file.lua:
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index cba6a10..49641ef 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -765,6 +765,22 @@
(= dcvs "svn") (clone-svn-repo full-url temp-dir-name)
:else nil)))
+(defn perform-reading-from-cheshirecat-edn
+ "Read and evaluate all informations stored in a given .edn file."
+ [cheshirecat-filename]
+ (if (file-exists? cheshirecat-filename)
+ (eval (read-string (fileutils/slurp- cheshirecat-filename)))
+ nil))
+
+(defn read-cheshirecat-edn
+ [temp-dir-name]
+ "Try to read and evaluate all informations stored in a given .edn file."
+ (let [cheshirecat-filename (str temp-dir-name "/.cheshirecat/artifact.edn")]
+ (println "Trying to read info from the file " cheshirecat-filename)
+ (let [result (perform-reading-from-cheshirecat-edn cheshirecat-filename)]
+ (println "Result: " result)
+ result)))
+
(defn count-books
[books]
(let [out-data (new java.util.TreeSet)]
9 years, 3 months
[jenkinscat-docs] master: Finished 2nd working version of the script. (cee6d4a)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit cee6d4ab862c186b8ed6b38eca00c5495676ab93
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Wed Jan 21 11:51:39 2015 +0100
Finished 2nd working version of the script.
>---------------------------------------------------------------
ChangeLog | 5 +++++
tools/create_books_clj_file.lua | 39 ++++++++++++++++++++++++++++++++-------
2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6a4cb4f..ec6bd7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
2015-01-21 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* tools/create_books_clj_file.lua:
+ Finished 2nd working version of the script.
+
+2015-01-21 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * tools/create_books_clj_file.lua:
Support for normal book processing.
2015-01-20 Pavel Tisnovsky <ptisnovs(a)redhat.com>
diff --git a/tools/create_books_clj_file.lua b/tools/create_books_clj_file.lua
index bc7e979..f9f7d75 100644
--- a/tools/create_books_clj_file.lua
+++ b/tools/create_books_clj_file.lua
@@ -4,6 +4,7 @@ local json = require("dkjson")
local json_url = "http://jenkins.machine:8080/"
+local bugzilla_url = "http://bugzilla.org/enter_bug.cgi?keywords=Documentation&groups=private&"
local jenkins_dir = "/var/lib/jenkins/"
local workdir = "work/"
@@ -212,7 +213,7 @@ end
--
--
function readDocumentInfoFromPublicanCfg(jobDirectory)
- local publicanCfgFile = jobDirectory .. "/workspace/publican.cfg"
+ local publicanCfgFile = jobDirectory .. "/publican.cfg"
local fin = io.open(publicanCfgFile, "r")
if fin == nil then
@@ -871,13 +872,37 @@ function main()
--print(bug_template)
local allJobs = fetchListOfAllJobs()
- addJobDirectories(allJobs)
- --addJobBuildCount(allJobs)
- --addJobBuildInfo(allJobs)
- addJobGitRepo(allJobs)
- addJobTitleTypeAndProduct(allJobs)
- exportToClojure("books.clj", allJobs)
+ local normalJobs = selectNormalJobs(allJobs)
+ local specialJobs = processSpecialJobs(allJobs)
+
+ local disabledJobs = readDisabledJobs()
+ local knownBooks = readKnownBooks()
+
+ --printDisabledJobs(disabledJobs)
+ printKnownBooks(knownBooks)
+
+ -- we need to filter out all disabled books
+ normalJobs = filterOutDisabledJobs(normalJobs, disabledJobs)
+ --printJobs("all", normalJobs)
+
+ addJobDirectories(normalJobs)
+ --addJobBuildCount(normalJobs)
+ --addJobBuildInfo(normalJobs)
+ addJobGitRepo(normalJobs)
+ addJobTitleTypeAndProduct(normalJobs)
addArtifactInfo(normalJobs)
+
+ addInfoFromKnownBooks(normalJobs, knownBooks)
+ addInfoFromKnownBooks(specialJobs, knownBooks)
+
+ --printJobs("all", allJobs)
+ --printJobs("normal", normalJobs)
+ --printJobs("special", specialJobs)
+
+ local joinedJobTables = {}
+ concatTables(joinedJobTables, normalJobs)
+ concatTables(joinedJobTables, specialJobs)
+ exportToClojure("books_.clj", joinedJobTables)
end
9 years, 3 months
[jenkinscat-docs] master: Support for normal book processing. (3b16a0d)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 3b16a0d058b0da158949e3920ac5a8d1fb22821b
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Wed Jan 21 11:49:55 2015 +0100
Support for normal book processing.
>---------------------------------------------------------------
ChangeLog | 5 +++
tools/create_books_clj_file.lua | 60 +++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 42135b0..6a4cb4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-21 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * tools/create_books_clj_file.lua:
+ Support for normal book processing.
+
2015-01-20 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* tools/create_books_clj_file.lua:
diff --git a/tools/create_books_clj_file.lua b/tools/create_books_clj_file.lua
index 54abbaa..bc7e979 100644
--- a/tools/create_books_clj_file.lua
+++ b/tools/create_books_clj_file.lua
@@ -206,6 +206,11 @@ function readValueFromPublicanCfg(line, name)
return line:sub(name:len()):trim():gsub("\"", ""):gsub("_", " ")
end
+
+
+--
+--
+--
function readDocumentInfoFromPublicanCfg(jobDirectory)
local publicanCfgFile = jobDirectory .. "/workspace/publican.cfg"
@@ -598,6 +603,61 @@ end
--
--
--
+function printJobs(jobType, allJobs)
+ print("List of " .. jobType .. " jobs:")
+ for i,job in ipairs(allJobs) do
+ --if job.bugzillaProductName and job.bugzillaProductName ~= "" then
+ print(i, job.name, job.documentTitle, job.documentType, job.productName, job.productVersion, job.git_repo, job.bugzillaProductName, job.bugzillaComponentName)
+ --end
+ end
+end
+
+
+
+--
+--
+--
+function selectNormalJobs(allJobs)
+ local normalJobs = {}
+ for i,job in ipairs(allJobs) do
+ local jobName = job.name
+ if job.name ~= "doc-FuseSource-ActiveMQDocs" and
+ not string.endsWith(job.name, "(test)") and
+ not (string.startsWith(job.name, "doc-") and string.endsWith(job.name, "(html)")) then
+ table.insert(normalJobs, job)
+ end
+ end
+ return normalJobs
+end
+
+
+
+--
+--
+--
+function fileExists(filename)
+ local file = io.open(filename, "r")
+ if file ~= nil then
+ io.close(file)
+ return true
+ else
+ return false
+ end
+end
+
+
+
+--
+-- Format input HTML file by using xmllint tool.
+-- We need to set the variable XMLLINT_INDENT to empty string because Jive/Mojo
+-- does not like indented HTML (it inserts empty <p>...</p> as a replacement for spaces)
+--
+function formatHTML(originalFileName, formattedFileName)
+ os.execute("export XMLLINT_INDENT='';xmllint --format " .. originalFileName .. " > " .. formattedFileName)
+end
+
+
+
--
--
--
9 years, 3 months
[jenkinscat-docs] master: Support for artifacts processing. (104d45f)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 104d45ff13634b2d7aebf791c2caba1667f022fc
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Tue Jan 20 10:58:12 2015 +0100
Support for artifacts processing.
>---------------------------------------------------------------
ChangeLog | 5 +++++
tools/create_books_clj_file.lua | 16 ++++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5947b09..42135b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-01-20 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+ * tools/create_books_clj_file.lua:
+ Support for artifacts processing.
+
+2015-01-20 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
* src/jenkinscat/server.clj:
Function for cloning from various repo types.
diff --git a/tools/create_books_clj_file.lua b/tools/create_books_clj_file.lua
index a5ff37a..54abbaa 100644
--- a/tools/create_books_clj_file.lua
+++ b/tools/create_books_clj_file.lua
@@ -487,6 +487,19 @@ function addJobTitleTypeAndProduct(allJobs)
end
end
+
+
+--
+--
+--
+function addArtifactInfo(allJobs)
+ for i, job in ipairs(allJobs) do
+ job.bugzillaProductName, job.bugzillaComponentName, job.bugzillaUrl = getBugzillaProductNameAndComponentName(job.directory, job.workDirectory)
+ end
+end
+
+
+
--
--
--
@@ -532,6 +545,9 @@ function exportToClojure(fileName, allJobs)
writeItem(fout, job.documentType)
writeItem(fout, job.productName)
writeItem(fout, job.productVersion)
+ writeItem(fout, job.bugzillaProductName)
+ writeItem(fout, job.bugzillaComponentName)
+ writeItem(fout, job.bugzillaUrl)
fout:write(" ]\n")
end
if export_books_as_edn then
9 years, 3 months
[jenkinscat-docs] master: Function for cloning from various repo types. (94d3e5c)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 94d3e5c96297bf263e2d3f4108f66b2c28f45bcd
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Tue Jan 20 10:56:36 2015 +0100
Function for cloning from various repo types.
>---------------------------------------------------------------
ChangeLog | 5 +++++
src/jenkinscat/server.clj | 23 +++++++++++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8f2ca97..5947b09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
2015-01-20 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
+ Function for cloning from various repo types.
+
+2015-01-20 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
Basic support for adding new books.
2015-01-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index b9babc1..cba6a10 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -742,6 +742,29 @@
url (get-full-repository-url repository-type repository-name)]
(check-if-repo-exists dvcs url)))
+(defn clone-git-repo
+ "Clone given GIT repository into temporary directory."
+ [url temp-dir-name]
+ (let [result (exec/exec "git clone" url temp-dir-name)]
+ (= result 0)))
+
+(defn clone-svn-repo
+ "Clone given SVN repository into temporary directory."
+ [url temp-dir-name]
+ (let [result (exec/exec "svn checkout --non-interactive --trust-server-cert " url temp-dir-name)]
+ (= result 0)))
+
+(defn clone-repo
+ "Clone given GIT or SVN repository into temporary directory."
+ [repository-type dcvs repository-name temp-dir-name]
+ ;(println repository-type dcvs repository-name)
+ (let [full-url (get-full-repository-url repository-type repository-name)]
+ (println "Clonning from: " full-url)
+ (cond
+ (= dcvs "git") (clone-git-repo full-url temp-dir-name)
+ (= dcvs "svn") (clone-svn-repo full-url temp-dir-name)
+ :else nil)))
+
(defn count-books
[books]
(let [out-data (new java.util.TreeSet)]
9 years, 3 months