public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* Renaming categories in Gnats 3.113.1
@ 2003-04-17 12:51 Walt Sullivan
  2003-04-22 14:30 ` Hans-Albert Schneider
  0 siblings, 1 reply; 3+ messages in thread
From: Walt Sullivan @ 2003-04-17 12:51 UTC (permalink / raw)
  To: help-gnats

I'm running Gnats 3.113.1, GnatsWeb 2.9.3 on Linux. I've received a request to change the names of several categories. Is it as simple as I think? I think I can:

1. Stop the queue-pr cron job.

2. Edit the "categories" file, change "oldname" to "newname".

3. Rename the directory from "oldname" to "newname".

4. Restart the queue-pr cron job.

Is it really that simple, or are there gotchas waiting to bite me?

Walt Sullivan
Unix System/Network Administrator

Meriton Networks
3026 Solandt Road, 
Kanata, Ontario K2K 2A5
walt.sullivan@meriton.com
(613) 270-9279 x262
Fax: (613) 270-9628


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Renaming categories in Gnats 3.113.1
  2003-04-17 12:51 Renaming categories in Gnats 3.113.1 Walt Sullivan
@ 2003-04-22 14:30 ` Hans-Albert Schneider
  0 siblings, 0 replies; 3+ messages in thread
From: Hans-Albert Schneider @ 2003-04-22 14:30 UTC (permalink / raw)
  To: Walt Sullivan; +Cc: help-gnats

[-- Attachment #1: Type: text/plain, Size: 1951 bytes --]

Walt Sullivan wrote:
> 
> I'm running Gnats 3.113.1, GnatsWeb 2.9.3 on Linux.
> I've received a request to change the names of several categories.

I faced the same problem almost exactly two years ago.

There is now an entry in the GNATS FAQ about this.  The FAQ is at
http://www.gnu.org/software/gnats/doc/faq/gnats-faq.html
Go to "Configuration Issues" / "General Configuration Questions" /
"How do I rename a category?"

If you want to check the mails from then, go to
	http://mail.gnu.org/archive/html/help-gnats/
and search for
	categor* and renam*

> Is it as simple as I think? I think I can:
> 
> 1. Stop the queue-pr cron job.
> 
> 2. Edit the "categories" file, change "oldname" to "newname".
> 
> 3. Rename the directory from "oldname" to "newname".
> 
> 4. Restart the queue-pr cron job.
> 
> Is it really that simple, or are there gotchas waiting to bite me?

If you are using proper locking, steps 1 and 4 are superflouos.
If you do not use locking, steps 2 and 3 may interfere with somebody
else changing one of the reports at the same time.

As the PR files themselves bear the category name in them, steps 2
and 3 are not that simple: the index is not updated, and (at least
in GNATS 3.xxx) it contains the category names given in the file.
The FAQ describes a safer method.  I use the attached script when I
have to rename a category.  I have written similar scripts for changing
responsibles and e-mail addresses (which was necessary because our
team has been transfered to another company).

Note: I did not yet check whether this script also works for GNATS 4.0.
I am aware of one caveat with GNATS 4:
If you changed the the name of the "Category" field, you need to
adjust the strings in lines 45, 49, and 82.


Hans-Albert

-- 
Hans-Albert Schneider		<Hans-Albert.Schneider@infineon.com>
Infineon Technologies AG	phone:	(+49) 89 234 45445
Corporate Logic; Verification	fax:	(+49) 89 234 724399
(CL DAT TDM VM)			Munich, Germany

[-- Attachment #2: mvcat --]
[-- Type: text/plain, Size: 1805 bytes --]

#!/bin/sh
#
# Move a report from one category to another.
# Author: Hans-Albert.Schneider@mchp.siemens.de
# Copyright (C) Siemens AG, CT SE 4, 2001
#

usage="usage: $0 -d gnats_root old_category new_category"

# Check usage
if [ $# -lt 4 ]
then
    echo $usage >&2
    exit 1
fi

if [ "x$1" = "x-d" ]
then
    gnatsroot="$2"
else
    echo $usage >&2
    exit 1
fi

oldcat="$3"
newcat="$4"

if [ ! -d "$gnatsroot/$oldcat" ]
then
    echo $usage >&2
    exit 1
fi

if [ ! -d "$gnatsroot/$newcat" ]
then
    mkcat -d "$gnatsroot"
fi

if [ ! -d "$gnatsroot/$newcat" ]
then
    echo $usage >&2
    exit 1
fi

echo "Category" | grep -i "$newcat" >/dev/null
if [ $? -eq 0 ]
then
    echo "Sorry, but the name of the old category, $oldcat," >&2
    echo "is a substring of the word 'Category'." >&2
    echo "This script cannot deal with that case; it would mess up" >&2
    echo "your reports." >&2
    echo "Please do the renaming manually." >&2
    exit 2
fi

#
# End of usage checking
#

# First, check for the trivial case:
reports=`echo "$gnatsroot/$oldcat"/*`
if [ "x$reports" = "x$gnatsroot/$oldcat/*" ]
then
    echo "No entries in category $oldcat"
    exit 0
fi

# Create a temporary file to be used as the EDITOR environment variable.
# Make sure it belongs to us, and nobody else can modify it.
#
tmp=${TMPDIR:-/tmp}/mvcat$$
[ -f "$tmp" ] && rm -f "$tmp"
[ -f "$tmp" ] && echo "Cannot rm $tmp" >&2 && exit 2
touch "$tmp" || echo "Cannot create $tmp" >&2
[ -f "$tmp" ] || exit 2
chmod 700 "$tmp"

cat >"$tmp" <<EOF
#!/bin/sh
# change category of GNATS problem report
EOF
echo "(echo '/>Category:/ s/$oldcat/$newcat/'; echo w) | ed "'$1' >> "$tmp"

EDITOR="$tmp"
export EDITOR
unset VISUAL


set -- "$gnatsroot/$oldcat"/*
for id in "$@"
do
    edit-pr -d "$gnatsroot" `basename $id`
done

rm -f "$tmp"

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Renaming categories in Gnats 3.113.1
@ 2003-04-17 14:34 Dirk Schenkewitz
  0 siblings, 0 replies; 3+ messages in thread
From: Dirk Schenkewitz @ 2003-04-17 14:34 UTC (permalink / raw)
  To: help-gnats

Hello Mr. Sullivan,

Walt Sullivan wrote:
> 
> I'm running Gnats 3.113.1, GnatsWeb 2.9.3 on Linux. I've received
> a request to change the names of several categories. Is it as simple
> as I think? I think I can:
> 
> 1. Stop the queue-pr cron job.
> 
> 2. Edit the "categories" file, change "oldname" to "newname".
> 
> 3. Rename the directory from "oldname" to "newname".
> 
> 4. Restart the queue-pr cron job.

This changes the category names only for NEW PRs! Is that enough?
If not:
Please take a look at any existing PR: the category is written there
in clear text. So if you want to change the names of categories for
new AND existing PRs, you need to go through all existing PRs and
change the category names there, too. And then you need to rebuild
the index, I believe. I cannot make any tests right now - If I'm
wrong with anything, please, anybody correct me.

> Is it really that simple, or are there gotchas waiting to bite me?

Even if you think it is enough to change category names only for
new PRs, you likely will get bitten when someone wants to edit
an old PR. But I'm not sure on that.

happy coding
        dirk
-- 
Dirk Schenkewitz 

InterFace AG                 fon: +49 (0)89 / 610 49 - 126
Leipziger Str. 16            fax: +49 (0)89 / 610 49 - 83
D-82008 Unterhaching         
http://www.interface-ag.de   mailto:dirk.schenkewitz@interface-ag.de


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-22 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-17 12:51 Renaming categories in Gnats 3.113.1 Walt Sullivan
2003-04-22 14:30 ` Hans-Albert Schneider
2003-04-17 14:34 Dirk Schenkewitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).