Skip to content

Commit

Permalink
Pbuild: tweak reponame generation
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Mar 1, 2021
1 parent 79c6f11 commit 1c2fc98
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pbuild
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ PBuild::Preset::apply_preset($opts, $preset) if $preset;

my $reponame = $opts->{'reponame'};
if (!$reponame && $opts->{'dist'}) {
$reponame = $opts->{'dist'}->[-1];
$reponame = $opts->{'dist'}->[0];
$reponame = $1 if $reponame =~ /^obs:\/.*?([^\/]+)\/standard\/*$/s;
$reponame =~ s/.*\///;
$reponame =~ s/\.conf$//;
$reponame =~ s/[:\s]+/_/g;
}

my $myarch = $opts->{'arch'};
Expand Down Expand Up @@ -124,7 +126,7 @@ for my $dist (@{$opts->{'dist'} || []}) {
push @{$opts->{'repo'}}, @baseobsrepos if @baseobsrepos && !$opts->{'repo'};

my $localconfig = -s "$dir/_config" ? PBuild::Util::readstr("$dir/_config") : '';
$localconfig = "\n%define _repository $reponame\n\n$localconfig" if $localconfig ne '';
$localconfig = "\n%define _repository $reponame\n\n$localconfig" if $reponame && $localconfig ne '';

my $buildconfig = PBuild::BuildConfig::combineconfigs(reverse(@baseconfigs), $localconfig);
my $bconf = Build::read_config($myarch, [ split("\n", $buildconfig) ]);
Expand Down

0 comments on commit 1c2fc98

Please sign in to comment.