_realname=git-repo
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.4.20
pkgrel=1
pkgdesc="The multiple Git repository tool (mingw-w64)"
arch=(any)
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://github.com/esrlabs/git-repo"
license=("Apache-2.0")
groups=("${MINGW_PACKAGE_PREFIX}")
depends=("${MINGW_PACKAGE_PREFIX}-python3")
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/esrlabs/${_realname}/archive/v${pkgver}.tar.gz")
sha256sums=('34844c368ff7adf594665e16de4fefa12c69ae494c4514f0c028f53a6b639536')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cat <<EOF | patch -p1
diff -ur git-repo-0.3.17.orig/main.py git-repo-0.3.17/main.py
--- git-repo-0.3.17.orig/main.py	2015-08-04 21:15:54.126874400 +0200
+++ git-repo-0.3.17/main.py	2015-08-04 21:15:18.948862300 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!${MINGW_PREFIX}/bin/python3
 #
 # Copyright (C) 2008 The Android Open Source Project
 #
diff -ur git-repo-0.3.17.orig/repo git-repo-0.3.17/repo
--- git-repo-0.3.17.orig/repo	2015-08-04 21:13:41.829307400 +0200
+++ git-repo-0.3.17/repo	2015-08-04 21:14:33.821281100 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!${MINGW_PREFIX}/bin/python3

 import sys

EOF
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  mkdir -p "${pkgdir}${MINGW_PREFIX}/bin"
  cp repo "${pkgdir}${MINGW_PREFIX}/bin"
}
