Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scancode): No ScanCode license texts in disclosure document #9622

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ RUN ARCH=$(arch | sed s/aarch64/arm64/) \
rm requirements.txt; \
fi

# Extract ScanCode license texts to a directory.
RUN 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=="$PIPTOOL_VERSION" \
wheel \
Expand All @@ -171,6 +176,9 @@ RUN pip install --no-cache-dir -U \
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

#------------------------------------------------------------------------
# NODEJS - Build NodeJS as a separate component with nvm
FROM base AS nodejsbuild
Expand Down Expand Up @@ -493,6 +501,8 @@ ENV GEM_HOME=/var/tmp/gem
ENV PATH=$PATH:$RBENV_ROOT/bin:$RBENV_ROOT/shims:$RBENV_ROOT/plugins/ruby-install/bin
COPY --from=ruby --chown=$USER:$USER $RBENV_ROOT $RBENV_ROOT

COPY --from=scancode-license-data --chown=$USER:$USER /opt/scancode-license-data /opt/scancode-license-data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the previous removal of unneeded files? Can we maybe elegantly replace that with only copying /opt/scancode-license-data/*.LICENSE here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed your comment as you already resolved / collapsed the conversation. So, still, what do you think about just copying needed files here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copying the needed stuff is more complicated than expected, so I went back deleting the files we don't need.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copying the needed stuff is more complicated than expected

Oh, interesting, mind sharing the details? Why does

COPY --from=scancode-license-data --chown=$USER:$USER /opt/scancode-license-data/*.LICENSE /opt/scancode-license-data

not work?

I went back deleting the files we don't need.

Unfortunately, that now seems to miss deleting the static directory, or?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping @wkl3nk just in case you overlooked this comment.


#------------------------------------------------------------------------
# Container with all supported package managers.
FROM minimal-tools as all-tools
Expand Down
3 changes: 2 additions & 1 deletion utils/spdx/src/main/kotlin/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ val scanCodeLicenseTextDir by lazy {
val pythonBinDir = listOf("bin", "Scripts")
val scanCodeBaseDir = scanCodeExeDir?.takeUnless { it.name in pythonBinDir } ?: scanCodeExeDir?.parentFile

scanCodeBaseDir?.walkTopDown()?.find { it.isDirectory && it.endsWith("licensedcode/data/licenses") }
scanCodeBaseDir?.walkTopDown()?.find { it.isDirectory && it.endsWith("licensedcode/data/licenses") } ?:
File("/opt/scancode-license-data").takeIf { it.isDirectory }
}

/**
Expand Down
Loading