[packagekit] Enabling repository by REPO_URL instead of REPO_ID

Dorian Perkins dperkins at google.com
Wed Aug 13 13:37:01 PDT 2008

Hello All,

I would like to write a method which will check to see if a repository
exists and enable it. My current scenario is that I want to install a
specific software package from a repo that is in my repo list but currently
disabled. Currently, the way PackageKit enables repositories is by REPO_ID.
The method "pk_client_repo_enable()" takes a string value which is checked
against the REPO_ID's of existing repo's and (in Fedora 9 with YUM) if it
matches, it sets the "enabled" flag of the corresponding repo to "1". This
poses a problem for me since I want to ensure that the REPO_URL of the
repository record on the system matches the URL of the repository data I am
checking against, not just the REPO_ID.

For example, in the possible occurence that the REPO_ID of a repository is
not the "standard" REPO_ID name (i.e., if I changed the default fedora
REPO_ID from "fedora" to "fedora9"), an attempt to call the method
"pk_client_repo_enable()" using the REPO_ID="fedora" will fail with the
error "Error: repo-not-found : Error getting repository data for fedora,
repository not found". Although arbitrary changing of the REPO_ID is not
likely to happen often, it is possible.

I would like to know if this has been considered at all and/or if a
workaround exists. Is it currently possible to verify a repository exists
based upon the URL instead of the REPO_ID? If not, would a function such as
"pk_client_repo_exists()" using URL matching be useful? Or, maybe adding
"repo_url" as a variable returned by "pk_client_repo_list()" through the
"repo-detail" callback signal would be better?

Please comment and advise on how I may possibly solve this problem.

Thank you all for your comments.

P.S. I am currently working on Fedora 9 with the 0.2.X stable branch.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20080813/7eb05631/attachment-0004.htm>

More information about the PackageKit mailing list