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 <philipp.hartmann@offis.de>
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/\((.*?)\)/'<debian/changelog)/" pristine-tar.spec
+pristine-tar.spec: debian/changelog
+ sed "s/Version:.*/Version: $$($(PERLRUN) -e '$$_=<>;print m/\((.*?)\)/'<$<)/" \
+ $@ > $@.new && $(MV) $@.new $@
.PHONY: pristine-tar.spec
}