TanmayPatil105 / procfetch

🎨 Yet another command-line system information utility written in C++
https://tanmaypatil105.github.io/procfetch/
GNU General Public License v3.0
23 stars 11 forks source link

YUM error shows on output #143

Open Juan-de-Costa-Rica opened 7 months ago

Juan-de-Costa-Rica commented 7 months ago

Running on fresh Fedora atomic I get this error showing up after GPU and before Packages:

error: unrecognized subcommand 'list'

  tip: a similar subcommand exists: 'install'

Usage: yum [OPTIONS] <COMMAND>

For more information, try '--help'.

Screenshot from 2024-05-01 21-41-33

TanmayPatil105 commented 7 months ago

That's interesting!! Can you put the output of dnf list installed here?

TanmayPatil105 commented 7 months ago

In our code, we're executing dnf list installed https://github.com/TanmayPatil105/procfetch/blob/main/src/fetch.cpp#L422. AFAIK in the latest Fedora versions, yum is symlinked to dnf. I'm not sure how yum is getting invoked here.

Juan-de-Costa-Rica commented 7 months ago

That's interesting!! Can you put the output of dnf list installed here?

Same error:

❯ dnf list installed
error: unrecognized subcommand 'list'

  tip: a similar subcommand exists: 'install'

Usage: yum [OPTIONS] <COMMAND>

For more information, try '--help'.

Screenshot from 2024-05-02 00-14-54

TanmayPatil105 commented 7 months ago

I'm setting up Fedora 39 on my VM. Meanwhile, What does man dnf say about listing all installed packages?

Juan-de-Costa-Rica commented 7 months ago

I'm setting up Fedora 39 on my VM. Meanwhile, What does man dnf say about listing all installed packages?

Mind you I'm running Bluefin which is a version of Fedora Silverblue, the immutable version of Fedora. It doesn't ship with dnf.

https://blog.christophersmart.com/2020/04/18/making-dnf-on-fedora-silverblue-a-little-easier-with-bash-aliases/

TanmayPatil105 commented 7 months ago

So, does yum list installed work?

TanmayPatil105 commented 7 months ago

Well, dnf and yum are high-level package management tools which perform package management tasks on top of rpm. And yes, we are displaying rpm packages!

TanmayPatil105 commented 7 months ago

Also, I can see in your output hostname isn't getting displayed. https://github.com/TanmayPatil105/procfetch/commit/24226741959810e77d2ba9b593c4b92fb5228ea0 should fix it

Juan-de-Costa-Rica commented 7 months ago

So, does yum list installed work?

Gives the same error.

Juan-de-Costa-Rica commented 7 months ago

I think for immutable/atomic Fedora systems it would be nice to show how many packages are installed or 'layered' via rpm-ostree.

TanmayPatil105 commented 7 months ago

Yupp! I was thinking of something like:

  if (Path::of("/var/lib/rpm"s).isExecutable())
    {
        Command::exec_async("rpm -qa"s, [&](auto c) {
        std::lock_guard<std::mutex> lock(mtx);

        if (Path::of("/bin/dnf"s).isExecutable())
          pkgs.push_back(rec{"dnf"s, c->getOutputLines()});
        else if (Path::of("/bin/yum"s).isExecutable())
          pkgs.push_back(rec{"yum"s, c->getOutputLines()});
        else
          pkgs.push_back(rec{"rpm"s, c->getOutputLines()});
        });
    }
TanmayPatil105 commented 7 months ago

I'm curious, what does neofetch display in the packages?

Juan-de-Costa-Rica commented 7 months ago

I'm curious, what does neofetch display in the packages?

1982 (rpm), 69 (flatpak), 28 (brew)

Screenshot from 2024-05-02 10-19-57

Juan-de-Costa-Rica commented 7 months ago

Yupp! I was thinking of something like:

For immutable/atomic Fedora you us rpm -qa to list your system packages and rpm status -v to list layered packages.

Output of rpm status -v looks like:

● fedora:fedora/35/x86_64/kinoite
                   Version: 35.20210924.n.0 (2021-09-24T08:10:09Z)
                BaseCommit: 8ca0e98140307a1124c34b3f73001b1cdd29178115c4e5b1e6436e36b0e0f613
              GPGSignature: Valid signature by 787EA6AE1147EEE56C40B30CDB4639719867C58F
       RemovedBasePackages: firefox 91.0.1-2.fc35
           LayeredPackages: zsh virt-manager vim doas fedora-workstation-repositories gstreamer1-plugin-openh264

  fedora:fedora/35/x86_64/kinoite
                   Version: 35.20210923.n.0 (2021-09-23T08:13:58Z)
                BaseCommit: 684ee39f6abc9a0b5bda5686a7eac92d02215ca42008a0bce38302bc1c280fef
              GPGSignature: Valid signature by 787EA6AE1147EEE56C40B30CDB4639719867C58F
       RemovedBasePackages: firefox 91.0.1-2.fc35
           LayeredPackages: zsh virt-manager vim doas fedora-workstation-repositories gstreamer1-plugin-openh264
TanmayPatil105 commented 7 months ago

I think that would add more complexity.\ Re-thinking: we should only display the output of rpm -qa. Showing package managers front-ends as package managers makes less sense.\ We maintain the same approach in Debian-based distributions (dpkg and apt). and I think we should maintain that consistency throughout.

TanmayPatil105 commented 7 months ago

https://github.com/TanmayPatil105/procfetch/commit/153d2e0d21f1f49e35d8fd83b2a43acefc7baadb I won't call it a "fix" but now it should work fine!