This is done without introducing any new kickstart syntax. We just check all the groups listed and if any is an environment, select it. This should work for deselecting environments too. --- pyanaconda/packaging/yumpayload.py | 38 ++++++++++++++++++++++++++++++++---- pyanaconda/ui/gui/spokes/software.py | 10 +++++++++- 2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py index 4b4a226..0cf380b 100644 --- a/pyanaconda/packaging/yumpayload.py +++ b/pyanaconda/packaging/yumpayload.py @@ -1365,8 +1365,20 @@ reposdir=%s """ self._selectYumGroup("core")
- if self.data.packages.default and self.environments: - self.selectEnvironment(self.environments[0]) + foundEnv = None + + if self.environments: + if self.data.packages.default: + self.selectEnvironment(self.environments[0]) + else: + # Look through all groups listed in the kickstart file. If one + # is an environment, select it now and then mark which one it is + # so we don't later try to select it as a group, too. + for (ndx, grp) in enumerate(self.data.packages.groupList): + if grp.name in self.environments: + self.selectEnvironment(grp.name) + foundEnv = ndx + break
for package in self.data.packages.packageList: try: @@ -1374,7 +1386,11 @@ reposdir=%s except NoSuchPackage as e: self._handleMissing(e)
- for group in self.data.packages.groupList: + for (ndx, group) in enumerate(self.data.packages.groupList): + # Skip any previously selected environment. + if ndx == foundEnv: + continue + default = False optional = False if group.include == GROUP_DEFAULT: @@ -1394,7 +1410,21 @@ reposdir=%s except NoSuchPackage as e: self._handleMissing(e)
- for group in self.data.packages.excludedGroupList: + # And then do the same thing for removing environments as we did for + # adding them earlier. + foundEnv = None + if self.environments: + for (ndx, grp) in enumerate(self.data.packages.excludedGroupList): + if grp.name in self.environments: + self.deselectEnvironment(grp.name) + foundEnv = ndx + break + + for (ndx, group) in enumerate(self.data.packages.excludedGroupList): + # Skip any previously selected environment. + if ndx == foundEnv: + continue + try: self._deselectYumGroup(group.name) except NoSuchGroup as e: diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py index 1f92e3d..b35c5a0 100644 --- a/pyanaconda/ui/gui/spokes/software.py +++ b/pyanaconda/ui/gui/spokes/software.py @@ -250,8 +250,16 @@ class SoftwareSelectionSpoke(NormalSpoke):
self._environmentStore = self.builder.get_object("environmentStore") self._environmentStore.clear() + + # If we don't know what the environment is, perhaps it's listed in the + # kickstart file. Look in there to see. if self.environment not in self.payload.environments: - self.environment = None + for grp in self.data.packages.groupList: + if grp.name in self.payload.environments: + self.environment = grp.name + break + else: + self.environment = None
clasess = [] firstEnvironment = True
On Mon, 2014-02-03 at 16:01 -0500, Chris Lumens wrote:
This is done without introducing any new kickstart syntax. We just check all the groups listed and if any is an environment, select it. This should work for deselecting environments too.
pyanaconda/packaging/yumpayload.py | 38 ++++++++++++++++++++++++++++++++---- pyanaconda/ui/gui/spokes/software.py | 10 +++++++++- 2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py index 4b4a226..0cf380b 100644 --- a/pyanaconda/packaging/yumpayload.py +++ b/pyanaconda/packaging/yumpayload.py @@ -1365,8 +1365,20 @@ reposdir=%s """ self._selectYumGroup("core")
if self.data.packages.default and self.environments:self.selectEnvironment(self.environments[0])
foundEnv = Noneif self.environments:if self.data.packages.default:self.selectEnvironment(self.environments[0])else:# Look through all groups listed in the kickstart file. If one# is an environment, select it now and then mark which one it is# so we don't later try to select it as a group, too.for (ndx, grp) in enumerate(self.data.packages.groupList):if grp.name in self.environments:self.selectEnvironment(grp.name)foundEnv = ndxbreak for package in self.data.packages.packageList: try:@@ -1374,7 +1386,11 @@ reposdir=%s except NoSuchPackage as e: self._handleMissing(e)
for group in self.data.packages.groupList:
for (ndx, group) in enumerate(self.data.packages.groupList):# Skip any previously selected environment.if ndx == foundEnv:continuedefault = False optional = False if group.include == GROUP_DEFAULT:@@ -1394,7 +1410,21 @@ reposdir=%s except NoSuchPackage as e: self._handleMissing(e)
for group in self.data.packages.excludedGroupList:
# And then do the same thing for removing environments as we did for# adding them earlier.foundEnv = Noneif self.environments:for (ndx, grp) in enumerate(self.data.packages.excludedGroupList):if grp.name in self.environments:self.deselectEnvironment(grp.name)foundEnv = ndxbreakfor (ndx, group) in enumerate(self.data.packages.excludedGroupList):# Skip any previously selected environment.if ndx == foundEnv:continuetry: self._deselectYumGroup(group.name) except NoSuchGroup as e:diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py index 1f92e3d..b35c5a0 100644 --- a/pyanaconda/ui/gui/spokes/software.py +++ b/pyanaconda/ui/gui/spokes/software.py @@ -250,8 +250,16 @@ class SoftwareSelectionSpoke(NormalSpoke):
self._environmentStore = self.builder.get_object("environmentStore") self._environmentStore.clear()
# If we don't know what the environment is, perhaps it's listed in the# kickstart file. Look in there to see. if self.environment not in self.payload.environments:
self.environment = None
for grp in self.data.packages.groupList:if grp.name in self.payload.environments:self.environment = grp.namebreakelse:self.environment = None clasess = [] firstEnvironment = True
I think there should be a function like find_environment(environments, groups) returning the environment and its index or (None, None). It could be used in three places in this patch.
On 02/03/2014 10:01 PM, Chris Lumens wrote:
This is done without introducing any new kickstart syntax. We just check all the groups listed and if any is an environment, select it. This should work for deselecting environments too.
I'm worried about overloading the group syntax instead of using the @^ environment group yum syntax uses, since we're going to end up with a group and an environment with the same ID at some point. RHEL makes me especially nervous, since they don't always follow the convention of using -environment in the environment IDs there. Yum makes no attempt to look up environments when you give it @whatever, so I think we should stick with that.
pyanaconda/packaging/yumpayload.py | 38 ++++++++++++++++++++++++++++++++---- pyanaconda/ui/gui/spokes/software.py | 10 +++++++++- 2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py index 4b4a226..0cf380b 100644 --- a/pyanaconda/packaging/yumpayload.py +++ b/pyanaconda/packaging/yumpayload.py @@ -1365,8 +1365,20 @@ reposdir=%s """ self._selectYumGroup("core")
if self.data.packages.default and self.environments:self.selectEnvironment(self.environments[0])
foundEnv = Noneif self.environments:if self.data.packages.default:self.selectEnvironment(self.environments[0])else:# Look through all groups listed in the kickstart file. If one# is an environment, select it now and then mark which one it is# so we don't later try to select it as a group, too.for (ndx, grp) in enumerate(self.data.packages.groupList):if grp.name in self.environments:self.selectEnvironment(grp.name)foundEnv = ndxbreak for package in self.data.packages.packageList: try:@@ -1374,7 +1386,11 @@ reposdir=%s except NoSuchPackage as e: self._handleMissing(e)
for group in self.data.packages.groupList:
for (ndx, group) in enumerate(self.data.packages.groupList):# Skip any previously selected environment.if ndx == foundEnv:continuedefault = False optional = False if group.include == GROUP_DEFAULT:@@ -1394,7 +1410,21 @@ reposdir=%s except NoSuchPackage as e: self._handleMissing(e)
for group in self.data.packages.excludedGroupList:
# And then do the same thing for removing environments as we did for# adding them earlier.foundEnv = Noneif self.environments:for (ndx, grp) in enumerate(self.data.packages.excludedGroupList):if grp.name in self.environments:self.deselectEnvironment(grp.name)foundEnv = ndxbreakfor (ndx, group) in enumerate(self.data.packages.excludedGroupList):# Skip any previously selected environment.if ndx == foundEnv:continuetry: self._deselectYumGroup(group.name) except NoSuchGroup as e:diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py index 1f92e3d..b35c5a0 100644 --- a/pyanaconda/ui/gui/spokes/software.py +++ b/pyanaconda/ui/gui/spokes/software.py @@ -250,8 +250,16 @@ class SoftwareSelectionSpoke(NormalSpoke):
self._environmentStore = self.builder.get_object("environmentStore") self._environmentStore.clear()
# If we don't know what the environment is, perhaps it's listed in the# kickstart file. Look in there to see. if self.environment not in self.payload.environments:
self.environment = None
for grp in self.data.packages.groupList:if grp.name in self.payload.environments:self.environment = grp.namebreakelse:self.environment = None clasess = [] firstEnvironment = True
I'm worried about overloading the group syntax instead of using the @^ environment group yum syntax uses, since we're going to end up with a group and an environment with the same ID at some point. RHEL makes me especially nervous, since they don't always follow the convention of using -environment in the environment IDs there. Yum makes no attempt to look up environments when you give it @whatever, so I think we should stick with that.
Sigh, yes, I can redo this to use some silly @^ syntax I don't remember anyone ever talking to me about. It just means I get to clone the bug for pykickstart and track down approval for that too.
If you note, I'm not assuming "-environment" anywhere, just looking up to see if a group is in the environments list or not.
- Chris
On 02/04/2014 04:26 PM, Chris Lumens wrote:
I'm worried about overloading the group syntax instead of using the @^ environment group yum syntax uses, since we're going to end up with a group and an environment with the same ID at some point. RHEL makes me especially nervous, since they don't always follow the convention of using -environment in the environment IDs there. Yum makes no attempt to look up environments when you give it @whatever, so I think we should stick with that.
Sigh, yes, I can redo this to use some silly @^ syntax I don't remember anyone ever talking to me about. It just means I get to clone the bug for pykickstart and track down approval for that too.
If you note, I'm not assuming "-environment" anywhere, just looking up to see if a group is in the environments list or not.
I just meant that the names in /comps/group/id might conflict with the names in /comps/environment/id, not that we should modify or care about anything in the strings. But now that I look at it, it seems that they've cleaned all that and that yum groupinstall looks for both groups and environments, so whatever, if there's a conflict it's comps's fault.
On Tue, 2014-02-04 at 16:42 +0100, David Shea wrote:
On 02/04/2014 04:26 PM, Chris Lumens wrote:
I'm worried about overloading the group syntax instead of using the @^ environment group yum syntax uses, since we're going to end up with a group and an environment with the same ID at some point. RHEL makes me especially nervous, since they don't always follow the convention of using -environment in the environment IDs there. Yum makes no attempt to look up environments when you give it @whatever, so I think we should stick with that.
Sigh, yes, I can redo this to use some silly @^ syntax I don't remember anyone ever talking to me about. It just means I get to clone the bug for pykickstart and track down approval for that too.
If you note, I'm not assuming "-environment" anywhere, just looking up to see if a group is in the environments list or not.
I just meant that the names in /comps/group/id might conflict with the names in /comps/environment/id, not that we should modify or care about anything in the strings. But now that I look at it, it seems that they've cleaned all that and that yum groupinstall looks for both groups and environments, so whatever, if there's a conflict it's comps's fault.
"yum groupinstall foo" will look for either an environment group or group called 'foo' (I don't recall which it prefers). "yum install @foo" will look for *only* a group called foo. "yum install @^foo" will look for *only* an environment group called foo.
yum's syntax (and, for that matter, code - the two different syntaxes above are actually backed by *entirely different functions*, reimplementing the same thing in different ways, because $dumb_historical_reasons) in this area is a hell of a mess, and probably not the best reference for 'good practice' - I'd be more inclined to look at what dnf does than what yum does.
anaconda-patches@lists.fedorahosted.org