guix: Rename and move sans-extension to tarball-sans-extension.
* guix/gnu-maintenance.scm (sans-extension): Move and rename to ... * guix/utils.scm (tarball-sans-extension): ... here.
This commit is contained in:
parent
83aa656217
commit
da1027a705
|
@ -230,12 +230,6 @@ network to check in GNU's database."
|
||||||
(or (assoc-ref (package-properties package) 'ftp-directory)
|
(or (assoc-ref (package-properties package) 'ftp-directory)
|
||||||
(string-append "/gnu/" name)))))
|
(string-append "/gnu/" name)))))
|
||||||
|
|
||||||
(define (sans-extension tarball)
|
|
||||||
"Return TARBALL without its .tar.* or .zip extension."
|
|
||||||
(let ((end (or (string-contains tarball ".tar")
|
|
||||||
(string-contains tarball ".zip"))))
|
|
||||||
(substring tarball 0 end)))
|
|
||||||
|
|
||||||
(define %tarball-rx
|
(define %tarball-rx
|
||||||
;; The .zip extensions is notably used for freefont-ttf.
|
;; The .zip extensions is notably used for freefont-ttf.
|
||||||
;; The "-src" pattern is for "TeXmacs-1.0.7.9-src.tar.gz".
|
;; The "-src" pattern is for "TeXmacs-1.0.7.9-src.tar.gz".
|
||||||
|
@ -261,14 +255,15 @@ true."
|
||||||
(string-append project
|
(string-append project
|
||||||
"-src")))))))
|
"-src")))))))
|
||||||
(not (regexp-exec %alpha-tarball-rx file))
|
(not (regexp-exec %alpha-tarball-rx file))
|
||||||
(let ((s (sans-extension file)))
|
(let ((s (tarball-sans-extension file)))
|
||||||
(regexp-exec %package-name-rx s))))
|
(regexp-exec %package-name-rx s))))
|
||||||
|
|
||||||
(define (tarball->version tarball)
|
(define (tarball->version tarball)
|
||||||
"Return the version TARBALL corresponds to. TARBALL is a file name like
|
"Return the version TARBALL corresponds to. TARBALL is a file name like
|
||||||
\"coreutils-8.23.tar.xz\"."
|
\"coreutils-8.23.tar.xz\"."
|
||||||
(let-values (((name version)
|
(let-values (((name version)
|
||||||
(gnu-package-name->name+version (sans-extension tarball))))
|
(gnu-package-name->name+version
|
||||||
|
(tarball-sans-extension tarball))))
|
||||||
version))
|
version))
|
||||||
|
|
||||||
(define* (releases project
|
(define* (releases project
|
||||||
|
@ -492,8 +487,9 @@ return the corresponding signature URL, or #f it signatures are unavailable."
|
||||||
(and (string=? url (basename url)) ;relative reference?
|
(and (string=? url (basename url)) ;relative reference?
|
||||||
(release-file? package url)
|
(release-file? package url)
|
||||||
(let-values (((name version)
|
(let-values (((name version)
|
||||||
(package-name->name+version (sans-extension url)
|
(package-name->name+version
|
||||||
#\-)))
|
(tarball-sans-extension url)
|
||||||
|
#\-)))
|
||||||
(upstream-source
|
(upstream-source
|
||||||
(package name)
|
(package name)
|
||||||
(version version)
|
(version version)
|
||||||
|
@ -565,14 +561,16 @@ list available from %GNU-FILE-LIST-URI over HTTP(S)."
|
||||||
(release-file? name (basename file))))
|
(release-file? name (basename file))))
|
||||||
files)))
|
files)))
|
||||||
(match (sort relevant (lambda (file1 file2)
|
(match (sort relevant (lambda (file1 file2)
|
||||||
(version>? (sans-extension (basename file1))
|
(version>? (tarball-sans-extension
|
||||||
(sans-extension (basename file2)))))
|
(basename file1))
|
||||||
|
(tarball-sans-extension
|
||||||
|
(basename file2)))))
|
||||||
((and tarballs (reference _ ...))
|
((and tarballs (reference _ ...))
|
||||||
(let* ((version (tarball->version reference))
|
(let* ((version (tarball->version reference))
|
||||||
(tarballs (filter (lambda (file)
|
(tarballs (filter (lambda (file)
|
||||||
(string=? (sans-extension
|
(string=? (tarball-sans-extension
|
||||||
(basename file))
|
(basename file))
|
||||||
(sans-extension
|
(tarball-sans-extension
|
||||||
(basename reference))))
|
(basename reference))))
|
||||||
tarballs)))
|
tarballs)))
|
||||||
(upstream-source
|
(upstream-source
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
arguments-from-environment-variable
|
arguments-from-environment-variable
|
||||||
file-extension
|
file-extension
|
||||||
file-sans-extension
|
file-sans-extension
|
||||||
|
tarball-sans-extension
|
||||||
compressed-file?
|
compressed-file?
|
||||||
switch-symlinks
|
switch-symlinks
|
||||||
call-with-temporary-output-file
|
call-with-temporary-output-file
|
||||||
|
@ -578,6 +579,12 @@ minor version numbers from version-string."
|
||||||
(substring file 0 dot)
|
(substring file 0 dot)
|
||||||
file)))
|
file)))
|
||||||
|
|
||||||
|
(define (tarball-sans-extension tarball)
|
||||||
|
"Return TARBALL without its .tar.* or .zip extension."
|
||||||
|
(let ((end (or (string-contains tarball ".tar")
|
||||||
|
(string-contains tarball ".zip"))))
|
||||||
|
(substring tarball 0 end)))
|
||||||
|
|
||||||
(define (compressed-file? file)
|
(define (compressed-file? file)
|
||||||
"Return true if FILE denotes a compressed file."
|
"Return true if FILE denotes a compressed file."
|
||||||
(->bool (member (file-extension file)
|
(->bool (member (file-extension file)
|
||||||
|
|
Loading…
Reference in New Issue