[Git][clojure-team/ring-codec-clojure][debian/main] 8 commits: add d/gbp.conf with team defaults
Jérôme Charaoui (@lavamind)
gitlab at salsa.debian.org
Sun Jan 22 15:32:14 GMT 2023
Jérôme Charaoui pushed to branch debian/main at Debian Clojure Maintainers / ring-codec-clojure
Commits:
98918253 by Jérôme Charaoui at 2023-01-22T10:19:40-05:00
add d/gbp.conf with team defaults
- - - - -
b4bb38d2 by Jérôme Charaoui at 2023-01-22T10:20:02-05:00
New upstream version 1.2.0
- - - - -
2214238d by Jérôme Charaoui at 2023-01-22T10:20:06-05:00
Update upstream source from tag 'upstream/1.2.0'
Update to upstream version '1.2.0'
with Debian dir 1c639523af5f072c07dfd2cdd565b564d57e835c
- - - - -
79c995d1 by Jérôme Charaoui at 2023-01-22T10:20:33-05:00
d/rules: replace override_dh_installlibs
- - - - -
5ff7dc68 by Jérôme Charaoui at 2023-01-22T10:29:24-05:00
d/control: bump Standards-Version, no changes needed
- - - - -
63a14eb1 by Jérôme Charaoui at 2023-01-22T10:29:25-05:00
d/rules: skip tests when nocheck build flag present
- - - - -
6d3a9e46 by Jérôme Charaoui at 2023-01-22T10:29:26-05:00
d/patches: refresh lein local patch for new upstream version
- - - - -
2bba767a by Jérôme Charaoui at 2023-01-22T10:30:21-05:00
Update changelog for 1.2.0-1 release
- - - - -
12 changed files:
- README.md
- debian/changelog
- debian/control
- + debian/gbp.conf
- debian/libring-codec-clojure.poms
- + debian/patches/0001-Lein-Local.patch
- − debian/patches/0001_Lein_Local.patch
- debian/patches/series
- debian/rules
- project.clj
- src/ring/util/codec.clj
- test/ring/util/test/codec.clj
Changes:
=====================================
README.md
=====================================
@@ -9,14 +9,14 @@ web applications.
To install, add the following to your project `:dependencies`:
- [ring/ring-codec "1.1.2"]
+ [ring/ring-codec "1.2.0"]
## Documentation
-* [API Docs](http://ring-clojure.github.com/ring-codec/ring.util.codec.html)
+* [API Docs](http://ring-clojure.github.io/ring-codec/ring.util.codec.html)
## License
-Copyright © 2019 James Reeves
+Copyright © 2021 James Reeves
Distributed under the MIT License, the same as Ring.
=====================================
debian/changelog
=====================================
@@ -1,9 +1,19 @@
-ring-codec-clojure (1.1.2-2) UNRELEASED; urgency=normal
+ring-codec-clojure (1.2.0-1) unstable; urgency=medium
+
+ * Team upload.
[ 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:20 -0500
+ [ Jérôme Charaoui ]
+ * New upstream version 1.2.0
+ * add d/gbp.conf with team defaults
+ * d/control: bump Standards-Version, no changes needed
+ * d/rules: replace override_dh_installlibs
+ * d/rules: skip tests when nocheck build flag present
+ * d/patches: refresh lein local patch for new upstream version
+
+ -- Jérôme Charaoui <jerome at riseup.net> Sun, 22 Jan 2023 10:29:37 -0500
ring-codec-clojure (1.1.2-1) unstable; urgency=medium
=====================================
debian/control
=====================================
@@ -12,7 +12,7 @@ Build-Depends: debhelper-compat (= 13),
libnrepl-clojure <!nocheck>,
libcomplete-clojure <!nocheck>,
leiningen,
-Standards-Version: 4.5.1
+Standards-Version: 4.6.2
Vcs-Git: https://salsa.debian.org/clojure-team/ring-codec-clojure.git
Vcs-Browser: https://salsa.debian.org/clojure-team/ring-codec-clojure
Homepage: https://github.com/ring-clojure/ring-codec
=====================================
debian/gbp.conf
=====================================
@@ -0,0 +1,4 @@
+[DEFAULT]
+pristine-tar = True
+debian-branch = debian/main
+upstream-branch = upstream
=====================================
debian/libring-codec-clojure.poms
=====================================
@@ -1 +1 @@
-debian/pom.xml --artifact=target/ring-codec.jar --usj-name=ring-codec
+debian/pom.xml --java-lib --artifact=target/ring-codec.jar --usj-name=ring-codec
=====================================
debian/patches/0001-Lein-Local.patch
=====================================
@@ -0,0 +1,34 @@
+From: =?utf-8?b?SsOpcsO0bWUgQ2hhcmFvdWk=?= <jerome at riseup.net>
+Date: Sun, 22 Jan 2023 10:22:49 -0500
+Subject: Lein Local
+
+Patch project.clj to build locally with lein.
+
+Forwarded: not-needed
+---
+ project.clj | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/project.clj b/project.clj
+index 98a05a5..50e8f3d 100644
+--- a/project.clj
++++ b/project.clj
+@@ -3,14 +3,13 @@
+ :url "https://github.com/ring-clojure/ring-codec"
+ :license {:name "The MIT License"
+ :url "http://opensource.org/licenses/MIT"}
+- :dependencies [[org.clojure/clojure "1.7.0"]]
+- :plugins [[lein-codox "0.10.7"]]
++ :dependencies [[org.clojure/clojure "1.x"]]
+ :codox
+ {:output-path "codox"
+ :source-uri "http://github.com/ring-clojure/ring-codec/blob/{version}/{filepath}#L{line}"}
+ :aliases {"test-all" ["with-profile" "default:+1.8:+1.9:+1.10" "test"]}
+ :profiles
+- {:dev {:dependencies [[criterium "0.4.6"]]}
+- :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
++ {:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
+ :1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}
+- :1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]}})
++ :1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]}}
++ :local-repo "debian/maven-repo")
=====================================
debian/patches/0001_Lein_Local.patch deleted
=====================================
@@ -1,28 +0,0 @@
-Patch project.clj to build locally using lein.
-Index: ring-codec-clojure/project.clj
-===================================================================
---- ring-codec-clojure.orig/project.clj
-+++ ring-codec-clojure/project.clj
-@@ -3,17 +3,13 @@
- :url "https://github.com/ring-clojure/ring-codec"
- :license {:name "The MIT License"
- :url "http://opensource.org/licenses/MIT"}
-- :dependencies [[org.clojure/clojure "1.5.1"]
-- [commons-codec "1.11"]]
-- :plugins [[lein-codox "0.10.3"]]
-- :codox
-- {:output-path "codox"
-- :source-uri "http://github.com/ring-clojure/ring-codec/blob/{version}/{filepath}#L{line}"}
-+ :dependencies [[org.clojure/clojure "1.10.x"]
-+ [commons-codec "debian"]]
- :aliases {"test-all" ["with-profile" "default:+1.6:+1.7:+1.8:+1.9:+1.10" "test"]}
- :profiles
-- {:dev {:dependencies [[criterium "0.4.4"]]}
-- :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
-+ {:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
- :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
- :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
- :1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}
-- :1.10 {:dependencies [[org.clojure/clojure "1.10.0"]]}})
-+ :1.10 {:dependencies [[org.clojure/clojure "1.10.0"]]}}
-+ :local-repo "debian/maven-repo")
=====================================
debian/patches/series
=====================================
@@ -1 +1 @@
-0001_Lein_Local.patch
+0001-Lein-Local.patch
=====================================
debian/rules
=====================================
@@ -20,10 +20,9 @@ override_dh_auto_build:
cd target && ln -sf $(NAME)-$(DEB_VERSION_UPSTREAM).jar $(NAME).jar
override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
lein test
-
-override_jh_installlibs:
- jh_installlibs target/$(NAME).jar
+endif
override_dh_clean:
rm -f debian/maven-repo
=====================================
project.clj
=====================================
@@ -1,19 +1,16 @@
-(defproject ring/ring-codec "1.1.2"
+(defproject ring/ring-codec "1.2.0"
:description "Library for encoding and decoding data"
:url "https://github.com/ring-clojure/ring-codec"
:license {:name "The MIT License"
:url "http://opensource.org/licenses/MIT"}
- :dependencies [[org.clojure/clojure "1.5.1"]
- [commons-codec "1.11"]]
- :plugins [[lein-codox "0.10.3"]]
+ :dependencies [[org.clojure/clojure "1.7.0"]]
+ :plugins [[lein-codox "0.10.7"]]
:codox
{:output-path "codox"
:source-uri "http://github.com/ring-clojure/ring-codec/blob/{version}/{filepath}#L{line}"}
- :aliases {"test-all" ["with-profile" "default:+1.6:+1.7:+1.8:+1.9:+1.10" "test"]}
+ :aliases {"test-all" ["with-profile" "default:+1.8:+1.9:+1.10" "test"]}
:profiles
- {:dev {:dependencies [[criterium "0.4.4"]]}
- :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
- :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
+ {:dev {:dependencies [[criterium "0.4.6"]]}
:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}
- :1.10 {:dependencies [[org.clojure/clojure "1.10.0"]]}})
+ :1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]}})
=====================================
src/ring/util/codec.clj
=====================================
@@ -1,10 +1,10 @@
(ns ring.util.codec
"Functions for encoding and decoding data."
(:require [clojure.string :as str])
- (:import java.io.File
- java.util.Map
+ (:import java.util.Map
+ clojure.lang.MapEntry
[java.net URLEncoder URLDecoder]
- org.apache.commons.codec.binary.Base64))
+ [java.util Base64 StringTokenizer]))
(defn assoc-conj
"Associate a key with a value in a map. If the key already exists in the map,
@@ -78,13 +78,13 @@
(defn base64-encode
"Encode an array of bytes into a base64 encoded string."
- [unencoded]
- (String. (Base64/encodeBase64 unencoded)))
+ [^bytes unencoded]
+ (String. (.encode (Base64/getEncoder) unencoded)))
(defn base64-decode
"Decode a base64 encoded string into an array of bytes."
[^String encoded]
- (Base64/decodeBase64 (.getBytes encoded)))
+ (.decode (Base64/getDecoder) encoded))
(defprotocol ^:no-doc FormEncodeable
(form-encode* [x encoding]))
@@ -127,9 +127,25 @@
(form-decode-str encoded "UTF-8"))
([^String encoded ^String encoding]
(try
- (URLDecoder/decode encoded encoding)
+ (URLDecoder/decode encoded ^String (or encoding "UTF-8"))
(catch Exception _ nil))))
+(defn- tokenized [s delim]
+ (reify clojure.lang.IReduceInit
+ (reduce [_ f init]
+ (let [tokenizer (StringTokenizer. s delim)]
+ (loop [result init]
+ (if (.hasMoreTokens tokenizer)
+ (recur (f result (.nextToken tokenizer)))
+ result))))))
+
+(defn- split-key-value-pair [^String s]
+ (let [i (.indexOf s #=(int \=))]
+ (cond
+ (pos? i) (MapEntry. (.substring s 0 i) (.substring s (inc i)))
+ (zero? i) (MapEntry. "" (.substring s (inc i)))
+ :else (MapEntry. s ""))))
+
(defn form-decode
"Decode the supplied www-form-urlencoded string using the specified encoding,
or UTF-8 by default. If the encoded value is a string, a string is returned.
@@ -141,8 +157,11 @@
(form-decode-str encoded encoding)
(reduce
(fn [m param]
- (if-let [[k v] (str/split param #"=" 2)]
- (assoc-conj m (form-decode-str k encoding) (form-decode-str (or v "") encoding))
- m))
+ (let [kv (split-key-value-pair param)
+ k (form-decode-str (key kv) encoding)
+ v (form-decode-str (val kv) encoding)]
+ (if (and k v)
+ (assoc-conj m k v)
+ m)))
{}
- (str/split encoded #"&")))))
+ (tokenized encoded "&")))))
=====================================
test/ring/util/test/codec.clj
=====================================
@@ -53,7 +53,9 @@
(deftest test-form-decode-str
(is (= (form-decode-str "foo=bar+baz") "foo=bar baz"))
- (is (nil? (form-decode-str "%D"))))
+ (is (nil? (form-decode-str "%D")))
+ (is (= (form-decode-str "foo=bar+baz" nil) "foo=bar baz"))
+ (is (= (form-decode-str "foo=bar+baz" "UTF-8") "foo=bar baz")))
(deftest test-form-decode
(are [x y] (= (form-decode x) y)
@@ -65,6 +67,16 @@
"a=b%2Fc" {"a" "b/c"}
"a=b&c" {"a" "b" "c" ""}
"a=&b=c" {"a" "" "b" "c"}
- "a&b=c" {"a" "" "b" "c"})
+ "a&b=c" {"a" "" "b" "c"}
+ "=" {"" ""}
+ "a=" {"a" ""}
+ "=b" {"" "b"})
+ (testing "invalid URL encoding"
+ (are [x y] (= (form-decode x) y)
+ "%=b" {}
+ "a=%" {}
+ "%=%" {}))
(is (= (form-decode "a=foo%FE%FF%00%2Fbar" "UTF-16")
+ {"a" "foo/bar"}))
+ (is (= (form-decode "a=foo%2Fbar" nil)
{"a" "foo/bar"})))
View it on GitLab: https://salsa.debian.org/clojure-team/ring-codec-clojure/-/compare/53f70cb88091b5a2aa53c4c0874edaa07c6f8b18...2bba767afb0b238bb1e06c516afdae6ded14df04
--
View it on GitLab: https://salsa.debian.org/clojure-team/ring-codec-clojure/-/compare/53f70cb88091b5a2aa53c4c0874edaa07c6f8b18...2bba767afb0b238bb1e06c516afdae6ded14df04
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/1eac9c36/attachment.htm>
More information about the pkg-java-commits
mailing list