forked from hyperledger/indy-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INDY-580: Improve packaging before supporting CentOS (hyperledger#381)
* Support older versions of Docker Signed-off-by: Benoit Donneaux <[email protected]> * Quote to support spaces Signed-off-by: Benoit Donneaux <[email protected]> * Support multibranch PL - can not work on same volume at the same time Signed-off-by: Benoit Donneaux <[email protected]> * Transpose previous fixes from Jenkinsfile Signed-off-by: Benoit Donneaux <[email protected]> * Adapt usage accordingly Signed-off-by: Benoit Donneaux <[email protected]> * Add a default value for new argument Signed-off-by: Benoit Donneaux <[email protected]> * Improve readability Signed-off-by: Benoit Donneaux <[email protected]> * Fix identation Signed-off-by: Benoit Donneaux <[email protected]>
- Loading branch information
1 parent
be8fb2b
commit ff57033
Showing
6 changed files
with
67 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,22 +3,22 @@ | |
set -e | ||
set -x | ||
|
||
OUTPUT_PATH=${1:-.} | ||
OUTPUT_PATH="${1:-.}" | ||
|
||
function build_from_pypi { | ||
PACKAGE_NAME=$1 | ||
PACKAGE_NAME="$1" | ||
|
||
if [ -z $2 ]; then | ||
if [ -z "$2" ]; then | ||
PACKAGE_VERSION="" | ||
else | ||
PACKAGE_VERSION="==$2" | ||
fi | ||
POSTINST_TMP=postinst-${PACKAGE_NAME} | ||
PREREM_TMP=prerm-${PACKAGE_NAME} | ||
cp postinst ${POSTINST_TMP} | ||
cp prerm ${PREREM_TMP} | ||
sed -i 's/{package_name}/python3-'${PACKAGE_NAME}'/' ${POSTINST_TMP} | ||
sed -i 's/{package_name}/python3-'${PACKAGE_NAME}'/' ${PREREM_TMP} | ||
POSTINST_TMP="postinst-${PACKAGE_NAME}" | ||
PREREM_TMP="prerm-${PACKAGE_NAME}" | ||
cp postinst "${POSTINST_TMP}" | ||
cp prerm "${PREREM_TMP}" | ||
sed -i "s/{package_name}/python3-${PACKAGE_NAME}/" "${POSTINST_TMP}" | ||
sed -i "s/{package_name}/python3-${PACKAGE_NAME}/" "${PREREM_TMP}" | ||
|
||
fpm --input-type "python" \ | ||
--output-type "deb" \ | ||
|
@@ -29,16 +29,16 @@ function build_from_pypi { | |
--exclude "*.pyc" \ | ||
--exclude "*.pyo" \ | ||
--maintainer "Hyperledger <[email protected]>" \ | ||
--after-install ${POSTINST_TMP} \ | ||
--before-remove ${PREREM_TMP} \ | ||
--package ${OUTPUT_PATH} \ | ||
${PACKAGE_NAME}${PACKAGE_VERSION} | ||
--after-install "${POSTINST_TMP}" \ | ||
--before-remove "${PREREM_TMP}" \ | ||
--package "${OUTPUT_PATH}" \ | ||
"${PACKAGE_NAME}${PACKAGE_VERSION}" | ||
|
||
rm ${POSTINST_TMP} | ||
rm ${PREREM_TMP} | ||
rm "${POSTINST_TMP}" | ||
rm "${PREREM_TMP}" | ||
} | ||
|
||
# build 3rd parties: | ||
# build_from_pypi <pypi-name> <version> | ||
|
||
build_from_pypi timeout-decorator | ||
build_from_pypi timeout-decorator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
#!/bin/bash -xe | ||
|
||
PKG_SOURCE_PATH=$1 | ||
VERSION=$2 | ||
PKG_SOURCE_PATH="$1" | ||
VERSION="$2" | ||
PKG_NAME=indy-node | ||
IMAGE_NAME=${PKG_NAME}-build-u1604 | ||
OUTPUT_VOLUME_NAME=${PKG_NAME}-deb-u1604 | ||
IMAGE_NAME="${PKG_NAME}-build-u1604" | ||
OUTPUT_VOLUME_NAME="${3:-"${PKG_NAME}-deb-u1604"}" | ||
|
||
if [[ (-z ${PKG_SOURCE_PATH}) || (-z ${VERSION}) ]]; then | ||
echo "Usage: $0 <path-to-package-sources> <version>" | ||
if [[ (-z "${PKG_SOURCE_PATH}") || (-z "${VERSION}") ]]; then | ||
echo "Usage: $0 <path-to-package-sources> <version> <volume>" | ||
exit 1; | ||
fi | ||
|
||
if [ -z $3 ]; then | ||
CMD="/root/build-"${PKG_NAME}".sh /input ${VERSION} /output" | ||
if [ -z "$4" ]; then | ||
CMD="/root/build-${PKG_NAME}.sh /input ${VERSION} /output" | ||
else | ||
CMD=$3 | ||
CMD="$4" | ||
fi | ||
|
||
docker build -t ${IMAGE_NAME} -f Dockerfile . | ||
docker volume create --name ${OUTPUT_VOLUME_NAME} | ||
docker build -t "${IMAGE_NAME}" -f Dockerfile . | ||
docker volume create --name "${OUTPUT_VOLUME_NAME}" | ||
|
||
docker run \ | ||
-i \ | ||
--rm \ | ||
-v ${PKG_SOURCE_PATH}:/input \ | ||
-v ${OUTPUT_VOLUME_NAME}:/output \ | ||
-e PKG_NAME=${PKG_NAME} \ | ||
${IMAGE_NAME} \ | ||
-v "${PKG_SOURCE_PATH}:/input" \ | ||
-v "${OUTPUT_VOLUME_NAME}:/output" \ | ||
-e PKG_NAME="${PKG_NAME}" \ | ||
"${IMAGE_NAME}" \ | ||
$CMD | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters