@@ -31,30 +31,22 @@ def estimate_image_size(spec_file,sudopw=None,padding=50):
3131 :param spec_file: the spec file, called "Singuarity"
3232 :param padding: the padding (MB) to add to the image
3333 '''
34- size_dir = tempfile .mkdtemp ()
35- tmp_dir = tempfile .mkdtemp ()
3634 image_folder = build_from_spec (spec_file = spec_file , # default will package the image
3735 sudopw = sudopw , # with root should not need sudo
38- output_folder = size_dir ,
39- build_dir = tmp_dir ,
4036 build_folder = True )
4137 original_size = calculate_folder_size (image_folder )
4238 bot .logger .debug ("Original image size calculated as %s" ,original_size )
4339 padded_size = original_size + padding
4440 bot .logger .debug ("Size with padding will be %s" ,padded_size )
45- shutil .rmtree (size_dir )
46- os .system ('sudo rm -rf %s' % tmp_dir )
4741 return padded_size
4842
4943
50- def build_from_spec (spec_file = None ,build_dir = None ,size = None ,sudopw = None ,
51- output_folder = None ,build_folder = False ):
44+ def build_from_spec (spec_file = None ,build_dir = None ,size = None ,sudopw = None ,build_folder = False ):
5245 '''build_from_spec will build a "spec" file in a "build_dir" and return the directory
5346 :param spec_file: the spec file, called "Singuarity"
5447 :param sudopw: the sudopw for Singularity, root should provide ''
5548 :param build_dir: the directory to build in. If not defined, will use tmpdir.
5649 :param size: the size of the image
57- :param output_folder: where to output the image package
5850 :param build_folder: "build" the image into a folder instead. Default False
5951 '''
6052 if spec_file == None :
@@ -64,7 +56,11 @@ def build_from_spec(spec_file=None,build_dir=None,size=None,sudopw=None,
6456 bot .logger .debug ("Building in directory %s" ,build_dir )
6557
6658 # Copy the spec to a temporary directory
59+ bot .logger .debug ("Spec file set to %s" ,spec_file )
6760 spec_path = "%s/%s" % (build_dir ,os .path .basename (spec_file ))
61+ bot .logger .debug ("Spec file for build should be in %s" ,spec_path )
62+
63+ # If it's not already there
6864 if not os .path .exists (spec_path ):
6965 shutil .copyfile (spec_file ,spec_path )
7066
0 commit comments