public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] cleaning /var/lib/portage/world
@ 2017-08-16 11:32 Francisco Ares
  2017-08-16 13:40 ` Arve Barsnes
  0 siblings, 1 reply; 5+ messages in thread
From: Francisco Ares @ 2017-08-16 11:32 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2194 bytes --]

Hello,

During the process of learning how to manage packages in our beloved distro
- and even after knowing how to, but due to being in a hurry - I have my
"world" package set a bit cumbered with package names that would not need
to be there, as they are dependencies of other packages, as some libraries,
for instance.

So I thought on finding out which of those packages could be removed from
"world", and I have come up with the following script, which results in 3
files in the "/tmp" directory:

- world_remove_candidates
- world_remove_candidates_reasons
- world

- the first is a simple list of packages found in "world" that _probably_
could be removed from "world";
- the second includes which packages depends on each of the above mentioned
packages;
- the third, the cleaned up "world", without overwriting the original.

But, after backing up the original "world" file and replacing with the one
built by the script, things don't work as expected, as a lot of packages
were orphaned, by checking with "depclean".

Anyone could tell me what did I miss?

Here is the script:

#---------------------------------------------------------------------------
#! /bin/bash
cd /tmp
if [ -e world_remove_candidate ]
then
    rm -f world_remove_candidate
fi
if [ -e world_remove_candidate_reasons ]
then
    rm -f world_remove_candidate_reasons
fi
for i in `cat /var/lib/portage/world`
do
    A=`equery d $i`
    if [ "a$A" != "a" ]
    then
        echo $i >> world_remove_candidate
        echo "* * * * * * * * * * * * * "$i >>
world_remove_candidate_reasons
        for j in $A
        do
            echo $j >> world_remove_candidate_reasons
        done
    fi
done

cp -a /var/lib/portage/world .
for i in `cat world_remove_candidate`
do
    S=`echo $i | sed s+/+\\\\\\\\/+`  # this is to format the string
accorgingly to 'sed' (ugly, isn't it?)
    cat world | sed -e /"$S"/d > world.x
    rm -f world
    mv world.x world
done

# the following loop is for announcing it has finished.
A=20
while [ "$A" != "0" ]
do
    A=$(( $A - 1 ))
    sleep 1
    echo -n -e \\a
done

ls -halF world*
#---------------------------------------------------------------------------


Thanks!
Francisco

[-- Attachment #2: Type: text/html, Size: 3480 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] cleaning /var/lib/portage/world
  2017-08-16 11:32 [gentoo-user] cleaning /var/lib/portage/world Francisco Ares
@ 2017-08-16 13:40 ` Arve Barsnes
  2017-08-16 16:23   ` Francisco Ares
  0 siblings, 1 reply; 5+ messages in thread
From: Arve Barsnes @ 2017-08-16 13:40 UTC (permalink / raw
  To: Gentoo

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

On 16 August 2017 at 13:32, Francisco Ares <frares@gmail.com> wrote:

> But, after backing up the original "world" file and replacing with the one
> built by the script, things don't work as expected, as a lot of packages
> were orphaned, by checking with "depclean".
>
> Anyone could tell me what did I miss?
>

You're probably getting false positives from equery, as you haven't taken
USE flags into consideration.

An example:
# equery d unrar
app-arch/rar-5.5.0_p20170811 (all_sfx ? app-arch/unrar)
app-emulation/winetricks-20170614 (rar ? app-arch/unrar)

I don't have the USE="rar" set on winetricks, so although it is correct
that rar would keep unrar available, since I have USE="all_sfx" set, your
script will make the wrong choice if I don't have rar installed.

Cheers,
Arve

[-- Attachment #2: Type: text/html, Size: 1356 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] cleaning /var/lib/portage/world
  2017-08-16 13:40 ` Arve Barsnes
@ 2017-08-16 16:23   ` Francisco Ares
  2017-08-16 17:07     ` Neil Bothwick
  0 siblings, 1 reply; 5+ messages in thread
From: Francisco Ares @ 2017-08-16 16:23 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 937 bytes --]

2017-08-16 10:40 GMT-03:00 Arve Barsnes <arve.barsnes@gmail.com>:

> On 16 August 2017 at 13:32, Francisco Ares <frares@gmail.com> wrote:
>
>> But, after backing up the original "world" file and replacing with the
>> one built by the script, things don't work as expected, as a lot of
>> packages were orphaned, by checking with "depclean".
>>
>> Anyone could tell me what did I miss?
>>
>
> You're probably getting false positives from equery, as you haven't taken
> USE flags into consideration.
>
> An example:
> # equery d unrar
> app-arch/rar-5.5.0_p20170811 (all_sfx ? app-arch/unrar)
> app-emulation/winetricks-20170614 (rar ? app-arch/unrar)
>
> I don't have the USE="rar" set on winetricks, so although it is correct
> that rar would keep unrar available, since I have USE="all_sfx" set, your
> script will make the wrong choice if I don't have rar installed.
>
> Cheers,
> Arve
>

Good point!  Back to work.

Thanks,
Francisco

[-- Attachment #2: Type: text/html, Size: 1924 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] cleaning /var/lib/portage/world
  2017-08-16 16:23   ` Francisco Ares
@ 2017-08-16 17:07     ` Neil Bothwick
  2017-08-17 14:34       ` Peter Humphrey
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Bothwick @ 2017-08-16 17:07 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1330 bytes --]

On Wed, 16 Aug 2017 13:23:28 -0300, Francisco Ares wrote:

> 2017-08-16 10:40 GMT-03:00 Arve Barsnes <arve.barsnes@gmail.com>:
> 
> > On 16 August 2017 at 13:32, Francisco Ares <frares@gmail.com> wrote:
> >  
> >> But, after backing up the original "world" file and replacing with
> >> the one built by the script, things don't work as expected, as a lot
> >> of packages were orphaned, by checking with "depclean".
> >>
> >> Anyone could tell me what did I miss?
> >>  
> >
> > You're probably getting false positives from equery, as you haven't
> > taken USE flags into consideration.
> >
> > An example:
> > # equery d unrar
> > app-arch/rar-5.5.0_p20170811 (all_sfx ? app-arch/unrar)
> > app-emulation/winetricks-20170614 (rar ? app-arch/unrar)
> >
> > I don't have the USE="rar" set on winetricks, so although it is
> > correct that rar would keep unrar available, since I have
> > USE="all_sfx" set, your script will make the wrong choice if I don't
> > have rar installed.

> Good point!  Back to work.

emerge -cpv cat/pkg will tell you whether the package can be removed or
if it is needed by something else. It will take a while to run it for
every atom in @world but it will give reliable results, as determined by
portage.


-- 
Neil Bothwick

Nostalgia isn't what it used to be.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] cleaning /var/lib/portage/world
  2017-08-16 17:07     ` Neil Bothwick
@ 2017-08-17 14:34       ` Peter Humphrey
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Humphrey @ 2017-08-17 14:34 UTC (permalink / raw
  To: gentoo-user

On Wednesday 16 August 2017 18:07:21 Neil Bothwick wrote:

> emerge -cpv cat/pkg will tell you whether the package can be removed or
> if it is needed by something else. It will take a while to run it for
> every atom in @world but it will give reliable results, as determined by
> portage.

That's what I've been doing too, except that I omitted the -v since I don't 
care which other package depends on this one, just that some package does, 
and then I can delete it from world.

-- 
Regards,
Peter.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-17 14:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-16 11:32 [gentoo-user] cleaning /var/lib/portage/world Francisco Ares
2017-08-16 13:40 ` Arve Barsnes
2017-08-16 16:23   ` Francisco Ares
2017-08-16 17:07     ` Neil Bothwick
2017-08-17 14:34       ` Peter Humphrey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox