[Pkg-javascript-commits] [node-regjsparser] 01/01: Fix regex substitution in build process

Daniel Ring techwolf-guest at moszumanska.debian.org
Tue Sep 26 10:02:16 UTC 2017


This is an automated email from the git hooks/post-receive script.

techwolf-guest pushed a commit to branch master
in repository node-regjsparser.

commit 3da8f6055aba3f9973082a1aee03c073173c92cb
Author: Daniel Ring <dring at wolfishly.me>
Date:   Tue Sep 26 02:55:40 2017 -0700

    Fix regex substitution in build process
---
 debian/rules | 38 ++------------------------------------
 1 file changed, 2 insertions(+), 36 deletions(-)

diff --git a/debian/rules b/debian/rules
index c8fc68b..32ff1ab 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,40 +1,5 @@
 #!/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))
-
 # run pipe exit if first or second fail
 PIPESAFE=exec 3>&1 && exec 4>&1 && error_first=$$( ( ( $(1) ; echo $$? >&3) | $(2) >&4 ) 3>&1)  && test "X$$error_first" = "X0"
 
@@ -50,9 +15,10 @@ dist:
 
 dist/debian-identifier-regex: dist
 	node tools/generate-identifier-regex.js > dist/debian-identifier-regex
+	sed -i 's/\\/\\\\/g' dist/debian-identifier-regex
 
 dist/parser.js: dist/debian-identifier-regex dist
-	node -pe "$(REPLACE_MARKER_FILE)" dist/debian-identifier-regex < parser.js > dist/parser.js
+	REGEX=$$(cat dist/debian-identifier-regex); sed "s/@debian-identifier-regex@/$$REGEX/g" parser.js > dist/parser.js
 
 override_dh_auto_build: dist/parser.js
 	dh_auto_build

-- 
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