# [PATCH v1] travis-ci: fix Perforce install on macOS

3 messages from 2017-01-21 to 2017-01-23. Participants: larsxschneider@gmail.com, Junio C Hamano, Lars Schneider.
Thread: https://gitlist.dev/t/44932

## larsxschneider@gmail.com, 2017-01-21 14:42

Subject: [PATCH v1] travis-ci: fix Perforce install on macOS
Message-ID: <20170121144245.31702-1-larsxschneider@gmail.com>
URL: https://gitlist.dev/e/20170121144245.31702-1-larsxschneider%40gmail.com

```
From: Lars Schneider <larsxschneider@gmail.com>

The `perforce` and `perforce-server` package were moved from brew [1][2]
to cask [3]. Teach TravisCI the new location.

Perforce updates their binaries without version bumps. That made the
brew install (legitimately!) fail due to checksum mismatches. The
workaround is not necessary anymore as Cask [4] allows to disable the
checksum test for individual formulas.

[1] https://github.com/Homebrew/homebrew-binary/commit/1394e42de04d07445f82f9512627e864ff4ca4c6
[2] https://github.com/Homebrew/homebrew-binary/commit/f8da22d6b8dbcfcfdb2dfa9ac1a5e5d8e05aac2b
[3] https://github.com/caskroom/homebrew-cask/pull/29180
[4] https://caskroom.github.io/

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---

Hi Junio,

this patch should fix the TravisCI builds:
https://travis-ci.org/git/git/builds

Could you fast track the patch to `maint` if it works without trouble on
`next` (as it should!)?

Thanks,
Lars

Notes:
    Base Commit: 787f75f056 (master)
    Diff on Web: https://github.com/larsxschneider/git/commit/ec7106339d
    Checkout:    git fetch https://github.com/larsxschneider/git travisci/brew-perforce-fix-v1 && git checkout ec7106339d

 .travis.yml | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 3843967a69..c6ba8c8ec5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -75,20 +75,13 @@ before_install:
       popd
       ;;
     osx)
-      brew_force_set_latest_binary_hash () {
-        FORMULA=$1
-        SHA=$(brew fetch --force $FORMULA 2>&1 | grep ^SHA256: | cut -d ' ' -f 2)
-        sed -E -i.bak "s/sha256 \"[0-9a-f]{64}\"/sha256 \"$SHA\"/g" \
-          "$(brew --repository homebrew/homebrew-binary)/$FORMULA.rb"
-      }
       brew update --quiet
       brew tap homebrew/binary --quiet
-      brew_force_set_latest_binary_hash perforce
-      brew_force_set_latest_binary_hash perforce-server
       # Uncomment this if you want to run perf tests:
       # brew install gnu-time
-      brew install git-lfs perforce-server perforce gettext
+      brew install git-lfs gettext
       brew link --force gettext
+      brew install Caskroom/cask/perforce
       ;;
     esac;
     echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)";
--
2.11.0


```

## Junio C Hamano, 2017-01-23 18:22

Subject: Re: [PATCH v1] travis-ci: fix Perforce install on macOS
Message-ID: <xmqq8tq1tz49.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq8tq1tz49.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20170121144245.31702-1-larsxschneider@gmail.com>

```
larsxschneider@gmail.com writes:

> Could you fast track the patch to `maint` if it works without trouble on
> `next` (as it should!)?
>
> Notes:
>     Base Commit: 787f75f056 (master)

I do not think there is any difference between 'maint' and 'master'
for this file right now, but I still would have appreciated if this
line also said 'maint', not 'master', if you want it to go to
'maint' eventually ;-) As https://travis-ci.org/git/git/builds seems
to be doing 'pu', too, hopefully we'll catch any issues there first.

Thanks.

>     Diff on Web: https://github.com/larsxschneider/git/commit/ec7106339d
>     Checkout:    git fetch https://github.com/larsxschneider/git travisci/brew-perforce-fix-v1 && git checkout ec7106339d
>
>  .travis.yml | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/.travis.yml b/.travis.yml
> index 3843967a69..c6ba8c8ec5 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -75,20 +75,13 @@ before_install:
>        popd
>        ;;
>      osx)
> -      brew_force_set_latest_binary_hash () {
> -        FORMULA=$1
> -        SHA=$(brew fetch --force $FORMULA 2>&1 | grep ^SHA256: | cut -d ' ' -f 2)
> -        sed -E -i.bak "s/sha256 \"[0-9a-f]{64}\"/sha256 \"$SHA\"/g" \
> -          "$(brew --repository homebrew/homebrew-binary)/$FORMULA.rb"
> -      }
>        brew update --quiet
>        brew tap homebrew/binary --quiet
> -      brew_force_set_latest_binary_hash perforce
> -      brew_force_set_latest_binary_hash perforce-server
>        # Uncomment this if you want to run perf tests:
>        # brew install gnu-time
> -      brew install git-lfs perforce-server perforce gettext
> +      brew install git-lfs gettext
>        brew link --force gettext
> +      brew install Caskroom/cask/perforce
>        ;;
>      esac;
>      echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)";
> --
> 2.11.0

```

## Lars Schneider, 2017-01-23 18:35

Subject: Re: [PATCH v1] travis-ci: fix Perforce install on macOS
Message-ID: <56F3C5E4-0E50-453E-BF47-AFF38BC7906D@gmail.com>
URL: https://gitlist.dev/e/56F3C5E4-0E50-453E-BF47-AFF38BC7906D%40gmail.com
In-Reply-To: <xmqq8tq1tz49.fsf@gitster.mtv.corp.google.com>

```

> On 23 Jan 2017, at 19:22, Junio C Hamano <gitster@pobox.com> wrote:
> 
> larsxschneider@gmail.com writes:
> 
>> Could you fast track the patch to `maint` if it works without trouble on
>> `next` (as it should!)?
>> 
>> Notes:
>>    Base Commit: 787f75f056 (master)
> 
> I do not think there is any difference between 'maint' and 'master'
> for this file right now, but I still would have appreciated if this
> line also said 'maint', not 'master', if you want it to go to
> 'maint' eventually ;-) As https://travis-ci.org/git/git/builds seems
> to be doing 'pu', too, hopefully we'll catch any issues there first.

You're right! My own automation betrayed me :-)

I made a tiny change, though. Can you queue v2?
http://public-inbox.org/git/20170122225550.28422-1-larsxschneider@gmail.com/

Thanks,
Lars


```
