=============================================================================
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
# -*- 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.
}
}
+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>);
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".
"$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".
-# $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
<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>
";