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: # 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: # Then, validate with SPDXViewer and SPDXTools:
# #
# $ java -jar SPDXViewer.jar /tmp/license.xml # $ java -jar SPDXViewer.jar /tmp/license.spdx
# $ java -jar java -jar spdx-tools-1.2.5-jar-with-dependencies.jar RdfToHtml /tmp/license.xml /tmp/license.html # $ java -jar java -jar spdx-tools-1.2.5-jar-with-dependencies.jar RdfToHtml /tmp/license.spdx /tmp/license.html
# #
# Finally, copy to dist: # 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, # The algorithm to compute a "verification code", implemented in this file,
# can be verified as follows: # can be verified as follows:
@ -25,13 +28,14 @@
# # build dist tar.xz, copy to /tmp/duktape-N.N.N.tar.xz # # build dist tar.xz, copy to /tmp/duktape-N.N.N.tar.xz
# $ cd /tmp # $ cd /tmp
# $ tar xvfJ duktape-N.N.N.tar.xz # $ 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/ # $ 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: # Resources:
# #
# - http://spdx.org/about-spdx/faqs
# - http://wiki.spdx.org/view/Technical_Team/Best_Practices # - http://wiki.spdx.org/view/Technical_Team/Best_Practices
# #
@ -67,7 +71,7 @@ def computePackageVerification(g, dirname, excluded):
# SPDX 1.2 Section 4.7 # SPDX 1.2 Section 4.7
# The SPDXTools command "GenerateVerificationCode" can be used to # The SPDXTools command "GenerateVerificationCode" can be used to
# check the verification codes created. Note that you must manually # 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. # computing the verification code.
verify_node = BNode() verify_node = BNode()
@ -160,7 +164,7 @@ def main():
g.add((pkg_node, SPDX.originator, duktape_org)) 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.downloadLocation, Literal('http://duktape.org/' + duktape_pkgname, datatype=XSD.anyURI)))
g.add((pkg_node, SPDX.homePage, Literal('http://duktape.org/', 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)) g.add((pkg_node, SPDX.packageVerificationCode, verify_node))
# SPDX.checksum: omitted because license is inside the package # 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.'))) 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. # example Makefiles are packaged into the dist package.
# #
set -e # exit on errors
INITJS_MINIFY=closure INITJS_MINIFY=closure
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
@ -186,7 +188,7 @@ for i in \
duk_replacements.c \ duk_replacements.c \
duk_replacements.h \ duk_replacements.h \
; do ; do
cp src/$i $DISTSRCSEP/ || exit 1 cp src/$i $DISTSRCSEP/
done done
for i in \ for i in \
@ -196,15 +198,15 @@ for i in \
object-assign.js \ object-assign.js \
performance-now.js \ performance-now.js \
; do ; do
cp polyfills/$i $DIST/polyfills/ || exit 1 cp polyfills/$i $DIST/polyfills/
done done
cp examples/README.rst $DIST/examples/ || exit 1 cp examples/README.rst $DIST/examples/
for i in \ for i in \
README.rst \ README.rst \
duk_cmdline.c \ duk_cmdline.c \
; do ; do
cp examples/cmdline/$i $DIST/examples/cmdline/ || exit 1 cp examples/cmdline/$i $DIST/examples/cmdline/
done done
for i in \ for i in \
@ -222,21 +224,21 @@ for i in \
server-socket-test.js \ server-socket-test.js \
client-socket-test.js \ client-socket-test.js \
; do ; do
cp examples/eventloop/$i $DIST/examples/eventloop/ || exit 1 cp examples/eventloop/$i $DIST/examples/eventloop/
done done
for i in \ for i in \
README.rst \ README.rst \
hello.c \ hello.c \
; do ; do
cp examples/hello/$i $DIST/examples/hello/ || exit 1 cp examples/hello/$i $DIST/examples/hello/
done done
for i in \ for i in \
README.rst \ README.rst \
eval.c \ eval.c \
; do ; do
cp examples/eval/$i $DIST/examples/eval/ || exit 1 cp examples/eval/$i $DIST/examples/eval/
done done
for i in \ for i in \
@ -248,7 +250,7 @@ for i in \
primecheck.c \ primecheck.c \
uppercase.c \ uppercase.c \
; do ; do
cp examples/guide/$i $DIST/examples/guide/ || exit 1 cp examples/guide/$i $DIST/examples/guide/
done done
for i in \ for i in \
@ -257,21 +259,21 @@ for i in \
hello.coffee \ hello.coffee \
mandel.coffee \ mandel.coffee \
; do ; do
cp examples/coffee/$i $DIST/examples/coffee/ || exit 1 cp examples/coffee/$i $DIST/examples/coffee/
done done
for i in \ for i in \
README.rst \ README.rst \
jxpretty.c \ jxpretty.c \
; do ; do
cp examples/jxpretty/$i $DIST/examples/jxpretty/ || exit 1 cp examples/jxpretty/$i $DIST/examples/jxpretty/
done done
for i in \ for i in \
README.rst \ README.rst \
sandbox.c \ sandbox.c \
; do ; do
cp examples/sandbox/$i $DIST/examples/sandbox/ || exit 1 cp examples/sandbox/$i $DIST/examples/sandbox/
done done
for i in \ for i in \
@ -280,7 +282,7 @@ for i in \
duk_alloc_logging.h \ duk_alloc_logging.h \
log2gnuplot.py \ log2gnuplot.py \
; do ; do
cp examples/alloc-logging/$i $DIST/examples/alloc-logging/ || exit 1 cp examples/alloc-logging/$i $DIST/examples/alloc-logging/
done done
for i in \ for i in \
@ -288,10 +290,10 @@ for i in \
duk_alloc_torture.c \ duk_alloc_torture.c \
duk_alloc_torture.h \ duk_alloc_torture.h \
; do ; do
cp examples/alloc-torture/$i $DIST/examples/alloc-torture/ || exit 1 cp examples/alloc-torture/$i $DIST/examples/alloc-torture/
done done
cp extras/README.rst $DIST/extras/ || exit cp extras/README.rst $DIST/extras/
# XXX: copy extras # XXX: copy extras
for i in \ for i in \
@ -304,7 +306,7 @@ for i in \
Makefile.sandbox \ Makefile.sandbox \
mandel.js \ mandel.js \
; do ; do
cp dist-files/$i $DIST/ || exit 1 cp dist-files/$i $DIST/
done done
cat dist-files/README.rst | sed \ cat dist-files/README.rst | sed \
@ -680,4 +682,4 @@ perl cloc-1.60.pl --quiet $DISTSRCCOM/duktape.c
rm $DIST/*.tmp rm $DIST/*.tmp
# Create SPDX license once all other files are in place (and cleaned) # 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