Skip to content

Commit

Permalink
Support OBS-Profiles kiwi annotation
Browse files Browse the repository at this point in the history
This can be used to configure the profiles that should be built.
The commit also supports the "@BUILD_FLAVOR@" special value, so
that a multibuild package can build different flavors.
  • Loading branch information
mlschroe committed Feb 28, 2018
1 parent 7616961 commit 36bfde8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Build/Kiwi.pm
Expand Up @@ -73,8 +73,12 @@ sub kiwiparse {
my $schemaversion56 = versionstring('5.6');
my $obsexclusivearch;
my $obsexcludearch;
my $obsprofiles;
$obsexclusivearch = $1 if $xml =~ /^\s*<!--\s+OBS-ExclusiveArch:\s+(.*)\s+-->\s*$/im;
$obsexcludearch = $1 if $xml =~ /^\s*<!--\s+OBS-ExcludeArch:\s+(.*)\s+-->\s*$/im;
$obsprofiles = $1 if $xml =~ /^\s*<!--\s+OBS-Profiles:\s+(.*)\s+-->\s*$/im;
my @obsprofiles;
@obsprofiles = split(' ', $obsprofiles) if $obsprofiles;
my $kiwi = Build::SimpleXML::parse($xml);
die("not a kiwi config\n") unless $kiwi && $kiwi->{'image'};
$kiwi = $kiwi->{'image'}->[0];
Expand Down Expand Up @@ -349,6 +353,7 @@ sub kiwiparse {
$containertags = [ "$containername:latest" ] if defined($containername) && !$containertags;
$ret->{'container_tags'} = $containertags if $containertags;
}
$ret->{'profiles'} = [ unify(@obsprofiles) ] if @obsprofiles;
return $ret;
}

Expand Down
17 changes: 13 additions & 4 deletions build-recipe-kiwi
Expand Up @@ -551,13 +551,22 @@ build_kiwi_appliance() {
test -x /etc/init.d/boot.device-mapper && \
/etc/init.d/boot.device-mapper start
fi
local kiwi_profile=$(queryconfig \
--dist "$BUILD_DIST" --configdir "$CONFIG_DIR" \
--archpath "$BUILD_ARCH" buildflags kiwiprofile
)
local kiwi_profile
kiwi_profile=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show "$BUILD_ROOT/$TOPDIR/SOURCES/$RECIPEFILE" profiles)
if test -z "$kiwi_profile"; then
kiwi_profile=$(queryconfig \
--dist "$BUILD_DIST" --configdir "$CONFIG_DIR" \
--archpath "$BUILD_ARCH" buildflags kiwiprofile
)
fi
# special build flavor hack
if test "$kiwi_profile" = '@BUILD_FLAVOR@' ; then
kiwi_profile="$BUILD_FLAVOR"
fi
if test -z "$kiwi_profile"; then
kiwi_profile=__not__set
fi

local kiwi_path=/usr/bin/kiwi kiwi_legacy=false
if ! test -L "$BUILD_ROOT/usr/bin/kiwi" ; then
kiwi_path=/usr/sbin/kiwi
Expand Down

0 comments on commit 36bfde8

Please sign in to comment.