maintain upstream libvirt patches in own github repository; apply patches for CVE...
authorMatthias Maier <tamiko@gentoo.org>
Tue, 23 Dec 2014 22:13:25 +0000 (22:13 +0000)
committerMatthias Maier <tamiko@gentoo.org>
Tue, 23 Dec 2014 22:13:25 +0000 (22:13 +0000)
Package-Manager: portage-2.2.15/cvs/Linux x86_64
Manifest-Sign-Key: 0xBD3A97A3

app-emulation/libvirt/ChangeLog
app-emulation/libvirt/Manifest
app-emulation/libvirt/files/libvirt-1.2.9-cve-2014-7823.patch [deleted file]
app-emulation/libvirt/libvirt-1.2.10-r3.ebuild [new file with mode: 0644]

index 1a69567545af915e0bf45459e3e13eab95a53144..335551db0bc678e9c7d1aae4a4a26d5b50de8180 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for app-emulation/libvirt
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/ChangeLog,v 1.407 2014/12/18 21:05:55 tamiko Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/ChangeLog,v 1.408 2014/12/23 22:13:13 tamiko Exp $
+
+*libvirt-1.2.10-r3 (23 Dec 2014)
+
+  23 Dec 2014; Matthias Maier <tamiko@gentoo.org> +libvirt-1.2.10-r3.ebuild,
+  -files/libvirt-1.2.9-cve-2014-7823.patch:
+  maintain upstream libvirt patches in own github repository; apply patches for
+  CVE-2014-8135, CVE-2014-8136
 
 *libvirt-1.2.11-r2 (18 Dec 2014)
 
index 246fb488896e772b903ff8e452738a9c9e4eabbf..53ed8b197d997748a8afc311720272ea799ffac1 100644 (file)
@@ -4,7 +4,6 @@ Hash: SHA256
 AUX libvirt-1.2.10-cve-2014-7823.patch 3066 SHA256 f5574d5b7f02700bd81596b451896163c8dcb1081d568338ed9810dbe0d759ef SHA512 1a13c0fd39671e417b7c338a4d4cada52c83527e726f23a59fb31b3f0777eec3b901761e7a62f07abec0968482a0410c0b28a145290755d68ea02f0b497d981c WHIRLPOOL 8ff93c91d1ab972cf46d90feb9b196e9b0516c3646809448660d200d7fbd205e9507323e63e9afd299ac7393d43f90ff7b1be2fc74ba8f5f64ce6c9ab37a3827
 AUX libvirt-1.2.10-cve-2014-8131-part2.patch 1413 SHA256 c2217f14db504f0366f06db091c5c2d7a433198606a25b0dd791d3b145b4dfdc SHA512 b745c7f62e300433d77785b5a5a66a5584a86a9387d6c2f09493e902f71a62fdc04809fee00ededa948576faff38f529410b53a8228f3a25008e69ece4ea57c2 WHIRLPOOL 07413bbbb743be2965270c08388a405fe6869530169721028de64d588d3d78ca2950ede8dd6438761755ac4d89069b6b87c7c9f8049ec418fba7ee81a8e9d6f7
 AUX libvirt-1.2.10-cve-2014-8131.patch 2761 SHA256 1ecbb82ee50dfb91361cb2f55d1dc8e014e08223258dad2a1183d5d844cd7d62 SHA512 36913fbab2ad6499e0386765c106e3592348a77fb8cf10c74353be6299de4a1740a336a2b98efbceed982725cb688f6110e435a4033d9d7141031262a12e0da9 WHIRLPOOL a750d5025385f956a66a177e90332c0f19f7be6097d75bb7b5a2b050a893b0e4638dd1edc04f92219727fa3e069c4e6349ce52cd007472186c72f8c400b107ab
-AUX libvirt-1.2.9-cve-2014-7823.patch 3250 SHA256 bbc13c3061875de9b9a4c31e061d3797118564ce3c945dda44015d320c4bc8d1 SHA512 851d6662ada92e0566614ae315a0a630c4656349efee01884590856285653a36fd467c81e0f53e3ffc3a55e4106250014d79f0d73cbf39c0c821ac957300c019 WHIRLPOOL b9bfc2b3f09aebd4a6f4e170acd75c8d372c84aa84d5914f3e8807da184c74dca03f117ef621caf6d1e73f2026410b4421c9ea845a092edb95bdcaa34d92bc64
 AUX libvirt-1.2.9-do_not_use_sysconf.patch 3879 SHA256 1a0c0b29c481097ee218cc752b11f00193a87a010feefc71ea3f56e041c5844d SHA512 cd8881ed2fd928e4fc122a8615fc328f515181129253cba1124c1faf48549729428113822b56034143e192c44944b1a40e83b960f742db64738e5bc05b9bb371 WHIRLPOOL 9413e40883d98d5d78a2c269786a2f640ec9689744ef431a4e9a092d251d33deda954ad8631520a04a16d8c30ca2e9b28bc8b78562f27267f80740901907a253
 AUX libvirt-1.2.9-fix-firewalld-configuration.patch 1069 SHA256 0a4116d91fa068e42735624b78b8fa763f7ee251480151033219981ed11a0c4f SHA512 99addf602f9551e7c2dd92d62d9c3170402d3028dee4f4e8f6809c58cbb2c15d971b518ddc83f2688e0e234194e14156c531eb2ceb0cf2b1740dbb5b099b54ed WHIRLPOOL 7d904c54eb2d98cc446700d1e21ab13080c8bd212122fe5dac91882d564b8453c2ea1e509e8b8995c03623f19d6555b8d126cf0e363e062d2ede93ec12cfcda8
 AUX libvirtd.confd-r4 2015 SHA256 c2ca5d9a2d4ed433e91bd215c2ca678109cc981072897a497955e36760dc3b9f SHA512 b3e1d2433be7838a35386747422a8f98f2a7f6a92a03089f9472eb8ee2efb7d10d2becd363fea7cdaf8771da31b58cd60d192b25e089b6257ad5341b1074e540 WHIRLPOOL 284e72e704b759433d5ddc1a3e4019164dda6b48cb2734ea9a6780747938bba2855a99dcf1b125ab3f500a6145315cafa4a3531ff6938c0c62e5b1a6f99ea9b3
@@ -12,27 +11,29 @@ AUX libvirtd.init-r13 3678 SHA256 5744e7392b0777d14142552237f517ff1fbf6c4734aff9
 AUX libvirtd.init-r14 4349 SHA256 ed8514d347d3a8a0b243cfc25a85dedb1e595f1e29e874bcadd14ef5f5d03e58 SHA512 a2bcde86fb3ad5e30357ff27e2dd7ed5246d0eb432a22f292f8c1a5aaa92499c5a24417836513dd8655da48c3cbc1696e7ce84aa3e200625cebce77f697eb07f WHIRLPOOL 6dc699c3a105593f6ce2152c5ccad0f04aaa4c57e75a4e3abf88592cce67b92f30a77921c321c7cc7f820851b3ce4bcc9b28dcdf20c2f2851551ec458b1fb517
 AUX libvirtd.service.conf 401 SHA256 1cfb6f7dec5746364d9a4cccddb4b63f8ccd0ebf8bfaa000b13a09962ca24fac SHA512 27adbd104ea87e51d423b057392a0c6726692ad8ee9723f73dc4bfe8eb54069725d64883434424ba810d36992d404d1ba4afe6bcefb866d3d3d92dfd161c2b32 WHIRLPOOL d6b960b7d18bdbaf0ff6dc5ecf29e7d10e22fa7d16933a149d6287c007d864a0e0dd67048c25a038dd5f73c9ea911d2cd49bf21c072b0c7eab1e92be35d8b545
 AUX virtlockd.init 437 SHA256 0894a839f85dff6f97bde514437935f4c1589ba4f2cbd3e0efe28753698694a1 SHA512 3d7b366736fb98acd26577e29a3c00592e7be038634fc3b51891f557426cd9945bf08a4486f1d62aa91ce7dc7d6bf96d7e57ef06a3a0b4aceb55b9e9c9e9b2da WHIRLPOOL d633a1a7358dbf7bd94d70f44753c9c346adfc78537643e5f379cea017d20e1097998ecfaf87e47e4e0f9216d43a3053af24e3129ecfb8f110f5283a769f368f
+DIST libvirt-1.2.10-20141223.tar.xz 5012 SHA256 a1d31d12f04631e46748b6dfc6893d20127bd97204415c9642b1af68077d68b4 SHA512 70148beb288d0df468bd3c82b42da1ccae54f4914514f7bd9817a4aa6e6bb54d21aba58ce9ab6cb35ec539af8c6ce9f5c2f91f1a67f29824bcf0a13e6c1a2975 WHIRLPOOL 0569ad4b4222f968684ab2e108bd761bdb750eb59348e70c38ebc809a9ee0cb74445126d2517f5b660a5600d4de9c20d3f3d7f96abff1cc9d3e2b5a834fc87f4
 DIST libvirt-1.2.10.tar.gz 30029503 SHA256 5050f4cea3dd59d3eca25c3d3f16085e10d624ecc18bd35820cd3dac6f46c08e SHA512 9cd5d2a604769cf70e388c367abcde27ee8d6d7043227f17dd2cac92a467ea06547374e1d83c7b1ee4c5322d8b3d9e4cbb6db373efae5eaaceed1b1376cbd09d WHIRLPOOL 986c1fd0128101f936897c97a36d646b8893d9ee0a223d05b004d73408a2720aeb9bb5fe3e4a7c476947021b89d955fb4a1b3a64dfe8dfe0d30dbfe75487b8fe
 DIST libvirt-1.2.11.tar.gz 30571605 SHA256 1b886429734a53fc9a201f46d77448fda963e1323246269eb0dcb4c12fb02fcc SHA512 4aaeb2eeb563f0a9105a1586054d69c24dada12ddf9b71edd3742ad602eb8c892d9f615ee1a2159051bec52699897c6707d9d0204b8f0fe61bae15885ee986f2 WHIRLPOOL b64ee58d633e4b3fec52125bd9b582f7d07045baa66c492fd2b6bc521d994cec95fa460c3a8b32a0f73043ad812e36d81832c31046bbacc280fb2f2764e9bd75
 EBUILD libvirt-1.2.10-r2.ebuild 12737 SHA256 91df435d21611b5e8a0a316a148b0d5449360cad43d61f50c271b87ef8e8b91d SHA512 893277721e06f434efa5f54e102620ff4df71d70a910999caed4dd60075e18eb38aa409b743681a367db6043ae360008da9cfd62932967276a52b2dc6e5750ee WHIRLPOOL 81e528bd5fcc722e916cad403d4bab5fc9f256a1c632163140a6bce90310b9195779255468c52d0f61f2f13fca3a10573c50b5b09571defcea1557aa460d2d00
+EBUILD libvirt-1.2.10-r3.ebuild 12915 SHA256 eace4861d704bcb66f99481be9de8d209e23664db19ef3df54123447440080e9 SHA512 0d135f7ed700a5db5dbb39b425cf9938c01668d6b336afda32edeeaa9bf381b61f4362d13e7f8542437a730e9603dba29f245c4903ba28328f51ea56080a497c WHIRLPOOL f4ea93ca177a1a7642acf7e67a4fbbd5eb5afb8dc19669dd779b32bfe3e6206f42ab0e3078e35c22a8b6abfbf531a0628db07f26d598dc14361856e1b5eae25f
 EBUILD libvirt-1.2.11-r2.ebuild 12679 SHA256 6e4bad045b0c8cf22dfd2a26e3278636fafb6156f447a2b7a531f8a008283d3b SHA512 7e71e2f98d6871f1fd3084aec1783fd59b85b74dd55dd8cc297f8b501a7b3c911930162eab056b65dfd0af75012e6b6d444767d025b6ecea8438af6755f3041f WHIRLPOOL 9c689c6f015179b618ad4e197d5897f4813b7a8d7157c8293e735559a4111652f3b89ae61156dec8e984e8df180ca0935af85dbf1808d1fd54ee5f48dcd5d774
 EBUILD libvirt-9999.ebuild 12695 SHA256 f984980eaec7fa121b5b5d3d9e44c4b8aed1161f88aebe6bcf9514face3b1540 SHA512 9299a530f8160abde0101dc27da8641bd176907a66d2e792f2d3588b5dea61637ef0e64f8ec07bc10508c6c3d60692209a4aefd0e60d2b0a8ba9d152be0fe255 WHIRLPOOL fb4564bb4e2410259cf7f0093edf6b6845e52275047d308645064a262439eb2646e1fff7af97bf30e4c093e766f6b2262404ea0cdcdd2010e15f28074bed052f
-MISC ChangeLog 25076 SHA256 100d0a50164707c05ae2ba925d69deb04e6c516bb1337386dd3ab10ed6efc1fe SHA512 8da6c0153293a54d0d888dbf5069fbdab7801e8adabd2df685cfe33d6e1ca2a3bd157229f03e435244d90bb8c495b4cd03088c7bcad7ab19ff392b9e6446e7c1 WHIRLPOOL 155245e3a8ae140c2ae6fd9afb761cebf101c6fab29f1069ba0a8a9d1f5c208ca64ce13d45362e7c6f852aa1ea727b8e69ba281e02ce6b429fa8aa422a026839
+MISC ChangeLog 25343 SHA256 43043a145b474b3cd5f1187da46ce0e7f6f41483cb4b25c2e92214911e597218 SHA512 48511be1004b621d96b4e4645610b86c9f00fdeab430e71d58d97b6f0f8bdb22f32db08ee8c82985b778c5eca8c615c8b78211f28d830a1e9d09b982045cd119 WHIRLPOOL 4025e8700ed3f9ebacad3031b8b5ac55143fe86667c5fb69bbe4fe216713e8727cfb64277fa2ea983eb7ee380eb176178f46a3e09ed1baabd299ef6f61be39f5
 MISC metadata.xml 3604 SHA256 90d98bcf32df9c4ff5d3fc90cdcac46ddc486efa9706b945cbf749d4a1ddcd30 SHA512 35b1fd9faa961efddec324d3721699068b9b2aefb49271f064b3930c9c246a71829f55566438754c34f294db9b8c2ad55386113a72ab11b31cbb604e4afe7816 WHIRLPOOL 6315f8a01134f62a1f7b9845f0e89624bb1edd713b4965a53209b199609ba4f510f0cbb4ee85f348947556cdeee27ab7ae7fcf52b1b9ed82176076d149c00116
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.1
 
-iQIcBAEBCAAGBQJUk0G0AAoJELhOzYlK7nn/FQ0P/1BS1wTP/jfc4vZWi4cu7Mvn
-UaKIXXdzzl+h5G5tQudUUwz1PI5+P3/aNEInMO6BXFLvXykkdOeNprNTmmfvTPBn
-qxBZEDVOTDk0T73tyN+4pMjIzPAC5ZybfE/54fCAICAqQZyphSieTcfrRs26550B
-LWnoQX4CgNBPbYHWQ3yMrlltDL1UZi+rMDOOgcGjwJACvSuYg65SLkSHkaQ/s8qb
-EBJAHrIVXeKG7S33xSb3ShmAUJ0w6zRXtkzL78mDpOTjLUZ1lAvKjSMT0tn0hBWC
-MOTLpLPe2K7ajHPbsCKnhAzon9kVEnTNpm8fBKuU3zG29WYg5XWabC/LNj76AfRq
-1+sKjdRsONHITF6SRwW1Jtc/X9jJZrp3twmiAVPOmfStonF0esdhF2qjitp2uAUO
-SZigb2yVV/p9Haz9FWqGi7l8fwyBHl7O8phh9yeskZPt70suAk0N6hD+0bGu/JXb
-R3oehf/eltkuxihOpdCoyu/+qc1TovsfX6ZfnNLAepoEb6eu5lvGP8H8ZBwOEm2Y
-h7RjqpIgl944Lp5Wif+F0Z+SGao5TqjTzd13WBOMu9Bdj89GQeuqyiTPrlwjR//u
-9CloCHnZ4UdrFhNVQgWvc7urTDBjJyGLcEy/l0iZqZVFN3L7YiDwtCAkdN6yl/sV
-ZPB9R0Skp7i6gf2HyGiB
-=qYwL
+iQIcBAEBCAAGBQJUmej7AAoJELhOzYlK7nn/CZMQAItP91bb18wKor0lYrqmYCRQ
+Wh0PY1cJv7EgU0tii7pyWVnPDvTVvZ1PdWYgwuZW+UME9AqxyOaDPlsY8zbVovH6
+TYJejmqvhkJvhzEyL4d7jcnWQxLXWaIWxy6Lc9CF9+BtA2PUqy3sBMDb+cSDbhI7
+DzITJsCEHvfMgNjwvz3sBKXHQeoT+X2jqwPcvb0Q/4Cmi9Ji2N1c9Xj9T5zjiJlp
+tLIOMnDUKbywSdUgMLcH37hZ7ibBVnzKer2S2KEd/7IAicx+37HZlzkx67H2E2M1
+qJLtMtYeQFM7kTyGCkM42vkGRNKYV2xNIb593TmWpnKoc6AGlAyq3NvTVCpO6Nyl
+iEyblvDU55g0KEOodcJL69rPCsAM5+8sD5cPjrL98+GCbqZ08CkrD7HXvAx2fEtI
+wM2Iw2Gtyja2cim/iD6H6flgx8/cEfKP/m3TniFY2JEeKr1mi/nqPI27q4K4309S
+z6iHcPgMlJyVjM07uesnr0KuuZOPJjOfWskW0LpoKrU36NwhyoGYB1P4KRg+89ce
+sCykJH7qrS6ZBmWHy6ztm7RMynjaR6cQZCTD36nto+wP2nMl8qpXzad5LqrQk7UM
+fUAhSBeu6bHZip1e60Oa8M/c+cyfl1o3/qy52trrosJ4c8QF+RzFFkHxTbJSxAQD
+0ARFBzi+CRReXXjKBMiw
+=KLbO
 -----END PGP SIGNATURE-----
