Skip to content

Commit

Permalink
Require License field for packages (#5572)
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored Jan 11, 2024
1 parent 81abd71 commit 4db36d7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
12 changes: 6 additions & 6 deletions doc/ref/gappkg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ The following components of this record are <E>mandatory</E>.
denoting the release date of the current version of the package
(a date since 1999, when &GAP;&nbsp;4 appeared),
</Item>
<Mark><C>License</C></Mark>
<Item>
a nonempty string containing an SPDX ID
(see Section <Ref Sect="Selecting a license for a GAP Package"/>),
</Item>
<Mark><C>ArchiveURL</C></Mark>
<Item>
a string started with <C>http://</C>, <C>https://</C>, or <C>ftp://</C>,
Expand Down Expand Up @@ -282,11 +287,6 @@ The following components of this record are <E>mandatory</E>.
The following components of the record are <E>optional</E>.

<List>
<Mark><C>License</C></Mark>
<Item>
a nonempty string containing an SPDX ID
(see Section <Ref Sect="Selecting a license for a GAP Package"/>),
</Item>
<Mark><C>TextFiles</C> or <C>BinaryFiles</C> or <C>TextBinaryFilesPatterns</C></Mark>
<Item>
a list of strings that specify which files in the archive are text files
Expand Down Expand Up @@ -1304,7 +1304,7 @@ each being a record with the following components.
As an example suppose the following is part of the <F>PackageInfo.g</F>.
Then &GAP; will load the file <F>fileForB.gd</F> as soon as package
<C>B</C> is loaded in version 0.6 or newer, and <F>fileForCD.gi</F> once
package <C>C</C> and <C>D</C> are loaded in version 1.2 and 0.1 or newer respectively.
package <C>C</C> and <C>D</C> are loaded in version 1.2 and 0.1 or newer respectively.

<Log><![CDATA[
Extensions := [
Expand Down
2 changes: 1 addition & 1 deletion lib/package.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ InstallGlobalFunction( ValidatePackageInfo, function( info )
# Info( InfoPackageLoading, 2, Concatenation( record.PackageName, ": Please be advised to change the date format to `yyyy-mm-dd`") );
#fi;

TestOption( record, "License",
TestMandat( record, "License",
x -> IsString(x) and 0 < Length(x),
"a nonempty string containing an SPDX ID" );
TestMandat( record, "ArchiveURL", IsURL, "a string started with http://, https:// or ftp://" );
Expand Down
11 changes: 11 additions & 0 deletions tst/testinstall/package.tst
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ gap> ValidatePackageInfo(rec());
with `='
#E component `Date' must be bound to a string of the form yyyy-mm-dd or dd/mm\
/yyyy that represents a date since 1999
#E component `License' must be bound to a nonempty string containing an SPDX \
ID
#E component `ArchiveURL' must be bound to a string started with http://, htt\
ps:// or ftp://
#E component `ArchiveFormats' must be bound to a string
Expand Down Expand Up @@ -234,6 +236,8 @@ gap> info := rec(
gap> ValidatePackageInfo(info);
#E component `Date' must be bound to a string of the form yyyy-mm-dd or dd/mm\
/yyyy that represents a date since 1999
#E component `License' must be bound to a nonempty string containing an SPDX \
ID
#E component `BookName' must be bound to a string
#E component `ArchiveURLSubset' must be bound to a list of strings denoting r\
elative paths to readable files or directories
Expand All @@ -260,6 +264,8 @@ gap> info := rec(
> AvailabilityTest := ReturnTrue,
> );;
gap> ValidatePackageInfo(info);
#E component `License' must be bound to a nonempty string containing an SPDX \
ID
#E component `BookName' must be bound to a string
#E component `ArchiveURLSubset' must be bound to a list of strings denoting r\
elative paths to readable files or directories
Expand Down Expand Up @@ -288,6 +294,8 @@ gap> info := rec(
gap> ValidatePackageInfo(info);
#E component `Date' must be bound to a string of the form yyyy-mm-dd or dd/mm\
/yyyy that represents a date since 1999
#E component `License' must be bound to a nonempty string containing an SPDX \
ID
#E component `BookName' must be bound to a string
#E component `ArchiveURLSubset' must be bound to a list of strings denoting r\
elative paths to readable files or directories
Expand Down Expand Up @@ -316,6 +324,8 @@ gap> info := rec(
gap> ValidatePackageInfo(info);
#E component `Date' must be bound to a string of the form yyyy-mm-dd or dd/mm\
/yyyy that represents a date since 1999
#E component `License' must be bound to a nonempty string containing an SPDX \
ID
#E component `BookName' must be bound to a string
#E component `ArchiveURLSubset' must be bound to a list of strings denoting r\
elative paths to readable files or directories
Expand All @@ -332,6 +342,7 @@ gap> info := rec(
> Subtitle := "desc",
> Version := "0",
> Date := "01/02/3000",
> License := "GPL-2.0-or-later",
> ArchiveURL := "https://",
> ArchiveFormats := "",
> README_URL := "https://",
Expand Down

0 comments on commit 4db36d7

Please sign in to comment.