Skip to content

Commit

Permalink
Get habitat build working with changes from #1654
Browse files Browse the repository at this point in the history
The pwd for building changed with #1654. Hopefully
this makes it not matter

Signed-off-by: Jay Mundrawala <[email protected]>
  • Loading branch information
Jay Mundrawala committed Apr 3, 2019
1 parent 8927787 commit 87dba17
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/bookshelf/habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ pkg_binds_optional=(
[chef-server-ctl]="secrets"
)

# set_pwd gives a consistent current working directory when building
# foo/bar/habitat/ vs foo/bar
set_pwd() {
cd "$PLAN_CONTEXT/../"
}

pkg_version() {
cat "$PLAN_CONTEXT/../../../VERSION"
}

do_before() {
set_pwd

do_default_before
if [ ! -f "$PLAN_CONTEXT/../../../VERSION" ]; then
exit_with "Cannot find VERSION file! You must run \"hab studio enter\" from the chef-server project root." 56
Expand All @@ -36,13 +44,15 @@ do_before() {
}

do_unpack() {
set_pwd
# Copy everything over to the cache path so we don't write out our compiled
# deps into the working directory, but into the cache directory.
mkdir -p "$HAB_CACHE_SRC_PATH/$pkg_dirname"
cp -R "$PLAN_CONTEXT/../"* "$HAB_CACHE_SRC_PATH/$pkg_dirname"
}

do_prepare() {
set_pwd
# The `/usr/bin/env` path is hardcoded in jiffy, so we'll add a symlink since fix_interpreter won't work.
if [[ ! -r /usr/bin/env ]]; then
ln -sv "$(pkg_path_for coreutils)/bin/env" /usr/bin/env
Expand All @@ -60,22 +70,25 @@ do_prepare() {
"$(pkg_path_for core/cacerts)"/ssl/certs/cacert.pem
}


do_build() {
set_pwd
export REL_VERSION=$pkg_version
make omnibus
}

do_install() {
set_pwd
cp -rv "_build/default/rel/bookshelf/"* "${pkg_prefix}"
cp -R "$HAB_CACHE_SRC_PATH/$pkg_dirname/schema" "$pkg_prefix"
}

do_check() {
set_pwd
make
}

do_end() {
set_pwd
# Clean up the `env` link, if we set it up.
if [[ -n "$_clean_env" ]]; then
rm -fv /usr/bin/env
Expand Down
11 changes: 11 additions & 0 deletions src/chef-server-ctl/habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ pkg_svc_user="hab"
pkg_svc_group="$pkg_svc_user"
pkg_description="Some description."

# set_pwd gives a consistent current working directory when building
# foo/bar/habitat/ vs foo/bar
set_pwd() {
cd "$PLAN_CONTEXT/../"
}

pkg_version() {
cat "$PLAN_CONTEXT/../../../VERSION"
}

do_before() {
set_pwd
do_default_before
if [ ! -f "$PLAN_CONTEXT/../../../VERSION" ]; then
exit_with "Cannot find VERSION file! You must run \"hab studio enter\" from the chef-server project root." 56
Expand All @@ -44,14 +51,17 @@ do_before() {
}

do_unpack() {
set_pwd
return 0
}

do_build() {
set_pwd
return 0
}

do_install() {
set_pwd
export HOME="${pkg_prefix}"
export RUBY_VENDOR="${pkg_prefix}/vendor/bundle"

Expand Down Expand Up @@ -113,5 +123,6 @@ EOF
}

do_check() {
set_pwd
return 0
}
12 changes: 12 additions & 0 deletions src/nginx/habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ pkg_description="NGINX configuration and content for Chef Server"
pkg_upstream_url="https://docs.chef.io/server_components.html"
pkg_svc_run="openresty -c ${pkg_svc_config_path}/nginx.conf -p ${pkg_svc_var_path}"

# set_pwd gives a consistent current working directory when building
# foo/bar/habitat/ vs foo/bar
set_pwd() {
cd "$PLAN_CONTEXT/../"
}

pkg_version() {
cat "$PLAN_CONTEXT/../../../VERSION"
}

do_before() {
set_pwd
do_default_before
if [ ! -f "$PLAN_CONTEXT/../../../VERSION" ]; then
exit_with "Cannot find VERSION file! You must run \"hab studio enter\" from the chef-server project root." 56
Expand All @@ -38,29 +45,34 @@ do_before() {
}

do_unpack() {
set_pwd
mkdir -p "$HAB_CACHE_SRC_PATH/$pkg_dirname"
cp -R "$PLAN_CONTEXT/../"* "$HAB_CACHE_SRC_PATH/$pkg_dirname"
mkdir -p "$HAB_CACHE_SRC_PATH/$pkg_dirname/static"
cp -R "$PLAN_CONTEXT/../../../omnibus/files/private-chef-cookbooks/private-chef/files/default/html" "$HAB_CACHE_SRC_PATH/$pkg_dirname/static"
}

do_build() {
set_pwd
return 0
}

do_install() {
set_pwd
echo PKG_SVC_STATIC_PATH $pkg_svc_static_path
mkdir -p $pkg_svc_static_path
cp -R $HAB_CACHE_SRC_PATH/$pkg_dirname/static "$pkg_prefix"
return 0
}

do_strip() {
set_pwd
return 0
}


## NOT RIGHT
do_after() {
set_pwd
return 0
}
12 changes: 12 additions & 0 deletions src/oc-id/habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,18 @@ pkg_exports=(
pkg_exposes=(port)
pkg_bin_dirs=(binstubs)

# set_pwd gives a consistent current working directory when building
# foo/bar/habitat/ vs foo/bar
set_pwd() {
cd "$PLAN_CONTEXT/../"
}

pkg_version() {
cat "$PLAN_CONTEXT/../../../VERSION"
}

do_before() {
set_pwd
do_default_before
if [ ! -f "$PLAN_CONTEXT/../../../VERSION" ]; then
exit_with "Cannot find VERSION file! You must run \"hab studio enter\" from the chef-server project root." 56
Expand All @@ -47,18 +54,21 @@ do_before() {
}

do_unpack() {
set_pwd
# Copy everything over to the cache path so we don't write out our compiled
# deps into the working directory, but into the cache directory.
mkdir -p "$HAB_CACHE_SRC_PATH/$pkg_dirname"
cp -R "$PLAN_CONTEXT/../"* "$HAB_CACHE_SRC_PATH/$pkg_dirname"
}

do_prepare() {
set_pwd
# clean up any lingering bundle artifacts
rm -rf $PLAN_CONTEXT/../.bundle
}

do_build() {
set_pwd
export LD_LIBRARY_PATH="$(pkg_path_for core/libffi)/lib:$(pkg_path_for core/sqlite)/lib"
export USE_SYSTEM_LIBFFI=1
export C_INCLUDE_PATH="$(pkg_path_for core/sqlite)/include"
Expand Down Expand Up @@ -86,6 +96,7 @@ _tar_pipe_app_cp_to() {
}

do_install() {
set_pwd
_bundler_dir="$(pkg_path_for bundler)"
export HOME="${pkg_prefix}/oc_id"
mkdir $HOME
Expand All @@ -107,5 +118,6 @@ do_install() {

# needed due to libffi Bad value error
do_strip() {
set_pwd
return 0
}
13 changes: 13 additions & 0 deletions src/oc_bifrost/habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ pkg_binds_optional=(
[chef-server-ctl]="secrets"
)

# set_pwd gives a consistent current working directory when building
# foo/bar/habitat/ vs foo/bar
set_pwd() {
cd "$PLAN_CONTEXT/../"
}

pkg_version() {
cat "$PLAN_CONTEXT/../../../VERSION"
}

do_before() {
set_pwd
do_default_before
if [ ! -f "$PLAN_CONTEXT/../../../VERSION" ]; then
exit_with "Cannot find VERSION file! You must run \"hab studio enter\" from the chef-server project root." 56
Expand All @@ -37,13 +44,15 @@ do_before() {
}

do_unpack() {
set_pwd
# Copy everything over to the cache path so we don't write out our compiled
# deps into the working directory, but into the cache directory.
mkdir -p "$HAB_CACHE_SRC_PATH/$pkg_dirname"
cp -R "$PLAN_CONTEXT/../"* "$HAB_CACHE_SRC_PATH/$pkg_dirname"
}

do_prepare() {
set_pwd
# The `/usr/bin/env` path is hardcoded in jiffy, so we'll add a symlink since fix_interpreter won't work.
if [[ ! -r /usr/bin/env ]]; then
ln -sv "$(pkg_path_for coreutils)/bin/env" /usr/bin/env
Expand All @@ -63,6 +72,7 @@ do_prepare() {


do_build() {
set_pwd
_bundler_dir="$(pkg_path_for bundler)"
export REL_VERSION=$pkg_version
export GEM_HOME="${pkg_path}/vendor/bundle"
Expand All @@ -71,15 +81,18 @@ do_build() {
}

do_install() {
set_pwd
cp -rv "_build/default/rel/oc_bifrost/"* "${pkg_prefix}"
cp -R "$HAB_CACHE_SRC_PATH/$pkg_dirname/schema" "$pkg_prefix"
}

do_check() {
set_pwd
make
}

do_end() {
set_pwd
# Clean up the `env` link, if we set it up.
if [[ -n "$_clean_env" ]]; then
rm -fv /usr/bin/env
Expand Down
13 changes: 13 additions & 0 deletions src/oc_erchef/habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,18 @@ pkg_binds_optional=(
[bookshelf]="port"
)

# set_pwd gives a consistent current working directory when building
# foo/bar/habitat/ vs foo/bar
set_pwd() {
cd "$PLAN_CONTEXT/../"
}

pkg_version() {
cat "$PLAN_CONTEXT/../../../VERSION"
}

do_before() {
set_pwd
do_default_before
if [ ! -f "$PLAN_CONTEXT/../../../VERSION" ]; then
exit_with "Cannot find VERSION file! You must run \"hab studio enter\" from the chef-server project root." 56
Expand All @@ -48,13 +55,15 @@ do_before() {
}

do_unpack() {
set_pwd
# Copy everything over to the cache path so we don't write out our compiled
# deps into the working directory, but into the cache directory.
mkdir -p "$HAB_CACHE_SRC_PATH/$pkg_dirname"
cp -R "$PLAN_CONTEXT/../"* "$HAB_CACHE_SRC_PATH/$pkg_dirname"
}

do_prepare() {
set_pwd
# The `/usr/bin/env` path is hardcoded in jiffy, so we'll add a symlink since fix_interpreter won't work.
if [[ ! -r /usr/bin/env ]]; then
ln -sv "$(pkg_path_for coreutils)/bin/env" /usr/bin/env
Expand All @@ -74,6 +83,7 @@ do_prepare() {


do_build() {
set_pwd
_bundler_dir="$(pkg_path_for bundler)"
export REL_VERSION=$pkg_version
export USE_SYSTEM_GECODE=1
Expand All @@ -86,6 +96,7 @@ do_build() {
}

do_install() {
set_pwd
export HOME="${pkg_prefix}"
cp Gemfile_habitat ${pkg_prefix}/Gemfile
cp Gemfile_habitat.lock ${pkg_prefix}/Gemfile.lock
Expand All @@ -96,10 +107,12 @@ do_install() {
}

do_check() {
set_pwd
make
}

do_end() {
set_pwd
# Clean up the `env` link, if we set it up.
if [[ -n "$_clean_env" ]]; then
rm -fv /usr/bin/env
Expand Down

0 comments on commit 87dba17

Please sign in to comment.