Bug 735079 - kickstart repo --cost is ignored
Summary: kickstart repo --cost is ignored
Alias: None
Product: Fedora
Classification: Fedora
Component: livecd-tools
Version: 16
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Brian Lane
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2011-09-01 11:23 UTC by Mads Kiilerich
Modified: 2012-05-08 04:32 UTC (History)
6 users (show)

Fixed In Version: livecd-tools-17.11-1.fc17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-05-08 04:32:45 UTC
Type: ---

Attachments (Terms of Use)

Description Mads Kiilerich 2011-09-01 11:23:12 UTC
/usr/share/doc/pykickstart-1.99.3/kickstart-docs.txt and http://fedoraproject.org/wiki/Anaconda/Kickstart describes the repo --cost option.

Building a live image with a kickstart where all repos have a cost specified as
  repo --cost=1 --name=xx --baseurl=file:///home/xxx
do however not work.

Instrumenting /usr/lib/python2.7/site-packages/yum/yumRepo.py __cmp__ in line 289 so it prints the .cost's shows that the repos always has the default value of 1000.

(It also shows that the repos are compared a huge number of times. I wonder if that is intentional and optimal.)


Comment 1 Mads Kiilerich 2011-09-01 11:42:35 UTC
Proof of concept fix - entirely in python-imgcreate:

--- kickstart.py	2011-09-01 13:39:52.486228328 +0200
+++ /usr/lib/python2.7/site-packages/imgcreate/kickstart.py
@@ -511,7 +511,7 @@
         if repos.has_key(repo.name):
             logging.warn("Overriding already specified repo %s" %(repo.name,))
-        repos[repo.name] = (repo.name, baseurl, mirrorlist, proxy, inc, exc)
+        repos[repo.name] = (repo.name, baseurl, mirrorlist, proxy, inc, exc, repo.cost)
     return repos.values()
--- creator.py	2011-09-01 13:32:40.030261984 +0200
+++ /usr/lib/python2.7/site-packages/imgcreate/creator.py
@@ -612,7 +612,7 @@
         ayum.setup(yum_conf, self._instroot)
         for repo in kickstart.get_repos(self.ks, repo_urls):
-            (name, baseurl, mirrorlist, proxy, inc, exc) = repo
+            (name, baseurl, mirrorlist, proxy, inc, exc, cost) = repo
             yr = ayum.addRepository(name, baseurl, mirrorlist)
             if inc:
@@ -621,6 +621,8 @@
                 yr.exclude = exc
             if proxy:
                 yr.proxy = proxy
+            if not cost is None:
+                yr.cost = cost
         if kickstart.exclude_docs(self.ks):
             rpm.addMacro("_excludedocs", "1")

Comment 2 Brian Lane 2011-09-01 15:16:50 UTC
Is this also a problem with anaconda? Or just livecd's?

Comment 3 Mads Kiilerich 2011-09-01 18:41:44 UTC
I don't know. I "never" use anaconda with package installation - I "always" install by letting anaconda resize a live image.

A quick greb for \.cost in /usr/lib/python2.7/site-packages/pyanaconda/yuminstall.py indicates that it do have the right plumbing in place.

(It do however seem like repos with cost 0 will cause problems - even though that would be the most obvious cost to assign to a local file:// repo ...)

Comment 4 Fedora Update System 2012-04-17 00:56:00 UTC
livecd-tools-16.12-1.fc16 has been submitted as an update for Fedora 16.

Comment 5 Fedora Update System 2012-04-17 00:57:06 UTC
livecd-tools-17.8-1.fc17 has been submitted as an update for Fedora 17.

Comment 6 Fedora Update System 2012-04-18 19:43:12 UTC
Package livecd-tools-16.12-1.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing livecd-tools-16.12-1.fc16'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2012-04-24 22:14:24 UTC
livecd-tools-17.9-1.fc17 has been submitted as an update for Fedora 17.

Comment 8 Fedora Update System 2012-04-25 18:08:30 UTC
livecd-tools-16.13-1.fc16 has been submitted as an update for Fedora 16.

Comment 9 Fedora Update System 2012-04-26 22:10:09 UTC
livecd-tools-17.10-1.fc17 has been submitted as an update for Fedora 17.

Comment 10 Fedora Update System 2012-05-03 23:18:41 UTC
livecd-tools-16.15-1.fc16 has been submitted as an update for Fedora 16.

Comment 11 Fedora Update System 2012-05-03 23:34:33 UTC
livecd-tools-17.11-1.fc17 has been submitted as an update for Fedora 17.

Comment 12 Fedora Update System 2012-05-08 04:32:45 UTC
livecd-tools-17.11-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.