Fixing broken integration test and improving the build generation.

To avoid the app_id duplicity the app now checks that the given
app_id is the same that the repo app_id and fails if it isn't (untested yet)
also if the sdk or runtime is installed at operative system level, the
installation is skipped to be able to avoid the major source of overhead
in the build.

The build system has been rethinked so a release can have multiple
builds to the same architecture if one was unsuccessful. This may
help repositories which choose to release against a branch, if
you release against a tag you will probably have to make other
release fixing the error anyway.
This commit is contained in:
sergiotarxz 2022-03-29 19:18:17 +02:00
parent 20b74912fa
commit 5eb44406a9
2 changed files with 26 additions and 15 deletions

View File

@ -59,7 +59,8 @@ use List::AllUtils qw/any/;
my ( $merged_output, $exit ) = tee_merged {
my $flatpak_builder_file = $application->flatpak_builder_file;
say
"$flatpak_builder_file directory portions should not be .., . or empty string", return 1
"$flatpak_builder_file directory portions should not be .., . or empty string",
return 1
if any { $_ eq '..' or $_ eq '.' or $_ eq '' }
File::Spec->splitdir($flatpak_builder_file);
my $dir = Path::Tiny->tempdir;
@ -68,28 +69,37 @@ use List::AllUtils qw/any/;
Path::Tiny->new( $ENV{HOME} )->child('.peace-apps');
local $ENV{HOME} = $dir;
say "TEMP_HOME: $dir";
system 'git', 'clone', $application->git_repo, $clone_dir and return 1;
system 'git', 'clone', $application->git_repo, $clone_dir
and return 1;
say "CLONE_DIR: $clone_dir";
my $current_dir = pushd $clone_dir;
my $flatpak_data = $self->_parse_flatpak_builder_file;
my $app_id = $flatpak_data->{"app-id"};
say "$app_id is not the provided app_id ($application->app_id)",
return 1
if $app_id ne $application->app_id;
say "APP_ID: $app_id";
my $sdk = $flatpak_data->{sdk};
say "SDK: $sdk";
my $runtime = $flatpak_data->{runtime};
say "RUNTIME: $runtime";
my %installed_apps = map { (join(',',[split "\t"]->@[1,4]) => 1) } split "\n", `flatpak list`;
system 'flatpak', '--user', 'list' and return 1;
system 'flatpak', '--user', 'remote-add', '--if-not-exists',
'remote', $application->flatpak_repo and return 1;
'remote', $application->flatpak_repo
and return 1;
say $sdk;
system 'flatpak', '--user', 'install', '--arch', $arch, '-y',
"$sdk" and return 1;
exists $installed_apps{"$sdk,$arch"} or system 'flatpak', '--user', 'install', '--arch', $arch, '-y',
"$sdk"
and return 1;
say $runtime;
system 'flatpak', '--user', 'install', '--arch', $arch, '-y',
"$runtime" and return 1;
exists $installed_apps{"$runtime,$arch"} or system 'flatpak', '--user', 'install', '--arch', $arch, '-y',
"$runtime"
and return 1;
system 'flatpak-builder', '--arch', $arch, '--install', '--user',
'build', $application->flatpak_builder_file, $app_id and return 1;
'build', $application->flatpak_builder_file, $app_id
and return 1;
$output_dir = $output_dir->child( $self->uuid );
$output_dir->mkpath;
return system 'flatpak', 'build-bundle', '--arch', $arch,

View File

@ -18,6 +18,7 @@ use Peace::Model::Release;
description => 'Stub',
url => 'https://gitea.sergiotarxz.freemyip.com/sergiotarxz/mangareader',
developer => $developer,
app_id => 'me.sergiotarxz.openmg',
price => '99',
git_repo =>
'https://gitea.sergiotarxz.freemyip.com/sergiotarxz/mangareader',