diff mbox series

[bug#49859,3/6] gnu: Remove adb and fastboot.

Message ID 98b6d8eee70e27683b6617ba92afd7a353514e45.1628040049.git.leo@famulari.name
State Accepted
Headers show
Series [bug#49859,1/6] gnu: Remove pidentd. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Leo Famulari Aug. 4, 2021, 1:20 a.m. UTC
As discussed in <https://bugs.gnu.org/46602>, this version of adb does
not support a current release of OpenSSL.

* gnu/packages/android.scm (adb, fastboot): Remove variables.
---
 gnu/packages/android.scm | 95 ----------------------------------------
 1 file changed, 95 deletions(-)

Comments

Julien Lepiller Aug. 4, 2021, 2:42 a.m. UTC | #1
Gasp… do we have no other choice? Adb and fastboot are really useful to me.

Le 3 août 2021 21:20:46 GMT-04:00, Leo Famulari <leo@famulari.name> a écrit :
>As discussed in <https://bugs.gnu.org/46602>, this version of adb does
>not support a current release of OpenSSL.
>
>* gnu/packages/android.scm (adb, fastboot): Remove variables.
>---
> gnu/packages/android.scm | 95 ----------------------------------------
> 1 file changed, 95 deletions(-)
>
>diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
>index eb538f6540..746a104d43 100644
>--- a/gnu/packages/android.scm
>+++ b/gnu/packages/android.scm
>@@ -351,53 +351,6 @@ various Android core host applications.")
> various Android core host applications.")
>     (license license:asl2.0)))
> 
>-(define-public adb
>-  (package
>-    (name "adb")
>-    (version (android-platform-version))
>-    (source (android-platform-system-core version))
>-    (build-system android-ndk-build-system)
>-    (arguments
>-     `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
>-       #:make-flags
>-       (list "CFLAGS=-Wno-error"
>-             "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
>-             (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
>-                            "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
>-       #:phases
>-       (modify-phases %standard-phases
>-         (add-after 'unpack 'enter-source
>-           (lambda _ (chdir "adb") #t))
>-         (add-after 'enter-source 'glibc-compat
>-           (lambda _
>-             ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
>-             (substitute* "usb_linux.cpp"
>-               (("#include <sys/types.h>" all)
>-                (string-append all "\n#include <sys/sysmacros.h>\n")))
>-             #t))
>-         (add-after 'enter-source 'make-libs-available
>-           (lambda* (#:key inputs outputs #:allow-other-keys)
>-             (substitute* "Android.mk"
>-              (("libcrypto_static") "libcrypto"))
>-             #t))
>-         (add-after 'install 'install-headers
>-           (lambda* (#:key inputs outputs #:allow-other-keys)
>-             (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
>-             #t)))))
>-    (inputs
>-     `(("android-libbase" ,android-libbase)
>-       ("android-libcutils" ,android-libcutils)
>-       ("android-liblog" ,android-liblog)
>-       ("openssl" ,openssl-1.0)))
>-    (home-page "https://developer.android.com/studio/command-line/adb.html")
>-    (synopsis "Android Debug Bridge")
>-    (description
>-     "@command{adb} is a versatile command line tool that lets you communicate
>-with an emulator instance or connected Android device.  It facilitates a variety
>-of device actions, such as installing and debugging apps, and it provides access
>-to a Unix shell that can run commands on the connected device or emulator.")
>-    (license license:asl2.0)))
>-
> (define-public mkbootimg
>   (package
>     (name "mkbootimg")
>@@ -652,54 +605,6 @@ file system.")
>     (description "@code{android-libutils} provides utilities for Android NDK developers.")
>     (license license:asl2.0)))
> 
>-(define-public fastboot
>-  (package
>-    (name "fastboot")
>-    (version (android-platform-version))
>-    (source (android-platform-system-core version))
>-    (build-system android-ndk-build-system)
>-    (arguments
>-     `(#:phases
>-       (modify-phases %standard-phases
>-         (add-after 'unpack 'enter-source
>-           (lambda _
>-             (chdir "fastboot")
>-             #t))
>-         (add-after 'enter-source 'patch-source
>-           (lambda _
>-             (substitute* "Android.mk"
>-              (("libext4_utils_host") "libext4_utils_host libselinux libpcre"))
>-             #t))
>-         (replace 'install
>-           (lambda* (#:key outputs #:allow-other-keys)
>-             (let* ((out (assoc-ref outputs "out"))
>-                    (lib (string-append out "/lib"))
>-                    (bin (string-append out "/bin")))
>-               (install-file "fastboot" bin)
>-               #t))))))
>-    (inputs
>-     `(("adb" ,adb)
>-       ("android-safe-iop" ,android-safe-iop)
>-       ("android-ext4-utils" ,android-ext4-utils)
>-       ("android-f2fs-utils" ,android-f2fs-utils)
>-       ("android-libbase" ,android-libbase)
>-       ("android-libcutils" ,android-libcutils)
>-       ("android-liblog" ,android-liblog)
>-       ("android-libutils" ,android-libutils)
>-       ("android-libsparse" ,android-libsparse)
>-       ("android-libziparchive" ,android-libziparchive)
>-       ("android-libselinux" ,android-libselinux)
>-       ("pcre" ,pcre)
>-       ("mkbootimg" ,mkbootimg)
>-       ("zlib" ,zlib)))
>-    (native-inputs
>-     `(("xz" ,xz)))
>-    (home-page "https://developer.android.com/studio/command-line/")
>-    (synopsis "Android image flasher")
>-    (description
>-     "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
>-    (license license:asl2.0)))
>-
> (define-public android-udev-rules
>   (package
>     (name "android-udev-rules")
>-- 
>2.32.0
>
>
>
>
Leo Famulari Aug. 4, 2021, 2:53 a.m. UTC | #2
On Tue, Aug 03, 2021 at 10:42:50PM -0400, Julien Lepiller wrote:
> Gasp… do we have no other choice? Adb and fastboot are really useful to me.

I think there must be a new version of adb that doesn't use the old
unsupported OpenSSL. Do you have time to check on that?

The unsupported OpenSSL version is the 1.0 series.

The supported version is 1.1.1.

Looking at android.scm, I see that our packages are based on the Git tag
7.1.2_r36 from this repo:

https://android.googlesource.com/platform/system/core
Julien Lepiller Aug. 4, 2021, 2:58 a.m. UTC | #3
There are more recent versions, unfortunately this is the latest version we can support. Later versions use a different build system, soong, that require much more work. I have a wip for that, but it will need more work to be really useful and be able to build adb and fastboot.

Le 3 août 2021 22:53:03 GMT-04:00, Leo Famulari <leo@famulari.name> a écrit :
>On Tue, Aug 03, 2021 at 10:42:50PM -0400, Julien Lepiller wrote:
>> Gasp… do we have no other choice? Adb and fastboot are really useful to me.
>
>I think there must be a new version of adb that doesn't use the old
>unsupported OpenSSL. Do you have time to check on that?
>
>The unsupported OpenSSL version is the 1.0 series.
>
>The supported version is 1.1.1.
>
>Looking at android.scm, I see that our packages are based on the Git tag
>7.1.2_r36 from this repo:
>
>https://android.googlesource.com/platform/system/core
Leo Famulari Aug. 4, 2021, 3:01 a.m. UTC | #4
On Tue, Aug 03, 2021 at 10:53:03PM -0400, Leo Famulari wrote:
> Looking at android.scm, I see that our packages are based on the Git tag
> 7.1.2_r36 from this repo:

I checked the license for 'libcrypto.so' on my phone, which is on
Android 11. And they are not even using OpenSSL anymore, but instead
BoringSSL. So, maybe there is some intermediate version of Android
between 7 and 11 that uses OpenSSL 1.1.1 (released September 2018).

https://boringssl.googlesource.com/boringssl/

Or, maybe we can move these packages (openssl-1.0 and these Android 7
packages) to guix-past. Or maybe someone has some other ideas.
Leo Famulari Aug. 4, 2021, 3:21 a.m. UTC | #5
On Tue, Aug 03, 2021 at 10:58:46PM -0400, Julien Lepiller wrote:
> There are more recent versions, unfortunately this is the latest version we can support. Later versions use a different build system, soong, that require much more work. I have a wip for that, but it will need more work to be really useful and be able to build adb and fastboot.

I see. Well, the packages could be moved to guix-past for now. Let's
wait and see what others have to say.

This version of OpenSSL became unsupported at the end of 2019.
Leo Famulari Aug. 4, 2021, 4:29 p.m. UTC | #6
On Tue, Aug 03, 2021 at 11:21:20PM -0400, Leo Famulari wrote:
> On Tue, Aug 03, 2021 at 10:58:46PM -0400, Julien Lepiller wrote:
> > There are more recent versions, unfortunately this is the latest version we can support. Later versions use a different build system, soong, that require much more work. I have a wip for that, but it will need more work to be really useful and be able to build adb and fastboot.
> 
> I see. Well, the packages could be moved to guix-past for now. Let's
> wait and see what others have to say.

I got more feedback on #guix IRC that we should not remove adb /
fastboot, because it's an important tool for freeing Android
smartphones.

Is there a reason we shouldn't use guix-past to hold these packages?
Efraim Flashner Aug. 5, 2021, 8:11 a.m. UTC | #7
On Wed, Aug 04, 2021 at 12:29:10PM -0400, Leo Famulari wrote:
> On Tue, Aug 03, 2021 at 11:21:20PM -0400, Leo Famulari wrote:
> > On Tue, Aug 03, 2021 at 10:58:46PM -0400, Julien Lepiller wrote:
> > > There are more recent versions, unfortunately this is the latest version we can support. Later versions use a different build system, soong, that require much more work. I have a wip for that, but it will need more work to be really useful and be able to build adb and fastboot.
> > 
> > I see. Well, the packages could be moved to guix-past for now. Let's
> > wait and see what others have to say.
> 
> I got more feedback on #guix IRC that we should not remove adb /
> fastboot, because it's an important tool for freeing Android
> smartphones.
> 
> Is there a reason we shouldn't use guix-past to hold these packages?
> 

I'm in favor of moving openssl-1.0 to guix-past, it's the perfect type
of package to go there. Upstream has declared it dead and no one is
going to touch it. Similar to how qt-4 moved there a few months ago.

ADB and fastboot are still useful, and (ignoring some networking options
they apparently have) are localhost only. I'd rather leave them both for
now with an eye to shoehorning in an updated version somehow, hiding
openssl-1.0, and adding a note to remove it as soon as nothing needs it
anymore.
Ludovic Courtès Aug. 11, 2021, 2:08 p.m. UTC | #8
Hi,

Efraim Flashner <efraim@flashner.co.il> skribis:

> I'm in favor of moving openssl-1.0 to guix-past, it's the perfect type
> of package to go there. Upstream has declared it dead and no one is
> going to touch it. Similar to how qt-4 moved there a few months ago.

Agreed. However…

> ADB and fastboot are still useful, and (ignoring some networking options
> they apparently have) are localhost only. I'd rather leave them both for
> now with an eye to shoehorning in an updated version somehow, hiding
> openssl-1.0, and adding a note to remove it as soon as nothing needs it
> anymore.

… this means we need to keep openssl 1.0, hidden, in Guix proper.  That
sounds like a reasonable option to me.  Leo’s approach of progressively
removing anything that depends on it sounds good to me nevertheless, but
it’s good that we can weigh the pros and cons for each candidate.

Julien said upgrading ADB/fastboot is not an option, at least not now.

Another option would be to patch ADB so it can use OpenSSL 1.1.
Hopefully the changes can be relatively simple and isolated.  Worth
trying?

Ludo’.
Giovanni Biscuolo Aug. 11, 2021, 3:18 p.m. UTC | #9
Hi,

Ludovic Courtès <ludo@gnu.org> writes:

[...]

> Another option would be to patch ADB so it can use OpenSSL 1.1.
> Hopefully the changes can be relatively simple and isolated.  Worth
> trying?

AFAIU Debian was applying this patch:
https://sources.debian.org/patches/android-platform-system-core/1:7.0.0+r33-1/adb_libssl_11.diff/

in the adb package ver 1:7.0.0+r33-1

OpenWRT was (is?) applying this (more "invasive") patch:
https://github.com/openwrt/openwrt/pull/971/files

I'll try the Debian one and send a patch if I succeed.

Thanks! Gio'
Leo Famulari Aug. 11, 2021, 5:52 p.m. UTC | #10
On Wed, Aug 11, 2021 at 05:18:38PM +0200, Giovanni Biscuolo wrote:
> Hi,
> 
> Ludovic Courtès <ludo@gnu.org> writes:
> 
> [...]
> 
> > Another option would be to patch ADB so it can use OpenSSL 1.1.
> > Hopefully the changes can be relatively simple and isolated.  Worth
> > trying?
> 
> AFAIU Debian was applying this patch:
> https://sources.debian.org/patches/android-platform-system-core/1:7.0.0+r33-1/adb_libssl_11.diff/
> 
> in the adb package ver 1:7.0.0+r33-1
> 
> OpenWRT was (is?) applying this (more "invasive") patch:
> https://github.com/openwrt/openwrt/pull/971/files
> 
> I'll try the Debian one and send a patch if I succeed.

Awesome, thanks! Let us know how it goes. I'll proceed with hiding
openssl-1.0 and removing the other packages (not adb or fastboot) in the
meantime.
Pierre Langlois Aug. 11, 2021, 6:13 p.m. UTC | #11
Hi Julien and Leo,

Julien Lepiller <julien@lepiller.eu> writes:

> There are more recent versions, unfortunately this is the latest version we can support. Later versions use a different build system, soong, that require much more work. I have a wip for that, but it will need more work to be really useful and be able to build adb and
> fastboot.

Recently I noticed this repository, by looking at how Archlinux managed
to package newer versions of adb/fastboot: https://github.com/nmeum/android-tools

I wonder if using it is something you've considered? Using submodules to
gather all the sources isn't very guix-y, but at least it's using cmake
so we wouldn't need to package Android build tools.

Just thought I'd make sure we're aware this exists! I too would be said
to see adb/fastboot go away :-).

Thanks,
Pierre
Giovanni Biscuolo Aug. 12, 2021, 5:24 p.m. UTC | #12
Hi Leo,

Leo Famulari <leo@famulari.name> writes:

[...]

>> AFAIU Debian was applying this patch:
>> https://sources.debian.org/patches/android-platform-system-core/1:7.0.0+r33-1/adb_libssl_11.diff/
>> 
>> in the adb package ver 1:7.0.0+r33-1
>> 
>> OpenWRT was (is?) applying this (more "invasive") patch:
>> https://github.com/openwrt/openwrt/pull/971/files
>> 
>> I'll try the Debian one and send a patch if I succeed.
>
> Awesome, thanks! Let us know how it goes.

It seems I did it! :-D (fortunately it was really easy)

I sent a patch as bug#50029.

AFAIU the adb patch also fixes the issue with fastboot, since fastboot
does not directly depend on openssl but indirectly via adb and
android-libselinux that already have openssl (1.1) as input: right?

> I'll proceed with hiding openssl-1.0 and removing the other packages
> (not adb or fastboot) in the meantime.

Thank you and happy hacking!

Ciao, Gio'
Leo Famulari Aug. 15, 2021, 10:10 p.m. UTC | #13
On Wed, Aug 11, 2021 at 01:52:29PM -0400, Leo Famulari wrote:
> Awesome, thanks! Let us know how it goes. I'll proceed with hiding
> openssl-1.0 and removing the other packages (not adb or fastboot) in the
> meantime.

Done as 12099eac1b161d364be923451d27d7d739d0f14d
diff mbox series

Patch

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index eb538f6540..746a104d43 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -351,53 +351,6 @@  various Android core host applications.")
 various Android core host applications.")
     (license license:asl2.0)))
 
-(define-public adb
-  (package
-    (name "adb")
-    (version (android-platform-version))
-    (source (android-platform-system-core version))
-    (build-system android-ndk-build-system)
-    (arguments
-     `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
-       #:make-flags
-       (list "CFLAGS=-Wno-error"
-             "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
-             (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
-                            "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'enter-source
-           (lambda _ (chdir "adb") #t))
-         (add-after 'enter-source 'glibc-compat
-           (lambda _
-             ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
-             (substitute* "usb_linux.cpp"
-               (("#include <sys/types.h>" all)
-                (string-append all "\n#include <sys/sysmacros.h>\n")))
-             #t))
-         (add-after 'enter-source 'make-libs-available
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (substitute* "Android.mk"
-              (("libcrypto_static") "libcrypto"))
-             #t))
-         (add-after 'install 'install-headers
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
-             #t)))))
-    (inputs
-     `(("android-libbase" ,android-libbase)
-       ("android-libcutils" ,android-libcutils)
-       ("android-liblog" ,android-liblog)
-       ("openssl" ,openssl-1.0)))
-    (home-page "https://developer.android.com/studio/command-line/adb.html")
-    (synopsis "Android Debug Bridge")
-    (description
-     "@command{adb} is a versatile command line tool that lets you communicate
-with an emulator instance or connected Android device.  It facilitates a variety
-of device actions, such as installing and debugging apps, and it provides access
-to a Unix shell that can run commands on the connected device or emulator.")
-    (license license:asl2.0)))
-
 (define-public mkbootimg
   (package
     (name "mkbootimg")
@@ -652,54 +605,6 @@  file system.")
     (description "@code{android-libutils} provides utilities for Android NDK developers.")
     (license license:asl2.0)))
 
-(define-public fastboot
-  (package
-    (name "fastboot")
-    (version (android-platform-version))
-    (source (android-platform-system-core version))
-    (build-system android-ndk-build-system)
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'enter-source
-           (lambda _
-             (chdir "fastboot")
-             #t))
-         (add-after 'enter-source 'patch-source
-           (lambda _
-             (substitute* "Android.mk"
-              (("libext4_utils_host") "libext4_utils_host libselinux libpcre"))
-             #t))
-         (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (lib (string-append out "/lib"))
-                    (bin (string-append out "/bin")))
-               (install-file "fastboot" bin)
-               #t))))))
-    (inputs
-     `(("adb" ,adb)
-       ("android-safe-iop" ,android-safe-iop)
-       ("android-ext4-utils" ,android-ext4-utils)
-       ("android-f2fs-utils" ,android-f2fs-utils)
-       ("android-libbase" ,android-libbase)
-       ("android-libcutils" ,android-libcutils)
-       ("android-liblog" ,android-liblog)
-       ("android-libutils" ,android-libutils)
-       ("android-libsparse" ,android-libsparse)
-       ("android-libziparchive" ,android-libziparchive)
-       ("android-libselinux" ,android-libselinux)
-       ("pcre" ,pcre)
-       ("mkbootimg" ,mkbootimg)
-       ("zlib" ,zlib)))
-    (native-inputs
-     `(("xz" ,xz)))
-    (home-page "https://developer.android.com/studio/command-line/")
-    (synopsis "Android image flasher")
-    (description
-     "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
-    (license license:asl2.0)))
-
 (define-public android-udev-rules
   (package
     (name "android-udev-rules")