summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-17 18:04:13 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-17 18:15:53 +0200
commit99effc8faa43d478371eb06aee5df8ae1383c51a (patch)
tree6e01a04c76f80f4707c56c12bdb6cad80d410b20
parent1c29f3ef8452860c4301d7ae57c89ac5956d1663 (diff)
lint: Honor 'cpe-name' and 'cpe-version' package properties.
* guix/scripts/lint.scm (package-name->cpe-name): Remove. (package-vulnerabilities): Honor 'cpe-name' and 'cpe-version' properties. * gnu/packages/grub.scm (grub)[properties]: New field. * gnu/packages/gnuzilla.scm (icecat)[properties]: Add 'cpe-name' and 'cpe-version'. * doc/guix.texi (Invoking guix lint): Mention 'cpe-name'.
-rw-r--r--doc/guix.texi13
-rw-r--r--gnu/packages/gnuzilla.scm6
-rw-r--r--gnu/packages/grub.scm5
-rw-r--r--guix/scripts/lint.scm21
4 files changed, 30 insertions, 15 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 0e63ecadfdc..3f0106be027 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4961,6 +4961,19 @@ To view information about a particular vulnerability, visit pages such as:
4961where @code{CVE-YYYY-ABCD} is the CVE identifier---e.g., 4961where @code{CVE-YYYY-ABCD} is the CVE identifier---e.g.,
4962@code{CVE-2015-7554}. 4962@code{CVE-2015-7554}.
4963 4963
4964Package developers can specify in package recipes the
4965@uref{https://nvd.nist.gov/cpe.cfm,Common Platform Enumeration (CPE)}
4966name and version of the package when they differ from the name that Guix
4967uses, as in this example:
4968
4969@example
4970(package
4971 (name "grub")
4972 ;; @dots{}
4973 ;; CPE calls this package "grub2".
4974 (properties '((cpe-name . "grub2"))))
4975@end example
4976
4964@item formatting 4977@item formatting
4965Warn about obvious source code formatting issues: trailing white space, 4978Warn about obvious source code formatting issues: trailing white space,
4966use of tabulations, etc. 4979use of tabulations, etc.
diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index df1075c3701..7e52534b8f8 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -517,4 +517,8 @@ standards.")
517software, which does not recommend non-free plugins and addons. It also 517software, which does not recommend non-free plugins and addons. It also
518features built-in privacy-protecting features.") 518features built-in privacy-protecting features.")
519 (license license:mpl2.0) ;and others, see toolkit/content/license.html 519 (license license:mpl2.0) ;and others, see toolkit/content/license.html
520 (properties '((ftp-directory . "/gnu/gnuzilla"))))) 520 (properties
521 `((ftp-directory . "/gnu/gnuzilla")
522 (cpe-name . "firefox_esr")
523 (cpe-version . ,(string-drop-right version
524 (string-length "-gnu1")))))))
diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
index 5fc7ee83866..ec2feebbf43 100644
--- a/gnu/packages/grub.scm
+++ b/gnu/packages/grub.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> 3;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4;;; Copyright © 2015 Leo Famulari <leo@famulari.name> 4;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
5;;; 5;;;
@@ -132,4 +132,5 @@ then goes on to load the rest of the operating system. As a multiboot
132bootloader, GRUB handles the presence of multiple operating systems installed 132bootloader, GRUB handles the presence of multiple operating systems installed
133on the same computer; upon booting the computer, the user is presented with a 133on the same computer; upon booting the computer, the user is presented with a
134menu to select one of the installed operating systems.") 134menu to select one of the installed operating systems.")
135 (license gpl3+))) 135 (license gpl3+)
136 (properties '((cpe-name . "grub2")))))
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 06001d3eaec..b4fdb6f9050 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -600,15 +600,6 @@ be determined."
600 ((? origin?) 600 ((? origin?)
601 (and=> (origin-actual-file-name patch) basename)))) 601 (and=> (origin-actual-file-name patch) basename))))
602 602
603(define (package-name->cpe-name name)
604 "Do a basic conversion of NAME, a Guix package name, to the corresponding
605Common Platform Enumeration (CPE) name."
606 (match name
607 ("icecat" "firefox") ;or "firefox_esr"
608 ("grub" "grub2")
609 ;; TODO: Add more.
610 (_ name)))
611
612(define (current-vulnerabilities*) 603(define (current-vulnerabilities*)
613 "Like 'current-vulnerabilities', but return the empty list upon networking 604 "Like 'current-vulnerabilities', but return the empty list upon networking
614or HTTP errors. This allows network-less operation and makes problems with 605or HTTP errors. This allows network-less operation and makes problems with
@@ -635,9 +626,15 @@ from ~s: ~a (~s)~%")
635 (current-vulnerabilities*))))) 626 (current-vulnerabilities*)))))
636 (lambda (package) 627 (lambda (package)
637 "Return a list of vulnerabilities affecting PACKAGE." 628 "Return a list of vulnerabilities affecting PACKAGE."
638 ((force lookup) 629 ;; First we retrieve the Common Platform Enumeration (CPE) name and
639 (package-name->cpe-name (package-name package)) 630 ;; version for PACKAGE, then we can pass them to LOOKUP.
640 (package-version package))))) 631 (let ((name (or (assoc-ref (package-properties package)
632 'cpe-name)
633 (package-name package)))
634 (version (or (assoc-ref (package-properties package)
635 'cpe-version)
636 (package-version package))))
637 ((force lookup) name version)))))
641 638
642(define (check-vulnerabilities package) 639(define (check-vulnerabilities package)
643 "Check for known vulnerabilities for PACKAGE." 640 "Check for known vulnerabilities for PACKAGE."