-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update all source files to the new XML format and add in the tools fr…
…om the schemadev branch Signed-off-by: Gary O'Neall <[email protected]>
- Loading branch information
Showing
364 changed files
with
37,842 additions
and
37,045 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
|
||
.DS_Store | ||
# Ignore all hidden files/dirs except .gitignore | ||
.* | ||
!/.gitignore | ||
|
||
# nodeJS | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* Gulpfile for validating SPDX license XML files | ||
* Script licensed under SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
var gulp = require('gulp'), | ||
xsd = require('libxml-xsd'), | ||
glob = require('glob'), | ||
gutil = require('gulp-util'), | ||
fs = require('fs'), | ||
srcdir = "src", | ||
xsdlocation = "schema/ListedLicense.xsd", | ||
schemaString = fs.readFileSync(xsdlocation, 'utf8'), | ||
schema = xsd.parse(schemaString), | ||
MAX_FILE_SIZE = 32766; | ||
|
||
/** | ||
* Validates a files against the XSD | ||
* @param file | ||
* @param error error if any error occurs | ||
* @returns Error if any error occurs, otherwise returns null | ||
*/ | ||
function validate(file) { | ||
|
||
if (file) { | ||
if (file.size > MAX_FILE_SIZE) { | ||
return new Error("File is too large for validation. Size is "+file.size,file.name); | ||
} | ||
var documentString = fs.readFileSync(file, 'utf8'); | ||
var validationErrors = schema.validate(documentString); | ||
if (validationErrors) { | ||
var errormsg = null; | ||
validationErrors.forEach(function(error) { | ||
if (errormsg) { | ||
errormsg += ';'; | ||
errormsg += ' at line ' + error.line + ' ' + error.message; | ||
} else { | ||
errormsg = ' at line ' + error.line + ' ' + error.message; | ||
} | ||
console.log('Validation error(s) for file '+file+':'+error); | ||
}); | ||
return new Error("File "+file+" "+errormsg); | ||
} else { | ||
return null; // no errors | ||
} | ||
} | ||
} | ||
|
||
function validateall(callback) { | ||
glob('./'+srcdir+'**/*.xml', function(err, files) { | ||
if (!files) { | ||
return; | ||
} | ||
var error = null; | ||
files.forEach(function(file) { | ||
var fileError = validate(file, fileError); | ||
if (fileError) { | ||
if (!error) { | ||
error = fileError; | ||
} else { | ||
// append the file in error | ||
error = new Error(error.message+fileError.message); | ||
} | ||
} | ||
}); | ||
if (error) { | ||
gutil.log(error.message); | ||
callback(error); | ||
} | ||
}); | ||
} | ||
|
||
gulp.task('validate', function(callback) { | ||
validateall(callback); | ||
}); | ||
|
||
// Comment the following out - just used for testing | ||
validateall(function(error) { | ||
if (error) { | ||
console.log(error.message); | ||
} | ||
}); | ||
console.log('done'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "license-list-xml", | ||
"version": "2.6.0", | ||
"description": "The SPDX License List is a list of commonly found licenses and exceptions used for open source and other collaborative software. The XML format is an internal representation of the licenses. See the license-list-data for supported formats for the license list.", | ||
"author": "Linux Foundation and its Contributors", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/spdx/license-list-XML" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/spdx/license-list-XML/issues" | ||
}, | ||
"keywords": [ | ||
"SPDX", | ||
"Software Package Data Exchange", | ||
"SPDX-License-Identifier", | ||
"licenses", | ||
"license", | ||
"linux foundation", | ||
"identifiers", | ||
"oss", | ||
"open source", | ||
"software" | ||
], | ||
"scripts": { | ||
"preinstall": "(npm list gulp -g || npm install gulp -g)" | ||
}, | ||
"dependencies": { | ||
"libxml-xsd": "0.5.2", | ||
"glob": "7.1.2", | ||
"gulp-util": "3.0.8", | ||
"fs": "" | ||
}, | ||
"devDependencies": { | ||
"gulp": "^3.9.1" | ||
}, | ||
"license": "CC-BY-3.0 AND MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.spdx.org/license" targetNamespace="http://www.spdx.org/license" elementFormDefault="qualified"> | ||
<annotation> | ||
<documentation xml:lang="en"> | ||
XML Schema for the SPDX Listed License input format. This format is intended for internal use | ||
of the SPDX legal team for representing licenses in the github source repository | ||
github.com/spdx/listed-license-XML. A separate format of the same licenses are available | ||
for application usage at github.com/spdx/license-list-data. | ||
Licensed under CC-BY-4.0. | ||
</documentation> | ||
</annotation> | ||
<element name="SPDXLicenseCollection" type="tns:SPDXLicenseCollectionType"/> | ||
<complexType name="SPDXLicenseCollectionType"> | ||
<choice minOccurs="1" maxOccurs="unbounded"> | ||
<element name="license" type="tns:LicenseType"/> | ||
<element name="exception" type="tns:ExceptionType"/> | ||
</choice> | ||
</complexType> | ||
<complexType name="ExceptionType" mixed="true"> | ||
<choice minOccurs="1" maxOccurs="unbounded"> | ||
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/> | ||
<element name="notes" type="string" minOccurs="0" maxOccurs="1"/> | ||
<element name="titleText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/> | ||
<element name="copyrightText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/> | ||
<element name="bullet" type="string"/> | ||
<element name="list" type="tns:listType"/> | ||
<element name="p" type="tns:formattedTextType"/> | ||
<element name="optional" type="tns:optionalType"/> | ||
<element name="alt" type="tns:altType"/> | ||
<element name="br" type="tns:emptyType"/> | ||
</choice> | ||
<attribute name="licenseId" type="string"/> | ||
<attribute name="isDeprecated" type="boolean"/> | ||
<attribute name="name" type="string"/> | ||
<attribute name="listVersionAdded" type="string"/> | ||
<attribute name="deprecatedVersion" type="string"/> | ||
</complexType> | ||
<complexType name="LicenseType" mixed="true"> | ||
<choice minOccurs="1" maxOccurs="unbounded"> | ||
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/> | ||
<element name="notes" type="string" minOccurs="0" maxOccurs="1"/> | ||
<element name="standardLicenseHeader" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/> | ||
<element name="titleText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/> | ||
<element name="copyrightText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/> | ||
<element name="bullet" type="string"/> | ||
<element name="list" type="tns:listType"/> | ||
<element name="p" type="tns:formattedTextType"/> | ||
<element name="optional" type="tns:optionalType"/> | ||
<element name="alt" type="tns:altType"/> | ||
<element name="br" type="tns:emptyType"/> | ||
</choice> | ||
<attribute name="licenseId" type="string"/> | ||
<attribute name="isOsiApproved" type="boolean"/> | ||
<attribute name="isFsfLibre" type="boolean"/> | ||
<attribute name="isDeprecated" type="boolean"/> | ||
<attribute name="name" type="string"/> | ||
<attribute name="listVersionAdded" type="string"/> | ||
<attribute name="deprecatedVersion" type="string"/> | ||
</complexType> | ||
<complexType name="notesType" mixed="true"> | ||
<choice minOccurs="1" maxOccurs="unbounded"> | ||
<element name="p" type="tns:formattedTextType"/> | ||
<element name="br" type="tns:emptyType"/> | ||
<element name="bullet" type="string"/> | ||
<element name="list" type="tns:listType"/> | ||
</choice> | ||
</complexType> | ||
<complexType name="crossRefsType"> | ||
<sequence> | ||
<element name="crossRef" type="string" minOccurs="1" maxOccurs="unbounded"/> | ||
</sequence> | ||
</complexType> | ||
<complexType name="altType" mixed="true"> | ||
<group ref="tns:formattedTextGroup" minOccurs="0" maxOccurs="unbounded"/> | ||
<attribute name="name" type="string"/> | ||
<attribute name="match" type="string"/> | ||
</complexType> | ||
<complexType name="optionalType" mixed="true"> | ||
<group ref="tns:formattedTextGroup" minOccurs="0" maxOccurs="unbounded"/> | ||
</complexType> | ||
<complexType name="listType"> | ||
<choice minOccurs="1" maxOccurs="unbounded"> | ||
<element name="item" type="tns:formattedTextType"/> | ||
<element name="list" type="tns:listType"/> | ||
</choice> | ||
</complexType> | ||
<complexType name="emptyType"/> | ||
<complexType name="formattedTextType" mixed="true"> | ||
<group ref="tns:formattedTextGroup" minOccurs="0" maxOccurs="unbounded"/> | ||
</complexType> | ||
<group name="formattedTextGroup"> | ||
<choice> | ||
<element name="p" type="tns:formattedTextType" minOccurs="0" maxOccurs="unbounded"/> | ||
<element name="bullet" type="string" minOccurs="0" maxOccurs="unbounded"/> | ||
<element name="list" type="tns:listType" minOccurs="0" maxOccurs="unbounded"/> | ||
<element name="optional" type="tns:optionalType" minOccurs="0" maxOccurs="unbounded"/> | ||
<element name="alt" type="tns:altType" minOccurs="0" maxOccurs="unbounded"/> | ||
<element name="br" type="tns:emptyType" minOccurs="0" maxOccurs="unbounded"/> | ||
<element name="titleText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/> | ||
<element name="copyrightText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/> | ||
</choice> | ||
</group> | ||
</schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
<spdx name="BSD Zero Clause License" identifier="0BSD" osi-approved="false"> | ||
<urls> | ||
<url>http://landley.net/toybox/license.html</url> | ||
</urls> | ||
<license> | ||
<copyright> | ||
<p>Copyright (C) 2006 by Rob Landley <[email protected]></p> | ||
</copyright> | ||
<body> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<SPDXLicenseCollection xmlns="http://www.spdx.org/license"> | ||
<license isOsiApproved="false" licenseId="0BSD" name="BSD Zero Clause License"> | ||
<crossRefs> | ||
<crossRef>http://landley.net/toybox/license.html</crossRef> | ||
</crossRefs> | ||
<copyrightText> | ||
<p>Copyright (C) 2006 by Rob Landley <[email protected]></p> | ||
</copyrightText> | ||
|
||
<p>Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is | ||
hereby granted.</p> | ||
<p>THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE | ||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE | ||
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING | ||
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | ||
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</p> | ||
</body> | ||
|
||
</license> | ||
</spdx> | ||
</SPDXLicenseCollection> |
Oops, something went wrong.