Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cleaning the world file (wiki) - check the script
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Thu Jan 11, 2018 6:44 pm    Post subject: Reply with quote

charles17 wrote:
John R. Graham wrote:
Well, not exactly. "Safely deselected" would be more accurate. ...

And still wrong. Those are packages I am using. If I deselect them, --depclean would remove them.
No argument. But, still, more accurate. Furthermore, I think "safe to deselect" are those packages on which other packages depend, so --depclean would not remove them. Still, agreed: if you want it, it should be in the world set.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Thu Jan 11, 2018 6:54 pm    Post subject: Reply with quote

helecho wrote:
Your script does not seem correct.

"Adjust" or delete it, what ever you like. I can use it without the wiki artivcle.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Thu Jan 11, 2018 7:09 pm    Post subject: Reply with quote

helecho wrote:
krinn, the script should display information. qdepends only displays information about installed packages, otherwise, the software would fail.


Code:
>qdepends -Q mqflskfsdfsqklfjds
>echo $?
0

qdepends doesn't output anything, as such it's correct to check if the return value of qdepends is a null string or not (as long as nobody change this in qdepends)
or do you really think i have mqflskfsdfsqklfjds package install on my system?
and i have put the echo test to show you that in this case, it would be wrong to check exit code of qdepends, but that's not what the script is doing because it test the return string length of qdepends.

For me, i see nothing incorrect in that script.
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Thu Jan 11, 2018 7:38 pm    Post subject: Reply with quote

qdepends does not display anything because the fake package is not a dependency and does not exist.

Anyway, the packages placed in the world file must exist.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Thu Jan 11, 2018 8:55 pm    Post subject: Reply with quote

The world file is meant to contain packages that you want as opposed to what the system or the package needs

gcc isn't in the world file because... its part of the @system set
lightdm-gtk-greeter could be in the world file if the end-user chose to install it
lightdm doesn't need to be in the world file because ... it is a dependency of lightdm-gtk-greeter

In an attempt to resolve something or some other means a user emerge lightdm, this will now appear in the world file...
explicitly emerging dependencies (instead of one-shot emerge) needlessly increasing the size of the world file which can complicate the dependency resolver.

The bash script on the wiki is one way to perform some housekeeping on the world file. It however it isn't perfect and hence the following lines are so the end-user can review what is being deselected from the world file. Deselection doesn't remove the binaries BUT an incorrectly deselected entry will expose the package such emerge --depclean will want to remove it (as there is nothing justifying its existence on your system)
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Thu Jan 11, 2018 8:59 pm    Post subject: Reply with quote

Naib wrote:
The bash script on the wiki is one way to perform some housekeeping on the world file. It however it isn't perfect and hence the following lines are so the end-user can review what is being deselected from the world file. Deselection doesn't remove the binaries BUT an incorrectly deselected entry will expose the package such emerge --depclean will want to remove it (as there is nothing justifying its existence on your system)

Ah, it's so easier to get when someone use the rights words.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Thu Jan 11, 2018 9:02 pm    Post subject: Reply with quote

krinn wrote:
Naib wrote:
The bash script on the wiki is one way to perform some housekeeping on the world file. It however it isn't perfect and hence the following lines are so the end-user can review what is being deselected from the world file. Deselection doesn't remove the binaries BUT an incorrectly deselected entry will expose the package such emerge --depclean will want to remove it (as there is nothing justifying its existence on your system)

Ah, it's so easier to get when someone use the rights words.
? pardon
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Thu Jan 11, 2018 10:07 pm    Post subject: Reply with quote

:)
Should had use "understand" instead of "get"?
Back to top
View user's profile Send private message
saboya
Guru
Guru


Joined: 28 Nov 2006
Posts: 552
Location: Brazil

PostPosted: Fri Jan 12, 2018 1:13 am    Post subject: Reply with quote

I don't understand why people have such a hard time with the world file.

Tip: Learn to use sets. Yout life is going to be a lot easier. Anything you excplicitly want, add it to a set. Anything else, emerge -1.
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Fri Jan 12, 2018 7:32 am    Post subject: Reply with quote

The following declaration are not compatible and show the script does not work as intended.

Naib wrote:
[...] explicitly emerging dependencies (instead of one-shot emerge) needlessly increasing the size of the world file which can complicate the dependency resolver.


# post 8169026:

krinn wrote:
[...] And on your test case, when you do --unmerge app-arch/upx-ucl you are making dev-libs/ucl no more use by anyone as it was only that package that use it in your test case. The qdepends test fail: dev-libs/ucl is not use by anyone, test end here because you already know you must keep it in world, or depclean will catch it.

Naib wrote:
The bash script on the wiki is one way to perform some housekeeping on the world file. [...]


@charles17: I will try to replace your script.

helecho
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Fri Jan 12, 2018 12:20 pm    Post subject: Reply with quote

It should be noted that the command [ ... ] is not safe so it is advised to use the [[ ... ]] bash syntax construct (cf. devmanual).

Code:
user $ if [ -n $foo ] && [ -z $foo ] && echo "huh?"
huh?
user $ if [[ -n $foo ]] && [[ -z $foo ]] && echo "huh"
user $


helecho
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Fri Jan 12, 2018 12:26 pm    Post subject: Reply with quote

It something many knows, but it's a problem when testing more than one conditions.
[ -n ] is one condition and valid.
Back to top
View user's profile Send private message
luiztux
n00b
n00b


Joined: 31 Aug 2015
Posts: 27
Location: /usr/portage/distfiles

PostPosted: Fri Jan 12, 2018 3:34 pm    Post subject: Reply with quote

saboya wrote:

Tip: Learn to use sets. Yout life is going to be a lot easier. Anything you excplicitly want, add it to a set. Anything else, emerge -1.


True! 8)
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Fri Jan 12, 2018 3:39 pm    Post subject: Reply with quote

helecho wrote:
It should be noted that the command [ ... ] is not safe so it is advised to use the [[ ... ]] bash syntax construct (cf. devmanual).

Code:
user $ if [ -n $foo ] && [ -z $foo ] && echo "huh?"
huh?
user $ if [[ -n $foo ]] && [[ -z $foo ]] && echo "huh"
user $


helecho

except [ (and thus test) are part of POSIX. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html

Depending on what you are going for [ is prefered over [[
https://unix.stackexchange.com/questions/306111/confused-about-operators-vs-vs-vs/306115
Quote:

if [ condition ]

This is the traditional shell test command. It is available on all POSIX shells. The test command sets an exit code and the if statement acts accordingly. Typical tests are whether a file exists or one number is equal to another.

if [[ condition ]]

This is a new upgraded variation on test from ksh that bash and zsh also support. This test command also sets an exit code and the if statement acts accordingly. Among its extended features, it can test whether a string matches a regular expression.

if ((condition))

Another ksh extension that bash and zsh also support. This performs arithmetic. As the result of the arithmetic, an exit code is set and the if statement acts accordingly. It returns an exit code of zero (true) if the result of the arithmetic calculation is nonzero. Like [[...]], this form is not POSIX and therefore not portable.

if (command)

This runs command in a subshell. When command completes, it sets an exit code and the if statement acts accordingly.

A typical reason for using a subshell like this is to limit side-effects of command if command required variable assignments or other changes to the shell's environment. Such changes do not remain after the subshell completes.

if command

command is executed and the if statement acts according to its exit code.

_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Fri Jan 12, 2018 9:13 pm    Post subject: Reply with quote

StackExchange provides good resources!

I prefer the bash syntax construct over the internal command because the shell interprets it as a conditional expression and
the shell process is easier to understand as explained on the forum.

It's really helpful to have access to these explanations. Thank, Naib!
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Fri Jan 19, 2018 5:30 pm    Post subject: Reply with quote

-- obsolete comment removed! --

Last edited by Mr. T. on Sun Jan 21, 2018 11:35 am; edited 1 time in total
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Fri Jan 19, 2018 5:34 pm    Post subject: Reply with quote

-- obsolete comment removed! --

Last edited by Mr. T. on Sun Jan 21, 2018 11:35 am; edited 1 time in total
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Fri Jan 19, 2018 5:56 pm    Post subject: Reply with quote

Currently, I do not know how to proceed. None of the proposed solutions seem correct because of mistakes and wrong assumptions (based on bad practices).

Indeed, I noticed that emerge -p --depclean <pkg> indicates reverse dependencies on packages that will be removed.

Code:
larry ~ $ emerge -p --depclean dev-python/six
  dev-python/six-1.10.0 pulled in by:
    dev-python/packaging-16.8 requires dev-python/six[python_targets_python2_7(-),python_targets_python3_5(-),-python_single_target_pypy(-),-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)]

Code:
larry $ emerge -p --depclean dev-python/packaging
dev-python/packaging: 16.8 none none

All selected packages: =dev-python/packaging-16.8
Packages installed:   332
Packages in world:    20
Packages in system:   44
Required packages:    331
Number to remove:     1


These packages will be removed by the depclean process (emerge --depclean --ask).

helecho
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Fri Jan 19, 2018 6:09 pm    Post subject: Reply with quote

In practice, an issue will occur if the administrator can not perform the cleaning because of dependency conflicts during the update.

Code:
root # emerge --update --deep --newuse @world
root # emerge --depclean


In fact, Gentoo is a rock.

Edit: fixed wrong translation.


Last edited by Mr. T. on Sat Jan 20, 2018 9:36 am; edited 1 time in total
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Fri Jan 19, 2018 6:28 pm    Post subject: Reply with quote

I do not see what is the use of the script and I have no idea how to implement it.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Fri Jan 19, 2018 6:34 pm    Post subject: Reply with quote

helecho wrote:
I may continue the discussion in parallel: check the script.
please do not cross-post or split discussions. It is rude and causes no end of convolutions when people are interested in the discussion. Your cross-posting has set up a circular reference by your cross-referencing.

In the other thread you are stating you don't know how the script works yet intend to fix BUT then go you do not see a use for the script. YET here you are saying it is needed to mitigate dependency conflicts.

What dependency conflicts are you experiencing. Why are you stating the script doesn't work. Not why you think it doesn't but concise examples with concise replies when people come to figure it out
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Fri Jan 19, 2018 7:05 pm    Post subject: Reply with quote

@helecho

Please do not cross post.

I've split your posts and replies from list all packages no other package depends on and merged them here.

--pjp
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Fri Jan 19, 2018 7:39 pm    Post subject: Reply with quote

These threads are related and it was easier for me to use cross references.

Some people advice to use this script to remove the dependencies found in the world file but the script is incorrect and its use results from bad practices.

In my opinion, emerge provides an output more useful than a script partially designed. I mention the dependencies as a proof of concept.

The script is at least partially incorrect if:
  • we do not update the system;
  • we use qdepends;
  • we search packages (world file) that may depend on others: potential dependencies.

Finally, the administrator have to follow good pratices and learn to parse the output of emerge. Otherwise, I think we're wasting time.

Edit: fixed wrong translation


Last edited by Mr. T. on Sat Jan 20, 2018 9:37 am; edited 1 time in total
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Fri Jan 19, 2018 8:19 pm    Post subject: Reply with quote

helecho wrote:
These threads are related and it was easier for me to use cross references.
And there are others who make use of these forums. Use a notetaking application if you want to keep associated thread referenced somewhere

helecho wrote:

Some people advice to use this script to remove the dependencies found in the world file but the script is incorrect and its use results from bad practices.

In my opinion, emerge provides an output more useful than a script partially designed. I mention the dependencies as a proof of concept.

The script is at least partially incorrect if:
  • we do not update the system;
  • we use qdepends;
  • we search packages (world file) that may depend on others: potential dependencies.

Finally, the administer have to follow good pratices and learn to parse the output of emerge. Otherwise, I think we're wasting time.

and yet you haven't provided concise information as to why it is bad. For a well maintained system it works well. if there are other issues with your tree it will struggle but so will portage, but that isn't the fault of the script or portage, that is the fault of the system admin.

Someone volunteer their time to produce it as a tool in user toolboxes. no one forces you to use it so don't you find it a bit rude to trash other peoples work without concisely explaining why or offering improvements
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Sat Jan 20, 2018 10:30 am    Post subject: Reply with quote

I agree that my posts in these thread may be unkind; I should use more emoticons ( :idea: ) and better explain my point of view.

I do not really know in which cases the dependencies may be included in the world file. In my opinion, the script is not effective in all cases.
Currently, I'm confused: I wonder if we can proceed with different ways and get different results (btw get unexpected results).

Here is the algorithm that I will use to remove the dependencies included in the world file. The program must be adapted to work (see the note, below).

Code:
#!/bin/bash

while read i ; do \
        if [[ -n $(qdepends -aQ $i) ]]; then \
             echo $i' can be deselected'
             echo $i >> /tmp/deselect
        else
             echo $i' needs to stay in @world'
        fi
done < /var/lib/portage/world


Note: qdepends -aQ always display information and most important this applet has a critical bug.

helecho
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum