Skip to content

Commit

Permalink
Merge pull request #36 from nexB/image-layers
Browse files Browse the repository at this point in the history
Report docker image layers as relative paths
  • Loading branch information
pombredanne committed Oct 26, 2021
2 parents 3c79905 + 9317714 commit b88cdf7
Show file tree
Hide file tree
Showing 55 changed files with 6,027 additions and 175 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -12,6 +12,7 @@
/Lib
/pip-selfcheck.json
/tmp
/venv
.Python
/include
/Include
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -19,4 +19,4 @@ python:
install: ./configure --dev

# Scripts to run at script stage
script: tmp/bin/pytest -vvs -n2
script: venv/bin/pytest -vvs -n2
13 changes: 13 additions & 0 deletions CHANGELOG.rst
@@ -1,6 +1,19 @@
Changelog
=========


v30.0.0
--------

This is a minor release with bug fixes and minor updates.

- Switched back to semver from calver like other AboutCode projects.
- Adopted the latest skeleton. With this the virtualenv is created under venv.
- Add new "layer_path_segments" argument to image.Image.to_dict() to allow
to report the Layer extracted locations as trimmed paths keeping only this
many trailing path segments.


v21.6.10
--------

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -25,8 +25,8 @@ Quick start

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


Container image formats
Expand Down
16 changes: 4 additions & 12 deletions azure-pipelines.yml
Expand Up @@ -7,42 +7,34 @@

jobs:

- template: etc/ci/azure-posix.yml
parameters:
job_name: ubuntu16_cpython
image_name: ubuntu-16.04
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: ubuntu18_cpython
image_name: ubuntu-18.04
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -n 2 -vvs
all: venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: ubuntu20_cpython
image_name: ubuntu-20.04
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -n 2 -vvs
all: venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: macos1014_cpython
image_name: macos-10.14
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -n 2 -vvs
all: venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: macos1015_cpython
image_name: macos-10.15
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -n 2 -vvs
all: venv/bin/pytest -n 2 -vvs
48 changes: 34 additions & 14 deletions configure
Expand Up @@ -11,7 +11,7 @@ set -e
#set -x

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

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

# where we create a virtualenv
VIRTUALENV_DIR=tmp
VIRTUALENV_DIR=venv

# Cleanable files and directories with the --clean option
CLEANABLE="
build
tmp"
venv"

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

# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
if [ -f "$CFG_ROOT_DIR/thirdparty" ]; then
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty "
fi
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi"


################################
# Set the quiet flag to empty if not defined
# Set the quiet flag to empty if not defined
if [[ "$CFG_QUIET" == "" ]]; then
CFG_QUIET=" "
fi
Expand All @@ -63,7 +69,7 @@ fi
# Use environment variables or a file if available.
# Otherwise the latest Python by default.
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
# check for a file named PYTHON_EXECUTABLE
# check for a file named PYTHON_EXECUTABLE
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
else
Expand All @@ -78,10 +84,14 @@ cli_help() {
echo " usage: ./configure [options]"
echo
echo The default is to configure for regular use. Use --dev for development.
echo Use the --init option if starting a new project and the project
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
echo and requirements.txt and/or requirements-dev.txt has not been generated.
echo
echo The options are:
echo " --clean: clean built and installed files and exit."
echo " --dev: configure the environment for development."
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
echo " --help: display this help message and exit."
echo
echo By default, the python interpreter version found in the path is used.
Expand Down Expand Up @@ -120,7 +130,7 @@ create_virtualenv() {
VIRTUALENV_PYZ="$CFG_ROOT_DIR/etc/thirdparty/virtualenv.pyz"
else
VIRTUALENV_PYZ="$CFG_ROOT_DIR/$VENV_DIR/virtualenv.pyz"
wget -O "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL"
wget -O "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL" 2>/dev/null || curl -o "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL"
fi

$PYTHON_EXECUTABLE "$VIRTUALENV_PYZ" \
Expand Down Expand Up @@ -155,12 +165,22 @@ install_packages() {
# Main command line entry point
CFG_DEV_MODE=0
CFG_REQUIREMENTS=$REQUIREMENTS

case "$CLI_ARGS" in
--help) cli_help;;
--clean) clean;;
--dev) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
esac
NO_INDEX="--no-index"

# We are using getopts to parse option arguments that start with "-"
while getopts :-: optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
help ) cli_help;;
clean ) clean;;
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
init ) NO_INDEX="";;
esac;;
esac
done

PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS $NO_INDEX"

create_virtualenv "$VIRTUALENV_DIR"
install_packages "$CFG_REQUIREMENTS"
Expand Down

0 comments on commit b88cdf7

Please sign in to comment.