IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15029


Ignore:
Timestamp:
Sep 25, 2007, 5:41:00 PM (19 years ago)
Author:
jhoblitt
Message:

allow File md5sum to be empty

Location:
trunk/DataStore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStore/lib/DataStore/File/Parser.pm

    r15027 r15029  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: Parser.pm,v 1.14 2007-09-26 00:44:43 jhoblitt Exp $
     3# $Id: Parser.pm,v 1.15 2007-09-26 03:41:00 jhoblitt Exp $
    44
    55package DataStore::File::Parser;
     
    185185        # validate format of md5sum, hex encoded
    186186        unless ($md5sum =~ $MD5_FIELD) {
    187             carp "line $lineno: field $md5sum:"
    188                . " does not conform to $MD5_FIELD: $line";
    189             next LINE;
     187            # allow md5sum to be empty
     188            unless ($md5sum =~ /^\s*$/) {
     189                carp "line $lineno: field $md5sum:"
     190                . " does not conform to $MD5_FIELD: $line";
     191                next LINE;
     192            }
     193            $md5sum = undef;
    190194        }
    191195
     
    197201        my @extra = @fields[4 .. $#fields] if $#fields >= 4;
    198202
    199         # fifo 
    200         push @data, DataStore::File->new({
     203        my %p = (
    201204            fileid  => $fileid,
    202205            bytes   => $bytes,
    203             md5sum  => $md5sum,
    204206            type    => $type,
    205207            extra   => \@extra,
    206208            uri     => $self->base_uri . $fileid,
    207         });
     209        );
     210        $p{md5sum} = $md5sum if $md5sum;
     211
     212        # fifo 
     213        push @data, DataStore::File->new(%p);
    208214    } continue {
    209215        $lineno++;
  • trunk/DataStore/scripts/dsfilesetls

    r10249 r15029  
    33# Copyright (C) 2006  Joshua Hoblitt
    44#
    5 # $Id: dsfilesetls,v 1.4 2006-11-29 01:26:57 jhoblitt Exp $
     5# $Id: dsfilesetls,v 1.5 2007-09-26 03:41:00 jhoblitt Exp $
    66
    77use strict;
     
    4848        $fs->fileid, " ",
    4949        $fs->bytes, " ",
    50         $fs->md5sum, " ",
     50        $fs->md5sum || 0, " ",
    5151        $fs->type;
    5252    print " ", join(" ", @{$fs->extra}) if defined $fs->extra;   
Note: See TracChangeset for help on using the changeset viewer.