diff --git a/ogscm/app/builder.py b/ogscm/app/builder.py index e5fba10702e7cb5ba834931a2432282d9ddab027..0bb9c65da244cbb5a74a8aa02f6917c582ea00c9 100644 --- a/ogscm/app/builder.py +++ b/ogscm/app/builder.py @@ -56,7 +56,9 @@ class builder(object): self.image_file = f"{self.__images_out_dir}/{self.__args.sif_file}" else: self.image_file = f"{image_base_name}.sif" - if self.__args.convert and not os.path.exists(self.image_file): + if self.__args.convert and ( + not os.path.exists(self.image_file) or self.__args.force + ): subprocess.run( f"cd {self.__cwd} && singularity build --force {self.image_file} docker-daemon:{self.__tag}", shell=True, @@ -66,7 +68,9 @@ class builder(object): self.image_file = f"{self.__images_out_dir}/{self.__args.enroot_file}" else: self.image_file = f"{image_base_name}.sqsh" - if self.__args.convert_enroot and not os.path.exists(self.image_file): + if self.__args.convert_enroot and ( + not os.path.exists(self.image_file) or self.__args.force + ): subprocess.run( # See https://www.mankier.com/1/mksquashfs for options. f"cd {self.__cwd} && rm -f {self.image_file} && ENROOT_SQUASH_OPTIONS='-comp xz -b 512K' enroot import -o {self.image_file} dockerd://{self.__tag}", diff --git a/ogscm/building_blocks/ogs.py b/ogscm/building_blocks/ogs.py index ffcc749237b418515b9743211d600477e6a1e1c7..c26362b063be196b63c66262629d7cae3eb84054 100644 --- a/ogscm/building_blocks/ogs.py +++ b/ogscm/building_blocks/ogs.py @@ -78,7 +78,6 @@ class ogs(bb_base, hpccm.templates.CMakeBuild, hpccm.templates.rm): commands=self.__commands, _arguments=self.__shell_args, ) - self += runscript(commands=["ogs"]) if self.__environment_variables: self += environment(variables=self.__environment_variables) diff --git a/ogscm/cli.py b/ogscm/cli.py index e3dab060f4f96b618a804c2b1d1a670b4606dc93..c2c6c8e7563e11fa1d3b862ecd25ee6df53c963e 100644 --- a/ogscm/cli.py +++ b/ogscm/cli.py @@ -116,6 +116,12 @@ def main(): # pragma: no cover default="", help="Overwrite output enroot image file name", ) + build_g.add_argument( + "--force", + dest="force", + action="store_true", + help="Forces overwriting of image files!", + ) build_g.add_argument( "--runtime-only", "-R",