[PATCH] pykickstart, pungi: Allow ignoring of group metadata from repos

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Right now, pungi automatically uses the comps.xml from any configured
repository. If you want to do severe modifications to the default groups,
you have to mirror all the packages yourself first, otherwise the group
metadata from the base repo you're pulling from will end up overriding your
changes.

The attached patches:
- pykickstart: add a new boolean option for ignoring group metadata in a 'repo' line
- pungi: add code that sets the proper yum flag to ignore the group data
  if it's set for that repo

Tested a s/F11/F10/ version of the patch on F10 w/F10 pungi.

Comments? How much unnecessary cargo-culting did I add to pykickstart?

Bill
diff --git a/pykickstart/commands/repo.py b/pykickstart/commands/repo.py
index 8f1d414..85d93d5 100644
--- a/pykickstart/commands/repo.py
+++ b/pykickstart/commands/repo.py
@@ -72,6 +72,21 @@ class F8_RepoData(FC6_RepoData):
 
         return retval
 
+class F11_RepoData(F8_RepoData):
+    removedKeywords = F8_RepoData.removedKeywords
+    removedAttrs = F8_RepoData.removedAttrs
+
+    def __init__(self, *args, **kwargs):
+        F8_RepoData.__init__(self, *args, **kwargs)
+        self.ignoregroups = kwargs.get("ignoregroups", None)
+
+    def _getArgsAsStr(self):
+        retval = F8_RepoData._getArgsAsStr(self)
+
+        if self.ignoregroups:
+            retval += " --ignoregroups true"
+        return retval
+
 class FC6_Repo(KickstartCommand):
     removedKeywords = KickstartCommand.removedKeywords
     removedAttrs = KickstartCommand.removedAttrs
@@ -146,3 +161,27 @@ class F8_Repo(FC6_Repo):
         rd = self.handler.RepoData(name=reponame, baseurl=repourl)
         self.add(rd)
 
+class F11_Repo(F8_Repo):
+    removedKeywords = F8_Repo.removedKeywords
+    removedAttrs = F8_Repo.removedAttrs
+
+    def __str__(self):
+        retval = ""
+        for repo in self.repoList:
+            retval += repo.__str__()
+
+        return retval
+
+    def _getParser(self):
+        op = F8_Repo._getParser(self)
+        op.add_option("--ignoregroups", action="store", type="ksboolean")
+        return op
+
+    def methodToRepo(self):
+        if not self.handler.method.url:
+            raise KickstartError, formatErrorMsg(self.handler.method.lineno, msg=_("Method must be a url to be added to the repo list."))
+        reponame = "ks-method-url"
+        repourl = self.handler.method.url
+        rd = self.handler.RepoData(name=reponame, baseurl=repourl)
+        self.add(rd)
+
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 459d3a8..3c1a9ce 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -507,7 +507,7 @@ commandMap = {
         "poweroff": reboot.FC6_Reboot,
         "raid": raid.F9_Raid,
         "reboot": reboot.FC6_Reboot,
-        "repo": repo.F8_Repo,
+        "repo": repo.F11_Repo,
         "rescue": rescue.F10_Rescue,
         "rootpw": rootpw.F8_RootPw,
         "selinux": selinux.FC3_SELinux,
@@ -804,7 +804,7 @@ dataMap = {
         "NetworkData": network.F8_NetworkData,
         "PartData": partition.F9_PartData,
         "RaidData": raid.F9_RaidData,
-        "RepoData": repo.F8_RepoData,
+        "RepoData": repo.F11_RepoData,
         "UserData": user.F8_UserData,
         "VolGroupData": volgroup.FC3_VolGroupData,
         "ZFCPData": zfcp.FC3_ZFCPData,
diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py
index e084054..cc3928f 100644
--- a/src/pypungi/__init__.py
+++ b/src/pypungi/__init__.py
@@ -201,6 +201,8 @@ class Pungi(pypungi.PungiBase):
             thisrepo.includepkgs = repo.includepkgs
             if repo.cost:
                 thisrepo.cost = repo.cost
+            if repo.ignoregroups:
+                thisrepo.enablegroups = 0
             self.ayum.repos.add(thisrepo)
             self.ayum.repos.enableRepo(thisrepo.id)
             self.ayum._getRepos(thisrepo=thisrepo.id, doSetup = True)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux