All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Add Xorg driver ABI dependencies
@ 2012-10-22  9:37 Ross Burton
  2012-10-22  9:37 ` [PATCH 1/3] xserver-xorg: add runtime provides for the driver ABI version Ross Burton
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ross Burton @ 2012-10-22  9:37 UTC (permalink / raw)
  To: openembedded-core

Hi,

The xserver driver ABIs frequently change and as such are versioned.  It's
entirely possible to build an image with an Xserver with ABI 13 but drivers
using ABI 11, and in this situation the server won't load the modules.  These
ABI versions have no relationship to the package version so the existing
dependencies can't be made stricter.

The solution Debian (and probably others) take is to add versioned Provides to
the server, and dependencies on those provides in the drivers.  Then ABI version
mismatches become package dependencies errors and are caught at image
construction time, not boot time.

Ross

The following changes since commit caba9cbfce09f19eb27f4c6615c0c5c48e1a2952:

  kernel.bbclass: add kernel-modules to PACKAGES (2012-10-19 23:06:26 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib ross/xorg

for you to fetch changes up to 4bb20610fa08a2daf71f59b42929181500345e75:

  insane: add a check for Xorg driver ABI dependencies (2012-10-22 09:26:20 +0100)

----------------------------------------------------------------
Ross Burton (3):
      xserver-xorg: add runtime provides for the driver ABI version
      xorg-driver: add xserver driver ABI dependencies
      insane: add a check for Xorg driver ABI dependencies

 meta/classes/insane.bbclass                        |   20 ++++++++++++++-
 .../xorg-driver/xorg-driver-common.inc             |   17 +++++++++++-
 .../xorg-driver/xorg-driver-input.inc              |    4 +++
 .../xorg-driver/xorg-driver-video.inc              |    3 +++
 .../recipes-graphics/xorg-xserver/xserver-xorg.inc |   27 +++++++++++++++++++-
 5 files changed, 68 insertions(+), 3 deletions(-)

Ross Burton (3):
  xserver-xorg: add runtime provides for the driver ABI version
  xorg-driver: add xserver driver ABI dependencies
  insane: add a check for Xorg driver ABI dependencies

 meta/classes/insane.bbclass                        |   20 ++++++++++++++-
 .../xorg-driver/xorg-driver-common.inc             |   17 +++++++++++-
 .../xorg-driver/xorg-driver-input.inc              |    4 +++
 .../xorg-driver/xorg-driver-video.inc              |    3 +++
 .../recipes-graphics/xorg-xserver/xserver-xorg.inc |   27 +++++++++++++++++++-
 5 files changed, 68 insertions(+), 3 deletions(-)

-- 
1.7.10




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

* [PATCH 1/3] xserver-xorg: add runtime provides for the driver ABI version
  2012-10-22  9:37 [PATCH 0/3] Add Xorg driver ABI dependencies Ross Burton
@ 2012-10-22  9:37 ` Ross Burton
  2012-10-22  9:37 ` [PATCH 2/3] xorg-driver: add xserver driver ABI dependencies Ross Burton
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Ross Burton @ 2012-10-22  9:37 UTC (permalink / raw)
  To: openembedded-core

The xserver driver ABIs can and do change in a way that is unrelated to the
version of xserver, so it's entirely possible to build an image that has a
mismatch between the server ABI version and the version that the drivers were
built against.  xserver detects this and refuses to load the modules.

By adding RPROVIDEs to the xserver package that describe the ABI versions it has
(such as xorg-abi-video-13, xorg-abi-input-11), drivers can RDEPEND on the
version that they were built against.  This means that when the ABIs change,
there will be package dependency errors at image time instead of images that
build fine but don't work.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 .../recipes-graphics/xorg-xserver/xserver-xorg.inc |   27 +++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
index 772fa52..c5ce208 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
@@ -13,7 +13,7 @@ PROVIDES = "virtual/xserver-xf86"
 PROVIDES += "virtual/xserver"
 
 PE = "2"
-INC_PR = "r2"
+INC_PR = "r3"
 
 XORG_PN = "xorg-server"
 SRC_URI = "${XORG_MIRROR}/individual/xserver/${XORG_PN}-${PV}.tar.bz2"
@@ -132,3 +132,28 @@ do_install_append () {
 	# Its assumed base-files creates this for us
 	rmdir ${D}${localstatedir}/log/
 }
+
+# Add runtime provides for the ABI versions of the video and input subsystems,
+# so that drivers can depend on the relevant version.
+python populate_packages_prepend() {
+    import subprocess
+
+    # Set PKG_CONFIG_PATH so pkg-config looks at the .pc files that are going
+    # into the new package, not the staged ones.
+    newenv = dict(os.environ)
+    newenv["PKG_CONFIG_PATH"] = d.expand("${PKGD}${libdir}/pkgconfig/")
+
+    def get_abi(name):
+        abis = {
+          "video": "abi_videodrv",
+          "input": "abi_xinput"
+        }
+        p = subprocess.Popen(args="pkg-config --variable=%s xorg-server" % abis[name],
+                             shell=True, env=newenv, stdout=subprocess.PIPE)
+        output = p.communicate()[0]
+        return "xorg-abi-%s-%s" % (name, output.split(".")[0])
+
+    pn = d.getVar("PN", True)
+    d.appendVar("RPROVIDES_" + pn, " " + get_abi("input"))
+    d.appendVar("RPROVIDES_" + pn, " " + get_abi("video"))
+}
-- 
1.7.10




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

* [PATCH 2/3] xorg-driver: add xserver driver ABI dependencies
  2012-10-22  9:37 [PATCH 0/3] Add Xorg driver ABI dependencies Ross Burton
  2012-10-22  9:37 ` [PATCH 1/3] xserver-xorg: add runtime provides for the driver ABI version Ross Burton
