Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

recover package.use?

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
th0th696
Apprentice
Apprentice
User avatar
Posts: 185
Joined: Wed Dec 08, 2004 11:35 pm
Contact:
Contact th0th696
Website

recover package.use?

  • Quote

Post by th0th696 » Thu Jul 01, 2010 4:09 pm

I've committed a major slip up while echo'ing a new line into my /etc/portage/package.use, I used the > 'replace file' instead of >> 'append to file' redirect and trashed all my old use flags. And while I usually have bzr or git watching etc for exactly this kind of occurrence, I just realized I have yet to set that up on this machine. However, I notice that eix does know what use flags I used when last building packages. Is there a way I can find this data and rebuild my package.use file? Right now I'm terrified to run a 'emerge -uND world' for fear of undoing alot of use flags that I'm pretty sure I'm using. If someone does know of, or can think of a way to recover that file I would be very appreciative.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56089
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Jul 01, 2010 5:26 pm

th0th696,

If your system was up to date with your own copy of the portage tree and you have not run emerge --sync since, you can use

Code: Select all

emerge -uDNvp world
All the changed use flags you see in the output are due to your missing package.use.

Hint: never use echo ... use the text editor of your choice.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
th0th696
Apprentice
Apprentice
User avatar
Posts: 185
Joined: Wed Dec 08, 2004 11:35 pm
Contact:
Contact th0th696
Website

sunc

  • Quote

Post by th0th696 » Thu Jul 01, 2010 6:20 pm

Unfortunately, I have run emerge --sync. But eix still knows my old use flags. Might I be able to extract the information from it's database? I guess I can just slowly go about upgrading all the stuff I know I'm using (audio apps etcetera), using eix first, then update flags. And I certainly know better than to use echo, I've been using flagedit quite a bit actually, no clue why I decided to break routine and bork my system (well it's fine now, just scared to upgrade).
Top
Carnildo
Guru
Guru
Posts: 595
Joined: Thu Jun 17, 2004 6:27 am

  • Quote

Post by Carnildo » Fri Jul 02, 2010 7:48 pm

You can still use the "emerge" method, but now you'll need to sort out the flags that changed because of the missing package.use from the flags that changed because of changes in the Portage tree.
Top
dol-sen
Retired Dev
Retired Dev
User avatar
Posts: 2805
Joined: Sun Jun 30, 2002 2:44 pm
Location: Richmond, BC, Canada

  • Quote

Post by dol-sen » Fri Jul 02, 2010 11:51 pm

th0th696

In gentoolkit-0.3.0_rc10-r1 I have created a new utility for fixing that very problem.

Code: Select all

# analyse rebuild -p use
for a list to screen. Drop the -p, --pretend option and it will create a file in your home directory for you to check and edit. It will anaylse your installed pkg database and figure out any differences from the global USE flag settings that need to be added to package.use. The file may not be perfect, the only bug I know of is that it does not handle multiple slotted pkgs well. You will have to look it over and fix any with the exact version info. (there will be 1 entry for each slot) The other option is to run it with the -e, --exact option to make each pkg be for only the specific version it finds. That will take care of the slotted pkg problem, but make upgrading more difficult to keep the flags correct.

After your satisfied with the new file, copy it to /etc/poprtage. and voila!! :D

You can also create a report on how USE flags, keywords are used on you system. The "rebuild use" feature is also handy for changing/experimenting different profiles. As it creates a new package.use file for you, you can maintain you system with the currently installed settings even though the profile USE flag settings may differ. The only exception to that would be masked USE flag changes which it does not do automatically.

I appreciate any feedback you have on how it works. I intend to add more modules to it and see if I can program some auto logic to take care of mutliple slotted pkgs.
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Top
th0th696
Apprentice
Apprentice
User avatar
Posts: 185
Joined: Wed Dec 08, 2004 11:35 pm
Contact:
Contact th0th696
Website

neato!

  • Quote

Post by th0th696 » Mon Jul 05, 2010 4:29 pm

How cool is that, that is exactly what I was looking for. Dol-sen you are amazing. Looks like it works great here, I think it even picked up all my overlays. I'll wgetpaste the file it created just in case someone wants to look at it, definitely lot's of flags in there I did not choose (i.e. all the 'handbook' entries). So I'll probably eliminate alot of them and just keep the ones I'm pretty sure I did.

http://paste.pocoo.org/show/233798/

Thanks again, for this time-saving code!
Top
dol-sen
Retired Dev
Retired Dev
User avatar
Posts: 2805
Joined: Sun Jun 30, 2002 2:44 pm
Location: Richmond, BC, Canada

  • Quote

Post by dol-sen » Mon Jul 05, 2010 10:46 pm

If you use the analyse rather than rebuild sub command, it will give you a report on how the flags are used and the pkgs that use them. From there you can decide to make some flags global in make.conf, then re-run to see the new report. When your finished you can generate the new file and edit any minor changes you want.
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Top
Bapabooiee
n00b
n00b
User avatar
Posts: 25
Joined: Sun Oct 18, 2009 6:40 pm

  • Quote

Post by Bapabooiee » Tue Jul 06, 2010 1:01 am

Ah, that looks like a very useful tool, dol-sen -- and I'm also glad you got your issue sorted-out, OP.

But yeah, you gotta be really careful not to overwrite important files using redirections. If it's to your fancy, you might want to consider setting the shell option that'll prevent already-existing files from being truncated by redirection:

Code: Select all

set -C
Just shove that into ~/.bashrc, and you should be good. The shell will then complain if you attempt to truncate a file that already exists, but you can then use a utility like `tee' to truncate that file instead, minimizing any mistakes because its use is more explicit than a redirection.
Top
Post Reply

8 posts • Page 1 of 1

Return to “Portage & Programming”

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