View previous topic :: View next topic |
Author |
Message |
TheCurse l33t
Joined: 21 Jun 2004 Posts: 670 Location: Köln
|
Posted: Mon Jul 18, 2005 12:11 pm Post subject: Gentoo Configuration Auto Cleaner |
|
|
Hi!
I have written a tool to automatically clean up files in /etc/portage! Look here.
You can use it like this:
gcac -o package.keywords.new
where the package.keywords.new should be a cleaned up version of package.keywords in /etc/portage (lines that are actually not needed are removed).
Therer are several options you can use:
--preserve - Don't delete empty lines and comments
--comment - Don't delete not needed lines, just comment
--use - Clean package.use
--mask - clean package.mask
--unmask - clean package.unmask
--o file - Result will not written to the screen but to file.
It would be nice if someone could test the tool and report any bug you find! Portage overlays are not supported yet, so don't report bugs about them.
Btw.: Sorry for my bad english
Last edited by TheCurse on Mon Mar 27, 2006 4:52 pm; edited 1 time in total |
|
Back to top |
|
|
Gatak Apprentice
Joined: 04 Jan 2004 Posts: 174
|
Posted: Tue Jul 19, 2005 1:15 pm Post subject: |
|
|
Would this tool also remove lines in package.keywords for applications that no longer need them?
For example if I had "=some-lib/blah-0.1 ~x86" since a year back and now I have 0.2 installed which is not ~x86.
What is the difference to this tool? https://forums.gentoo.org/viewtopic-t-302999.html |
|
Back to top |
|
|
TheCurse l33t
Joined: 21 Jun 2004 Posts: 670 Location: Köln
|
Posted: Tue Jul 19, 2005 2:43 pm Post subject: |
|
|
It should removes lines that are no longer needed. In your example it would remove "=some-lib/blah-0.1 ~x86".
If the line was ">=some-lib/blah-0.1 ~x86" and version 0.2 is installed and has ~x86 then the line would not be removed.
I do not know about the tool you mentioned, but it seems that it does lots of things gcac does, but in an different way. One difference of course is the programming language. Then I don't actually change anything in the files, just print it to standard-output (the screen). Another thing is that I do not use emerge, so it should be faster I think.
But nevertheless, I do not really know the differences. |
|
Back to top |
|
|
Gatak Apprentice
Joined: 04 Jan 2004 Posts: 174
|
Posted: Tue Jul 19, 2005 3:00 pm Post subject: |
|
|
OK Thanks for your reply. The other tool was rather slow too, as you said.
You should add your program to gentoo-wiki.com so other people can find it =) Perhaps also suggest on bugs.gentoo.org that gcac is included in portage? |
|
Back to top |
|
|
TheCurse l33t
Joined: 21 Jun 2004 Posts: 670 Location: Köln
|
Posted: Tue Jul 19, 2005 4:14 pm Post subject: |
|
|
I will do that, soon. |
|
Back to top |
|
|
TheCurse l33t
Joined: 21 Jun 2004 Posts: 670 Location: Köln
|
Posted: Mon Mar 27, 2006 5:02 pm Post subject: |
|
|
I did a few code cleanups and tuned the slow parts of the tool, so that it now should be really fast! Please test and give feedback!
Bye! |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Mon Mar 27, 2006 9:15 pm Post subject: |
|
|
It doesn't compile here...
Code: | Making all in src
make[2]: Entering directory `/var/tmp/portage/gcac-0.6/work/gcac-0.6/src'
if i686-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/include/g++-v3 -I/home/tim/Projects/gcac/include -Wall -g -march=athlon -Os -pipe -MT directorys.o -MD -MP -MF ".deps/directorys.Tpo" -c -o directorys.o directorys.cc; \
then mv -f ".deps/directorys.Tpo" ".deps/directorys.Po"; else rm -f ".deps/directorys.Tpo"; exit 1; fi
if i686-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/include/g++-v3 -I/home/tim/Projects/gcac/include -Wall -g -march=athlon -Os -pipe -MT files.o -MD -MP -MF ".deps/files.Tpo" -c -o files.o files.cc; \
then mv -f ".deps/files.Tpo" ".deps/files.Po"; else rm -f ".deps/files.Tpo"; exit 1; fi
directorys.cc:17:24: error: directorys.h: No such file or directory
directorys.cc:19: error: âp_directoryâ has not been declared
directorys.cc: In function âint count_subfolders()â:
directorys.cc:24: error: âDIRâ was not declared in this scope
directorys.cc:24: error: âdirhandleâ was not declared in this scope
directorys.cc:26: error: âstringâ was not declared in this scope
directorys.cc:26: error: expected `;' before ânameâ
directorys.cc:28: error: âpathâ was not declared in this scope
directorys.cc:28: error: âopendirâ was not declared in this scope
directorys.cc:30: error: âreaddirâ was not declared in this scope
directorys.cc:32: error: ânameâ was not declared in this scope
files.cc:17:19: error: files.h: No such file or directory
files.cc:22: error: âp_fileâ has not been declared
files.cc:22: error: ISO C++ forbids declaration of âp_fileâ with no type
files.cc: In function âint p_file()â:
files.cc:24: error: âopenedâ was not declared in this scope
files.cc:25: warning: no return statement in function returning non-void
files.cc: At global scope:
files.cc:27: error: âp_fileâ is not a class or namespace
files.cc:27: error: expected constructor, destructor, or type conversion before â(â token
files.cc:42: error: âp_fileâ is not a class or namespace
files.cc: In function âbool is_open()â:
files.cc:44: error: âopenedâ was not declared in this scope
files.cc: At global scope:
files.cc:47: error: âp_fileâ is not a class or namespace
files.cc:47: error: âstringâ was not declared in this scope
files.cc:47: error: âpathâ was not declared in this scope
files.cc:48: error: expected â,â or â;â before â{â token
files.cc:82: error: âp_fileâ is not a class or namespace
files.cc: In function âbool close()â:
files.cc:88: error: âfileâ was not declared in this scope
files.cc:107: error: âopenedâ was not declared in this scope
files.cc:112: error: âopenedâ was not declared in this scope
files.cc:118: error: âopenedâ was not declared in this scope
files.cc:125: error: âcerrâ was not declared in this scope
files.cc:125: error: âendlâ was not declared in this scope
files.cc:126: error: âEXIT_FAILUREâ was not declared in this scope
files.cc:126: error: âexitâ was not declared in this scope
files.cc: At global scope:
files.cc:130: error: âp_fileâ is not a class or namespace
files.cc:130: error: âstringâ was not declared in this scope
files.cc:130: error: âstrâ was not declared in this scope
files.cc:131: error: expected â,â or â;â before â{â token
files.cc: In function âint p_file()â:
files.cc:25: warning: control reaches end of non-void function
directorys.cc:32: error: invalid use of undefined type âstruct direntâ
directorys.cc:25: error: forward declaration of âstruct direntâ
directorys.cc:39: error: âclosedirâ was not declared in this scope
directorys.cc:46: error: âcerrâ was not declared in this scope
directorys.cc:46: error: âendlâ was not declared in this scope
directorys.cc:47: error: âEXIT_FAILUREâ was not declared in this scope
directorys.cc:47: error: âexitâ was not declared in this scope
directorys.cc: At global scope:
directorys.cc:51: error: âp_directoryâ has not been declared
directorys.cc:51: error: âstringâ was not declared in this scope
directorys.cc:51: error: âstrâ was not declared in this scope
directorys.cc:52: error: expected â,â or â;â before â{â token
directorys.cc:58: error: âstringâ does not name a type
make[2]: *** [directorys.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [files.o] Error 1
make[2]: Leaving directory `/var/tmp/portage/gcac-0.6/work/gcac-0.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/gcac-0.6/work/gcac-0.6'
make: *** [all] Error 2 |
_________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
TheCurse l33t
Joined: 21 Jun 2004 Posts: 670 Location: Köln
|
Posted: Tue Mar 28, 2006 6:20 am Post subject: |
|
|
I am sorry, should be fixed in 0.6.2 I hope... |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Tue Mar 28, 2006 8:25 am Post subject: |
|
|
That's better.
It works very well for package.keywords, although it doesn't seem to recognise the -* keyword. A few problems though - what I'm assuming is the "file not found" message is in a language that looks like German to me: "Fehler beim öffnen der Datei", and the program segfaulted when I tried to use it on my package.use file. _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
TheCurse l33t
Joined: 21 Jun 2004 Posts: 670 Location: Köln
|
Posted: Tue Mar 28, 2006 12:21 pm Post subject: |
|
|
Thanks for feedback, in a next version I will handle the -* keyword and the message (it must be a message that sould only test the functionality from one of the first versions, I will check that, and yes, it is german).
When I have enough time, I will go and hunt down the segfault (would be nice if you mail me your package.use, for maybe I can reproduce it here). |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Tue Mar 28, 2006 4:21 pm Post subject: |
|
|
It's quite short, so I'll post my package.use file here.
/etc/portage/package.use: | sys-libs/glibc userlocales profile nptl nptlonly
sys-libs/libstdc++-v3 nptl
sys-devel/gcc -fortran
dev-lang/php mysql postgres gd session hardenedphp cgi fastbuild posix threads dba
# For libglade bindings
dev-python/pygtk gnome
net-im/bitlbee msn
media-video/mplayer dvd mmx nvidia win32codecs xanim |
_________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
TheCurse l33t
Joined: 21 Jun 2004 Posts: 670 Location: Köln
|
Posted: Sun Apr 02, 2006 7:18 pm Post subject: |
|
|
Thanks for feedback! I have released a minor update (0.6.3) where the segmentation faults are hopefully fixed and --use etc. should work again. The -* keyword is not implemented yet, because I have no time at the moment.
Bye |
|
Back to top |
|
|
|