[pacman-dev] Move update-copyright into build-aux

Message ID 20191105052705.942931-1-allan@archlinux.org
State Accepted, archived
Headers show
Series [pacman-dev] Move update-copyright into build-aux | expand

Commit Message

Allan McRae Nov. 5, 2019, 5:27 a.m. UTC
This is a useful function to update all our copyright years. Move
it into build-aux so that it is not lost in the switch to meson.

Signed-off-by: Allan McRae <allan@archlinux.org>
---
 Makefile.am                | 7 +------
 build-aux/update-copyright | 8 ++++++++
 2 files changed, 9 insertions(+), 6 deletions(-)
 create mode 100755 build-aux/update-copyright

Patch

diff --git a/Makefile.am b/Makefile.am
index c661f447..851bf472 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -77,9 +77,4 @@  update-po:
 	$(MAKE) -C scripts/po update-po
 	$(MAKE) -C src/pacman/po update-po
 
-update-copyright:
-	for file in $(shell sh -c 'git grep -l "Copyright .* Pacman Development" | grep -v "\.po"'); do \
-	  sed -i -e "/Copyright (/s/-$(OLD)/-$(NEW)/" -e "/Copyright (/s/ $(OLD)/ $(OLD)-$(NEW)/" "$$file"; \
-	done
-
-.PHONY: update-po update-copyright
+.PHONY: update-po
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
new file mode 100755
index 00000000..eef368b8
--- /dev/null
+++ b/build-aux/update-copyright
@@ -0,0 +1,8 @@ 
+#! /bin/sh
+
+OLD=$1
+NEW=$2
+
+for file in $(git grep -l "Copyright .* Pacman Development" | grep -v "\.po"); do \
+	sed -i -e "/Copyright (/s/-${OLD}/-${NEW}/" -e "/Copyright (/s/ ${OLD}/ ${OLD}-${NEW}/" "$file"
+done