From 9446715e1ae1d6696952af90ac4eef893f94fd06 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Mon, 24 Oct 2016 09:16:35 +0100 Subject: [PATCH] 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 --- builder | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/builder b/builder index 9cf48b4..54201ae 100755 --- a/builder +++ b/builder @@ -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")