public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474)
@ 2017-10-26  6:16 Zac Medico
  2017-10-26 17:12 ` [gentoo-portage-dev] [PATCH 2/2] postinst-qa-check.d: fix parallel-install to skip QA Noticre Zac Medico
  2017-10-26 19:31 ` [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474) Michał Górny
  0 siblings, 2 replies; 4+ messages in thread
From: Zac Medico @ 2017-10-26  6:16 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

In order to prevent false-positives during postinst_qa_check,
use a preinst_qa_check function to initialize a baseline state
for the postinst checks.

Bug: https://bugs.gentoo.org/635474
---
 bin/misc-functions.sh                  | 18 +++++++++++-------
 bin/postinst-qa-check.d/50gnome2-utils |  3 +++
 bin/postinst-qa-check.d/50xdg-utils    |  6 ++++++
 bin/preinst-qa-check.d/50gnome2-utils  |  1 +
 bin/preinst-qa-check.d/50xdg-utils     |  1 +
 pym/portage/package/ebuild/doebuild.py |  1 +
 6 files changed, 23 insertions(+), 7 deletions(-)
 create mode 120000 bin/preinst-qa-check.d/50gnome2-utils
 create mode 120000 bin/preinst-qa-check.d/50xdg-utils

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index b0506bde7..a02aa3bfd 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -256,8 +256,12 @@ install_qa_check() {
 	rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!"
 }
 
+preinst_qa_check() {
+	postinst_qa_check preinst
+}
+
 postinst_qa_check() {
-	local d f paths qa_checks=()
+	local d f paths qa_checks=() PORTAGE_QA_PHASE=${1:-postinst}
 	if ! ___eapi_has_prefix_variables; then
 		local EPREFIX= EROOT=${ROOT}
 	fi
@@ -267,23 +271,23 @@ postinst_qa_check() {
 	# Collect the paths for QA checks, highest prio first.
 	paths=(
 		# sysadmin overrides
-		"${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/postinst-qa-check.d
+		"${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/${PORTAGE_QA_PHASE}-qa-check.d
 		# system-wide package installs
-		"${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/postinst-qa-check.d
+		"${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/${PORTAGE_QA_PHASE}-qa-check.d
 	)
 
 	# Now repo-specific checks.
 	# (yes, PORTAGE_ECLASS_LOCATIONS contains repo paths...)
 	for d in "${PORTAGE_ECLASS_LOCATIONS[@]}"; do
 		paths+=(
-			"${d}"/metadata/postinst-qa-check.d
+			"${d}"/metadata/${PORTAGE_QA_PHASE}-qa-check.d
 		)
 	done
 
 	paths+=(
 		# Portage built-in checks
-		"${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/postinst-qa-check.d
-		"${PORTAGE_BIN_PATH}"/postinst-qa-check.d
+		"${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/${PORTAGE_QA_PHASE}-qa-check.d
+		"${PORTAGE_BIN_PATH}"/${PORTAGE_QA_PHASE}-qa-check.d
 	)
 
 	# Collect file names of QA checks. We need them early to support
@@ -308,7 +312,7 @@ postinst_qa_check() {
 			# Allow inheriting eclasses.
 			# XXX: we want this only in repository-wide checks.
 			_IN_INSTALL_QA_CHECK=1
-			source "${d}/${f}" || eerror "Post-postinst QA check ${f} failed to run"
+			source "${d}/${f}" || eerror "Post-${PORTAGE_QA_PHASE} QA check ${f} failed to run"
 		)
 	done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z)
 }
diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index 7f1b0b847..80360cf64 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -33,6 +33,9 @@ gnome2_icon_cache_check() {
 		fi
 	done
 
+	# preinst initializes the baseline state for the posinst check
+	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
+
 	# The eqatag call is prohibitively expensive if the cache is
 	# missing and there are a large number of files.
 	if [[ -z ${missing} && ${all_files[@]} ]]; then
diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index d1285caf4..84f938abd 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -29,6 +29,9 @@ xdg_desktop_database_check() {
 		fi
 	done
 
+	# preinst initializes the baseline state for the posinst check
+	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
+
 	# The eqatag call is prohibitively expensive if the cache is
 	# missing and there are a large number of files.
 	if [[ -z ${missing} && ${all_files[@]} ]]; then
@@ -66,6 +69,9 @@ xdg_mimeinfo_database_check() {
 		fi
 	done
 
+	# preinst initializes the baseline state for the posinst check
+	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
+
 	# The eqatag call is prohibitively expensive if the cache is
 	# missing and there are a large number of files.
 	if [[ -z ${missing} && ${all_files[@]} ]]; then
diff --git a/bin/preinst-qa-check.d/50gnome2-utils b/bin/preinst-qa-check.d/50gnome2-utils
new file mode 120000
index 000000000..ee57f814d
--- /dev/null
+++ b/bin/preinst-qa-check.d/50gnome2-utils
@@ -0,0 +1 @@
+../postinst-qa-check.d/50gnome2-utils
\ No newline at end of file
diff --git a/bin/preinst-qa-check.d/50xdg-utils b/bin/preinst-qa-check.d/50xdg-utils
new file mode 120000
index 000000000..16f68a471
--- /dev/null
+++ b/bin/preinst-qa-check.d/50xdg-utils
@@ -0,0 +1 @@
+../postinst-qa-check.d/50xdg-utils
\ No newline at end of file
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index ac697a763..66e63b919 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1738,6 +1738,7 @@ _post_phase_cmds = {
 		"preinst_sfperms",
 		"preinst_selinux_labels",
 		"preinst_suid_scan",
+		"preinst_qa_check",
 		],
 
 	"postinst" : [
-- 
2.13.5



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

* [gentoo-portage-dev] [PATCH 2/2] postinst-qa-check.d: fix parallel-install to skip QA Noticre
  2017-10-26  6:16 [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474) Zac Medico
@ 2017-10-26 17:12 ` Zac Medico
  2017-10-26 19:31 ` [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474) Michał Górny
  1 sibling, 0 replies; 4+ messages in thread
From: Zac Medico @ 2017-10-26 17:12 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

---
 bin/postinst-qa-check.d/50gnome2-utils | 3 +++
 bin/postinst-qa-check.d/50xdg-utils    | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index 80360cf64..dacc19a43 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -36,6 +36,9 @@ gnome2_icon_cache_check() {
 	# preinst initializes the baseline state for the posinst check
 	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
 
+	# parallel-install makes it impossible to blame a specific package
+	has parallel-install ${FEATURES} && return
+
 	# The eqatag call is prohibitively expensive if the cache is
 	# missing and there are a large number of files.
 	if [[ -z ${missing} && ${all_files[@]} ]]; then
diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index 84f938abd..7094e75a1 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -32,6 +32,9 @@ xdg_desktop_database_check() {
 	# preinst initializes the baseline state for the posinst check
 	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
 
+	# parallel-install makes it impossible to blame a specific package
+	has parallel-install ${FEATURES} && return
+
 	# The eqatag call is prohibitively expensive if the cache is
 	# missing and there are a large number of files.
 	if [[ -z ${missing} && ${all_files[@]} ]]; then
@@ -72,6 +75,9 @@ xdg_mimeinfo_database_check() {
 	# preinst initializes the baseline state for the posinst check
 	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
 
+	# parallel-install makes it impossible to blame a specific package
+	has parallel-install ${FEATURES} && return
+
 	# The eqatag call is prohibitively expensive if the cache is
 	# missing and there are a large number of files.
 	if [[ -z ${missing} && ${all_files[@]} ]]; then
-- 
2.13.5



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

* Re: [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474)
  2017-10-26  6:16 [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474) Zac Medico
  2017-10-26 17:12 ` [gentoo-portage-dev] [PATCH 2/2] postinst-qa-check.d: fix parallel-install to skip QA Noticre Zac Medico
@ 2017-10-26 19:31 ` Michał Górny
  2017-10-26 20:06   ` Zac Medico
  1 sibling, 1 reply; 4+ messages in thread
From: Michał Górny @ 2017-10-26 19:31 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

W dniu śro, 25.10.2017 o godzinie 23∶16 -0700, użytkownik Zac Medico
napisał:
> In order to prevent false-positives during postinst_qa_check,
> use a preinst_qa_check function to initialize a baseline state
> for the postinst checks.
> 
> Bug: https://bugs.gentoo.org/635474
> ---
>  bin/misc-functions.sh                  | 18 +++++++++++-------
>  bin/postinst-qa-check.d/50gnome2-utils |  3 +++
>  bin/postinst-qa-check.d/50xdg-utils    |  6 ++++++
>  bin/preinst-qa-check.d/50gnome2-utils  |  1 +
>  bin/preinst-qa-check.d/50xdg-utils     |  1 +
>  pym/portage/package/ebuild/doebuild.py |  1 +
>  6 files changed, 23 insertions(+), 7 deletions(-)
>  create mode 120000 bin/preinst-qa-check.d/50gnome2-utils
>  create mode 120000 bin/preinst-qa-check.d/50xdg-utils
> 

To be honest, I think that's a serious overkill for a minor issue.
The same effect could be achieved by adding a small pkg_postinst()
to sys-apps/portage.

-- 
Best regards,
Michał Górny



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

* Re: [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474)
  2017-10-26 19:31 ` [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474) Michał Górny
@ 2017-10-26 20:06   ` Zac Medico
  0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2017-10-26 20:06 UTC (permalink / raw
  To: Michał Górny, gentoo-portage-dev; +Cc: Zac Medico

On 10/26/2017 12:31 PM, Michał Górny wrote:
> W dniu śro, 25.10.2017 o godzinie 23∶16 -0700, użytkownik Zac Medico
> napisał:
>> In order to prevent false-positives during postinst_qa_check,
>> use a preinst_qa_check function to initialize a baseline state
>> for the postinst checks.
>>
>> Bug: https://bugs.gentoo.org/635474
>> ---
>>  bin/misc-functions.sh                  | 18 +++++++++++-------
>>  bin/postinst-qa-check.d/50gnome2-utils |  3 +++
>>  bin/postinst-qa-check.d/50xdg-utils    |  6 ++++++
>>  bin/preinst-qa-check.d/50gnome2-utils  |  1 +
>>  bin/preinst-qa-check.d/50xdg-utils     |  1 +
>>  pym/portage/package/ebuild/doebuild.py |  1 +
>>  6 files changed, 23 insertions(+), 7 deletions(-)
>>  create mode 120000 bin/preinst-qa-check.d/50gnome2-utils
>>  create mode 120000 bin/preinst-qa-check.d/50xdg-utils
>>
> 
> To be honest, I think that's a serious overkill for a minor issue.
> The same effect could be achieved by adding a small pkg_postinst()
> to sys-apps/portage.

However, that's not going to help if all the ctimes get bumped due to
the rootfs being cloned somehow (via tar or rsync), and having it hang
in eqatag for hours is completely unacceptable.
-- 
Thanks,
Zac


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

end of thread, other threads:[~2017-10-26 20:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26  6:16 [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474) Zac Medico
2017-10-26 17:12 ` [gentoo-portage-dev] [PATCH 2/2] postinst-qa-check.d: fix parallel-install to skip QA Noticre Zac Medico
2017-10-26 19:31 ` [gentoo-portage-dev] [PATCH] postinst_qa_check: initialize preinst state (bug 635474) Michał Górny
2017-10-26 20:06   ` Zac Medico

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