Subject: [bug#42800] [PATCH v2] Add (guix android-repo-download).

From: Mathieu Othacehe <[email-masked]>
Date: Thu, 13 Aug 2020 11:02:28 +0200

Hello Danny,

> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <[email-masked]>
> +;;; Copyright © 2017 Mathieu Lirzin <[email-masked]>
> +;;; Copyright © 2017 Christopher Baines <[email-masked]>
> +;;; Copyright © 2020 Jakub Kądziołka <[email-masked]>

I think you can strip out those copyrights.

> +  #:use-module (git) ; FIXME Remove

Why should it be removed?

> +  #:use-module (ice-9 match)
> +  #:use-module (ice-9 vlist)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-34)
> +  #:use-module (srfi srfi-35)
> +  #:export (android-repo-reference
> +            android-repo-reference?
> +            android-repo-reference-mainfest-url
                                         ^
                                         typo
                                         
> +            android-repo-reference-revision
> +
> +            android-repo-fetch
> +            android-repo-version
> +            android-repo-file-name))
> +
> +;;; Commentary:
> +;;;
> +;;; An <origin> method that fetches a specific commit from an Android Repo
> +;;; repository.
> +;;; The repository's manifest (URL and revision) can be specified with a
> +;; <android-repo-reference> object.

Missing semicolon.

> +;;;
> +;;; Code:
> +
> +(define-record-type* <android-repo-reference>
> +  android-repo-reference make-android-repo-reference
> +  android-repo-reference?
> +  (manifest-url        android-repo-reference-manifest-url)
> +  (manifest-revision   android-repo-reference-manifest-revision))
> +
> +(define (git-repo-package)
> +  "Return the default git-repo package."
> +  (let ((distro (resolve-interface '(gnu packages android))))
> +    (module-ref distro 'git-repo)))
> +
> +(define* (android-repo-fetch ref hash-algo hash
> +                             #:optional name
> +                             #:key (system (%current-system))
> +                             (guile (default-guile))
> +                             (git-repo (git-repo-package)))
> +  "Return a fixed-output derivation that fetches REF, an
> +<android-repo-reference> object.  The output is expected to have recursive
> +hash HASH of type HASH-ALGO (a symbol).  Use NAME as the file name, or a
> +generic name if #f."

if unset.

> +  ;; TODO: Remove.
> +  (define inputs
> +    (standard-packages))

Why should it be removed?

> +            (or (android-repo-fetch (getenv "android-repo manifest-url")
> +                                    (getenv "android-repo manifest-revision")

Spaces in env variable names are quite unusual.

> +    (with-directory-excursion directory
> +      (invoke git-repo-command "init" "-u" manifest-url "-b" manifest-revision
> +              "--depth=1")

It could also be useful to be able to select the manifest name, using
the "-m" switch.

> +      (invoke git-repo-command "sync" "-c" "--fail-fast" "-v" "-j" "3")

Any specific reason to default to 3 threads?

Otherwise this looks nice!

Thanks,

Mathieu