From 0489224b9b5e6eb3ab60a719ab3a148da3649b34 Mon Sep 17 00:00:00 2001 From: cjwatson <> Date: Fri, 6 Jun 2003 16:56:05 -0800 Subject: [PATCH] [project @ 2003-06-06 17:56:05 by cjwatson] Somewhere along the way we lost compatibility with old non-hashed-directory spools, despite attempts to keep it. Introduce a getbugcomponent() function which understands old-style db directories, and use it. Update nCipher copyright date to include 2003, since this is on work time. --- README | 2 +- cgi/common.pl | 6 +----- debian/copyright | 2 +- scripts/errorlib.in | 42 +++++++++++++++++++++++++++++------------- scripts/text.in | 4 ++-- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/README b/README index d545a11..b916ffd 100644 --- a/README +++ b/README @@ -77,7 +77,7 @@ COPYRIGHT AND LACK-OF-WARRANTY NOTICE ============================================================================= Copyright 1999 Darren O. Benham Copyright 1994,1995,1996,1997 Ian Jackson -Copyright 1997 nCipher Corporation Limited +Copyright 1997,2003 nCipher Corporation Limited This bug system 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 diff --git a/cgi/common.pl b/cgi/common.pl index 14d1ab3..9f4d5a0 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -616,11 +616,7 @@ sub getsrcpkgs { sub buglog { my $bugnum = shift; - - my $dir = getlocationpath( getbuglocation( $bugnum, "log" ) ); - my $hash = get_hashname( $bugnum ); - return "" if ( !$dir ); - return "$dir/$hash/$bugnum.log"; + return getbugcomponent($bugnum, 'log'); } 1; diff --git a/debian/copyright b/debian/copyright index a799f40..b30c6c8 100644 --- a/debian/copyright +++ b/debian/copyright @@ -17,7 +17,7 @@ The sources can be found at: Copyright 1999 Darren O. Benham Copyright 1994,1995,1996,1997 Ian Jackson -Copyright 1997 nCipher Corporation Limited +Copyright 1997,2003 nCipher Corporation Limited This bug system 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 diff --git a/scripts/errorlib.in b/scripts/errorlib.in index b799bc6..062e864 100755 --- a/scripts/errorlib.in +++ b/scripts/errorlib.in @@ -1,5 +1,5 @@ # -*- perl -*- -# $Id: errorlib.in,v 1.28 2003/06/05 08:54:31 cjwatson Exp $ +# $Id: errorlib.in,v 1.29 2003/06/06 17:56:05 cjwatson Exp $ sub F_SETLK { 6; } sub F_WRLCK{ 1; } $flockstruct= 'sslll'; # And there ought to be something for this too. @@ -46,11 +46,25 @@ sub getlocationpath { } } +sub getbugcomponent { + my ($bugnum, $ext, $location) = @_; + + $location = getbuglocation($bugnum, $ext) unless defined $location; + my $dir = getlocationpath($location); + return undef unless $dir; + if ($location eq 'db') { + return "$dir/$bugnum.$ext"; + } else { + my $hash = get_hashname($bugnum); + return "$dir/$hash/$bugnum.$ext"; + } +} + sub readbug { local ($lref, $location) = @_; - my $hash = get_hashname($lref); - $path = getlocationpath($location); - if (!open(S,"$path/$hash/$lref.status")) { &unfilelock; return undef; } + my $status = getbugcomponent($lref, 'status', $location); + return undef unless defined $status; + if (!open(S,$status)) { return undef; } my %data; chop($data{originator}= ); chop($data{date}= ); @@ -72,15 +86,17 @@ sub readbug { sub lockreadbug { local ($lref, $location) = @_; &filelock("lock/$lref"); - return readbug($lref, $location); + my $data = readbug($lref, $location); + &unfilelock unless defined $data; + return $data; } sub writebug { local ($ref, $data, $location) = @_; - my $hash = get_hashname($ref); my $change; - $path = getlocationpath($location); - open(S,">$path/$hash/$ref.status.new") || &quit("opening $path/$hash/$ref.status.new: $!"); + my $status = getbugcomponent($ref, 'status', $location); + &quit("can't find location for $ref") unless defined $status; + open(S,"> $status.new") || &quit("opening $status.new: $!"); print(S "$data->{originator}\n". "$data->{date}\n". @@ -93,15 +109,15 @@ sub writebug { "$data->{mergedwith}\n". "$data->{severity}\n". "$data->{versions}\n". - "$data->{fixed_versions}\n") || &quit("writing $path/$hash/$ref.status.new: $!"); - close(S) || &quit("closing $path/$hash/$ref.status.new: $!"); - if (-e "$path/$hash/$ref.status") { + "$data->{fixed_versions}\n") || &quit("writing $status.new: $!"); + close(S) || &quit("closing $status.new: $!"); + if (-e $status) { $change = 'change'; } else { $change = 'new'; } - rename("$path/$hash/$ref.status.new","$path/$hash/$ref.status") || - &quit("installing new $path/$hash/$ref.status: $!"); + rename("$status.new",$status) || + &quit("installing new $status: $!"); &bughook($change,$ref, "$data->{originator}\n". "$data->{date}\n". diff --git a/scripts/text.in b/scripts/text.in index 31e9c91..cdfdcc2 100644 --- a/scripts/text.in +++ b/scripts/text.in @@ -1,4 +1,4 @@ -# $Id: text.in,v 1.20 2003/06/04 18:05:51 cjwatson Exp $ +# $Id: text.in,v 1.21 2003/06/06 17:56:05 cjwatson Exp $ ############################################################################ # Here is a blurb to point people to ftp archive of directions. It is @@ -180,7 +180,7 @@ $gHTMLTail = "

Debian $gBug tracking system
Copyright (C) 1999 Darren O. Benham, - 1997 nCipher Corporation Ltd, + 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson. "; -- 2.39.2