diff options
author | Jason Zaman <perfinion@gentoo.org> | 2014-11-22 13:27:44 +0000 |
---|---|---|
committer | Jason Zaman <perfinion@gentoo.org> | 2014-11-22 13:27:44 +0000 |
commit | 3da51391e72bda355917f6621c436a759aeeb5e4 (patch) | |
tree | fe2d1ef3e6958db22103fc48c7eea5f7f3f2174b /sys-libs/libsemanage | |
parent | Marked ~hppa too. (diff) | |
download | historical-3da51391e72bda355917f6621c436a759aeeb5e4.tar.gz historical-3da51391e72bda355917f6621c436a759aeeb5e4.tar.bz2 historical-3da51391e72bda355917f6621c436a759aeeb5e4.zip |
python3 support for semanage_migrate_store. bug 529252
Package-Manager: portage-2.2.12/cvs/Linux x86_64
Manifest-Sign-Key: 0x7EF137EC935B0EAF
Diffstat (limited to 'sys-libs/libsemanage')
-rw-r--r-- | sys-libs/libsemanage/ChangeLog | 9 | ||||
-rw-r--r-- | sys-libs/libsemanage/Manifest | 32 | ||||
-rw-r--r-- | sys-libs/libsemanage/files/0002-semanage_migrate_store-Python3-support.patch | 284 | ||||
-rw-r--r-- | sys-libs/libsemanage/libsemanage-2.4_rc6-r1.ebuild | 105 |
4 files changed, 415 insertions, 15 deletions
diff --git a/sys-libs/libsemanage/ChangeLog b/sys-libs/libsemanage/ChangeLog index edf63d26ede4..831f0b25267a 100644 --- a/sys-libs/libsemanage/ChangeLog +++ b/sys-libs/libsemanage/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-libs/libsemanage # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/libsemanage/ChangeLog,v 1.81 2014/11/14 19:19:00 swift Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/libsemanage/ChangeLog,v 1.82 2014/11/22 13:27:42 perfinion Exp $ + +*libsemanage-2.4_rc6-r1 (22 Nov 2014) + + 22 Nov 2014; Jason Zaman <perfinon@gentoo.org> + +files/0002-semanage_migrate_store-Python3-support.patch, + +libsemanage-2.4_rc6-r1.ebuild: + python3 support for semanage_migrate_store. bug 529252 *libsemanage-2.4_rc6 (14 Nov 2014) diff --git a/sys-libs/libsemanage/Manifest b/sys-libs/libsemanage/Manifest index 8183a39e7a08..a2499a8e7682 100644 --- a/sys-libs/libsemanage/Manifest +++ b/sys-libs/libsemanage/Manifest @@ -1,6 +1,7 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 +AUX 0002-semanage_migrate_store-Python3-support.patch 10287 SHA256 685bab1de2fdc80952592fe7347f599b3a0dc8c5410606cd96d31275d48fae4d SHA512 4d0dd2b0b9ca81ab7a6b3bfdb89307fd33c8e7f4808ad28eda93246d01f6c91b3a73cb116a84736aa79cd7eaf7563d6aa9bffb38f974d1d445a49fc8c8d77db0 WHIRLPOOL e40042934df6c0747b36a8da53125fe91c07f1b7087f29e93f55ca8103021ff1fbb07d080b6bc5b1ca5b91ef6fdae08d6b0dddfb3e15567ff8a901397041565b DIST libsemanage-2.2.tar.gz 138208 SHA256 11f60bfa0f1c6063cd9bd99ce0cb4acc9d6d9e9b8d7743d39e847bcd7803bd75 SHA512 09032b1b322fec7346164939ade118034812cb538ebc72121640d4ac5c89d2a66b59caa465027cfbebb590dee039a26d4345eafedf365d7f6ad0b5e90377d50f WHIRLPOOL 49170c5ee9ff57dcc4a15aa72386f37993f76436f0da25808c60dab2d03ba52932d0d4fa753c326900d83d2fae30f8bcf659251f17327783f2e2be3deb4842f4 DIST libsemanage-2.3.tar.gz 138231 SHA256 03e09e35e611c286e446bef92b6023ef2623815996f5a53394bb02e49a312e4b SHA512 defe3bbdbe51abdaa13a39f693c33446d8a1a8509ac1eb25c7770da2df6487bcb0ca31259d02b4531d4c81db5e221e94e95bec97f6a1a155e1de2f65e6f0da34 WHIRLPOOL 943d4d300aa8ad49c411b10b41c0c3e751c46dbcbbe129bdd1d2e975e231c58391d6ecdee6b27699fff9f6e6facf5b48fc8d57c2ff68692694c7de430750fac9 DIST libsemanage-2.4-rc2.tar.gz 151013 SHA256 1e759200a4ef10943b3992b86d98004ad5751cf3a43b286cfa0500659debd815 SHA512 b9cfb0483481b68e5771dbb7c08413dbb7f41cfead45971ea98072aaa973723d45f6edf2ff67e909f7376de0c3d0d1e34abf1046e8f1db4607edbf0a310fc52a WHIRLPOOL f9d0abd6ff4f17d71a8c0ea74b3e4b9c3b312517d3ca8a76a4ff5a2c85d92c18f51fe25e069164691031bd121e315a86b75c37ae8281b00422400d265559349c @@ -11,23 +12,26 @@ EBUILD libsemanage-2.3-r2.ebuild 3451 SHA256 c7a81769d7838df565c99ee28fad062dbdf EBUILD libsemanage-2.3-r3.ebuild 3537 SHA256 00c6826ae6646ec7ddcf6c176035a7058962d8ba25ba2cd9febbcd4d290b3a88 SHA512 86401b345346d23e7a874bf1fd68636bd79c33e2937f9885a2a1c0c1d043c7a7bbc73b183b0687882164a6d50f70b8c5c04c38dd60dd2d6f060e764cb607fef5 WHIRLPOOL ccada4c09dfd01dc7d85f1e551438a8e8c7f7cb65a2908fb6d128c0dde447b4bf9c9ae53fc273b8466d117b7b9a170fa442977e15ebcf255f6e941239f3ac731 EBUILD libsemanage-2.4_rc2.ebuild 3549 SHA256 282783f8df0962d5035954cedaed996c119ae8806fdb40d6e9656543e0b3943c SHA512 dc265873655347c4aed4da4072df9ae047a781b1d0aff042d0fc750f58211c7163081d8a3df12ee28e9e45925fa2de5f43957ad17c0a8f76e4bc819902a4b61b WHIRLPOOL 84058341789f3fe9bec16c2f18d8f67f4cf0a983244da199737d04dc4af1750b8dc5d50e9b1a7a5b2ed08255dae0961df722a45103b576c1a396c1233f9647d8 EBUILD libsemanage-2.4_rc5.ebuild 3549 SHA256 6a473e9697e607c3b03cc40c1ee1562716128daf099dcec82444af64a250e0ad SHA512 c57689f340b6174ac41edb75517197827cdb6cc0511e0968f6431355c6dc43b412c0628ea63a58fe084433c184e343312af9dc92a0435d5ca34ed2aeeba3a465 WHIRLPOOL 1464e71d68a32f854515d211f141f070e8a84f7d309823e3b9f84869fdc293f8d9b0198c6a3741afcdab56152799969a5437c7736bc594d448a668e4ff954fcb +EBUILD libsemanage-2.4_rc6-r1.ebuild 3652 SHA256 8d0804838976890c6ae68c73ec221eb831ee03d9e5330bfe9dc303ab39948348 SHA512 66ef53255ff51cec3d6ab1e7e34a432d24e9d72777a2020de96f8ff0c31a4e99c728deaee664f3c306ad1e0fdc42c6baa6656986902572b537efa248597817ce WHIRLPOOL b98d3494a644324a264074427ba2ecd37c0898ad89d3b16146ae515d777dcc7178aed73c7ff091a1f50738bbb5cf49ab8e7e6a38bd28912ed20e3dbbf8026a64 EBUILD libsemanage-2.4_rc6.ebuild 3559 SHA256 74bfae2b3a00d2f8867aa8b01418ab66192a6f0e95154a39c5be276a8e07e28b SHA512 b5f9ba1d57a13d2fe91ce5f6a027bfbe29dd07a205c303e8a1c35cd97dadff22fc81f81c02e160133f5ee65ae1fe8eb5c697a48d9328fdfb6a2d73de6f3a8f84 WHIRLPOOL 514e7fe1d288525f0a13ac71c98823a26ae9580de4ecf8725a18a3a97cce351c44d0828acd061d475d03d02843c01bb9d7bd18e43b7a9c23df8a984c48b3aac6 -MISC ChangeLog 11587 SHA256 fcac11e97d2c156e3910ce3493ae9b9026c013d524534bc97c010b4361b455ae SHA512 7cb0cf95eaecb5334f500da9bfaa2bd6cc0cc36a0cec7e8b22073684aa67f0d1f401dd46f704ba3f7ab656450e836ddf01b251cd64612fec8f2e38941d4d5dc7 WHIRLPOOL 818bf457e88c469528d84fcc7ffe786f23a70db7fa39e43193ec600a32d5ad9922ac6ad7f839a46d3da63237eabce3f2dee925516a892fe5e9c2256bc8a5658d +MISC ChangeLog 11831 SHA256 b055bf1eda0e312e338f77e867e96b0a88f75408ec787c0579dd4172d5a2d8e4 SHA512 78a6e89adeec466b6c03c3b801a06bccbf0e61fb4b642d5824a779435879e66b8876262fb517578c60195f2ea73aaa7b8a58ba527db3d6e72f0c1fe0b5026736 WHIRLPOOL 82b475266956d399980c0b516f85c9a3d67c445886d41cd20db37ce27c52bfddf8b6c45eb974cdf6811917d980e3260478d4478aa8698cc4510f4e4c9dc46ede MISC metadata.xml 233 SHA256 c5a240155da9b7588e31ff668d3656486a16868654c076f7e1aea823a6b85ae9 SHA512 96a2805dfeebf2e9458e4b602da2cff381f9a3a2e05feb0b36d22b25cac15417e54c8f0572f14f3f944ca7d20377f20ef217ad51105e273a40525b1174df714a WHIRLPOOL 1e68c6d8f1f0446a8be9a001f4c89d641a2055fc9d440be286f753fbf8a216f9d0ed530694f1ff5859a1604eff125316fdcf9593cb91113e4735cc3fa8e8b9a3 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0 -iQIcBAEBCAAGBQJUZlWOAAoJEC7dUkA7aK9HyToP/0dfzR8b7WdJvGTxGDiSLaDR -Y0Kc0alTpL+m/aMkgREGO1qFtUBGntKNOLFEelTRtpEyPAQdkEuSJOmFNEvjovQM -HqvKJVY3sr0ZnNFr5ooiu0ZCV5f2tIuMs9oafYZSPrg8RakscJbIOdqvV9f5MXtQ -30ffTryrLHEwIu7aazM62h5rEzmyxP79sWQ/em8JYtfJyU1evM6y3VtMiAeRbLNB -NgfSnwjPvS+w2wKHUQnds2zI2Xi+RrChAP+eLHjCshWwcoFHz/nMUL0DhRqkPIsf -NAUrRNrG7KA4OIOv0ilMte0LTNeFTbVRYsAdhi9GlSmBzv287EG4P+uZKxD3nLVB -yiITheyFF6kFd09YRIJkqLl6ascJE94ZWumbanSnTGzB7Yiyc4TL/mJlPQ1ULYNz -cCfedIpB3vA/N9prpni9IP2DPpZm9h6+aHFqtElNGTF2M8YmnoBqmDvEFZnIiGz6 -iUcArR74ahQ2VV1TGNoMA7oJ2JJYF/TBmhE5YA/6bVcF9fFb8QJFaKLMHEZSGq60 -G3Nh2irRu3pzKRvEOtcttOVUkvIHWoD//+lbTJh4y+CClXtPjKO9wBA832r0gabl -h8Thvh7OmXq3w0vjt2wFR6fZACu/iJWxmP3Bm4MVsbGnGRKwa8E4fzW0qX9PtR4L -gTJEkyt52u8Nqlo1UuNW -=lqWw +iQJ8BAEBCABmBQJUcI9PXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w +ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRFMTYyREVBRDFDQ0REMTEzRjA0QjNENDky +QkJFRDlDQjFBNjhFRjU1AAoJECu+2csaaO9VccEQAKDVhrR4UXCABpWExBKJiCzM +RD2otLACzqc/ZdtylMwyZYCLZRXi8SB0H0Sqf0WjHn3aXTQ8r6qnlYG8rgS4kgCI +7c5E0cZ1NO7+ajaamCB+uSGHU2dO/ghZoqeh7aDi2NdReKUXv8nwBJRNZ/9LeoeE +LauzOlKArYNXO+Hu9nXtdsHzbrc2Etkzo77srs60m3q8PDRd1P67doiXtmjucDm0 +01OmS4S9jh3mqDcxoIG6GYmB7NFs5Bmq2/rHst9Qj5wFClwEDyOxk+7ualphtET0 +OqmlnzngpmVl7fBWo/l3KkKN6Z4DAqOWo/awqo4iqe/ViSoVhPBNCl8eE4GlVpUt +k26l8xWrKqqEHvE60t2uXDtTwkLnoCdfwmuzSv45Jx5LghmACpA6L9UjxWklqmgN +42Y4m/8HiewNuBrfgJEgRfIzETqmAGDC1w94PZ5YfhMxhLjMccVM72K1+7S4fif0 +VJRPKTd9qqU8SxQU/WVbMMhQzH6N5GEp66sze2w4wGLnvBuf1VGhLG9H8Du8h50P +bOK/K58WJlIPkkAhJYwkm0/oE8KtGOv1O+4aEUmRbp5pdz9UOR2e1xDXCna/11Ar ++N88Duv1mtMV7oh/4/o69e4FHPy09crxrEPF8df/HsJQ8UDvUxRm6JUZKAoxJC7B +n+bCvlNVb4xjtXR1/RXz +=4jz1 -----END PGP SIGNATURE----- diff --git a/sys-libs/libsemanage/files/0002-semanage_migrate_store-Python3-support.patch b/sys-libs/libsemanage/files/0002-semanage_migrate_store-Python3-support.patch new file mode 100644 index 000000000000..40f821ae20d7 --- /dev/null +++ b/sys-libs/libsemanage/files/0002-semanage_migrate_store-Python3-support.patch @@ -0,0 +1,284 @@ +From 877acdb31ff4261f0fcd03a8fb9ada76703802f3 Mon Sep 17 00:00:00 2001 +From: Jason Zaman <jason@perfinion.com> +Date: Thu, 20 Nov 2014 00:18:59 +0400 +Subject: [PATCH 2/2] semanage_migrate_store: Python3 support + +Mainly used the 2to3 conversion tool. Also added in a __future__ +import so that the script continues to work on Python 2. + +Tested on 2.7, 3.3, 3.4. Should work on 2.6 too but untested. + +Signed-off-by: Jason Zaman <jason@perfinion.com> +Acked-by: Steve Lawrence <slawrence@tresys.com> +--- + libsemanage/utils/semanage_migrate_store | 86 +++++++++++++++++--------------- + 1 file changed, 45 insertions(+), 41 deletions(-) + +diff --git a/libsemanage/utils/semanage_migrate_store b/libsemanage/utils/semanage_migrate_store +index cbc4f31..0371e49 100755 +--- a/libsemanage/utils/semanage_migrate_store ++++ b/libsemanage/utils/semanage_migrate_store +@@ -1,6 +1,7 @@ + #!/usr/bin/python -E + + ++from __future__ import print_function + import os + import errno + import shutil +@@ -16,7 +17,7 @@ try: + import selinux + import semanage + except: +- print >> sys.stderr, "You must install libselinux-python and libsemanage-python before running this tool" ++ print("You must install libselinux-python and libsemanage-python before running this tool", file=sys.stderr) + exit(1) + + +@@ -25,100 +26,103 @@ except: + # For some reason this function doesn't exist in libselinux :\ + def copy_with_context(src, dst): + if DEBUG: +- print "copying %s to %s" % (src, dst) ++ print("copying %s to %s" % (src, dst)) + try: + con = selinux.lgetfilecon_raw(src)[1] + except: +- print >> sys.stderr, "Could not get file context of %s" % src ++ print("Could not get file context of %s" % src, file=sys.stderr) + exit(1) + + try: + selinux.setfscreatecon_raw(con) + except: +- print >> sys.stderr, "Could not set fs create context: %s" %con ++ print("Could not set fs create context: %s" %con, file=sys.stderr) + exit(1) + + try: + shutil.copy2(src, dst) +- except OSError as (err, strerr): +- print >> sys.stderr, "Could not copy %s to %s, %s" %(src, dst, strerr) ++ except OSError as the_err: ++ (err, strerr) = the_err.args ++ print("Could not copy %s to %s, %s" %(src, dst, strerr), file=sys.stderr) + exit(1) + + try: + selinux.setfscreatecon_raw(None) + except: +- print >> sys.stderr, "Could not reset fs create context. May need to relabel system." ++ print("Could not reset fs create context. May need to relabel system.", file=sys.stderr) + + def create_dir_from(src, dst, mode): +- if DEBUG: print "Making directory %s" % dst ++ if DEBUG: print("Making directory %s" % dst) + try: + con = selinux.lgetfilecon_raw(src)[1] + selinux.setfscreatecon_raw(con) + os.makedirs(dst, mode) +- except OSError as (err, stderr): ++ except OSError as the_err: ++ (err, stderr) = the_err.args + if err == errno.EEXIST: + pass + else: +- print >> sys.stderr, "Error creating %s" % dst ++ print("Error creating %s" % dst, file=sys.stderr) + exit(1) + + try: + selinux.setfscreatecon_raw(None) + except: +- print >> sys.stderr, "Could not reset fs create context. May need to relabel system." ++ print("Could not reset fs create context. May need to relabel system.", file=sys.stderr) + + def create_file_from(src, dst): +- if DEBUG: print "Making file %s" % dst ++ if DEBUG: print("Making file %s" % dst) + try: + con = selinux.lgetfilecon_raw(src)[1] + selinux.setfscreatecon_raw(con) + open(dst, 'a').close() +- except OSError as (err, stderr): +- print >> sys.stderr, "Error creating %s" % dst ++ except OSError as the_err: ++ (err, stderr) = the_err.args ++ print("Error creating %s" % dst, file=sys.stderr) + exit(1) + + try: + selinux.setfscreatecon_raw(None) + except: +- print >> sys.stderr, "Could not reset fs create context. May need to relabel system." ++ print("Could not reset fs create context. May need to relabel system.", file=sys.stderr) + + def copy_module(store, name, con, base): +- if DEBUG: print "Install module %s" % name ++ if DEBUG: print("Install module %s" % name) + (file, ext) = os.path.splitext(name) + if ext != ".pp": + # Stray non-pp file in modules directory, skip +- print >> sys.stderr, "warning: %s has invalid extension, skipping" % name ++ print("warning: %s has invalid extension, skipping" % name, file=sys.stderr) + return + try: + selinux.setfscreatecon_raw(con) +- ++ + if base: + root = oldstore_path(store) + else: + root = oldmodules_path(store) + + bottomdir = bottomdir_path(store) +- ++ + os.mkdir("%s/%s" % (bottomdir, file)) + + copy_with_context(os.path.join(root, name), "%s/%s/hll" % (bottomdir, file)) + + # This is the ext file that will eventually be used to choose a compiler +- efile = open("%s/%s/lang_ext" % (bottomdir, file), "w+", 0600) ++ efile = open("%s/%s/lang_ext" % (bottomdir, file), "w+", 0o600) + efile.write("pp") + efile.close() + + except: +- print >> sys.stderr, "Error installing module %s" % name ++ print("Error installing module %s" % name, file=sys.stderr) + exit(1) + + try: + selinux.setfscreatecon_raw(None) + except: +- print >> sys.stderr, "Could not reset fs create context. May need to relabel system." ++ print("Could not reset fs create context. May need to relabel system.", file=sys.stderr) + + def disable_module(file, root, name, disabledmodules): +- if DEBUG: print "Disabling %s" % name ++ if DEBUG: print("Disabling %s" % name) + (disabledname, disabledext) = os.path.splitext(file) + create_file_from(os.path.join(root, name), "%s/%s" % (disabledmodules, disabledname)) + +@@ -131,14 +135,14 @@ def migrate_store(store): + newmodules = newmodules_path(store); + bottomdir = bottomdir_path(store); + +- print "Migrating from %s to %s" % (oldstore, newstore) ++ print("Migrating from %s to %s" % (oldstore, newstore)) + + # Build up new directory structure +- create_dir_from(selinux.selinux_policy_root(), "%s/%s" % (newroot_path(), store), 0755) +- create_dir_from(oldmodules, newstore, 0700) +- create_dir_from(oldstore, newmodules, 0700) +- create_dir_from(oldstore, bottomdir, 0700) +- create_dir_from(oldstore, disabledmodules, 0700) ++ create_dir_from(selinux.selinux_policy_root(), "%s/%s" % (newroot_path(), store), 0o755) ++ create_dir_from(oldmodules, newstore, 0o700) ++ create_dir_from(oldstore, newmodules, 0o700) ++ create_dir_from(oldstore, bottomdir, 0o700) ++ create_dir_from(oldstore, disabledmodules, 0o700) + + # use whatever the file context of bottomdir is for the module directories + con = selinux.lgetfilecon_raw(bottomdir)[1] +@@ -149,7 +153,7 @@ def migrate_store(store): + # Dir structure built, start copying files + for root, dirs, files in os.walk(oldstore): + if root == oldstore: +- # This is the top level directory, need to move ++ # This is the top level directory, need to move + for name in files: + # Check to see if it is in TOPPATHS and copy if so + if name in TOPPATHS: +@@ -164,7 +168,7 @@ def migrate_store(store): + for name in files: + (file, ext) = os.path.splitext(name) + if name == "base.pp": +- print >> sys.stderr, "Error installing module %s, name conflicts with base" % name ++ print("Error installing module %s, name conflicts with base" % name, file=sys.stderr) + exit(1) + elif ext == ".disabled": + disable_module(file, root, name, disabledmodules) +@@ -173,32 +177,32 @@ def migrate_store(store): + + def rebuild_policy(): + # Ok, the modules are loaded, lets try to rebuild the policy +- print "Attempting to rebuild policy from %s" % newroot_path() ++ print("Attempting to rebuild policy from %s" % newroot_path()) + + curstore = selinux.selinux_getpolicytype()[1] + + handle = semanage.semanage_handle_create() + if not handle: +- print >> sys.stderr, "Could not create semanage handle" ++ print("Could not create semanage handle", file=sys.stderr) + exit(1) + + semanage.semanage_select_store(handle, curstore, semanage.SEMANAGE_CON_DIRECT) + + if not semanage.semanage_is_managed(handle): + semanage.semanage_handle_destroy(handle) +- print >> sys.stderr, "SELinux policy is not managed or store cannot be accessed." ++ print("SELinux policy is not managed or store cannot be accessed.", file=sys.stderr) + exit(1) + + rc = semanage.semanage_access_check(handle) + if rc < semanage.SEMANAGE_CAN_WRITE: + semanage.semanage_handle_destroy(handle) +- print >> sys.stderr, "Cannot write to policy store." ++ print("Cannot write to policy store.", file=sys.stderr) + exit(1) + + rc = semanage.semanage_connect(handle) + if rc < 0: + semanage.semanage_handle_destroy(handle) +- print >> sys.stderr, "Could not establish semanage connection" ++ print("Could not establish semanage connection", file=sys.stderr) + exit(1) + + semanage.semanage_set_rebuild(handle, 1) +@@ -206,12 +210,12 @@ def rebuild_policy(): + rc = semanage.semanage_begin_transaction(handle) + if rc < 0: + semanage.semanage_handle_destroy(handle) +- print >> sys.stderr, "Could not begin transaction" ++ print("Could not begin transaction", file=sys.stderr) + exit(1) + + rc = semanage.semanage_commit(handle) + if rc < 0: +- print >> sys.stderr, "Could not commit transaction" ++ print("Could not commit transaction", file=sys.stderr) + + semanage.semanage_handle_destroy(handle) + +@@ -283,7 +287,7 @@ if __name__ == "__main__": + "preserve_tunables" ] + + +- create_dir_from(oldroot_path(), newroot_path(), 0755) ++ create_dir_from(oldroot_path(), newroot_path(), 0o755) + + stores = None + if TYPE is not None: +@@ -299,14 +303,14 @@ if __name__ == "__main__": + + if os.path.isdir(newstore_path(store)): + # store has already been migrated, but old modules dir still exits +- print >> sys.stderr, "warning: Policy type %s has already been migrated, but modules still exist in the old store. Skipping store." % store ++ print("warning: Policy type %s has already been migrated, but modules still exist in the old store. Skipping store." % store, file=sys.stderr) + continue + + migrate_store(store) + + if CLEAN is True: + def remove_error(function, path, execinfo): +- print >> sys.stderr, "warning: Unable to remove old store modules directory %s. Cleaning failed." % oldmodules_path(store) ++ print("warning: Unable to remove old store modules directory %s. Cleaning failed." % oldmodules_path(store), file=sys.stderr) + shutil.rmtree(oldmodules_path(store), onerror=remove_error) + + if NOREBUILD is False: +-- +2.0.4 + diff --git a/sys-libs/libsemanage/libsemanage-2.4_rc6-r1.ebuild b/sys-libs/libsemanage/libsemanage-2.4_rc6-r1.ebuild new file mode 100644 index 000000000000..59e4b4a1adf1 --- /dev/null +++ b/sys-libs/libsemanage/libsemanage-2.4_rc6-r1.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-libs/libsemanage/libsemanage-2.4_rc6-r1.ebuild,v 1.1 2014/11/22 13:27:42 perfinion Exp $ + +EAPI="5" +PYTHON_COMPAT=( python2_7 python3_2 python3_3 python3_4 ) + +inherit multilib python-r1 toolchain-funcs eutils multilib-minimal + +MY_P="${P//_/-}" + +SEPOL_VER="2.4_rc6" +SELNX_VER="2.4_rc6" + +DESCRIPTION="SELinux kernel and policy management library" +HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki" +SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20140826/${MY_P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="python" + +RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}[${MULTILIB_USEDEP}] + >=sys-libs/libselinux-${SELNX_VER}[${MULTILIB_USEDEP}] + >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] + >=dev-libs/ustr-1.0.4-r2[${MULTILIB_USEDEP}] + " +DEPEND="${RDEPEND} + sys-devel/bison + sys-devel/flex + python? ( + >=dev-lang/swig-2.0.4-r1 + virtual/pkgconfig + ${PYTHON_DEPS} + )" + +# tests are not meant to be run outside of the +# full SELinux userland repo +RESTRICT="test" + +S="${WORKDIR}/${MY_P}" + +src_prepare() { + echo "# Set this to true to save the linked policy." >> "${S}/src/semanage.conf" + echo "# This is normally only useful for analysis" >> "${S}/src/semanage.conf" + echo "# or debugging of policy." >> "${S}/src/semanage.conf" + echo "save-linked=false" >> "${S}/src/semanage.conf" + echo >> "${S}/src/semanage.conf" + echo "# Set this to 0 to disable assertion checking." >> "${S}/src/semanage.conf" + echo "# This should speed up building the kernel policy" >> "${S}/src/semanage.conf" + echo "# from policy modules, but may leave you open to" >> "${S}/src/semanage.conf" + echo "# dangerous rules which assertion checking" >> "${S}/src/semanage.conf" + echo "# would catch." >> "${S}/src/semanage.conf" + echo "expand-check=1" >> "${S}/src/semanage.conf" + echo >> "${S}/src/semanage.conf" + echo "# Modules in the module store can be compressed" >> "${S}/src/semanage.conf" + echo "# with bzip2. Set this to the bzip2 blocksize" >> "${S}/src/semanage.conf" + echo "# 1-9 when compressing. The higher the number," >> "${S}/src/semanage.conf" + echo "# the more memory is traded off for disk space." >> "${S}/src/semanage.conf" + echo "# Set to 0 to disable bzip2 compression." >> "${S}/src/semanage.conf" + echo "bzip-blocksize=0" >> "${S}/src/semanage.conf" + echo >> "${S}/src/semanage.conf" + echo "# Reduce memory usage for bzip2 compression and" >> "${S}/src/semanage.conf" + echo "# decompression of modules in the module store." >> "${S}/src/semanage.conf" + echo "bzip-small=true" >> "${S}/src/semanage.conf" + + epatch "${FILESDIR}/0002-semanage_migrate_store-Python3-support.patch" # bug 529252 + + epatch_user + + multilib_copy_sources +} + +multilib_src_compile() { + emake \ + AR="$(tc-getAR)" \ + CC="$(tc-getCC)" \ + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \ + all + + if multilib_is_native_abi && use python; then + building_py() { + python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH + emake CC="$(tc-getCC)" PYINC="-I${PYTHON_INCLUDEDIR}" PYTHONLBIDIR="${PYTHON_LIBPATH}" PYPREFIX="${EPYTHON##*/}" "$@" + } + python_foreach_impl building_py swigify + python_foreach_impl building_py pywrap + fi +} + +multilib_src_install() { + emake \ + LIBDIR="${ED}/usr/$(get_libdir)" \ + SHLIBDIR="${ED}/usr/$(get_libdir)" \ + DESTDIR="${ED}" install + + if multilib_is_native_abi && use python; then + installation_py() { + emake DESTDIR="${ED}" LIBDIR="${ED}/usr/$(get_libdir)" \ + SHLIBDIR="${ED}/usr/$(get_libdir)" install-pywrap + } + python_foreach_impl installation_py + fi +} |