42 |
|
print "The Python config and ntuple release must be given!\n"; |
43 |
|
exit; |
44 |
|
} |
45 |
– |
if ($opt{"location"} && locationExists ($opt{"location"})) |
46 |
– |
{ |
47 |
– |
print "This location is already registered in the database!\n"; |
48 |
– |
exit; |
49 |
– |
} |
45 |
|
if ($ARGV[0] eq "uploadRelease") |
46 |
|
{ |
47 |
|
my $parentDir = "./$opt{'release'}"; |
81 |
|
$status = "" if $ARGV[0] eq "update"; |
82 |
|
$status = "deprecated" if $ARGV[0] eq "deprecate"; |
83 |
|
$opt{"format"} = "BEAN" if $ARGV[0] eq "create" && !$opt{"format"}; |
84 |
+ |
if ($opt{"location"} && locationExists ($id, $opt{"location"})) |
85 |
+ |
{ |
86 |
+ |
print "This location is already registered in the database!\n"; |
87 |
+ |
exit; |
88 |
+ |
} |
89 |
|
dbUpdate ($id, $fullDataset, "$ENV{'USER'}\@$ENV{'HOSTNAME'}", $opt{"format"}, $opt{"location"}, $opt{"name"}, $opt{"fileList"}, $status, $opt{"comment"}, $opt{"pyConfig"}, $opt{"crabCfg"}, $opt{"jsonFile"}, $opt{"lumiSummary"}, $opt{"release"}) if !$opt{"other"}; |
90 |
|
dbUpdateOther ($id, $opt{"comment"}, "$ENV{'USER'}\@$ENV{'HOSTNAME'}") if $opt{"other"}; |
91 |
|
dbDelete ($id) if $ARGV[0] eq "deleteEntry" && !$opt{"other"}; |
746 |
|
sub |
747 |
|
locationExists |
748 |
|
{ |
749 |
+ |
my $id = shift; |
750 |
|
my $location = shift; |
751 |
|
|
752 |
|
$location =~ s/^(.*)\/+$/$1/; |
753 |
< |
my $query = "select id from ntuple where location like '$location%'"; |
753 |
> |
my $query = "select id from ntuple where location like '$location%' and id!=$id"; |
754 |
|
$db->selectdb ("ntuple"); |
755 |
|
my $results = $db->query ($query); |
756 |
|
return 1 if $results->numrows (); |
764 |
|
$location =~ s/^\/data\/se\/store\/(.*)$/\/store\/$1/; |
765 |
|
} |
766 |
|
|
767 |
< |
my $query = "select id from ntuple where location like '$location%'"; |
767 |
> |
my $query = "select id from ntuple where location like '$location%' and id!=$id"; |
768 |
|
$db->selectdb ("ntuple"); |
769 |
|
my $results = $db->query ($query); |
770 |
|
return 1 if $results->numrows (); |