Skip to content

Commit

Permalink
pbuild: add debugflags option
Browse files Browse the repository at this point in the history
Currently we just support the "expansion" flag.
  • Loading branch information
mlschroe committed Jul 13, 2023
1 parent 0ae48c3 commit d650108
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions PBuild/Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ sub create {
'assetmgr' => $assetmgr,
};
$ctx->{'rebuild'} = $opts->{'buildtrigger'} if $opts->{'buildtrigger'};
$Build::Expand::expand_dbg = 1 if $opts->{'debugflags'}->{'expansion'};
return bless $ctx;
}

Expand Down Expand Up @@ -88,14 +89,17 @@ sub pkgexpand {
my ($ctx, @pkgs) = @_;
my $bconf = $ctx->{'bconf'};
my $bconf_host = $ctx->{'bconf_host'};
my $expand_dbg = $Build::Expand::expand_dbg;
if (($bconf_host || $bconf)->{'expandflags:preinstallexpand'}) {
print "=== preinstall expansion\n" if $expand_dbg;
my $err = Build::expandpreinstalls($bconf_host || $bconf);
die("cannot expand preinstalls: $err\n") if $err;
}
my $pkgsrc = $ctx->{'pkgsrc'};
my $subpacks = $ctx->{'subpacks'};
my $cross = $bconf_host ? 1 : 0;
for my $pkg (@pkgs) {
print "=== dependency expansion of $pkg\n" if $expand_dbg;
my $p = $pkgsrc->{$pkg};
if ($p->{'native'}) {
PBuild::Expand::expand_deps($p, $bconf_host, $subpacks);
Expand Down Expand Up @@ -718,8 +722,10 @@ sub build {
}
@btdeps = PBuild::Util::unify(@btdeps);
}
my $expand_dbg = $Build::Expand::expand_dbg;
my @sysdeps = @btdeps;
unshift @sysdeps, grep {/^kiwi-.*:/} @{$p->{'dep'} || []} if $buildtype eq 'kiwi-image';
print "=== sysdeps expansion\n" if $expand_dbg;
if (@sysdeps) {
@sysdeps = Build::get_sysbuild($bconf, $buildtype, [ @sysdeps ]); # cannot cache...
} else {
Expand Down Expand Up @@ -752,6 +758,7 @@ sub build {
if ($kiwimode || $buildtype eq 'buildenv' || $buildtype eq 'preinstallimage') {
@bdeps = (1, @$edeps); # reuse edeps packages, no need to expand again
} else {
print "=== builddeps expansion\n" if $expand_dbg;
@bdeps = Build::get_build($bconf, $ctx->{'subpacks'}->{$p->{'name'}}, @bdeps);
}
if (!shift(@bdeps)) {
Expand Down
7 changes: 7 additions & 0 deletions PBuild/Options.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,15 @@ my $pbuild_options = {
'showlog' => '',
'ccache' => \&ccache_special,
'ccache-type' => '',
'debugflags' => \&debugflags_special,
};

sub debugflags_special {
my ($opts, $opt, $origopt, $args) = @_;
my $arg = Build::Options::getarg($origopt, $args);
$opts->{'debugflags'}->{$_} = 1 for split(',', $arg);
}

sub vm_type_special {
my ($opts, $opt, $origopt, $args) = @_;
my $arg;
Expand Down

0 comments on commit d650108

Please sign in to comment.