[Git][clojure-team/puppetlabs-i18n-clojure][debian/main] 12 commits: New upstream version 0.9.0

Jérôme Charaoui (@lavamind) gitlab at salsa.debian.org
Sun Jan 22 04:28:38 GMT 2023



Jérôme Charaoui pushed to branch debian/main at Debian Clojure Maintainers / puppetlabs-i18n-clojure


Commits:
8f883caf by Louis-Philippe Véronneau at 2020-12-14T12:44:29-05:00
New upstream version 0.9.0
- - - - -
3f4a64d3 by Jérôme Charaoui at 2023-01-21T22:33:47-05:00
add d/gbp.conf with team defaults

- - - - -
d9517972 by Jérôme Charaoui at 2023-01-21T22:35:01-05:00
d/watch: switch to git mode, fix URL

- - - - -
22bd84d9 by Jérôme Charaoui at 2023-01-21T22:35:17-05:00
New upstream version 0.9.2
- - - - -
f3b225b6 by Jérôme Charaoui at 2023-01-21T22:35:19-05:00
Update upstream source from tag 'upstream/0.9.2'

Update to upstream version '0.9.2'
with Debian dir ec63558f92d4e855008aa29e505c30f8b4b70d15
- - - - -
4bf50df6 by Jérôme Charaoui at 2023-01-21T22:57:28-05:00
d/patches: refresh Lein Local patch for new upstream version

- - - - -
1725288d by Jérôme Charaoui at 2023-01-21T22:58:45-05:00
d/control: bump Standards-Version, no changes needed

- - - - -
517fb856 by Jérôme Charaoui at 2023-01-21T23:00:47-05:00
d/rules: skip tests when nocheck flag is present

- - - - -
009e175a by Jérôme Charaoui at 2023-01-21T23:01:39-05:00
run wrap-and-sort -bastk

Gbp-Dch: ignore

- - - - -
95d4b4c5 by Jérôme Charaoui at 2023-01-21T23:02:18-05:00
d/control: add myself to uploaders

- - - - -
77e6b8ed by Jérôme Charaoui at 2023-01-21T23:03:43-05:00
add missing classpath to jar artifact

- - - - -
e1e932f1 by Jérôme Charaoui at 2023-01-21T23:05:43-05:00
Update changelog for 0.9.2-1 release

- - - - -


21 changed files:

- .gitignore
- .travis.yml
- + CHANGELOG.md
- README.md
- debian/changelog
- debian/control
- + debian/gbp.conf
- + debian/libpuppetlabs-i18n-clojure.classpath
- debian/patches/0001_Lein_Local.patch → debian/patches/0001-Lein-Local.patch
- debian/patches/series
- debian/rules
- debian/tests/control
- debian/watch
- test/locales.clj → dev-resources/locales.clj
- project.clj
- src/leiningen/i18n.clj
- src/leiningen/i18n/utils.clj
- src/puppetlabs/i18n/core.clj
- src/puppetlabs/i18n/main.clj
- test/puppetlabs/i18n/bin_test.clj
- test/puppetlabs/i18n/core_test.clj


Changes:

=====================================
.gitignore
=====================================
@@ -1,3 +1,4 @@
+/.eastwood
 /target
 /classes
 /checkouts


=====================================
.travis.yml
=====================================
@@ -8,7 +8,17 @@ jobs:
     - stage: jdk11
       dist: bionic
       jdk: openjdk11
+    - stage: lint jdk11
+      dist: bionic
+      jdk: openjdk11
+      script: |
+        set -e
+        ./dev-setup
+        set -x
+        lein eastwood
+        lein check
+        set +x
 script: "./ext/travisci/test.sh"
 branches:
   only:
-    - master
+    - main


=====================================
CHANGELOG.md
=====================================
@@ -0,0 +1,4 @@
+## [0.9.1]
+
+- remove AOT and main specification from jar to make artifact more portable.
+- remove main specification in project.clj and update README with new example.


=====================================
README.md
=====================================
@@ -10,8 +10,8 @@ which a huge amount of tooling exists.
 The `main.clj` and `example/program` in this repo contain some simple code
 that demonstrates how to use the translation functions. Before you can use
 it, you need to run `make` to generate the necessary
-`ResourceBundles`. After that, you can use `lein run` or `LANG=de_DE lein
-run` to look at English and German output.
+`ResourceBundles`. After that, you can use `lein run -m puppetlabs.i18n.main`
+or `LANG=de_DE lein run -m puppetlabs.i18n.main` to look at English and German output.
 
 ## Developer usage
 


