Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local: set metadata_expire to zero by default #544

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions etc/dnf/plugins/local.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ enabled = true
# Path to the local repository.
# repodir = /var/lib/dnf/plugins/local

# Sets how long DNF should cache local repo metadata, in seconds.
# By default this is set to zero to trigger a refresh every time.
# metadata_expire = 0

# Createrepo options. See man createrepo_c
[createrepo]
# This option lets you disable createrepo command. This could be useful
Expand Down
6 changes: 6 additions & 0 deletions plugins/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ def parse_config(self):
else:
crepo["verbose"] = False

if conf.has_option("main", "metadata_expire"):
main["metadata_expire"] = conf.getint("main", "metadata_expire")
else:
main["metadata_expire"] = 0

return main, crepo


Expand Down Expand Up @@ -104,6 +109,7 @@ def pre_config(self):
local_repo = dnf.repo.Repo("_dnf_local", self.base.conf)
local_repo.baseurl = "file://{}".format(self.main["repodir"])
local_repo.cost = 500
local_repo.metadata_expire = self.main["metadata_expire"]
local_repo.skip_if_unavailable = True
self.base.repos.add(local_repo)

Expand Down
Loading