Changeset 88
- Timestamp:
- 12/01/05 19:00:57 (19 years ago)
- Location:
- trunk/soft/ObsData
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/soft/ObsData/ObsData.pm
- Property cvs2svn:cvs-rev changed from 1.29 to 1.30
r87 r88 289 289 next; 290 290 } 291 $or->p arse_files;291 $or->process; 292 292 } 293 293 } -
trunk/soft/ObsData/ObsData/Repository.pm
- Property cvs2svn:cvs-rev changed from 1.26 to 1.27
r87 r88 55 55 56 56 bless($or, $class); 57 58 $or->set_do_if_change; 59 $or; 57 60 } 58 61 … … 129 132 } 130 133 131 sub p arse_files {134 sub process { 132 135 my ($self) = @_; 133 136 $self->loging(0, "%s() start for %s", (caller(0))[3], $self->{dir}); … … 138 141 archivefile => $file, 139 142 ); 140 $orda->p arse_archive;143 $orda->process; 141 144 } 142 145 } … … 164 167 #} 165 168 166 sub see_archive_change { 167 my ($self) = @_; 168 169 my @filestats = stat("$self->{dir}/$self->{archivefile}"); 169 sub get_info { 170 my ($self) = @_; 171 172 $self->{filestats} = [ stat("$self->{dir}/$self->{archivefile}") ]; 173 174 if (! @{$self->{filestats}}) { 175 $self->loging(4, 176 "Cannot get info of %s", 177 "$self->{dir}/$self->{archivefile}" 178 ); 179 return 0; 180 } 170 181 171 182 if ($self->{status}->SectionExists($self->{archivefile})) { 172 183 if (my $oldmtime = $self->{status}->val($self->{archivefile}, 'mtime')) { 173 if ($oldmtime == $ filestats[9]) {174 175 } elsif ($oldmtime > $ filestats[9]) {184 if ($oldmtime == $self->{filestats}[9]) { 185 186 } elsif ($oldmtime > $self->{filestats}[9]) { 176 187 $self->loging(3, 177 188 "Wahou, %s is older than my reference: %d => %d", 178 189 $oldmtime, 179 $ filestats[9],190 $self->{filestats}[9], 180 191 ); 181 192 } else { … … 184 195 $self->{archivefile}, 185 196 $oldmtime, 186 $ filestats[9],197 $self->{filestats}[9], 187 198 ); 188 199 } … … 190 201 191 202 if (defined(my $oldsize = $self->{status}->val($self->{archivefile}, 'size'))) { 192 if ($oldsize != $ filestats[7]) {203 if ($oldsize != $self->{filestats}[7]) { 193 204 $self->{changes}{archive_size} = $self->loging(0, 194 205 "%s size differ %d => %d", 195 206 $self->{archivefile}, 196 207 $oldsize, 197 $ filestats[7],208 $self->{filestats}[7], 198 209 ); 199 210 } … … 210 221 } 211 222 } 212 213 223 } else { 214 224 $self->{changes}{archive_new} = 215 225 $self->loging(0, "%s is new file", $self->{archivefile}); 216 226 } 227 return 1; 217 228 } 218 229 … … 221 232 sub file_need_parse { 222 233 my ($self) = @_; 223 224 $self->see_archive_change;225 234 226 235 my $need = 0; … … 249 258 sub parse_archive { 250 259 my ($self) = @_; 251 252 my $newer = $self->file_need_parse();253 260 254 261 $self->loging(0, "trying to read archive content of %s", $self->{archivefile}); … … 262 269 }; 263 270 264 $self->update_status;265 271 foreach my $datafile ($self->{Oarchive}->ls) { 266 272 $self->loging(0, "archive %s: content %s", $self->{archivefile}, $datafile); … … 271 277 $data->dispatch; 272 278 } 279 return 1; 280 } 281 282 sub process { 283 my ($self) = @_; 284 285 if (!$self->get_info) { 286 return 0; 287 } 288 289 if ($self->file_need_parse) { 290 if (!$self->parse_archive) { 291 return 0; 292 } 293 } 294 295 $self->update_status; 296 297 return 1; 273 298 } 274 299
Note: See TracChangeset
for help on using the changeset viewer.