diff options
| author | root <root@alpha.trunkmasters.com> | 2026-06-20 15:22:35 -0500 |
|---|---|---|
| committer | root <root@alpha.trunkmasters.com> | 2026-06-20 15:22:35 -0500 |
| commit | d5c3c4e8fa2a23a496b46f7cab45deb650cf6758 (patch) | |
| tree | 38422b29a0472716da9b4f5c126b4fcab948dab2 /app-admin | |
| parent | ce8dcbb18030f4e25b245717931f1eabc2f56ff9 (diff) | |
| download | baldeagleos-repo-d5c3c4e8fa2a23a496b46f7cab45deb650cf6758.tar.gz baldeagleos-repo-d5c3c4e8fa2a23a496b46f7cab45deb650cf6758.tar.xz baldeagleos-repo-d5c3c4e8fa2a23a496b46f7cab45deb650cf6758.zip | |
Adding metadata
Diffstat (limited to 'app-admin')
| -rw-r--r-- | app-admin/aerie/aerie-0.2.1-r1.ebuild | 51 | ||||
| -rw-r--r-- | app-admin/aerie/files/aerie-0.2.1-protect-ahead-branch.patch | 90 |
2 files changed, 141 insertions, 0 deletions
diff --git a/app-admin/aerie/aerie-0.2.1-r1.ebuild b/app-admin/aerie/aerie-0.2.1-r1.ebuild new file mode 100644 index 000000000000..bdf909bb293b --- /dev/null +++ b/app-admin/aerie/aerie-0.2.1-r1.ebuild @@ -0,0 +1,51 @@ +# Copyright 2026 BaldEagleOS Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{13..14} ) + +inherit python-single-r1 + +DESCRIPTION="Repository and profile management tool for BaldEagleOS" +HOMEPAGE="https://git.baldeagleos.com/aerie" +SRC_URI="https://distfiles.baldeagleos.com/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 arm64" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RDEPEND=" + ${PYTHON_DEPS} + app-portage/gentoolkit + dev-vcs/git +" + +DOCS=( README.md Changelog ) +PATCHES=( + "${FILESDIR}/${P}-protect-ahead-branch.patch" +) + +pkg_setup() { + python-single-r1_pkg_setup +} + +src_compile() { + : +} + +src_test() { + PYTHONPATH=src "${EPYTHON}" -m unittest discover -s tests || die +} + +src_install() { + python_domodule src/aerie + python_newscript bin/aerie aerie + einstalldocs + + insinto "/etc/${PN}" + doins "etc/${PN}.yml" + doins etc/baldeagleos.conf.example + doins etc/parent.example +} diff --git a/app-admin/aerie/files/aerie-0.2.1-protect-ahead-branch.patch b/app-admin/aerie/files/aerie-0.2.1-protect-ahead-branch.patch new file mode 100644 index 000000000000..967e08dd1dff --- /dev/null +++ b/app-admin/aerie/files/aerie-0.2.1-protect-ahead-branch.patch @@ -0,0 +1,90 @@ +diff --git a/src/aerie/sync.py b/src/aerie/sync.py +index 858bb58..d58a6b7 100644 +--- a/src/aerie/sync.py ++++ b/src/aerie/sync.py +@@ -76,6 +76,26 @@ def ensure_clean_git_tree(path: Path) -> None: + ) + + ++def count_local_commits_to_drop(path: Path, target: str) -> int: ++ commits = run( ++ ["git", "-C", str(path), "rev-list", "--count", f"{target}..HEAD"], ++ capture=True, ++ ) ++ return int(commits.stdout.strip() or "0") ++ ++ ++def ensure_no_local_commits_to_drop(path: Path, target: str) -> None: ++ count = count_local_commits_to_drop(path, target) ++ if count: ++ raise AerieError( ++ f"cannot update {path}; local HEAD has {count} commit(s) that would be " ++ f"discarded by reset to {target}\n" ++ f"Inspect with: git -C {path} log --oneline {target}..HEAD\n" ++ "Publish those commits, disable auto-sync for generated repos, or use " ++ "'aerie sync --force' to discard them." ++ ) ++ ++ + def discard_local_changes(path: Path) -> None: + run(["git", "-C", str(path), "reset", "--hard"]) + run(["git", "-C", str(path), "clean", "-fd"]) +@@ -95,8 +115,11 @@ def update_repo(repo: RepoConfig, release: str, *, force: bool = False) -> None: + else: + ensure_clean_git_tree(repo.location) + run(["git", "-C", str(repo.location), "fetch", "--prune", "origin"]) +- run(["git", "-C", str(repo.location), "checkout", "-B", release, f"origin/{release}"]) +- run(["git", "-C", str(repo.location), "reset", "--hard", f"origin/{release}"]) ++ target = f"origin/{release}" ++ if not force: ++ ensure_no_local_commits_to_drop(repo.location, target) ++ run(["git", "-C", str(repo.location), "checkout", "-B", release, target]) ++ run(["git", "-C", str(repo.location), "reset", "--hard", target]) + + + def sync_repo( +diff --git a/tests/test_sync.py b/tests/test_sync.py +index ab85c07..d15a670 100644 +--- a/tests/test_sync.py ++++ b/tests/test_sync.py +@@ -60,6 +60,40 @@ class SyncTests(unittest.TestCase): + + run.assert_called_once_with(["git", "-C", "/repo", "status", "--porcelain"], capture=True) + ++ def test_update_repo_rejects_local_commits_without_force(self): ++ repo = repo_config(Path("/repo")) ++ ++ with patch("aerie.sync.run") as run: ++ run.side_effect = [ ++ subprocess.CompletedProcess(args=[], returncode=0, stdout=""), ++ subprocess.CompletedProcess(args=[], returncode=0, stdout=""), ++ subprocess.CompletedProcess(args=[], returncode=0, stdout="2\n"), ++ ] ++ with self.assertRaisesRegex(AerieError, "local HEAD has 2 commit"): ++ update_repo(repo, "develop") ++ ++ self.assertEqual( ++ run.call_args_list, ++ [ ++ call( ++ ["git", "-C", "/repo", "status", "--porcelain"], ++ capture=True, ++ ), ++ call(["git", "-C", "/repo", "fetch", "--prune", "origin"]), ++ call( ++ [ ++ "git", ++ "-C", ++ "/repo", ++ "rev-list", ++ "--count", ++ "origin/develop..HEAD", ++ ], ++ capture=True, ++ ), ++ ], ++ ) ++ + def test_run_reports_captured_git_status_stderr(self): + with patch("aerie.sync.subprocess.run") as subprocess_run: + subprocess_run.side_effect = subprocess.CalledProcessError( |
