mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
AUR bearhub: fix stale source cache collision (pkgrel=10)
Use tag-specific tarball name bearhub-0.10.7-bearhub.6.tar.gz so makepkg and AUR helpers do not reuse an outdated bearhub-0.10.7.tar.gz from cache. Ignore makepkg artifacts under packaging/aur/.
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
from logging import Logger
|
||||
from pathlib import Path
|
||||
|
||||
from bauh.api.paths import CACHE_DIR
|
||||
|
||||
SYNC_FILE = f'{CACHE_DIR}/arch/mirrors_sync'
|
||||
|
||||
|
||||
def should_sync(logger: logging.Logger):
|
||||
if os.path.exists(SYNC_FILE):
|
||||
with open(SYNC_FILE) as f:
|
||||
sync_file = f.read()
|
||||
|
||||
try:
|
||||
sync_time = datetime.fromtimestamp(int(sync_file))
|
||||
now = datetime.now()
|
||||
|
||||
if now > sync_time and now.day != sync_time.day:
|
||||
logger.info("Package databases synchronization out of date")
|
||||
else:
|
||||
msg = "Package databases already synchronized"
|
||||
logger.info(msg)
|
||||
return False
|
||||
except Exception:
|
||||
logger.warning("Could not convert the database synchronization time from '{}".format(SYNC_FILE))
|
||||
traceback.print_exc()
|
||||
return True
|
||||
|
||||
|
||||
def register_sync(logger: Logger):
|
||||
try:
|
||||
Path('/'.join(SYNC_FILE.split('/')[0:-1])).mkdir(parents=True, exist_ok=True)
|
||||
with open(SYNC_FILE, 'w+') as f:
|
||||
f.write(str(int(time.time())))
|
||||
except Exception:
|
||||
logger.error("Could not write to mirrors sync file '{}'".format(SYNC_FILE))
|
||||
traceback.print_exc()
|
||||
Reference in New Issue
Block a user