summaryrefslogtreecommitdiff
path: root/app-portage
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-01-20 17:37:04 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-01-20 17:37:04 +0000
commitcc591ba8d03842768663c67463304ab2a7914563 (patch)
tree03bf0ec1ac6cd20aa0c5b1df92f5a9d2db25e4a3 /app-portage
parent9bb042c828e3fa5ee9340ac4968f11b6f0383cd6 (diff)
app-portage/flaggie : import from Gentoo, make it work with Sisyphus layout (bugfix : https://bugs.redcorelinux.org/show_bug.cgi?id=148)
Diffstat (limited to 'app-portage')
-rw-r--r--app-portage/flaggie/Manifest1
-rw-r--r--app-portage/flaggie/files/flaggie-0.99.8_sisyphus.patch43
-rw-r--r--app-portage/flaggie/flaggie-0.99.8-r1.ebuild35
3 files changed, 79 insertions, 0 deletions
diff --git a/app-portage/flaggie/Manifest b/app-portage/flaggie/Manifest
new file mode 100644
index 00000000..5fef7c99
--- /dev/null
+++ b/app-portage/flaggie/Manifest
@@ -0,0 +1 @@
+DIST flaggie-0.99.8.tar.gz 17865 BLAKE2B af52f5c030ff81ebd1efac6c02a736c87d0ce8f953722f0f364adf7ace74a26245fb43fb5ba96000fb2da391ff90c6c682522fc5a7725fca0289c1063e4704ac SHA512 77265b2958210a9643776dfaad65d00cd511b2b8d1cedd397c6712559af9c7d671cf286eabd0c866b10408429829615cd2f2b7c3013a99d470be8f2f7e8cccfb
diff --git a/app-portage/flaggie/files/flaggie-0.99.8_sisyphus.patch b/app-portage/flaggie/files/flaggie-0.99.8_sisyphus.patch
new file mode 100644
index 00000000..0b45d116
--- /dev/null
+++ b/app-portage/flaggie/files/flaggie-0.99.8_sisyphus.patch
@@ -0,0 +1,43 @@
+diff -ruN old/flaggie/config.py new/flaggie/config.py
+--- old/flaggie/config.py 2023-01-15 08:39:45.000000000 +0100
++++ new/flaggie/config.py 2023-10-08 12:46:51.500298249 +0200
+@@ -63,6 +63,10 @@
+ COMMENT_RE = re.compile(r"(?<!\S)#(.*)$")
+
+
++def to_sisyphus_filename(filename: str) -> str:
++ return "sisyphus." + re.sub(r'\.(accept_)?', "-", filename) + ".conf"
++
++
+ def find_config_files(config_root: Path, token_type: TokenType) -> list[Path]:
+ """
+ Find all configuration files of given type
+@@ -72,7 +76,11 @@
+ order as they are read by Portage.
+ """
+
+- path = config_root / "etc/portage" / CONFIG_FILENAMES[token_type]
++ filename = CONFIG_FILENAMES[token_type]
++ sisyphus = config_root / "etc/sisyphus" / to_sisyphus_filename(filename)
++ if sisyphus.exists():
++ return [sisyphus]
++ path = config_root / "etc/portage" / filename
+
+ # if it's an existing directory, find the last visible file
+ # in the directory (provided there is any)
+diff -ruN old/test/test_config.py new/test/test_config.py
+--- old/test/test_config.py 2023-01-15 08:39:45.000000000 +0100
++++ new/test/test_config.py 2023-10-08 12:35:11.372100053 +0200
+@@ -26,9 +26,11 @@
+ ["package.use/foo.conf"]),
+ # corner case: package.use yielding no valid files
+ (["package.use/.foo"], ["package.use/99local.conf"]),
++ (["sisyphus.package-use.conf"], None),
+ ])
+ def test_find_config(tmp_path, layout, expected):
+- confdir = tmp_path / "etc/portage"
++ sisyphus = layout and layout[0].startswith("sisyphus.")
++ confdir = tmp_path / "etc" / ("sisyphus" if sisyphus else "portage")
+ for f in layout:
+ path = confdir / f
+ path.parent.mkdir(parents=True, exist_ok=True)
diff --git a/app-portage/flaggie/flaggie-0.99.8-r1.ebuild b/app-portage/flaggie/flaggie-0.99.8-r1.ebuild
new file mode 100644
index 00000000..0a52d3da
--- /dev/null
+++ b/app-portage/flaggie/flaggie-0.99.8-r1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=flit
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="A smart CLI mangler for package.* files"
+HOMEPAGE="
+ https://github.com/projg2/flaggie/
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="amd64 arm arm64 ~hppa ~mips ~ppc64 ~riscv x86 ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ >=app-portage/gentoopm-0.5.0[${PYTHON_USEDEP}]
+ dev-python/more-itertools[${PYTHON_USEDEP}]
+ dev-vcs/git
+"
+PATCHES=(
+ "${FILESDIR}/${P}_sisyphus.patch"
+)
+
+distutils_enable_tests pytest
+
+pkg_postinst() {
+ ewarn "This is a preview release of flaggie 1.x. It it not fully featured"
+ ewarn "yet and it may have significant bugs. Please back your /etc/portage"
+ ewarn "up before using it. Verify the results using --pretend."
+}