Tribler: added scripts that modify the sources in order to provide logging information.
authorAdriana Draghici <adriana008@gmail.com>
Sat, 14 Nov 2009 16:03:55 +0000 (16:03 +0000)
committerAdriana Draghici <adriana008@gmail.com>
Sat, 14 Nov 2009 16:03:55 +0000 (16:03 +0000)
12 files changed:
tribler-mod/scrips/README [new file with mode: 0644]
tribler-mod/scrips/make_changes.sh [new file with mode: 0755]
tribler-mod/scrips/modified_files_DEBUG [moved from tribler-mod/scrips/modified_files with 100% similarity]
tribler-mod/scrips/modified_files_DEBUG_NORMAL [new file with mode: 0644]
tribler-mod/scrips/modify.sh [deleted file]
tribler-mod/scrips/modify_Connecter.sh [new file with mode: 0755]
tribler-mod/scrips/modify_all_print.sh [new file with mode: 0755]
tribler-mod/scrips/print_timestamp.sh [new file with mode: 0755]
tribler-mod/scrips/set_DEBUG_NORMAL.sh [new file with mode: 0755]
tribler-mod/scrips/undo_changes.sh [new file with mode: 0755]
tribler-mod/scrips/unmodify.sh [deleted file]
tribler-mod/scrips/unmodify_all_print.sh [new file with mode: 0755]

