unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#64808] [PATCH] gnu: Add andorid-sdkmanager.
@ 2023-07-23 18:41 Distopico
  2023-07-24 12:58 ` Andreas Enge
  0 siblings, 1 reply; 7+ messages in thread
From: Distopico @ 2023-07-23 18:41 UTC (permalink / raw)
  To: 64808; +Cc: maxim.cournoyer, andreas


A drop-in replacement for sdkmanager from the Android SDK by F-droid project.

* gnu/packages/android.scm (andorid-sdkmanager): New variables.
---
 gnu/packages/android.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index f35c2398bd..24f5fd2893 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2020 Sergey Trofimov <sarg@sarg.org.ru>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -721,6 +722,32 @@ (define-public fastboot
      "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
     (license license:asl2.0)))
 
+(define-public andorid-sdkmanager
+  (package
+    (name "android-sdkmanager")
+    (version "0.6.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "sdkmanager" version ".tar.gz"))
+              (sha256
+               (base32
+                "11as7n2mj3nbqsqb3ivyv9985n73i022s748qvjg36cs8ig50afx"))))
+    (build-system python-build-system)
+    (inputs (list python-requests python-argcomplete python-urllib3))
+    (propagated-inputs (list gnupg))
+    (home-page "https://gitlab.com/fdroid/sdkmanager")
+    (synopsis
+     "Drop-in replacement for sdkmanager from the Android SDK written in Python")
+    (description
+     "This package provides an drop-in replacement for sdkmanager from the Android SDK
+written in Python from fdroid project.  It implements the exact API of the sdkmanager
+command line.  It only deviates from that API if it can be done while being
+100% compatible.
+
+The project also attempts to maintain the same terminal output so it can be compatible
+with things that scrape sdkmanager output.")
+    (license license:agpl3+)))
+
 (define-public android-udev-rules
   (package
     (name "android-udev-rules")

base-commit: 13cb9b302868b5a966a6ae177412c474084f4bf1
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#64808] [PATCH] gnu: Add andorid-sdkmanager.
  2023-07-23 18:41 [bug#64808] [PATCH] gnu: Add andorid-sdkmanager Distopico
@ 2023-07-24 12:58 ` Andreas Enge
  2023-07-24 13:04   ` Andreas Enge
  2023-07-24 14:51   ` Distopico
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Enge @ 2023-07-24 12:58 UTC (permalink / raw)
  To: Distopico; +Cc: 64808, maxim.cournoyer

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

Hello,

thanks for the new package!

According to our naming scheme, we should either call it "sdkmanager"
(the upstream name), or "python-sdkmanager" (as a Python library). Given
that it is mainly an executable, I opted for the first one; also since the
second one is a bit misleading (it does not manage SDKs for python).

I have removed the propagated input gnutls; propagated inputs should be
used very sparingly, and so far I did not see where it would be required.

I am not sure the package works. When running
   sdkmanager --sdk_root /tmp/sdk --install
it complains that it has no rights on /opt/android-sdk. I was just guessing
how it works from "sdkmanager --help"; should --sdk_root not set the place
where to install the SDKs?

"sdkmanager --list" does seem to work.

I am attaching a new version of the patch; what do you think?

Andreas


[-- Attachment #2: 0001-gnu-Add-sdkmanager.patch --]
[-- Type: text/plain, Size: 2540 bytes --]

From fe501c98e105a0ee76b34737d8071608f130c76b Mon Sep 17 00:00:00 2001
Message-ID: <fe501c98e105a0ee76b34737d8071608f130c76b.1690203197.git.andreas@enge.fr>
From: Distopico <distopico@riseup.net>
Date: Sun, 23 Jul 2023 13:41:32 -0500
Subject: [PATCH] gnu: Add sdkmanager.

* gnu/packages/android.scm (sdkmanager): New variable.

Co-authored-by: Andreas Enge <andreas@enge.fr>
---
 gnu/packages/android.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index f35c2398bd..f9c24226b8 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2020 Sergey Trofimov <sarg@sarg.org.ru>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -38,6 +39,7 @@ (define-module (gnu packages android)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system trivial)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
@@ -721,6 +723,28 @@ (define-public fastboot
      "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
     (license license:asl2.0)))
 
