Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Start using per package USE flags
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
frankenputer
n00b
n00b


Joined: 09 Mar 2016
Posts: 26

PostPosted: Fri Jul 08, 2016 2:56 pm    Post subject: [HOWTO] Start using per package USE flags Reply with quote

As listed in the wiki, a Gentoo newcomer might find himself in a struggle to get all of the system packages USE flags. The upstream versions in future might add/drop some USE flags, so this functions takes care of updating the USE flags for you.

Code:
useflagspacks() {
  the_temp=$(mktemp --tmpdir XXXXXX)
  the_packs='/tmp/allpacks'
  qlist --installed --umap --nocolor --verbose > "${the_temp}"

  declare -a remove_flags=(
    '(' ')'
  # some `sed' regex kung fu
    '\S*\('{abi_,elibc_,kernel_,video_}'\)\S*'
    '\S*\('{input_,linguas_,userland_}'\)\S*'
    '\S*\(cpu_flags\|python_\)\S*'
  )

  for x in "${remove_flags[@]}"
  do
    sed -i "s/${x}//g" "${the_temp}"
  done

  # make sure the rest USE flags are not empty
  gawk '{
    for (x=2; x <= NF; x++) {
      if ("" != $x) {
        print ">="$0;
        break;
      }
    }
  }' "${the_temp}" > "${the_packs}"

  [[ -f "${the_temp}" ]] && rm "${the_temp}"
}


Trimmed output from /tmp/allpacks:

Code:
>=x11-misc/dmenu-4.6 xinerama
>=x11-misc/dzen-0.9.5-r1 xft xinerama


Backup all of the installed packages (qlist --installed > file), make.conf and this file, so you can restore your system and installed packages with the USE flags as if nothing happened.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
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