Skip to content

Commit

Permalink
Merge branch 'conan_support' of github.com:melter2m/LicenseFinder int…
Browse files Browse the repository at this point in the history
…o conan_support

* 'conan_support' of github.com:melter2m/LicenseFinder:
  [Deprecated] - Remove Dep package manager for jammy release
  [Fixed] Ensure licenses are recognised by `spdx_id`
  Use Ubuntu 22.04 (Jammy) for Docker image * Use Python3 by default, Python2 is no longer available * Ignore "dep" tests for Go for now as "dep" is no longer available
  • Loading branch information
melter2m committed Jul 18, 2023
2 parents e23992a + 9d1ce27 commit ac8420e
Show file tree
Hide file tree
Showing 16 changed files with 574 additions and 250 deletions.
107 changes: 50 additions & 57 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM ubuntu:bionic
FROM ubuntu:jammy

WORKDIR /tmp

# Versioning
ENV PIP_INSTALL_VERSION 19.0.2
ENV PIP3_INSTALL_VERSION 20.0.2
ENV GO_LANG_VERSION 1.17.13
ENV MAVEN_VERSION 3.6.0
ENV SBT_VERSION 1.3.3
ENV GRADLE_VERSION 5.6.4
ENV RUBY_VERSION 3.2.2
ENV MIX_VERSION 2.0
ENV COMPOSER_ALLOW_SUPERUSER 1

