Skip to content

Commit

Permalink
Rename obsproduct to productcompose
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Nov 20, 2023
1 parent f68c7d6 commit 1fe25db
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 26 deletions.
22 changes: 14 additions & 8 deletions Build.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ our $do_fissile;
our $do_helm;
our $do_flatpak;
our $do_mkosi;
our $do_obsproduct;
our $do_productcompose;

sub import {
for (@_) {
Expand All @@ -61,9 +61,9 @@ sub import {
$do_helm = 1 if $_ eq ':helm';
$do_flatpak = 1 if $_ eq ':flatpak';
$do_mkosi = 1 if $_ eq ':mkosi';
$do_obsproduct = 1 if $_ eq ':obsproduct';
$do_productcompose = 1 if $_ eq ':productcompose';
}
$do_rpm = $do_deb = $do_kiwi = $do_obsproduct = $do_arch = $do_collax = $do_livebuild = $do_snapcraft = $do_appimage = $do_docker = $do_fissile = $do_helm = $do_flatpak = $do_mkosi = 1 if !$do_rpm && !$do_deb && !$do_kiwi && !$do_arch && !$do_collax && !$do_livebuild && !$do_snapcraft && !$do_appimage && !$do_docker && !$do_fissile && !$do_helm && !$do_flatpak && !$do_mkosi && !$do_obsproduct;
$do_rpm = $do_deb = $do_kiwi = $do_productcompose = $do_arch = $do_collax = $do_livebuild = $do_snapcraft = $do_appimage = $do_docker = $do_fissile = $do_helm = $do_flatpak = $do_mkosi = 1 if !$do_rpm && !$do_deb && !$do_kiwi && !$do_arch && !$do_collax && !$do_livebuild && !$do_snapcraft && !$do_appimage && !$do_docker && !$do_fissile && !$do_helm && !$do_flatpak && !$do_mkosi && !$do_productcompose;

if ($do_deb) {
require Build::Deb;
Expand Down Expand Up @@ -101,8 +101,8 @@ sub import {
if ($do_mkosi) {
require Build::Mkosi;
}
if ($do_obsproduct) {
require Build::ObsProduct;
if ($do_productcompose) {
require Build::ProductCompose;
}
}

Expand Down Expand Up @@ -198,6 +198,9 @@ my %subst_defaults = (
'system-packages:kiwi-product' => [
'kiwi',
],
'system-packages:productcompose' => [
'product-composer',
],
'system-packages:docker' => [
'docker', 'system-packages:repo-creation',
],
Expand Down Expand Up @@ -831,6 +834,9 @@ sub get_sysbuild {
@sysdeps = @{$config->{'substitute'}->{'system-packages:kiwi-image'} || []};
@sysdeps = @{$config->{'substitute'}->{'kiwi-setup:image'} || []} unless @sysdeps;
@sysdeps = @{$subst_defaults{'system-packages:kiwi-image'} || []} unless @sysdeps;
} elsif ($buildtype eq 'productcompose') {
@sysdeps = @{$config->{'substitute'}->{'system-packages:productcompose'} || []};
@sysdeps = @{$subst_defaults{'system-packages:productcompose'} || []} unless @sysdeps;
} elsif ($buildtype eq 'kiwi-product') {
@sysdeps = @{$config->{'substitute'}->{'system-packages:kiwi-product'} || []};
@sysdeps = @{$config->{'substitute'}->{'kiwi-setup:product'} || []} unless @sysdeps;
Expand Down Expand Up @@ -1263,7 +1269,7 @@ sub add_all_providers {
sub recipe2buildtype {
my ($recipe) = @_;
return undef unless defined $recipe;
return $1 if $recipe =~ /\.(spec|dsc|kiwi|obsproduct|livebuild)$/;
return $1 if $recipe =~ /\.(spec|dsc|kiwi|productcompose|livebuild)$/;
$recipe =~ s/.*\///;
$recipe =~ s/^_service:.*://;
return 'arch' if $recipe eq 'PKGBUILD';
Expand Down Expand Up @@ -1321,7 +1327,7 @@ sub parse {
return Build::Kiwi::parse($cf, $fn, @args) if $do_kiwi && $fn =~ /\.kiwi$/;
return Build::LiveBuild::parse($cf, $fn, @args) if $do_livebuild && $fn =~ /\.livebuild$/;
return Build::Mkosi::parse($cf, $fn, @args) if $do_mkosi && $fn =~ /^mkosi\./;
return Build::ObsProduct::parse($cf, $fn, @args) if $do_obsproduct && $fn =~ /\.obsproduct$/;
return Build::ProductCompose::parse($cf, $fn, @args) if $do_productcompose && $fn =~ /\.productcompose$/;
return parse_typed($cf, $fn, recipe2buildtype($fn), @args);
}

Expand All @@ -1331,7 +1337,7 @@ sub parse_typed {
return Build::Rpm::parse($cf, $fn, @args) if $do_rpm && $buildtype eq 'spec';
return Build::Deb::parse($cf, $fn, @args) if $do_deb && $buildtype eq 'dsc';
return Build::Kiwi::parse($cf, $fn, @args) if $do_kiwi && $buildtype eq 'kiwi';
return Build::ObsProduct::parse($cf, $fn, @args) if $do_obsproduct && $buildtype eq 'obsproduct';
return Build::ProductCompose::parse($cf, $fn, @args) if $do_productcompose && $buildtype eq 'productcompose';
return Build::LiveBuild::parse($cf, $fn, @args) if $do_livebuild && $buildtype eq 'livebuild';
return Build::Snapcraft::parse($cf, $fn, @args) if $do_snapcraft && $buildtype eq 'snapcraft';
return Build::Appimage::parse($cf, $fn, @args) if $do_appimage && $buildtype eq 'appimage';
Expand Down
2 changes: 1 addition & 1 deletion Build/ObsProduct.pm → Build/ProductCompose.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
################################################################

package Build::ObsProduct;
package Build::ProductCompose;

use strict;
use warnings;
Expand Down
4 changes: 2 additions & 2 deletions PBuild/Recipe.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ sub find_recipe {
return $files{$files[0]};
}
}
if ($type ne 'obsproduct') {
@files = grep {/\.obsproduct$/} keys %files;
if ($type ne 'productcompose') {
@files = grep {/\.productcompose$/} keys %files;
@files = grep {/^\Q$pkg\E/i} @files if @files > 1;
return $files{$files[0]} if @files == 1;
if (@files > 1) {
Expand Down
8 changes: 4 additions & 4 deletions build-recipe
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RPM_NOPREP=
BUILD_CHANGELOG_TIMESTAMP=
VCSURL=

for i in spec dsc kiwi obsproduct arch collax preinstallimage simpleimage mock livebuild snapcraft debootstrap debbuild appimage docker podman fissile helm flatpak mkosi; do
for i in spec dsc kiwi productcompose arch collax preinstallimage simpleimage mock livebuild snapcraft debootstrap debbuild appimage docker podman fissile helm flatpak mkosi; do
. "$BUILD_DIR/build-recipe-$i"
done

Expand Down Expand Up @@ -122,7 +122,7 @@ recipe_set_buildtype() {
*.spec|*.src.rpm) BUILDTYPE=spec ;;
*.dsc) BUILDTYPE=dsc ;;
*.kiwi) BUILDTYPE=kiwi ;;
*.obsproduct) BUILDTYPE=obsproduct ;;
*.productcompose) BUILDTYPE=productcompose ;;
PKGBUILD) BUILDTYPE=arch ;;
snapcraft.yaml) BUILDTYPE=snapcraft ;;
appimage.yml) BUILDTYPE=appimage ;;
Expand Down Expand Up @@ -185,15 +185,15 @@ expand_recipe_directories() {
case $(queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" type) in
dsc) types=".dsc" ;;
kiwi) types=".kiwi" ;;
obsproduct) types=".obsproduct" ;;
productcompose) types=".productcompose" ;;
arch) types="PKGBUILD" ;;
collax) types="build.collax" ;;
livebuild) types=".livebuild" ;;
snapcraft) types="snapcraft.yaml" ;;
mkosi) types="mkosi." ;;
esac
fi
types="$types .spec _specsubdir:package _specsubdir:dist .dsc PKGBUILD Dockerfile build.collax .kiwi .obsproduct .src.rpm .nosrc.rpm simpleimage snapcraft.yaml Chart.yaml flatpak.yaml flatpak.json mkosi."
types="$types .spec _specsubdir:package _specsubdir:dist .dsc PKGBUILD Dockerfile build.collax .kiwi .productcompose .src.rpm .nosrc.rpm simpleimage snapcraft.yaml Chart.yaml flatpak.yaml flatpak.json mkosi."
fi
for t in $types ; do
found=
Expand Down
18 changes: 9 additions & 9 deletions build-recipe-obsproduct → build-recipe-productcompose
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
################################################################


