Bug 1476464

Summary: dnf download broken if repository is file:/// (ie. local)
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: dnf-plugins-coreAssignee: Jaroslav Mracek <jmracek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dmach, jmracek, mhatina, packaging-team-maint, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-09 15:59:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 910269    

Description Richard W.M. Jones 2017-07-29 09:45:38 UTC
Description of problem:

dnf download is broken if the repository is file:///

eg:

$ grep baseurl yum.conf
baseurl=file:///var/tmp/p/repo
$ ls repo/systemd-*
repo/systemd-233-6.fc26.i686.rpm
repo/systemd-233-6.fc26.x86_64.rpm
repo/systemd-234-3.fc27.x86_64.rpm
$ dnf download -c yum.conf --destdir tmp systemd
Last metadata expiration check: 0:08:42 ago on Sat 29 Jul 2017 10:33:42 BST.
$ ls tmp
[no output]

This worked in dnf 2.5 but broke in dnf 2.6.2.

Version-Release number of selected component (if applicable):

dnf-2.6.2-2.fc27.noarch

How reproducible:

100%

Steps to Reproduce:
1. Set up a local repo containing some RPMs.
2. Create a yum.conf file pointing to the local repo.
3. Try to dnf download the RPMs.

Comment 1 Richard W.M. Jones 2017-07-29 09:55:54 UTC
I couldn't work out how to run dnf from the build directory, otherwise
I'd try to bisect this for you.

The instructions in the README don't appear to work:

$ PYTHONPATH=/home/rjones/d/dnf /home/rjones/d/dnf/bin/dnf-2 download -c yum.conf --destdir tmp systemd
No such command: download. Please use /home/rjones/d/dnf/bin/dnf-2 --help
It could be a DNF plugin command, try: "dnf install 'dnf-command(download)'"

And I couldn't build dnf for python 3 at all because of weird
cmake errors, even though I have all the dependencies installed:

$ rpm -qf /usr/bin/python3
python3-3.6.1-6.fc26.x86_64
$ cmake .. '-DPYTHON_DESIRED="3"'
-- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is at least version "3.0")
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find PythonInterp: Found unsuitable version "2.7.13", but
  required is at least "3.0" (found /usr/bin/python)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:375 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindPythonInterp.cmake:149 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:18 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
See also "/home/rjones/d/dnf/build/CMakeFiles/CMakeOutput.log".

Comment 2 Richard W.M. Jones 2017-07-31 11:18:02 UTC
I reverted d1f583570f2c8f39be1ca3966d54c4e89b8bde63 in dnf-plugins-core
and that fixes the problem.

It's not quite a straightforward reversion because I had to keep the
removal of the ‘--destdir’ parameter from the plugin otherwise both
core dnf and the plugin define this parameter which causes a problem
for Python argparse.  Anyway after reverting the remainder of the
commit it fixed the problem, so I think this commit is to blame.

Comment 3 Jaroslav Mracek 2017-08-01 13:43:07 UTC
I created a patch (https://github.com/rpm-software-management/dnf/pull/879) that should solve the problem. But I am still confused with problem with --destdir option. We removed --destdir from plugin download, therefore there should be no conflict at all. DNF-plugins-core requires pythonX-dnf >= 2.6.1 and in case of dnf there is conflict with older conflict dnf-plugins-core < 2.1.3 . Anyway I hope that with the patch it is ok.

Comment 4 Richard W.M. Jones 2017-08-01 15:27:05 UTC
Yes these patches work.

Comment 5 Jaroslav Mracek 2017-08-01 17:30:41 UTC
Nice to hear it :-) .

Comment 6 Richard W.M. Jones 2017-08-03 17:33:48 UTC
I tested dnf-2.6.2-3.fc27 which contains the patch and it looks
like it fixes it.  Thanks for that.  Can we close this bug now?

Comment 7 Jaroslav Mracek 2017-08-04 07:14:49 UTC
The bug will be closed at the time of release (I will make the release on next Monday). Thanks for testing.

Comment 8 Fedora Update System 2017-08-07 12:50:54 UTC
dnf-2.6.3-1.fc26 dnf-plugins-extras-2.0.2-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4813633f96

Comment 9 Fedora Update System 2017-08-08 01:24:36 UTC
dnf-2.6.3-1.fc26, dnf-plugins-extras-2.0.2-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-4813633f96

Comment 10 Fedora Update System 2017-08-09 15:59:59 UTC
dnf-2.6.3-1.fc26, dnf-plugins-extras-2.0.2-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.