This is the thing where your kickstart can say:
repo --name=updates
and anaconda will figure out that you want to use the repo already defined in /etc/anaconda.repos.d. It works with yum, so it also need to work with dnf. --- pyanaconda/packaging/dnfpayload.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/packaging/dnfpayload.py b/pyanaconda/packaging/dnfpayload.py index 7a91c26..fab258f 100644 --- a/pyanaconda/packaging/dnfpayload.py +++ b/pyanaconda/packaging/dnfpayload.py @@ -691,6 +691,16 @@ class DNFPayload(packaging.PackagePayload): checkmount) method = self.data.method
+ # Read in all the repos from the installation environment, make a note of which + # are enabled, and then disable them all. If the user gave us a method, we want + # to use that instead of the default repos. + self._base.read_all_repos() + + enabled = [] + for repo in self._base.repos.iter_enabled(): + enabled.append(repo.name) + repo.disable() + if method.method: try: self._base.conf.releasever = self._getReleaseVersion(url) @@ -716,15 +726,19 @@ class DNFPayload(packaging.PackagePayload): # this preserves the method details while disabling it method.method = None self.install_device = None - - if not method.method: - # only when there's no repo set via method use the repos from the - # install image itself: - log.info('Loading repositories config on the filesystem.') - self._base.read_all_repos() + else: + for (name, repo) in self._base.repos.iteritems(): + if name in enabled: + repo.enable()
for ksrepo in self.data.repo.dataList(): - self._add_repo(ksrepo) + # This is a repo we already have a config file in /etc/anaconda.repos.d, + # so we just need to enable it here. See the kickstart docs for the repo + # command. + if not ksrepo.baseurl and not ksrepo.mirrorlist: + self._base.repos[ksrepo.name].enable() + else: + self._add_repo(ksrepo)
ksnames = [r.name for r in self.data.repo.dataList()] ksnames.append(constants.BASE_REPO_NAME)
This prevents us from leaving /dnf.package.cache around on the installed system. --- pyanaconda/packaging/dnfpayload.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/packaging/dnfpayload.py b/pyanaconda/packaging/dnfpayload.py index fab258f..33438b9 100644 --- a/pyanaconda/packaging/dnfpayload.py +++ b/pyanaconda/packaging/dnfpayload.py @@ -39,6 +39,7 @@ import pyanaconda.errors as errors import pyanaconda.iutil import pyanaconda.localization import pyanaconda.packaging as packaging +import shutil import sys import time from pyanaconda.iutil import ProxyString, ProxyStringError @@ -186,6 +187,7 @@ class DNFPayload(packaging.PackagePayload): raise packaging.PayloadError("unsupported payload type")
self._base = None + self._download_location = None self._configure()
def unsetup(self): @@ -396,6 +398,8 @@ class DNFPayload(packaging.PackagePayload): for repo in self._base.repos.iter_enabled(): repo.pkgdir = pkgdir
+ return pkgdir + def _select_group(self, group_id, default=True, optional=False, required=False): grp = self._base.comps.group_by_pattern(group_id) if grp is None: @@ -605,7 +609,7 @@ class DNFPayload(packaging.PackagePayload): self._setupMedia(self.install_device) try: self.checkSoftwareSelection() - self._pick_download_location() + self._download_location = self._pick_download_location() except packaging.PayloadError as e: if errors.errorHandler.cb(e) == errors.ERROR_RAISE: _failure_limbo() @@ -645,6 +649,7 @@ class DNFPayload(packaging.PackagePayload): progressQ.send_message(post_msg) process.join() self._base.close() + shutil.rmtree(self._download_location)
def getRepo(self, repo_id): """ Return the yum repo object. """
On 01/08/2015 11:58 AM, Chris Lumens wrote:
This prevents us from leaving /dnf.package.cache around on the installed system.
pyanaconda/packaging/dnfpayload.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
This one looks good.
On 01/08/2015 11:58 AM, Chris Lumens wrote:
This is the thing where your kickstart can say:
repo --name=updatesand anaconda will figure out that you want to use the repo already defined in /etc/anaconda.repos.d. It works with yum, so it also need to work with dnf.
pyanaconda/packaging/dnfpayload.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/packaging/dnfpayload.py b/pyanaconda/packaging/dnfpayload.py index 7a91c26..fab258f 100644 --- a/pyanaconda/packaging/dnfpayload.py +++ b/pyanaconda/packaging/dnfpayload.py @@ -691,6 +691,16 @@ class DNFPayload(packaging.PackagePayload): checkmount) method = self.data.method
# Read in all the repos from the installation environment, make a note of which# are enabled, and then disable them all. If the user gave us a method, we want# to use that instead of the default repos.self._base.read_all_repos()enabled = []for repo in self._base.repos.iter_enabled():enabled.append(repo.name)repo.disable()if method.method: try: self._base.conf.releasever = self._getReleaseVersion(url)@@ -716,15 +726,19 @@ class DNFPayload(packaging.PackagePayload): # this preserves the method details while disabling it method.method = None self.install_device = None
if not method.method:# only when there's no repo set via method use the repos from the# install image itself:log.info('Loading repositories config on the filesystem.')self._base.read_all_repos()
else:for (name, repo) in self._base.repos.iteritems():if name in enabled:repo.enable()
This breaks the closest mirror method, since closest mirror works by unsetting ksdata.method.method.
This is the thing where your kickstart can say:
repo --name=updates
and anaconda will figure out that you want to use the repo already defined in /etc/anaconda.repos.d. It works with yum, so it also need to work with dnf. --- pyanaconda/packaging/dnfpayload.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/packaging/dnfpayload.py b/pyanaconda/packaging/dnfpayload.py index 5cde775..0a23f1c 100644 --- a/pyanaconda/packaging/dnfpayload.py +++ b/pyanaconda/packaging/dnfpayload.py @@ -694,6 +694,16 @@ class DNFPayload(packaging.PackagePayload): checkmount) method = self.data.method
+ # Read in all the repos from the installation environment, make a note of which + # are enabled, and then disable them all. If the user gave us a method, we want + # to use that instead of the default repos. + self._base.read_all_repos() + + enabled = [] + for repo in self._base.repos.iter_enabled(): + enabled.append(repo.id) + repo.disable() + if method.method: try: self._base.conf.releasever = self._getReleaseVersion(url) @@ -720,14 +730,20 @@ class DNFPayload(packaging.PackagePayload): method.method = None self.install_device = None
+ # We need to check this again separately in case method.method was unset above. if not method.method: - # only when there's no repo set via method use the repos from the - # install image itself: - log.info('Loading repositories config on the filesystem.') - self._base.read_all_repos() + for (id_, repo) in self._base.repos.iteritems(): + if id_ in enabled: + repo.enable()
for ksrepo in self.data.repo.dataList(): - self._add_repo(ksrepo) + # This is a repo we already have a config file in /etc/anaconda.repos.d, + # so we just need to enable it here. See the kickstart docs for the repo + # command. + if not ksrepo.baseurl and not ksrepo.mirrorlist: + self._base.repos[ksrepo.name].enable() + else: + self._add_repo(ksrepo)
ksnames = [r.name for r in self.data.repo.dataList()] ksnames.append(constants.BASE_REPO_NAME)
On 01/08/2015 04:06 PM, Chris Lumens wrote:
This is the thing where your kickstart can say:
repo --name=updatesand anaconda will figure out that you want to use the repo already defined in /etc/anaconda.repos.d. It works with yum, so it also need to work with dnf.
pyanaconda/packaging/dnfpayload.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
Ack.
anaconda-patches@lists.fedorahosted.org