-
-
Notifications
You must be signed in to change notification settings - Fork 10
Description
While running OSS Review Toolkit (ORT) with: docker build -t ort .
[pythonbuild 4/6] RUN scancode-license-data --path /opt/scancode-license-data:
0.596 /opt/python/versions/3.11.9/lib/python3.11/site-packages/typecode/magic2.py:195: UserWarning: System libmagic found in typical location is used. Install instead a typecode-libmagic plugin for best support.
0.596 warnings.warn(
0.618 Usage: scancode-license-data [OPTIONS]
0.618
0.618 Error: Got unexpected extra argument (/opt/scancode-license-data)
ERROR: failed to build: failed to solve: process "/bin/bash -o pipefail -c scancode-license-data --path /opt/scancode-license-data" did not complete successfully: exit code: 2
I'm on mac using arm64, and I modified the dockerfile slightly, to get past some other errors like : missing libicu-dev, pkg-config and python3-distutils. I also messed around with changing the python version as well as the scancode version...
The method of dumping the licenses does not seem to work? I've tried almost everything and I am out of ideas. Please save me!
Where in code?
In ORT's source code, the Dockerfile contains information on the build, in the Dockerfile (under the Python section):
Scancode extract license ...
#------------------------------------------------------------------------
# PYTHON - Build Python as a separate component with pyenv
FROM base AS pythonbuild
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends \
libreadline-dev \
libicu-dev \
python3-distutils \
libgdbm-dev \
libsqlite3-dev \
libssl-dev \
libbz2-dev \
liblzma-dev \
tk-dev \
&& sudo rm -rf /var/lib/apt/lists/*
ARG PYTHON_VERSION
ARG PYENV_GIT_TAG
ENV PYENV_ROOT=/opt/python
ENV PATH=$PATH:$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PYENV_ROOT/conan2/bin
RUN curl -kSs https://pyenv.run | bash \
&& pyenv install -v $PYTHON_VERSION \
&& pyenv global $PYTHON_VERSION
ARG CONAN_VERSION
ARG CONAN2_VERSION
ARG PYTHON_INSPECTOR_VERSION
ARG PYTHON_PIPENV_VERSION
ARG PYTHON_POETRY_VERSION
ARG PYTHON_POETRY_PLUGIN_EXPORT_VERSION
ARG PYTHON_SETUPTOOLS_VERSION
ARG PIP_VERSION
ARG SCANCODE_VERSION
RUN ARCH=$(arch | sed s/aarch64/arm64/) \
&& if [ "$ARCH" == "arm64" ]; then \
pip install -U scancode-toolkit-mini==$SCANCODE_VERSION; \
else \
curl -Os https://raw.githubusercontent.com/nexB/scancode-toolkit/v$SCANCODE_VERSION/requirements.txt; \
pip install -U --constraint requirements.txt scancode-toolkit==$SCANCODE_VERSION setuptools==$PYTHON_SETUPTOOLS_VERSION; \
rm requirements.txt; \
fi
**# Extract ScanCode license texts to a directory.
RUN mkdir -p /opt/scancode-license-data \
&& scancode-license-data --path /opt/scancode-license-data \
&& find /opt/scancode-license-data -type f -not -name "*.LICENSE" -exec rm -f {} + \
&& rm -rf /opt/scancode-license-data/static**
RUN pip install --no-cache-dir -U \
pip=="$PIP_VERSION" \
wheel \
&& pip install --no-cache-dir -U \
Mercurial \
conan=="$CONAN_VERSION" \
pipenv=="$PYTHON_PIPENV_VERSION" \
poetry=="$PYTHON_POETRY_VERSION" \
poetry-plugin-export=="$PYTHON_POETRY_PLUGIN_EXPORT_VERSION" \
python-inspector=="$PYTHON_INSPECTOR_VERSION" \
setuptools=="$PYTHON_SETUPTOOLS_VERSION"
RUN mkdir /tmp/conan2 && cd /tmp/conan2 \
&& wget https://github.com/conan-io/conan/releases/download/$CONAN2_VERSION/conan-$CONAN2_VERSION-linux-x86_64.tgz \
&& tar -xvf conan-$CONAN2_VERSION-linux-x86_64.tgz\
# Rename the Conan 2 executable to "conan2" to be able to call both Conan version from the package manager.
&& mkdir $PYENV_ROOT/conan2 && mv /tmp/conan2/bin $PYENV_ROOT/conan2/ \
&& mv $PYENV_ROOT/conan2/bin/conan $PYENV_ROOT/conan2/bin/conan2
FROM scratch AS python
COPY --from=pythonbuild /opt/python /opt/python
FROM scratch AS scancode-license-data
COPY --from=pythonbuild /opt/scancode-license-data /opt/scancode-license-data
#------------------------------------------------------------------------