-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add PACKGEN to build_packages.sh and add better parameter parsing #159
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -23,19 +23,101 @@ | |||||||||
|
||||||||||
set -e | ||||||||||
|
||||||||||
# Default values | ||||||||||
GIT_TOP_LEVEL=$(git rev-parse --show-toplevel) | ||||||||||
ROCM_EXAMPLES_ROOT="$GIT_TOP_LEVEL" | ||||||||||
PACKAGE_NAME="ROCm-SDK-Examples" | ||||||||||
PACKAGE_VERSION="6.2.0" | ||||||||||
PACKAGE_INSTALL_PREFIX="/opt/rocm/examples" | ||||||||||
TEST_PACKAGE_INSTALL_PREFIX="/opt/rocm/examples-test" | ||||||||||
BUILD_DIR="$ROCM_EXAMPLES_ROOT/build" | ||||||||||
DEB_DIR="$BUILD_DIR/deb" | ||||||||||
RPM_DIR="$BUILD_DIR/rpm" | ||||||||||
DEB_PACKAGE_RELEASE="local.9999" | ||||||||||
RPM_PACKAGE_RELEASE="local.9999" | ||||||||||
CPACKGEN="" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Changing name to "PACKGEN", since you're not actually using CPack to build your packages. NOTE: I haven't changed subsequent references. |
||||||||||
|
||||||||||
# Inputs and Defaults | ||||||||||
ROCM_EXAMPLES_ROOT="${1:-$GIT_TOP_LEVEL}" | ||||||||||
PACKAGE_NAME="${2:-ROCm-SDK-Examples}" | ||||||||||
PACKAGE_VERSION="${3:-6.2.0}" | ||||||||||
PACKAGE_INSTALL_PREFIX="${4:-/opt/rocm/examples}" | ||||||||||
TEST_PACKAGE_INSTALL_PREFIX="${5:-/opt/rocm/examples-test}" | ||||||||||
BUILD_DIR="${6:-$ROCM_EXAMPLES_ROOT/build}" | ||||||||||
DEB_DIR="${7:-$BUILD_DIR/deb}" | ||||||||||
RPM_DIR="${8:-$BUILD_DIR/rpm}" | ||||||||||
DEB_PACKAGE_RELEASE="${9:-local.9999}" | ||||||||||
RPM_PACKAGE_RELEASE="${10:-local.9999}" | ||||||||||
PACKAGE_CONTACT="ROCm Developer Support <rocm-dev.support@amd.com>" | ||||||||||
PACKAGE_DESCRIPTION_SUMMARY="A collection of examples for the ROCm software stack" | ||||||||||
PACKAGE_HOMEPAGE_URL="https://github.com/ROCm/ROCm-examples" | ||||||||||
|
||||||||||
# Getopt argument parsing | ||||||||||
VALID_ARGS=$(getopt -o hcr --long help,clean,release,root:,pkgname:,version:,install-prefix:,test-install-prefix:,build-dir:,deb-dir:,rpm-dir:,deb-release:,rpm-release:,cpackgen: -- "$@") | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I didn't see "clean" or "release" in your switch-case statement. If I'm missing something, you can ignore this suggestion. |
||||||||||
if [[ $? -ne 0 ]]; then | ||||||||||
echo "Invalid arguments" | ||||||||||
exit 1 | ||||||||||
fi | ||||||||||
|
||||||||||
eval set -- "$VALID_ARGS" | ||||||||||
|
||||||||||
while [ : ]; do | ||||||||||
case "$1" in | ||||||||||
-h | --help) | ||||||||||
echo "Usage: build_rocm_examples.sh [options]" | ||||||||||
echo "Options:" | ||||||||||
echo " --root <path> Set the root of the ROCm examples" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Changing to |
||||||||||
echo " --pkgname <name> Set the package name" | ||||||||||
echo " --version <version> Set the package version" | ||||||||||
Comment on lines
+58
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's group |
||||||||||
echo " --install-prefix <path> Set the package install prefix" | ||||||||||
echo " --test-install-prefix <path> Set the test package install prefix" | ||||||||||
echo " --build-dir <path> Set the build directory" | ||||||||||
echo " --deb-dir <path> Set the DEB directory" | ||||||||||
echo " --rpm-dir <path> Set the RPM directory" | ||||||||||
echo " --deb-release <release> Set the DEB package release" | ||||||||||
echo " --rpm-release <release> Set the RPM package release" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
echo " --cpackgen <tool> Specify the CPack tool" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
exit 0 | ||||||||||
;; | ||||||||||
--root) | ||||||||||
ROCM_EXAMPLES_ROOT="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--pkgname) | ||||||||||
PACKAGE_NAME="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--version) | ||||||||||
PACKAGE_VERSION="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--install-prefix) | ||||||||||
PACKAGE_INSTALL_PREFIX="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--test-install-prefix) | ||||||||||
TEST_PACKAGE_INSTALL_PREFIX="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--build-dir) | ||||||||||
BUILD_DIR="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--deb-dir) | ||||||||||
DEB_DIR="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--rpm-dir) | ||||||||||
RPM_DIR="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--deb-release) | ||||||||||
DEB_PACKAGE_RELEASE="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--rpm-release) | ||||||||||
RPM_PACKAGE_RELEASE="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--cpackgen) | ||||||||||
CPACKGEN="$2" | ||||||||||
shift 2 | ||||||||||
;; | ||||||||||
--) | ||||||||||
shift | ||||||||||
break | ||||||||||
;; | ||||||||||
esac | ||||||||||
done | ||||||||||
|
||||||||||
STAGING_DIR="$BUILD_DIR/$PACKAGE_NAME-$PACKAGE_VERSION" | ||||||||||
TEST_STAGING_DIR="$BUILD_DIR/${PACKAGE_NAME}-test-$PACKAGE_VERSION" | ||||||||||
|
@@ -70,6 +152,7 @@ print_input_variables() { | |||||||||
echo "RPM_DIR=$RPM_DIR" | ||||||||||
echo "DEB_PACKAGE_RELEASE=$DEB_PACKAGE_RELEASE" | ||||||||||
echo "RPM_PACKAGE_RELEASE=$RPM_PACKAGE_RELEASE" | ||||||||||
echo "CPACKGEN=$CPACKGEN" | ||||||||||
echo "************************************" | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -321,12 +404,15 @@ copy_sources | |||||||||
# Copy CTest files to the test staging directory | ||||||||||
copy_test_files | ||||||||||
|
||||||||||
# Create DEB and RPM packages | ||||||||||
create_deb_package | ||||||||||
create_rpm_package | ||||||||||
# Conditionally create DEB and RPM packages based on CPACKGEN | ||||||||||
if [ -z "$CPACKGEN" ] || [ "$CPACKGEN" == "DEB" ]; then | ||||||||||
create_deb_package | ||||||||||
create_deb_test_package | ||||||||||
fi | ||||||||||
|
||||||||||
# Create DEB and RPM test packages | ||||||||||
create_deb_test_package | ||||||||||
create_rpm_test_package | ||||||||||
if [ -z "$CPACKGEN" ] || [ "$CPACKGEN" == "RPM" ]; then | ||||||||||
create_rpm_package | ||||||||||
create_rpm_test_package | ||||||||||
fi | ||||||||||
|
||||||||||
popd || exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing to SRC_DIR to match other path related options. Maybe we should move it lower to also group them all together. NOTE: I haven't changed subsequent references.