diff --git a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm index 17646e715d723d56f297efa5bb5ddab7d94cd3a9..f195eb65cfbf0a50fc1efedd5d5fb5f6a22e7c51 100644 --- a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm +++ b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm @@ -20,7 +20,7 @@ my %dependent_sources; my %taxonomy2species_id; my %name2species_id; -my ($host, $port, $dbname, $user, $pass, $create); +my ($host, $port, $dbname, $user, $pass, $create, $release); my $skipdownload; # -------------------------------------------------------------------------------- @@ -28,7 +28,7 @@ my $skipdownload; sub run { - ($host, $port, $dbname, $user, $pass, my $speciesr, my $sourcesr, $skipdownload, $create) = @_; + ($host, $port, $dbname, $user, $pass, my $speciesr, my $sourcesr, $skipdownload, $create, $release) = @_; my @species = @$speciesr; my @sources = @$sourcesr; @@ -154,11 +154,14 @@ sub run { # update AFTER processing in case of crash. update_source($dbi, $source_url_id, $file_cs, $new_file[0]); + # set release if specified + set_release($release, $source_id) if ($release); + } elsif(!$empty){ print "Ignoring ".join(' ',@new_file)." as checksums match\n"; } - + } # remove last working directory @@ -806,6 +809,24 @@ sub create { } +# -------------------------------------------------------------------------------- + +# Set release for a source. + +sub set_release { + + my ($release, $source_id) = @_; + + my $dbi = dbi(); + + my $sth = $dbi->prepare("UPDATE source SET release=? WHERE source_id=?"); + + $sth->execute($release, $source_id); + + print "Set release to $release for source ID $source_id\n"; + +} + # -------------------------------------------------------------------------------- 1;