Browse Source

Use 'license.spdx' for SPDX license name

Also add 'set -e' to make_dist.sh.
weak-references
Sami Vaarala 10 years ago
parent
commit
fc68fc3876
  1. 20
      util/create_spdx_license.py
  2. 34
      util/make_dist.sh

20
util/create_spdx_license.py

@ -8,16 +8,19 @@
#
# The utility outputs RDF/XML to specified file:
#
# $ python create_spdx_license.py /tmp/license.xml
# $ python create_spdx_license.py /tmp/license.spdx
#
# Then, validate with SPDXViewer and SPDXTools:
#
# $ java -jar SPDXViewer.jar /tmp/license.xml
# $ java -jar java -jar spdx-tools-1.2.5-jar-with-dependencies.jar RdfToHtml /tmp/license.xml /tmp/license.html
# $ java -jar SPDXViewer.jar /tmp/license.spdx
# $ java -jar java -jar spdx-tools-1.2.5-jar-with-dependencies.jar RdfToHtml /tmp/license.spdx /tmp/license.html
#
# Finally, copy to dist:
#
# $ cp /tmp/license.xml dist/
# $ cp /tmp/license.spdx dist/license.spdx
#
# SPDX FAQ indicates there is no standard extension for an SPDX license file
# but '.spdx' is a common practice.
#
# The algorithm to compute a "verification code", implemented in this file,
# can be verified as follows:
@ -25,13 +28,14 @@
# # build dist tar.xz, copy to /tmp/duktape-N.N.N.tar.xz
# $ cd /tmp
# $ tar xvfJ duktape-N.N.N.tar.xz
# $ rm duktape-N.N.N/license.xml # remove file excluded from verification code
# $ rm duktape-N.N.N/license.spdx # remove file excluded from verification code
# $ java -jar spdx-tools-1.2.5-jar-with-dependencies.jar GenerateVerificationCode /tmp/duktape-N.N.N/
#
# Compare the resulting verification code manually with the one in license.xml.
# Compare the resulting verification code manually with the one in license.spdx.
#
# Resources:
#
# - http://spdx.org/about-spdx/faqs
# - http://wiki.spdx.org/view/Technical_Team/Best_Practices
#
@ -67,7 +71,7 @@ def computePackageVerification(g, dirname, excluded):
# SPDX 1.2 Section 4.7
# The SPDXTools command "GenerateVerificationCode" can be used to
# check the verification codes created. Note that you must manually
# remove "license.xml" from the unpacked dist directory before
# remove "license.spdx" from the unpacked dist directory before
# computing the verification code.
verify_node = BNode()
@ -160,7 +164,7 @@ def main():
g.add((pkg_node, SPDX.originator, duktape_org))
g.add((pkg_node, SPDX.downloadLocation, Literal('http://duktape.org/' + duktape_pkgname, datatype=XSD.anyURI)))
g.add((pkg_node, SPDX.homePage, Literal('http://duktape.org/', datatype=XSD.anyURI)))
verify_node = computePackageVerification(g, '.', [ './license.xml' ])
verify_node = computePackageVerification(g, '.', [ './license.spdx' ])
g.add((pkg_node, SPDX.packageVerificationCode, verify_node))
# SPDX.checksum: omitted because license is inside the package
g.add((pkg_node, SPDX.sourceInfo, Literal('Official duktape.org release built from GitHub repo https://github.com/svaarala/duktape.')))

34
util/make_dist.sh

@ -19,6 +19,8 @@
# example Makefiles are packaged into the dist package.
#
set -e # exit on errors
INITJS_MINIFY=closure
while [ $# -gt 0 ]; do
case "$1" in
@ -186,7 +188,7 @@ for i in \
duk_replacements.c \
duk_replacements.h \
; do
cp src/$i $DISTSRCSEP/ || exit 1
cp src/$i $DISTSRCSEP/
done
for i in \
@ -196,15 +198,15 @@ for i in \
object-assign.js \
performance-now.js \
; do
cp polyfills/$i $DIST/polyfills/ || exit 1
cp polyfills/$i $DIST/polyfills/
done
cp examples/README.rst $DIST/examples/ || exit 1
cp examples/README.rst $DIST/examples/
for i in \
README.rst \
duk_cmdline.c \
; do
cp examples/cmdline/$i $DIST/examples/cmdline/ || exit 1
cp examples/cmdline/$i $DIST/examples/cmdline/
done
for i in \
@ -222,21 +224,21 @@ for i in \
server-socket-test.js \
client-socket-test.js \
; do
cp examples/eventloop/$i $DIST/examples/eventloop/ || exit 1
cp examples/eventloop/$i $DIST/examples/eventloop/
done
for i in \
README.rst \
hello.c \
; do
cp examples/hello/$i $DIST/examples/hello/ || exit 1
cp examples/hello/$i $DIST/examples/hello/
done
for i in \
README.rst \
eval.c \
; do
cp examples/eval/$i $DIST/examples/eval/ || exit 1
cp examples/eval/$i $DIST/examples/eval/
done
for i in \
@ -248,7 +250,7 @@ for i in \
primecheck.c \
uppercase.c \
; do
cp examples/guide/$i $DIST/examples/guide/ || exit 1
cp examples/guide/$i $DIST/examples/guide/
done
for i in \
@ -257,21 +259,21 @@ for i in \
hello.coffee \
mandel.coffee \
; do
cp examples/coffee/$i $DIST/examples/coffee/ || exit 1
cp examples/coffee/$i $DIST/examples/coffee/
done
for i in \
README.rst \
jxpretty.c \
; do
cp examples/jxpretty/$i $DIST/examples/jxpretty/ || exit 1
cp examples/jxpretty/$i $DIST/examples/jxpretty/
done
for i in \
README.rst \
sandbox.c \
; do
cp examples/sandbox/$i $DIST/examples/sandbox/ || exit 1
cp examples/sandbox/$i $DIST/examples/sandbox/
done
for i in \
@ -280,7 +282,7 @@ for i in \
duk_alloc_logging.h \
log2gnuplot.py \
; do
cp examples/alloc-logging/$i $DIST/examples/alloc-logging/ || exit 1
cp examples/alloc-logging/$i $DIST/examples/alloc-logging/
done
for i in \
@ -288,10 +290,10 @@ for i in \
duk_alloc_torture.c \
duk_alloc_torture.h \
; do
cp examples/alloc-torture/$i $DIST/examples/alloc-torture/ || exit 1
cp examples/alloc-torture/$i $DIST/examples/alloc-torture/
done
cp extras/README.rst $DIST/extras/ || exit
cp extras/README.rst $DIST/extras/
# XXX: copy extras
for i in \
@ -304,7 +306,7 @@ for i in \
Makefile.sandbox \
mandel.js \
; do
cp dist-files/$i $DIST/ || exit 1
cp dist-files/$i $DIST/
done
cat dist-files/README.rst | sed \
@ -680,4 +682,4 @@ perl cloc-1.60.pl --quiet $DISTSRCCOM/duktape.c
rm $DIST/*.tmp
# Create SPDX license once all other files are in place (and cleaned)
python util/create_spdx_license.py `pwd`/dist/license.xml
python util/create_spdx_license.py `pwd`/dist/license.spdx

Loading…
Cancel
Save