recipe_setup_obsproduct() {
recipe_setup_productcompose() {
TOPDIR=/usr/src/packages
test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR"
mkdir -p "$BUILD_ROOT$TOPDIR"
mkdir -p "$BUILD_ROOT$TOPDIR/OTHER"
mkdir -p "$BUILD_ROOT$TOPDIR/SOURCES"
mkdir -p "$BUILD_ROOT$TOPDIR/OBSPRODUCT"
mkdir -p "$BUILD_ROOT$TOPDIR/PRODUCT"
# compat, older build versions did not clean TOPDIR ...
mkdir -p "$BUILD_ROOT$TOPDIR/BUILD"
mkdir -p "$BUILD_ROOT$TOPDIR/RPMS"
Expand All @@ -51,12 +51,12 @@ recipe_setup_obsproduct() {
fi
}

recipe_prepare_obsproduct() {
recipe_prepare_productcompose() {
:
}

recipe_build_obsproduct() {
echo "running obs product builder..."
recipe_build_productcompose() {
echo "running product composer..."

extra_args=""
if test -n "$RELEASE" ; then
Expand All @@ -65,13 +65,13 @@ recipe_build_obsproduct() {
if test -n "$BUILD_FLAVOR" ; then
extra_args=" $extra_args --flavor $BUILD_FLAVOR"
fi
chroot "$BUILD_ROOT" su -c "/usr/bin/obs-product-builder build $extra_args -v --clean $TOPDIR/SOURCES/$RECIPEFILE $TOPDIR/OBSPRODUCT" - abuild < /dev/null && BUILD_SUCCEEDED=true
chroot "$BUILD_ROOT" su -c "/usr/bin/product-composer build $extra_args -v --clean $TOPDIR/SOURCES/$RECIPEFILE $TOPDIR/PRODUCT" - abuild < /dev/null && BUILD_SUCCEEDED=true
}

recipe_resultdirs_obsproduct() {
echo OBSPRODUCT
recipe_resultdirs_productcompose() {
echo PRODUCT
}

recipe_cleanup_obsproduct() {
recipe_cleanup_productcompose() {
:
}
2 changes: 1 addition & 1 deletion docs/build_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ architecture!). For example arm-linux-gnueabihf for armv7hl builds.
Build recipe type. This is the format of the file which provides the
build description. This gets usually autodetected, but in some rare
cases it can be set here to either one of these: spec, dsc, kiwi,
livebuild, arch, preinstallimage, obsproduct.
livebuild, arch, preinstallimage, productcompose.

Defines the build recipe format. Valid values are currently: none, spec,
dsc, arch, kiwi, preinstallimage. If no type is specified, OBS deduces a
Expand Down
2 changes: 1 addition & 1 deletion expanddeps
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Build::readdeps($cf, undef, \%repo);

my @sysdeps = Build::get_sysbuild($cf, $buildtype, $extrasysdeps);

if ($buildtype eq 'kiwi-image' || $buildtype eq 'kiwi-product' || $buildtype eq 'obsproduct') {
if ($buildtype eq 'kiwi-image' || $buildtype eq 'kiwi-product' || $buildtype eq 'productcompose') {
if (!shift @sysdeps) {
print STDERR "expansion error\n";
print STDERR " $_\n" for @sysdeps;
Expand Down

0 comments on commit 1fe25db

Please sign in to comment.