diff --git a/app-emulation/libvirt/files/libvirt-1.2.9-cve-2014-7823.patch b/app-emulation/libvirt/files/libvirt-1.2.9-cve-2014-7823.patch
deleted file mode 100644 (file)
index 7d0d655..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-Patch from: https://www.redhat.com/archives/libvir-list/2014-November/msg00114.html
-
-Backported to version 1.2.9: (Matthias Maier <tamiko@gentoo.org>)
-In libvirt versions prior to 1.2.10 the function
-  char*
-  virDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
-is defined in libvirt.c
-
-
-From: Eric Blake <eblake redhat com>
-To: libvir-list redhat com
-Subject: [libvirt] [PATCH] CVE-2014-7823: dumpxml: security hole with migratable flag
-Date: Wed, 5 Nov 2014 17:30:46 +0100
----
-
-Commit 28f8dfd (v1.0.0) introduced a security hole: in at least
-the qemu implementation of virDomainGetXMLDesc, the use of the
-flag VIR_DOMAIN_XML_MIGRATABLE (which is usable from a read-only
-connection) triggers the implicit use of VIR_DOMAIN_XML_SECURE
-prior to calling qemuDomainFormatXML.  However, the use of
-VIR_DOMAIN_XML_SECURE is supposed to be restricted to read-write
-clients only.  This patch treats the migratable flag as requiring
-the same permissions, rather than analyzing what might break if
-migratable xml no longer includes secret information.
-
-Fortunately, the information leak is low-risk: all that is gated
-by the VIR_DOMAIN_XML_SECURE flag is the VNC connection password;
-but VNC passwords are already weak (FIPS forbids their use, and
-on a non-FIPS machine, anyone stupid enough to trust a max-8-byte
-password sent in plaintext over the network deserves what they
-get).  SPICE offers better security than VNC, and all other
-secrets are properly protected by use of virSecret associations
-rather than direct output in domain XML.
-
-* src/remote/remote_protocol.x (REMOTE_PROC_DOMAIN_GET_XML_DESC):
-Tighten rules on use of migratable flag.
-* src/libvirt-domain.c (virDomainGetXMLDesc): Likewise.
-
-Signed-off-by: Eric Blake <eblake redhat com>
----
-
-The libvirt-security list agreed that this did not need an embargo
-because it is low-risk; but I'm on the road this week, so while
-this patch for master can go in now, I won't complete the backport
-to all the affected stable branches (everything since v1.0.0) or
-do the Libvirt Security Notice writeup until Monday.
-
- src/libvirt-domain.c         | 3 ++-
- src/remote/remote_protocol.x | 1 +
- 2 files changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/src/libvirt.c b/src/libvirt.c
-index 7dc3146..2b0defc 100644
---- a/src/libvirt.c
-+++ b/src/libvirt.c
-@@ -4369,7 +4369,8 @@ virDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
-     virCheckDomainReturn(domain, NULL);
-     conn = domain->conn;
-
--    if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
-+    if ((conn->flags & VIR_CONNECT_RO) &&
-+        (flags & (VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_MIGRATABLE))) {
-         virReportError(VIR_ERR_OPERATION_DENIED, "%s",
-                        _("virDomainGetXMLDesc with secure flag"));
-         goto error;
-diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
-index db12cda..ebf4530 100644
---- a/src/remote/remote_protocol.x
-+++ b/src/remote/remote_protocol.x
-@@ -3255,6 +3255,7 @@ enum remote_procedure {
-      * @generate: both
-      * @acl: domain:read
-      * @acl: domain:read_secure:VIR_DOMAIN_XML_SECURE
-+     * @acl: domain:read_secure:VIR_DOMAIN_XML_MIGRATABLE
-      */
-     REMOTE_PROC_DOMAIN_GET_XML_DESC = 14,
-
--- 
-1.9.3
-
diff --git a/app-emulation/libvirt/libvirt-1.2.10-r3.ebuild b/app-emulation/libvirt/libvirt-1.2.10-r3.ebuild
new file mode 100644 (file)
index 0000000..49bf165
--- /dev/null
@@ -0,0 +1,459 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/libvirt-1.2.10-r3.ebuild,v 1.1 2014/12/23 22:13:13 tamiko Exp $
+
+EAPI=5
+
+AUTOTOOLIZE=yes
+
+MY_P="${P/_rc/-rc}"
+
+inherit eutils user autotools linux-info systemd readme.gentoo
+
+BACKPORTS="20141223"
+
+if [[ ${PV} = *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="git://libvirt.org/libvirt.git"
+       SRC_URI=""
+       KEYWORDS=""
+       SLOT="0"
+else
+       # Versions with 4 numbers are stable updates:
+       if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then
+               SRC_URI="http://libvirt.org/sources/stable_updates/${MY_P}.tar.gz
+               ${BACKPORTS:+
+                       http://dev.gentoo.org/~tamiko/distfiles/${P}-${BACKPORTS}.tar.xz}"
+       else
+               SRC_URI="http://libvirt.org/sources/${MY_P}.tar.gz
+               ${BACKPORTS:+
+                       http://dev.gentoo.org/~tamiko/distfiles/${P}-${BACKPORTS}.tar.xz}"
+       fi
+       KEYWORDS="~amd64 ~x86"
+       SLOT="0/${PV}"
+fi
+S="${WORKDIR}/${P%_rc*}"
+
+DESCRIPTION="C toolkit to manipulate virtual machines"
+HOMEPAGE="http://www.libvirt.org/"
+LICENSE="LGPL-2.1"
+IUSE="audit avahi +caps firewalld fuse iscsi +libvirtd lvm lxc +macvtap nfs \
+       nls numa openvz parted pcap phyp policykit +qemu rbd sasl \
+       selinux +udev uml +vepa virtualbox virt-network wireshark-plugins xen \
+       elibc_glibc systemd"
+REQUIRED_USE="libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) )
+       lxc? ( caps libvirtd )
+       openvz? ( libvirtd )
+       qemu? ( libvirtd )
+       uml? ( libvirtd )
+       vepa? ( macvtap )
+       virtualbox? ( libvirtd )
+       xen? ( libvirtd )
+       virt-network? ( libvirtd )
+       firewalld? ( virt-network )"
+
+# gettext.sh command is used by the libvirt command wrappers, and it's
+# non-optional, so put it into RDEPEND.
+# We can use both libnl:1.1 and libnl:3, but if you have both installed, the
+# package will use 3 by default. Since we don't have slot pinning in an API,
+# we must go with the most recent
+RDEPEND="sys-libs/readline
+       sys-libs/ncurses
+       >=net-misc/curl-7.18.0
+       dev-libs/libgcrypt:0
+       >=dev-libs/libxml2-2.7.6
+       dev-libs/libnl:3
+       >=net-libs/gnutls-1.0.25
+       net-libs/libssh2
+       sys-apps/dmidecode
+       >=sys-apps/util-linux-2.17
+       sys-devel/gettext
+       >=net-analyzer/netcat6-1.0-r2
+       app-misc/scrub
+       audit? ( sys-process/audit )
+       avahi? ( >=net-dns/avahi-0.6[dbus] )
+       caps? ( sys-libs/libcap-ng )
+       fuse? ( >=sys-fs/fuse-2.8.6 )
+       iscsi? ( sys-block/open-iscsi )
+       lxc? ( !systemd? ( sys-power/pm-utils ) )
+       lvm? ( >=sys-fs/lvm2-2.02.48-r2 )
+       nfs? ( net-fs/nfs-utils )
+       numa? (
+               >sys-process/numactl-2.0.2
+               sys-process/numad
+       )
+       openvz? ( sys-kernel/openvz-sources )
+       parted? (
+               >=sys-block/parted-1.8[device-mapper]
+               sys-fs/lvm2
+       )
+       pcap? ( >=net-libs/libpcap-1.0.0 )
+       policykit? ( >=sys-auth/polkit-0.9 )
+       qemu? (
+               >=app-emulation/qemu-0.13.0
+               dev-libs/yajl
+               !systemd? ( sys-power/pm-utils )
+       )
+       rbd? ( sys-cluster/ceph )
+       sasl? ( dev-libs/cyrus-sasl )
+       selinux? ( >=sys-libs/libselinux-2.0.85 )
+       systemd? ( sys-apps/systemd )
+       virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
+       wireshark-plugins? ( net-analyzer/wireshark:= )
+       xen? ( app-emulation/xen-tools app-emulation/xen )
+       udev? ( virtual/udev >=x11-libs/libpciaccess-0.10.9 )
+       virt-network? ( net-dns/dnsmasq[script]
+               >=net-firewall/iptables-1.4.10
+               net-misc/radvd
+               net-firewall/ebtables
+               sys-apps/iproute2[-minimal]
+               firewalld? ( net-firewall/firewalld )
+       )
+       elibc_glibc? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )"
+
+DEPEND="${RDEPEND}
+       virtual/pkgconfig
+       app-text/xhtml1
+       dev-lang/perl
+       dev-libs/libxslt"
+
+DOC_CONTENTS="For the basic networking support (bridged and routed networks)
+you don't need any extra software. For more complex network modes
+including but not limited to NATed network, you can enable the
+'virt-network' USE flag.\n\n
+If you are using dnsmasq on your system, you will have
+to configure /etc/dnsmasq.conf to enable the following settings:\n\n
+       bind-interfaces\n
+       interface or except-interface\n\n
+Otherwise you might have issues with your existing DNS server."
+
+LXC_CONFIG_CHECK="
+       ~CGROUPS
+       ~CGROUP_FREEZER
+       ~CGROUP_DEVICE
+       ~CGROUP_CPUACCT
+       ~CGROUP_SCHED
+       ~CGROUP_PERF
+       ~BLK_CGROUP
+       ~NET_CLS_CGROUP
+       ~CGROUP_NET_PRIO
+       ~CPUSETS
+       ~RESOURCE_COUNTERS
+       ~NAMESPACES
+       ~UTS_NS
+       ~IPC_NS
+       ~PID_NS
+       ~NET_NS
+       ~USER_NS
+       ~DEVPTS_MULTIPLE_INSTANCES
+       ~VETH
+       ~MACVLAN
+       ~POSIX_MQUEUE
+       ~SECURITYFS
+       ~!GRKERNSEC_CHROOT_MOUNT
+       ~!GRKERNSEC_CHROOT_DOUBLE
+       ~!GRKERNSEC_CHROOT_PIVOT
+       ~!GRKERNSEC_CHROOT_CHMOD
+       ~!GRKERNSEC_CHROOT_CAPS
+"
+
+VIRTNET_CONFIG_CHECK="
+       ~BRIDGE_NF_EBTABLES
+       ~BRIDGE_EBT_MARK_T
+       ~NETFILTER_ADVANCED
+       ~NETFILTER_XT_TARGET_CHECKSUM
+       ~NETFILTER_XT_CONNMARK
+       ~NETFILTER_XT_MARK
+"
+
+BWLMT_CONFIG_CHECK="
+       ~BRIDGE_EBT_T_NAT
+       ~NET_SCH_HTB
+       ~NET_SCH_SFQ
+       ~NET_SCH_INGRESS
+       ~NET_CLS_FW
+       ~NET_CLS_U32
+       ~NET_ACT_POLICE
+"
+
+MACVTAP_CONFIG_CHECK=" ~MACVTAP"
+
+LVM_CONFIG_CHECK=" ~BLK_DEV_DM ~DM_SNAPSHOT ~DM_MULTIPATH"
+
+ERROR_USER_NS="Optional depending on LXC configuration."
+
+pkg_setup() {
+       enewgroup qemu 77
+       enewuser qemu 77 -1 -1 qemu kvm
+
+       # Some people used the masked ebuild which was not adding the qemu
+       # user to the kvm group originally. This results in VMs failing to
+       # start for some users. bug #430808
+       egetent group kvm | grep -q qemu
+       if [[ $? -ne 0 ]]; then
+               gpasswd -a qemu kvm
+       fi
+
+       # Handle specific kernel versions for different features
+       kernel_is lt 3 6 && LXC_CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR"
+       kernel_is ge 3 6 &&     LXC_CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP ~MEMCG_KMEM"
+
+       CONFIG_CHECK=""
+       use fuse && CONFIG_CHECK+=" ~FUSE_FS"
+       use lvm && CONFIG_CHECK+="${LVM_CONFIG_CHECK}"
+       use lxc && CONFIG_CHECK+="${LXC_CONFIG_CHECK}"
+       use macvtap && CONFIG_CHECK+="${MACVTAP_CONFIG_CHECK}"
+       use virt-network && CONFIG_CHECK+="${VIRTNET_CONFIG_CHECK}"
+       # Bandwidth Limiting Support
+       use virt-network && CONFIG_CHECK+="${BWLMT_CONFIG_CHECK}"
+       if [[ -n ${CONFIG_CHECK} ]]; then
+               linux-info_pkg_setup
+       fi
+}
+
+src_prepare() {
+       touch "${S}/.mailmap"
+
+       if [[ ${PV} = *9999* ]]; then
+               # git checkouts require bootstrapping to create the configure script.
+               # Additionally the submodules must be cloned to the right locations
+               # bug #377279
+               ./bootstrap || die "bootstrap failed"
+               (
+                       git submodule status | sed 's/^[ +-]//;s/ .*//'
+                       git hash-object bootstrap.conf
+               ) >.git-module-status
+       fi
+
+       epatch "${FILESDIR}"/${PN}-1.2.9-do_not_use_sysconf.patch
+       epatch "${FILESDIR}"/${PN}-1.2.9-fix-firewalld-configuration.patch
+       [[ -n ${BACKPORTS} ]] && \
+               EPATCH_FORCE=yes EPATCH_SUFFIX="patch" \
+                       EPATCH_SOURCE="${WORKDIR}/patches" epatch
+
+       epatch_user
+
+       [[ -n ${AUTOTOOLIZE} ]] && eautoreconf
+
+       # Tweak the init script
+       local avahi_init=
+       local iscsi_init=
+       local rbd_init=
+       local firewalld_init=
+       cp "${FILESDIR}/libvirtd.init-r13" "${S}/libvirtd.init"
+       use avahi && avahi_init='avahi-daemon'
+       use iscsi && iscsi_init='iscsid'
+       use rbd && rbd_init='ceph'
+       use firewalld && firewalld_init='need firewalld'
+
+       sed -e "s/USE_FLAG_FIREWALLD/${firewalld_init}/" -i "${S}/libvirtd.init"
+       sed -e "s/USE_FLAG_AVAHI/${avahi_init}/" -i "${S}/libvirtd.init"
+       sed -e "s/USE_FLAG_ISCSI/${iscsi_init}/" -i "${S}/libvirtd.init"
+       sed -e "s/USE_FLAG_RBD/${rbd_init}/" -i "${S}/libvirtd.init"
+}
+
+src_configure() {
+       local myconf=""
+
+       ## enable/disable daemon, otherwise client only utils
+       myconf+=" $(use_with libvirtd)"
+
+       ## enable/disable the daemon using avahi to find VMs
+       myconf+=" $(use_with avahi)"
+
+       ## hypervisors on the local host
+       myconf+=" $(use_with xen) $(use_with xen xen-inotify)"
+       myconf+=" --without-xenapi"
+       if use xen && has_version ">=app-emulation/xen-tools-4.2.0"; then
+               myconf+=" --with-libxl"
+       else
+               myconf+=" --without-libxl"
+       fi
+       myconf+=" $(use_with openvz)"
+       myconf+=" $(use_with lxc)"
+       if use virtualbox && has_version app-emulation/virtualbox-ose; then
+               myconf+=" --with-vbox=/usr/lib/virtualbox-ose/"
+       else
+               myconf+=" $(use_with virtualbox vbox)"
+       fi
+       myconf+=" $(use_with uml)"
+       myconf+=" $(use_with qemu)"
+       myconf+=" $(use_with qemu yajl)" # Use QMP over HMP
+       myconf+=" $(use_with phyp)"
+       myconf+=" --with-esx"
+       myconf+=" --with-vmware"
+
+       ## additional host drivers
+       myconf+=" $(use_with virt-network network)"
+       myconf+=" --with-storage-fs"
+       myconf+=" $(use_with lvm storage-lvm)"
+       myconf+=" $(use_with iscsi storage-iscsi)"
+       myconf+=" $(use_with parted storage-disk)"
+       myconf+=" $(use_with lvm storage-mpath)"
+       myconf+=" $(use_with rbd storage-rbd)"
+       myconf+=" $(use_with numa numactl)"
+       myconf+=" $(use_with numa numad)"
+       myconf+=" $(use_with selinux)"
+       myconf+=" $(use_with fuse)"
+
+       # udev for device support details
+       myconf+=" $(use_with udev)"
+       myconf+=" --without-hal"
+
+       # linux capability support so we don't need privileged accounts
+       myconf+=" $(use_with caps capng)"
+
+       ## auth stuff
+       myconf+=" $(use_with policykit polkit)"
+       myconf+=" $(use_with sasl)"
+
+       # network bits
+       myconf+=" $(use_with macvtap)"
+       myconf+=" $(use_with pcap libpcap)"
+       myconf+=" $(use_with vepa virtualport)"
+       myconf+=" $(use_with firewalld)"
+
+       ## other
+       myconf+=" $(use_enable nls)"
+
+       # user privilege bits fir qemu/kvm
+       if use caps; then
+               myconf+=" --with-qemu-user=qemu"
+               myconf+=" --with-qemu-group=qemu"
+       else
+               myconf+=" --with-qemu-user=root"
+               myconf+=" --with-qemu-group=root"
+       fi
+
+       # audit support
+       myconf+=" $(use_with audit)"
+
+       # wireshark dissector
+       myconf+=" $(use_with wireshark-plugins wireshark-dissector)"
+
+       ## stuff we don't yet support
+       myconf+=" --without-netcf"
+
+       # locking support
+       myconf+=" --without-sanlock"
+
+       # systemd unit files
+       myconf+=" $(use_with systemd systemd-daemon)"
+       use systemd && myconf+=" --with-init-script=systemd"
+
+       # this is a nasty trick to work around the problem in bug
+       # #275073. The reason why we don't solve this properly is that
+       # it'll require us to rebuild autotools (and we don't really want
+       # to do that right now). The proper solution has been sent
+       # upstream and should hopefully land in 0.7.7, in the mean time,
+       # mime the same functionality with this.
+       case ${CHOST} in
+               *cygwin* | *mingw* )
+                       ;;
+               *)
+                       ac_cv_prog_WINDRES=no
+                       ;;
+       esac
+
+       econf \
+               ${myconf} \
+               --disable-static \
+               --disable-werror \
+               --with-remote \
+               --docdir=/usr/share/doc/${PF} \
+               --localstatedir=/var
+
+       if [[ ${PV} = *9999* ]]; then
+               # Restore gnulib's config.sub and config.guess
+               # bug #377279
+               (cd .gnulib && git reset --hard > /dev/null)
+       fi
+}
+
+src_test() {
+       # Explicitly allow parallel build of tests
+       export VIR_TEST_DEBUG=1
+       HOME="${T}" emake check || die "tests failed"
+}
+
+src_install() {
+       emake install \
+               DESTDIR="${D}" \
+               HTML_DIR=/usr/share/doc/${PF}/html \
+               DOCS_DIR=/usr/share/doc/${PF} \
+               EXAMPLE_DIR=/usr/share/doc/${PF}/examples \
+               SYSTEMD_UNIT_DIR="$(systemd_get_unitdir)" \
+               || die "emake install failed"
+
+       find "${D}" -name '*.la' -delete || die
+
+       # Remove bogus, empty directories. They are either not used, or
+       # libvirtd is able to create them on demand
+       rm -rf "${D}"/etc/sysconf
+       rm -rf "${D}"/var/cache
+       rm -rf "${D}"/var/run
+       rm -rf "${D}"/var/log
+
+       use libvirtd || return 0
+       # From here, only libvirtd-related instructions, be warned!
+
+       use systemd && \
+               systemd_install_serviced "${FILESDIR}"/libvirtd.service.conf libvirtd
+
+       newinitd "${S}/libvirtd.init" libvirtd || die
+       newconfd "${FILESDIR}/libvirtd.confd-r4" libvirtd || die
+       newinitd "${FILESDIR}/virtlockd.init" virtlockd || die
+
+       readme.gentoo_create_doc
+}
+
+pkg_preinst() {
+       # we only ever want to generate this once
+       if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
+               rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml
+       fi
+
+       # We really don't want to use or support old PolicyKit cause it
+       # screws with the new polkit integration
+       if has_version sys-auth/policykit; then
+               rm -rf "${D}"/usr/share/PolicyKit/policy/org.libvirt.unix.policy
+       fi
+
+       # Only sysctl files ending in .conf work
+       dodir /etc/sysctl.d
+       mv "${D}"/usr/lib/sysctl.d/libvirtd.conf "${D}"/etc/sysctl.d/libvirtd.conf
+}
+
+pkg_postinst() {
+       if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
+               touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml
+       fi
+
+       if ! use policykit; then
+               elog "To allow normal users to connect to libvirtd you must change the"
+               elog "unix sock group and/or perms in /etc/libvirt/libvirtd.conf"
+       fi
+
+       use libvirtd || return 0
+       # From here, only libvirtd-related instructions, be warned!
+
+       readme.gentoo_print_elog
+
+       if use caps && use qemu; then
+               elog "libvirt will now start qemu/kvm VMs with non-root privileges."
+               elog "Ensure any resources your VMs use are accessible by qemu:qemu"
+       fi
+
+       if [[ -n "${REPLACING_VERSIONS}" ]]; then
+               elog ""
+               elog "The systemd service-file configuration under /etc/sysconfig has"
+               elog "been removed. Please use"
+               elog "    /etc/systemd/system/libvirt.d/00gentoo.conf"
+               elog "to control the '--listen' parameter for libvirtd. The configuration"
+               elog "for the libvirt-guests.service is now found under"
+               elog "    /etc/libvirt/libvirt-guests.conf"
+               elog "The openrc configuration has not been changed. Thus no action is"
+               elog "required for the openrc service manager."
+               elog ""
+       fi
+}