-
Notifications
You must be signed in to change notification settings - Fork 24
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
CHEF-14475-Hab path changes for chef-cli #238
Draft
nikhil2611
wants to merge
10
commits into
main
Choose a base branch
from
nikhil/hab-path-changes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6f738ca
Added plan.sh file
sanghinitin 7a26e94
Change gem file for app bundler on windows and plan.ps1 added
sanghinitin bfcead9
Main marged
sanghinitin 91c05e4
Habitat pkg version sync with version file
sanghinitin 4fe4c3f
Removed duplicate dep and check linux gem are not trying to install o…
sanghinitin f18096a
Change in linux plan file and Rakefile to add install task
sanghinitin b92f675
added hab path aware code changes
nikhil2611 1422e98
fixing the git issue
nikhil2611 86cd859
added the hab env and few command fix for hab path
nikhil2611 809bc85
testing for plan.sh as of now
nikhil2611 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
_chef_client_ruby="core/ruby31" | ||
pkg_name="chef-cli" | ||
pkg_origin="ngupta26" | ||
pkg_maintainer="The Chef Maintainers <[email protected]>" | ||
pkg_description="The Chef CLI" | ||
pkg_license=('Apache-2.0') | ||
pkg_bin_dirs=( | ||
bin | ||
vendor/bin | ||
) | ||
pkg_build_deps=( | ||
core/make | ||
core/gcc | ||
core/git | ||
core/libarchive | ||
) | ||
pkg_deps=( | ||
$_chef_client_ruby | ||
core/coreutils | ||
) | ||
pkg_svc_user=root | ||
|
||
pkg_version() { | ||
cat "${SRC_PATH}/VERSION" | ||
} | ||
|
||
do_before() { | ||
do_default_before | ||
update_pkg_version | ||
# We must wait until we update the pkg_version to use the pkg_version | ||
pkg_filename="${pkg_name}-${pkg_version}.tar.gz" | ||
} | ||
|
||
do_download() { | ||
build_line "Locally creating archive of latest repository commit at ${HAB_CACHE_SRC_PATH}/${pkg_filename}" | ||
# source is in this repo, so we're going to create an archive from the | ||
# appropriate path within the repo and place the generated tarball in the | ||
# location expected by do_unpack | ||
( cd "${SRC_PATH}" || exit_with "unable to enter hab-src directory" 1 | ||
git archive --prefix="${pkg_name}-${pkg_version}/" --output="${HAB_CACHE_SRC_PATH}/${pkg_filename}" HEAD | ||
) | ||
} | ||
|
||
do_verify() { | ||
build_line "Skipping checksum verification on the archive we just created." | ||
return 0 | ||
} | ||
|
||
do_setup_environment() { | ||
push_runtime_env GEM_PATH "${pkg_prefix}/vendor" | ||
|
||
set_runtime_env APPBUNDLER_ALLOW_RVM "true" # prevent appbundler from clearing out the carefully constructed runtime GEM_PATH | ||
set_runtime_env LANG "en_US.UTF-8" | ||
set_runtime_env LC_CTYPE "en_US.UTF-8" | ||
} | ||
|
||
do_prepare() { | ||
export GEM_HOME="${pkg_prefix}/vendor" | ||
export CPPFLAGS="${CPPFLAGS} ${CFLAGS}" | ||
|
||
( cd "$CACHE_PATH" | ||
bundle config --local jobs "$(nproc)" | ||
bundle config --local without server docgen maintenance pry travis integration ci chefstyle | ||
bundle config --local shebang "$(pkg_path_for "$_chef_client_ruby")/bin/ruby" | ||
bundle config --local retry 5 | ||
bundle config --local silence_root_warning 1 | ||
) | ||
|
||
build_line "Setting link for /usr/bin/env to 'coreutils'" | ||
if [ ! -f /usr/bin/env ]; then | ||
ln -s "$(pkg_interpreter_for core/coreutils bin/env)" /usr/bin/env | ||
fi | ||
} | ||
|
||
do_build() { | ||
( cd "$CACHE_PATH" || exit_with "unable to enter hab-cache directory" 1 | ||
build_line "Installing gem dependencies ..." | ||
bundle install --jobs=3 --retry=3 | ||
build_line "Installing gems from git repos properly ..." | ||
build_line "Installing this project's gems ..." | ||
bundle exec rake install:local | ||
gem install chef-utils chef-config appbundler | ||
) | ||
} | ||
|
||
do_install() { | ||
( cd "$pkg_prefix" || exit_with "unable to enter pkg prefix directory" 1 | ||
export BUNDLE_GEMFILE="${CACHE_PATH}/Gemfile" | ||
build_line "** fixing binstub shebangs" | ||
fix_interpreter "${pkg_prefix}/vendor/bin/*" "$_chef_client_ruby" bin/ruby | ||
export BUNDLE_GEMFILE="${CACHE_PATH}/Gemfile" | ||
for gem in chef-cli; do | ||
build_line "** generating binstubs for $gem with precise version pins" | ||
appbundler $CACHE_PATH $pkg_prefix/bin $gem | ||
done | ||
) | ||
} | ||
|
||
do_after() { | ||
build_line "Trimming the fat ..." | ||
|
||
# We don't need the cache of downloaded .gem files ... | ||
rm -rf "$pkg_prefix/vendor/cache" | ||
|
||
# We don't need the gem docs. | ||
rm -rf "$pkg_prefix/vendor/doc" | ||
# We don't need to ship the test suites for every gem dependency, | ||
# only Chef's for package verification. | ||
find "$pkg_prefix/vendor/gems" -name spec -type d | grep -v "chef-cli-${pkg_version}" \ | ||
| while read spec_dir; do rm -rf "$spec_dir"; done | ||
} | ||
|
||
do_end() { | ||
if [ "$(readlink /usr/bin/env)" = "$(pkg_interpreter_for core/coreutils bin/env)" ]; then | ||
build_line "Removing the symlink we created for '/usr/bin/env'" | ||
rm /usr/bin/env | ||
fi | ||
} | ||
|
||
do_strip() { | ||
return 0 | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This could potentially be various origins for the chef-cli pkg?