mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
commit
1ee2244a29
6
Makefile
6
Makefile
@ -41,9 +41,9 @@ endif
|
||||
|
||||
test-with-kind:
|
||||
@build/docker/build-image.sh intel/intel-fpga-admissionwebhook buildah
|
||||
@$(PODMAN) tag localhost/intel/intel-fpga-admissionwebhook:0.18.0 docker.io/intel/intel-fpga-admissionwebhook:0.18.0
|
||||
@$(PODMAN) tag localhost/intel/intel-fpga-admissionwebhook:0.18.1 docker.io/intel/intel-fpga-admissionwebhook:0.18.1
|
||||
@mkdir -p $(e2e_tmp_dir)
|
||||
@$(PODMAN) save "docker.io/intel/intel-fpga-admissionwebhook:0.18.0" -o $(e2e_tmp_dir)/$(WEBHOOK_IMAGE_FILE)
|
||||
@$(PODMAN) save "docker.io/intel/intel-fpga-admissionwebhook:0.18.1" -o $(e2e_tmp_dir)/$(WEBHOOK_IMAGE_FILE)
|
||||
@$(KIND) create cluster --name "intel-device-plugins" --kubeconfig $(e2e_tmp_dir)/kubeconfig --image "kindest/node:v1.17.0"
|
||||
@$(KIND) load image-archive --name "intel-device-plugins" $(e2e_tmp_dir)/$(WEBHOOK_IMAGE_FILE)
|
||||
@$(GO) test -v ./test/e2e -args -kubeconfig $(e2e_tmp_dir)/kubeconfig -kubectl-path $(KUBECTL) -ginkgo.focus "Webhook" || rc=1; \
|
||||
@ -88,7 +88,7 @@ clean:
|
||||
|
||||
ORG?=intel
|
||||
REG?=$(ORG)/
|
||||
TAG?=0.18.0
|
||||
TAG?=0.18.1
|
||||
export TAG
|
||||
|
||||
pre-pull:
|
||||
|
@ -225,6 +225,15 @@ matching Kubernetes versions are listed below:
|
||||
[Go environment]: https://golang.org/doc/install
|
||||
[Kubernetes cluster]: https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/
|
||||
|
||||
## License
|
||||
|
||||
All of the source code required to build intel-device-plugins-for-kubernetes
|
||||
is available under Open Source licenses. The source code files identify external Go
|
||||
modules used. Binaries are distributed as container images on
|
||||
DockerHub. Those images contain license texts under
|
||||
`/usr/local/share/package-licenses` and source code under
|
||||
`/usr/local/share/package-sources`.
|
||||
|
||||
## Related code
|
||||
|
||||
A related Intel SRIOV network device plugin can be found in [this repository](https://github.com/intel/sriov-network-device-plugin)
|
||||
|
@ -6,11 +6,11 @@
|
||||
#
|
||||
# This is used on release branches before tagging a stable version.
|
||||
# The master branch defaults to using the latest Clear Linux.
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:9f04d3cc0ca3f6951ab3646639b43eb73e963a7cee7322d619a02c7eeecce711
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:7f790763c87853f6e553f7317101d6e5eb337b7d0454c081d40890b5f062de4a
|
||||
|
||||
FROM ${CLEAR_LINUX_BASE} as builder
|
||||
|
||||
ARG CLEAR_LINUX_VERSION="--version=33450"
|
||||
ARG CLEAR_LINUX_VERSION="--version=33720"
|
||||
|
||||
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION}
|
||||
|
||||
@ -31,7 +31,7 @@ RUN cd cmd/operator; GO111MODULE=${GO111MODULE} go install; cd -
|
||||
RUN chmod a+x /go/bin/operator \
|
||||
&& install -D /go/bin/operator /install_root/usr/local/bin/intel_deviceplugin_operator \
|
||||
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/operator /install_root/usr/local/share/package-licenses/
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/operator /install_root/usr/local/share/
|
||||
|
||||
FROM scratch as final
|
||||
COPY --from=builder /install_root /
|
||||
|
@ -6,11 +6,11 @@
|
||||
#
|
||||
# This is used on release branches before tagging a stable version.
|
||||
# The master branch defaults to using the latest Clear Linux.
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:9f04d3cc0ca3f6951ab3646639b43eb73e963a7cee7322d619a02c7eeecce711
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:7f790763c87853f6e553f7317101d6e5eb337b7d0454c081d40890b5f062de4a
|
||||
|
||||
FROM ${CLEAR_LINUX_BASE} as builder
|
||||
|
||||
ARG CLEAR_LINUX_VERSION="--version=33450"
|
||||
ARG CLEAR_LINUX_VERSION="--version=33720"
|
||||
|
||||
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION}
|
||||
|
||||
@ -31,7 +31,7 @@ RUN cd cmd/fpga_admissionwebhook; GO111MODULE=${GO111MODULE} go install; cd -
|
||||
RUN chmod a+x /go/bin/fpga_admissionwebhook \
|
||||
&& install -D /go/bin/fpga_admissionwebhook /install_root/usr/local/bin/intel_fpga_admissionwebhook \
|
||||
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/fpga_admissionwebhook /install_root/usr/local/share/package-licenses/
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/fpga_admissionwebhook /install_root/usr/local/share/
|
||||
|
||||
FROM scratch as final
|
||||
COPY --from=builder /install_root /
|
||||
|
@ -6,11 +6,11 @@
|
||||
#
|
||||
# This is used on release branches before tagging a stable version.
|
||||
# The master branch defaults to using the latest Clear Linux.
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:9f04d3cc0ca3f6951ab3646639b43eb73e963a7cee7322d619a02c7eeecce711
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:7f790763c87853f6e553f7317101d6e5eb337b7d0454c081d40890b5f062de4a
|
||||
|
||||
FROM ${CLEAR_LINUX_BASE} as builder
|
||||
|
||||
ARG CLEAR_LINUX_VERSION="--version=33450"
|
||||
ARG CLEAR_LINUX_VERSION="--version=33720"
|
||||
|
||||
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION}
|
||||
|
||||
@ -37,8 +37,8 @@ RUN cd $DIR/cmd/fpga_crihook && \
|
||||
chmod a+x /go/bin/fpga_tool && \
|
||||
cd $DIR && \
|
||||
install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE && \
|
||||
scripts/copy-modules-licenses.sh ./cmd/fpga_crihook /install_root/usr/local/share/package-licenses/ && \
|
||||
scripts/copy-modules-licenses.sh ./cmd/fpga_tool /install_root/usr/local/share/package-licenses/
|
||||
scripts/copy-modules-licenses.sh ./cmd/fpga_crihook /install_root/usr/local/share/ && \
|
||||
scripts/copy-modules-licenses.sh ./cmd/fpga_tool /install_root/usr/local/share/
|
||||
|
||||
# Minimal result image
|
||||
FROM scratch as final
|
||||
|
@ -6,11 +6,11 @@
|
||||
#
|
||||
# This is used on release branches before tagging a stable version.
|
||||
# The master branch defaults to using the latest Clear Linux.
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:9f04d3cc0ca3f6951ab3646639b43eb73e963a7cee7322d619a02c7eeecce711
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:7f790763c87853f6e553f7317101d6e5eb337b7d0454c081d40890b5f062de4a
|
||||
|
||||
FROM ${CLEAR_LINUX_BASE} as builder
|
||||
|
||||
ARG CLEAR_LINUX_VERSION="--version=33450"
|
||||
ARG CLEAR_LINUX_VERSION="--version=33720"
|
||||
|
||||
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION}
|
||||
|
||||
@ -31,7 +31,7 @@ RUN cd cmd/fpga_plugin; GO111MODULE=${GO111MODULE} go install; cd -
|
||||
RUN chmod a+x /go/bin/fpga_plugin \
|
||||
&& install -D /go/bin/fpga_plugin /install_root/usr/local/bin/intel_fpga_device_plugin \
|
||||
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/fpga_plugin /install_root/usr/local/share/package-licenses/
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/fpga_plugin /install_root/usr/local/share/
|
||||
|
||||
FROM scratch as final
|
||||
COPY --from=builder /install_root /
|
||||
|
@ -6,11 +6,11 @@
|
||||
#
|
||||
# This is used on release branches before tagging a stable version.
|
||||
# The master branch defaults to using the latest Clear Linux.
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:9f04d3cc0ca3f6951ab3646639b43eb73e963a7cee7322d619a02c7eeecce711
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:7f790763c87853f6e553f7317101d6e5eb337b7d0454c081d40890b5f062de4a
|
||||
|
||||
FROM ${CLEAR_LINUX_BASE} as builder
|
||||
|
||||
ARG CLEAR_LINUX_VERSION="--version=33450"
|
||||
ARG CLEAR_LINUX_VERSION="--version=33720"
|
||||
|
||||
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION}
|
||||
|
||||
@ -31,7 +31,7 @@ RUN cd cmd/gpu_plugin; GO111MODULE=${GO111MODULE} go install; cd -
|
||||
RUN chmod a+x /go/bin/gpu_plugin \
|
||||
&& install -D /go/bin/gpu_plugin /install_root/usr/local/bin/intel_gpu_device_plugin \
|
||||
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/gpu_plugin /install_root/usr/local/share/package-licenses/
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/gpu_plugin /install_root/usr/local/share/
|
||||
|
||||
FROM scratch as final
|
||||
COPY --from=builder /install_root /
|
||||
|
@ -6,11 +6,11 @@
|
||||
#
|
||||
# This is used on release branches before tagging a stable version.
|
||||
# The master branch defaults to using the latest Clear Linux.
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:9f04d3cc0ca3f6951ab3646639b43eb73e963a7cee7322d619a02c7eeecce711
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:7f790763c87853f6e553f7317101d6e5eb337b7d0454c081d40890b5f062de4a
|
||||
|
||||
FROM ${CLEAR_LINUX_BASE} as builder
|
||||
|
||||
ARG CLEAR_LINUX_VERSION="--version=33450"
|
||||
ARG CLEAR_LINUX_VERSION="--version=33720"
|
||||
|
||||
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION}
|
||||
|
||||
@ -45,7 +45,7 @@ RUN cd cmd/qat_plugin; echo "build tags: ${TAGS_KERNELDRV}"; GO111MODULE=${GO111
|
||||
RUN chmod a+x /go/bin/qat_plugin \
|
||||
&& install -D /go/bin/qat_plugin /install_root/usr/local/bin/intel_qat_device_plugin \
|
||||
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/qat_plugin /install_root/usr/local/share/package-licenses/
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/qat_plugin /install_root/usr/local/share/
|
||||
|
||||
FROM scratch as final
|
||||
COPY --from=builder /install_root /
|
||||
|
@ -6,9 +6,9 @@
|
||||
#
|
||||
# This is used on release branches before tagging a stable version.
|
||||
# The master branch defaults to using the latest Clear Linux.
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:9f04d3cc0ca3f6951ab3646639b43eb73e963a7cee7322d619a02c7eeecce711
|
||||
ARG CLEAR_LINUX_BASE=clearlinux/golang@sha256:7f790763c87853f6e553f7317101d6e5eb337b7d0454c081d40890b5f062de4a
|
||||
FROM ${CLEAR_LINUX_BASE} as builder
|
||||
ARG CLEAR_LINUX_VERSION="--version=33450"
|
||||
ARG CLEAR_LINUX_VERSION="--version=33720"
|
||||
|
||||
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION}
|
||||
RUN swupd bundle-add devpkg-libusb
|
||||
@ -22,13 +22,14 @@ RUN mkdir /install_root \
|
||||
&& rm -rf /install_root/var/lib/swupd/*
|
||||
|
||||
ARG DIR=/intel-device-plugins-for-kubernetes
|
||||
ARG GO111MODULE=on
|
||||
WORKDIR $DIR
|
||||
COPY . .
|
||||
RUN cd cmd/vpu_plugin; go install
|
||||
RUN cd cmd/vpu_plugin; GO111MODULE=${GO111MODULE} go install; cd -
|
||||
RUN chmod a+x /go/bin/vpu_plugin \
|
||||
&& install -D /go/bin/vpu_plugin /install_root/usr/local/bin/intel_vpu_device_plugin \
|
||||
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/vpu_plugin /install_root/usr/local/share/package-licenses/ \
|
||||
&& scripts/copy-modules-licenses.sh ./cmd/vpu_plugin /install_root/usr/local/share/ \
|
||||
&& install -D /usr/share/package-licenses/libusb/* -t /install_root/usr/local/share/package-licenses/libusb \
|
||||
&& install -D /lib64/libusb-1.0.so.0 /install_root/lib64
|
||||
|
||||
|
@ -6,11 +6,11 @@
|
||||
#
|
||||
# This is used on release branches before tagging a stable version.
|
||||
# The master branch defaults to using the latest Clear Linux.
|
||||
ARG CLEAR_LINUX_BASE=clearlinux@sha256:fc47d67eaa0f22c0a6c96250b485ae59e65b1b863ec91941935907c9e7210ae1
|
||||
ARG CLEAR_LINUX_BASE=clearlinux@sha256:15c95ae65db75e7690461e595cee692dbf18a2ac98c36efc1059ddcfea8ab622
|
||||
|
||||
FROM ${CLEAR_LINUX_BASE} as builder
|
||||
|
||||
ARG CLEAR_LINUX_VERSION="--version=33450"
|
||||
ARG CLEAR_LINUX_VERSION="--version=33720"
|
||||
|
||||
RUN mkdir /install_root && \
|
||||
swupd os-install \
|
||||
|
@ -13,7 +13,7 @@ spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: intelfpga-demo-job-1
|
||||
image: intel/opae-nlb-demo:0.18.0
|
||||
image: intel/opae-nlb-demo:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
capabilities:
|
||||
|
@ -6,11 +6,11 @@
|
||||
#
|
||||
# This is used on release branches before tagging a stable version.
|
||||
# The master branch defaults to using the latest Clear Linux.
|
||||
ARG CLEAR_LINUX_BASE=clearlinux@sha256:fc47d67eaa0f22c0a6c96250b485ae59e65b1b863ec91941935907c9e7210ae1
|
||||
ARG CLEAR_LINUX_BASE=clearlinux@sha256:15c95ae65db75e7690461e595cee692dbf18a2ac98c36efc1059ddcfea8ab622
|
||||
|
||||
FROM ${CLEAR_LINUX_BASE} as builder
|
||||
|
||||
ARG CLEAR_LINUX_VERSION="--version=33450"
|
||||
ARG CLEAR_LINUX_VERSION="--version=33720"
|
||||
|
||||
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION} && \
|
||||
swupd bundle-add wget c-basic devpkg-json-c devpkg-util-linux devpkg-hwloc doxygen patch
|
||||
|
@ -5,10 +5,11 @@ FROM clearlinux:base as builder
|
||||
ARG QAT_DRIVER_RELEASE="qat1.7.l.4.9.0-00008"
|
||||
ARG QAT_ENGINE_VERSION="v0.5.44"
|
||||
ARG QAT_ENGINE_FLAGS="--disable-multibuff-offload"
|
||||
ARG IPP_CRYPTO_VERSION="ippcp_2020u2"
|
||||
|
||||
RUN swupd bundle-add --skip-diskspace-check devpkg-systemd devpkg-openssl c-basic wget git && \
|
||||
git clone -b $QAT_ENGINE_VERSION https://github.com/intel/QAT_Engine && \
|
||||
git clone https://github.com/intel/ipp-crypto && \
|
||||
git clone -b $IPP_CRYPTO_VERSION https://github.com/intel/ipp-crypto && \
|
||||
wget https://01.org/sites/default/files/downloads/$QAT_DRIVER_RELEASE.tar.gz && \
|
||||
tar xf *.tar.gz
|
||||
|
||||
|
@ -5,7 +5,7 @@ metadata:
|
||||
spec:
|
||||
containers:
|
||||
- name: test-container
|
||||
image: intel/opae-nlb-demo:0.18.0
|
||||
image: intel/opae-nlb-demo:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
capabilities:
|
||||
|
@ -5,7 +5,7 @@ metadata:
|
||||
spec:
|
||||
containers:
|
||||
- name: test-container
|
||||
image: intel/opae-nlb-demo:0.18.0
|
||||
image: intel/opae-nlb-demo:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
capabilities:
|
||||
|
@ -16,7 +16,7 @@ spec:
|
||||
control-plane: controller-manager
|
||||
spec:
|
||||
containers:
|
||||
- image: intel/intel-fpga-admissionwebhook:0.18.0
|
||||
- image: intel/intel-fpga-admissionwebhook:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: manager
|
||||
securityContext:
|
||||
|
@ -21,7 +21,7 @@ spec:
|
||||
spec:
|
||||
initContainers:
|
||||
- name: intel-fpga-initcontainer
|
||||
image: intel/intel-fpga-initcontainer:0.18.0
|
||||
image: intel/intel-fpga-initcontainer:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
@ -37,7 +37,7 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
image: intel/intel-fpga-plugin:0.18.0
|
||||
image: intel/intel-fpga-plugin:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
- -mode=af
|
||||
|
@ -20,7 +20,7 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
image: intel/intel-gpu-plugin:0.18.0
|
||||
image: intel/intel-gpu-plugin:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
|
@ -23,7 +23,7 @@ spec:
|
||||
control-plane: controller-manager
|
||||
spec:
|
||||
containers:
|
||||
- image: intel/intel-deviceplugin-operator:0.18.0
|
||||
- image: intel/intel-deviceplugin-operator:0.18.1
|
||||
name: manager
|
||||
resources:
|
||||
limits:
|
||||
|
@ -3,4 +3,4 @@ kind: GpuDevicePlugin
|
||||
metadata:
|
||||
name: gpudeviceplugin-sample
|
||||
spec:
|
||||
image: intel/intel-gpu-plugin:0.18.0
|
||||
image: intel/intel-gpu-plugin:0.18.1
|
||||
|
@ -3,4 +3,4 @@ kind: QatDevicePlugin
|
||||
metadata:
|
||||
name: qatdeviceplugin-sample
|
||||
spec:
|
||||
image: intel/intel-qat-plugin:0.18.0
|
||||
image: intel/intel-qat-plugin:0.18.1
|
||||
|
@ -5,7 +5,7 @@ metadata:
|
||||
spec:
|
||||
containers:
|
||||
- name: crypto-perf
|
||||
image: intel/crypto-perf:0.18.0
|
||||
image: intel/crypto-perf:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: [ "/bin/bash", "-c", "--" ]
|
||||
args: [ "while true; do sleep 300000; done;" ]
|
||||
|
@ -18,7 +18,7 @@ spec:
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
privileged: true
|
||||
image: intel/intel-qat-plugin:0.18.0
|
||||
image: intel/intel-qat-plugin:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
args: ["-mode", "kernel"]
|
||||
volumeMounts:
|
||||
|
@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: intel-qat-plugin
|
||||
image: intel/intel-qat-plugin:0.18.0
|
||||
image: intel/intel-qat-plugin:0.18.1
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
env:
|
||||
|
@ -20,7 +20,7 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
image: intel/intel-vpu-plugin:0.18.0
|
||||
image: intel/intel-vpu-plugin:0.18.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
|
@ -4,22 +4,26 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Copy the licenses of ".Deps" modules for a package to a target directory
|
||||
# Copy the license obligations of ".Deps" modules for a package to a target directory
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
if [ $# != 2 ] || [ "$1" = "?" ] || [ "$1" = "--help" ]; then
|
||||
echo "Usage: $0 <package> <license target dir>" >&2
|
||||
echo "Usage: $0 <package> <target dir>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $2 ] || [ ! -w $2 ]; then
|
||||
echo "Error: cannot use $2 as the license target directory"
|
||||
echo "Error: cannot use $2 as the target directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $2/package-licenses ]; then
|
||||
mkdir $2/package-licenses
|
||||
fi
|
||||
|
||||
export GO111MODULE=on
|
||||
|
||||
if [ ! -d vendor ]; then
|
||||
@ -32,9 +36,19 @@ PACKAGE_DEPS=$(go list -f '{{ join .Deps "\n" }}' $1 |grep "\.")
|
||||
pushd vendor > /dev/null
|
||||
|
||||
for lic in $LICENSE_FILES; do
|
||||
DIR=`dirname $lic`
|
||||
|
||||
# Copy the license if its repository path is found in package .Deps
|
||||
if [ $(echo $PACKAGE_DEPS | grep -c `dirname $lic`) -gt 0 ]; then
|
||||
cp -t $2 --parent $lic
|
||||
if [ $(echo $PACKAGE_DEPS | grep -c $DIR) -gt 0 ]; then
|
||||
cp -t $2/package-licenses --parent $lic
|
||||
|
||||
# Copy the source if the license is MPL/GPL/LGPL
|
||||
if [ $(grep -c -w -e MPL -e GPL -e LGPL $lic) -gt 0 ]; then
|
||||
if [ ! -d $2/package-sources ]; then
|
||||
mkdir $2/package-sources
|
||||
fi
|
||||
tar -Jvcf $2/package-sources/$(echo $DIR | tr / _).tar.xz $DIR
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user