Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bs_publish: move out repository create stuff into separate function #7891

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
136 changes: 71 additions & 65 deletions src/backend/bs_publish
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,74 @@ sub clean_blobdir {
rmdir($blobdir);
}

sub createrepo {
my ($projid, $repoid, $data) = @_;
my $prp = "$projid/$repoid";
print " creating repository\n";
my $extrep = BSUrlmapper::get_extrep($prp);
return unless $extrep;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't create repo metadata anymore, if no stage server is defined?
This is not wanted....

Copy link
Contributor Author

@rhabacker rhabacker Jul 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because $stageservers is unused here I assume that you are suggesting to use BSUrlmapper::get_extrep($prp) instead, as done in the updated patch ?

$extrep .= $data->{'dbgsplit'} if $data->{'dbgsplit'};

my %repotype = %{$data->{'repotype'}};
my %patterntype = %{$data->{'patterntype'}};

my $xrepoid = $repoid;
$xrepoid .= $data->{'dbgsplit'} if $data->{'dbgsplit'};

if ($repotype{'rpm-md'}) {
createrepo_rpmmd($extrep, $projid, $xrepoid, $data, $repotype{'rpm-md'});
} else {
deleterepo_rpmmd($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'suse'}) {
createrepo_susetags($extrep, $projid, $xrepoid, $data, $repotype{'suse'});
} else {
deleterepo_susetags($extrep, $projid, $xrepoid, $data);
}
# Mandriva format:
if ($repotype{'hdlist2'}) {
createrepo_hdlist2($extrep, $projid, $xrepoid, $data, $repotype{'hdlist2'});
} else {
deleterepo_hdlist2($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'debian'}) {
createrepo_debian($extrep, $projid, $xrepoid, $data, $repotype{'debian'});
} else {
deleterepo_debian($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'arch'}) {
createrepo_arch($extrep, $projid, $xrepoid, $data, $repotype{'arch'});
} else {
deleterepo_arch($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'staticlinks'}) {
createrepo_staticlinks($extrep, $projid, $xrepoid, $data, $repotype{'staticlinks'});
} else {
deleterepo_staticlinks($extrep, $projid, $xrepoid, $data);
}

if ($patterntype{'ymp'}) {
createpatterns_ymp($extrep, $projid, $xrepoid, $data, $patterntype{'ymp'});
} else {
deletepatterns_ymp($extrep, $projid, $xrepoid, $data);
}
if ($patterntype{'rpm-md'}) {
createpatterns_rpmmd($extrep, $projid, $xrepoid, $data, $patterntype{'rpm-md'});
} else {
deletepatterns_rpmmd($extrep, $projid, $xrepoid, $data);
}
if ($patterntype{'comps'}) {
createpatterns_comps($extrep, $projid, $xrepoid, $data, $patterntype{'comps'});
} else {
deletepatterns_comps($extrep, $projid, $xrepoid, $data);
}

# virt-builder repository
if (-e "$extrep/index") {
createrepo_virtbuilder($extrep, $projid, $xrepoid, $data);
}
}

sub deleterepo {
my ($projid, $repoid, $dbgsplit) = @_;
my $prp = "$projid/$repoid";
Expand Down Expand Up @@ -2607,9 +2675,6 @@ sub publish {
goto publishprog_done;
}

my $xrepoid = $repoid;
$xrepoid .= $dbgsplit if $dbgsplit;

my @repotags = @{$repotype{'repotag'} || []};
# de-escape (mostly done for ':'
s/%([a-fA-F0-9]{2})/chr(hex($1))/ge for @repotags;
Expand All @@ -2634,70 +2699,11 @@ sub publish {
'packtrack' => $packtrack,
'repotags' => \@repotags,
'chksumfiles' => \@chksumfiles,
'repotype' => \%repotype,
'patterntype' => \%patterntype,
};

if ($repotype{'rpm-md'}) {
createrepo_rpmmd($extrep, $projid, $xrepoid, $data, $repotype{'rpm-md'});
} else {
deleterepo_rpmmd($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'suse'}) {
createrepo_susetags($extrep, $projid, $xrepoid, $data, $repotype{'suse'});
} else {
deleterepo_susetags($extrep, $projid, $xrepoid, $data);
}
# Mandriva format:
if ($repotype{'hdlist2'}) {
createrepo_hdlist2($extrep, $projid, $xrepoid, $data, $repotype{'hdlist2'});
} else {
deleterepo_hdlist2($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'debian'}) {
createrepo_debian($extrep, $projid, $xrepoid, $data, $repotype{'debian'});
} else {
deleterepo_debian($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'arch'}) {
createrepo_arch($extrep, $projid, $xrepoid, $data, $repotype{'arch'});
} else {
deleterepo_arch($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'vagrant'}) {
createrepo_vagrant($extrep, $projid, $xrepoid, $data, $repotype{'vagrant'});
} else {
deleterepo_vagrant($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'staticlinks'}) {
createrepo_staticlinks($extrep, $projid, $xrepoid, $data, $repotype{'staticlinks'});
} else {
deleterepo_staticlinks($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'zyppservice'}) {
createrepo_zyppservice($extrep, $projid, $xrepoid, $data, $repotype{'zyppservice'});
} else {
deleterepo_zyppservice($extrep, $projid, $xrepoid, $data);
}

if ($patterntype{'ymp'}) {
createpatterns_ymp($extrep, $projid, $xrepoid, $data, $patterntype{'ymp'});
} else {
deletepatterns_ymp($extrep, $projid, $xrepoid, $data);
}
if ($patterntype{'rpm-md'}) {
createpatterns_rpmmd($extrep, $projid, $xrepoid, $data, $patterntype{'rpm-md'});
} else {
deletepatterns_rpmmd($extrep, $projid, $xrepoid, $data);
}
if ($patterntype{'comps'}) {
createpatterns_comps($extrep, $projid, $xrepoid, $data, $patterntype{'comps'});
} else {
deletepatterns_comps($extrep, $projid, $xrepoid, $data);
}

# virt-builder repository
if (-e "$extrep/index") {
createrepo_virtbuilder($extrep, $projid, $xrepoid, $data);
}
createrepo($projid, $repoid, $data);

publishprog_done:
unlink("$uploaddir/publisher.$$") if @$signargs;
Expand Down