Skip to content

Commit ad269bf

Browse files
committed
tweaks to build
1 parent 4820e3d commit ad269bf

10 files changed

Lines changed: 26 additions & 19 deletions

File tree

singularity/analysis/reproduce/hash.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828

2929
from singularity.cli import Singularity
3030
from singularity.logger import bot
31-
from .criteria import *
32-
from .levels import *
33-
from .utils import (
31+
from singularity.analysis.reproduce.criteria import *
32+
from singularity.analysis.reproduce.levels import *
33+
from singularity.analysis.reproduce.utils import (
3434
get_image_tar,
3535
delete_image_tar,
3636
extract_guts
@@ -130,7 +130,8 @@ def get_image_hash(image_path,
130130
def get_content_hashes(image_path,
131131
level=None,
132132
regexp=None,
133-
include_files=None,tag_root=True,
133+
include_files=None,
134+
tag_root=True,
134135
level_filter=None,
135136
skip_files=None,
136137
version=None,

singularity/analysis/reproduce/metrics.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
def assess_differences(image_file1,
3838
image_file2,
3939
levels=None,
40-
version=None,size_heuristic=False,
40+
version=None,
41+
size_heuristic=False,
4142
guts1=None,
4243
guts2=None):
4344

@@ -62,15 +63,13 @@ def assess_differences(image_file1,
6263
# Compare the dictionary of file:hash between two images, and get root owned lookup
6364
if guts1 is None:
6465
guts1 = get_content_hashes(image_path=image_file1,
65-
level_filter=level_filter,
66-
tag_root=True,
67-
include_sizes=True)
66+
level_filter=level_filter)
67+
# tag_root=True
68+
# include_sizes=True
6869

6970
if guts2 is None:
7071
guts2 = get_content_hashes(image_path=image_file2,
71-
level_filter=level_filter,
72-
tag_root=True,
73-
include_sizes=True)
72+
level_filter=level_filter)
7473

7574
files = list(set(list(guts1['hashes'].keys()) + list(guts2['hashes'].keys())))
7675

singularity/cli/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def pull(self,image_path,pull_folder='',
304304
elif name_by_hash is True:
305305
bot.debug("user specified naming by hash.")
306306
cmd.append("--hash")
307-
else:
307+
else: # otherwise let the Singularity client determine own name
308308
image_name = "%s" %image_path.replace("shub://","").replace("/","-")
309309

310310
elif image_path.startswith('docker://'):
@@ -315,11 +315,10 @@ def pull(self,image_path,pull_folder='',
315315
cmd = cmd + ["--name", image_name]
316316

317317
cmd.append(image_path)
318-
image_path = "%s/%s.img" %(pull_folder,image_name)
319318
bot.debug(' '.join(cmd))
320319
output = self.run_command(cmd)
321320
self.println(output)
322-
return image_path
321+
return output.split('Container is at:')[-1].strip('\n')
323322

324323

325324
def run(self,image_path,args=None,writable=False,contain=False):

singularity/tests/data/README

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Generation
2+
3+
The cirros and busybox images were produced with Singularity 2.4, which has a much smaller image footprint. The file extractions for the package are from 2016, and were remade as one had become corrupt. More evidence for squashfs
4+
5+
```
6+
sudo singularity build cirros-2017-10-21.simg docker://cirros
7+
sudo singularity build busybox-2017-10-21.simg docker://busybox
8+
9+
```
-3 MB
Binary file not shown.
680 KB
Binary file not shown.
-13 MB
Binary file not shown.
3.38 MB
Binary file not shown.

singularity/tests/test_package.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ def setUp(self):
5656
self.pwd = get_installdir()
5757
self.cli = Singularity()
5858
self.tmpdir = tempfile.mkdtemp()
59-
self.image1 = "%s/tests/data/busybox-2016-02-16.img" %(self.pwd)
60-
self.image2 = "%s/tests/data/cirros-2016-01-04.img" %(self.pwd)
61-
# We can't test creating the packages, because requires sudo :/
59+
self.image1 = "%s/tests/data/busybox-2017-10-21.simg" %(self.pwd)
60+
self.image2 = "%s/tests/data/cirros-2017-10-21.simg" %(self.pwd)
6261
self.pkg1 = "%s/tests/data/busybox-2016-02-16.img.zip" %(self.pwd)
6362
self.pkg2 = "%s/tests/data/cirros-2016-01-04.img.zip" %(self.pwd)
6463

singularity/tests/test_reproduce.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def setUp(self):
5555
self.pwd = get_installdir()
5656
self.cli = Singularity()
5757
self.tmpdir = tempfile.mkdtemp()
58-
self.image1 = "%s/tests/data/busybox-2016-02-16.img" %(self.pwd)
59-
self.image2 = "%s/tests/data/cirros-2016-01-04.img" %(self.pwd)
58+
self.image1 = "%s/tests/data/busybox-2017-10-21.simg" %(self.pwd)
59+
self.image2 = "%s/tests/data/cirros-2017-10-21.simg" %(self.pwd)
6060

6161
def tearDown(self):
6262
shutil.rmtree(self.tmpdir)

0 commit comments

Comments
 (0)