Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 926627 - sys-apps/portage: emerge --depclean doesn't uninstall build time dependencies of binary packages
Summary: sys-apps/portage: emerge --depclean doesn't uninstall build time dependencies...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-10 05:16 UTC by amano.kenji
Modified: 2024-03-16 22:21 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amano.kenji 2024-03-10 05:16:20 UTC
And, emerge --update --deep --newuse @world doesn't update build time dependencies of binary packages.

Thus, eclean-dist -d complains that there are distfiles for unavailable versions of build time dependencies of binary packages.

I want eclean-dist -d to stop complaining about distfiles for missing versions of build time dependencies.

Reproducible: Always
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-10 05:20:04 UTC
--with-bdeps controls this behaviour, see man emerge.
Comment 2 amano.kenji 2024-03-11 04:14:29 UTC
The thing is that --with-bdeps applies to both binary packages and source packages.

`--with-bdeps y` should not apply to binary packages.

`--with-bdeps n` should not apply to source packages.

The value of `--with-bdeps` should change dynamically according to the merge type.
Comment 3 Zac Medico gentoo-dev 2024-03-11 05:56:49 UTC
(In reply to amano.kenji from comment #2)
> The thing is that --with-bdeps applies to both binary packages and source
> packages.

It's not really supposed to apply to source packages because build time dependencies are unconditional for those.


> `--with-bdeps y` should not apply to binary packages.

It's only meaningful for binary packages or installed packages, since build time dependencies are unconditional for source packages.


> `--with-bdeps n` should not apply to source packages.

Right, it can't, because build time dependencies are unconditional for source packages.

> The value of `--with-bdeps` should change dynamically according to the merge
> type.

It defaults with yes for removal actions (well it's complicated see --with-bdeps-auto) and no for installation actions.
Comment 4 amano.kenji 2024-03-12 01:53:17 UTC
Which default options do you propose?
Comment 5 amano.kenji 2024-03-12 01:59:48 UTC
I don't want emerge --depclean to remove build-time dependencies of source packages.

I don't know how to do that, yet.
Comment 6 amano.kenji 2024-03-12 02:02:15 UTC
emerge --pretend --depclean --with-debps n tries to remove dev-lang/ocaml, dev-lang/go, and other build-time dependencies of source packages.
Comment 7 Zac Medico gentoo-dev 2024-03-12 02:06:04 UTC
(In reply to amano.kenji from comment #5)
> I don't want emerge --depclean to remove build-time dependencies of source
> packages.
> 
> I don't know how to do that, yet.

That's the default --with-bdeps=y behavior for removal actions.

(In reply to amano.kenji from comment #6)
> emerge --pretend --depclean --with-debps n tries to remove dev-lang/ocaml,
> dev-lang/go, and other build-time dependencies of source packages.

Right, so it sounds like you want the default --with-bdeps=y behavior, no?
Comment 8 amano.kenji 2024-03-13 01:47:29 UTC
> Right, so it sounds like you want the default --with-bdeps=y behavior, no?

I want emerge --depclean --with-bdeps y for source packages.

I want emerge --depclean --with-bdeps n for binary packages

--depclean does not treat binary packages differently from source packages for now.
Comment 9 Zac Medico gentoo-dev 2024-03-13 03:15:42 UTC
Yes, --depclean only sees installed packages and does not distinguish whether they were installed from binary packages or built from source. The installed packages are all effectively "binary" packages regardless of whether or not there was a local source build involved.
Comment 10 amano.kenji 2024-03-13 12:44:06 UTC
What can I do to prevent eclean-dist -d from complaining about distfiles for missing versions of build time dependencies?

I don't want to delete all build-time dependencies for every package.
Comment 11 Zac Medico gentoo-dev 2024-03-13 15:17:20 UTC
(In reply to amano.kenji from comment #10)
> What can I do to prevent eclean-dist -d from complaining about distfiles for
> missing versions of build time dependencies?

Please post the specific message that eclean-dist -d emits in this case, so that we can trace it back to the code responsible for emitting it.
Comment 12 Zac Medico gentoo-dev 2024-03-13 15:27:28 UTC
When I searched the eclean code these "Could not get stat info" messages were suspect:

> clean.py-                statinfo = os.stat(file_)
> clean.py-                if statinfo.st_nlink == 1:
> clean.py-                    key_size += statinfo.st_size
> clean.py-            except OSError as er:
> clean.py:                print(pp.error("Could not get stat info for:" + file_), file=sys.stderr)
> clean.py-                print(pp.error("Error: %s" % str(er)), file=sys.stderr)
> clean.py-        return key_size
> clean.py-
> clean.py-    def _clean_files(self, files, key, file_type):
> --
> clean.py-                        print(pp.error("Error: %s" % str(er)), file=sys.stderr)
> clean.py-                        break
> clean.py-                else:
> clean.py-                    print(
> clean.py:                        pp.error("Could not get stat info for:" + file_),
> clean.py-                        file=sys.stderr,
> clean.py-                    )
> clean.py-                    print(pp.error("Error: %s" % str(er)), file=sys.stderr)
> clean.py-            if self.controller(statinfo.st_size, key, file_, file_type):
> --
> clean.py-                    try:
> clean.py-                        statinfo = os.stat(fp)
> clean.py-                    except OSError as er:
> clean.py-                        print(
> clean.py:                            pp.error("Could not get stat info for:" + fp),
> clean.py-                            file=sys.stderr,
> clean.py-                        )
> clean.py-                        print(pp.error("Error: %s" % str(er)), file=sys.stderr)
> clean.py-                    clean_size += statinfo.st_size
Comment 13 amano.kenji 2024-03-14 01:43:06 UTC
There is nothing wrong with eclean-dist -d. It is doing its job perfectly.

The issue is with emerge.

emerge --update --deep --newuse @world doesn't update build-time dependencies of binary packages.

emerge --depclean doesn't delete build-time dependencies of binary packages which replaced source packages. Those source packages replaced by binary packages led to installation of build-time dependencies.
Comment 14 amano.kenji 2024-03-14 01:44:39 UTC
Sometimes, the same software can come from a binary package. Sometimes, it can come from a source package.
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-14 01:49:58 UTC
(In reply to amano.kenji from comment #13)
> There is nothing wrong with eclean-dist -d. It is doing its job perfectly.
> 
> The issue is with emerge.
> 
> emerge --update --deep --newuse @world doesn't update build-time
> dependencies of binary packages.
> 

You've been told how to make it do that.
Comment 16 Zac Medico gentoo-dev 2024-03-14 01:53:04 UTC
(In reply to amano.kenji from comment #13)
> There is nothing wrong with eclean-dist -d. It is doing its job perfectly.

In comment #10 you said eclean-dist -d was complaining and I suspected the "Could not get stat info" message but I really don't know what message you saw. So was it the "Could not get stat info" message and if not what was the specific message?
Comment 17 amano.kenji 2024-03-15 01:04:33 UTC
I did not get "Could not get stat info", but I remember that eclean-dist -d complained that some distfiles were associated with missing versions of some packages.

Because I cleaned them up, I will have to wait for the same messages to appear again.
Comment 18 amano.kenji 2024-03-15 01:06:47 UTC
> You've been told how to make it do that.

I want emerge --depclean to delete build-time dependencies of binary packages specifically.

Right now, that doesn't seem possible.
Comment 19 Zac Medico gentoo-dev 2024-03-15 02:59:17 UTC
(In reply to amano.kenji from comment #18)
> > You've been told how to make it do that.
> 
> I want emerge --depclean to delete build-time dependencies of binary
> packages specifically.
> 
> Right now, that doesn't seem possible.

Maybe if we filtered out the build-time dependencies when we download the metadata from the binhost, it would give the result you want?
Comment 20 amano.kenji 2024-03-16 04:54:24 UTC
(In reply to Zac Medico from comment #19)
> Maybe if we filtered out the build-time dependencies when we download the
> metadata from the binhost, it would give the result you want?

That sounds like a solution, but it will have to be tested.
Comment 21 Zac Medico gentoo-dev 2024-03-16 22:15:13 UTC
Since packages can be signed, it would be better for us to tag them in a database rather than to actually modify their metadata. We can also use this database to track which binhost they were downloaded from. We can use a binrepos.conf setting to trigger the tagging, like "bdeps = n" or something like that.
Comment 22 Zac Medico gentoo-dev 2024-03-16 22:21:33 UTC
The "bdeps = n" tags can possibly be stored in the database, or we can evaluate them more dynamically if we just associate packages with binrepos in the database and use that association to dynamically generate tags from binrepos.conf.

At install time, we can permanently omit the build time deps from the installed metadata, or we can possibly preserve them and support dynamic behavior for installed packages.