]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2003-06-06 17:56:05 by cjwatson]
authorcjwatson <>
Sat, 7 Jun 2003 00:56:05 +0000 (16:56 -0800)
committercjwatson <>
Sat, 7 Jun 2003 00:56:05 +0000 (16:56 -0800)
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
cgi/common.pl
debian/copyright
scripts/errorlib.in
scripts/text.in

diff --git a/README b/README
index d545a117293f646f1721e478f410fa22e59b2436..b916ffd51cc032b4916e173fe7dc524ea18c2896 100644 (file)
--- a/README
+++ b/README
@@ -77,7 +77,7 @@ COPYRIGHT AND LACK-OF-WARRANTY NOTICE
 =============================================================================
 Copyright 1999 Darren O. Benham <gecko@debian.org>
 Copyright 1994,1995,1996,1997 Ian Jackson <ijackson@chiark.greenend.org.uk>
-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
index 14d1ab37d10be64ab0df8bf28acdb1fb53e2c66d..9f4d5a0e3247a1077ba9dd110d7973437e094f81 100644 (file)
@@ -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;
index a799f40aa8afb21ee9f16ba40751136f80106e37..b30c6c8bebafefb3740c95eb905ff4d87caea26f 100644 (file)
@@ -17,7 +17,7 @@ The sources can be found at:
 
 Copyright 1999 Darren O. Benham <gecko@debian.org>
 Copyright 1994,1995,1996,1997 Ian Jackson <ijackson@chiark.greenend.org.uk>
-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
index b799bc6e6b0beb908373fd93932168050cb24a5d..062e864046312905f9c0ba1217680fba612b82e2 100755 (executable)
@@ -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}= <S>);
     chop($data{date}= <S>);
@@ -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".
index 31e9c91b8086f56c68fe20beea5b72aa6dbb4870..cdfdcc2c96b87a989e27c6aacc507111155c86a7 100644 (file)
@@ -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 = "<HR>
  <P>
  <A HREF=\"http://$gWebDomain/\">Debian $gBug tracking system</A><BR>
  Copyright (C) 1999 Darren O. Benham,
- 1997 nCipher Corporation Ltd,
+ 1997,2003 nCipher Corporation Ltd,
  1994-97 Ian Jackson.
  </ADDRESS>
 ";