dnf5 icon indicating copy to clipboard operation
dnf5 copied to clipboard

Download command

Open j-mracek opened this issue 1 year ago • 8 comments

  • [x] dnf download <pkg-spec>... (Core command)

Options

All general DNF options are accepted, see Options in :manpage:dnf(8) for details.

  • [x] --resolve

    Resolves dependencies of specified packages and downloads missing dependencies in the system.

  • [x] --alldeps

    When used with --resolve, download all dependencies (do not skip already installed ones).

Remaining options are tracked in separate issues:

  • [x] #945

    Show this help.

    • Proposing to drop (requires documentation)
  • [x] #946

    Limit the query to packages of given architectures (default is all compatible architectures with your system). To download packages with arch incompatible with your system use --forcearch=<arch> option to change basearch.

  • [x] #947

    Download the source rpm. Enables source repositories of all enabled binary repositories.

  • [ ] #948

    Download the debuginfo rpm. Enables debuginfo repositories of all enabled binary repositories.

  • [ ] #949

    Download directory, default should be loaded from the destdir configuration option.

    • Shall we keep --downloaddir, or --destdir or both?
  • [x] #497

    Instead of downloading, print list of urls where the rpms can be downloaded.

  • [x] #950

    Limit the protocol of the urls output by the --url option. Options are http, https, rsync, ftp.

j-mracek avatar Apr 25 '23 11:04 j-mracek

[RHEL issue. It used to work in RHEL with dnf4] 'dnf5 download' accepts but does not respect dnf.conf options "timeout", "username", "password", "ip_resolve". It does not download anything and exits with 0. Example: compare dnf5 behavior with wget:

# dnf5 --setopt=username=test --setopt=password=123456 download http://localhost/~testuser/foo.rpm
Updating and loading repositories:
Repositories loaded.
# echo $?
0
# ls foo.rpm
ls: cannot access 'foo.rpm': No such file or directory
# wget --http-user=test --http-password=123456 http://localhost/~testuser/foo.rpm
--2023-04-25 07:28:05--  http://localhost/~testuser/foo.rpm
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6652 (6.5K) [application/x-rpm]
Saving to: ‘foo.rpm’

foo.rpm             100%[===================>]   6.50K  --.-KB/s    in 0s      

2023-04-25 07:28:05 (1.35 GB/s) - ‘foo.rpm’ saved [6652/6652]
# ls foo.rpm
foo.rpm

glum23 avatar Apr 25 '23 11:04 glum23

@glum23 Could it be related to the fact that dnf5 does not copy rpms from local repository?

j-mracek avatar Apr 25 '23 11:04 j-mracek

@j-mracek I'd say dnf4 does not copy rpms from a local repository too, however, only when it is a file. Here it is a web server on localhost, however, rpm located in other user's username/password protected directory. I'd say it should not be considered as "local so ignored". Anyway, dnf4 in the very same situation downloads the rpm file.

glum23 avatar Apr 25 '23 11:04 glum23

I've noticed following two differences in current dnf5 download command behavior compared to the dnf when working on the download command tests refactoring in ci-dnf-stack: https://github.com/rpm-software-management/ci-dnf-stack/pull/1262.

  • Command doesn't return an error when non-existing package is passed
  • ~~When using the --resolve parameter, the matching package is not downloaded if the latest version is already installed on the system~~ EDIT: This should be fixed now.

Tests for this functionality already exist in the ci-dnf-stack and are disabled for now.

jan-kolarik avatar Apr 26 '23 06:04 jan-kolarik

[RHEL issue. It used to work in RHEL with dnf4] 'dnf5 download' accepts but does not respect dnf.conf options "timeout", "username", "password", "ip_resolve". It does not download anything and exits with 0. Example: compare dnf5 behavior with wget:

# dnf5 --setopt=username=test --setopt=password=123456 download http://localhost/~testuser/foo.rpm
Updating and loading repositories:
Repositories loaded.
# echo $?
0
# ls foo.rpm
ls: cannot access 'foo.rpm': No such file or directory
# wget --http-user=test --http-password=123456 http://localhost/~testuser/foo.rpm
--2023-04-25 07:28:05--  http://localhost/~testuser/foo.rpm
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6652 (6.5K) [application/x-rpm]
Saving to: ‘foo.rpm’

foo.rpm             100%[===================>]   6.50K  --.-KB/s    in 0s      

2023-04-25 07:28:05 (1.35 GB/s) - ‘foo.rpm’ saved [6652/6652]
# ls foo.rpm
foo.rpm

It doesn't seem to download anything when you specify a URL. I tried downloading the VS Code RPM using DNF5 and it doesn't work, while it does what it has to without any problems on DNF4.

image

Bavuett avatar Apr 26 '23 19:04 Bavuett

In the meantime, may I take the implementation of the --url option? It looks like a good issue for newbies like me.

Bavuett avatar Apr 26 '23 19:04 Bavuett

@Bavuett Feel free to take --url. I've created a sub task for it - https://github.com/rpm-software-management/dnf5/issues/497.

j-mracek avatar Apr 27 '23 06:04 j-mracek

The remaining tasks are tracked in separate issues

j-mracek avatar Oct 05 '23 11:10 j-mracek