mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
nix-channels: minor fixes
This commit is contained in:
parent
35c2897988
commit
143744c934
@ -374,7 +374,7 @@ def garbage_collect():
|
|||||||
|
|
||||||
for release in (working_dir / RELEASES_DIR).iterdir():
|
for release in (working_dir / RELEASES_DIR).iterdir():
|
||||||
channel = release.name.split('@')[0]
|
channel = release.name.split('@')[0]
|
||||||
date_str = (release / '.released-time').read_text
|
date_str = (release / '.released-time').read_text()
|
||||||
released_date = datetime.strptime(date_str, '%Y-%m-%d %H:%M:%S')
|
released_date = datetime.strptime(date_str, '%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
if released_date >= time_threshold:
|
if released_date >= time_threshold:
|
||||||
@ -407,7 +407,7 @@ def garbage_collect():
|
|||||||
stdout=subprocess.PIPE
|
stdout=subprocess.PIPE
|
||||||
)
|
)
|
||||||
|
|
||||||
for path in process.stdout.splitlines():
|
for path in process.stdout.decode().splitlines():
|
||||||
closure.add(hash_part(path))
|
closure.add(hash_part(path))
|
||||||
|
|
||||||
logging.info(f' - {len(closure)} paths in closure')
|
logging.info(f' - {len(closure)} paths in closure')
|
||||||
@ -418,16 +418,16 @@ def garbage_collect():
|
|||||||
if not path.name.endswith('.narinfo'):
|
if not path.name.endswith('.narinfo'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
hash = path.split('.narinfo', 1)[0]
|
hash = path.name.split('.narinfo', 1)[0]
|
||||||
if hash in closure:
|
if hash in closure:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
deleted += 1
|
deleted += 1
|
||||||
|
|
||||||
if DELETE_OLD:
|
if DELETE_OLD:
|
||||||
narinfo = parse_narinfo(path.read_text)
|
narinfo = parse_narinfo(path.read_text())
|
||||||
path.unlink()
|
path.unlink(missing_ok=True)
|
||||||
(working_dir / STORE_DIR / narinfo['URL']).unlink()
|
(working_dir / STORE_DIR / narinfo['URL']).unlink(missing_ok=True)
|
||||||
|
|
||||||
if DELETE_OLD:
|
if DELETE_OLD:
|
||||||
logging.info(f' - {deleted} paths deleted')
|
logging.info(f' - {deleted} paths deleted')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user