Moving this thread to yum-devel... On Thu, 2008-10-23 at 14:33 -0400, seth vidal wrote: > On Thu, 2008-10-23 at 13:51 -0400, Mark Salter wrote: > > On Thu, 2008-10-23 at 12:14 -0400, seth vidal wrote: > > > On Thu, 2008-10-23 at 12:04 -0400, Mark Salter wrote: > > > > So, I'm toying around with the idea of using yum to install non-hostarch > > > > packages into some installroot. For instance, I have a repo containing > > > > some noarch and arm rpms. On an x86 box, given a yum.conf which only > > > > points to that noarch+arm repo, I'd like to be able to do something > > > > like: > > > > > > > > % yum -c my_yum.conf depsolve 'somepkg' > > > > > > > > The problem is that yum doesn't seem to want anything to do with arches > > > > which don't make sense for the x86 host. Not even 'list' them. If I run > > > > the yum list command, only the noarch rpms are shown. > > > > > > > > Am I missing something? Am I crazy for even thinking about such a thing? > > > > > > If the arch cannot use the pkgs then yum ignores them. > > > > > > If you can 'setarch' to that arch then yum will work - but I doubt you > > > can do that with i686->arm. > > > > > > The trouble is, of course, that scriptlets can't be run. So installing > > > the pkgs just won't work. > > > > > > does this help? > > > > > > > Yes. I know about the scripts and have some thoughts on how to handle > > that part. At the moment, I'm just using noscripts in tsflags and am > > focused on getting the depsolving part working. > > > > And no, setarch as-is can't help. > > > > So, where to go from here? Would a commandline arg to yum specifying > > the desired arch/arches be interesting for the community? Or should I > > be thinking along the lines of a new tool (reusing as much of the yum > > backend as possible)? > > > > Look at how yum get's the arch. It's not laid out right now for it to be > overridden but it is doable. Look at yum/config.py and yum/__init__.py > > if you can come up with a patch that isn't too nasty I'd be willing to > take a look.
After digging around in the yum code for a bit, this is what I came up with. The changes are minimal, but I'm not sure the placement is right, so comments/pointers welcome. diff --git a/cli.py b/cli.py index ff4c7d6..8d103ab 100644 --- a/cli.py +++ b/cli.py @@ -227,6 +227,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput): sleeptime = random.randrange(opts.sleeptime*60) else: sleeptime = 0 + + if opts.forcearch: + rpmUtils.arch.canonArch = opts.forcearch # save our original args out self.args = args @@ -1224,6 +1227,9 @@ class YumOptionParser(OptionParser): metavar='[plugin]') self.add_option("--skip-broken", action="store_true", dest="skipbroken", help=_("skip packages with depsolving problems")) + self.add_option("--forcearch", dest='forcearch', default=None, + help=_("specify arch to operate on"), + metavar='[arch]') diff --git a/yum/config.py b/yum/config.py index 03123a9..18bd545 100644 --- a/yum/config.py +++ b/yum/config.py @@ -643,6 +643,7 @@ class YumConf(StartupConf): enablegroups = BoolOption(True) enable_group_conditionals = BoolOption(True) group_package_types = ListOption(['mandatory', 'default']) + ignorearch = BoolOption(False) timeout = FloatOption(30.0) # FIXME: Should use variation of SecondsOption diff --git a/yum/depsolve.py b/yum/depsolve.py index 25eb0e6..3e055c8 100644 --- a/yum/depsolve.py +++ b/yum/depsolve.py @@ -114,6 +114,10 @@ class Depsolve(object): self._tsInfo.install_method = self.install self._tsInfo.update_method = self.update self._tsInfo.remove_method = self.remove + if self.conf.ignorearch: + if rpm.RPMPROB_FILTER_IGNOREARCH not in self._tsInfo.probFilterFlags: + self._tsInfo.probFilterFlags.append(rpm.RPMPROB_FILTER_IGNOREARCH) + return self._tsInfo def _setTsInfo(self, value): --Mark _______________________________________________ Yum-devel mailing list Yum-devel@lists.baseurl.org http://lists.baseurl.org/mailman/listinfo/yum-devel