On 02/17/2011 08:38 PM, Panu Matilainen wrote:
On 02/17/2011 08:20 PM, seth vidal wrote:
On Thu, 2011-02-17 at 13:16 -0500, seth vidal wrote:
my concern here is since populateTs() is public we are opening up an api
break by adding the kwarg there. B/c of people subclassing it.
We've killed stuff like that before.
just to be clear
this is not 'no' this is 'hrrrrrrrm'
maybe I'll grep around a bunch of our callers, see where things go
sideways.
Oh, if it's the kwarg you're most worried about, the same can be
accomplished in other ways too, such as adding an attribute to control
the callback behavior to YumBase/Depsolve class.
Here's another thought...
diff --git a/yum/depsolve.py b/yum/depsolve.py
index 997c66d..c5b55e3 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -220,12 +220,12 @@ class Depsolve(object):
txmbr.ts_state = 'i'
txmbr.output_state = TS_INSTALL
- # grab essential data for callback use in hdr-like form
- minhdr = {}
- for item in ['epoch', 'name', 'version', 'release',
'arch']:
- minhdr[item] = hdr[item]
-
- self.ts.addInstall(hdr, (minhdr, rpmfile), txmbr.ts_state)
+ if self.newCallback: # or whatever the mechanism...
+ cbhdr = txmbr.po
+ else:
+ cbhdr = hdr
+
+ self.ts.addInstall(hdr, (cbhdr, rpmfile), txmbr.ts_state)
self.verbose_logger.log(logginglevels.DEBUG_1,
_('Adding Package %s in mode %s'), txmbr.po,
txmbr.ts_state)
if self.dsCallback:
Since PackageObject supports dict-like access, this would be at least
close to working as-is, would mean even less data to copy & keep in
memory as only a reference to "po" is used, etc. But this would already
require/want some changes to the actual callback, with differing code
paths for old vs new so it's probably a bit too much at this time.
When the yum API break is eventually done, the callback key should
probably be changed to
self.ts.addInstall(hdr, txmbr, txmbr.ts_state)
That way the callback wouldn't have to hunt backwards to find the txmbr
and the related package object is handily available for any info you
want from there, including the actual file path etc.
But again, this is just food for thought for the future, not something
that could/should be done now. Using txmbr as the sole pkg key would
simplify the callback a great deal but as long as compatibility is
required, it'd just require /more/ code.
- Panu -
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel