diff mbox series

[1/1] package/python-rsa: new package.

Message ID 20200207141629.31586-1-raphael.melotte@essensium.com
State Accepted
Headers show
Series [1/1] package/python-rsa: new package. | expand

Commit Message

Raphaël Mélotte Feb. 7, 2020, 2:16 p.m. UTC
Python-RSA is a pure-Python RSA implementation.

Signed-off-by: Raphaël Mélotte <raphael.melotte@essensium.com>
---
 DEVELOPERS                         |  3 +++
 package/Config.in                  |  1 +
 package/python-rsa/Config.in       | 10 ++++++++++
 package/python-rsa/python-rsa.hash |  6 ++++++
 package/python-rsa/python-rsa.mk   | 15 +++++++++++++++
 5 files changed, 35 insertions(+)
 create mode 100644 package/python-rsa/Config.in
 create mode 100644 package/python-rsa/python-rsa.hash
 create mode 100644 package/python-rsa/python-rsa.mk

Comments

Thomas Petazzoni Aug. 4, 2021, 10:01 p.m. UTC | #1
Hello Raphaël,

About 1.5 years after your patch was sent, I finally applied it to our
next branch. I did a number of changes, see below.

On Fri,  7 Feb 2020 15:16:28 +0100
Raphaël Mélotte <raphael.melotte@essensium.com> wrote:

> diff --git a/DEVELOPERS b/DEVELOPERS
> index d8ea23e0b3..b470e34cc5 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2076,6 +2076,9 @@ N:	Rahul Jain <rahul.jain@imgtec.com>
>  F:	package/uhttpd/
>  F:	package/ustream-ssl/
>  
> +N:  Raphaël Mélotte <raphael.melotte@essensium.com>
> +F:  package/python-rsa/

The indentation was not correct here, and anyway you've had several
packages added since then, so it did not apply as-is, but that's not a
big deal.

> diff --git a/package/python-rsa/Config.in b/package/python-rsa/Config.in
> new file mode 100644
> index 0000000000..c02601105b
> --- /dev/null
> +++ b/package/python-rsa/Config.in
> @@ -0,0 +1,10 @@
> +config BR2_PACKAGE_PYTHON_RSA
> +	bool "python-rsa"

As I've updated to a newer release of python-rsa, which is Python 3.x
only, I've added a dependency on BR2_PACKAGE_PYTHON3.

> +	select BR2_PACKAGE_PYTHON_PYASN1

This should have had the annotation "# runtime".

> diff --git a/package/python-rsa/python-rsa.hash b/package/python-rsa/python-rsa.hash
> new file mode 100644
> index 0000000000..c93c2243fb
> --- /dev/null
> +++ b/package/python-rsa/python-rsa.hash
> @@ -0,0 +1,6 @@
> +# md5, sha256 from https://pypi.org/rsa/json:
> +md5  9f9af433a16868b616fc609215e91ddb  rsa-4.0.tar.gz
> +sha256  1a836406405730121ae9823e19c6e806c62bbad73f890574fff50efa4122c487  rsa-4.0.tar.gz

Having the md5 hash is not needed when we have the sha256, so I kept
only the sha265.

> +PYTHON_RSA_VERSION = 4.0

I updated to 4.7.2

> +PYTHON_RSA_SOURCE = rsa-$(PYTHON_RSA_VERSION).tar.gz
> +PYTHON_RSA_SITE = https://files.pythonhosted.org/packages/cb/d0/8f99b91432a60ca4b1cd478fd0bdf28c1901c58e3a9f14f4ba3dba86b57f
> +PYTHON_RSA_SETUP_TYPE = setuptools
> +PYTHON_RSA_LICENSE = APACHE

This is not a valid SPDX code. The valid code is Apache-2.0.

> +PYTHON_RSA_LICENSE_FILES = LICENSE
> +PYTHON_RSA_DEPENDENCIES = python-pyasn1

This is not a build-time dependency, only a runtime one, so I dropped
this line. Having the "select" in the Config.in file is enough for
runtime dependencies.

Also, I've added a test case in support/testing/ so that python-rsa
gets runtime tested in our infrastructure. Feel free to have a look at
the final commit at
https://git.buildroot.org/buildroot/commit/?h=next&id=58c99c957b002a9d6fa7de8df24c87df379c9faf
to see how the test case is implemented, it could be useful for your
future contributions.

