Commit c79dcb37 authored by Mislav Marohnić's avatar Mislav Marohnić
Browse files

Merge branch 'patch-galore'

parents c73b670b 210ceef8
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -847,9 +847,15 @@ isolated_gem_install() {
}

apply_ruby_patch() {
  local patchfile
  case "$1" in
  ruby-* | jruby-* | rubinius-* )
    patch -p0 -i "${2:--}"
    patchfile="$(mktemp "${TMP}/ruby-patch.XXXXXX")"
    cat "${2:--}" >"$patchfile"

    local striplevel=0
    grep -q '^diff --git a/' "$patchfile" && striplevel=1
    patch -p$striplevel --force -i "$patchfile"
    ;;
  esac
}
+29 −3
Original line number Diff line number Diff line
@@ -85,9 +85,9 @@ OUT
  stub brew false
  stub_make_install
  stub_make_install
  stub patch ' : echo patch "$@" >> build.log'
  stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'

  install_fixture --patch definitions/needs-yaml
  TMPDIR="$TMP" install_fixture --patch definitions/needs-yaml <<<""
  assert_success

  unstub make
@@ -97,7 +97,33 @@ OUT
yaml-0.1.6: --prefix=$INSTALL_ROOT
make -j 2
make install
patch -p0 -i -
patch -p0 --force -i $TMP/ruby-patch.XXX
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2
make install
OUT
}

@test "apply ruby patch from git diff before building" {
  cached_tarball "yaml-0.1.6"
  cached_tarball "ruby-2.0.0"

  stub brew false
  stub_make_install
  stub_make_install
  stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'

  TMPDIR="$TMP" install_fixture --patch definitions/needs-yaml <<<"diff --git a/script.rb"
  assert_success

  unstub make
  unstub patch

  assert_build_log <<OUT
yaml-0.1.6: --prefix=$INSTALL_ROOT
make -j 2
make install
patch -p1 --force -i $TMP/ruby-patch.XXX
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2
make install