b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | # |
| 2 | # This is free software, licensed under the GNU General Public License v2. |
| 3 | # See /LICENSE for more information. |
| 4 | # |
| 5 | |
| 6 | include $(TOPDIR)/rules.mk |
| 7 | |
| 8 | PKG_NAME:=selinux-python |
| 9 | PKG_VERSION:=3.5 |
| 10 | PKG_RELEASE:=1 |
| 11 | |
| 12 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz |
| 13 | PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/$(PKG_VERSION) |
| 14 | PKG_HASH:=8245bb4dae59333461f19ca0c79a829081f07972fa5e3ad4c2b2b917dd71d96b |
| 15 | |
| 16 | PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com> |
| 17 | PKG_LICENSE:=GPL-2.0-only |
| 18 | PKG_LICENSE_FILES:=LICENSE |
| 19 | |
| 20 | PKG_BUILD_PARALLEL:=1 |
| 21 | PKG_INSTALL:=1 |
| 22 | PYTHON3_PKG_BUILD:=0 |
| 23 | |
| 24 | include $(INCLUDE_DIR)/package.mk |
| 25 | include ../../lang/python/python3-package.mk |
| 26 | |
| 27 | # |
| 28 | # common definitions |
| 29 | # |
| 30 | |
| 31 | define Package/selinux-python/Default |
| 32 | URL:=http://selinuxproject.org/page/Main_Page |
| 33 | DEPENDS:=+python3-light |
| 34 | endef |
| 35 | |
| 36 | define Package/selinux-python/Default/python |
| 37 | $(call Package/selinux-python/Default) |
| 38 | SUBMENU:=Python |
| 39 | SECTION:=lang |
| 40 | CATEGORY:=Languages |
| 41 | endef |
| 42 | |
| 43 | define Package/selinux-python/Default/util |
| 44 | $(call Package/selinux-python/Default) |
| 45 | SECTION:=utils |
| 46 | CATEGORY:=Utilities |
| 47 | TITLE:=SELinux management utility |
| 48 | endef |
| 49 | |
| 50 | define Package/selinux-python/Default/description |
| 51 | A set of SELinux tools written in Python that help with managing a |
| 52 | system with SELinux enabled. |
| 53 | endef |
| 54 | |
| 55 | MAKE_VARS = \ |
| 56 | $(PYTHON3_VARS) \ |
| 57 | $(HOST_PYTHON3_PIP_VARS) \ |
| 58 | PYTHON_SETUP_ARGS=--no-compile |
| 59 | |
| 60 | define Build/Compile |
| 61 | $(call Build/Compile/Default,all) |
| 62 | endef |
| 63 | |
| 64 | # |
| 65 | # python3-seobject |
| 66 | # |
| 67 | |
| 68 | define Package/python3-seobject |
| 69 | $(call Package/selinux-python/Default/python) |
| 70 | TITLE:=SELinux seobject library |
| 71 | DEPENDS+= +python3-selinux +python3-semanage +python3-sepolicy +python3-setools |
| 72 | endef |
| 73 | |
| 74 | define Package/python3-seobject/description |
| 75 | $(call Package/selinux-python/Default/description) |
| 76 | |
| 77 | This package contains the seobject library. |
| 78 | endef |
| 79 | |
| 80 | define Py3Package/python3-seobject/filespec |
| 81 | +|$(PYTHON3_PKG_DIR)/seobject.py |
| 82 | endef |
| 83 | |
| 84 | Py3Package/python3-seobject/install:=: |
| 85 | |
| 86 | # |
| 87 | # python3-sepolgen |
| 88 | # |
| 89 | |
| 90 | define Package/python3-sepolgen |
| 91 | $(call Package/selinux-python/Default/python) |
| 92 | TITLE:=SELinux policy generation library |
| 93 | DEPENDS+= +python3-selinux |
| 94 | endef |
| 95 | |
| 96 | define Package/python3-sepolgen/description |
| 97 | $(call Package/selinux-python/Default/description) |
| 98 | |
| 99 | This package contains the SELinux policy generation Python library. |
| 100 | endef |
| 101 | |
| 102 | define Package/python3-sepolgen/conffiles |
| 103 | /etc/sepolgen/ |
| 104 | endef |
| 105 | |
| 106 | define Py3Package/python3-sepolgen/filespec |
| 107 | +|$(PYTHON3_PKG_DIR)/sepolgen |
| 108 | endef |
| 109 | |
| 110 | define Py3Package/python3-sepolgen/install |
| 111 | $(INSTALL_DIR) $(1)/etc/sepolgen |
| 112 | $(INSTALL_DATA) $(PKG_INSTALL_DIR)/var/lib/sepolgen/perm_map $(1)/etc/sepolgen/ |
| 113 | endef |
| 114 | |
| 115 | # |
| 116 | # python3-sepolicy |
| 117 | # |
| 118 | |
| 119 | define Package/python3-sepolicy |
| 120 | $(call Package/selinux-python/Default/python) |
| 121 | TITLE:=SELinux Policy Analyses binding |
| 122 | DEPENDS+= +python3-selinux +python3-sepolgen +python3-xml +python3-setools |
| 123 | endef |
| 124 | |
| 125 | define Package/python3-sepolicy/description |
| 126 | $(call Package/selinux-python/Default/description) |
| 127 | |
| 128 | This package contains a Python binding for SELinux Policy Analyses. |
| 129 | endef |
| 130 | |
| 131 | define Py3Package/python3-sepolicy/filespec |
| 132 | +|$(PYTHON3_PKG_DIR)/sepolicy |
| 133 | -|$(PYTHON3_PKG_DIR)/sepolicy/gui.py |
| 134 | -|$(PYTHON3_PKG_DIR)/sepolicy/sedbus.py |
| 135 | +|$(PYTHON3_PKG_DIR)/sepolicy-$(PKG_VERSION).dist-info |
| 136 | endef |
| 137 | |
| 138 | Py3Package/python3-sepolicy/install:=: |
| 139 | |
| 140 | # |
| 141 | # selinux-audit2allow |
| 142 | # |
| 143 | |
| 144 | define Package/selinux-audit2allow |
| 145 | $(call Package/selinux-python/Default/util) |
| 146 | TITLE+= audit2allow |
| 147 | DEPENDS+= +python3-selinux +python3-sepolgen |
| 148 | endef |
| 149 | |
| 150 | define Package/selinux-audit2allow/description |
| 151 | $(call Package/selinux-python/Default/description) |
| 152 | |
| 153 | This package contains the audit2allow and audit2why tools. |
| 154 | endef |
| 155 | |
| 156 | define Package/selinux-audit2allow/install |
| 157 | $(INSTALL_DIR) $(1)/usr/bin |
| 158 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/audit2allow $(1)/usr/bin/ |
| 159 | $(LN) audit2allow $(1)/usr/bin/audit2why |
| 160 | endef |
| 161 | |
| 162 | # |
| 163 | # selinux-chchat |
| 164 | # |
| 165 | |
| 166 | define Package/selinux-chcat |
| 167 | $(call Package/selinux-python/Default/util) |
| 168 | TITLE+= chcat |
| 169 | DEPENDS+= +python3-selinux +python3-seobject +selinux-semanage |
| 170 | endef |
| 171 | |
| 172 | define Package/selinux-chcat/description |
| 173 | $(call Package/selinux-python/Default/description) |
| 174 | |
| 175 | This package contains the chcat tool. |
| 176 | endef |
| 177 | |
| 178 | define Package/selinux-chcat/install |
| 179 | $(INSTALL_DIR) $(1)/usr/bin |
| 180 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/chcat $(1)/usr/bin/ |
| 181 | endef |
| 182 | |
| 183 | # |
| 184 | # selinux-python |
| 185 | # |
| 186 | |
| 187 | define Package/selinux-python |
| 188 | $(call Package/selinux-python/Default/util) |
| 189 | TITLE+= meta-package |
| 190 | DEPENDS:= \ |
| 191 | +selinux-audit2allow \ |
| 192 | +selinux-chcat \ |
| 193 | +selinux-semanage \ |
| 194 | +selinux-sepolgen-ifgen \ |
| 195 | +selinux-sepolicy |
| 196 | endef |
| 197 | |
| 198 | define Package/selinux-python/description |
| 199 | $(call Package/selinux-python/Default/description) |
| 200 | |
| 201 | This is a meta-package that installs all of the SELinux management |
| 202 | utilities. |
| 203 | endef |
| 204 | |
| 205 | Package/selinux-python/install:=: |
| 206 | |
| 207 | # |
| 208 | # selinux-semanage |
| 209 | # |
| 210 | |
| 211 | define Package/selinux-semanage |
| 212 | $(call Package/selinux-python/Default/util) |
| 213 | TITLE+= semanage |
| 214 | DEPENDS+= +python3-seobject |
| 215 | endef |
| 216 | |
| 217 | define Package/selinux-semanage/description |
| 218 | $(call Package/selinux-python/Default/description) |
| 219 | |
| 220 | This package contains the semanage tool. |
| 221 | endef |
| 222 | |
| 223 | define Package/selinux-semanage/install |
| 224 | $(INSTALL_DIR) $(1)/usr/sbin |
| 225 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/semanage $(1)/usr/sbin/ |
| 226 | endef |
| 227 | |
| 228 | # |
| 229 | # selinux-sepolgen-ifgen |
| 230 | # |
| 231 | |
| 232 | define Package/selinux-sepolgen-ifgen |
| 233 | $(call Package/selinux-python/Default/util) |
| 234 | TITLE+= sepolgen-ifgen |
| 235 | DEPENDS+= +python3-selinux +python3-sepolgen +libselinux |
| 236 | endef |
| 237 | |
| 238 | define Package/selinux-sepolgen-iften/description |
| 239 | $(call Package/selinux-python/Default/description) |
| 240 | |
| 241 | This package contains the sepolgen-ifgen tool. |
| 242 | endef |
| 243 | |
| 244 | define Package/selinux-sepolgen-ifgen/install |
| 245 | $(INSTALL_DIR) $(1)/usr/bin |
| 246 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sepolgen-ifgen $(1)/usr/bin/ |
| 247 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sepolgen-ifgen-attr-helper $(1)/usr/bin/ |
| 248 | endef |
| 249 | |
| 250 | # |
| 251 | # selinux-sepolicy |
| 252 | # |
| 253 | |
| 254 | define Package/selinux-sepolicy |
| 255 | $(call Package/selinux-python/Default/util) |
| 256 | TITLE+= sepolicy |
| 257 | DEPENDS+= +python3-multiprocessing +python3-selinux +python3-sepolicy |
| 258 | endef |
| 259 | |
| 260 | define Package/selinux-sepolicy/description |
| 261 | $(call Package/selinux-python/Default/description) |
| 262 | |
| 263 | This package contains the sepolicy and sepolgen tools. |
| 264 | endef |
| 265 | |
| 266 | define Package/selinux-sepolicy/install |
| 267 | $(INSTALL_DIR) $(1)/usr/bin |
| 268 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sepolicy $(1)/usr/bin/ |
| 269 | $(LN) sepolicy $(1)/usr/bin/sepolgen |
| 270 | endef |
| 271 | |
| 272 | $(eval $(call Py3Package,python3-seobject)) |
| 273 | $(eval $(call Py3Package,python3-sepolgen)) |
| 274 | $(eval $(call Py3Package,python3-sepolicy)) |
| 275 | |
| 276 | $(eval $(call BuildPackage,python3-seobject)) |
| 277 | $(eval $(call BuildPackage,python3-sepolgen)) |
| 278 | $(eval $(call BuildPackage,python3-sepolicy)) |
| 279 | |
| 280 | $(eval $(call BuildPackage,python3-seobject-src)) |
| 281 | $(eval $(call BuildPackage,python3-sepolgen-src)) |
| 282 | $(eval $(call BuildPackage,python3-sepolicy-src)) |
| 283 | |
| 284 | $(eval $(call BuildPackage,selinux-audit2allow)) |
| 285 | $(eval $(call BuildPackage,selinux-chcat)) |
| 286 | $(eval $(call BuildPackage,selinux-python)) |
| 287 | $(eval $(call BuildPackage,selinux-semanage)) |
| 288 | $(eval $(call BuildPackage,selinux-sepolgen-ifgen)) |
| 289 | $(eval $(call BuildPackage,selinux-sepolicy)) |