@@ -56,6 +56,8 @@ def add_common_args(parser):
56
56
'If both --enablerepo and --disablerepo are set, --disablerepo will be applied first' )
57
57
group .add_argument ('--no-update' , action = 'store_true' ,
58
58
help = 'do not run "yum update" on container start, use it as it was at build time' )
59
+ group .add_argument ('--no-network' , action = 'store_true' ,
60
+ help = 'disable all networking support in the build environment' )
59
61
60
62
def add_container_args (parser ):
61
63
group = parser .add_argument_group ("container arguments" )
@@ -196,6 +198,11 @@ def container(args):
196
198
docker_args += ["-e" , "DISABLEREPO=%s" % args .disablerepo ]
197
199
if args .no_update :
198
200
docker_args += ["-e" , "NOUPDATE=1" ]
201
+ if args .no_network :
202
+ docker_args += ["--network" , "none" ]
203
+
204
+ if args .no_network and not args .no_update :
205
+ print ("WARNING: network disabled but --no-update not passed" , file = sys .stderr )
199
206
200
207
# container args
201
208
if args .volume :
@@ -228,6 +235,9 @@ def container(args):
228
235
# action-specific
229
236
match args .action :
230
237
case 'build' :
238
+ if args .no_network and not args .builddep_dir :
239
+ print ("WARNING: network disabled but --builddep-dir not passed" , file = sys .stderr )
240
+
231
241
build_dir = os .path .abspath (args .source_dir )
232
242
if args .define :
233
243
docker_args += ["-e" , "RPMBUILD_DEFINE=%s" % args .define ]
0 commit comments