Skip to content

Commit

Permalink
Update relevant Habitat Plans to set PLAN_PACKAGE_TARGET.
Browse files Browse the repository at this point in the history
This change explicitly injects a package target value for Rust software
components that deal with Habitat packages. The `PLAN_PACKAGE_TARGET`
environment variable is consumed *at build time* by an
`active_package_target` function in the `habitat_core::package::target`
module (which is used once to set a static value at runtime). This is
the mechanism to "bake in" a package target for our tooling.

It should be noted that the `PLAN_PACKAGE_TARGET` is **not** a public,
Habitat environment variable. It is an internal Habitat source
code-consuming variable that is not referenced or used anywhere else in
our system (by design).

Additionally, this approach of setting `PLAN_PACKAGE_TARGET` will not be
used for Builder software components **unless** we plan to build Builder
packages for platform targets other than `x86_64-linux`.

Signed-off-by: Fletcher Nichol <fnichol@nichol.ca>
  • Loading branch information
fnichol committed Jul 17, 2018
1 parent 6d1cf1c commit dc1b4ba
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 4 deletions.
9 changes: 8 additions & 1 deletion components/hab/plan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function Invoke-Prepare {
}

$env:SSL_CERT_FILE = "$(Get-HabPackagePath "cacerts")/ssl/certs/cacert.pem"
$env:PLAN_VERSION = "$pkg_version/$pkg_release"
$env:LIB += ";$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
$env:INCLUDE += ";$HAB_CACHE_SRC_PATH/$pkg_dirname/include"
$env:SODIUM_LIB_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
Expand All @@ -26,6 +25,14 @@ function Invoke-Prepare {
$env:OPENSSL_LIBS = 'ssleay32:libeay32'
$env:OPENSSL_LIB_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
$env:OPENSSL_INCLUDE_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/include"

# Used by the `build.rs` program to set the version of the binaries
$env:PLAN_VERSION = "$pkg_version/$pkg_release"
Write-BuildLine "Setting env:PLAN_VERSION=$env:PLAN_VERSION"

# Used to set the active package target for the binaries at build time
$env:PLAN_PACKAGE_TARGET = "$pkg_target"
Write-BuildLine "Setting env:PLAN_PACKAGE_TARGET=$env:PLAN_PACKAGE_TARGET"
}

