summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/cmdline/bugcount7
-rwxr-xr-xcontrib/cmdline/bugids32
-rwxr-xr-xcontrib/cmdline/buglist73
-rwxr-xr-xcontrib/cmdline/bugs31
-rwxr-xr-xcontrib/cmdline/bugslink8
-rwxr-xr-xcontrib/cmdline/makequery108
-rw-r--r--contrib/cmdline/query.conf6
7 files changed, 166 insertions, 99 deletions
diff --git a/contrib/cmdline/bugcount b/contrib/cmdline/bugcount
new file mode 100755
index 000000000..b41412a12
--- /dev/null
+++ b/contrib/cmdline/bugcount
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+thisdir=`dirname "$0"`
+bugids=`$thisdir/bugids "$@"`
+if test "$?" != "0"; then echo "$bugids" 1>&2; exit 1; fi
+
+echo "$bugids" | wc -w
diff --git a/contrib/cmdline/bugids b/contrib/cmdline/bugids
new file mode 100755
index 000000000..6bb54213a
--- /dev/null
+++ b/contrib/cmdline/bugids
@@ -0,0 +1,32 @@
+#!/bin/sh
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is
+# Andreas Franke <afranke@mathweb.org>.
+# Corporation. Portions created by Andreas Franke are
+# Copyright (C) 2001,2005 Andreas Franke. All
+# Rights Reserved.
+#
+# Contributor(s):
+
+thisdir=`dirname "$0"`
+buglist="$thisdir/buglist"
+csvfile="$thisdir/buglist.csv"
+
+$thisdir/buglist "$@" 2>&1 1>${csvfile}
+if test "$?" != "0"; then cat "$csvfile" 1>&2; exit 1; fi
+
+# 1. use 'awk' to select the first column (bug_id)
+# 2. use 'grep -v' to remove the first line with the column headers
+# 3. use backquotes & 'echo' to get all values in one line, space separated
+echo `cat ${csvfile} | awk -F, '{printf $1 "\n"}' | grep -v bug_id`
diff --git a/contrib/cmdline/buglist b/contrib/cmdline/buglist
index 7f08286de..4bd5f20b5 100755
--- a/contrib/cmdline/buglist
+++ b/contrib/cmdline/buglist
@@ -12,83 +12,20 @@
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is
-# Andreas Franke <afranke@ags.uni-sb.de>.
+# Andreas Franke <afranke@mathweb.org>.
# Corporation. Portions created by Andreas Franke are
-# Copyright (C) 2001 Andreas Franke. All
+# Copyright (C) 2001,2005 Andreas Franke. All
# Rights Reserved.
#
# Contributor(s):
-conf="`dirname $0`/query.conf"
-
-query="http://bugzilla.mozilla.org/buglist.cgi?cmd=doit"
defaultcolumnlist="severity priority platform status resolution target_milestone status_whiteboard keywords summaryfull"
-chart=0
-and=0
-while test "$1" != ""; do
- arg=$1
- arg_len=`expr length ${arg}`
- if test `expr substr "${arg}" 1 2` == "--"; then
- eq_pos=`expr match ${arg} '--.*='`
- if test "${eq_pos}" == "0"; then
- echo 'Missing value for long option '"${arg}"' ("=" not found)' 1>&2
- exit 1;
- fi
- # extract option name
- let name_len=${eq_pos}-3
- name=`expr substr ${arg} 3 ${name_len}`
- # extract option value
- let val_start=${eq_pos}+1
- let val_len=${arg_len}-${eq_pos}
- val=`expr substr ${arg} ${val_start} ${val_len}`
- elif test `expr substr ${arg} 1 1` == "-" &&
- test "`expr substr ${arg} 2 1`" != ""; then
- # extract
- name=`expr substr ${arg} 2 1`
- let val_len=${arg_len}-2
- val=`expr substr ${arg} 3 ${val_len}`
- else
- name="default"
- val="${arg}"
- #echo "Unrecognized option ${arg}" 1>&2
- #exit 1
- fi
-
- # find field and comparison type for option ${name}
- field=`grep '"'${name}'"' ${conf} | awk '{printf $1}'`
- type=`grep '"'${name}'"' ${conf} | awk '{printf $2}'`
- if test "${field}" == "" || test "${type}" == ""; then
- echo "Field name & comparison type not found for option ${name}." 1>&2
- exit 1;
- fi
-
- or=0
- while test "${val}" != ""; do
- comma_idx=`expr index ${val} ,`
- if test ${comma_idx} == "0"; then
- val1="${val}"
- val=""
- else
- let val1_len=${comma_idx}-1
- val1=`expr substr ${val} 1 ${val1_len}`
- val_len=`expr length ${val}`
- let rest_start=${comma_idx}+1
- let rest_len=${val_len}-${comma_idx}
- val=`expr substr ${val} ${rest_start} ${rest_len}`
- fi
- query="${query}&field${chart}-${and}-${or}=${field}"
- query="${query}&type${chart}-${and}-${or}=${type}"
- query="${query}&value${chart}-${and}-${or}=${val1}"
- #echo "----- ${name} : ${field} : ${type} : ${val1} -----" 1>&2
- let or=${or}+1
- done
- let chart=${chart}+1
- shift
-done
+thisdir=`dirname "$0"`
+query=`$thisdir/makequery "$@"`
+if test "$?" != "0"; then exit 1; fi
outputfile="/dev/stdout"
#outputfile="buglist.html"
#\rm -f ${outputfile}
wget -q -O ${outputfile} --header="Cookie: COLUMNLIST=${COLUMNLIST-${defaultcolumnlist}}" "${query}"
-
diff --git a/contrib/cmdline/bugs b/contrib/cmdline/bugs
index 05d4d66ab..2e8655876 100755
--- a/contrib/cmdline/bugs
+++ b/contrib/cmdline/bugs
@@ -1,31 +1,6 @@
#!/bin/sh
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-#
-# The Original Code is the Bugzilla Bug Tracking System.
-#
-# The Initial Developer of the Original Code is
-# Andreas Franke <afranke@ags.uni-sb.de>.
-# Corporation. Portions created by Andreas Franke are
-# Copyright (C) 2001 Andreas Franke. All
-# Rights Reserved.
-#
-# Contributor(s):
-buglist="`dirname $0`/buglist"
-htmlfile="`dirname $0`/buglist.html"
+thisdir=`dirname "$0"`
+bugids=`$thisdir/bugids "$@"` || echo "$bugids" 1>&2 && exit 1
-${buglist} "$@" 2>&1 1>${htmlfile}
-if test ${?} == "0"; then
- echo `grep 'TR VALIGN=TOP ALIGN=LEFT CLASS=' ${htmlfile} | sed -e 's/<TR.*id=//' | sed -e 's/".*//'` | sed -e 's/ /\,/g'
-else
- cat ${htmlfile} 1>&2
- exit 1
-fi
+echo "$bugids" | sed -e 's/ /\,/g'
diff --git a/contrib/cmdline/bugslink b/contrib/cmdline/bugslink
new file mode 100755
index 000000000..ee7d5c588
--- /dev/null
+++ b/contrib/cmdline/bugslink
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+thisdir=`dirname "$0"`
+bugids=`$thisdir/bugids "$@"` || echo "$bugids" 1>&2 && exit 1
+
+bugids=`echo "$bugids" | sed -e 's/ /\,/g'`
+echo "https://bugzilla.mozilla.org/buglist.cgi?ctype=html&bug_id=$bugids"
+
diff --git a/contrib/cmdline/makequery b/contrib/cmdline/makequery
new file mode 100755
index 000000000..b34efb841
--- /dev/null
+++ b/contrib/cmdline/makequery
@@ -0,0 +1,108 @@
+#!/bin/sh
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is
+# Andreas Franke <afranke@mathweb.org>.
+# Corporation. Portions created by Andreas Franke are
+# Copyright (C) 2001,2005 Andreas Franke. All
+# Rights Reserved.
+#
+# Contributor(s):
+
+conf="`dirname $0`/query.conf"
+
+query="https://bugzilla.mozilla.org/buglist.cgi?ctype=csv"
+
+chart=0
+and=0
+while test "X$1" != "X"; do
+ arg="$1"
+ shift
+ if test 0 != `expr "X$arg" : 'X--[^=]*\$'`; then
+ # long option: --name val (without '=')
+ name=`expr "X$arg" : 'X--\(.*\)'`
+ val="$1"
+ shift
+ elif test 0 != `expr "X$arg" : 'X--[^=][^=]*='`; then
+ # long option: --name=val
+ name=`expr "X$arg" : 'X--\([^=]*\)'`
+ val=`expr "X$arg" : 'X--[^=]*=\(.*\)'`
+ elif test 0 != `expr "X$arg" : 'X-[a-zA-Z]\$'`; then
+ # short option like -X foo (with space in between)
+ name=`expr "X$arg" : 'X-\(.\)'`
+ val="$1"
+ shift
+ elif test 0 != `expr "X$arg" : 'X-[a-zA-Z]='`; then
+ # reject things like -X=foo
+ echo "Unrecognized option $arg" 1>&2
+ echo "Use -Xfoo or -X foo instead of -X=foo" 1>&2
+ exit 1
+ elif test 0 != `expr "X$arg" : 'X-[a-zA-Z]'`; then
+ # short option like -Xfoo (without space)
+ name=`expr "X$arg" : 'X-\(.\)'`
+ val=`expr "X$arg" : 'X-.\(.*\)'`
+ else
+ name="default"
+ val="$arg"
+ #echo "Unrecognized option $arg" 1>&2
+ #exit 1
+ fi
+
+ # plausibility check: val must not be empty, nor start with '-'
+ if test "X$val" = "X"; then
+ echo "No value found for '$name'!" 1>&2
+ exit 1
+ elif test 0 != `expr "X$val" : "X-"` && \
+ test 0 = `expr "X$val" : "X---"`; then
+ echo "Suspicious value for '$name': '$val' looks like an option!" 1>&2
+ exit 1
+ fi
+
+ # find field and comparison type for option ${name}
+ field=`grep "\"$name\"" "$conf" | awk '{printf $1}'`
+ type=`grep "\"$name\"" "$conf" | awk '{printf $2}'`
+ if test "X$field" = "X" || test "X$type" = "X"; then
+ if test "X$name" = "Xdefault"; then
+ echo 1>&2 "Error: unexpected argument '$arg'"
+ cat 1>&2 <<EOF
+Use short options like -P1 or long options like --priority=1 ,
+or enable the 'default' behaviour in the 'query.conf' file.
+EOF
+ else
+ echo "Unknown field name '$name'." 1>&2
+ fi
+ exit 1
+ fi
+
+ # split val into comma-separated alternative values
+ or=0
+ while test "X$val" != "X"; do
+ # val1 gets everything before the first comma; val gets the rest
+ if test 0 != `expr "X$val" : 'X[^,]*,'`; then
+ val1=`expr "X$val" : 'X\([^,]*\),'`
+ val=`expr "X$val" : 'X[^,]*,\(.*\)'`
+ else
+ val1="$val"
+ val=""
+ fi
+ # append to query
+ query="${query}&field${chart}-${and}-${or}=${field}"
+ query="${query}&type${chart}-${and}-${or}=${type}"
+ query="${query}&value${chart}-${and}-${or}=${val1}"
+ #echo "----- ${name} : ${field} : ${type} : ${val1} -----" 1>&2
+ or=`expr ${or} + 1`
+ done
+ chart=`expr ${chart} + 1`
+done
+
+echo "${query}"
diff --git a/contrib/cmdline/query.conf b/contrib/cmdline/query.conf
index 65bae2248..a44347b2b 100644
--- a/contrib/cmdline/query.conf
+++ b/contrib/cmdline/query.conf
@@ -11,7 +11,7 @@
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is
-# Andreas Franke <afranke@ags.uni-sb.de>.
+# Andreas Franke <afranke@mathweb.org>.
# Corporation. Portions created by Andreas Franke are
# Copyright (C) 2001 Andreas Franke. All
# Rights Reserved.
@@ -27,7 +27,7 @@ bug_status substring "s","status"
resolution substring "r","resolution"
rep_platform substring "p","platform"
op_sys substring "o","os","opsys"
-priority substring "p","priority"
+priority substring "P","priority"
bug_severity substring "S","severity"
assigned_to substring "A","O","owner","assignedto"
reporter substring "R","reporter"
@@ -37,7 +37,7 @@ product substring "product"
version substring "V","version"
component substring "c","component"
target_milestone substring "M","milestone"
-short_desc substring "default","summary"
+short_desc substring "summary","defaultREMOVEME"
longdesc substring "d","description","longdesc"
bug_file_loc substring "u","url"
status_whiteboard substring "w","whiteboard"