public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH autotools-multilib] Check installed headers for consistency.
@ 2013-01-27 11:21 Michał Górny
  2013-01-27 12:44 ` Alexis Ballier
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2013-01-27 11:21 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

The installed headers are supposed not to change between ABIs. If they
do, we need to do something special about them or everything is going to
end up real bad.

Therefore, do a checksum of headers installed in /usr/include after each ABI's
src_install() and die if they don't match.
---
 gx86/eclass/autotools-multilib.eclass | 36 ++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/gx86/eclass/autotools-multilib.eclass b/gx86/eclass/autotools-multilib.eclass
index 90f7bee..4cd5242 100644
--- a/gx86/eclass/autotools-multilib.eclass
+++ b/gx86/eclass/autotools-multilib.eclass
@@ -120,5 +120,39 @@ autotools-multilib_src_test() {
 }
 
 autotools-multilib_src_install() {
-	autotools-multilib_foreach_abi autotools-utils_src_install
+	autotools-multilib_secure_install() {
+		autotools-utils_src_install
+
+		# Make sure all headers are the same for each ABI.
+		autotools-multilib_cksum() {
+			find "${ED}"usr/include -type f \
+				-exec cksum {} + | sort -k2
+		}
+
+		local cksum=$(autotools-multilib_cksum)
+		local cksum_file=${T}/.autotools-multilib_cksum
+
+		if [[ -f ${cksum_file} ]]; then
+			local cksum_prev=$(< "${cksum_file}")
+
+			if [[ ${cksum} != ${cksum_prev} ]]; then
+				echo "${cksum}" > "${cksum_file}.new"
+
+				eerror "Header files have changed between ABIs."
+
+				if type -p diff &>/dev/null; then
+					eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")"
+				else
+					eerror "Old checksums in: ${cksum_file}"
+					eerror "New checksums in: ${cksum_file}.new"
+				fi
+
+				die "Header checksum mismatch, aborting."
+			fi
+		else
+			echo "${cksum}" > "${cksum_file}"
+		fi
+	}
+
+	autotools-multilib_foreach_abi autotools-multilib_secure_install
 }
-- 
1.8.1.1



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

* Re: [gentoo-dev] [PATCH autotools-multilib] Check installed headers for consistency.
  2013-01-27 11:21 [gentoo-dev] [PATCH autotools-multilib] Check installed headers for consistency Michał Górny
@ 2013-01-27 12:44 ` Alexis Ballier
  2013-01-27 13:02   ` Michał Górny
  0 siblings, 1 reply; 3+ messages in thread
From: Alexis Ballier @ 2013-01-27 12:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: mgorny

On Sun, 27 Jan 2013 12:21:01 +0100
Michał Górny <mgorny@gentoo.org> wrote:

> The installed headers are supposed not to change between ABIs. If they
> do, we need to do something special about them or everything is going
> to end up real bad.
> 
> Therefore, do a checksum of headers installed in /usr/include after
> each ABI's src_install() and die if they don't match.

sounds a bit restrictive IMHO, but such a kind of check is probably
necessary and has to be added before the eclass is widespread.
you could probably add a way to disable those checks for the
hypothetical case there is a false positive (ie: yes the headers
differ but it doesn't matter).

Alexis.


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

* Re: [gentoo-dev] [PATCH autotools-multilib] Check installed headers for consistency.
  2013-01-27 12:44 ` Alexis Ballier
@ 2013-01-27 13:02   ` Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2013-01-27 13:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: aballier

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

On Sun, 27 Jan 2013 09:44:23 -0300
Alexis Ballier <aballier@gentoo.org> wrote:

> On Sun, 27 Jan 2013 12:21:01 +0100
> Michał Górny <mgorny@gentoo.org> wrote:
> 
> > The installed headers are supposed not to change between ABIs. If they
> > do, we need to do something special about them or everything is going
> > to end up real bad.
> > 
> > Therefore, do a checksum of headers installed in /usr/include after
> > each ABI's src_install() and die if they don't match.
> 
> sounds a bit restrictive IMHO, but such a kind of check is probably
> necessary and has to be added before the eclass is widespread.
> you could probably add a way to disable those checks for the
> hypothetical case there is a false positive (ie: yes the headers
> differ but it doesn't matter).

Well, since this is eclass and not the PMS, we can add it anytime when
it becomes really necessary ;).

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

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

end of thread, other threads:[~2013-01-27 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-27 11:21 [gentoo-dev] [PATCH autotools-multilib] Check installed headers for consistency Michał Górny
2013-01-27 12:44 ` Alexis Ballier
2013-01-27 13:02   ` 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