Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list, add and remove repositories with yum python API?

How can I search for installed repostiries, add and delete them with yum python API (under fedora 17). I've searched tons of websites and I have found how to manage packages (like here: http://phacker.org/2008/06/20/yum-python-api/), but I have not found anywhere how to handle repositories).

I want for example to be able to get with python yum API the same result as:

yum repolist
yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm`

(the last is simmilar to yum-config-manager --add-repo; yum-config-manager --enable)

etc.

like image 311
Wojciech Danilo Avatar asked Oct 20 '12 13:10

Wojciech Danilo


People also ask

How do I list a yum repository?

Run command yum repolist and it will show you all repositories configured under YUM and enabled for use on that server. To view, disabled repositories or all repositories refer below section in this article. In the above output, you can see the repo list with repo id, repo name, and status.

How do I remove a repository from yum repos D?

You can temporarily remove/disable a yum repo by adding the --disablerepo=(repo name) to your yum line.

How enable and disable repository in yum?

To disable a particular repository or repositories, run the following command as the root user: yum-config-manager --disable repository… Alternatively, you can use a global regular expression to disable all matching Yum repositories: yum-config-manager --disable glob_expression…

How do I enable repository with yum-Config-Manager?

To enable all repositories run "yum-config-manager --enable \*". --disable Disable the specified repos (automatically saves). To disable all repositories run "yum-config-manager --disable \*". --add-repo=ADDREPO Add (and enable) the repo from the specified file or url.


1 Answers

you can use eulfedora

eulfedora.api provides complete access to the Fedora API, primarily making use of Fedora's REST API. This low-level interface is wrapped by eulfedora.server.Repository and eulfedora.models.DigitalObject, which provide a more abstract, object-oriented, and Pythonic way of interacting with a Fedora Repository or with individual objects and datastreams.

like image 97
abzcoding Avatar answered Oct 22 '22 04:10

abzcoding