public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review
@ 2014-08-18 17:56 Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 01/13] Support EAPI=6_pre1 for testing EAPI6 features Michał Górny
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev

Here are my patches drafting the first implementations of various parts
of EAPI6, based on top of my cleaned up portage base (see the previous
patch serie).

Unless I've missed something, it includes all Council-approved items
except for runtime USE, and additionally --docdir and --htmldir. Please
review, comment and possibly test.

The easy way:

	portage_LIVE_REPO=https://github.com/mgorny/portage.git
	portage_LIVE_BRANCH=eapi6

--
Michał Górny



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 01/13] Support EAPI=6_pre1 for testing EAPI6 features
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 02/13] Add tentative support for EAPI6 --docdir and --htmldir Michał Górny
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

---
 pym/portage/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 66bfeb0..0046161 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -491,7 +491,7 @@ def abssymlink(symlink, target=None):
 
 _doebuild_manifest_exempt_depend = 0
 
-_testing_eapis = frozenset(["4-python", "4-slot-abi", "5-progress", "5-hdepend"])
+_testing_eapis = frozenset(["4-python", "4-slot-abi", "5-progress", "5-hdepend", "6_pre1"])
 _deprecated_eapis = frozenset(["4_pre1", "3_pre2", "3_pre1", "5_pre1", "5_pre2"])
 _supported_eapis = frozenset([str(x) for x in range(portage.const.EAPI + 1)] + list(_testing_eapis) + list(_deprecated_eapis))
 
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 02/13] Add tentative support for EAPI6 --docdir and --htmldir
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 01/13] Support EAPI=6_pre1 for testing EAPI6 features Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 03/13] Add tentative support for EAPI6 get_libdir() Michał Górny
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Pass --docdir and --htmldir to configure scripts that support it.
---
 bin/eapi.sh          |  4 ++++
 bin/phase-helpers.sh | 12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 623b89f..5f96c3b 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -110,6 +110,10 @@ ___eapi_econf_passes_--disable-silent-rules() {
 	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
 }
 
+___eapi_econf_passes_--docdir_and_--htmldir() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_use_enable_and_use_with_support_empty_third_argument() {
 	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
 }
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index b96c3f5..c2161f6 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -522,7 +522,7 @@ econf() {
 		fi
 
 		local conf_args=()
-		if ___eapi_econf_passes_--disable-dependency-tracking || ___eapi_econf_passes_--disable-silent-rules; then
+		if ___eapi_econf_passes_--disable-dependency-tracking || ___eapi_econf_passes_--disable-silent-rules || ___eapi_econf_passes_--docdir_and_--htmldir; then
 			local conf_help=$("${ECONF_SOURCE}/configure" --help 2>/dev/null)
 
 			if ___eapi_econf_passes_--disable-dependency-tracking; then
@@ -536,6 +536,16 @@ econf() {
 					conf_args+=( --disable-silent-rules )
 				fi
 			fi
+
+			if ___eapi_econf_passes_--docdir_and_--htmldir; then
+				if [[ ${conf_help} == *--docdir* ]]; then
+					conf_args+=( --docdir="${EPREFIX}"/usr/share/doc/${PF} )
+				fi
+
+				if [[ ${conf_help} == *--htmldir* ]]; then
+					conf_args+=( --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html )
+				fi
+			fi
 		fi
 
 		# if the profile defines a location to install libs to aside from default, pass it on.
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 03/13] Add tentative support for EAPI6 get_libdir()
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 01/13] Support EAPI=6_pre1 for testing EAPI6 features Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 02/13] Add tentative support for EAPI6 --docdir and --htmldir Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 04/13] Add tentative support for EAPI6 einstalldocs function Michał Górny
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Add get_libdir() function to obtain the basename of libdir using
the same algorithm that econf uses.
---
 bin/eapi.sh          |  4 ++++
 bin/phase-helpers.sh | 11 +++++++++++
 2 files changed, 15 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 5f96c3b..6ace20d 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -64,6 +64,10 @@ ___eapi_has_usex() {
 	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
 }
 
+___eapi_has_get_libdir() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_has_master_repositories() {
 	[[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
 }
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index c2161f6..8edbc07 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -842,6 +842,17 @@ best_version() {
 	esac
 }
 
+if ___eapi_has_get_libdir; then
+	get_libdir() {
+		local libdir_var="LIBDIR_${ABI}"
+		local libdir="lib"
+
+		[[ -n ${ABI} && -n ${!libdir_var} ]] && libdir=${!libdir_var}
+
+		echo "${libdir}"
+	}
+fi
+
 if ___eapi_has_master_repositories; then
 	master_repositories() {
 		local output repository=$1 retval
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 04/13] Add tentative support for EAPI6 einstalldocs function
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (2 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 03/13] Add tentative support for EAPI6 get_libdir() Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 05/13] Add tentative support for EAPI6 eapply function Michał Górny
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Add the einstalldocs function to conveniently install documentation
using the default patterns or DOCS and HTML_DOCS variables.
---
 bin/eapi.sh          |  4 ++++
 bin/phase-helpers.sh | 22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 6ace20d..978a410 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -68,6 +68,10 @@ ___eapi_has_get_libdir() {
 	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_has_einstalldocs() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_has_master_repositories() {
 	[[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
 }
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 8edbc07..6ccf4f4 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -853,6 +853,28 @@ if ___eapi_has_get_libdir; then
 	}
 fi
 
+if ___eapi_has_einstalldocs; then
+	einstalldocs() {
+		if ! declare -p DOCS &>/dev/null ; then
+			local d
+			for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \
+					THANKS BUGS FAQ CREDITS CHANGELOG ; do
+				[[ -s ${d} ]] && dodoc "${d}"
+			done
+		elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then
+			[[ ${DOCS[@]} ]] && dodoc -r "${DOCS[@]}"
+		else
+			[[ ${DOCS} ]] && dodoc -r ${DOCS}
+		fi
+
+		if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then
+			[[ ${HTML_DOCS[@]} ]] && dohtml -r "${HTML_DOCS[@]}"
+		else
+			[[ ${HTML_DOCS} ]] && dohtml -r ${HTML_DOCS}
+		fi
+	}
+fi
+
 if ___eapi_has_master_repositories; then
 	master_repositories() {
 		local output repository=$1 retval
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 05/13] Add tentative support for EAPI6 eapply function
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (3 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 04/13] Add tentative support for EAPI6 einstalldocs function Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 06/13] Add tentative support for EAPI6 eapply_user function Michał Górny
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Add the eapply patch applying function.
---
 bin/eapi.sh          |  4 ++++
 bin/phase-helpers.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 978a410..8ffffbb 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -72,6 +72,10 @@ ___eapi_has_einstalldocs() {
 	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_has_eapply() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_has_master_repositories() {
 	[[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
 }
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 6ccf4f4..6bd8a12 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -875,6 +875,58 @@ if ___eapi_has_einstalldocs; then
 	}
 fi
 
+if ___eapi_has_eapply; then
+	eapply() {
+		_eapply_patch() {
+			started_applying=1
+			ebegin "Applying ${1#${top_dir}/}"
+			# -p1 as a sane default
+			# -f to avoid interactivity
+			# -s to silence progress output
+			patch -p1 -f -s "${patch_options[@]}" < "${1}"
+			if ! eend ${?}; then
+				__helpers_die "patch -p1 ${patch_options[*]} failed with ${1}"
+				failed=1
+			fi
+		}
+
+		local f patch_options=() failed started_applying options_terminated
+		for f; do
+			local top_dir=${f%/*}
+
+			if [[ ${f} == -* && -z ${options_terminated} ]]; then
+				if [[ -n ${started_applying} ]]; then
+					die "eapply: options need to be specified before files"
+				fi
+				if [[ ${f} == -- ]]; then
+					options_terminated=1
+				else
+					patch_options+=( ${f} )
+				fi
+			elif [[ -d ${f} ]]; then
+				local prev_shopt=$(shopt -p nullglob)
+				shopt -s nullglob
+				local files=( "${f}"/*.{patch,diff} )
+				${prev_shopt}
+
+				[[ -z ${files[@]} ]] && die "No *.{patch,diff} files in directory ${f}"
+
+				local f2
+				for f2 in "${files[@]}"; do
+					_eapply_patch "${f2}"
+				done
+			else
+				_eapply_patch "${f}"
+			fi
+
+			# in case of nonfatal
+			[[ -n ${failed} ]] && return 1
+		done
+
+		return 0
+	}
+fi
+
 if ___eapi_has_master_repositories; then
 	master_repositories() {
 		local output repository=$1 retval
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 06/13] Add tentative support for EAPI6 eapply_user function
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (4 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 05/13] Add tentative support for EAPI6 eapply function Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 07/13] Enable tentative EAPI6 failglob in global scope Michał Górny
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Add support for the user patch applying function.
---
 bin/eapi.sh          |  4 ++++
 bin/phase-helpers.sh | 22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 8ffffbb..6e78750 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -76,6 +76,10 @@ ___eapi_has_eapply() {
 	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_has_eapply_user() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_has_master_repositories() {
 	[[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
 }
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 6bd8a12..49b5547 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -927,6 +927,28 @@ if ___eapi_has_eapply; then
 	}
 fi
 
+if ___eapi_has_eapply_user; then
+	eapply_user() {
+		local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches
+
+		local d applied
+		# possibilities:
+		# 1. ${CATEGORY}/${P}-${PR} (note: -r0 desired to avoid applying
+		#    ${P} twice)
+		# 2. ${CATEGORY}/${P}
+		# 3. ${CATEGORY}/${PN}
+		# all of the above may be optionally followed by a slot
+		for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT%/*}}; do
+			if [[ -d ${d} ]]; then
+				[[ -z ${applied} ]] && einfo "Applying user patches ..."
+				eapply "${d}"
+			fi
+		done
+
+		[[ -n ${applied} ]] && einfo "User patches applied."
+	}
+fi
+
 if ___eapi_has_master_repositories; then
 	master_repositories() {
 		local output repository=$1 retval
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 07/13] Enable tentative EAPI6 failglob in global scope
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (5 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 06/13] Add tentative support for EAPI6 eapply_user function Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 08/13] Enable tentative support for EAPI6 profile-level directories Michał Górny
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Enable failglob in global scope to catch unintended globbing attempts
including unescaped special uses of '*'.
---
 bin/eapi.sh   |  4 ++++
 bin/ebuild.sh | 11 +++++++++++
 2 files changed, 15 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 6e78750..fa57999 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -160,6 +160,10 @@ ___eapi_unpack_is_case_sensitive() {
 
 # OTHERS
 
+___eapi_enables_failglob_in_global_scope() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_enables_globstar() {
 	[[ ${1-${EAPI}} =~ ^(4-python|5-progress)$ ]]
 }
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index be044e0..167ea4c 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -533,6 +533,13 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 		# we make a backup copy for QA checks.
 		__INHERITED_QA_CACHE=$INHERITED
 
+		# Catch failed globbing attempts in case ebuild writer forgot to
+		# escape '*' or likes.
+		# Note: this needs to be done before unsetting EAPI.
+		if ___eapi_enables_failglob_in_global_scope; then
+			shopt -s failglob
+		fi
+
 		# *DEPEND and IUSE will be set during the sourcing of the ebuild.
 		# In order to ensure correct interaction between ebuilds and
 		# eclasses, they need to be unset before this process of
@@ -549,6 +556,10 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 			set +x
 		fi
 
+		if ___eapi_enables_failglob_in_global_scope; then
+			shopt -u failglob
+		fi
+
 		if [[ "${EBUILD_PHASE}" != "depend" ]] ; then
 			RESTRICT=${PORTAGE_RESTRICT}
 			[[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 08/13] Enable tentative support for EAPI6 profile-level directories
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (6 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 07/13] Enable tentative EAPI6 failglob in global scope Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 09/13] Add tentative EAPI6 .txz unpack support Michał Górny
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Enable the support for package.* and use.* directories on profile and
repository level.
---
 pym/portage/eapi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index 4f77910..7217d23 100644
--- a/pym/portage/eapi.py
+++ b/pym/portage/eapi.py
@@ -81,7 +81,7 @@ def eapi_supports_stable_use_forcing_and_masking(eapi):
 	return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi")
 
 def eapi_allows_directories_on_profile_level_and_repository_level(eapi):
-	return eapi in ("4-python", "5-progress")
+	return eapi not in ("0", "1", "2", "3", "4", "4-slot-abi", "5")
 
 def eapi_has_use_aliases(eapi):
 	return eapi in ("4-python", "5-progress")
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 09/13] Add tentative EAPI6 .txz unpack support
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (7 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 08/13] Enable tentative support for EAPI6 profile-level directories Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 10/13] Add tentative EAPI6 absolute path support to unpack() Michał Górny
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Support unpacking .txz-suffixed archives.
---
 bin/eapi.sh          |  4 ++++
 bin/phase-helpers.sh | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index fa57999..878f8e7 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -118,6 +118,10 @@ ___eapi_unpack_supports_xz() {
 	[[ ! ${1-${EAPI}} =~ ^(0|1|2)$ ]]
 }
 
+___eapi_unpack_supports_txz() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_econf_passes_--disable-dependency-tracking() {
 	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
 }
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 49b5547..0be79fd 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -456,6 +456,19 @@ unpack() {
 					__vecho "unpack ${x}: file format not recognized. Ignoring."
 				fi
 				;;
+			txz)
+				if ___eapi_unpack_is_case_sensitive && \
+					[[ " txz " != *" ${suffix} "* ]] ; then
+					eqawarn "QA Notice: unpack called with" \
+						"suffix '${suffix}' which is unofficially supported" \
+						"with EAPI '${EAPI}'. Instead use 'txz'."
+				fi
+				if ___eapi_supports_txz; then
+					tar xoJf "$srcdir$x" || die "$myfail"
+				else
+					__vecho "unpack ${x}: file format not recognized. Ignoring."
+				fi
+				;;
 			*)
 				__vecho "unpack ${x}: file format not recognized. Ignoring."
 				;;
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 10/13] Add tentative EAPI6 absolute path support to unpack()
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (8 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 09/13] Add tentative EAPI6 .txz unpack support Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 11/13] Add tentative EAPI6 nonfatal support to die() Michał Górny
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Add support for absolute paths in unpack(). Allow subdirectory-level
relative paths not to start with './'.
---
 bin/eapi.sh          |  4 ++++
 bin/phase-helpers.sh | 25 ++++++++++++++++++-------
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 878f8e7..6716b1c 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -162,6 +162,10 @@ ___eapi_unpack_is_case_sensitive() {
 	[[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]]
 }
 
+___eapi_unpack_supports_absolute_paths() {
+	[[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]]
+}
+
 # OTHERS
 
 ___eapi_enables_failglob_in_global_scope() {
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 0be79fd..60f7a39 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -276,14 +276,25 @@ unpack() {
 		y=${y##*.}
 		y_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${y}")
 
-		if [[ ${x} == "./"* ]] ; then
-			srcdir=""
-		elif [[ ${x} == ${DISTDIR%/}/* ]] ; then
-			die "Arguments to unpack() cannot begin with \${DISTDIR}."
-		elif [[ ${x} == "/"* ]] ; then
-			die "Arguments to unpack() cannot be absolute"
+		# wrt PMS 11.3.3.13 Misc Commands
+		if [[ ${x} != */* ]]; then
+			# filename without path of any kind
+			srcdir=${DISTDIR}/
+		elif [[ ${x} == ./* ]]; then
+			# relative path starting with './'
+			srcdir=
 		else
-			srcdir="${DISTDIR}/"
+			# non-'./' filename with path of some kind
+			if ___eapi_unpack_supports_absolute_paths; then
+				# EAPI 6 allows absolute and deep relative paths
+				srcdir=
+			elif [[ ${x} == ${DISTDIR%/}/* ]]; then
+				die "Arguments to unpack() cannot begin with \${DISTDIR} in EAPI ${EAPI}"
+			elif [[ ${x} == /* ]] ; then
+				die "Arguments to unpack() cannot be absolute in EAPI ${EAPI}"
+			else
+				die "Relative paths to unpack() must be prefixed with './' in EAPI ${EAPI}"
+			fi
 		fi
 		[[ ! -s ${srcdir}${x} ]] && die "${x} does not exist"
 
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 11/13] Add tentative EAPI6 nonfatal support to die()
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (9 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 10/13] Add tentative EAPI6 absolute path support to unpack() Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 12/13] Add tentative EAPI6 in_iuse() function Michał Górny
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Add support for die() to respect 'nonfatal' modifier if
'--respect-nonfatal' (or '-n') option is used. This allows eclasses
to create custom ebuild helpers that mimic built-in helper behavior.
---
 bin/eapi.sh               | 4 ++++
 bin/isolated-functions.sh | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 6716b1c..c650a4c 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -166,6 +166,10 @@ ___eapi_unpack_supports_absolute_paths() {
 	[[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]]
 }
 
+___eapi_die_can_respect_nonfatal() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 # OTHERS
 
 ___eapi_enables_failglob_in_global_scope() {
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index d41f0b3..f9bc90d 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -116,6 +116,13 @@ __helpers_die() {
 die() {
 	local IFS=$' \t\n'
 
+	if ___eapi_die_can_respect_nonfatal; then
+		if [[ ${1} == -n || ${1} == --respect-nonfatal ]]; then
+			[[ ${PORTAGE_NONFATAL} == 1 ]] && return 1
+			shift
+		fi
+	fi
+
 	set +e
 	if [ -n "${QA_INTERCEPTORS}" ] ; then
 		# die was called from inside inherit. We need to clean up
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 12/13] Add tentative EAPI6 in_iuse() function
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (10 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 11/13] Add tentative EAPI6 nonfatal support to die() Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 13/13] Add tentative EAPI6 phase functions Michał Górny
  2014-12-02  8:30 ` [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Add a function to query IUSE_EFFECTIVE for flags.
---
 bin/eapi.sh                            |  4 ++++
 bin/phase-helpers.sh                   | 16 ++++++++++++++++
 pym/portage/eapi.py                    |  3 +++
 pym/portage/package/ebuild/doebuild.py |  2 +-
 4 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index c650a4c..e0ade02 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -80,6 +80,10 @@ ___eapi_has_eapply_user() {
 	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_has_in_iuse() {
+	[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_has_master_repositories() {
 	[[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
 }
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 60f7a39..2eada2f 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -973,6 +973,22 @@ if ___eapi_has_eapply_user; then
 	}
 fi
 
+if ___eapi_has_in_iuse; then
+	in_iuse() {
+		local use=${1}
+
+		if [[ -z "${use}" ]]; then
+			echo "!!! in_iuse() called without a parameter." >&2
+			echo "!!! in_iuse <USEFLAG>" >&2
+			die "in_iuse() called without a parameter"
+		fi
+
+		local liuse=( ${IUSE_EFFECTIVE} )
+
+		has "${use}" "${liuse[@]#[+-]}"
+	}
+fi
+
 if ___eapi_has_master_repositories; then
 	master_repositories() {
 		local output repository=$1 retval
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index 7217d23..386c81d 100644
--- a/pym/portage/eapi.py
+++ b/pym/portage/eapi.py
@@ -68,6 +68,9 @@ def eapi_has_required_use_at_most_one_of(eapi):
 def eapi_has_use_dep_defaults(eapi):
 	return eapi not in ("0", "1", "2", "3")
 
+def eapi_has_in_iuse(eapi):
+	return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi", "5", "5-progress")
+
 def eapi_has_repo_deps(eapi):
 	return eapi in ("4-python", "5-progress")
 
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 01707ae..29fb0df 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -54,7 +54,7 @@ from portage.dep import Atom, check_required_use, \
 from portage.eapi import eapi_exports_KV, eapi_exports_merge_type, \
 	eapi_exports_replace_vars, eapi_exports_REPOSITORY, \
 	eapi_has_required_use, eapi_has_src_prepare_and_src_configure, \
-	eapi_has_pkg_pretend, _get_eapi_attrs
+	eapi_has_pkg_pretend, _get_eapi_attrs, eapi_has_in_iuse
 from portage.elog import elog_process, _preload_elog_modules
 from portage.elog.messages import eerror, eqawarn
 from portage.exception import DigestException, FileNotFound, \
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-portage-dev] [PATCH 13/13] Add tentative EAPI6 phase functions
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (11 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 12/13] Add tentative EAPI6 in_iuse() function Michał Górny
@ 2014-08-18 17:56 ` Michał Górny
  2014-12-02  8:30 ` [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

---
 bin/phase-functions.sh | 11 +++++++++++
 bin/phase-helpers.sh   | 18 ++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index b7fb5d7..f2088bd 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -806,6 +806,17 @@ __ebuild_phase_funcs() {
 				declare -F src_install >/dev/null || \
 					src_install() { default; }
 			fi
+
+			# defaults starting with EAPI 6
+			if ! has ${eapi} 2 3 4 4-python 4-slot-abi 5 5-progress 5-hdepend; then
+				[[ ${phase_func} == src_prepare ]] && \
+					default_src_prepare() { __eapi6_src_prepare; }
+				[[ ${phase_func} == src_install ]] && \
+					default_src_install() { __eapi6_src_install; }
+
+				declare -F src_prepare >/dev/null || \
+					src_prepare() { default; }
+			fi
 			;;
 	esac
 }
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 2eada2f..e64fe8b 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -748,6 +748,24 @@ __eapi4_src_install() {
 	fi
 }
 
+__eapi6_src_prepare() {
+	if [[ $(declare -p PATCHES) == "declare -a "* ]]; then
+		eapply "${PATCHES[@]}"
+	elif [[ -n ${PATCHES} ]]; then
+		eapply ${PATCHES}
+	fi
+
+	eapply_user
+}
+
+__eapi6_src_install() {
+	if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then
+		emake DESTDIR="${D}" install
+	fi
+
+	einstalldocs
+}
+
 # @FUNCTION: has_version
 # @USAGE: [--host-root] <DEPEND ATOM>
 # @DESCRIPTION:
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review
  2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
                   ` (12 preceding siblings ...)
  2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 13/13] Add tentative EAPI6 phase functions Michał Górny
@ 2014-12-02  8:30 ` Michał Górny
  13 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2014-12-02  8:30 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

Dnia 2014-08-18, o godz. 19:56:39
Michał Górny <mgorny@gentoo.org> napisał(a):

> Here are my patches drafting the first implementations of various parts
> of EAPI6, based on top of my cleaned up portage base (see the previous
> patch serie).
> 
> Unless I've missed something, it includes all Council-approved items
> except for runtime USE, and additionally --docdir and --htmldir. Please
> review, comment and possibly test.

Replaced by 'Updated EAPI 6 patch set':
http://thread.gmane.org/gmane.linux.gentoo.portage.devel/4870

-- 
Best regards,
Michał Górny

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-12-02  8:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 01/13] Support EAPI=6_pre1 for testing EAPI6 features Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 02/13] Add tentative support for EAPI6 --docdir and --htmldir Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 03/13] Add tentative support for EAPI6 get_libdir() Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 04/13] Add tentative support for EAPI6 einstalldocs function Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 05/13] Add tentative support for EAPI6 eapply function Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 06/13] Add tentative support for EAPI6 eapply_user function Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 07/13] Enable tentative EAPI6 failglob in global scope Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 08/13] Enable tentative support for EAPI6 profile-level directories Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 09/13] Add tentative EAPI6 .txz unpack support Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 10/13] Add tentative EAPI6 absolute path support to unpack() Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 11/13] Add tentative EAPI6 nonfatal support to die() Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 12/13] Add tentative EAPI6 in_iuse() function Michał Górny
2014-08-18 17:56 ` [gentoo-portage-dev] [PATCH 13/13] Add tentative EAPI6 phase functions Michał Górny
2014-12-02  8:30 ` [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox