rpm-software-management / rpm-software-management/dnf5

Can't install/remove source packages from a repository: Argument... matches only source packages

Open
#1,663 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

downstream Priority: MEDIUM Triaged
Dominant language
C++
Stars
472
Forks
170
Avg merge
1d 12h
Merged PRs (30d)
37

Description

It was reported in Fedora that source packages cannot be installed from a repository:

# dnf --repoid rawhide-source install dontpanic.src
Updating and loading repositories:
Repositories loaded.
Failed to resolve the transaction:
Argument 'dontpanic.src' matches only source packages.

They can be installed from a local package:

# dnf5 install ~test/rpmbuild/SRPMS/foo-0-0.fc42.src.rpm 
[...]
Package                         Arch      Version                          Repository              Size
Installing:
 foo                            src       0-0.fc42                         @commandline       399.0   B

Transaction Summary:
 Installing:        1 packages
[...]
[3/3] Installing foo-0:0-0.fc42.src                            100% |   4.6 KiB/s | 644.0   B |  00m00s
Warning: skipped PGP checks for 1 package from repository: @commandline
Complete!

But cannot be uninstalled regardless their provenance:

# rpm -q foo
foo-0-0.fc42.src
root@fedora-42:~ # dnf5 remove foo
Argument 'foo' matches only source packages.

Nothing to do.

The error comes from GoalProblem Transaction::Impl::report_not_found() which unconditionally excludes all source packages:

    query.filter_arch(std::vector<std::string>{"src", "nosrc"}, sack::QueryCmp::NEQ);
    if (query.empty()) {
        add_resolve_log(
            action,
            GoalProblem::ONLY_SRC,
            settings,
            libdnf5::transaction::TransactionItemType::PACKAGE,
            pkg_spec,
            {},
            log_level);
        return GoalProblem::ONLY_SRC;
    }       

That error-reporting method is called from GoalProblem Goal::Impl::add_remove_to_goal() and similar GoalProblem Goal::Impl methods.

It seems that DNF5 forgot to support operations on source packages as a simplification of discriminating among architectures.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with GoalProblem Transaction::Impl::report_not_found(), then trace its callers in Goal::Impl::add_remove_to_goal() and the similar Goal::Impl methods. Reproduce the repository install and removal commands from the report; done means source packages are no longer rejected solely because their architecture is src or nosrc.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.