Subject: [bug#51774] [PATCH v2] gnu: font-adobe-source-code-pro: Update to 2.032R-ro-1.052R-it-1.012R-VAR.

From: Liliana Marie Prikler <[email-masked]>
Date: Tue, 16 Nov 2021 21:29:49 +0100

Hi,

Am Dienstag, den 16.11.2021, 19:07 +0000 schrieb phodina:
> Hi,
> 
> Jelle pointed out, that this font is already packaged as adobe-
> source-code-pro. Thanks, indeed it is.
> 
> Unfortunately since the version string changed (another backslash)
> the regexp now looks horrible. Maybe it would be better to define it
> with let to keep the code cleaner. What do you think?
In principle both are fine solutions to me, but the implementation
matters.  Perhaps someone else has another reason why to use one or the
other, but that's it for me.  As for the implementation here, see
below.

> * gnu/packages/fonts (font-adobe-source-code-pro): Update to
>   2.032R-ro-1.052R-it-1.012R-VAR and update regexp in commit.
Normally, you'd insert two dashes here and comments after that.  These 
lines don't appear in the commit log or the diff.

> diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
> index 3f36a71bdd..eddbeaba7e 100644
> --- a/gnu/packages/fonts.scm
> +++ b/gnu/packages/fonts.scm
> @@ -975,19 +975,20 @@ (define-public font-hack
>  (define-public font-adobe-source-code-pro
>    (package
>      (name "font-adobe-source-code-pro")
> -    (version "2.030R-ro-1.050R-it")
> +    (version "2.032R-ro-1.052R-it-1.012R-VAR")
>      (source
>       (origin
>         (method git-fetch)
>         (uri (git-reference
>               (url "https://github.com/adobe-fonts/source-code-pro")
> -             (commit (regexp-substitute/global
> -                      ;; The upstream tag uses "/" between the roman
> and italic
> -                      ;; versions, so substitute our "-" separator
> here.
> -                      #f "R-ro-" version 'pre "R-ro/" 'post))))
> +             (commit (regexp-substitute/global #f "it-" (regexp-
> substitute/global
> +                                                         ;; The
> upstream tag uses "/" between the roman and italic
> +                                                         ;;
> versions, so substitute our "-" separator here.
> +                                                         #f "R-ro-"
> version 'pre "R-ro/" 'post) 'pre "it/"
> +                                                         'post))))
This regexp could be simplified by noticing that it's always
<VERSION>R-<TAG>/<VERSION>R-<TAG>/<VERSION>R-<TAG>, whereas we use
<VERSION>R-<TAG>-<VERSION>R-<TAG>-<VERSION>R-<TAG>.  So simply use a
regexp that matches <VERSION>R-<TAG>- and then replace just the dash
with a slash.  That being said, I'm not sure how much cleaner this is
compared to let-binding

Cheers.