commit:     be1016621c919ec293667becd69e6dd2b854a2fc
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 13 12:03:51 2021 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Sun Jun 13 12:08:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be101662

dev-vcs/git-flow: some QA fixes

1. Inherit eclasses before declaring any variables, just in case;
2. Fix indentation of SRC_URI;
3. Put non-executable support scripts in /usr/libexec/git-flow instead
   of polluting /usr/bin;
4. Use PF rather than P as the directory name for docs;
5. Change the sed delimiter to ! so that slashes in paths do not have to
   be escaped;
6. Install to ED rather than D so that we (hopefully) support Prefix.

Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 .../git-flow/files/git-flow-1.12.3_scriptdir.patch | 72 ++++++++++++++++++++++
 dev-vcs/git-flow/git-flow-1.12.3-r1.ebuild         | 46 ++++++++++++++
 2 files changed, 118 insertions(+)

diff --git a/dev-vcs/git-flow/files/git-flow-1.12.3_scriptdir.patch 
b/dev-vcs/git-flow/files/git-flow-1.12.3_scriptdir.patch
new file mode 100644
index 00000000000..34fab234d41
--- /dev/null
+++ b/dev-vcs/git-flow/files/git-flow-1.12.3_scriptdir.patch
@@ -0,0 +1,72 @@
+Keeps the auxiliary, non-executable script files out of /usr/bin, and
+avoids calling uname every time git-flow runs.
+
+--- a/git-flow
++++ b/git-flow
+@@ -41,41 +41,9 @@
+       set -x
+ fi
+ 
+-# Setup the GITFLOW_DIR for different operating systems.
+-# This is mostly to make sure that we get the correct directory when the
+-# git-flow file is a symbolic link
+-case $(uname -s) in
+-Linux)
+-      export GITFLOW_DIR=$(dirname "$(readlink -e "$0")")
+-      ;;
+-FreeBSD|OpenBSD|NetBSD)
+-      export FLAGS_GETOPT_CMD='/usr/local/bin/getopt'
+-      export GITFLOW_DIR=$(dirname "$(realpath "$0")")
+-      ;;
+-Darwin)
+-      PRG="$0"
+-      while [ -h "$PRG" ]; do
+-              link=$(readlink "$PRG")
+-              if expr "$link" : '/.*' > /dev/null; then
+-                      PRG="$link"
+-              else
+-                      PRG="$(dirname "$PRG")/$link"
+-              fi
+-      done
+-      export GITFLOW_DIR=$(dirname "$PRG")
+-      ;;
+-*MINGW*)
+-      export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
+-      pwd () {
+-              builtin pwd -W
+-      }
+-      ;;
+-*)
+-      # The sed expression here replaces all backslashes by forward slashes.
+-      # This helps our Windows users, while not bothering our Unix users.)
+-      export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
+-      ;;
+-esac
++# Setup GITFLOW_DIR
++GITFLOW_DIR="@PREFIX@/libexec/git-flow"
++export GITFLOW_DIR
+ 
+ # Extra environment settings
+ if [ -f ~/.gitflow_export ]; then
+--- a/Makefile
++++ b/Makefile
+@@ -30,6 +30,7 @@
+ 
+ datarootdir=$(prefix)/share
+ docdir=$(datarootdir)/doc/gitflow
++scriptdir=$(prefix)/libexec/git-flow
+ # files that need mode 755
+ EXEC_FILES=git-flow
+ 
+@@ -55,9 +56,10 @@
+ 
+ install:
+       install -d -m 0755 $(prefix)/bin
++      install -d -m 0755 $(scriptdir)
+       install -d -m 0755 $(docdir)/hooks
+       install -m 0755 $(EXEC_FILES) $(prefix)/bin
+-      install -m 0644 $(SCRIPT_FILES) $(prefix)/bin
++      install -m 0644 $(SCRIPT_FILES) $(scriptdir)
+       install -m 0644 $(HOOK_FILES) $(docdir)/hooks
+ 
+ uninstall:

diff --git a/dev-vcs/git-flow/git-flow-1.12.3-r1.ebuild 
b/dev-vcs/git-flow/git-flow-1.12.3-r1.ebuild
new file mode 100644
index 00000000000..7bd223ff451
--- /dev/null
+++ b/dev-vcs/git-flow/git-flow-1.12.3-r1.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit bash-completion-r1
+
+MY_PN="${PN/-/}-avh"
+COMP_PN="${PN}-completion"
+COMP_PV="0.6.0"
+COMP_P="${COMP_PN}-${COMP_PV}"
+
+DESCRIPTION="Git extensions to provide high-level repository operations"
+HOMEPAGE="https://github.com/petervanderdoes/gitflow-avh";
+SRC_URI="https://github.com/petervanderdoes/${MY_PN}/archive/${PV}.tar.gz -> 
${P}.tar.gz
+       https://github.com/petervanderdoes/${COMP_PN}/archive/${COMP_PV}.tar.gz 
-> ${COMP_P}.tar.gz"
+
+LICENSE="BSD MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="dev-vcs/git"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.12.3_scriptdir.patch
+)
+
+DOCS=( AUTHORS CHANGELOG.md README.md )
+
+S="${WORKDIR}"/${MY_PN}-${PV}
+
+src_prepare() {
+       default
+       sed -i "s!doc/gitflow!doc/${PF}!" Makefile || die "Fixing doc path 
failed"
+       sed -i "s!@PREFIX@!${EPREFIX}!" git-flow || die "Failed to set prefix 
in the script"
+}
+
+src_compile() {
+       true
+}
+
+src_install() {
+       emake prefix="${ED}"/usr install
+       einstalldocs
+       newbashcomp "${WORKDIR}"/${COMP_P}/${COMP_PN}.bash ${PN}
+}

Reply via email to