Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

cleaning the world file (wiki) - check the script

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
84 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • Next
Author
Message
John R. Graham
Administrator
Administrator
User avatar
Posts: 10897
Joined: Tue Mar 08, 2005 3:39 pm
Location: Somewhere over Winder, Georgia, USA

  • Quote

Post by John R. Graham » Thu Jan 11, 2018 6:44 pm

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.
Top
charles17
Advocate
Advocate
Posts: 3686
Joined: Sun Mar 02, 2008 3:20 pm

  • Quote

Post by charles17 » Thu Jan 11, 2018 6:54 pm

helecho wrote:Your script does not seem correct.
"Adjust" or delete it, what ever you like. I can use it without the wiki artivcle.
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

  • Quote

Post by krinn » Thu Jan 11, 2018 7:09 pm

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

Code: Select all

>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.
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Thu Jan 11, 2018 7:38 pm

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.
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Thu Jan 11, 2018 8:55 pm

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)
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

  • Quote

Post by krinn » Thu Jan 11, 2018 8:59 pm

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.
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Thu Jan 11, 2018 9:02 pm

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
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

  • Quote

Post by krinn » Thu Jan 11, 2018 10:07 pm

:)
Should had use "understand" instead of "get"?
Top
saboya
Guru
Guru
Posts: 557
Joined: Tue Nov 28, 2006 10:28 am
Location: Brazil

  • Quote

Post by saboya » Fri Jan 12, 2018 1:13 am

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.
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Fri Jan 12, 2018 7:32 am

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[/post]:
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
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Fri Jan 12, 2018 12:20 pm

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

Code: Select all

user $ if [ -n $foo ] && [ -z $foo ] && echo "huh?"
huh?
user $ if [[ -n $foo ]] && [[ -z $foo ]] && echo "huh"
user $
helecho
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

  • Quote

Post by krinn » Fri Jan 12, 2018 12:26 pm

It something many knows, but it's a problem when testing more than one conditions.
[ -n ] is one condition and valid.
Top
luiztux
n00b
n00b
User avatar
Posts: 27
Joined: Mon Aug 31, 2015 12:14 pm
Location: /usr/portage/distfiles

  • Quote

Post by luiztux » Fri Jan 12, 2018 3:34 pm

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)
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Fri Jan 12, 2018 3:39 pm

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: Select all

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/96 ... hap02.html

Depending on what you are going for [ is prefered over [[
https://unix.stackexchange.com/question ... -vs/306115
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.
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Fri Jan 12, 2018 9:13 pm

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!
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Fri Jan 19, 2018 5:30 pm

-- obsolete comment removed! --
Last edited by Mr. T. on Sun Jan 21, 2018 11:35 am, edited 1 time in total.
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Fri Jan 19, 2018 5:34 pm

-- obsolete comment removed! --
Last edited by Mr. T. on Sun Jan 21, 2018 11:35 am, edited 1 time in total.
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Fri Jan 19, 2018 5:56 pm

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: Select all

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: Select all

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
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Fri Jan 19, 2018 6:09 pm

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

Code: Select all

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.
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Fri Jan 19, 2018 6:28 pm

I do not see what is the use of the script and I have no idea how to implement it.
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Fri Jan 19, 2018 6:34 pm

helecho wrote:I may continue the discussion in parallel: [topic=1075276]check the script[/topic].
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
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Fri Jan 19, 2018 7:05 pm

@helecho

Please do not cross post.

I've split your posts and replies from [topic=1042252]list all packages no other package depends on[/topic] and merged them here.

--pjp
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Fri Jan 19, 2018 7:39 pm

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.
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Fri Jan 19, 2018 8:19 pm

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
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
Mr. T.
Guru
Guru
Posts: 477
Joined: Mon Dec 26, 2016 4:19 pm

  • Quote

Post by Mr. T. » Sat Jan 20, 2018 10:30 am

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: Select all

#!/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=390749]bug[/bug].

helecho
Top
Post Reply

84 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • Next

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic