Re: [PATCH] Allow changing the base repo.

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

 



> @@ -113,6 +137,15 @@ class Payload(object):
>          """Return a list of repo identifiers, not objects themselves."""
>          raise NotImplementedError()
>  
> +    def getRepo(self, repo_id):
> +        repo = None
> +        for r in self.data.repo.dataList():
> +            if r.name == repo_id:
> +                repo = r
> +                break
> +
> +        return repo
> +
>      def addRepo(self, newrepo):
>          """Add the repo given by the pykickstart Repo object newrepo to the
>             system.  The repo will be automatically enabled and its metadata

I feel like there's something better I could be doing in pykickstart to
help here.  The repo object has an __eq__ method so you could create a
fake repo object out of repo_id and see if it's "in" the dataList.
That's about halfway there.

> +    def reset(self):
> +        if self._yum:
> +            self._yum.close()
> +            del self._yum
> +
> +        if os.path.ismount(INSTALL_TREE) and not flags.testing:
> +            isys.umount(INSTALL_TREE)
> +
> +        if os.path.islink(INSTALL_TREE):
> +            os.unlink(INSTALL_TREE)
> +
> +        if os.path.ismount(ISO_DIR) and not flags.testing:
> +            isys.umount(INSTALL_TREE)
> +
> +        if self.install_device:
> +            self.install_device.teardown(recursive=True)
> +
> +        self.install_device = None
> +
> +        self._groups = []
> +        self._packages = []

You'll want to stub out this method on Payload before we start relying
on it elsewhere in anaconda.  Just having it pass should be fine.

> @@ -147,8 +168,12 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
>          return self._yum.repos.repos.keys()
>  
>      @property
> +    def addOns(self):
> +        return [r.name for r in self.data.repo.dataList()]
> +
> +    @property
>      def baseRepo(self):
> -        repo_names = [BASE_REPO_NAME, productName.lower(), "rawhide"]
> +        repo_names = [BASE_REPO_NAME] + default_repos
>          base_repo_name = None
>          for repo_name in repo_names:
>              if repo_name in self.repos and \

Likewise, I think you'll want an addOns stub too.  It should just return [].

> @@ -168,36 +193,112 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
>  
>          return False
>  
> -    def _configureRepos(self, storage):
> -        """ Configure the initial repository set. """
> -        log.info("configuring repos")
> -        # FIXME: driverdisk support
> +    def _resetMethod(self):
> +        self.data.method.method = ""
> +        self.data.method.url = None
> +        self.data.method.server = None
> +        self.data.method.dir = None
> +        self.data.method.partition = None
> +        self.data.method.biospart = None
> +        self.data.method.noverifyssl = False
> +        self.data.method.proxy = ""
> +        self.data.method.opts = None

Ugh.  Okay, I need a way in pykickstart to clear out an object and reset
it to defaults.  This is just going to require changes every time we add
something else to pykickstart.  It's fine for now, but I'll see what I
can do so this is unnecessary.

> +    def updateBaseRepo(self, storage, fallback=True):

Likewise with an updateBaseRepo stub, unless of course it's not meant to
be used outside this base class.

> -    def _configureKSRepo(self, storage, repo):
> +    def configureAddOnRepo(self, repo):

And with configureAddOnRepo.

> +    def _applyYumSelections(self):
> +        """ Apply the selections in ksdata to yum.
> +
> +            This follows the same ordering/pattern as kickstart.py.
> +        """
> +        for package in self.data.packages.packageList:
> +            self.selectPackage(package)
> +
> +        for group in self.data.packages.groupList:
> +            if group.include == GROUP_DEFAULT:
> +                default = True
> +            elif group.include == GROUP_ALL:
> +                default = True
> +                optional = True
> +
> +            self.selectGroup(group.name, default=default, optional=optional)
> +
> +        for package in self.data.packages.excludedList:
> +            self.deselectPackage(package)
> +
> +        for group in self.data.packages.excludedGroupList:
> +            self.deselectGroup(group.name)

We're definitely going to have to think about merging this code with
selectPackages in kickstart.py.  I was looking at that method a bit
yesterday.  Hopefully I'll have something to show for it.

Overall, looks good.

- Chris

_______________________________________________
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