Attempt to only add/remove enman repos that need action

Since enman was changed to provide exit status 1 [1] if the requested
operation failed, builder attempting to re-add an already existing repo
caused the entire build to fail. Rather than run the command and hope
for the best, this commit changes builder to obtain a list of already
installed repositories, and only add/remove the requested repos that
aren't already in the correct state.

[1] Sabayon/enman@7f3a6c88
This commit is contained in:
Ben Roberts
2016-10-24 09:16:35 +01:00
parent 890206ba80
commit 9446715e1a
+12 -2
View File
@@ -412,14 +412,24 @@ if ($use_equo) {
say "Devkit version:";
system("equo s -vq app-misc/sabayon-devkit");
my @installed_enman_repos = split(/\n/, chomp(system("enman list --installed -q")));
if ( $enman_repositories and $enman_repositories ne "" ) {
my @enman_toadd = split( / /, $enman_repositories );
safe_call("enman add $_") for @enman_toadd;
for my $enman_add (@enman_toadd) {
if ! grep ($enman_add, @installed_enman_repos) {
safe_call("enman add $_");
}
}
}
if ( $remove_enman_repositories and $remove_enman_repositories ne "" ) {
my @enman_toremove = split( / /, $remove_enman_repositories );
system("enman remove $_") for @enman_toremove;
for my $enman_remove (@enman_toremove) {
if grep ($enman_remove, @installed_enman_repos) {
safe_call("enman remove $_");
}
}
}
system("enman add $repository_name")