Skip to content

Commit

Permalink
IS-1495: Release Indy SDK 1.14.3 - build DEB's using cargo deb
Browse files Browse the repository at this point in the history
Signed-off-by: artem.ivanov <[email protected]>
  • Loading branch information
Artemkaaas committed Mar 2, 2020
1 parent 2a32e8a commit 952f3ce
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 41 deletions.
43 changes: 27 additions & 16 deletions Jenkinsfile.cd
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ def linuxLibindyBuild(file, env_name, network_name, full_testing) {
cargo build --release --features "fatal_warnings sodium_static"
'''

stash includes: 'libindy/target/release/libindy.so,libindy/target/release/libindy.a', name: "LibindyBuildResult${env_name}"
stash includes: 'libindy/target/release/libindy.so', name: "LibindyBuildResult${env_name}"
stash includes: 'libindy/target/release/libindy.a', name: "LibindyDevBuildResult${env_name}"
}

sh "cp libindy/target/release/libindy.so wrappers/java/lib"
Expand Down Expand Up @@ -1040,6 +1041,7 @@ def linuxPublishing(file, env_name, build_wrappers) {
testEnv = buildTestEnv(file, env_name)

libindyDebPublishing(testEnv, libindyVersion, env_name)
libindyDevDebPublishing(testEnv, libindyVersion, env_name)
libnullpayDebPublishing(testEnv, env_name)
libvcxDebPublishing(testEnv, env_name)
libindyCliDebPublishing(testEnv, libindyVersion, env_name) // Note that last deb publishing should pass resetCache = true inside
Expand Down Expand Up @@ -1283,10 +1285,18 @@ def libindyDebPublishing(testEnv, version, env_name) {
debPublishing(testEnv, "libindy", "libindy", version, "LibindyBuildResult${env_name}", "libindyDebs${env_name}", env_name)
}

def libindyDevDebPublishing(testEnv, version, env_name) {
echo 'Publish Libindy Dev deb files to Apt'

setLibindyDependencyVersion("libindy/Cargo.toml")

debPublishing(testEnv, "libindy", "libindy-dev", version, "LibindyDevBuildResult${env_name}", "libindyDevDebs${env_name}", env_name)
}

def libindyCliDebPublishing(testEnv, version, env_name) {
echo 'Publish Indy Cli deb files to Apt'

setLibindyDependencyVersion("cli/debian/control")
setLibindyDependencyVersion("cli/Cargo.toml")

debPublishing(testEnv, "cli", "indy-cli", version, "IndyCliBuildResult${env_name}", "libindyCliDebs${env_name}", env_name, true)
}
Expand All @@ -1296,7 +1306,7 @@ def libnullpayDebPublishing(testEnv, env_name) {

def libnullpayVersion = getSrcVersion("libnullpay")

setLibindyDependencyVersion("libnullpay/debian/control")
setLibindyDependencyVersion("libnullpay/Cargo.toml")

debPublishing(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "LibnullpayBuildResult${env_name}", "libnullpayDebs${env_name}", env_name)
}
Expand All @@ -1306,7 +1316,7 @@ def libvcxDebPublishing(testEnv, env_name) {

def libvcxVersion = getSrcVersion("vcx/libvcx")

setLibindyDependencyVersion("vcx/libvcx/debian/control")
setLibindyDependencyVersion("vcx/libvcx/Cargo.toml")

debPublishing(testEnv, "vcx/libvcx", "libvcx", libvcxVersion, "LibvcxBuildResult${env_name}", "libvcxDebs${env_name}", env_name)
}
Expand All @@ -1315,7 +1325,7 @@ def setLibindyDependencyVersion(file) {
def libindyVersion = getSrcVersion("libindy")
def replaceVersion = "$libindyVersion~$env.BUILD_NUMBER"

sh "sed -i -e \"s/^\\(Depends: .*libindy\\)\\(\\s*[,]\\{,1\\}.*\\)/\\1 (= $replaceVersion)\\2/\" $file"
sh "sed -i -E -e \"s/depends = \\\"libindy \\(= [0-9,.]+\\)/depends = \\\"libindy \\(= $replaceVersion\\)/g\" $file"
}

def debPublishing(testEnv, directory, packageName, version, inStashName, outStashName, env_name, resetCache = false) {
Expand All @@ -1326,15 +1336,15 @@ def debPublishing(testEnv, directory, packageName, version, inStashName, outStas
testEnv.inside {
sh "cp ci/deb-build-and-upload.sh $directory && chmod -R 755 $directory/*.sh"

def suffix = "~$env.BUILD_NUMBER"
def package_version = "$version~$env.BUILD_NUMBER"
def package_type = ubuntuPakageTypes[env_name]

unstash name: inStashName

def extraFlags = resetCache ? "" : "--no-reset-cache"

withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_key')]) {
sh "cd $directory && ./deb-build-and-upload.sh $packageName $version $env.BRANCH_NAME $suffix $SOVRIN_SDK_REPO_NAME $SOVRIN_REPO_HOST $sovrin_key $package_type $extraFlags"
sh "cd $directory && ./deb-build-and-upload.sh $packageName $package_version $env.BRANCH_NAME $SOVRIN_SDK_REPO_NAME $SOVRIN_REPO_HOST $sovrin_key $package_type $extraFlags"

if (env.BRANCH_NAME == 'rc') {
stash includes: "$directory/debs/*", name: outStashName
Expand Down Expand Up @@ -1464,6 +1474,7 @@ def publishingRCtoStable() {

echo "Moving ${env_name} RC artifacts to Stable: libindy"
publishLibindyDebRCtoStable(testEnv, libindyVersion, env_name)
publishLibindyDevDebRCtoStable(testEnv, libindyVersion, env_name)

echo 'Moving Ubuntu RC artifacts to Stable: python wrapper'
pythonWrapperPublishing(testEnv, true, 'wrappers/python', 'libindy')
Expand Down Expand Up @@ -1687,24 +1698,28 @@ def copyFilesFromRcToStable(src, target) {
}

def publishLibindyDebRCtoStable(testEnv, version, env_name) {
publishDebRCtoStable(testEnv, "libindy", "libindy", version, "libindyDebs", true, env_name)
publishDebRCtoStable(testEnv, "libindy", "libindy", version, "libindyDebs", env_name)
}

def publishLibindyDevDebRCtoStable(testEnv, version, env_name) {
publishDebRCtoStable(testEnv, "libindy-dev", "libindy", version, "libindyDevDebs", env_name)
}

def publishLibindyCliDebRCtoStable(testEnv, version, env_name) {
publishDebRCtoStable(testEnv, "indy-cli", "cli", version, "libindyCliDebs", false, env_name)
publishDebRCtoStable(testEnv, "indy-cli", "cli", version, "libindyCliDebs", env_name)
}

def publishLibnullpayDebRCtoStable(testEnv, env_name) {
def libnullpayVersion = getSrcVersion("libnullpay")
publishDebRCtoStable(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "libnullpayDebs", false, env_name)
publishDebRCtoStable(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "libnullpayDebs", env_name)
}

def publishLibvcxDebRCtoStable(testEnv, env_name) {
def libvcxVersion = getSrcVersion("vcx/libvcx")
publishDebRCtoStable(testEnv, "libvcx", "vcx/libvcx", libvcxVersion, "libvcxDebs", false, env_name, true)
publishDebRCtoStable(testEnv, "libvcx", "vcx/libvcx", libvcxVersion, "libvcxDebs", env_name, true)
}

def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveDevArtifacts, env_name, resetCache = false) {
def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, env_name, resetCache = false) {
testEnv.inside {
def rcFullVersion = "${version}~${env.BUILD_NUMBER}"
def package_type = ubuntuPakageTypes[env_name]
Expand All @@ -1718,10 +1733,6 @@ def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveD

sh "fakeroot deb-reversion -v $version $folder/debs/\"$packageName\"_\"$rcFullVersion\"_amd64.deb"

if (moveDevArtifacts) {
sh "fakeroot deb-reversion -v $version $folder/debs/\"$packageName\"-dev_\"$rcFullVersion\"_amd64.deb"
}

def extraFlags = resetCache ? "" : "--no-reset-cache"

withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_key')]) {
Expand Down
20 changes: 9 additions & 11 deletions ci/deb-build-and-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,32 @@ set -e
set -x

if [ "$1" = "--help" ] ; then
echo "Usage: <package> <version> <type> <suffix> <repo> <host> <key> <package_type> <extra_flags>"
echo "Usage: <package> <version> <type> <repo> <host> <key> <package_type> <extra_flags>"
return
fi

package="$1"
version="$2"
type="$3"
suffix="$4"
repo="$5"
host="$6"
key="$7"
package_type="$8"
extra_flags="$9"
repo="$4"
host="$5"
key="$6"
package_type="$7"
extra_flags="$8"

[ -z $package ] && exit 1
[ -z $version ] && exit 2
[ -z $type ] && exit 3
[ -z $suffix ] && exit 4
[ -z $repo ] && exit 5
[ -z $host ] && exit 6
[ -z $key ] && exit 7
[ -z $package_type ] && exit 8

sed -i -E -e 'H;1h;$!d;x' -e "s/$package ([(,),0-9,.]+)/$package ($version$suffix)/" debian/changelog
sed -i -E -e "s/provides = \"${package} \(= [(,),0-9,.]+\)\"/provides = \"${package} \(= ${version}\)\"/g" Cargo.toml
sed -i -e "s/RELEASE=\(%RELEASE%\)/RELEASE=$type/" debian/postinst

dpkg-buildpackage -tc
cargo deb --no-build --deb-version ${version}-${package_type} --variant ${package}-${package_type}

mkdir debs && mv ../*.deb ./debs/
mkdir debs && mv target/debian/*.deb ./debs/

./sovrin-packaging/upload_debs.py ./debs $repo $type --distro=$package_type --host $host --ssh-key $key $extra_flags
22 changes: 22 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
name = "indy-cli"
version = "1.14.3"
authors = ["Hyperledger Indy Contributors <[email protected]>"]
license = "MIT/Apache-2.0"
description = """\
This is the official command line interface for Indy SDK,\
which provides a distributed-ledger-based foundation for self-sovereign\
identity."""
edition = "2018"

[features]
Expand Down Expand Up @@ -30,3 +35,20 @@ serde_derive = "1.0.97"
term = "0.4.6"
rpassword = "1.0.0"
indy = { version = "1.14.3", path = "../wrappers/rust/" }

[package.metadata.deb]
depends = "libindy (= 1.14.3), libncursesw5-dev"
section = "devel"
priority = "optional"
assets = [
["target/release/indy-cli", "usr/bin/", "755"]
]
maintainer-scripts = "./debian"

[package.metadata.deb.variants.indy-cli-xenial]
name = "indy-cli"
provides = "indy-cli (= 1.14.3)"

[package.metadata.deb.variants.indy-cli-bionic]
name = "indy-cli"
provides = "indy-cli (= 1.14.3)"
45 changes: 41 additions & 4 deletions libindy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,49 @@ name = "wallet"
harness = false

[package.metadata.deb]
provides = "libindy (= 1.14.3)"
extended-description = """\
This is the official SDK for Hyperledger Indy, which provides a \
distributed-ledger-based foundation for self-sovereign identity. \
The major artifact of the SDK is a c-callable library; there are \
also convenience wrappers for various programming languages. \
All bugs, stories, and backlog for this project are managed through \
Hyperledger's Jira in project IS (note that regular Indy tickets are \
in the INDY project instead...). Also, join us on Jira's Rocket.Chat \
at #indy-sdk to discuss."""
section = "devel"
priority = "optional"
maintainer-scripts = "./debian"

[package.metadata.deb.variants.xenial]
[package.metadata.deb.variants.libindy-xenial]
provides = "libindy (= 1.14.3)"
name = "libindy"
depends = "libzmq5, libsodium18, libssl1.0.0"
assets = [
["target/release/libindy.so", "usr/lib/", "644"],
]

[package.metadata.deb.variants.bionic]
[package.metadata.deb.variants.libindy-bionic]
provides = "libindy (= 1.14.3)"
name = "libindy"
depends = "libzmq5, libsodium23, libssl1.1"
depends = "libzmq5, libsodium23, libssl1.1"
assets = [
["target/release/libindy.so", "usr/lib/", "644"],
]

[package.metadata.deb.variants.libindy-dev-xenial]
provides = "libindy-dev (= 1.14.3)"
name = "libindy-dev"
depends = "libindy (= 1.14.3)"
assets = [
["include/*.h", "usr/include/indy/", "644"],
["target/release/libindy.a", "usr/lib/", "644"],
]

[package.metadata.deb.variants.libindy-dev-bionic]
provides = "libindy-dev (= 1.14.3)"
name = "libindy-dev"
depends = "libindy (= 1.14.3)"
assets = [
["include/*.h", "usr/include/indy/", "644"],
["target/release/libindy.a", "usr/lib/", "644"],
]
20 changes: 20 additions & 0 deletions libnullpay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
name = "null-payment-method"
version = "1.14.3"
authors = ["Hyperledger Indy Contributors <[email protected]>"]
license = "MIT/Apache-2.0"
description = """\
This is a simple plugin that can be used for development of applications that use Payments API of Indy SDK."""
build = "build.rs"

[lib]
Expand Down Expand Up @@ -30,3 +33,20 @@ indy = { version="1.14.3", path="../wrappers/rust" }

[target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.5"

[package.metadata.deb]
depends = "libindy (= 1.14.3)"
section = "devel"
priority = "optional"
assets = [
["target/release/libnullpay.so", "usr/lib/", "644"]
]
maintainer-scripts = "./debian"

[package.metadata.deb.variants.libnullpay-xenial]
name = "libnullpay"
provides = "libnullpay (= 1.14.3)"

[package.metadata.deb.variants.libnullpay-bionic]
name = "libnullpay"
provides = "libnullpay (= 1.14.3)"
31 changes: 21 additions & 10 deletions vcx/libvcx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,31 @@ serde_json = "1.0"
serde_derive = "1.0"

[package.metadata.deb]
maintainer = "Evernym, Inc."
copyright = "2018, Evernym Inc."
depends = "$auto, libindy (=1.14.3)"
depends = "libindy (= 1.14.3)"
extended-description = """\
This is Evernym's SDK for managing Verifiable Credential eXchange against an Indy network. For specific instructions on building see the README in the corresponding github repo https://github.com/evernym/sdk"""
section = "admin"
revision = "338ad01"
This is the official SDK for Hyperledger Indy, which provides a\
distributed-ledger-based foundation for self-sovereign identity.\
The major artifact of the SDK is a c-callable library; there are\
also convenience wrappers for various programming languages.\
All bugs, stories, and backlog for this project are managed through\
Hyperledger's Jira in project IS (note that regular Indy tickets are\
in the INDY project instead...). Also, join us on Jira's Rocket.Chat\
at #indy-sdk to discuss."""
section = "devel"
priority = "optional"
assets = [
["target/debug/libvcx.so.*", "usr/lib/", "644"],
["include/vcx.h", "usr/share/libvcx/", "644"],
["scripts/provision_agent_keys.py", "usr/share/libvcx/", "655"]
["target/release/libvcx.so", "usr/lib/", "644"],
["include/vcx.h", "usr/share/libvcx/", "644"]
]
maintainer-scripts = "./scripts"
maintainer-scripts = "./debian"

[package.metadata.deb.variants.libvcx-xenial]
name = "libvcx"
provides = "libvcx (= 0.7.0)"

[package.metadata.deb.variants.libvcx-bionic]
name = "libvcx"
provides = "libvcx (= 0.7.0)"

[profile.release]
debug = true
Expand Down

0 comments on commit 952f3ce

Please sign in to comment.