Skip to content

Commit 935fe52

Browse files
authored
Merge pull request #98 from vsoch/add/google-build
Update reproducibility metrics for 3.* containers
2 parents 498c343 + 1eaf613 commit 935fe52

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+481
-385
lines changed

.travis.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
language: python
2-
31
sudo: true
2+
go:
3+
- "1.11"
44

55
os: linux
66

7-
language: python
7+
language: go
8+
9+
addons:
10+
apt:
11+
packages:
12+
- flawfinder
13+
- squashfs-tools
14+
- uuid-dev
15+
- libuuid1
16+
- libffi-dev
17+
- libssl-dev
18+
- libssl1.0.0
19+
- libarchive-dev
20+
- libgpgme11-dev
21+
- libseccomp-dev
22+
homebrew:
23+
packages:
24+
- squashfs
25+
update: true
26+
827

928
matrix:
1029
include:
@@ -13,6 +32,9 @@ matrix:
1332
- os: linux
1433
env: PYTHON_VERSION=3
1534

35+
install:
36+
- # override
37+
1638
before_install:
1739
- sudo chmod u+x .travis/*
1840
- .travis/before_install

.travis/before_install

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ sudo sed -i -e 's/^Defaults\tsecure_path.*$//' /etc/sudoers
1515
if [ "${PYTHON_VERSION}" == "2" ];
1616
then
1717
wget https://repo.continuum.io/archive/Anaconda2-5.0.0.1-Linux-x86_64.sh
18-
sudo bash Anaconda2-5.0.0.1-Linux-x86_64.sh -b -p /opt/anaconda2 && sudo chown -R 0755 /opt/anaconda2
19-
PATH=/opt/anaconda3/bin:$PATH
18+
sudo bash Anaconda2-5.0.0.1-Linux-x86_64.sh -b -p /opt/conda && sudo chown -R 0755 /opt/conda
19+
PATH=/opt/conda/bin:$PATH
2020
rm Anaconda2-5.0.0.1-Linux-x86_64.sh
2121
export PATH
2222
else
2323
wget https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh
24-
sudo bash Anaconda3-5.0.0.1-Linux-x86_64.sh -b -p /opt/anaconda3 && sudo chown -R 0755 /opt/anaconda3
25-
PATH=/opt/anaconda3/bin:$PATH
24+
sudo bash Anaconda3-5.0.0.1-Linux-x86_64.sh -b -p /opt/conda && sudo chown -R 0755 /opt/conda
25+
PATH=/opt/conda/bin:$PATH
2626
rm Anaconda3-5.0.0.1-Linux-x86_64.sh
2727
export PATH
2828
fi
@@ -32,7 +32,19 @@ which python
3232

3333
conda install -y pandas scikit-learn pygments
3434
cd $TRAVIS_BUILD_DIR && sudo python -m pip install -r requirements.txt
35-
python python setup.py install
35+
/opt/conda/bin/pip uninstall singularity --yes || echo "Not installed"
36+
/opt/conda/bin/python setup.py install
3637

37-
# Install Singularity (development)
38-
cd /tmp && git clone https://github.com/singularityware/singularity.git && cd singularity && ./autogen.sh && ./configure --prefix=/usr/local && make && sudo make install
38+
# Install Singularity
39+
40+
SINGULARITY_BASE="${GOPATH}/src/github.com/sylabs/singularity"
41+
export PATH="${GOPATH}/bin:${PATH}"
42+
43+
mkdir -p "${GOPATH}/src/github.com/sylabs"
44+
cd "${GOPATH}/src/github.com/sylabs"
45+
46+
git clone -b release-3.2 https://github.com/sylabs/singularity
47+
cd singularity
48+
./mconfig -v -p /usr/local
49+
make -j `nproc 2>/dev/null || echo 1` -C ./builddir all
50+
sudo make -C ./builddir install

.travis/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
python -m unittest discover -s $TRAVIS_BUILD_DIR/singularity/tests/ -p '[t|T]est*.py'
2+
/opt/conda/bin/python -m unittest discover -s $TRAVIS_BUILD_DIR/singularity/tests/ -p '[t|T]est*.py'

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and changes prior to that are (unfortunately) done retrospectively. Critical ite
1515

1616

1717
## [master](https://github.com/singularityware/singularity-python/tree/master)
18+
- updating Singularity python for version 3 singularity (3.0.0)
1819
- removed all client functionality in favor of using spython (2.5)
1920
- build on Google will not extract file counts, etc.
2021

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
[![Build Status](https://travis-ci.org/singularityware/singularity-python.svg?branch=master)](https://travis-ci.org/singularityware/singularity-python)
44

5-
Singularity Python is a python module and command line tool to provide helpers for working with <a href="https://singularityware.github.io" target="_blank">Singularity</a> containers, specifically providing functions to visualize, package, and compare containers.
5+
Singularity Python is a python module and command line tool to provide helpers for working with <a href="https://www.sylabs.io/guides/3.0/user-guide/" target="_blank">Singularity</a> containers, specifically providing functions to visualize, package, and compare containers.
66

77
- If you are looking for the Singularity Python client to pull, build, and otherwise wrap Singularity functions, then please see the repository [singularity-cli](https://singularityhub.github.io/singularity-cli) for the [spython](https://pypi.org/project/spython/) module.
88
- If you are looking for local management and interaction with various storage locations (e.g., to pull and inspect containers in Singularity Hub, Registry, or other cloud resource) then please see the [Global Client](https://singularityhub.github.io/sregistry-cli) for the `sregistry` module.
9+
- If you are looking for the Google Cloud (original) build functions, see the [v2.5](https://github.com/singularityhub/singularity-python/tree/v2.5) branch.
910

1011
## Install
1112
You have the option to install only the dependencies that are needed for your functionality of interest.

examples/classify/classify_image/count_files.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
extension_counts
88
)
99

10-
container = "ubuntu.simg"
10+
# singularity pull docker://busybox
11+
container = "busybox_latest.sif"
1112

1213
# Now we might be interested in counting different things
13-
readme_count = file_counts(container)
14-
copyright_count = file_counts(container, patterns=['copyright'])
15-
authors_count = file_counts(container, patterns=['authors','thanks','credit'])
16-
todo_count = file_counts(container, patterns=['todo'])
14+
bin_count = file_counts(container, patterns=['bin'])
1715

1816
# Or getting a complete dict of extensions
1917
extensions = extension_counts(container)

examples/classify/classify_image/derive_tags.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# Default tags will be returned as software in "bin"
1616
tags = get_tags(container)
1717

18-
# We can also get the raw list of flies
19-
file_list = get_container_contents(container)['all']
20-
2118
# We can specify other folders of interest
2219
folders = ['init','init.d','bin','systemd']
2320
tags = get_tags(container, search_folders=folders)
21+
22+
# We can also get the raw list of flies
23+
file_list = get_container_contents(container)['all']
Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,23 @@
11
from glob import glob
22

3-
from singularity.analysis.reproduce import assess_differences
3+
from singularity.analysis.reproduce import assess_differences, get_level
44

5-
image_files=glob('*.img')
5+
# singularity pull docker://ubuntu:14.04
6+
# singularity pull docker://ubuntu:12.04
67

7-
# ASSESS DIFFERENCES #######################################
8-
# returns dictionary with
9-
10-
report = assess_differences(image_files[0],image_files[1])
8+
image_files = glob('ubuntu*.sif')
119

12-
report.keys()
13-
# dict_keys(['different', 'missing', 'same'])
1410

15-
# These files are equivalent between the images
16-
print(len(report['same']))
17-
5663
11+
# Choose a level that you want to assess based on
12+
level_filter = {"RECIPE": get_level('RECIPE')}
1813

19-
# These files are present in both, but different
20-
print(report['different'])
21-
['./etc/hosts',
22-
'./.exec',
23-
'./environment',
24-
'./etc/mtab',
25-
'./etc/resolv.conf',
26-
'./.run',
27-
'./.shell',
28-
'./singularity']
14+
# ASSESS DIFFERENCES #######################################
2915

30-
# These files are found in the first image, but not the second
31-
print(report['missing'])
32-
['./var/lib/apt/lists/.wh.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_i18n_Translation-en',
33-
'./bin/gunzip']
16+
# Running for all levels, this will take a few minutes
17+
report = assess_differences(image_files[0], image_files[1], levels=level_filter)
3418

19+
# {'RECIPE': {'difference': [],
20+
# 'intersect_different': [],
21+
# 'same': 7,
22+
# 'union': 14},
23+
# 'scores': {'RECIPE': 1.0}}

examples/reproducibility/generate_image_hash.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
get_image_file_hash
88
)
99

10-
image_files = glob("*.simg")
10+
image_files = glob("*.sif")
1111
image_path = image_files[0]
1212

1313
########################################################
@@ -30,7 +30,7 @@
3030
# We can, then generate an image hash, and by default the level "REPLICATION" will be used:
3131

3232
get_image_hash(image_path)
33-
#'bf8e242931e25ae9496015868ab2e8cc8d156ffd'
33+
# '4c252c8fb818e4b854a478a1a0df5991'
3434

3535
# But we can also specify a level that we want:
3636
get_image_hash(image_path,level="IDENTICAL")
@@ -45,10 +45,10 @@
4545
# of one container at one level!
4646
digest = get_content_hashes(image_path)
4747
digest['hashes']['/usr/bin/chfn']
48-
# 'ee2b438c278011bdac1a3a927e2d37519a8ed9c7'
48+
# '4b5ee4db88c3b8bfb0cb7cb3a90a7793'
4949

5050
# We can also get a hash of the entire image file, this is done on the
5151
# binary file and not contents inside.
5252

5353
file_hash = get_image_file_hash(image_path)
54-
# e'13775a83962ae60744d691eb7f7fd1e96599e656'
54+
# 'd5349c37fdc2e6f2dca8793732e1c420'

examples/shub/paper/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
21
# Singularity Hub Paper
32

43
This is the code for the Singularity Hub paper. You should be able to view the comparison tree at [result/index.html](result/index.html).
4+
Note that the version of Singularity Python used for this is older than currently on master,
5+
you will need to install:
6+
7+
```bash
8+
git clone -b v2.5 https://www.github.com/singularityhub/singularity-python.git
9+
cd singularity-python
10+
python setup.py install
11+
```
12+
13+
And the images used were also Singularity version 2.2 and 2.3.

0 commit comments

Comments
 (0)