@@ -51,8 +51,10 @@ def build_from_spec(spec_file=None,build_dir=None,size=None,sudopw=None,build_fo
5151 '''
5252 if spec_file == None :
5353 spec_file = "Singularity"
54+
5455 if build_dir == None :
5556 build_dir = tempfile .mkdtemp ()
57+
5658 bot .logger .debug ("Building in directory %s" ,build_dir )
5759
5860 # Copy the spec to a temporary directory
@@ -65,25 +67,32 @@ def build_from_spec(spec_file=None,build_dir=None,size=None,sudopw=None,build_fo
6567 shutil .copyfile (spec_file ,spec_path )
6668
6769 image_path = "%s/image" % (build_dir )
70+
6871 # Run create image and bootstrap with Singularity command line tool.
6972 if sudopw != None :
7073 cli = Singularity (sudopw = sudopw )
7174 else :
7275 cli = Singularity () # This command will ask the user for sudo
76+
7377 print ("\n Creating and boostrapping image..." )
78+
7479 # Does the user want to "build" into a folder or image?
7580 if build_folder == True :
81+ bot .logger .debug ("build_folder is true, creating %s" ,image_path )
7682 os .mkdir (image_path )
7783 else :
7884 cli .create (image_path ,size = size )
85+
7986 result = cli .bootstrap (image_path = image_path ,spec_path = spec_path )
8087 print (result )
88+
8189 # If image, rename based on hash
8290 if build_folder == False :
8391 version = get_image_hash (image_path )
8492 final_path = "%s/%s" % (build_dir ,version )
8593 os .rename (image_path ,final_path )
8694 image_path = final_path
95+
8796 bot .logger .debug ("Built image: %s" ,image_path )
8897 return image_path
8998
0 commit comments