mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 15:27:17 +00:00
remote all gitfiles in git remote trigger
In case if there is .gitignore file with asterics, the pkgbuild upload would not appear
This commit is contained in:
parent
214d6d7fdd
commit
2c2eae2334
@ -81,7 +81,8 @@ class RemotePush(LazyLogging):
|
|||||||
# ...secondly, we clone whole tree...
|
# ...secondly, we clone whole tree...
|
||||||
Sources.fetch(package_target_dir, package.remote)
|
Sources.fetch(package_target_dir, package.remote)
|
||||||
# ...and last, but not least, we remove the dot-git directory...
|
# ...and last, but not least, we remove the dot-git directory...
|
||||||
shutil.rmtree(package_target_dir / ".git", ignore_errors=True)
|
for git_file in package_target_dir.glob(".git*"):
|
||||||
|
shutil.rmtree(package_target_dir / git_file)
|
||||||
# ...copy all patches...
|
# ...copy all patches...
|
||||||
for patch in self.database.patches_get(package.base):
|
for patch in self.database.patches_get(package.base):
|
||||||
filename = f"ahriman-{package.base}.patch" if patch.key is None else f"ahriman-{patch.key}.patch"
|
filename = f"ahriman-{package.base}.patch" if patch.key is None else f"ahriman-{patch.key}.patch"
|
||||||
|
@ -20,18 +20,21 @@ def test_package_update(database: SQLite, configuration: Configuration, package_
|
|||||||
"""
|
"""
|
||||||
patch1 = PkgbuildPatch(None, "patch")
|
patch1 = PkgbuildPatch(None, "patch")
|
||||||
patch2 = PkgbuildPatch("key", "value")
|
patch2 = PkgbuildPatch("key", "value")
|
||||||
|
local = Path("local")
|
||||||
|
|
||||||
|
glob_mock = mocker.patch("pathlib.Path.glob", return_value=[".git", ".gitignore"])
|
||||||
rmtree_mock = mocker.patch("shutil.rmtree")
|
rmtree_mock = mocker.patch("shutil.rmtree")
|
||||||
fetch_mock = mocker.patch("ahriman.core.build_tools.sources.Sources.fetch")
|
fetch_mock = mocker.patch("ahriman.core.build_tools.sources.Sources.fetch")
|
||||||
patches_mock = mocker.patch("ahriman.core.database.SQLite.patches_get", return_value=[patch1, patch2])
|
patches_mock = mocker.patch("ahriman.core.database.SQLite.patches_get", return_value=[patch1, patch2])
|
||||||
patches_write_mock = mocker.patch("ahriman.models.pkgbuild_patch.PkgbuildPatch.write")
|
patches_write_mock = mocker.patch("ahriman.models.pkgbuild_patch.PkgbuildPatch.write")
|
||||||
runner = RemotePush(configuration, database, "gitremote")
|
runner = RemotePush(configuration, database, "gitremote")
|
||||||
|
|
||||||
local = Path("local")
|
|
||||||
assert runner.package_update(package_ahriman, local) == package_ahriman.base
|
assert runner.package_update(package_ahriman, local) == package_ahriman.base
|
||||||
|
glob_mock.assert_called_once_with(".git*")
|
||||||
rmtree_mock.assert_has_calls([
|
rmtree_mock.assert_has_calls([
|
||||||
MockCall(local / package_ahriman.base, ignore_errors=True),
|
MockCall(local / package_ahriman.base, ignore_errors=True),
|
||||||
MockCall(local / package_ahriman.base / ".git", ignore_errors=True),
|
MockCall(local / package_ahriman.base / ".git"),
|
||||||
|
MockCall(local / package_ahriman.base / ".gitignore"),
|
||||||
])
|
])
|
||||||
fetch_mock.assert_called_once_with(pytest.helpers.anyvar(int), package_ahriman.remote)
|
fetch_mock.assert_called_once_with(pytest.helpers.anyvar(int), package_ahriman.remote)
|
||||||
patches_mock.assert_called_once_with(package_ahriman.base)
|
patches_mock.assert_called_once_with(package_ahriman.base)
|
||||||
|
Loading…
Reference in New Issue
Block a user