Skip to content

Commit

Permalink
Bump UUID to regenerate all nix-alien files
Browse files Browse the repository at this point in the history
Since there is so many changes in nix-alien right now, this commit will
bump the UUID used as a base for hashing the names, so we can ensure
everyone will use the new changes.
  • Loading branch information
thiagokokada committed Oct 24, 2023
1 parent 1c77644 commit fc1baf7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion nix_alien/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from string import Template
from typing import Callable, Optional

UUID_NAMESPACE = uuid.UUID("f318d4a6-dd46-47ce-995d-e95c17cadcc0")
UUID_NAMESPACE = uuid.UUID("eebf3397-2041-4370-bf33-937b33d5c959")


def edit_file(file: Path) -> subprocess.CompletedProcess:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_fhs_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def test_main_with_print(monkeypatch, capsys):
assert (
out
== """\
/home/nameless-shelter/.cache/nix-alien/b5ae45f6-276c-53a3-93ab-4a44f35976a4/fhs-env/default.nix
/home/nameless-shelter/.cache/nix-alien/d51a223b-43f0-56c6-b5c8-2404823026ac/fhs-env/default.nix
"""
)

Expand All @@ -246,6 +246,6 @@ def test_main_with_print(monkeypatch, capsys):
assert (
out
== """\
/home/nameless-shelter/.cache/nix-alien/b5ae45f6-276c-53a3-93ab-4a44f35976a4/fhs-env/flake.nix
/home/nameless-shelter/.cache/nix-alien/d51a223b-43f0-56c6-b5c8-2404823026ac/fhs-env/flake.nix
"""
)
18 changes: 9 additions & 9 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ def test_edit_file(monkeypatch):
def test_get_hash_for_program(monkeypatch):
monkeypatch.setenv("HOME", "/home/nameless-shelter")
assert helpers.get_hash_for_program("/home/nameless-shelter/abc") == UUID(
"d0efaea7-176f-56e6-99a0-ea49599a163b"
"0acc4435-07de-59bf-a1c3-a42f55aaca35"
)
assert helpers.get_hash_for_program("~/abc") == UUID(
"d0efaea7-176f-56e6-99a0-ea49599a163b"
"0acc4435-07de-59bf-a1c3-a42f55aaca35"
)
assert helpers.get_hash_for_program("/abc") == UUID(
"f52177f5-def5-5d9e-91fc-ef1283fc54b1"
"cf2f97e0-6eec-5407-aea0-bbecc488d451"
)
assert helpers.get_hash_for_program("/./abc") == UUID(
"f52177f5-def5-5d9e-91fc-ef1283fc54b1"
"cf2f97e0-6eec-5407-aea0-bbecc488d451"
)
assert helpers.get_hash_for_program("/xyz/../abc") == UUID(
"f52177f5-def5-5d9e-91fc-ef1283fc54b1"
"cf2f97e0-6eec-5407-aea0-bbecc488d451"
)


def test_get_cache_path(monkeypatch):
monkeypatch.setenv("HOME", "/home/nameless-shelter")
assert helpers.get_cache_path("/abc") == Path(
"/home/nameless-shelter/.cache/nix-alien/f52177f5-def5-5d9e-91fc-ef1283fc54b1"
"/home/nameless-shelter/.cache/nix-alien/cf2f97e0-6eec-5407-aea0-bbecc488d451"
)

monkeypatch.setenv("XDG_CACHE_HOME", "/")
assert helpers.get_cache_path("/abc") == Path(
"/nix-alien/f52177f5-def5-5d9e-91fc-ef1283fc54b1"
"/nix-alien/cf2f97e0-6eec-5407-aea0-bbecc488d451"
)


Expand All @@ -48,7 +48,7 @@ def test_get_dest_path(monkeypatch):
directory="bar",
filename="foo.nix",
) == Path(
"/home/nameless-shelter/.cache/nix-alien/f52177f5-def5-5d9e-91fc-ef1283fc54b1/bar/foo.nix"
"/home/nameless-shelter/.cache/nix-alien/cf2f97e0-6eec-5407-aea0-bbecc488d451/bar/foo.nix"
)

monkeypatch.setenv("XDG_CACHE_HOME", "/")
Expand All @@ -57,7 +57,7 @@ def test_get_dest_path(monkeypatch):
program="/abc",
directory="bar",
filename="foo.nix",
) == Path("/nix-alien/f52177f5-def5-5d9e-91fc-ef1283fc54b1/bar/foo.nix")
) == Path("/nix-alien/cf2f97e0-6eec-5407-aea0-bbecc488d451/bar/foo.nix")

assert helpers.get_dest_path(
destination="/quux",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_nix_ld.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def test_main_with_print(monkeypatch, capsys):
assert (
out
== """\
/home/nameless-shelter/.cache/nix-alien/b5ae45f6-276c-53a3-93ab-4a44f35976a4/nix-ld/default.nix
/home/nameless-shelter/.cache/nix-alien/d51a223b-43f0-56c6-b5c8-2404823026ac/nix-ld/default.nix
"""
)

Expand All @@ -251,6 +251,6 @@ def test_main_with_print(monkeypatch, capsys):
assert (
out
== """\
/home/nameless-shelter/.cache/nix-alien/b5ae45f6-276c-53a3-93ab-4a44f35976a4/nix-ld/flake.nix
/home/nameless-shelter/.cache/nix-alien/d51a223b-43f0-56c6-b5c8-2404823026ac/nix-ld/flake.nix
"""
)

0 comments on commit fc1baf7

Please sign in to comment.