changeset 23525:645d1f5f2cb2

pkg: warn on invalid or repeated lines in DESCRIPTION (bug #51090) * get_description.m: Warn on lines with duplicate keywords and ignore the contents instead of replacing. Issue a warning for invalid lines. * package.txi (The DESCRIPTION File): Fix doc of Depends keyword, multiple lines are not accepted.
author Mike Miller <mtmiller@octave.org>
date Tue, 23 May 2017 14:12:13 -0700
parents 7c278572db66
children dc3745744aef
files doc/interpreter/package.txi scripts/pkg/private/get_description.m
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/package.txi	Tue May 23 13:37:17 2017 -0700
+++ b/doc/interpreter/package.txi	Tue May 23 14:12:13 2017 -0700
@@ -398,8 +398,7 @@
 Possible operators are @code{<}, @code{<=}, @code{==}, @code{>=} or
 @code{>}.  If the part of the dependency in @code{()} is missing, any
 version of the package is acceptable.  Multiple dependencies can be
-defined either as a comma separated list or on separate @code{Depends}
-lines.
+defined as a comma separated list.
 
 @item License
 An optional short description of the used license (e.g., GPL version 3
--- a/scripts/pkg/private/get_description.m	Tue May 23 13:37:17 2017 -0700
+++ b/scripts/pkg/private/get_description.m	Tue May 23 14:12:13 2017 -0700
@@ -45,7 +45,7 @@
       ## Keyword/value pair
       colon = find (line == ":");
       if (length (colon) == 0)
-        disp ("skipping line");
+        warning ("pkg: skipping invalid line in DESCRIPTION file");
       else
         colon = colon(1);
         keyword = tolower (strtrim (line(1:colon-1)));
@@ -55,7 +55,12 @@
             error ("The keyword '%s' of the package '%s' has an empty value",
                     keyword, desc.name);
         endif
-        desc.(keyword) = value;
+        if (isfield (desc, keyword))
+          warning ("pkg: duplicate keyword \"%s\" in DESCRIPTION, ignoring",
+                   keyword);
+        else
+          desc.(keyword) = value;
+        endif
       endif
     endif
     line = fgetl (fid);