@ 2012-10-22  9:37 ` Ross Burton
  2012-10-22  9:37 ` [PATCH 3/3] insane: add a check for Xorg " Ross Burton
  2012-10-23 18:53 ` [PATCH 0/3] Add " Saul Wold
  3 siblings, 0 replies; 6+ messages in thread
From: Ross Burton @ 2012-10-22  9:37 UTC (permalink / raw)
  To: openembedded-core

At build time extract the xserver driver ABI versions that we're building
against and add RDEPENDs on them, so the driver isn't used against an xserver
with a different ABI (which won't work).

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 .../xorg-driver/xorg-driver-common.inc                |   17 ++++++++++++++++-
 .../xorg-driver/xorg-driver-input.inc                 |    4 ++++
 .../xorg-driver/xorg-driver-video.inc                 |    3 +++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-graphics/xorg-driver/xorg-driver-common.inc b/meta/recipes-graphics/xorg-driver/xorg-driver-common.inc
index 9a474b7..f9f25ff 100644
--- a/meta/recipes-graphics/xorg-driver/xorg-driver-common.inc
+++ b/meta/recipes-graphics/xorg-driver/xorg-driver-common.inc
@@ -5,7 +5,7 @@ SECTION = "x11/drivers"
 LICENSE = "MIT-X"
 
 PE = "2"
-INC_PR = "r17"
+INC_PR = "r18"
 
 DEPENDS = "virtual/xserver xproto randrproto util-macros"
 
@@ -31,3 +31,18 @@ do_configure_prepend () {
 do_install_append() {
 	find ${D}${libdir}/xorg/modules -regex ".*\.la$" | xargs rm -f --
 }
+
+# Function to add the relevant ABI dependency to drivers, which should be called
+# from a populate_packages append/prepend.
+def add_abi_depends(d, name):
+    # Map of ABI names exposed in the dependencies to pkg-config variables
+    abis = {
+      "video": "abi_videodrv",
+      "input": "abi_xinput"
+    }
+
+    output = os.popen("pkg-config xorg-server --variable=%s" % abis[name]).read()
+    abi = "xorg-abi-%s-%s" % (name, output.split(".")[0])
+
+    pn = d.getVar("PN", True)
+    d.appendVar('RDEPENDS_' + pn, ' ' + abi)
diff --git a/meta/recipes-graphics/xorg-driver/xorg-driver-input.inc b/meta/recipes-graphics/xorg-driver/xorg-driver-input.inc
index bf4ca6c..a544d71 100644
--- a/meta/recipes-graphics/xorg-driver/xorg-driver-input.inc
+++ b/meta/recipes-graphics/xorg-driver/xorg-driver-input.inc
@@ -2,5 +2,9 @@ include xorg-driver-common.inc
 
 DEPENDS += "inputproto kbproto "
 
+python populate_packages_prepend() {
+    add_abi_depends(d, "input")
+}
+
 FILES_${PN} += " ${libdir}/xorg/modules/input/*.so"
 FILES_${PN}-dbg += " ${libdir}/xorg/modules/input/.debug"
diff --git a/meta/recipes-graphics/xorg-driver/xorg-driver-video.inc b/meta/recipes-graphics/xorg-driver/xorg-driver-video.inc
index 57c80d1..4fe3349 100644
--- a/meta/recipes-graphics/xorg-driver/xorg-driver-video.inc
+++ b/meta/recipes-graphics/xorg-driver/xorg-driver-video.inc
@@ -2,3 +2,6 @@ include xorg-driver-common.inc
 
 DEPENDS =+ "renderproto videoproto xextproto fontsproto"
 
+python populate_packages_prepend() {
+    add_abi_depends(d, "video")
+}
-- 
1.7.10




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

* [PATCH 3/3] insane: add a check for Xorg driver ABI dependencies
  2012-10-22  9:37 [PATCH 0/3] Add Xorg driver ABI dependencies Ross Burton
  2012-10-22  9:37 ` [PATCH 1/3] xserver-xorg: add runtime provides for the driver ABI version Ross Burton
  2012-10-22  9:37 ` [PATCH 2/3] xorg-driver: add xserver driver ABI dependencies Ross Burton
@ 2012-10-22  9:37 ` Ross Burton
  2012-10-23 18:53 ` [PATCH 0/3] Add " Saul Wold
  3 siblings, 0 replies; 6+ messages in thread
From: Ross Burton @ 2012-10-22  9:37 UTC (permalink / raw)
  To: openembedded-core

Now that xserver provides driver ABI names, all drivers should depend on the ABI
version that they have been built against.

All drivers that include xorg-driver-input.inc or xorg-driver-video.inc will get
these automatically, so this should only impact binary drivers.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/insane.bbclass |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 71a9a58..29b122e 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -109,7 +109,7 @@ def package_qa_get_machine_dict():
 
 
 # Currently not being used by default "desktop"
-WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir"
+WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir xorg-driver-abi"
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms dep-cmp"
 
 ALL_QA = "${WARN_QA} ${ERROR_QA}"
@@ -496,6 +496,24 @@ def package_qa_check_buildpaths(path, name, d, elf, messages):
     if tmpdir in file_content:
         messages.append("File %s in package contained reference to tmpdir" % package_qa_clean_path(path,d))
 
+
+QAPATHTEST[xorg-driver-abi] = "package_qa_check_xorg_driver_abi"
+def package_qa_check_xorg_driver_abi(path, name, d, elf, messages):
+    """
+    Check that all packages containing Xorg drivers have ABI dependencies
+    """
+
+    # Skip dev, dbg or nativesdk packages
+    if name.endswith("-dev") or name.endswith("-dbg") or name.startswith("nativesdk-"):
+        return
+
+    driverdir = d.expand("${libdir}/xorg/modules/drivers/")
+    if driverdir in path and path.endswith(".so"):
+        for rdep in bb.utils.explode_deps(d.getVar('RDEPENDS_' + name, True) or ""):
+            if rdep.startswith("xorg-abi-"):
+                return
+        messages.append("Package %s contains Xorg driver (%s) but no xorg-abi- dependencies" % (name, os.path.basename(path)))
+
 def package_qa_check_license(workdir, d):
     """
     Check for changes in the license files 
-- 
1.7.10




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

* Re: [PATCH 0/3] Add Xorg driver ABI dependencies
  2012-10-22  9:37 [PATCH 0/3] Add Xorg driver ABI dependencies Ross Burton
                   ` (2 preceding siblings ...)
  2012-10-22  9:37 ` [PATCH 3/3] insane: add a check for Xorg " Ross Burton
@ 2012-10-23 18:53 ` Saul Wold
  2012-10-24 15:10   ` Saul Wold
  3 siblings, 1 reply; 6+ messages in thread
From: Saul Wold @ 2012-10-23 18:53 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-core

On 10/22/2012 02:37 AM, Ross Burton wrote:
> Hi,
>
> The xserver driver ABIs frequently change and as such are versioned.  It's
> entirely possible to build an image with an Xserver with ABI 13 but drivers
> using ABI 11, and in this situation the server won't load the modules.  These
> ABI versions have no relationship to the package version so the existing
> dependencies can't be made stricter.
>
> The solution Debian (and probably others) take is to add versioned Provides to
> the server, and dependencies on those provides in the drivers.  Then ABI version
> mismatches become package dependencies errors and are caught at image
> construction time, not boot time.
>
> Ross
>
> The following changes since commit caba9cbfce09f19eb27f4c6615c0c5c48e1a2952:
>
>    kernel.bbclass: add kernel-modules to PACKAGES (2012-10-19 23:06:26 +0100)
>
> are available in the git repository at:
>
>    git://git.yoctoproject.org/poky-contrib ross/xorg
>
> for you to fetch changes up to 4bb20610fa08a2daf71f59b42929181500345e75:
>
>    insane: add a check for Xorg driver ABI dependencies (2012-10-22 09:26:20 +0100)
>
> ----------------------------------------------------------------
> Ross Burton (3):
>        xserver-xorg: add runtime provides for the driver ABI version
Merged into OE-Core
>        xorg-driver: add xserver driver ABI dependencies
Not merged yet.

>        insane: add a check for Xorg driver ABI dependencies
>
Merged into OE-Core

Thanks
	Sau!
>   meta/classes/insane.bbclass                        |   20 ++++++++++++++-
>   .../xorg-driver/xorg-driver-common.inc             |   17 +++++++++++-
>   .../xorg-driver/xorg-driver-input.inc              |    4 +++
>   .../xorg-driver/xorg-driver-video.inc              |    3 +++
>   .../recipes-graphics/xorg-xserver/xserver-xorg.inc |   27 +++++++++++++++++++-
>   5 files changed, 68 insertions(+), 3 deletions(-)
>
> Ross Burton (3):
>    xserver-xorg: add runtime provides for the driver ABI version
>    xorg-driver: add xserver driver ABI dependencies
>    insane: add a check for Xorg driver ABI dependencies
>
>   meta/classes/insane.bbclass                        |   20 ++++++++++++++-
>   .../xorg-driver/xorg-driver-common.inc             |   17 +++++++++++-
>   .../xorg-driver/xorg-driver-input.inc              |    4 +++
>   .../xorg-driver/xorg-driver-video.inc              |    3 +++
>   .../recipes-graphics/xorg-xserver/xserver-xorg.inc |   27 +++++++++++++++++++-
>   5 files changed, 68 insertions(+), 3 deletions(-)
>



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

* Re: [PATCH 0/3] Add Xorg driver ABI dependencies
  2012-10-23 18:53 ` [PATCH 0/3] Add " Saul Wold