+(define-public sdkmanager
+  (package
+    (name "sdkmanager")
+    (version "0.6.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "sdkmanager" version ".tar.gz"))
+              (sha256
+               (base32
+                "11as7n2mj3nbqsqb3ivyv9985n73i022s748qvjg36cs8ig50afx"))))
+    (build-system pyproject-build-system)
+    (inputs (list python-requests python-argcomplete python-urllib3))
+    (home-page "https://gitlab.com/fdroid/sdkmanager")
+    (synopsis
+     "Replacement for Android sdkmanager written in Python")
+    (description
+     "This package provides a drop-in replacement for sdkmanager from
+the Android SDK.  It is written in Python and part of the F-Droid
+project.  It implements the exact API of the Android sdkmanager command
+line.  The project also attempts to maintain the same terminal output.")
+    (license license:agpl3+)))
+
 (define-public android-udev-rules
   (package
     (name "android-udev-rules")

base-commit: cf9904bcc8dd03e73675475bb4d8746dc434e415
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#64808] [PATCH] gnu: Add andorid-sdkmanager.
  2023-07-24 12:58 ` Andreas Enge
@ 2023-07-24 13:04   ` Andreas Enge
  2023-07-24 14:51   ` Distopico
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Enge @ 2023-07-24 13:04 UTC (permalink / raw)
  To: Distopico; +Cc: 64808, maxim.cournoyer

Something like this works:
   ANDROID_HOME=/tmp/sdk sdkmanager --install tools
and creates a directory
   /tmp/sdk/tools
with stuff in it.

So if it works for you, I would be happy to push the new package.

Andreas





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#64808] [PATCH] gnu: Add andorid-sdkmanager.
  2023-07-24 12:58 ` Andreas Enge
  2023-07-24 13:04   ` Andreas Enge
@ 2023-07-24 14:51   ` Distopico
  2023-07-24 15:43     ` Andreas Enge
  1 sibling, 1 reply; 7+ messages in thread
From: Distopico @ 2023-07-24 14:51 UTC (permalink / raw)
  To: Andreas Enge; +Cc: 64808, maxim.cournoyer


[-- Attachment #1.1: Type: text/plain, Size: 1400 bytes --]


On 2023-07-24, Andreas Enge <andreas@enge.fr> wrote:

> Hello,
>
> thanks for the new package!
>
> According to our naming scheme, we should either call it "sdkmanager"
> (the upstream name), or "python-sdkmanager" (as a Python library). Given
> that it is mainly an executable, I opted for the first one; also since the
> second one is a bit misleading (it does not manage SDKs for python).
>
> I have removed the propagated input gnutls; propagated inputs should be
> used very sparingly, and so far I did not see where it would be required.
>
> I am not sure the package works. When running
>    sdkmanager --sdk_root /tmp/sdk --install
> it complains that it has no rights on /opt/android-sdk. I was just guessing
> how it works from "sdkmanager --help"; should --sdk_root not set the place
> where to install the SDKs?
>
> "sdkmanager --list" does seem to work.
>
> I am attaching a new version of the patch; what do you think?
>
> Andreas
>
> [2. text/plain; 0001-gnu-Add-sdkmanager.patch]...

The name change make sense, thank you and ANDROID_HOME is the way
according with the documentation, but "gnupg" is necessary, if you test
with `--container -N` you will se the error:
`FileNotFoundError: [Errno 2] No such file or directory: 'gpgv'`
after run `sdkmanager --list`, "gpgv" is part of gnupg package, for that
reason I added it in "propagated-inputs". attached a patch with that
change.


[-- Attachment #1.2: 0001-gnu-Add-andorid-sdkmanager.patch --]
[-- Type: text/x-patch, Size: 2514 bytes --]

From 60c09ab615cb929be2215adc6b85ce3c8cd3fcfa Mon Sep 17 00:00:00 2001
From: Distopico <distopico@riseup.net>
Date: Sun, 23 Jul 2023 13:37:39 -0500
Subject: [PATCH] gnu: Add andorid-sdkmanager.

* gnu/packages/android.scm (sdkmanager): New variables.
---
 gnu/packages/android.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index f35c2398bd..1d36f9aa7d 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2020 Sergey Trofimov <sarg@sarg.org.ru>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -52,6 +53,7 @@ (define-module (gnu packages android)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages python)
+  #:use-module (guix build-system pyproject)
   #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
@@ -721,6 +723,29 @@ (define-public fastboot
      "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
     (license license:asl2.0)))
 
+(define-public sdkmanager
+  (package
+    (name "sdkmanager")
+    (version "0.6.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "sdkmanager" version ".tar.gz"))
+              (sha256
+               (base32
+                "11as7n2mj3nbqsqb3ivyv9985n73i022s748qvjg36cs8ig50afx"))))
+    (build-system pyproject-build-system)
+    (inputs (list python-requests python-argcomplete python-urllib3))
+    (propagated-inputs (list gnupg))
+    (home-page "https://gitlab.com/fdroid/sdkmanager")
+    (synopsis
+     "Replacement for Android sdkmanager written in Python")
+    (description
+     "This package provides a drop-in replacement for sdkmanager from
+the Android SDK.  It is written in Python and part of the F-Droid
+project.  It implements the exact API of the Android sdkmanager command
+line.  The project also attempts to maintain the same terminal output.")
+    (license license:agpl3+)))
+
 (define-public android-udev-rules
   (package
     (name "android-udev-rules")

base-commit: 13cb9b302868b5a966a6ae177412c474084f4bf1
-- 
2.41.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#64808] [PATCH] gnu: Add andorid-sdkmanager.
  2023-07-24 14:51   ` Distopico
@ 2023-07-24 15:43     ` Andreas Enge
  2023-07-24 17:23       ` Distopico
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Enge @ 2023-07-24 15:43 UTC (permalink / raw)
  To: Distopico; +Cc: 64808, maxim.cournoyer

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

Am Mon, Jul 24, 2023 at 09:51:35AM -0500 schrieb Distopico:
> The name change make sense, thank you and ANDROID_HOME is the way
> according with the documentation, but "gnupg" is necessary, if you test
> with `--container -N` you will se the error:
> `FileNotFoundError: [Errno 2] No such file or directory: 'gpgv'`
> after run `sdkmanager --list`, "gpgv" is part of gnupg package, for that
> reason I added it in "propagated-inputs". attached a patch with that
> change.

Ah, I see, of course I did have gnupg in my profile already...
I think a better option is to replace the one occurrence of "gpgv"
in the script by the absolute path to the binary; this also registers
a reference with the package.

Could you test the attached patch, please?

Andreas


[-- Attachment #2: 0001-gnu-Add-sdkmanager.patch --]
[-- Type: text/plain, Size: 2956 bytes --]

From 18c42e27cca61c868fc6b5d06ab8e13cc0a02302 Mon Sep 17 00:00:00 2001
Message-ID: <18c42e27cca61c868fc6b5d06ab8e13cc0a02302.1690213156.git.andreas@enge.fr>
From: Distopico <distopico@riseup.net>
Date: Sun, 23 Jul 2023 13:41:32 -0500
Subject: [PATCH] gnu: Add sdkmanager.

* gnu/packages/android.scm (sdkmanager): New variable.

Co-authored-by: Andreas Enge <andreas@enge.fr>
---
 gnu/packages/android.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index f35c2398bd..b9b8b89208 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2020 Sergey Trofimov <sarg@sarg.org.ru>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -38,6 +39,7 @@ (define-module (gnu packages android)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system trivial)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
@@ -721,6 +723,35 @@ (define-public fastboot
      "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
     (license license:asl2.0)))
 
+(define-public sdkmanager
+  (package
+    (name "sdkmanager")
+    (version "0.6.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "sdkmanager" version ".tar.gz"))
+              (sha256
+               (base32
+                "11as7n2mj3nbqsqb3ivyv9985n73i022s748qvjg36cs8ig50afx"))))
+    (build-system pyproject-build-system)
+    (inputs (list python-requests python-argcomplete python-urllib3 gnupg))
+    (arguments
+     (list #:phases #~(modify-phases %standard-phases
+                        (add-before 'build 'patch-gnupg
+                          (lambda _
+                            (substitute* "sdkmanager.py"
+                              (("gpgv")
+                               (string-append #$(this-package-input "gnupg")
+                                              "/bin/gpgv"))))))))
+    (home-page "https://gitlab.com/fdroid/sdkmanager")
+    (synopsis "Replacement for Android sdkmanager written in Python")
+    (description
+     "This package provides a drop-in replacement for sdkmanager from
+the Android SDK.  It is written in Python and part of the F-Droid
+project.  It implements the exact API of the Android sdkmanager command
+line.  The project also attempts to maintain the same terminal output.")
+    (license license:agpl3+)))
+
 (define-public android-udev-rules
   (package
     (name "android-udev-rules")

base-commit: cf9904bcc8dd03e73675475bb4d8746dc434e415
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#64808] [PATCH] gnu: Add andorid-sdkmanager.
  2023-07-24 15:43     ` Andreas Enge
@ 2023-07-24 17:23       ` Distopico
  2023-07-24 18:23         ` bug#64808: " Andreas Enge
  0 siblings, 1 reply; 7+ messages in thread
From: Distopico @ 2023-07-24 17:23 UTC (permalink / raw)
  To: Andreas Enge; +Cc: 64808, maxim.cournoyer

That patch works fine from my side, thank you.

On 2023-07-24, Andreas Enge <andreas@enge.fr> wrote:

> Am Mon, Jul 24, 2023 at 09:51:35AM -0500 schrieb Distopico:
>> The name change make sense, thank you and ANDROID_HOME is the way
>> according with the documentation, but "gnupg" is necessary, if you test
>> with `--container -N` you will se the error:
>> `FileNotFoundError: [Errno 2] No such file or directory: 'gpgv'`
>> after run `sdkmanager --list`, "gpgv" is part of gnupg package, for that
>> reason I added it in "propagated-inputs". attached a patch with that
>> change.
>
> Ah, I see, of course I did have gnupg in my profile already...
> I think a better option is to replace the one occurrence of "gpgv"
> in the script by the absolute path to the binary; this also registers
> a reference with the package.
>
> Could you test the attached patch, please?
>
> Andreas
>
> [2. text/plain; 0001-gnu-Add-sdkmanager.patch]...





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#64808: [PATCH] gnu: Add andorid-sdkmanager.
  2023-07-24 17:23       ` Distopico
@ 2023-07-24 18:23         ` Andreas Enge
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Enge @ 2023-07-24 18:23 UTC (permalink / raw)
  To: Distopico; +Cc: maxim.cournoyer, 64808-done

Am Mon, Jul 24, 2023 at 12:23:44PM -0500 schrieb Distopico:
> That patch works fine from my side, thank you.

Excellent, thank you, and congratulations for your first package in Guix!
I have just pushed the commit and am closing the issue.

Andreas





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-07-24 18:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-23 18:41 [bug#64808] [PATCH] gnu: Add andorid-sdkmanager Distopico
2023-07-24 12:58 ` Andreas Enge
2023-07-24 13:04   ` Andreas Enge
2023-07-24 14:51   ` Distopico
2023-07-24 15:43     ` Andreas Enge
2023-07-24 17:23       ` Distopico
2023-07-24 18:23         ` bug#64808: " Andreas Enge

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).