File: convert-kdebug-with-argument.sh

package info (click to toggle)
kde-dev-scripts 4%3A20.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,476 kB
  • sloc: perl: 15,559; lisp: 5,627; sh: 4,315; python: 3,892; ruby: 1,386; makefile: 13; sed: 9
file content (30 lines) | stat: -rwxr-xr-x 1,049 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

if test $# != 4; then
  echo "Usage : $0 <old category number> <new log name> <new category name> <debug name file>"
  echo "example : convert-kdebug-with-argument.sh 7112 log_smtp SMTP_LOG smtp_debug"
  exit 1
fi


oldcategorynumber="$1"
newlogname="$2"
newcategoryname="$3"
debugnamefile="$4"

upname=`echo $debugnamefile | tr 'a-z' 'A-Z'`

#convert debug to new qCDebug/qCWarning/qCCritical

find -iname "*.cpp" -o -iname "*.h" | xargs sed -ri \
		-e "s|^(\s*#include\s+)<KDebug>|\1<QDebug>\n\1\"${debugnamefile}.h\"|" \
		-e "s,k(Debug|Warning)\s*\(\s*$oldcategorynumber\s*\),qC\1\($newcategoryname\)," \
		-e "s,k(Fatal|Error)\s*\(\s*$oldcategorynumber\s*\),qCCritical\($newcategoryname\),"


# end
echo "1) add ecm_qt_declare_logging_category(<file>_SRCS HEADER $debugnamefile.h IDENTIFIER $newcategoryname CATEGORY_NAME $newlogname) to CMakeLists.txt";
echo "2) #include \"${debugnamefile}.h\" to each file which was changed and where it is missing"
echo "3) Verify that it compiles :)"
echo "4) If you find bugs fix them please"