Support for host cache
This commit is contained in:
parent
3b6650efdb
commit
2c5b9ab442
@ -27,28 +27,33 @@ class Packages:
|
|||||||
update='apk update',
|
update='apk update',
|
||||||
upgrade='apk upgrade',
|
upgrade='apk upgrade',
|
||||||
install='apk add',
|
install='apk add',
|
||||||
|
host=None,
|
||||||
),
|
),
|
||||||
apt=dict(
|
apt=dict(
|
||||||
update='apt-get -y update',
|
update='apt-get -y update',
|
||||||
upgrade='apt-get -y upgrade',
|
upgrade='apt-get -y upgrade',
|
||||||
install='apt-get -y --no-install-recommends install',
|
install='apt-get -y --no-install-recommends install',
|
||||||
|
host=None,
|
||||||
),
|
),
|
||||||
pacman=dict(
|
pacman=dict(
|
||||||
update='pacman -Sy',
|
update='pacman -Sy',
|
||||||
upgrade='pacman -Su --noconfirm',
|
upgrade='pacman -Su --noconfirm',
|
||||||
install='pacman -S --noconfirm',
|
install='pacman -S --noconfirm',
|
||||||
lastupdate='stat -c %Y /var/lib/pacman/sync/core.db',
|
lastupdate='stat -c %Y /var/lib/pacman/sync/core.db',
|
||||||
|
host='/var/lib/pacman',
|
||||||
),
|
),
|
||||||
dnf=dict(
|
dnf=dict(
|
||||||
update='dnf makecache --assumeyes',
|
update='dnf makecache --assumeyes',
|
||||||
upgrade='dnf upgrade --best --assumeyes --skip-broken', # noqa
|
upgrade='dnf upgrade --best --assumeyes --skip-broken', # noqa
|
||||||
install='dnf install --setopt=install_weak_deps=False --best --assumeyes', # noqa
|
install='dnf install --setopt=install_weak_deps=False --best --assumeyes', # noqa
|
||||||
lastupdate='stat -c %Y /var/cache/dnf/* | head -n1',
|
lastupdate='stat -c %Y /var/cache/dnf/* | head -n1',
|
||||||
|
host=None,
|
||||||
),
|
),
|
||||||
yum=dict(
|
yum=dict(
|
||||||
update='yum update',
|
update='yum update',
|
||||||
upgrade='yum upgrade',
|
upgrade='yum upgrade',
|
||||||
install='yum install',
|
install='yum install',
|
||||||
|
host=None,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -62,6 +67,12 @@ class Packages:
|
|||||||
self.packages += line.split(' ')
|
self.packages += line.split(' ')
|
||||||
|
|
||||||
async def cache_setup(self, target):
|
async def cache_setup(self, target):
|
||||||
|
# Try to use the host cache directory if present rather than home
|
||||||
|
# directory, in cases where host and guest are the same distros
|
||||||
|
hostpath = self.mgrs[self.mgr]['host']
|
||||||
|
if target.exists(hostpath):
|
||||||
|
self.cache_root = hostpath
|
||||||
|
|
||||||
if 'CACHE_DIR' in os.environ:
|
if 'CACHE_DIR' in os.environ:
|
||||||
self.cache_root = os.path.join(os.getenv('CACHE_DIR'))
|
self.cache_root = os.path.join(os.getenv('CACHE_DIR'))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user