aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2017-10-13 15:18:10 +0100
committerPascal Terjan <pterjan@mageia.org>2017-10-13 15:18:10 +0100
commitb916a14b9d07c7876bebfb70af5dddf8b4e86de7 (patch)
tree03ea62b81fe8d1eec7625978f80ec3683fa0134d
parent25a0b8762f97e0cd6424e84859e69d76b9b6aca4 (diff)
downloadiurt-b916a14b9d07c7876bebfb70af5dddf8b4e86de7.tar
iurt-b916a14b9d07c7876bebfb70af5dddf8b4e86de7.tar.gz
iurt-b916a14b9d07c7876bebfb70af5dddf8b4e86de7.tar.bz2
iurt-b916a14b9d07c7876bebfb70af5dddf8b4e86de7.tar.xz
iurt-b916a14b9d07c7876bebfb70af5dddf8b4e86de7.zip
Change use_netns to allow per package setting
-rw-r--r--NEWS2
-rwxr-xr-xiurt9
-rw-r--r--lib/Iurt/Chroot.pm14
3 files changed, 15 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index 7f7504a..7d00488 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- iurt: change use_netns to allow per package setting
+
0.7.2.2
- iurt: actully commit the fixed and tested version
diff --git a/iurt b/iurt
index 4ea53df..789da6f 100755
--- a/iurt
+++ b/iurt
@@ -503,7 +503,7 @@ my %config_usage = (
},
use_netns => {
desc => 'Create a separate network namespace for each chroot to prevent builds from accessing the network',
- default => 1
+ default => { default => 1 }
},
);
@@ -720,17 +720,20 @@ sub rebuild_one {
retry:
$urpmi->clean_urpmi_process;
+ $srpm =~ /(.*)-[^-]+-[^-]+\.src\.rpm$/ or return $srpm;
+ my $srpm_name = $1;
+
if (!$run{use_old_chroot}) {
plog('DEBUG', 'Not reusing old chroot');
+ my $use_netns = defined($config->{use_netns}{$srpm_name}) ? $config->{use_netns}{$srpm_name} : $config->{use_netns}{default};
$chroot_tmp = create_temp_chroot(\%run, $config,
- $chroot_tmp, $chroot_ref) or return $srpm;
+ $chroot_tmp, $chroot_ref, $use_netns) or return $srpm;
}
if (!$urpmi->urpmi_command($chroot_tmp)) {
plog('ERROR', "Creating chroot failed.\nCommand was: $chroot_tmp");
return $srpm;
}
- $srpm =~ /(.*)-[^-]+-[^-]+\.src\.rpm$/ or return $srpm;
my ($maintainer, $cc);
if (!$run{warn}) {
($maintainer) = get_maint(\%run, $srpm);
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index c54b180..9710b0f 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -49,7 +49,7 @@ sub clean_chroot {
}
-=head2 clean_and_build_chroot($chroot, $chroot_ref, $run, $config)
+=head2 clean_and_build_chroot($chroot, $chroot_ref, $run, $config, $use_netns)
Create or clean a chroot
I<$chroot> chroot path
@@ -60,10 +60,10 @@ Return true.
sub clean_and_build_chroot {
- my ($chroot, $chroot_ref, $run, $config) = @_;
+ my ($chroot, $chroot_ref, $run, $config, $use_netns) = @_;
clean_chroot($chroot, $run, $config) and return 1;
- if (!create_build_chroot($chroot, $chroot_ref, $run, $config)) {
+ if (!create_build_chroot($chroot, $chroot_ref, $run, $config, $use_netns)) {
plog('ERROR', "Failed to create chroot");
return;
}
@@ -188,11 +188,11 @@ sub add_local_user {
}
sub create_temp_chroot {
- my ($run, $config, $chroot_tmp, $chroot_ref) = @_;
+ my ($run, $config, $chroot_tmp, $chroot_ref, $use_netns) = @_;
plog("Install new chroot");
plog('DEBUG', "... in $chroot_tmp");
- clean_and_build_chroot($chroot_tmp, $chroot_ref, $run, $config) or return;
+ clean_and_build_chroot($chroot_tmp, $chroot_ref, $run, $config, $use_netns) or return;
$chroot_tmp;
}
@@ -298,7 +298,7 @@ sub check_chroot_need_update {
}
sub create_build_chroot {
- my ($chroot, $chroot_ref, $run, $config) = @_;
+ my ($chroot, $chroot_ref, $run, $config, $use_netns) = @_;
my $ret = 0;
if ($run->{storage} eq 'btrfs') {
$ret = create_build_chroot_btrfs($chroot, $chroot_ref, $run, $config);
@@ -316,7 +316,7 @@ sub create_build_chroot {
}
}
- if ($ret && $config->{use_netns}) {
+ if ($use_netns) {
sudo($config, '--netns_create', $chroot);
}
return $ret;