[Pkg-javascript-commits] [node-regjsparser] 01/03: Use node for generate a file
Bastien Roucariès
rouca at moszumanska.debian.org
Mon Sep 18 11:55:28 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-regjsparser.
commit e9572c047fb4fae9a4bba56ea7371bcc536e387a
Author: Bastien ROUCARIÈS <roucaries.bastien at gmail.com>
Date: Sat Sep 16 00:25:18 2017 +0200
Use node for generate a file
---
debian/rules | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 50 insertions(+), 3 deletions(-)
diff --git a/debian/rules b/debian/rules
index 07a8fb1..25b407b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,13 +1,60 @@
#!/usr/bin/make -f
+
+# newline for make
+define newline
+
+
+endef
+space := $(subst ,, )
+# remove new line
+RAW2LINE:=$(subst $(newline),,$(1))
+
+# replace a marker by another file
+define REPLACE_MARKER_FILE_RAW
+ 'use strict';
+ try {
+ var replacementfile = process.argv[1];
+ var readline = require('readline');
+ var fs = require('fs');
+ var rl = readline.createInterface({
+ input: process.stdin,
+ output: null,
+ terminal: false
+ });
+ var replacement = fs.readFileSync(replacementfile,'utf8');
+ rl.on('line', function(line){
+ process.stdout.write(line.replace('@debian-identifier-regex@',replacement));
+ process.stdout.write('\n');
+ });
+ }
+ catch (e) {
+ process.stderr.write(e);
+ process.exit(1);
+ }
+endef
+REPLACE_MARKER_FILE:=$(subst $(newline),,$(REPLACE_MARKER_FILE_RAW))
+
+
%:
dh $@
-override_dh_auto_build:
+override_dh_auto_configure:
+# npm install unicode-10.0.0
+ dh_auto_configure
+
+dist:
mkdir dist
+
+dist/debian-identifier-regex: dist
node tools/generate-identifier-regex.js > dist/debian-identifier-regex
- cp parser.js dist/
- sed -i dist/parser.js -e "s/@debian-identifier-regex@/$$(cat dist/debian-identifier-regex)/g"
+
+dist/parser.js: dist/debian-identifier-regex dist
+ node -pe "$(REPLACE_MARKER_FILE)" dist/debian-identifier-regex < parser.js > dist/parser.js
+
+override_dh_auto_build: dist/parser.js
+ dh_auto_build
override_dh_auto_clean:
rm -rf dist
+ rm -rf node_modules
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-regjsparser.git
More information about the Pkg-javascript-commits
mailing list