@ 2012-10-24 15:10   ` Saul Wold
  0 siblings, 0 replies; 6+ messages in thread
From: Saul Wold @ 2012-10-24 15:10 UTC (permalink / raw)
  To: Saul Wold; +Cc: openembedded-core

On 10/23/2012 11:53 AM, Saul Wold wrote:
> On 10/22/2012 02:37 AM, Ross Burton wrote:
>> Hi,
>>
>> The xserver driver ABIs frequently change and as such are versioned.
>> It's
>> entirely possible to build an image with an Xserver with ABI 13 but
>> drivers
>> using ABI 11, and in this situation the server won't load the
>> modules.  These
>> ABI versions have no relationship to the package version so the existing
>> dependencies can't be made stricter.
>>
>> The solution Debian (and probably others) take is to add versioned
>> Provides to
>> the server, and dependencies on those provides in the drivers.  Then
>> ABI version
>> mismatches become package dependencies errors and are caught at image
>> construction time, not boot time.
>>
>> Ross
>>
>> The following changes since commit
>> caba9cbfce09f19eb27f4c6615c0c5c48e1a2952:
>>
>>    kernel.bbclass: add kernel-modules to PACKAGES (2012-10-19 23:06:26
>> +0100)
>>
>> are available in the git repository at:
>>
>>    git://git.yoctoproject.org/poky-contrib ross/xorg
>>
>> for you to fetch changes up to 4bb20610fa08a2daf71f59b42929181500345e75:
>>
>>    insane: add a check for Xorg driver ABI dependencies (2012-10-22
>> 09:26:20 +0100)
>>
>> ----------------------------------------------------------------
>> Ross Burton (3):
>>        xserver-xorg: add runtime provides for the driver ABI version
> Merged into OE-Core
>>        xorg-driver: add xserver driver ABI dependencies
> Not merged yet.
>
Merged into OE-Core

Thanks
	Sau!
>>        insane: add a check for Xorg driver ABI dependencies
>>
> Merged into OE-Core
>
> Thanks
>      Sau!
>>   meta/classes/insane.bbclass                        |   20
>> ++++++++++++++-
>>   .../xorg-driver/xorg-driver-common.inc             |   17 +++++++++++-
>>   .../xorg-driver/xorg-driver-input.inc              |    4 +++
>>   .../xorg-driver/xorg-driver-video.inc              |    3 +++
>>   .../recipes-graphics/xorg-xserver/xserver-xorg.inc |   27
>> +++++++++++++++++++-
>>   5 files changed, 68 insertions(+), 3 deletions(-)
>>
>> Ross Burton (3):
>>    xserver-xorg: add runtime provides for the driver ABI version
>>    xorg-driver: add xserver driver ABI dependencies
>>    insane: add a check for Xorg driver ABI dependencies
>>
>>   meta/classes/insane.bbclass                        |   20
>> ++++++++++++++-
>>   .../xorg-driver/xorg-driver-common.inc             |   17 +++++++++++-
>>   .../xorg-driver/xorg-driver-input.inc              |    4 +++
>>   .../xorg-driver/xorg-driver-video.inc              |    3 +++
>>   .../recipes-graphics/xorg-xserver/xserver-xorg.inc |   27
>> +++++++++++++++++++-
>>   5 files changed, 68 insertions(+), 3 deletions(-)
>>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
>



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

end of thread, other threads:[~2012-10-24 15:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22  9:37 [PATCH 0/3] Add Xorg driver ABI dependencies Ross Burton
2012-10-22  9:37 ` [PATCH 1/3] xserver-xorg: add runtime provides for the driver ABI version Ross Burton
2012-10-22  9:37 ` [PATCH 2/3] xorg-driver: add xserver driver ABI dependencies Ross Burton
2012-10-22  9:37 ` [PATCH 3/3] insane: add a check for Xorg " Ross Burton
2012-10-23 18:53 ` [PATCH 0/3] Add " Saul Wold
2012-10-24 15:10   ` Saul Wold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.