FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Kubuntu User

 
 
LinkBack Thread Tools
 
Old 04-18-2012, 06:25 PM
David Lehman
 
Default Enable package installation.

This is only tested with a sane http repo.
---
pyanaconda/install.py | 1 +
pyanaconda/packaging/yumpayload.py | 47 ++++++++++++++++++++++++-----------
2 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 24d3098..e029168 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -41,6 +41,7 @@ def doInstall(storage, payload, ksdata, instClass):
steps = len(storage.devicetree.findActions(type="create", object="format")) +
len(storage.devicetree.findActions(type="resize", object="format")) +
len(storage.devicetree.findActions(type="migrate", object="format"))
+ steps += 2 # package install setup, package install
progress.progressQ.put((progress.PROGRESS_CODE_INI T, [steps]))

# Do partitioning.
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index dad7c42..d004cf9 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -78,7 +78,7 @@ log = logging.getLogger("anaconda")

from pyanaconda.errors import *
from pyanaconda.packaging import NoSuchGroup, NoSuchPackage
-#from pyanaconda.progress import progress
+from pyanaconda.progress import *

default_repos = [productName.lower(), "rawhide"]

@@ -797,6 +797,8 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
log.info("preparing transaction")
log.debug("initialize transaction set")
with _yum_lock:
+ progressQ.put((PROGRESS_CODE_MESSAGE,
+ [_("Starting installation process")]))
self._yum.initActionTs()

log.debug("populate transaction set")
@@ -827,6 +829,7 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
self._yum.ts.setFlags(rpm.RPMTRANS_FLAG_TEST)

log.info("running transaction")
+ progressQ.put((PROGRESS_CODE_STEP, []))
try:
self._yum.runTransaction(cb=rpmcb)
except PackageSackError as e:
@@ -848,7 +851,11 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
exn = PayloadInstallError(str(e))
if errorHandler.cb(exn) == ERROR_RAISE:
raise exn
+ else:
+ self.install_log.write("*** FINISHED INSTALLING PACKAGES ***")
+ progressQ.put((PROGRESS_CODE_STEP, []))
finally:
+ self.install_log.close()
self._yum.ts.close()
iutil.resetRpmDb()

@@ -876,7 +883,7 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
super(YumPayload, self).postInstall()

class RPMCallback(object):
- def __init__(self, yb, log, upgrade):
+ def __init__(self, yb, log, upgrade=False):
self._yum = yb # yum.YumBase
self.install_log = log # file instance
self.upgrade = upgrade # boolean
@@ -902,6 +909,9 @@ class RPMCallback(object):
def callback(self, event, amount, total, key, userdata):
""" Yum install callback. """
if event == rpm.RPMCALLBACK_TRANS_START:
+ if amount == 6:
+ progressQ.put((PROGRESS_CODE_MESSAGE,
+ [_("Preparing transaction from installation source")]))
self.total_actions = total
self.completed_actions = 0
elif event == rpm.RPMCALLBACK_TRANS_PROGRESS:
@@ -915,19 +925,22 @@ class RPMCallback(object):
# return an open fd to the file
txmbr = self._get_txmbr(key)[1]

- if self.upgrade:
- mode = _("Upgrading")
- else:
- mode = _("Installing")
-
- self.completed_actions += 1
- self.install_log.write("%s %s %s (%d/%d)
"
- % (time.strftime("%H:%M:%S"),
- mode,
- txmbr.po,
- self.completed_actions,
- self.total_actions))
- self.install_log.flush()
+ if not amount:
+ if self.upgrade:
+ mode = _("Upgrading")
+ else:
+ mode = _("Installing")
+
+ self.completed_actions += 1
+ pkg = "%s-%s.%s.%s" % (txmbr.name, txmbr.version,
+ txmbr.release, txmbr.arch)
+ msg = "%s %s (%d/%d)" % (mode, pkg,
+ self.completed_actions,
+ self.total_actions)
+ self.install_log.write("%s %s
" % (time.strftime("%H:%M:%S"),
+ msg))
+ self.install_log.flush()
+ progressQ.put((PROGRESS_CODE_MESSAGE, [msg]))

self.package_file = None
repo = self._yum.repos.getRepo(txmbr.po.repoid)
@@ -936,6 +949,10 @@ class RPMCallback(object):
try:
package_path = repo.getPackage(txmbr.po)
except (yum.Errors.NoMoreMirrorsRepoError, IOError):
+ if os.path.exists(txmbr.po.localPkg()):
+ os.unlink(txmbr.po.localPkg())
+ log.debug("retrying download of %s" % txmbr.po)
+ continue
exn = PayloadInstallError("failed to open package")
if errorHandler.cb(exn, txmbr.po) == ERROR_RAISE:
raise exn
--
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-18-2012, 07:10 PM
Chris Lumens
 
Default Enable package installation.

> diff --git a/pyanaconda/install.py b/pyanaconda/install.py
> index 24d3098..e029168 100644
> --- a/pyanaconda/install.py
> +++ b/pyanaconda/install.py
> @@ -41,6 +41,7 @@ def doInstall(storage, payload, ksdata, instClass):
> steps = len(storage.devicetree.findActions(type="create", object="format")) +
> len(storage.devicetree.findActions(type="resize", object="format")) +
> len(storage.devicetree.findActions(type="migrate", object="format"))
> + steps += 2 # package install setup, package install
> progress.progressQ.put((progress.PROGRESS_CODE_INI T, [steps]))
>

My original thinking was that we'd have a step for every single package
to be installed. That provides the user with some knowledge of how far
through the process they are, but it makes partitioning almost
irrelevant when a lot of packages are in the set.

Things we can do:

(1) What you've got.

(2) What I was thinking.

(3) What you've got, but supplement the text somehow to show how many
packages through the process you are.

(4) Fill the progress bar up to 100% with partitioning, then go back to
0% when packaging starts and fill it back up on a per-package basis.

(5) ???

> default_repos = [productName.lower(), "rawhide"]
>
> @@ -797,6 +797,8 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
> log.info("preparing transaction")
> log.debug("initialize transaction set")
> with _yum_lock:
> + progressQ.put((PROGRESS_CODE_MESSAGE,
> + [_("Starting installation process")]))
> self._yum.initActionTs()
>
> log.debug("populate transaction set")

I wish there were a better way to hide this ugliness. Maybe at the
least, I can add helper functions to progress.py for each PROGRESS_CODE_
value so you can just pass the single message argument or whatever.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:10 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org