=====================================
debian/changelog
=====================================
@@ -1,9 +1,19 @@
-puppetlabs-i18n-clojure (0.9.0-3) UNRELEASED; urgency=normal
+puppetlabs-i18n-clojure (0.9.2-1) unstable; urgency=medium
 
   [ Louis-Philippe Véronneau ]
   * d/control: New email for the Clojure Team.
 
- -- Louis-Philippe Véronneau <pollo at debian.org>  Sat, 08 Jan 2022 18:32:35 -0500
+  [ Jérôme Charaoui ]
+  * New upstream version 0.9.2
+  * add d/gbp.conf with team defaults
+  * add missing classpath to jar artifact
+  * d/control: add myself to uploaders
+  * d/control: bump Standards-Version, no changes needed
+  * d/patches: refresh Lein Local patch for new upstream version
+  * d/rules: skip tests when nocheck flag is present
+  * d/watch: switch to git mode, fix URL
+
+ -- Jérôme Charaoui <jerome at riseup.net>  Sat, 21 Jan 2023 23:05:08 -0500
 
 puppetlabs-i18n-clojure (0.9.0-2) unstable; urgency=medium
 


=====================================
debian/control
=====================================
@@ -2,20 +2,23 @@ Source: puppetlabs-i18n-clojure
 Section: java
 Priority: optional
 Maintainer: Debian Clojure Maintainers <team+clojure at tracker.debian.org>
-Uploaders: Apollon Oikonomopoulos <apoikos at debian.org>
-Build-Depends: debhelper-compat (= 13),
-               default-jdk-headless,
-               javahelper,
-               maven-repo-helper,
-               libclojure-java,
-               libcpath-clojure (>= 0.1.2-2),
-               gettext-base (>= 0.21-3),
-               libkitchensink-clojure (>= 3.1.1),
-               libnrepl-clojure <!nocheck>,
-               libcomplete-clojure <!nocheck>,
-               git <!nocheck>,
-               leiningen,
-Standards-Version: 4.5.1
+Uploaders:
+ Apollon Oikonomopoulos <apoikos at debian.org>,
+ Jérôme Charaoui <jerome at riseup.net>,
+Build-Depends:
+ debhelper-compat (= 13),
+ default-jdk-headless,
+ gettext-base (>= 0.21-3),
+ git <!nocheck>,
+ javahelper,
+ leiningen,
+ libclojure-java,
+ libcomplete-clojure <!nocheck>,
+ libcpath-clojure (>= 0.1.2-2),
+ libkitchensink-clojure (>= 3.1.1),
+ libnrepl-clojure <!nocheck>,
+ maven-repo-helper,
+Standards-Version: 4.6.2
 Vcs-Git: https://salsa.debian.org/clojure-team/puppetlabs-i18n-clojure.git
 Vcs-Browser: https://salsa.debian.org/clojure-team/puppetlabs-i18n-clojure
 Homepage: https://github.com/puppetlabs/i18n
@@ -23,13 +26,15 @@ Rules-Requires-Root: no
 
 Package: libpuppetlabs-i18n-clojure
 Architecture: all
-Depends: ${java:Depends},
-         ${misc:Depends},
-         libclojure-java,
-         libcpath-clojure (>= 0.1.2-2),
-         gettext-base (>= 0.21-3),
-         libkitchensink-clojure (>= 3.1.1),
-Recommends: ${java:Recommends}
+Depends:
+ gettext-base (>= 0.21-3),
+ libclojure-java,
+ libcpath-clojure (>= 0.1.2-2),
+ libkitchensink-clojure (>= 3.1.1),
+ ${java:Depends},
+ ${misc:Depends},
+Recommends:
+ ${java:Recommends},
 Description: Clojure i18n library
  puppetlabs-i18n provides convenience functions to access the JVM's
  localization facilities and automates managing messages and resource bundles.


=====================================
debian/gbp.conf
=====================================
@@ -0,0 +1,4 @@
+[DEFAULT]
+pristine-tar = True
+debian-branch = debian/main
+upstream-branch = upstream


=====================================
debian/libpuppetlabs-i18n-clojure.classpath
=====================================
@@ -0,0 +1 @@
+usr/share/java/puppetlabs-i18n.jar /usr/share/java/cpath-clj.jar /usr/share/java/libintl.jar


=====================================
debian/patches/0001_Lein_Local.patch → debian/patches/0001-Lein-Local.patch
=====================================
@@ -1,31 +1,44 @@
-Patch project.clj to build locally using lein.
-Index: puppetlabs-i18n-clojure/project.clj
-===================================================================
---- puppetlabs-i18n-clojure.orig/project.clj
-+++ puppetlabs-i18n-clojure/project.clj
-@@ -5,11 +5,14 @@
+From: =?utf-8?b?SsOpcsO0bWUgQ2hhcmFvdWk=?= <jerome at riseup.net>
+Date: Sat, 21 Jan 2023 22:40:31 -0500
+Subject: Lein Local
+
+Patch project.clj to build with local lein.
+
+Forwarded: not-needed
+---
+ project.clj | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/project.clj b/project.clj
+index d9210fe..6dfc4a1 100644
+--- a/project.clj
++++ b/project.clj
+@@ -5,17 +5,20 @@
              :url "http://www.apache.org/licenses/LICENSE-2.0"}
  
    :pedantic? :abort
 -  :dependencies [[org.clojure/clojure "1.10.1"]
 -                 [cpath-clj "0.1.2"]
 -                 [org.gnu.gettext/libintl "0.18.3"]]
-+  :dependencies [[org.clojure/clojure "1.10.x"]
++  :dependencies [[org.clojure/clojure "1.x"]
 +                 [cpath-clj "debian"]
 +                 [org.gnu.gettext/libintl "debian"]
 +                 [com.fasterxml.jackson.core/jackson-core "2.x"]
 +                 [com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.x"]
 +                 [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.x"]]
  
--  :profiles {:dev {:dependencies [[puppetlabs/kitchensink "2.1.0"
+-  :profiles {:dev {:dependencies [[puppetlabs/kitchensink "3.1.3"
+-                                   :exclusions [org.clojure/clojure]]]
+-                   :plugins [[jonase/eastwood "0.8.1"
+-                              :exclusions [org.clojure/clojure]]]}}
 +  :profiles {:dev {:dependencies [[puppetlabs/kitchensink "debian"
-                                    :exclusions [org.clojure/clojure]]]}}
++                                   :exclusions [org.clojure/clojure]]]}}
  
-   :main puppetlabs.i18n.main
-@@ -18,4 +21,5 @@
    :deploy-repositories [["releases" {:url "https://clojars.org/repo"
                                       :username :env/clojars_jenkins_username
                                       :password :env/clojars_jenkins_password
--                                     :sign-releases false}]])
-+                                     :sign-releases false}]]
+                                      :sign-releases false}]]
+-  :eval-in-leiningen true)
++  :eval-in-leiningen true
++
 +  :local-repo "debian/maven-repo")


=====================================
debian/patches/series
=====================================
@@ -1 +1 @@
-0001_Lein_Local.patch
+0001-Lein-Local.patch


=====================================
debian/rules
=====================================
@@ -20,8 +20,10 @@ override_dh_auto_build:
 	cd target && ln -sf i18n-$(DEB_VERSION_UPSTREAM).jar $(NAME).jar
 
 override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 	make i18n
 	lein test
+endif
 
 override_jh_installlibs:
 	jh_installlibs target/$(NAME).jar


=====================================
debian/tests/control
=====================================
@@ -1,6 +1,10 @@
 Tests: build
-Depends: @, clojure
+Depends:
+ clojure,
+ @,
 Restrictions: superficial
 
 Tests: unittests
-Depends: @, clojure
+Depends:
+ clojure,
+ @,


=====================================
debian/watch
=====================================
@@ -1,3 +1,4 @@
 version=4
-opts=filenamemangle=s!.*/archive/(.*)!i18n-$1! \
- https://github.com/puppetlabs/i18n/tags .*/archive/([\d.]+)\.tar\.gz
+opts="mode=git" \
+https://github.com/puppetlabs/clj-i18n.git \
+refs/tags/@ANY_VERSION@


=====================================
test/locales.clj → dev-resources/locales.clj
=====================================


=====================================
project.clj
=====================================
@@ -1,4 +1,4 @@
-(defproject puppetlabs/i18n "0.9.0"
+(defproject puppetlabs/i18n "0.9.2"
   :description "Clojure i18n library"
   :url "http://github.com/puppetlabs/clj-i18n"
   :license {:name "Apache License, Version 2.0"
@@ -9,13 +9,13 @@
                  [cpath-clj "0.1.2"]
                  [org.gnu.gettext/libintl "0.18.3"]]
 
-  :profiles {:dev {:dependencies [[puppetlabs/kitchensink "2.1.0"
-                                   :exclusions [org.clojure/clojure]]]}}
-
-  :main puppetlabs.i18n.main
-  :aot [puppetlabs.i18n.main]
+  :profiles {:dev {:dependencies [[puppetlabs/kitchensink "3.1.3"
+                                   :exclusions [org.clojure/clojure]]]
+                   :plugins [[jonase/eastwood "0.8.1"
+                              :exclusions [org.clojure/clojure]]]}}
 
   :deploy-repositories [["releases" {:url "https://clojars.org/repo"
                                      :username :env/clojars_jenkins_username
                                      :password :env/clojars_jenkins_password
-                                     :sign-releases false}]])
+                                     :sign-releases false}]]
+  :eval-in-leiningen true)


