summaryrefslogtreecommitdiff
path: root/tools/maint
diff options
context:
space:
mode:
Diffstat (limited to 'tools/maint')
-rwxr-xr-xtools/maint/copyright.sh46
-rwxr-xr-xtools/maint/init_potfiles.sh26
2 files changed, 72 insertions, 0 deletions
diff --git a/tools/maint/copyright.sh b/tools/maint/copyright.sh
new file mode 100755
index 0000000..6dff6b7
--- /dev/null
+++ b/tools/maint/copyright.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+GITCMD="git log --pretty=format:%ad --date=format:%Y "
+
+function get_min_date()
+{
+ $GITCMD $1 | tail -1
+}
+
+function get_max_date()
+{
+ $GITCMD $1 | head -1
+}
+
+function process_c_file()
+{
+ filename=$1
+
+ echo "Processing $filename..."
+
+ min=$( get_min_date $filename )
+
+ max=$( get_max_date $filename )
+
+ if [ "$min" -eq "$max" ]; then
+ timestamp="$min"
+ else
+ timestamp="$min-$max"
+ fi
+
+ sed -i "s# \* Copyright (C) [0-9-]* Cyrille Bagard# \* Copyright (C) $timestamp Cyrille Bagard#" $filename
+
+}
+
+
+if [ ! -f configure.ac ]; then
+ echo "This script has to be run from the top directory."
+ exit 1
+fi
+
+for file in $( find . -name '*.[ch]' -exec grep -l 'Copyright.*Cyrille Bagard$' {} \; );
+do
+ git ls-files --error-unmatch $file > /dev/null 2>&1 \
+ && process_c_file $file
+
+done
diff --git a/tools/maint/init_potfiles.sh b/tools/maint/init_potfiles.sh
new file mode 100755
index 0000000..e92c120
--- /dev/null
+++ b/tools/maint/init_potfiles.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+function keep_i18n() {
+
+ while read file;
+ do
+
+ if [ "$file" != "i18n.h" ]; then
+
+ grep -q '_(' $file
+
+ status=$?
+
+ if [ "$status" -eq 0 ]; then
+ echo $file
+ fi
+
+ fi
+
+ done
+
+}
+
+mkdir -p po
+
+find . -type f -name '*.[ch]' | keep_i18n | sort > po/POTFILES.in