Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1113384 - [rfe] repofrompath option to specify ad-hoc repo
Summary: [rfe] repofrompath option to specify ad-hoc repo
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-26 05:12 UTC by Honza Horak
Modified: 2015-08-11 02:08 UTC (History)
13 users (show)

Fixed In Version: dnf-1.0.2-3.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-11 02:08:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Honza Horak 2014-06-26 05:12:47 UTC
Description of problem:
When I want to work with some repository that is not configured in /etc/yum.repos.d and I'd like to use dnf for that in the same time (since it already has the rest of the features), something like yum-utils' repoquery's --repofrompath option is missing:

       --repofrompath=<repoid>,<path/url>
              Specify a path or url to a repository (same path as in a baseurl) 
              to add to the repositories for this query. This option can be used
              multiple times. If you want to view only the pkgs from this 
              repository combine this with --repoid. The repoid for the 
              repository  is specified by <repoid>.

This option allows to specify repository id and baseurl on the command-line.

I'd like to see that option in base dnf, so it may be used together with all the commands available. My specific use case right now is to use `dnf download` for downloading RPMs from some repository (not configured in /etc) or making queries in that repository with plugins download and repoquery.

Comment 1 Ales Kozumplik 2014-06-26 05:41:33 UTC
Hi Honza, thanks for the reoprt, we'll cosider this.

Comment 2 Jan Zeleny 2014-06-26 06:45:08 UTC
If you take votes, count me in. I agree with the low priority though, at least for now.

Comment 3 Mark Hamzy 2014-09-25 18:45:58 UTC
In https://bugzilla.redhat.com/show_bug.cgi?id=1120899#c18 someone suggested to use dnf.  However, this doesn't work for me.

[anaconda root@ppc64lehamzytest2 ~]# dnf upgrade anaconda python-blivet
Config error: releasever not given and can not be detected from the installroot.
[anaconda root@ppc64lehamzytest2 ~]# dnf --releasever=21_Alpha_TC3 upgrade anaconda python-blivet
Error: There are no enabled repos.
[anaconda root@ppc64lehamzytest2 ~]# dnf --releasever=21_Alpha_TC3 --repofrompath=temp-f21-repo,http://ppc.koji.fedoraproject.org/mash/branched-20140925-Alpha-TC3/21-ppc/ppc64le/os/ --enablerepo=temp-f21-repo upgrade anaconda python-blivet
Error: Unknown repo: 'temp-f21-repo'


So I would suggest raising the priority of this feature request. :)

Comment 4 Radek Holy 2015-05-28 15:32:58 UTC
I wonder whether passing a path to a ".repo" file wouldn't be better since one would be able to specify all the possible repo options.

Comment 5 Radek Holy 2015-05-28 15:34:27 UTC
...but actually I'm often too lazy to create a .repo file for a single command...

Comment 6 Thorsten Leemhuis 2015-06-12 13:16:00 UTC
+1 for this RFE in general, as I used the feature myself quite a few times in the past and would really miss it.