=====================================
src/leiningen/i18n.clj
=====================================
@@ -7,7 +7,9 @@
             [clojure.pprint :as pprint]
             [clojure.string :as cstr]
             [clojure.java.shell :as sh :refer [sh]]
-            [cpath-clj.core :as cp]))
+            [cpath-clj.core :as cp])
+  (:import
+   (java.io File)))
 
 (defn help
   []
@@ -97,7 +99,7 @@
 (defn ensure-contains-line
   "Make sure that file contains the given line, if not append it. If file
   does not exist yet, create it and put line into it"
-  [file line]
+  [^File file line]
   (if (.isFile file)
     (let [contents (slurp file)]
       (if-not (.contains contents line)
@@ -136,7 +138,12 @@
 (defn i18n-make
   [project]
   (l/info "Running 'make i18n'")
-  (sh "make" "i18n"))
+  (let [{:keys [exit out err]} (sh "make" "i18n")]
+    (print out)
+    (binding [*out* *err*]
+      (print err))
+    (when-not (zero? exit)
+      (l/abort))))
 
 (defn abort
   [& rest]


=====================================
src/leiningen/i18n/utils.clj
=====================================
@@ -7,5 +7,5 @@
    replacement. Uses RegExp's m flag (?m) so that ^/$ matches beginning of line."
   [s regex-match replacement]
   (cstr/replace-first s
-                      (re-pattern (str "(?m)^" (.toString regex-match) "$"))
+                      (re-pattern (str "(?m)^" (str regex-match) "$"))
                       replacement))


=====================================
src/puppetlabs/i18n/core.clj
=====================================
@@ -156,11 +156,12 @@
        (binding [*locale* locale#] ~@body)
        (throw (IllegalArgumentException.
                (str "Expected java.util.Locale but got "
-                    (.getName (.getClass locale#))))))))
+                    (.getName (class locale#))))))))
 
-(defn user-locale []
+(defn user-locale
   "Return the user's preferred locale. If none is set, return the system
-  locale"
+  locale."
+  []
   (or *locale* (system-locale)))
 
 ;; @todo lutter 2015-04-21: there are various formats of string locales
@@ -182,7 +183,7 @@
   "Find the name of the ResourceBundle for the given namespace name"
   ([namespace]
    (bundle-for-namespace @info-map namespace))
-  ([i18n-info-map namespace]
+  ([i18n-info-map ^String namespace]
    (:bundle
     (get i18n-info-map
          (first (filter #(.startsWith namespace %)
@@ -195,9 +196,9 @@
 
 (defn get-bundle
   "Get the java.util.ResourceBundle for the given locale (a string)"
-  [namespace loc]
+  [namespace ^java.util.Locale loc]
   (try
-    (let [base-name (bundle-for-namespace namespace)]
+    (let [^String base-name (bundle-for-namespace namespace)]
       (and base-name
            (gnu.gettext.GettextResource/getBundle base-name loc)))
     (catch java.lang.NullPointerException e
@@ -312,12 +313,13 @@
            (remove
             ;; q values can only have three decimal places; we need to
             ;; remove all q values that are 0
-            (fn [[lang q]] (< q 0.0001))
-            (for [choice (remove str/blank? (str/split (str header) #","))]
-              (let [[lang q] (str/split choice #";")]
-                [(str/trim lang)
-                 (or (when q (as-number (get (str/split q #"=") 1)))
-                     1)])))))
+            (fn [[lang q]] (or (not q) (< q 0.0001)))
+            (doall
+             (for [choice (remove str/blank? (str/split (str header) #","))]
+               (when-let [[lang q] (seq (str/split choice #";"))]
+                 [(str/trim lang)
+                  (or (when q (as-number (get (str/split q #"=") 1)))
+                      1)]))))))
 
 (defn negotiate-locale
   "Given a string sequence of wanted locale (sorted by preference) and a
@@ -335,9 +337,11 @@
   ;; For example, if we have locales #{"de" "es"} available, and the user
   ;; asks for ["de_AT" "fr"], we should probably return "de" rather than
   ;; falling back to the message locale
-  (if-let [loc (some available wanted)]
-    (string-as-locale loc)
-    (system-locale)))
+  (if-not (seq wanted)
+    (system-locale)
+    (if-let [loc (some available wanted)]
+      (string-as-locale loc)
+      (system-locale))))
 
 (defn locale-negotiator
   "Ring middleware that performs locale negotiation.
@@ -350,8 +354,8 @@
     ;; @todo lutter 2015-06-03: remove our hand-crafted language
     ;; negotiation and use java.util.Locale/filterTags instead; this would
     ;; remove the gnarly parse-http-accept-header business. Requires Java 8
-    (let [headers (:headers request)
-          parsed  (parse-http-accept-header (get headers "accept-language"))
+    (let [lang (get-in request [:headers "accept-language"] "")
+          parsed  (parse-http-accept-header lang)
           wanted  (mapv first parsed)
           negotiated (negotiate-locale wanted (available-locales))]
       (with-user-locale negotiated (handler request)))))


=====================================
src/puppetlabs/i18n/main.clj
=====================================
@@ -14,7 +14,7 @@
   ;; This code ensures that translators never see this message since
   ;; xgettext doesn't see the string
   (let [dont-do-this "Current Locale: {0}"]
-    (println (tru dont-do-this (.toString (i18n/user-locale)))))
+    (println (tru dont-do-this (str (i18n/user-locale)))))
 
   ;; Very simple localization
   (println (trs "Welcome! This is localized"))


=====================================
test/puppetlabs/i18n/bin_test.clj
=====================================
@@ -3,7 +3,9 @@
             [clojure.string :as str]
             [clojure.test :refer :all]
             [clojure.java.shell :refer [sh]]
-            [puppetlabs.kitchensink.core :as ks]))
+            [puppetlabs.kitchensink.core :as ks])
+  (:import
+   (java.nio.file Path)))
 
 (defn git-head-sha
   []
@@ -21,7 +23,7 @@
     (io/copy (io/file resource) temp-file)
     temp-file))
 
-(defn- path [f] (.getPath f))
+(defn- path [^Path f] (.getPath f))
 
 (deftest add-gitref-test
   (testing "the src/leiningen/i18n/bin/add-gitref.sh script"


=====================================
test/puppetlabs/i18n/core_test.clj
=====================================
@@ -1,8 +1,24 @@
 (ns puppetlabs.i18n.core-test
-  (:require [clojure.test :refer :all]
-            [puppetlabs.i18n.core :refer :all]
-            [clojure.java.io :as io]
-            [clojure.pprint :refer [pprint]]))
+  (:require
+   [clojure.java.io :as io]
+   [clojure.pprint :refer [pprint]]
+   [clojure.test :refer :all]
+   [puppetlabs.i18n.core
+    :refer [as-number
+            available-locales
+            bundle-for-namespace
+            info-map'
+            locale-negotiator
+            negotiate-locale
+            parse-http-accept-header
+            string-as-locale
+            system-locale
+            trs
+            trsn
+            tru
+            trun
+            user-locale
+            with-user-locale]]))
 
 ;; Set the JVM's default locale so we run in a known environment
 (. java.util.Locale setDefault (string-as-locale "en-US"))
@@ -265,7 +281,8 @@
         (check "de" "de_DE, de;q=0.9, en;q=0.8")
         (check "oc" "it, fr"))
       (testing "falls back to system-locale for empty/invalid headers"
-        (map #(check "oc" %) ["" nil "en;q=garbage" ",,," ",;," "xyz" "de-US"])
+        (doseq [x ["" nil "en;q=garbage" ",,," ",;," "xyz" "de-US"]]
+          (check "oc" x))
         (is (= (system-locale) (neg {:headers {}})))
         (is (= (system-locale) (neg {}))))
       (testing "conveys the locale"



View it on GitLab: https://salsa.debian.org/clojure-team/puppetlabs-i18n-clojure/-/compare/85c1a11d2e9c8ea16f9cf9cbc0c79df6d1d929f1...e1e932f119cf5d9d6bc0f3a4cb7c9b84ab70ee9f

-- 
View it on GitLab: https://salsa.debian.org/clojure-team/puppetlabs-i18n-clojure/-/compare/85c1a11d2e9c8ea16f9cf9cbc0c79df6d1d929f1...e1e932f119cf5d9d6bc0f3a4cb7c9b84ab70ee9f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20230122/b4a27a19/attachment.htm>


More information about the pkg-java-commits mailing list