Thanks a lot,

Thomas
Raphaël Mélotte Aug. 10, 2021, 7:11 p.m. UTC | #2
Hello,

On 8/5/21 12:01 AM, Thomas Petazzoni wrote:
> About 1.5 years after your patch was sent, I finally applied it to our
> next branch. I did a number of changes, see below.

Thanks for the useful comments, I'll take them into account for any future 
contribution.


> Also, I've added a test case in support/testing/ so that python-rsa
> gets runtime tested in our infrastructure. Feel free to have a look at
> the final commit at
> https://git.buildroot.org/buildroot/commit/?h=next&id=58c99c957b002a9d6fa7de8df24c87df379c9faf
> to see how the test case is implemented, it could be useful for your
> future contributions.

Interesting! I'm curious to try it locally as well.

Thanks,

Raphaël
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index d8ea23e0b3..b470e34cc5 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2076,6 +2076,9 @@  N:	Rahul Jain <rahul.jain@imgtec.com>
 F:	package/uhttpd/
 F:	package/ustream-ssl/
 
+N:  Raphaël Mélotte <raphael.melotte@essensium.com>
+F:  package/python-rsa/
+
 N:	Refik Tuzakli <tuzakli.refik@gmail.com>
 F:	package/paho-mqtt-cpp/
 
diff --git a/package/Config.in b/package/Config.in
index bad4f9cba6..d190d18874 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1106,6 +1106,7 @@  menu "External python modules"
 	source "package/python-requests-toolbelt/Config.in"
 	source "package/python-rpi-gpio/Config.in"
 	source "package/python-rpi-ws281x/Config.in"
+	source "package/python-rsa/Config.in"
 	source "package/python-rtslib-fb/Config.in"
 	source "package/python-scandir/Config.in"
 	source "package/python-scapy/Config.in"
diff --git a/package/python-rsa/Config.in b/package/python-rsa/Config.in
new file mode 100644
index 0000000000..c02601105b
--- /dev/null
+++ b/package/python-rsa/Config.in
@@ -0,0 +1,10 @@ 
+config BR2_PACKAGE_PYTHON_RSA
+	bool "python-rsa"
+	select BR2_PACKAGE_PYTHON_PYASN1
+	help
+	  Python-RSA is a pure-Python RSA implementation. It supports
+	  encryption and decryption, signing and verifying signatures,
+	  and key generation according to PKCS\#1 version 1.5. It can be
+	  used as a Python library as well as on the command line.
+
+	  https://stuvel.eu/rsa
diff --git a/package/python-rsa/python-rsa.hash b/package/python-rsa/python-rsa.hash
new file mode 100644
index 0000000000..c93c2243fb
--- /dev/null
+++ b/package/python-rsa/python-rsa.hash
@@ -0,0 +1,6 @@ 
+# md5, sha256 from https://pypi.org/rsa/json:
+md5  9f9af433a16868b616fc609215e91ddb  rsa-4.0.tar.gz
+sha256  1a836406405730121ae9823e19c6e806c62bbad73f890574fff50efa4122c487  rsa-4.0.tar.gz
+
+# Locally computed checksums:
+sha256	073f28b7d389c8fe74f607e17c27f81eaa5ace69edc43a884f23f41b41c5c726  LICENSE
diff --git a/package/python-rsa/python-rsa.mk b/package/python-rsa/python-rsa.mk
new file mode 100644
index 0000000000..e847eaffb1
--- /dev/null
+++ b/package/python-rsa/python-rsa.mk
@@ -0,0 +1,15 @@ 
+################################################################################
+#
+# python-rsa
+#
+################################################################################
+
+PYTHON_RSA_VERSION = 4.0
+PYTHON_RSA_SOURCE = rsa-$(PYTHON_RSA_VERSION).tar.gz
+PYTHON_RSA_SITE = https://files.pythonhosted.org/packages/cb/d0/8f99b91432a60ca4b1cd478fd0bdf28c1901c58e3a9f14f4ba3dba86b57f
+PYTHON_RSA_SETUP_TYPE = setuptools
+PYTHON_RSA_LICENSE = APACHE
+PYTHON_RSA_LICENSE_FILES = LICENSE
+PYTHON_RSA_DEPENDENCIES = python-pyasn1
+
+$(eval $(python-package))