From: Philipp A. Hartmann Date: Mon, 27 Aug 2012 13:15:34 +0000 (+0200) Subject: Makefile.PL: avoid in-place editing with sed X-Git-Tag: 1.27~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2dd28bf5f7a18e45af8285696bdbc31f6207f83c;p=tools%2Fpristine-tar.git Makefile.PL: avoid in-place editing with sed This patch avoids the usage of the in-place editing option '-i' of sed for version number extraction from debian/changelog to update pristine-tar.spec. The -i option is not supported by all versions of sed (e.g. not by SunOS 5.9 nor by NetBSD 6.0). Additionally, the exact syntax may vary. E.g., the sed of Mac OS X requires -i to be followed by a suffix, which is added to the original filename to create a backup file. The portable solution is to avoid the in-place editing altogether and to instead write first to a temporary file, which is then moved back to the original filename. In addition to the use of a temporary file, the rule has been changed to use the PERLRUN variable to invoke the correct perl interpreter and a dependency on debian/changelog (the phonyness of the rule could be dropped as well). Signed-off-by: Philipp A. Hartmann --- diff --git a/Makefile.PL b/Makefile.PL index cd4f31b..e28b636 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -38,8 +38,9 @@ extra_clean: rm -f *.1 zgz/zgz $(MAKE) clean -C pit/suse-bzip2 PREFIX=$(PREFIX) -pristine-tar.spec: - sed -i "s/Version:.*/Version: $$(perl -e '$$_=<>;print m/\((.*?)\)/';print m/\((.*?)\)/'<$<)/" \ + $@ > $@.new && $(MV) $@.new $@ .PHONY: pristine-tar.spec }