Skip to content

Commit

Permalink
[backend] clean up addrev_local's linkinfodb handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Jul 18, 2016
1 parent 0f075bc commit 22cbf6a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/backend/BSRevision.pm
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ sub addrev_replace_common {
my %rfilemd5;
for my $todo (@todo) {
my ($tmpfile, $file, $rfile) = @$todo;
die("addrev_local_replace must not replace _link files\n") if $suf eq 'rev' && $rfile eq '_link';
next unless defined($tmpfile);
mkdir_p($uploaddir);
unlink("$uploaddir/addrev_meta$$");
Expand Down Expand Up @@ -314,6 +315,7 @@ sub addrev_meta_replace {
sub updatelinkinfodb {
my ($projid, $packid, $rev, $files) = @_;

return if $packid eq '_project'; # no links allowed
mkdir_p($sourcedb) unless -d $sourcedb;
my $linkdb = BSDB::opendb($sourcedb, 'linkinfo');
my $linkinfo;
Expand Down Expand Up @@ -367,6 +369,9 @@ sub addrev_local {
# add missing data to complete the revision object
$rev->{'project'} = $projid;
$rev->{'package'} = $packid;
if (!$files && !$cgi->{'nolinkinfodb'}) {
eval { $files = BSSrcrep::lsrev($rev) };
}
# update linked package database
updatelinkinfodb($projid, $packid, $rev, $files) if $files;
# kill upload revision as we did a real commit
Expand All @@ -376,6 +381,11 @@ sub addrev_local {
return $rev;
}

sub addrev_meta {
my ($cgi, $projid, $packid, $rev) = @_;
die("addrev_meta is not implemented (yet)\n");
}

sub undelete_rev {
my ($cgi, $projid, $packid, $revfilefrom, $revfileto) = @_;
my @rev = BSFileDB::fdb_getall($revfilefrom, $srcrevlay);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bs_srcserver
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ sub expandproduct {
next;
}
my $prev = {'srcmd5' => $srcmd5, 'time' => time(), 'user' => $user, 'comment' => 'autogenerated', 'version' => '1', 'vrev' => '1'};
BSRevision::addrev_local({'vrev' => 1}, $projid, $pid, $prev);
BSRevision::addrev_local({'vrev' => 1, 'nolinkinfodb' => 1}, $projid, $pid, $prev);
if (! -e "$projectsdir/$projid.pkg/$pid.xml") {
my $pidpack = readxml("$pdir/_meta", $BSXML::pack, 1);
if ($pidpack) {
Expand Down

0 comments on commit 22cbf6a

Please sign in to comment.