From: ludo@gnu.org (Ludovic Courtès)
To: Eric Bavier <ericbavier@openmailbox.org>
Cc: guix-devel@gnu.org, Eric Bavier <bavier@member.fsf.org>
Subject: Re: [PATCH] guix: lint: Check for version-only origin file names.
Date: Fri, 28 Aug 2015 09:48:48 +0200 [thread overview]
Message-ID: <87y4gvvonz.fsf@gnu.org> (raw)
In-Reply-To: <20150824191024.3da87f41@openmailbox.org> (Eric Bavier's message of "Mon, 24 Aug 2015 19:10:24 -0500")
Eric Bavier <ericbavier@openmailbox.org> skribis:
> From 0311d5b383003600ac43d3a9bfdec0ad3c398db2 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Sun, 23 Aug 2015 18:00:45 -0500
> Subject: [PATCH] guix: lint: Check for version-only origin file names.
>
> * guix/scripts/lint.scm (check-source): Emit warning if source filename
> contains only the version of the package.
> * tests/lint.scm ("source: filename", "source: filename v",
> "source: filename valid"): New tests.
> * doc/guix.texi (Invoking guix lint): Mention file name check.
> Offending packages updated.
This is useful, thanks for looking into it.
I would prefer it to make a separate linter, like ‘source-file-name’.
The reason is that ‘source’ is a relatively expensive check, since it
needs to probe URLs (so you might want to skip it in some cases),
whereas the linter your propose is lightweight.
WDYT?
> --- a/gnu/packages/algebra.scm
> +++ b/gnu/packages/algebra.scm
> @@ -386,6 +386,7 @@ cosine/ sine transforms or DCT/DST).")
> (method url-fetch)
> (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
> version ".tar.bz2"))
> + (file-name (string-append name "-" version ".tar.bz2"))
Could you make these package updates a separate patch? Some may trigger
large rebuilds, so you may have to keep them for ‘core-updates’ or such.
> + (define (origin-version-name? origin)
> + ;; Return #t if the source file name contains only a version; indicates
> + ;; that the origin needs a 'file-name' field.
> + (let ((filename (store-path-package-name
> + (with-store store
> + (derivation->output-path
> + (package-source-derivation store origin)))))
> + (version (package-version package)))
> + (or (string-prefix? version filename)
> + ;; Common in many projects is for the filename to start with a "v"
> + ;; followed by the version, e.g. "v3.2.0.tar.gz".
> + (string-prefix? (string-append "v" version) filename))))
Opening a connection to the store in the middle of the code
(‘with-store’) is Bad Practice. ;-)
I think this can actually be made simpler, with something akin to what
‘node-full-name’ does in guix/scripts/graph.scm. Maybe we could extract
an ‘origin-actual-file-name’ procedure from that and move it to (guix
packages). WDYT?
> +(test-assert "source: filename"
“file name” (two words).
Could you send an updated patch?
Thanks,
Ludo’.
next prev parent reply other threads:[~2015-08-28 7:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-23 23:05 [PATCH] guix: lint: Check for version-only origin file names ericbavier
2015-08-24 23:02 ` Mark H Weaver
2015-08-25 0:10 ` Eric Bavier
2015-08-28 7:48 ` Ludovic Courtès [this message]
2015-09-10 20:50 ` Eric Bavier
2015-09-11 4:04 ` Eric Bavier
2015-09-13 16:59 ` Ludovic Courtès
2015-09-14 23:11 ` Eric Bavier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y4gvvonz.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=bavier@member.fsf.org \
--cc=ericbavier@openmailbox.org \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).