(In reply to Radek Holy from comment #5)
> ...but actually I'm often too lazy to create a .repo file for a single
> command...

+1 for this comment as well, as one can hand out commands like "repoquery --repofrompath=repo,http://repos.fedorapeople.org/repos/thl/kernel-vanilla-mainline/fedora-22/x86_64/ --disablerepo=* --enablerepo=repo --qf '%{evr}' -q kernel" to people running Fedora and they will just work (that is a shorter example of the command used in https://fedoraproject.org/wiki/Kernel_Vanilla_Repositories#What_kernel_versions_do_the_repos_currently_contain.3F )

Comment 7 Michael Mráka 2015-06-16 11:00:04 UTC
Implemented in
https://github.com/rpm-software-management/dnf/pull/296

Comment 8 Jonathan Underwood 2015-06-22 15:28:31 UTC
Another +1 from me - this is invaluable.

Here's an example of something I can't do with dnf repoquery...

repoquery --repofrompath=this,http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os --repoid=this -s --qf "%{name} %{name}\n" emacs-* | grep -v emacs- | perl -pe 's/^(.+?)-[^-]+-[^-]+$/\1\n/' | uniq | perl -pe 's/^(.+?)-[^-]+-[^-]+$/\1\n/' | fedoradev-pkgowners | sort | column -t

Comment 9 Fedora Update System 2015-07-22 08:25:26 UTC
dnf-1.0.2-2.fc22,hawkey-0.5.9-2.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/dnf-1.0.2-2.fc22,hawkey-0.5.9-2.fc22

Comment 10 Vít Ondruch 2015-07-30 09:19:00 UTC
I don't understand why you kept the <repo>, i.e. the name have to be specified? Why you do that so complex?

Comment 11 Fedora Update System 2015-08-01 02:28:35 UTC
Package dnf-1.0.2-3.fc22, hawkey-0.5.9-3.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-1.0.2-3.fc22 hawkey-0.5.9-3.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-12577/dnf-1.0.2-3.fc22,hawkey-0.5.9-3.fc22
then log in and leave karma (feedback).

Comment 12 Michael Mráka 2015-08-05 08:48:11 UTC
It's necessary to be able to reference repo in other options (--enablerepo/--disablerepo, repository-packages, etc).

Comment 13 Vít Ondruch 2015-08-05 09:11:28 UTC
(In reply to Michael Mráka from comment #12)
> It's necessary to be able to reference repo in other options
> (--enablerepo/--disablerepo, repository-packages, etc).

Do you really believe, that I will invest time to write something like "--reporfrompath=foo,http://.." just to disable it later by --disablerepo? Just to be clear, once I specify this parameter, I really want to use this repo, no matter what the other option says.

Comment 14 Michael Mráka 2015-08-05 10:00:44 UTC
Most like not for one repo specified on commandline. But there can be multiple --repofrompath e.g. generated by a shell script and it makes sense.
Also you can't otherwise reference the repo in repository-packages.

Comment 15 Vít Ondruch 2015-08-05 10:35:32 UTC
(In reply to Michael Mráka from comment #14)
> Most like not for one repo specified on commandline. But there can be
> multiple --repofrompath e.g. generated by a shell script and it makes sense.

If you are speaking about shell script, this can be definitely adjusted to generated such "--repofrompath" parameter only when needed. This script could be probably simpler, since I can't imagine how the "repoid" would be handled.

> Also you can't otherwise reference the repo in repository-packages.

What is this "repository-packages" command about? I don't think this was one of YUM command nor I don't find it systematic. What is the difference to "--repo" (bug 1193851) parameter. Why/where/when it was introduced?

Comment 16 Alex Wood 2015-08-06 13:47:36 UTC
So glad you've implemented this!  Just for the benefit of others, I use repofrompath to create an ad hoc repo base on my mock configs.  That way I can run repoquery to get an idea of what things look like in my mock environments.

For example:

#! /bin/zsh

mock-repoquery() {
    local profile="$1"
    [ -f "$profile" ] || profile="/etc/mock/${1}.cfg"

    # Take all baseurls in a file and make them into an array
    # See Parameter Expansion Flags section of the zshexpn man page and
    # http://unix.stackexchange.com/a/29748
    local repo_urls
    repo_urls=("${(@f)$(sed -n -r 's/.*baseurl=(.*)(\\n|$)/\1/p' $profile |     cut -d'\' -f1)}")
    local repo_args
    repo_args=()
    for ((i=1; i <= ${#repo_urls}; i++)); do
        repo_args+="--repofrompath=r${i},$repo_urls[i]"
        repo_args+="--repoid=r${i}"
    done
    if type dnf; then
        prefix="dnf"
    else
        prefix=""
    fi
    $prefix repoquery --disablerepo="*" "${repo_args[@]}" "$@[2,-1]"
}

mock-repoquery "$@"

Comment 17 Vít Ondruch 2015-08-06 14:57:15 UTC
(In reply to Alex Wood from comment #16)
>     for ((i=1; i <= ${#repo_urls}; i++)); do
>         repo_args+="--repofrompath=r${i},$repo_urls[i]"
>         repo_args+="--repoid=r${i}"
>     done

Alex, thanks for the example. It just demonstrates how useless the <repoid> is. It could be as easy as:

     for ((i=1; i <= ${#repo_urls}; i++)); do
         repo_args+="--repofrompath=$repo_urls[i]"
     done

Comment 18 Radek Holy 2015-08-10 09:24:20 UTC
(In reply to Vít Ondruch from comment #15)
> What is this "repository-packages" command about? I don't think this was one
> of YUM command nor I don't find it systematic. What is the difference to
> "--repo" (bug 1193851) parameter. Why/where/when it was introduced?

I assume you are able to open YUM's man pages.

The difference is that with "repo-pkgs" you are able to ask DNF to install a package from a particular repository while allowing DNF to install required dependencies from other repositories. This is very useful in combination with Copr or other "testing" repositories. It also allows you to easily uninstall all the testing packages once the testing is done.

Anyway, please use email or IRC to ask off-topic questions (or to question this answer).

Comment 19 Fedora Update System 2015-08-11 02:08:31 UTC
dnf-1.0.2-3.fc22, hawkey-0.5.9-3.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.