Bug 1113384 - [rfe] repofrompath option to specify ad-hoc repo
[rfe] repofrompath option to specify ad-hoc repo
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
rawhide
Unspecified Unspecified
medium Severity unspecified
: ---
: ---
Assigned To: Michael Mráka
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-26 01:12 EDT by Honza Horak
Modified: 2015-08-10 22:08 EDT (History)
13 users (show)

See Also:
Fixed In Version: dnf-1.0.2-3.fc22
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-10 22:08:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Honza Horak 2014-06-26 01:12:47 EDT
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 01:41:33 EDT
Hi Honza, thanks for the reoprt, we'll cosider this.
Comment 2 Jan Zeleny 2014-06-26 02:45:08 EDT
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 14:45:58 EDT
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 11:32:58 EDT
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 11:34:27 EDT
...but actually I'm often too lazy to create a .repo file for a single command...
Comment 6 Thorsten Leemhuis 2015-06-12 09:16:00 EDT
+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 07:00:04 EDT
Implemented in
https://github.com/rpm-software-management/dnf/pull/296
Comment 8 Jonathan Underwood 2015-06-22 11:28:31 EDT
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 04:25:26 EDT
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 05:19:00 EDT
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-07-31 22:28:35 EDT
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 04:48:11 EDT
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 05:11:28 EDT
(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 06:00:44 EDT
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 06:35:32 EDT
(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 09:47:36 EDT
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 10:57:15 EDT
(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 05:24:20 EDT
(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-10 22:08:31 EDT
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.