[Pkg-javascript-commits] [d3-format] 02/02: Initial Debian packaging
Ximin Luo
infinity0 at debian.org
Sat Nov 19 02:57:27 UTC 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository d3-format.
commit 698c81c12240069a372af53494c2083761af68d1
Author: Ximin Luo <infinity0 at debian.org>
Date: Sat Nov 19 03:55:39 2016 +0100
Initial Debian packaging
---
debian/README.source | 10 +++++++
debian/changelog | 5 ++++
debian/compat | 1 +
debian/control | 60 ++++++++++++++++++++++++++++++++++++++
debian/copyright | 17 +++++++++++
debian/d3-format.js.footer | 11 +++++++
debian/d3-format.js.header | 6 ++++
debian/docs | 1 +
debian/gbp.conf | 3 ++
debian/libjs-d3-format.install | 2 ++
debian/main.mk | 66 ++++++++++++++++++++++++++++++++++++++++++
debian/node-d3-format.install | 3 ++
debian/node-d3-format.links | 2 ++
debian/rules | 20 +++++++++++++
debian/source/format | 1 +
debian/tests/control | 2 ++
debian/watch | 4 +++
17 files changed, 214 insertions(+)
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..665ce93
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,10 @@
+Debian build script
+===================
+
+Instead of packaging node-rollup with all of its dependencies, we recreate its
+output here using a hacky sed-based Makefile, debian/main.mk.
+
+When updating to the next upstream version, you should ensure that the final
+output of diff as run by `debian/rules compare-upstream` is blank.
+
+ -- Ximin Luo <infinity0 at debian.org> Sat, 19 Nov 2016 02:58:59 +0100
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..91c9210
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+d3-format (1.0.2-1) UNRELEASED; urgency=medium
+
+ * Initial release. (Closes: #844784)
+
+ -- Ximin Luo <infinity0 at debian.org> Sat, 19 Nov 2016 00:55:41 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..220dc64
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,60 @@
+Source: d3-format
+Section: web
+Priority: extra
+Maintainer: Debian Javascript Maintainers <pkg-javascript-devel at lists.alioth.debian.org>
+Uploaders: Ximin Luo <infinity0 at debian.org>
+Build-Depends:
+ debhelper (>= 9),
+ nodejs (>= 4.0),
+ node-uglify,
+ python
+Standards-Version: 3.9.8
+Homepage: https://github.com/d3/d3-format
+Vcs-Git: https://anonscm.debian.org/git/pkg-javascript/node-d3-format.git
+Vcs-Browser: https://anonscm.debian.org/cgit/pkg-javascript/node-d3-format.git
+
+Package: libjs-d3-format
+Architecture: any
+Depends: ${misc:Depends}
+Recommends: javascript-common
+Description: Formatting numbers for human consumption - browser library
+ Sometimes JavaScript doesn’t display numbers the way you expect. For example,
+ printing tenths with a naive simple loop might give you 0, 0.1, 0.2,
+ 0.30000000000000004, 0.4, 0.5, 0.6000000000000001, 0.7000000000000001, 0.8,
+ 0.9 - welcome to binary floating point!
+ .
+ Yet rounding error is not the only reason to customize number formatting. A
+ table of numbers should be formatted consistently for comparison; above, 0.0
+ would be better than 0. Large numbers should have grouped digits (e.g.,
+ 42,000) or be in scientific or metric notation (4.2e+4, 42k). Currencies
+ should have fixed precision ($3.50). Reported numerical results should be
+ rounded to significant digits (4021 becomes 4000). Number formats should
+ appropriate to the reader’s locale (42.000,00 or 42,000.00). The list goes on.
+ .
+ Formatting numbers for human consumption is the purpose of d3-format, which is
+ modeled after Python 3’s format specification mini-language (PEP 3101).
+ .
+ This package contains the plain JS library as well as a minified version.
+
+Package: node-d3-format
+Architecture: any
+Depends: ${misc:Depends}, libjs-d3-format
+Recommends: nodejs
+Description: Formatting numbers for human consumption - NodeJS module
+ Sometimes JavaScript doesn’t display numbers the way you expect. For example,
+ printing tenths with a naive simple loop might give you 0, 0.1, 0.2,
+ 0.30000000000000004, 0.4, 0.5, 0.6000000000000001, 0.7000000000000001, 0.8,
+ 0.9 - welcome to binary floating point!
+ .
+ Yet rounding error is not the only reason to customize number formatting. A
+ table of numbers should be formatted consistently for comparison; above, 0.0
+ would be better than 0. Large numbers should have grouped digits (e.g.,
+ 42,000) or be in scientific or metric notation (4.2e+4, 42k). Currencies
+ should have fixed precision ($3.50). Reported numerical results should be
+ rounded to significant digits (4021 becomes 4000). Number formats should
+ appropriate to the reader’s locale (42.000,00 or 42,000.00). The list goes on.
+ .
+ Formatting numbers for human consumption is the purpose of d3-format, which is
+ modeled after Python 3’s format specification mini-language (PEP 3101).
+ .
+ This package contains the NodeJS package.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..90eeba3
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,17 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: d3-format
+Source: https://github.com/d3/d3-format
+
+Files: *
+Copyright: 2010-2015 Mike Bostock <mbostock at gmail.com>
+License: BSD-3-Clause
+
+Files: debian/*
+Copyright: 2016 Ximin Luo <infinity0 at debian.org>
+License: BSD-3-clause
+
+License: BSD-3-clause
+ On Debian systems, the complete text of the BSD 3 Clause License can
+ be found in the file `/usr/share/common-licenses/BSD', replacing
+ references to the University of California with the appropriate
+ copyright holder.
diff --git a/debian/d3-format.js.footer b/debian/d3-format.js.footer
new file mode 100644
index 0000000..5062798
--- /dev/null
+++ b/debian/d3-format.js.footer
@@ -0,0 +1,11 @@
+
+exports.formatDefaultLocale = defaultLocale;
+exports.formatLocale = formatLocale;
+exports.formatSpecifier = formatSpecifier;
+exports.precisionFixed = precisionFixed;
+exports.precisionPrefix = precisionPrefix;
+exports.precisionRound = precisionRound;
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/debian/d3-format.js.header b/debian/d3-format.js.header
new file mode 100644
index 0000000..a86f555
--- /dev/null
+++ b/debian/d3-format.js.header
@@ -0,0 +1,6 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ (factory((global.d3 = global.d3 || {})));
+}(this, (function (exports) { 'use strict';
+
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..b43bf86
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README.md
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..5474c60
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+pristine-tar = True
+sign-tags = True
diff --git a/debian/libjs-d3-format.install b/debian/libjs-d3-format.install
new file mode 100644
index 0000000..d17a5d0
--- /dev/null
+++ b/debian/libjs-d3-format.install
@@ -0,0 +1,2 @@
+build/* usr/share/javascript/d3-format
+locale usr/share/javascript/d3-format
diff --git a/debian/main.mk b/debian/main.mk
new file mode 100755
index 0000000..fa4164d
--- /dev/null
+++ b/debian/main.mk
@@ -0,0 +1,66 @@
+#!/usr/bin/make -f
+# Replacement for upstream's rollup-based buildsystem
+
+SOURCES = \
+ formatDecimal \
+ exponent \
+ formatGroup \
+ formatDefault \
+ formatPrefixAuto \
+ formatRounded \
+ formatTypes \
+ formatSpecifier \
+ locale \
+ defaultLocale \
+ precisionFixed \
+ precisionPrefix \
+ precisionRound
+
+FUNCTIONS = \
+ formatDefaultLocale \
+ formatLocale \
+ formatSpecifier \
+ precisionFixed \
+ precisionPrefix \
+ precisionRound
+
+EXPORT_VAR = \
+ -e '/^export var $(1);/d' \
+ -e 's/^\( *\)\($(1) = .*\)/\1exports.\2/g'
+
+EXPORT_PROTOTYPE = \
+ -e '/function $(1)/,/^}/{s ^} }\n\n$(1).prototype = $(2).prototype; // instanceof g}'
+
+HEADER = \
+ python -c 'import json; x = json.load(open("package.json")); \
+ print("// %s Version %s Copyright %s" % (x["homepage"], x["version"], x["author"]["name"]))'
+
+ALL = build/d3-format.js build/d3-format.min.js
+
+all: $(ALL)
+
+build/%.js: debian/rules debian/%.js.header debian/%.js.footer
+ mkdir -p build && rm -f "$@" && touch "$@"
+ $(HEADER) >> "$@"
+ cat debian/$*.js.header >> "$@"
+ set -e; for i in $(SOURCES); do \
+ sed \
+ $(call EXPORT_VAR,format) \
+ $(call EXPORT_VAR,formatPrefix) \
+ -e 's/export default function.*(/function '"$$i"'(/g' \
+ -e '/^import .* from/d' \
+ -e 's/^export var/var/g' \
+ -e 's/export default {/var '"$$i"' = {/g' \
+ -e 's/function locale/function formatLocale/' \
+ $(call EXPORT_PROTOTYPE,formatSpecifier,FormatSpecifier) \
+ "src/$$i.js" >> "$@"; \
+ done
+ cat debian/$*.js.footer >> "$@"
+
+build/%.min.js: build/%.js
+ uglifyjs --preamble "$$($(HEADER))" "$<" -c -m -o "$@"
+
+clean:
+ rm -rf $(ALL)
+
+.PHONY: all clean
diff --git a/debian/node-d3-format.install b/debian/node-d3-format.install
new file mode 100644
index 0000000..baa7117
--- /dev/null
+++ b/debian/node-d3-format.install
@@ -0,0 +1,3 @@
+# No point installing these since they are not plain normal JS
+#src/* usr/lib/nodejs/d3-format/lib
+package.json usr/lib/nodejs/d3-format/
diff --git a/debian/node-d3-format.links b/debian/node-d3-format.links
new file mode 100644
index 0000000..c8791cb
--- /dev/null
+++ b/debian/node-d3-format.links
@@ -0,0 +1,2 @@
+usr/share/javascript/d3-format/d3-format.js usr/lib/nodejs/d3-format/build/d3-format.js
+usr/share/javascript/d3-format/locale usr/lib/nodejs/d3-format/locale
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..f9c85d2
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,20 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If this is blank then we're all good. If not, then you need to update main.mk
+compare-upstream:
+ NODE_PATH=debian npm --prefix=debian install d3-format
+ $(MAKE) -f debian/main.mk all
+ diff -ruwB build/d3-format.js debian/node_modules/d3-format/build/d3-format.js
+
+%:
+ dh $@
+
+override_dh_auto_build:
+ $(MAKE) -f debian/main.mk all
+
+override_dh_auto_clean:
+ $(MAKE) -f debian/main.mk clean
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..c980b1c
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Test-Command: nodejs -e "require('"'"'d3-format'"'"');"
+Depends: @
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..ecc520a
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,4 @@
+version=4
+opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%d3-format-$1.tar.gz%" \
+ https://github.com/d3/d3-format/tags \
+ (?:.*?/)?v?(\d[\d.]*)\.tar\.gz
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/d3-format.git
More information about the Pkg-javascript-commits
mailing list