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