# programs needed for building
Expand All @@ -29,7 +27,7 @@ RUN add-apt-repository ppa:git-core/ppa && \
apt -q update && apt install -y git && rm -rf /var/lib/apt/lists/*

# install nodejs
RUN curl -sL https://deb.nodesource.com/setup_17.x | bash - && \
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
apt -q update && apt install -y nodejs && rm -rf /var/lib/apt/lists/*

# install yarn
Expand Down Expand Up @@ -61,10 +59,9 @@ RUN curl -o rebar3 https://s3.amazonaws.com/rebar3/rebar3 && \
mv rebar3 /usr/local/bin/rebar3

# install and update python and python-pip
RUN apt -q update && apt install -y python python-pip python3-pip && \
RUN apt -q update && apt install -y python3-pip && \
rm -rf /var/lib/apt/lists/* && \
python3 -m pip install pip==$PIP3_INSTALL_VERSION --upgrade && \
python -m pip install pip==$PIP_INSTALL_VERSION --upgrade --force
python3 -m pip install pip==$PIP3_INSTALL_VERSION --upgrade

# install maven
RUN curl -O https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz && \
Expand All @@ -74,7 +71,7 @@ RUN curl -O https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binarie

# install sbt
RUN mkdir -p /usr/local/share/sbt-launcher-packaging && \
curl --progress \
curl \
--retry 3 \
--retry-delay 15 \
--location "https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.tgz" \
Expand Down Expand Up @@ -107,13 +104,11 @@ RUN mkdir /gopath && \
go install github.com/kardianos/govendor@latest && \
go clean -cache

#install rvm and glide and godep
#install rvm and glide
RUN apt-add-repository -y ppa:rael-gc/rvm && \
add-apt-repository -y ppa:masterminds/glide && \
apt -q update && apt install -y rvm && \
/usr/share/rvm/bin/rvm install --default $RUBY_VERSION &&\
apt install -y glide && \
apt install -y go-dep && \
/usr/share/rvm/bin/rvm install --default $RUBY_VERSION && \
apt install -y golang-glide && \
rm -rf /var/lib/apt/lists/*

# install trash
Expand All @@ -137,10 +132,7 @@ ENV LC_ALL=en_US.UTF-8
RUN curl https://sh.rustup.rs -sSf | bash -ls -- -y --profile minimal

#install mix
RUN wget https://packages.erlang-solutions.com/erlang-solutions_${MIX_VERSION}_all.deb && \
dpkg -i erlang-solutions_${MIX_VERSION}_all.deb && \
rm -f erlang-solutions_${MIX_VERSION}_all.deb && \
apt -q update && apt install -y esl-erlang && rm -rf /var/lib/apt/lists/*
RUN apt -q update && apt install -y erlang && rm -rf /var/lib/apt/lists/*
# Install Elixir
WORKDIR /tmp/elixir-build
RUN git clone https://github.com/elixir-lang/elixir.git
Expand All @@ -149,7 +141,7 @@ RUN make && make install
WORKDIR /

# install conan
RUN apt -q update && apt install -y python-dev && rm -rf /var/lib/apt/lists/* && \
RUN apt -q update && apt install -y python3-dev && rm -rf /var/lib/apt/lists/* && \
pip install --no-cache-dir --ignore-installed six --ignore-installed colorama \
--ignore-installed requests --ignore-installed chardet \
--ignore-installed urllib3 \
Expand All @@ -160,25 +152,25 @@ RUN apt -q update && apt install -y python-dev && rm -rf /var/lib/apt/lists/* &&
# install NuGet (w. mono)
# https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools#macoslinux
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF &&\
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list &&\
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list &&\
apt -q update && apt install -y mono-complete && rm -rf /var/lib/apt/lists/* &&\
curl -o "/usr/local/bin/nuget.exe" "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" &&\
curl -o "/usr/local/bin/nugetv3.5.0.exe" "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe"

# install dotnet core
RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb &&\
RUN wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb &&\
dpkg -i packages-microsoft-prod.deb &&\
rm packages-microsoft-prod.deb &&\
apt -q update &&\
apt install -y dotnet-runtime-2.1 dotnet-sdk-2.1 dotnet-sdk-2.2 dotnet-sdk-3.0 dotnet-sdk-3.1 &&\
apt install -y dotnet-sdk-6.0 dotnet-sdk-7.0 &&\
rm -rf /var/lib/apt/lists/*

# install Composer
# The ARG and ENV are for installing tzdata which is part of this installaion.
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
ENV TZ=GMT
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4F4EA0AAE5267A6C &&\
echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu bionic main" | tee /etc/apt/sources.list.d/php.list &&\
echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu jammy main" | tee /etc/apt/sources.list.d/php.list &&\
export DEBIAN_FRONTEND=noninteractive &&\
apt -q update && apt install -y php7.4-cli && rm -rf /var/lib/apt/lists/* &&\
EXPECTED_COMPOSER_INSTALLER_CHECKSUM="$(curl --silent https://composer.github.io/installer.sig)" &&\
Expand All @@ -201,53 +193,35 @@ RUN \
(echo; echo "yes") | sh "${conda_installer}"

# install Swift Package Manager
# Based on https://github.com/apple/swift-docker/blob/main/5.3/ubuntu/18.04/Dockerfile
# Based on https://github.com/apple/swift-docker/blob/main/5.8/ubuntu/22.04/Dockerfile
# The GPG download steps has been modified. Keys are now on LF repo and copied instaad of downloaded.
# Refer to https://swift.org/download/#using-downloads in the Linux section on how to download the keys
RUN apt -q update && apt -q install -y \
libatomic1 \
libcurl4 \
libxml2 \
libedit2 \
libsqlite3-0 \
libc6-dev \
binutils \
libgcc-5-dev \
libstdc++-5-dev \
zlib1g-dev \
libpython2.7 \
tzdata \
git \
gnupg2 \
libc6-dev \
libedit2 \
libgcc-9-dev \
libcurl4-openssl-dev \
libpython3-dev \
libsqlite3-0 \
libstdc++-9-dev \
libxml2-dev \
libz3-dev \
pkg-config \
python3-lldb-13 \
tzdata \
zlib1g-dev \
&& rm -r /var/lib/apt/lists/*

#install flutter
ENV FLUTTER_HOME=/root/flutter
RUN git config --global --add safe.directory /root/flutter
RUN curl -o flutter_linux_2.8.1-stable.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.8.1-stable.tar.xz \
&& tar xf flutter_linux_2.8.1-stable.tar.xz \
&& mv flutter ${FLUTTER_HOME} \
&& rm flutter_linux_2.8.1-stable.tar.xz

ENV PATH=$PATH:${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin
RUN flutter doctor -v \
&& flutter update-packages \
&& flutter precache
# Accepting all licences
RUN yes | flutter doctor --android-licenses -v
# Creating Flutter sample projects to put binaries in cache fore each template type
RUN flutter create --template=app ${TEMP}/app_sample \
&& flutter create --template=package ${TEMP}/package_sample \
&& flutter create --template=plugin ${TEMP}/plugin_sample


# pub 4096R/ED3D1561 2019-03-22 [SC] [expires: 2023-03-23]
# Key fingerprint = A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561
# uid Swift 5.x Release Signing Key <[email protected]
ARG SWIFT_SIGNING_KEY=A62AE125BBBFBB96A6E042EC925CC1CCED3D1561
ARG SWIFT_PLATFORM=ubuntu18.04
ARG SWIFT_BRANCH=swift-5.3.3-release
ARG SWIFT_VERSION=swift-5.3.3-RELEASE
ARG SWIFT_PLATFORM=ubuntu22.04
ARG SWIFT_BRANCH=swift-5.8-release
ARG SWIFT_VERSION=swift-5.8-RELEASE
ARG SWIFT_WEBROOT=https://download.swift.org

ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
Expand Down Expand Up @@ -275,6 +249,25 @@ RUN set -e; \
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \
set +e

# install flutter
ENV FLUTTER_HOME=/root/flutter
RUN git config --global --add safe.directory /root/flutter
RUN curl -o flutter_linux_2.8.1-stable.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.8.1-stable.tar.xz \
&& tar xf flutter_linux_2.8.1-stable.tar.xz \
&& mv flutter ${FLUTTER_HOME} \
&& rm flutter_linux_2.8.1-stable.tar.xz

ENV PATH=$PATH:${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin
RUN flutter doctor -v \
&& flutter update-packages \
&& flutter precache
# Accepting all licences
RUN yes | flutter doctor --android-licenses -v
# Creating Flutter sample projects to put binaries in cache fore each template type
RUN flutter create --template=app ${TEMP}/app_sample \
&& flutter create --template=package ${TEMP}/package_sample \
&& flutter create --template=plugin ${TEMP}/plugin_sample

# install license_finder
COPY . /LicenseFinder
RUN bash -lc "cd /LicenseFinder && bundle config set no-cache 'true' && bundle install -j4 && bundle pristine && rake install"
Expand Down
8 changes: 7 additions & 1 deletion ci/scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ pushd "$PROJECT_ROOT"
DISABLE_BINARY="--disable-binary"
fi

rvm install --default $RUBY_VERSION_UNDER_TEST $DISABLE_BINARY
# This is needed for 2.7 but also works for 2.6. For 2.6, you can also downgrade the openssl version to 1.1.1l-1ubuntu1.4 in the dockerfile with allowing downgrades for apt install -y libssl-dev=1.1.1l-1ubuntu1.4
if [[ $RUBY_VERSION_UNDER_TEST == "2.6.10" || $RUBY_VERSION_UNDER_TEST == "2.7.8" ]]; then
OPEN_SSL_FLAG="--with-openssl-dir=/usr/share/rvm/usr/"
rvm pkg install openssl
fi

rvm install --default $RUBY_VERSION_UNDER_TEST $DISABLE_BINARY $OPEN_SSL_FLAG
ruby --version

export GOPATH=$HOME/go
Expand Down
3 changes: 2 additions & 1 deletion features/features/cli/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
expect(developer).to be_receiving_exit_code(1)
end

specify 'displays an error if symlink to potential license file is dangling' do
# Dep has been deprecated since 2020
xspecify 'displays an error if symlink to potential license file is dangling' do
project = LicenseFinder::TestingDSL::BrokenSymLinkDepProject.create
ENV['GOPATH'] = "#{project.project_dir}/gopath_dep"
developer.run_license_finder('gopath_dep/src/foo-dep')
Expand Down
2 changes: 1 addition & 1 deletion features/features/package_managers/dep_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_relative '../../support/feature_helper'

describe 'Dep Dependencies' do
xdescribe 'Dep Dependencies' do
let(:go_developer) { LicenseFinder::TestingDSL::User.new }

specify 'are shown in reports for a project' do
Expand Down
56 changes: 28 additions & 28 deletions features/support/testing_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -425,34 +425,34 @@ def shell_out(command)
end
end

class DepProject < Project
def add_dep
clone('gopath_dep')
end

def install
orig_gopath = ENV['GOPATH']
ENV['GOPATH'] = "#{project_dir}/gopath_dep"
shell_out('dep ensure')
ENV['GOPATH'] = orig_gopath
end

def shell_out(command)
ProjectDir.new(Paths.project.join('gopath_dep', 'src', 'foo-dep')).shell_out(command)
end
end

class BrokenSymLinkDepProject < Project
def add_dep
clone('gopath_dep')
end

def install; end

def shell_out(command)
ProjectDir.new(Paths.project.join('gopath_dep', 'src', 'foo-dep')).shell_out(command)
end
end
# class DepProject < Project
# def add_dep
# clone('gopath_dep')
# end
#
# def install
# orig_gopath = ENV['GOPATH']
# ENV['GOPATH'] = "#{project_dir}/gopath_dep"
# shell_out('dep ensure')
# ENV['GOPATH'] = orig_gopath
# end
#
# def shell_out(command)
# ProjectDir.new(Paths.project.join('gopath_dep', 'src', 'foo-dep')).shell_out(command)
# end
# end
#
# class BrokenSymLinkDepProject < Project
# def add_dep
# clone('gopath_dep')
# end
#
# def install; end
#
# def shell_out(command)
# ProjectDir.new(Paths.project.join('gopath_dep', 'src', 'foo-dep')).shell_out(command)
# end
# end

class GovendorProject < Project
def add_dep
Expand Down
2 changes: 1 addition & 1 deletion lib/license_finder/license.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def unrecognized_matcher?
attr_reader :short_name, :pretty_name, :other_names, :spdx_id, :matcher

def names
([short_name, pretty_name] + other_names).uniq
([short_name, pretty_name, spdx_id] + other_names).uniq
end
end

Expand Down
Loading

0 comments on commit ac8420e

Please sign in to comment.