function Invoke-Unpack {
Expand Down
4 changes: 4 additions & 0 deletions components/hab/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ _common_prepare() {
export PLAN_VERSION="${pkg_version}/${pkg_release}"
build_line "Setting PLAN_VERSION=$PLAN_VERSION"

# Used to set the active package target for the binaries at build time
export PLAN_PACKAGE_TARGET="$pkg_target"
build_line "Setting PLAN_PACKAGE_TARGET=$PLAN_PACKAGE_TARGET"

if [ -z "$HAB_CARGO_TARGET_DIR" ]; then
# Used by Cargo to use a pristine, isolated directory for all compilation
export CARGO_TARGET_DIR="$HAB_CACHE_SRC_PATH/$pkg_dirname"
Expand Down
9 changes: 8 additions & 1 deletion components/pkg-export-docker/plan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function Invoke-Prepare {
}

$env:SSL_CERT_FILE = "$(Get-HabPackagePath "cacerts")/ssl/certs/cacert.pem"
$env:PLAN_VERSION = "$pkg_version/$pkg_release"
$env:LIB += ";$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
$env:INCLUDE += ";$HAB_CACHE_SRC_PATH/$pkg_dirname/include"
$env:SODIUM_LIB_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
Expand All @@ -27,6 +26,14 @@ function Invoke-Prepare {
$env:OPENSSL_LIBS = 'ssleay32:libeay32'
$env:OPENSSL_LIB_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
$env:OPENSSL_INCLUDE_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/include"

# Used by the `build.rs` program to set the version of the binaries
$env:PLAN_VERSION = "$pkg_version/$pkg_release"
Write-BuildLine "Setting env:PLAN_VERSION=$env:PLAN_VERSION"

# Used to set the active package target for the binaries at build time
$env:PLAN_PACKAGE_TARGET = "$pkg_target"
Write-BuildLine "Setting env:PLAN_PACKAGE_TARGET=$env:PLAN_PACKAGE_TARGET"
}

function Invoke-Unpack {
Expand Down
4 changes: 4 additions & 0 deletions components/pkg-export-docker/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ _common_prepare() {
export PLAN_VERSION="${pkg_version}/${pkg_release}"
build_line "Setting PLAN_VERSION=$PLAN_VERSION"

# Used to set the active package target for the binaries at build time
export PLAN_PACKAGE_TARGET="$pkg_target"
build_line "Setting PLAN_PACKAGE_TARGET=$PLAN_PACKAGE_TARGET"

if [ -z "$HAB_CARGO_TARGET_DIR" ]; then
# Used by Cargo to use a pristine, isolated directory for all compilation
export CARGO_TARGET_DIR="$HAB_CACHE_SRC_PATH/$pkg_dirname"
Expand Down
4 changes: 4 additions & 0 deletions components/pkg-export-helm/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ _common_prepare() {
export PLAN_VERSION="${pkg_version}/${pkg_release}"
build_line "Setting PLAN_VERSION=$PLAN_VERSION"

# Used to set the active package target for the binaries at build time
export PLAN_PACKAGE_TARGET="$pkg_target"
build_line "Setting PLAN_PACKAGE_TARGET=$PLAN_PACKAGE_TARGET"

if [ -z "$HAB_CARGO_TARGET_DIR" ]; then
# Used by Cargo to use a pristine, isolated directory for all compilation
export CARGO_TARGET_DIR="$HAB_CACHE_SRC_PATH/$pkg_dirname"
Expand Down
4 changes: 4 additions & 0 deletions components/pkg-export-kubernetes/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ _common_prepare() {
export PLAN_VERSION="${pkg_version}/${pkg_release}"
build_line "Setting PLAN_VERSION=$PLAN_VERSION"

# Used to set the active package target for the binaries at build time
export PLAN_PACKAGE_TARGET="$pkg_target"
build_line "Setting PLAN_PACKAGE_TARGET=$PLAN_PACKAGE_TARGET"

if [ -z "$HAB_CARGO_TARGET_DIR" ]; then
# Used by Cargo to use a pristine, isolated directory for all compilation
export CARGO_TARGET_DIR="$HAB_CACHE_SRC_PATH/$pkg_dirname"
Expand Down
9 changes: 8 additions & 1 deletion components/pkg-export-tar/plan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function Invoke-Prepare {
}

$env:SSL_CERT_FILE = "$(Get-HabPackagePath "cacerts")/ssl/certs/cacert.pem"
$env:PLAN_VERSION = "$pkg_version/$pkg_release"
$env:LIB += ";$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
$env:INCLUDE += ";$HAB_CACHE_SRC_PATH/$pkg_dirname/include"
$env:SODIUM_LIB_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
Expand All @@ -26,6 +25,14 @@ function Invoke-Prepare {
$env:OPENSSL_LIBS = 'ssleay32:libeay32'
$env:OPENSSL_LIB_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
$env:OPENSSL_INCLUDE_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/include"

# Used by the `build.rs` program to set the version of the binaries
$env:PLAN_VERSION = "$pkg_version/$pkg_release"
Write-BuildLine "Setting env:PLAN_VERSION=$env:PLAN_VERSION"

# Used to set the active package target for the binaries at build time
$env:PLAN_PACKAGE_TARGET = "$pkg_target"
Write-BuildLine "Setting env:PLAN_PACKAGE_TARGET=$env:PLAN_PACKAGE_TARGET"
}

function Invoke-Unpack {
Expand Down
4 changes: 4 additions & 0 deletions components/pkg-export-tar/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ _common_prepare() {
export PLAN_VERSION="${pkg_version}/${pkg_release}"
build_line "Setting PLAN_VERSION=$PLAN_VERSION"

# Used to set the active package target for the binaries at build time
export PLAN_PACKAGE_TARGET="$pkg_target"
build_line "Setting PLAN_PACKAGE_TARGET=$PLAN_PACKAGE_TARGET"

if [ -z "$HAB_CARGO_TARGET_DIR" ]; then
# Used by Cargo to use a pristine, isolated directory for all compilation
export CARGO_TARGET_DIR="$HAB_CACHE_SRC_PATH/$pkg_dirname"
Expand Down
9 changes: 8 additions & 1 deletion components/sup/plan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function Invoke-Prepare {
}

$env:SSL_CERT_FILE = "$(Get-HabPackagePath "cacerts")/ssl/certs/cacert.pem"
$env:PLAN_VERSION = "$pkg_version/$pkg_release"
$env:LIB += ";$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
$env:INCLUDE += ";$HAB_CACHE_SRC_PATH/$pkg_dirname/include"
$env:SODIUM_LIB_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
Expand All @@ -28,6 +27,14 @@ function Invoke-Prepare {
$env:OPENSSL_LIB_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/lib"
$env:OPENSSL_INCLUDE_DIR = "$HAB_CACHE_SRC_PATH/$pkg_dirname/include"
$env:LIBZMQ_PREFIX = "$HAB_CACHE_SRC_PATH/$pkg_dirname"

# Used by the `build.rs` program to set the version of the binaries
$env:PLAN_VERSION = "$pkg_version/$pkg_release"
Write-BuildLine "Setting env:PLAN_VERSION=$env:PLAN_VERSION"

# Used to set the active package target for the binaries at build time
$env:PLAN_PACKAGE_TARGET = "$pkg_target"
Write-BuildLine "Setting env:PLAN_PACKAGE_TARGET=$env:PLAN_PACKAGE_TARGET"
}

function Invoke-Unpack {
Expand Down
4 changes: 4 additions & 0 deletions components/sup/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ _common_prepare() {
export PLAN_VERSION="${pkg_version}/${pkg_release}"
build_line "Setting PLAN_VERSION=$PLAN_VERSION"

# Used to set the active package target for the binaries at build time
export PLAN_PACKAGE_TARGET="$pkg_target"
build_line "Setting PLAN_PACKAGE_TARGET=$PLAN_PACKAGE_TARGET"

if [ -z "$HAB_CARGO_TARGET_DIR" ]; then
# Used by Cargo to use a pristine, isolated directory for all compilation
export CARGO_TARGET_DIR="$HAB_CACHE_SRC_PATH/$pkg_dirname"
Expand Down

0 comments on commit dc1b4ba

Please sign in to comment.