Skip to content

Commit b88cdf7

Browse files
authored
Merge pull request #36 from nexB/image-layers
Report docker image layers as relative paths
2 parents 3c79905 + 9317714 commit b88cdf7

Some content is hidden

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

55 files changed

+6027
-175
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/Lib
1313
/pip-selfcheck.json
1414
/tmp
15+
/venv
1516
.Python
1617
/include
1718
/Include

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ python:
1919
install: ./configure --dev
2020

2121
# Scripts to run at script stage
22-
script: tmp/bin/pytest -vvs -n2
22+
script: venv/bin/pytest -vvs -n2

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
Changelog
22
=========
33

4+
5+
v30.0.0
6+
--------
7+
8+
This is a minor release with bug fixes and minor updates.
9+
10+
- Switched back to semver from calver like other AboutCode projects.
11+
- Adopted the latest skeleton. With this the virtualenv is created under venv.
12+
- Add new "layer_path_segments" argument to image.Image.to_dict() to allow
13+
to report the Layer extracted locations as trimmed paths keeping only this
14+
many trailing path segments.
15+
16+
417
v21.6.10
518
--------
619

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Quick start
2525

2626
- Only runs on POSIX OSes
2727
- Get Python 3.6+
28-
- Check out a clone or download of container-inspector, then run: `./configure`.
29-
- Then run `tmp/bin/container-inspector -h` for help.
28+
- Check out a clone or download of container-inspector, then run: `./configure --dev`.
29+
- Then run `env/bin/container-inspector -h` for help.
3030

3131

3232
Container image formats

azure-pipelines.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,34 @@
77

88
jobs:
99

10-
- template: etc/ci/azure-posix.yml
11-
parameters:
12-
job_name: ubuntu16_cpython
13-
image_name: ubuntu-16.04
14-
python_versions: ['3.6', '3.7', '3.8', '3.9']
15-
test_suites:
16-
all: tmp/bin/pytest -vvs
17-
1810
- template: etc/ci/azure-posix.yml
1911
parameters:
2012
job_name: ubuntu18_cpython
2113
image_name: ubuntu-18.04
2214
python_versions: ['3.6', '3.7', '3.8', '3.9']
2315
test_suites:
24-
all: tmp/bin/pytest -n 2 -vvs
16+
all: venv/bin/pytest -n 2 -vvs
2517

2618
- template: etc/ci/azure-posix.yml
2719
parameters:
2820
job_name: ubuntu20_cpython
2921
image_name: ubuntu-20.04
3022
python_versions: ['3.6', '3.7', '3.8', '3.9']
3123
test_suites:
32-
all: tmp/bin/pytest -n 2 -vvs
24+
all: venv/bin/pytest -n 2 -vvs
3325

3426
- template: etc/ci/azure-posix.yml
3527
parameters:
3628
job_name: macos1014_cpython
3729
image_name: macos-10.14
3830
python_versions: ['3.6', '3.7', '3.8', '3.9']
3931
test_suites:
40-
all: tmp/bin/pytest -n 2 -vvs
32+
all: venv/bin/pytest -n 2 -vvs
4133

4234
- template: etc/ci/azure-posix.yml
4335
parameters:
4436
job_name: macos1015_cpython
4537
image_name: macos-10.15
4638
python_versions: ['3.6', '3.7', '3.8', '3.9']
4739
test_suites:
48-
all: tmp/bin/pytest -n 2 -vvs
40+
all: venv/bin/pytest -n 2 -vvs

configure

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -e
1111
#set -x
1212

1313
################################
14-
# A configuration script to set things up:
14+
# A configuration script to set things up:
1515
# create a virtualenv and install or update thirdparty packages.
1616
# Source this script for initial configuration
1717
# Use configure --help for details
@@ -26,16 +26,16 @@ CLI_ARGS=$1
2626
################################
2727

2828
# Requirement arguments passed to pip and used by default or with --dev.
29-
REQUIREMENTS="--editable ."
30-
DEV_REQUIREMENTS="--editable .[testing]"
29+
REQUIREMENTS="--editable . --constraint requirements.txt"
30+
DEV_REQUIREMENTS="--editable .[testing] --constraint requirements.txt --constraint requirements-dev.txt"
3131

3232
# where we create a virtualenv
33-
VIRTUALENV_DIR=tmp
33+
VIRTUALENV_DIR=venv
3434

3535
# Cleanable files and directories with the --clean option
3636
CLEANABLE="
3737
build
38-
tmp"
38+
venv"
3939

4040
# extra arguments passed to pip
4141
PIP_EXTRA_ARGS=" "
@@ -50,9 +50,15 @@ VIRTUALENV_PYZ_URL=https://bootstrap.pypa.io/virtualenv.pyz
5050
CFG_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5151
CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin
5252

53+
# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
54+
if [ -f "$CFG_ROOT_DIR/thirdparty" ]; then
55+
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty "
56+
fi
57+
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi"
58+
5359

5460
################################
55-
# Set the quiet flag to empty if not defined
61+
# Set the quiet flag to empty if not defined
5662
if [[ "$CFG_QUIET" == "" ]]; then
5763
CFG_QUIET=" "
5864
fi
@@ -63,7 +69,7 @@ fi
6369
# Use environment variables or a file if available.
6470
# Otherwise the latest Python by default.
6571
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
66-
# check for a file named PYTHON_EXECUTABLE
72+
# check for a file named PYTHON_EXECUTABLE
6773
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
6874
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
6975
else
@@ -78,10 +84,14 @@ cli_help() {
7884
echo " usage: ./configure [options]"
7985
echo
8086
echo The default is to configure for regular use. Use --dev for development.
87+
echo Use the --init option if starting a new project and the project
88+
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
89+
echo and requirements.txt and/or requirements-dev.txt has not been generated.
8190
echo
8291
echo The options are:
8392
echo " --clean: clean built and installed files and exit."
8493
echo " --dev: configure the environment for development."
94+
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
8595
echo " --help: display this help message and exit."
8696
echo
8797
echo By default, the python interpreter version found in the path is used.
@@ -120,7 +130,7 @@ create_virtualenv() {
120130
VIRTUALENV_PYZ="$CFG_ROOT_DIR/etc/thirdparty/virtualenv.pyz"
121131
else
122132
VIRTUALENV_PYZ="$CFG_ROOT_DIR/$VENV_DIR/virtualenv.pyz"
123-
wget -O "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL"
133+
wget -O "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL" 2>/dev/null || curl -o "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL"
124134
fi
125135

126136
$PYTHON_EXECUTABLE "$VIRTUALENV_PYZ" \
@@ -155,12 +165,22 @@ install_packages() {
155165
# Main command line entry point
156166
CFG_DEV_MODE=0
157167
CFG_REQUIREMENTS=$REQUIREMENTS
158-
159-
case "$CLI_ARGS" in
160-
--help) cli_help;;
161-
--clean) clean;;
162-
--dev) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
163-
esac
168+
NO_INDEX="--no-index"
169+
170+
# We are using getopts to parse option arguments that start with "-"
171+
while getopts :-: optchar; do
172+
case "${optchar}" in
173+
-)
174+
case "${OPTARG}" in
175+
help ) cli_help;;
176+
clean ) clean;;
177+
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
178+
init ) NO_INDEX="";;
179+
esac;;
180+
esac
181+
done
182+
183+
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS $NO_INDEX"
164184

165185
create_virtualenv "$VIRTUALENV_DIR"
166186
install_packages "$CFG_REQUIREMENTS"

0 commit comments

Comments
 (0)