From 8ea3f82021e4232a51c36e809ec46eae05e19516 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 23 Apr 2013 19:21:18 +0000 Subject: Add two tools useful for package maintainers: backport-rev attempts to merge a revision from the trunk in the current directory (presumably one of the release branches). gen-bugnote fetches a bug title from bugs.wireshark.org and formats it for inclusion in the release notes. svn path=/trunk/; revision=49004 --- tools/backport-rev | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/gen-bugnote | 89 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100755 tools/backport-rev create mode 100755 tools/gen-bugnote (limited to 'tools') diff --git a/tools/backport-rev b/tools/backport-rev new file mode 100755 index 0000000000..a71a78e0e4 --- /dev/null +++ b/tools/backport-rev @@ -0,0 +1,100 @@ +#!/bin/bash +# +# Copyrev - copies a revision from the Wireshark trunk to the current +# directory. +# +# Usage: backport-rev +# +# $Id$ +# +# Copyright 2013 Gerald Combs +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +if [ -z "$VISUAL" ] ; then + VISUAL=$EDITOR +fi + +function exit_err +{ + if [ -n "$*" ] ; then + echo "$*" + fi + echo -n $patchfile | pbcopy + echo "Patch saved to $patchfile and copied to pasteboard" + if [ -n "$VISUAL" ] ; then + "$VISUAL" $patchfile $logfile + else + echo "Can't find an editor. You'll have to open $patchfile and $logfile yourself." + fi + exit 1 +} + +subdir="" +trunk="trunk" + +while getopts "at:" opt ; do + case $opt in + a) + subdir="/asn1" + ;; + t) + trunk="trunk-$OPTARG" + ;; + \?) + echo "Unknown option -$OPTARG" + ;; + esac +done +shift $((OPTIND-1)) + +svnurl="http://anonsvn.wireshark.org/wireshark/$trunk" +#svnurl="$HOME/Development/wireshark" + +rev="$1" + +patchfile="/tmp/copyrev-$rev.patch" +logfile="/tmp/copyrev-$rev.log" +oldrev=$(( $rev - 1 )) +echo "Working on r$rev ($oldrev)" + +echo -n "Attempting dry run: " +if [ -n "$subdir" ] ; then + cd .$subdir +fi + +svn diff --diff-cmd /usr/bin/diff -x "-w -b -U 5" -c $rev $svnurl$subdir \ + > $patchfile || exit_err "Error" + +svn log -v -r $rev $svnurl | sed -e 's/^..*/ &/' > $logfile || exit 1 + +svn merge --dry-run -c$rev $svnurl | grep '^Summary' \ + > /dev/null 2>&1 && exit_err "Conflict" + +echo "OK" +echo "Attempting patch:" +svn merge -c$rev $svnurl + +if [ -n "$subdir" ] ; then + cd .. +fi +echo Done with r$rev + +echo "Copy over revisions from the trunk:" +echo "" +uniq < $logfile + +rm -v $patchfile $logfile diff --git a/tools/gen-bugnote b/tools/gen-bugnote new file mode 100755 index 0000000000..907a73b6ee --- /dev/null +++ b/tools/gen-bugnote @@ -0,0 +1,89 @@ +#!/bin/bash +# +# Given a Wireshark bug ID, fetch its title and prepare an entry suitable +# for pasting into the release notes. Requires curl, grep, and sed. +# +# Usage: gen-bugnote +# +# $Id$ +# +# Copyright 2013 Gerald Combs +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +output_fmt="docbook" +if [ -f release-notes.asciidoc -o -f docbook/release-notes.asciidoc ] ; then + output_fmt="asciidoc" +fi + +while getopts "o:" OPT ; do + case $OPT in + o) output_fmt=$OPTARG + ;; + esac +done +shift $(($OPTIND - 1)) + +bz_url_pfx="https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=" +bug_id="$1" + +case "$OSTYPE" in + darwin*) + clipboard_cmd="pbcopy -Pascii" + ;; + cygwin*) + clipboard_cmd="cat > /dev/clipboard" + ;; + linux*) + clipboard_cmd="xsel --clipboard" + ;; + *) + echo "Unable to copy to clipboard" + clipboard_cmd="cat > /dev/null" + ;; +esac + +if [ -z "$bug_id" ] ; then + echo "Usage: " `basename $0` " " + exit 1 +fi + +bug_title=` + curl -s -o - "https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=$bug_id" | + grep -i '' | + sed \ + -e 's:.*<title>.*ndash; ::' \ + -e 's:.*::' \ + -e 's/[^\.]$/&./' \ + ` + +case "$output_fmt" in + asciidoc) + echo -n "$bug_title (ws-buglink:$bug_id)" | $clipboard_cmd + ;; + docbook) +$clipboard_cmd < + $bug_title + (Bug + $bug_id) + + +Fin + ;; +esac + +echo "Copied $bug_id: $bug_title" -- cgit v1.2.3