Cannot find Gemspec file after upgrade

Hello!

After upgrading from hab 0.55 to 0.59 we are now running into a build issue:

inspec: Preparing to build
inspec: Setting GEM_HOME=/hab/pkgs/jquick/inspec/2.2.41/20180720144235/lib
inspec: Setting GEM_PATH=/hab/pkgs/jquick/inspec/2.2.41/20180720144235/lib
inspec: Building
/hab/cache/src/inspec-2.2.41 /src /src/habitat
ERROR:  Gemspec file not found: inspec.gemspec
inspec: Build time: 9m14s
inspec: Exiting on error
Script done, file is /src/results/logs/inspec.2018-07-20-144235.log

Our plan can be found here: https://github.com/inspec/inspec/blob/master/habitat/plan.sh

Wondering if we should not be using the cache paths anymore or if anything changed.

Thanks!

Ignore that. I haven’t had enough coffee yet :frowning: Continuing investigation.

Looks like this started breaking with the release on the 13th (0.59). As we auto build it on every commit.

Ok what is happening is that when it’s copying the files, it’s not copying it to the location you’re expecting:

Adding a -v to the copy gives us:

'/src/habitat/../inspec.gemspec' -> '/hab/cache/src/inspec-2.2.41/../inspec.gemspec'

You can resolve this by changing line 46 to

cp -R $PLAN_CONTEXT/../* $HAB_CACHE_SRC_PATH/$pkg_dirname/

Progress! But still having other issues now

   inspec: Building
/hab/cache/src/inspec-2.2.41 /src /src/habitat
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
ERROR:  While executing gem ... (Gem::InvalidSpecificationException)
    [".rubocop.yml"] are not files
   inspec: Build time: 6m12s
   inspec: Exiting on error
Script done, file is /src/results/logs/inspec.2018-07-20-152736.log

I can manually build the gem without issues using gem build inspec.gemspec

Ok, I’ve got a better solution

cp -RT $PLAN_CONTEXT/.. $HAB_CACHE_SRC_PATH/$pkg_dirname/

Looking into the 0.55.0 vs 0.56.0 and newer studio, something has changed that causes the PATH ordering to be different. In an attach in 0.55.0:

[7] inspec(do_unpack)> type -a cp
cp is /hab/pkgs/core/coreutils/8.29/20180608092141/bin/cp
cp is /hab/pkgs/core/busybox-static/1.28.1/20180608102729/bin/cp
cp is /hab/pkgs/core/coreutils/8.25/20170513213226/bin/cp
[8] inspec(do_unpack)> hab --version
hab 0.55.0/20180321220925

0.56.0:

[12] inspec(do_unpack)> type -a cp
cp is /hab/pkgs/core/busybox-static/1.28.1/20180608102729/bin/cp
cp is /hab/pkgs/core/coreutils/8.29/20180608092141/bin/cp
cp is /hab/pkgs/core/coreutils/8.25/20170513213226/bin/cp
[13] inspec(do_unpack)> hab --version
hab 0.56.0/20180530234036

As you can see, with 0.56.0, cp from busybox has taken precedence over cp from coreutils, which would cause this change in behavior.

Thanks that fixed it!

@jquick @smacfarlane Alternatively, I think you can also just move coreutils up above busybox in your pkg_deps array.