diff --git a/tribler-mod/scrips/README b/tribler-mod/scrips/README
new file mode 100644 (file)
index 0000000..da8f2bd
--- /dev/null
@@ -0,0 +1,28 @@
+
+
+===== Scripturi ========
+
+1. modify_all_print.sh - adauga in instructiunile print din toate fisierele sursa, informatii legate de timp.
+2. print_timestamp.sh - adauga in instructiunile print informatii legate de timp.
+                                        - caile catre fisierele sursa modificate sunt scrise intr-un fisier dat ca argument scriptului. 
+3. set_DEBUG.sh - seteaza DEBUG pe true
+4. set_DEBUG_NORMAL.sh - seteaza DEBUG_NORMAL pe true
+
+Exemplu:
+
+./print_timestamp.sh modified_files_DEBUG
+./set_DEBUG.sh t modified_files_DEBUG
+./set_DEBUG_NORMAL.sh t modified_files_DEBUG_NORMAL
+
+
+5. make_changes.sh - modifica instr print din toate fisierele, face schimbarile legate de flag-urile DEBUG
+                                       si DEBUG_NORMAL in fisierele listate in modified_files_DEBUG, respectiv modified_files_DEBUG_NORMAL.
+
+6. undo_changes.sh - aduce sursele la forma in care erau inaintea rularii scripturilor de modificare.
+
+
+
+Fisierele modified_files_* contin pe fiecare linie calea catre un fisier ce trebuie modificat.
+Liniile care nu contin cel putin un "/" sunt ignorate.
+
+
diff --git a/tribler-mod/scrips/make_changes.sh b/tribler-mod/scrips/make_changes.sh
new file mode 100755 (executable)
index 0000000..fde5fac
--- /dev/null
@@ -0,0 +1,7 @@
+# Modifies tribler sources to output logging information.
+
+./modify_all_print.sh 
+./set_DEBUG.sh  t modified_files_DEBUG
+./set_DEBUG_NORMAL.sh  t modified_files_DEBUG_NORMAL
+
+
diff --git a/tribler-mod/scrips/modified_files_DEBUG_NORMAL b/tribler-mod/scrips/modified_files_DEBUG_NORMAL
new file mode 100644 (file)
index 0000000..e685b55
--- /dev/null
@@ -0,0 +1,2 @@
+./Tribler/Core/BitTornado/BT1/Connecter.py  
+
diff --git a/tribler-mod/scrips/modify.sh b/tribler-mod/scrips/modify.sh
deleted file mode 100755 (executable)
index 40d35ee..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-for i in $(find -name '*.py' -type f | grep -v '.svn'); do sed -i.bak 's/print >>sys.stderr,/print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ",/g' $i; sed -i.bak '1i\from time import localtime, strftime\n' $i; done;
diff --git a/tribler-mod/scrips/modify_Connecter.sh b/tribler-mod/scrips/modify_Connecter.sh
new file mode 100755 (executable)
index 0000000..c74e99f
--- /dev/null
@@ -0,0 +1,3 @@
+
+sed -i.bak 's/print[ \t]\'/print >>sys.strderr, \'/g' Tribler/Core/BitTornado/BT1/Connecter.py;
+
diff --git a/tribler-mod/scrips/modify_all_print.sh b/tribler-mod/scrips/modify_all_print.sh
new file mode 100755 (executable)
index 0000000..69e3a44
--- /dev/null
@@ -0,0 +1,2 @@
+# Modifies all print instructions in order to output time information.
+for i in $(find -name '*.py' -type f | grep -v '.svn'); do sed -i.bak 's/print[ \t]*>>sys.stderr,/print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ",/g' $i; sed -i.bak '1i\from time import localtime, strftime' $i; done;
diff --git a/tribler-mod/scrips/print_timestamp.sh b/tribler-mod/scrips/print_timestamp.sh
new file mode 100755 (executable)
index 0000000..01dad8e
--- /dev/null
@@ -0,0 +1,18 @@
+
+# Modifies print instructions in given files in order to output time information.
+if test $# -lt 2 -o \( "-$1" != "-a" -a "-$1" != "-d" \)
+then
+       echo "Usage: ";echo "$0 a <filename> - adds timestamp to print instructions in the source files listed in <filename>"
+       echo "$0 d <filename> - removes timestamp from print instructions in the source files listed in <filename>"
+else
+#      for i in $(cat $2 | grep "/");do echo $i; done;
+       if test "-$1" == "-a"
+       then
+               for i in $(cat $2 | grep "/"); do sed -i.bak 's/print[ \t]*>>sys.stderr,/print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ",/g' $i; sed -i.bak '1i\from time import localtime, strftime' $i; done;
+       else
+               for i in $(cat $2 | grep "/"); do sed -i.bak 's/print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ",/print >>sys.stderr, /g' $i; sed -i.bak '1s/from time import localtime, strftime/ /;t' $i; done;
+       fi
+fi
+
+
+
diff --git a/tribler-mod/scrips/set_DEBUG_NORMAL.sh b/tribler-mod/scrips/set_DEBUG_NORMAL.sh
new file mode 100755 (executable)
index 0000000..d79f4d7
--- /dev/null
@@ -0,0 +1,16 @@
+
+
+if test $# -lt 2 -o \( "-$1" != "-f" -a "-$1" != "-t" \)
+then
+       echo "Usage: ";echo "$0 t <filename> - changes DEBUG_NORMAL_MSGS variable to True for the source files listed in <filename>"
+       echo "$0 f <filename> - changes DEBUG_NORMAL_MSGS variable to False for the source files listed in <filename>"
+else
+       if test "-$1" == "-t"
+       then
+               for i in $(cat $2 | grep "/"); do sed -i.bak 's/DEBUG_NORMAL_MSGS[ \t]*=[ \t]*False[ \t]*[#a-zA-Z ]*/DEBUG_NORMAL_MSGS = True  #False/g' $i; done;
+       else
+               for i in $(cat $2 | grep "/"); do sed -i.bak 's/DEBUG_NORMAL_MSGS[ \t]*=[ \t]*True[ \t]*[#a-zA-Z ]*/DEBUG_NORMAL_MSGS = False #True/g' $i; done;
+       fi
+fi
+
+
diff --git a/tribler-mod/scrips/undo_changes.sh b/tribler-mod/scrips/undo_changes.sh
new file mode 100755 (executable)
index 0000000..ca8c410
--- /dev/null
@@ -0,0 +1,7 @@
+
+./unmodify_all_print.sh
+./set_DEBUG.sh f modified_files_DEBUG
+./set_DEBUG_NORMAL.sh f modified_files_DEBUG_NORMAL
+
+
+
diff --git a/tribler-mod/scrips/unmodify.sh b/tribler-mod/scrips/unmodify.sh
deleted file mode 100755 (executable)
index cc6636a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-for i in $(find -name '*.py' -type f | grep -v '.svn'); do sed -i.bak 's/print >>sys.stderr, strftime("%d %m %Y %H:%M:%S", localtime())," ",/print >>sys.stderr, /g' $i; sed -i.bak 's/from time import localtime, strftime\n/ /g' $i; done;
-
diff --git a/tribler-mod/scrips/unmodify_all_print.sh b/tribler-mod/scrips/unmodify_all_print.sh
new file mode 100755 (executable)
index 0000000..f887484
--- /dev/null
@@ -0,0 +1,2 @@
+for i in $(find -name '*.py' -type f | grep -v '.svn'); do sed -i.bak 's/print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ",/print >>sys.stderr,/g' $i; sed -i.bak '1s/from time import localtime, strftime/ /;t' $i; done;
+