client/rhel/yum-rhn-plugin/rhnplugin.py | 40 ++++++++++++++++---------
client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec | 6 +++
rel-eng/packages/yum-rhn-plugin | 2 -
3 files changed, 33 insertions(+), 15 deletions(-)
New commits:
commit 9845810362cc698d10307bd4c648bcc187241c91
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Jun 28 11:55:18 2011 +0200
Automatic commit of package [yum-rhn-plugin] release [1.5.7-1].
diff --git a/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
b/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
index a799606..953cc57 100644
--- a/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
+++ b/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
@@ -1,6 +1,6 @@
Summary: RHN support for yum
Name: yum-rhn-plugin
-Version: 1.5.6
+Version: 1.5.7
Release: 1%{?dist}
License: GPLv2
Group: System Environment/Base
@@ -72,6 +72,10 @@ fi
%doc LICENSE
%changelog
+* Tue Jun 28 2011 Miroslav Suchý 1.5.7-1
+- 707241 - create progressbar even during groupinstall and do not delete
+ rhnplugin.repos during groupinstall command (msuchy(a)redhat.com)
+
* Mon May 02 2011 Miroslav Suchý 1.5.6-1
- set proxy_dict only if we have some proxy
- proxy_dict is private attribute
diff --git a/rel-eng/packages/yum-rhn-plugin b/rel-eng/packages/yum-rhn-plugin
index 5d65323..39f4c01 100644
--- a/rel-eng/packages/yum-rhn-plugin
+++ b/rel-eng/packages/yum-rhn-plugin
@@ -1 +1 @@
-1.5.6-1 client/rhel/yum-rhn-plugin/
+1.5.7-1 client/rhel/yum-rhn-plugin/
commit 83fc936f50812b72e40c3cd64b866bd462a5d53f
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Jun 28 11:53:18 2011 +0200
707241 - create progressbar even during groupinstall and do not delete rhnplugin.repos
during groupinstall command
during groupinstall is prereposetup_hook called twice (BZ#717163) and
during second run rhnplugin.repos is efectively truncated
and if rhnplugin.repos does not exist (first run, or next after groupinstall)
repos is not populated in init() and there is no progress bar callback to copy from.
We have to create it, which is really big hack - that part of code has been copied
from yum module output, function setupProgressCallbacks()
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index f7c99b6..8660cf5 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -26,6 +26,9 @@ import gettext
t = gettext.translation('yum-rhn-plugin', fallback=True)
_ = t.ugettext
+sys.path.append('/usr/share/yum-cli')
+from output import YumTextMeter, CacheProgressCallback
+
# TODO: Get the up2date stuff that we need in a better place,
# so we don't have to do path magic.
sys.path.append("/usr/share/rhn/")
@@ -151,18 +154,17 @@ def prereposetup_hook(conduit):
return
repos = conduit.getRepos()
- cachedir = conduit.getConf().cachedir
- default_gpgcheck = conduit.getConf().gpgcheck
+ conduit_conf = conduit.getConf()
+ cachedir = conduit_conf.cachedir
+ default_gpgcheck = conduit_conf.gpgcheck
gpgcheck = conduit.confBool('main', 'gpgcheck', default_gpgcheck)
sslcacert = get_ssl_ca_cert(up2date_cfg)
- enablegroups = conduit.getConf().enablegroups
- metadata_expire = conduit.getConf().metadata_expire
+ enablegroups = conduit_conf.enablegroups
+ metadata_expire = conduit_conf.metadata_expire
cachefilename = os.path.join(cachedir, cachedRHNReposFile)
- try:
- cachefile = open(cachefilename, 'w')
- except:
- cachefile = None
+ cachefile_content = ''
+ create_cache_even_second_time = not (os.path.exists(cachefilename) and
os.path.getsize(cachefilename))
for channel in svrChannels:
if channel['version']:
repo = RhnRepo(channel)
@@ -171,11 +173,18 @@ def prereposetup_hook(conduit):
# there will be nearly always only one, and even if there is more
# repos, we can ignore them
if type(already_exists_repos[0]) == type(repo): # repo is type of
RhnRepo
- continue # repo has been already initialized
+ # repo has been already initialized
+ if create_cache_even_second_time:
+ cachefile_content += already_exists_repos.id + "\n"
+ continue
else: # YumRepository from _init, made for caching
callback = already_exists_repos[0].callback
repo.setCallback(callback)
repos.delete(repo.id)
+ else: # no repo created in init - setup progressbar
+ if (not (conduit_conf.debuglevel < 2 or not sys.stdout.isatty())):
+ progressbar = YumTextMeter(fo=sys.stdout)
+ repo.setCallback(progressbar)
repo.basecachedir = cachedir
repo.gpgcheck = gpgcheck
repo.proxy = proxy_url
@@ -192,10 +201,15 @@ def prereposetup_hook(conduit):
conduit.info(5, "Repo '%s' setting option '%s' =
'%s'" %
(repo.id, o[0], o[1]))
repos.add(repo)
- if cachefile:
- cachefile.write("%s %s\n" % (repo.id, repo.name))
- if cachefile:
- cachefile.close()
+ cachefile_content += "%s %s\n" % (repo.id, repo.name)
+ if cachefile_content:
+ try:
+ cachefile = open(cachefilename, 'w')
+ except IOError:
+ cachefile = None # this is not fatal, we can live without cache
+ if cachefile:
+ cachefile.write(cachefile_content)
+ cachefile.close()
# resolve --enablerepo/--disablerepo for RHN repos
opts = conduit.getCmdLine()[0]
Show replies by date