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

Merge upstream updates to APA #5

Merged
merged 18 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
037d71e
Run canary twice a day to prevent false postitive alarm (#29)
Beau-Gosse-dev Jun 27, 2023
9c086fb
fied bug due to which setup-environment.(sh/ps1) wasn't identifying c…
santosh-at-github Aug 3, 2023
ab8e3af
Updates dockerfile to copy only what we need to build the image
jamolina Aug 3, 2023
eb77b34
Bumping up version number. Update dependencies. Adds note on readme.
jamolina Aug 3, 2023
544eba7
rules: Update go.json with ArgoCD minVersion (#42)
danielkleinstein Mar 6, 2024
5746aa8
Bump pyinstaller from 5.13.0 to 5.13.1
dependabot[bot] Mar 20, 2024
4b466aa
Merge pull request #38 from aws/dependabot/pip/pyinstaller-5.13.1
Beau-Gosse-dev Mar 20, 2024
2218359
Bump urllib3 from 2.0.4 to 2.0.7
dependabot[bot] Mar 20, 2024
b890205
Merge pull request #37 from aws/dependabot/pip/urllib3-2.0.7
Beau-Gosse-dev Mar 20, 2024
d8c4e12
add a Python version check when running as a script (#49)
natict Apr 2, 2024
7c258e8
Removing FakeDependency
Beau-Gosse-dev Apr 8, 2024
9dc5f23
Merge pull request #50 from aws/removeFakeDep
Beau-Gosse-dev Apr 8, 2024
2a3436f
Updaing version for release 1.1.1
Beau-Gosse-dev Apr 8, 2024
710b081
Merge pull request #51 from aws/release1.1.1
Beau-Gosse-dev Apr 8, 2024
f85a0b6
merge upstream v1.1.1
binh-ampere Apr 12, 2024
6a9cad7
Delete .github/workflows/canary.yml
binh-ampere Apr 15, 2024
ab22b59
change to repo.maven.apache.org url
binh-ampere Apr 15, 2024
f7cf809
Merge branch 'upstream-updates' of github.com:binh-ampere/ampere-port…
binh-ampere Apr 15, 2024
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
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ RUN apt update \

ENV MAVEN_HOME=/usr/share/maven

COPY . /root/
COPY src src/
COPY build.sh setup-environment.sh getBinaryName.sh requirements-build.txt ./
SHELL ["/bin/bash", "-c"]
RUN cd /root/ && /usr/bin/python3.11 -m venv .venv \
RUN /usr/bin/python3.11 -m venv .venv \
&& source .venv/bin/activate \
&& python3 -m pip install -r requirements-build.txt \
&& FILE_NAME=porting-advisor ./build.sh

RUN mv /root/dist/porting-advisor /opt/porting-advisor
RUN mv dist/porting-advisor /opt/porting-advisor

# Use Eclipse Temurin JRE 17 as runtime
FROM eclipse-temurin:17-jre as runtime
Expand Down
1 change: 0 additions & 1 deletion Integration-Test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ $Dependencies = @(
"<si><t>coverlet.collector</t></si><si><t>1.2.0</t></si>"
"<si><t>SciPy</t></si>"
"<si><t>NumPy</t></si>"
"<si><t>FakeDependency</t></si><si><t>1.2.3</t></si>"
"<si><t>cors</t></si><si><t>2.8.5</t></si>"
"<si><t>express</t></si><si><t>4.18.1</t></si>"
"<si><t>rxjs</t></si><si><t>7.5.6</t></si>"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ This is a fork of the [Porting advisor for Graviton](https://github.com/aws/port

It is a command line tool that analyzes source code for known code patterns and dependency libraries. It then generates a report with any incompatibilities with Ampere's processors. This tool provides suggestions of minimal required and/or recommended versions to run on Ampere processors for both language runtime and dependency libraries. It can be run on non-ARM based machines (like Intel and AMD) and Ampere processors are not required. This tool does not work on binaries, only source code. It does not make any code modifications, it doesn't make API level recommendations, nor does it send data back to Ampere.

This tool scans all files in a source tree, regardless of whether they are included in the build system or not. As such, it may erroneously report issues in files that appear in the source tree but are excluded by the build system. Currently, the tool supports the following languages/dependencies:
**PLEASE NOTE: Even though we do our best to find known incompatibilities, we still recommend to perform the appropriate tests to your application on an Ampere processor based system before going to Production.**

This tool scans all files in a source tree, regardless of whether they are included by the build system or not. As such it may erroneously report issues in files that appear in the source tree but are excluded by the build system. Currently, the tool supports the following languages/dependencies:

* Python 3+
* Python version
Expand Down
17 changes: 13 additions & 4 deletions Setup-Environment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ Sets up Python Virtual Environment.
#>

try {
$p = python --version
Get-Command python | ForEach-Object {
$PYTHON_VERSION_MAJOR = [int]($_.FileVersionInfo.ProductVersion -split '\.')[0]
$PYTHON_VERSION_MINOR = [int]($_.FileVersionInfo.ProductVersion -split '\.')[1]

if ($PYTHON_VERSION_MAJOR -ge 3 -and $PYTHON_VERSION_MINOR -ge 10) {
$PYTHON3 = $_.Name
}
}
$p = & $PYTHON3 "--version"
} catch {
throw '**ERROR**: python is missing, please install it before running this build script'
throw '**ERROR**: python3.10+ is missing, please install it before running this build script'
}

try {
Expand All @@ -17,7 +25,7 @@ try {

if (!(Test-Path -Path .venv)) {
Write-Host "💻 Creating Python virtual environment"
python -m venv .venv
& $PYTHON3 "-m" "venv" ".venv"
if($LASTEXITCODE -ne 0) {
throw "**ERROR**: could not create Python Virtual Environment."
}
Expand All @@ -33,4 +41,5 @@ Write-Host "☁️ Installing requirements"
pip install -r requirements-build.txt
if($LASTEXITCODE -ne 0) {
throw "**ERROR**: error installing required packages"
}
}

8 changes: 0 additions & 8 deletions container-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ source ./test-helpers.sh
# This script tests container image build and runs a couple of
# tests against the generated image.

if [ -d ".venv" ]; then
mv .venv .venv_temp
fi

docker build -t porting-advisor .
if [ $? -ne 0 ]; then
echo "**ERROR**: building container image" && exit 1
Expand All @@ -30,8 +26,4 @@ if [ $? -ne 0 ]; then
fi
rm -f test.html

if [ -d ".venv_temp" ]; then
mv .venv_temp .venv
fi

exit 0
1 change: 0 additions & 1 deletion integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ declare -a dependencies=("<si><t>component</t></si><si><t>version</t></si><si><t
"<si><t>coverlet.collector</t></si><si><t>1.2.0</t></si>"
"<si><t>SciPy</t></si>"
"<si><t>NumPy</t></si>"
"<si><t>FakeDependency</t></si><si><t>1.2.3</t></si>"
"<si><t>cors</t></si><si><t>2.8.5</t></si>"
"<si><t>express</t></si><si><t>4.18.1</t></si>"
"<si><t>rxjs</t></si><si><t>7.5.6</t></si>"
Expand Down
22 changes: 11 additions & 11 deletions requirements-build.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
altgraph==0.17.2
certifi==2022.12.7
charset-normalizer==2.1.1
coverage==7.0.1
altgraph==0.17.3
certifi==2023.7.22
charset-normalizer==3.2.0
coverage==7.2.7
idna==3.4
Jinja2==3.1.2
MarkupSafe==2.1.1
packaging==21.3
MarkupSafe==2.1.3
packaging==23.1
progressbar33==2.4
pyinstaller==5.5
pyinstaller-hooks-contrib==2022.4
pyparsing==3.0.9
pyinstaller==5.13.1
pyinstaller-hooks-contrib==2023.6
pyparsing==3.1.1
requests==2.31.0
urllib3==1.26.13
XlsxWriter==3.0.3
urllib3==2.0.7
XlsxWriter==3.1.2
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
altgraph==0.17.2
altgraph==0.17.3
Jinja2==3.1.2
MarkupSafe==2.1.1
packaging==21.3
MarkupSafe==2.1.3
packaging==23.1
progressbar33==2.4
pyparsing==3.0.9
XlsxWriter==3.0.3
pyparsing==3.1.1
XlsxWriter==3.1.2
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

SciPy>=1.7.1
NumPy
FakeDependency>=1.2.3
25 changes: 17 additions & 8 deletions setup-environment.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#!/bin/bash

# This script sets up the Python Virtual Environment to install dependencies
# This script looks up Python 3.10 or higher in PATH and sets up the Python Virtual Environment to install dependencies

if hash python3
then
echo "🐍 python3 is installed"
for AVAILABLE_PYTHON in $(compgen -c python | sort -u); do
PYTHON_VERSION_MAJOR=$($AVAILABLE_PYTHON --version 2>/dev/null | awk -F '[ .]' 'BEGIN {OFS="."} {print $(NF-2)}')
PYTHON_VERSION_MINOR=$($AVAILABLE_PYTHON --version 2>/dev/null | awk -F '[ .]' 'BEGIN {OFS="."} {print $(NF-1)}')
if [[ $PYTHON_VERSION_MAJOR -ge 3 ]] && [[ $PYTHON_VERSION_MINOR -ge 10 ]]; then
PYTHON3=$AVAILABLE_PYTHON
echo "🐍 python3.10+ is installed"
break
fi
done

if [[ ! -z $PYTHON3 ]]
then
if hash pip3
then
echo "📦 pip is installed"
Expand All @@ -15,7 +23,7 @@ then

if [ ! -f ".venv/bin/activate" ]; then
echo "💻 Creating Python virtual environment"
python3 -m venv .venv
$PYTHON3 -m venv .venv
if [ $? -ne 0 ]; then
echo "**ERROR**: could not create Python Virtual Environment." && exit 1
fi
Expand All @@ -28,12 +36,13 @@ then
fi

echo "☁️ Installing requirements"
python3 -m pip install -r requirements-build.txt
$PYTHON3 -m pip install -r requirements-build.txt
if [ $? -ne 0 ]; then
echo "**ERROR**: error installing required packages" && exit 1
fi
exit 0
else
echo "**ERROR**: python3 is missing, please install it before running this build script"
echo "**ERROR**: python3.10+ is missing, please install it before running this build script"
exit 1
fi
fi

2 changes: 1 addition & 1 deletion src/advisor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""

__project__ = 'porting-advisor'
__version__ = '1.0.2'
__version__ = '1.1.1'
__summary__ = 'Produces an aarch64 porting readiness report.'
__webpage__ = 'http://www.gitlab.com/arm-hpc/porting-advisor'

Expand Down
3 changes: 2 additions & 1 deletion src/advisor/rules/go.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"recommendedVersion": "1.18"
},
"libraryRules": [
{ "name": "github.com/golang/snappy", "minVersion": "0.0.2" }
{ "name": "github.com/golang/snappy", "minVersion": "0.0.2" },
{ "name": "github.com/argoproj/argo-cd/v2", "minVersion": "2.4.0" }
]
}
4 changes: 4 additions & 0 deletions src/porting-advisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@

SPDX-License-Identifier: Apache-2.0
"""
import sys

from advisor import main

if __name__ == '__main__':
if sys.version_info < (3, 10):
print("Python 3.10 or newer is required to run this application.")
sys.exit(1)
main()
4 changes: 2 additions & 2 deletions unittest/test_java_tool_invoker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_can_run_checks_java_is_installed(self):
self.assertTrue(self.tool_invoker.can_run())

def test_ampere_ready_assessor_for_jars_with_native_methods(self):
download_url = 'https://repo1.maven.org/maven2/io/netty/netty-transport-native-unix-common/4.1.73.Final/netty-transport-native-unix-common-4.1.73.Final.jar'
download_url = 'https://repo.maven.apache.org/maven2/io/netty/netty-transport-native-unix-common/4.1.73.Final/netty-transport-native-unix-common-4.1.73.Final.jar'
path = os.path.join('sample-projects', 'java-samples', 'netty-transport-native-unix-common-4.1.73.Final.jar')
urllib.request.urlretrieve(download_url, path)
result, message = self.tool_invoker.ampere_ready_assessor(path)
Expand All @@ -21,7 +21,7 @@ def test_ampere_ready_assessor_for_jars_with_native_methods(self):
self.assertTrue(message.startswith('Native methods:'))

def test_ampere_ready_assessor_for_jars_with_non_native_methods(self):
download_url = 'https://search.maven.org/remotecontent?filepath=javax/activation/activation/1.1.1/activation-1.1.1.jar'
download_url = 'https://repo.maven.apache.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar'
path = os.path.join('sample-projects', 'java-samples', 'activation-1.1.1.jar')
urllib.request.urlretrieve(download_url, path)
result, message = self.tool_invoker.ampere_ready_assessor(path)
Expand Down
Loading