[Pkg-javascript-commits] [node-ws] 04/10: add uscan repacking script to pull in dependencies that have no chance of becoming a Debian package
Ximin Luo
infinity0 at pwned.gg
Mon Mar 30 02:37:19 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0-guest pushed a commit to branch master
in repository node-ws.
commit 2b333b1ab609190076b13198ad0716ecafd83626
Author: Ximin Luo <infinity0 at pwned.gg>
Date: Mon Mar 30 04:08:25 2015 +0200
add uscan repacking script to pull in dependencies that have no chance of becoming a Debian package
---
debian/rules | 3 ++
debian/uscan | 104 ++++++++++++++++++++++++++++++++++++++++++++
debian/watch | 2 +-
debian/watch.bufferutil | 3 ++
debian/watch.options.js | 3 ++
debian/watch.ultron | 3 ++
debian/watch.utf-8-validate | 3 ++
debian/watch.wscat | 3 ++
8 files changed, 123 insertions(+), 1 deletion(-)
diff --git a/debian/rules b/debian/rules
index b1cd1cd..643b565 100755
--- a/debian/rules
+++ b/debian/rules
@@ -38,4 +38,7 @@ override_dh_installchangelogs:
debian/wscat.1:
help2man -N -n "Communicate over websocket" debian/wscat -o "$@"
+get-orig-source:
+ debian/uscan
+
.PHONY: debian/clean
diff --git a/debian/uscan b/debian/uscan
new file mode 100755
index 0000000..8ce1cca
--- /dev/null
+++ b/debian/uscan
@@ -0,0 +1,104 @@
+#!/bin/sh
+# Upstream thinks it's a good idea to create a whole new github repo plus an
+# npm package for every generic-but-solved-in-a-specific-way sub-component of
+# their project.
+#
+# They are wrong, group them back together here. We don't have time to package
+# 6 Debian packages (that will never be used by anyone else) just for node-ws.
+
+TMPDIR=debian/get-orig-source.tmp
+VERFILE=dependency.versions
+
+set -e
+
+if [ -n "$1" ]; then
+ version="$2"
+ filename="$3"
+ test -d "$TMPDIR" || exit 147
+ if [ "$(basename "$filename")" = "ws-$version.tar.gz" ]; then
+ echo "$version" >> "$TMPDIR/version"
+ else
+ echo "$filename=$version" | sed -e "s,$TMPDIR/ws-\(.*\)-$version.tar.gz,\1,g" >> "$TMPDIR/$VERFILE"
+ fi
+ tar -C "$TMPDIR" -xf "$filename"
+ exit
+fi
+
+rm -rf "$TMPDIR"
+mkdir -p "$TMPDIR"
+
+cur_version="$(dpkg-parsechangelog -n1 -S Version | sed -e 's,\(.*\)-.*,\1,g' | sed -re 's,([^+]+)(\+ds([0-9]+)\.(.*))?,\1-\3-\4,g')"
+cur_upstream="$(echo "$cur_version" | cut -d- -f1)"
+cur_depiter="$(echo "$cur_version" | cut -d- -f2)"
+cur_depiter="${cur_depiter:-0}"
+cur_dephash="$(echo "$cur_version" | cut -d- -f3)"
+cur_dephash="${cur_dephash:-0}"
+
+git_clone_head() {
+ local repo="$1"
+ local dep="$2"
+ local oldpwd="$(pwd -P)"
+ cd "$TMPDIR"
+ git clone "https://github.com/$repo/$dep"
+ cd "$dep"
+ git tag 0 "$(git rev-list HEAD | tail -n 1)"
+ local version="$(git describe --tags | sed -e 's,-,.,g')"
+ cd ..
+ mv "$dep" "$dep-$version"
+ cd "$oldpwd"
+ echo "$dep=$version" >> "$TMPDIR/$VERFILE"
+}
+
+get_dep() {
+ local repo="$1"
+ local dep="$2"
+ uscan --destdir="$TMPDIR" --no-symlink --upstream-version 0 --download --package "ws-$dep" --watchfile "debian/watch.$dep" || git_clone_head "$1" "$2"
+}
+
+get_dep websockets bufferutil
+get_dep websockets utf-8-validate
+get_dep unshiftio ultron
+get_dep einaros options.js
+get_dep websockets wscat
+
+new_dephash="$(sha256sum "$TMPDIR/$VERFILE" | cut -b1-8)"
+
+if [ "$new_dephash" = "$cur_dephash" ]; then
+ if ! uscan --destdir "$TMPDIR" --no-symlink --upstream-version "${cur_upstream}"; then
+ rm -rf "$TMPDIR"
+ echo >&2 "no newer version, exiting"
+ exit 1
+ fi
+else
+ uscan --destdir "$TMPDIR" --no-symlink --upstream-version "${cur_upstream}~~"
+fi
+
+origpwd="$(pwd -P)"
+cd "$TMPDIR"
+new_upstream="$(cat version)"
+cd "ws-$new_upstream"
+mkdir -p bin
+mkdir -p src
+mkdir -p node_modules/options
+mkdir -p node_modules/ultron
+cp ../bufferutil-*/src/*.cc src
+cp ../utf-8-validate-*/src/*.cc src
+cp ../wscat-*/bin/* bin
+cp ../ultron-*/index.js node_modules/ultron/index.js
+cp ../options.js-*/lib/options.js node_modules/options/index.js
+python - ../bufferutil-*/binding.gyp ../utf-8-validate-*/binding.gyp >binding.gyp <<EOF
+import ast, itertools, pprint, sys
+o = [ast.literal_eval(open(i).read()) for i in sys.argv[1:]]
+pprint.pprint({"targets": list(itertools.chain(*(x["targets"] for x in o)))})
+EOF
+cp ../"$VERFILE" .
+cd ..
+
+new_depiter=$((cur_depiter + 1))
+new_version="${new_upstream}+ds${new_depiter}.${new_dephash}"
+mv "ws-${new_upstream}" "node-ws_${new_version}"
+tar -cJf "node-ws_${new_version}.orig.tar.xz" "node-ws_${new_version}"
+
+cd "$origpwd"
+mv "$TMPDIR/node-ws_${new_version}.orig.tar.xz" ..
+rm -rf "$TMPDIR"
diff --git a/debian/watch b/debian/watch
index fb4b2e9..f5c44fb 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,3 +1,3 @@
version=3
opts=filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/ws-$1.tar.gz/ \
-https://github.com/einaros/ws/tags .*/archive/v?([\d\.]+).tar.gz
+https://github.com/einaros/ws/tags .*/archive/v?([\d\.]+).tar.gz debian debian/uscan
diff --git a/debian/watch.bufferutil b/debian/watch.bufferutil
new file mode 100644
index 0000000..e4e71b2
--- /dev/null
+++ b/debian/watch.bufferutil
@@ -0,0 +1,3 @@
+version=3
+opts=filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/ws-bufferutil-$1.tar.gz/ \
+https://github.com/websockets/bufferutil/tags .*/archive/v?([\d\.]+).tar.gz debian debian/uscan
diff --git a/debian/watch.options.js b/debian/watch.options.js
new file mode 100644
index 0000000..99dfebc
--- /dev/null
+++ b/debian/watch.options.js
@@ -0,0 +1,3 @@
+version=3
+opts=filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/ws-options.js-$1.tar.gz/ \
+https://github.com/einaros/options.js/tags .*/archive/v?([\d\.]+).tar.gz debian debian/uscan
diff --git a/debian/watch.ultron b/debian/watch.ultron
new file mode 100644
index 0000000..64a38af
--- /dev/null
+++ b/debian/watch.ultron
@@ -0,0 +1,3 @@
+version=3
+opts=filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/ws-ultron-$1.tar.gz/ \
+https://github.com/unshiftio/ultron/tags .*/archive/v?([\d\.]+).tar.gz debian debian/uscan
diff --git a/debian/watch.utf-8-validate b/debian/watch.utf-8-validate
new file mode 100644
index 0000000..9304dc3
--- /dev/null
+++ b/debian/watch.utf-8-validate
@@ -0,0 +1,3 @@
+version=3
+opts=filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/ws-utf-8-validate-$1.tar.gz/ \
+https://github.com/websockets/utf-8-validate/tags .*/archive/v?([\d\.]+).tar.gz debian debian/uscan
diff --git a/debian/watch.wscat b/debian/watch.wscat
new file mode 100644
index 0000000..3722a4f
--- /dev/null
+++ b/debian/watch.wscat
@@ -0,0 +1,3 @@
+version=3
+opts=filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/ws-wscat-$1.tar.gz/ \
+https://github.com/websockets/wscat/tags .*/archive/v?([\d\.]+).tar.gz debian debian/uscan
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-ws.git
More information about the Pkg-javascript-commits
mailing list