@@ -58,6 +58,8 @@ def add_common_args(parser):
58
58
help = "Directory where the build-dependency RPMs will be taken from." )
59
59
group .add_argument ('--no-update' , action = 'store_true' ,
60
60
help = 'do not run "yum update" on container start, use it as it was at build time' )
61
+ group .add_argument ('--no-network' , action = 'store_true' ,
62
+ help = 'disable all networking support in the build environment' )
61
63
62
64
def add_container_args (parser ):
63
65
group = parser .add_argument_group ("container arguments" )
@@ -213,6 +215,11 @@ def container(args):
213
215
docker_args += ["-e" , "DISABLEREPO=%s" % args .disablerepo ]
214
216
if args .no_update :
215
217
docker_args += ["-e" , "NOUPDATE=1" ]
218
+ if args .no_network :
219
+ docker_args += ["--network" , "none" ]
220
+
221
+ if args .no_network and not args .no_update :
222
+ print ("WARNING: network disabled but --no-update not passed" , file = sys .stderr )
216
223
217
224
# container args
218
225
if args .volume :
@@ -249,6 +256,9 @@ def container(args):
249
256
# action-specific
250
257
match args .action :
251
258
case 'build' :
259
+ if args .no_network and not args .local_repo :
260
+ print ("WARNING: network disabled but --local-repo not passed" , file = sys .stderr )
261
+
252
262
build_dir = os .path .abspath (args .source_dir )
253
263
if args .define :
254
264
docker_args += ["-e" , "RPMBUILD_DEFINE=%s" % args .define ]
0 commit comments