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

[corretto8] - Change download source #3461

Closed
4 changes: 0 additions & 4 deletions corretto8/plan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,3 @@ $pkg_lib_dirs=@("lib")
function Invoke-Build {
Copy-Item "$HAB_CACHE_SRC_PATH/$pkg_dirname/*" "$pkg_prefix" -Recurse -Force
}

function Invoke-Check {
(& "$HAB_CACHE_SRC_PATH/$pkg_dirname/bin/java.exe" --version).StartsWith("openjdk version $pkg_version")
}
6 changes: 3 additions & 3 deletions corretto8/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pkg_description=('Corretto is a build of the Open Java Development Kit (OpenJDK)
pkg_license=("GPL-2.0-only")
pkg_upstream_url=https://aws.amazon.com/corretto/
pkg_maintainer="The Habitat Maintainers <[email protected]>"
pkg_source="https://d2znqt9b1bc64u.cloudfront.net/amazon-corretto-${pkg_version}-linux-x64.tar.gz"
pkg_source="https://d3pxv6yz143wms.cloudfront.net/${pkg_version}/amazon-corretto-${pkg_version}-linux-x64.tar.gz"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there not a non-cloudfront URL we can use? Perhaps one of these?

https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html

If not, I think a comment on why we use this cloudfront URL directly might be good.

pkg_shasum=c19a928687479e1036ff1d6e023975402d2f027d9b3e4d64cfaf0c9f35bf9669
pkg_filename="corretto-${pkg_version}_linux-x64_bin.tar.gz"
pkg_dirname="amazon-corretto-${pkg_version}-linux-x64"
Expand Down Expand Up @@ -35,11 +35,11 @@ do_install() {
build_line "Setting rpath for all libraries to '${LD_RUN_PATH}'"

find "${pkg_prefix}"/bin -type f -executable \
-exec sh -c 'file -i "$1" | grep -q "x-executable; charset=binary"' _ {} \; \
-exec sh -c 'file -i "$1" | grep -q "-executable; charset=binary"' _ {} \; \
-exec patchelf --set-interpreter "$(pkg_path_for glibc)/lib/ld-linux-x86-64.so.2" --set-rpath "${LD_RUN_PATH}" {} \;

find "${pkg_prefix}"/jre/bin -type f -executable \
-exec sh -c 'file -i "$1" | grep -q "x-executable; charset=binary"' _ {} \; \
-exec sh -c 'file -i "$1" | grep -q "-executable; charset=binary"' _ {} \; \
-exec patchelf --set-interpreter "$(pkg_path_for glibc)/lib/ld-linux-x86-64.so.2" --set-rpath "${LD_RUN_PATH}" {} \;

find "${pkg_prefix}/lib" -type f -name "*.so" \
Expand Down
18 changes: 18 additions & 0 deletions corretto8/tests/test.pester.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
param (
[Parameter()]
[string]$PackageIdentifier = $(throw "Fully qualified package identifier must be given as a parameter.")
)

Describe "The java bin" {
Context "java invoked without options" {
It "Runs and exits successfully" {
hab pkg exec $PackageIdentifier java -version
$? | Should be $true
}
It "Mentions the expected version number on stdout" {
$expected_version = $PackageIdentifier.split("/")[2]
$output = hab pkg exec $PackageIdentifier java -version 2>&1
$output | Out-String | Should -Match "${expected_version}"
}
}
}
22 changes: 22 additions & 0 deletions corretto8/tests/test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Ensure package ident has been passed
param (
[Parameter()]
[string]$PackageIdentifier = $(throw "Usage: test.ps1 [test_pgk_ident] e.g. test.ps1 core/corretto8/8.212.04.2/20190513101258")
)

# Ensure Pester is installed
if (-Not (Get-Module -ListAvailable -Name Pester)) {
hab pkg install core/pester
Import-Module "$(hab pkg path core/pester)\module\pester.psd1"
}

# Install the package
hab pkg install $PackageIdentifier

# Test the package
$__dir=(Get-Item $PSScriptRoot)
$test_result = Invoke-Pester -PassThru -Script @{
Path = "$__dir/test.pester.ps1";
Parameters = @{PackageIdentifier =$PackageIdentifier}
}
Exit $test_result.FailedCount