Tutorial: empty mytutorialapp-0.1.0.tar.gz file downloaded


#1

Edit: nevermind, I saw my error.
pkg_source=pkg_source=https://s3-us-west-2.amazonaws.com/{pkg_name}/{pkg_name}-${pkg_version}.tar.gz

A double pkg_source= …

Sandi

Here’s the output from build on my Macbook:

[61][default:/src:0]# build
   : Loading /src/plan.sh
   mytutorialapp: Plan loaded
   mytutorialapp: hab-plan-build setup
   mytutorialapp: Using HAB_BIN=/hab/pkgs/core/hab/0.8.0/20160708161531/bin/hab for installs, signing, and hashing
   mytutorialapp: Resolving dependencies
» Installing core/node
→ Using core/gcc-libs/5.2.0/20160612075020
→ Using core/glibc/2.22/20160612063629
→ Using core/linux-headers/4.3/20160612063537
→ Using core/node/4.2.6/20160708162711 which satisfies core/node
★ Install of core/node complete with 4 packages installed.
   mytutorialapp: Resolved dependency 'core/node' to /hab/pkgs/core/node/4.2.6/20160708162711
   mytutorialapp: Setting PATH=/hab/pkgs/core/node/4.2.6/20160708162711/bin:/hab/pkgs/core/hab-plan-build/0.8.0/20160708170556/bin:/hab/pkgs/core/bash/4.3.42/20160612075613/bin:/hab/pkgs/core/binutils/2.25.1/20160612064534/bin:/hab/pkgs/core/bzip2/1.0.6/20160612075040/bin:/hab/pkgs/core/coreutils/8.24/20160612075329/bin:/hab/pkgs/core/file/5.24/20160612064523/bin:/hab/pkgs/core/findutils/4.4.2/20160612080341/bin:/hab/pkgs/core/gawk/4.1.3/20160612075739/bin:/hab/pkgs/core/grep/2.22/20160612075540/bin:/hab/pkgs/core/gzip/1.6/20160612080637/bin:/hab/pkgs/core/hab/0.8.0/20160708161531/bin:/hab/pkgs/core/sed/4.2.2/20160612075228/bin:/hab/pkgs/core/tar/1.28/20160612075701/bin:/hab/pkgs/core/unzip/6.0/20160612081414/bin:/hab/pkgs/core/wget/1.18/20160708162313/bin:/hab/pkgs/core/xz/5.2.2/20160612080402/bin:/hab/pkgs/core/acl/2.2.52/20160612075215/bin:/hab/pkgs/core/attr/2.4.47/20160612075207/bin:/hab/pkgs/core/glibc/2.22/20160612063629/bin:/hab/pkgs/core/less/481/20160612080021/bin:/hab/pkgs/core/libcap/2.24/20160612075226/bin:/hab/pkgs/core/libidn/1.32/20160612081104/bin:/hab/pkgs/core/ncurses/6.0/20160612075116/bin:/hab/pkgs/core/openssl/1.0.2h/20160708160802/bin:/hab/pkgs/core/pcre/8.38/20160612075520/bin
   mytutorialapp: Downloading 'pkg_source=https://s3-us-west-2.amazonaws.com/mytutorialapp/mytutorialapp-0.1.0.tar.gz' to 'mytutorialapp-0.1.0.tar.gz'
pkg_source=https://s3-us-west-2.amazonaws.com/mytutorialapp/mytutorialapp-0.1.0.tar.gz: Scheme missing.
   mytutorialapp: Build time: 0m0s
   mytutorialapp: Exiting on error
[62][default:/src:1]# ls -l /hab/cache/src/mytutorialapp-0.1.0.tar.gz 
-rw-r--r-- 1 root root 0 Jul 28 18:02 /hab/cache/src/mytutorialapp-0.1.0.tar.gz

When I run ‘curl https://s3-us-west-2.amazonaws.com/mytutorialapp/mytutorialapp-0.1.0.tar.gz > mytutorialapp-0.1.0.tar.gz’ outside of hab studio, I get a valid tar.gz file with the expected contents.

This is my plan.sh:

pkg_origin=sandi
pkg_name=mytutorialapp
pkg_version=0.1.0
pkg_maintainer="Your Name <your email address>"
pkg_license=()
pkg_source=pkg_source=https://s3-us-west-2.amazonaws.com/${pkg_name}/${pkg_name}-${pkg_version}.tar.gz
pkg_shasum=b54f8ada292b0249245385996221751f571e170162e0d464a26b958478cc9bfa
pkg_filename=${pkg_name}-${pkg_version}.tar.gz
pkg_deps=(core/node)
pkg_expose=(8080)

do_build() {
  # The mytutorialapp source code is unpacked into a directory,
  # mytutorialapp-0.1.0, at the root of $HAB_CACHE_SRC_PATH. If you were downloading
  # an archive that didn't match your package name and version, you would have to
  # copy the files into $HAB_CACHE_SRC_PATH.

  # This installs both npm as well as the nconf module we listed as a
  # dependency in package.json.
  npm install
}

do_install() {
  # Our source files were copied over to the HAB_CACHE_SRC_PATH in do_build(),
  # so now they need to be copied into the root directory of our package through
  # the pkg_prefix variable. This is so that we have the source files available
  # in the package.
  cp package.json ${pkg_prefix}
  cp server.js ${pkg_prefix}

  # Copy over the nconf module to the package that we installed in do_build().
  mkdir -p ${pkg_prefix}/node_modules/
  cp -vr node_modules/* ${pkg_prefix}/node_modules/
}

Sandi