summaryrefslogtreecommitdiff
path: root/apply/resolv.py
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-04-24 20:28:44 +0200
committerJulian T <julian@jtle.dk>2021-04-24 20:32:37 +0200
commit0c24ead1cb0126a1847c2ed971649e9ee25e920e (patch)
tree20a9e5e791b72696f3784fa4580530a5f3d16810 /apply/resolv.py
parent62d63afb0783b42f9f6bdbecc81b701b9d629093 (diff)
Add status subcommand
Diffstat (limited to 'apply/resolv.py')
-rw-r--r--apply/resolv.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/apply/resolv.py b/apply/resolv.py
index eba5ed1..93d0566 100644
--- a/apply/resolv.py
+++ b/apply/resolv.py
@@ -1,7 +1,6 @@
from pathlib import Path
from .writer import Writer
from .state import StateFile, FileState
-import os
class Resolver:
@@ -16,17 +15,6 @@ class Resolver:
self.override = override
self.state = state
- def check_location(self, path: Path) -> FileState:
- if not path.exists():
- return FileState.Unused
-
- if path.is_symlink():
- dest = Path(os.path.realpath(str(path)))
- if Path.cwd() in dest.parents:
- return FileState.create_owned(dest)
-
- return FileState.Used
-
def check_parent(self, path: Path, packagename):
"""
Check if parents exists, and if we created them mark them
@@ -46,7 +34,7 @@ class Resolver:
def do_link(self, package, ppath: Path):
dest = Path(self.applydir, ppath)
- dest_state = self.check_location(dest)
+ dest_state = FileState.check_location(dest)
if not self.override and not dest_state.can_write():
# Check if it's a pointer to the correct location
@@ -58,7 +46,7 @@ class Resolver:
self.check_parent(dest, package)
target_abs = Path.cwd().joinpath(Path(package, ppath))
- if dest_state == FileState.Owned \
+ if dest_state == FileState.Owned and dest_state.link_intact()\
and dest_state.links_to() == target_abs:
return