Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
useedit: Useflag Editor
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Wed Apr 06, 2005 7:51 pm    Post subject: useedit: Useflag Editor Reply with quote

So, ich habe mal wieder ein kleines Script geschrieben:
(Gibt es bestimmt schon, mir ist aber keins bekannt)

Beschreibung:

Mit useedit kann man per Console mit einem einfachen Kommando neue USE-Flags hinzufügen, USE-Flags entfernen, die aktuellen anzeigen und überprüfen ob man ein bestimmtes Flag bereits gesetzt hat.
Beim hinzufügen wird geprüft ob das entsprechende Flag schon gesetzt ist.

Warum:

Mich hat es ein wenig genervt wenn ich mittels emerge foo -pv ein neues nützliches USE-flag entdeckt hatte, ich jedesmal den editor anwerfen musste.


Ebuild

Zu installieren im Portage-Overlay unter app-portage/useedit

Ich würde mich über Kommentare und Anregungen freuen.
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
Pylon
Retired Dev
Retired Dev


Joined: 17 Jan 2003
Posts: 279
Location: Cologne

PostPosted: Wed Apr 06, 2005 8:54 pm    Post subject: Reply with quote

Klein, fein, aber buggy ;-)

Ich habe meine USE-Flags über mehrere Zeilen mit \ getrennt verteilt. Dein Script liest aber nur die erste Zeile aus.

Und entferne mal die Kommentarzeilen von crypto-mount aus dem ebuild :-P
_________________
hacking is not a crime
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Thu Apr 07, 2005 7:18 am    Post subject: Reply with quote

Ups,

ja, habe mein altes ebuild einfach umgebaut. Werde das mal aktualisieren.
Das mit den mehrzeiligen USE-Flags fehlt in der Tat noch. Daran hatte ich nicht gedachte. Wer macht schon sowas? Wozu hat man denn Zeilenumbruch im VIM ... :twisted:
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3495

PostPosted: Thu Apr 07, 2005 7:37 am    Post subject: Reply with quote

Anarcho wrote:
Wer macht schon sowas?


Ich! 8)

Ich habe noch nichtmal ein \ drin. Bei mir ists ein

Code:
USE="
     a
     -b
     c
"


Ist einfach übersichtlicher.
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Thu Apr 07, 2005 8:27 am    Post subject: Reply with quote

Anarcho wrote:
Ups,

ja, habe mein altes ebuild einfach umgebaut. Werde das mal aktualisieren.
Das mit den mehrzeiligen USE-Flags fehlt in der Tat noch. Daran hatte ich nicht gedachte. Wer macht schon sowas? Wozu hat man denn Zeilenumbruch im VIM ... :twisted:

euse (aus gentoolkit) und app-portage/ufed machen das zum Beispiel...
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Thu Apr 07, 2005 8:27 am    Post subject: Reply with quote

Jaja,

ist ja gut. Ich werde das noch ändern...
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2538
Location: Konradsreuth (Germany)

PostPosted: Tue Dec 06, 2005 10:05 am    Post subject: Reply with quote

Man könnt natürlich die USE-Flags folgendermaßen auslesen:

Code:
#!/usr/bin/perl -w

use strict;

my $dz;
my @use_tmp;
my @use;

open($dz, "</etc/make.conf");

while(<$dz>)
{
  last if /^\s*USE=\"/;
}

s/^\s*USE=\"\s*|\s*\\\s*//;

if(/\"/)
{
  s/\"//g;
  push @use_tmp, $_;
}

else
{

  push @use_tmp, $_;

  while(<$dz>)
  {
    s/^\s+|\s+$|\s*\\\s*//g;
    last if /\"/;
    push @use_tmp, $_;
  }

  s/\"//;
  push @use_tmp, $_;

}

foreach(@use_tmp)
{
  push @use, split(/\s+/, $_);
}


print "USE-Flags:\n\n";

foreach(@use)
{
  print "$_\n";
}
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2538
Location: Konradsreuth (Germany)

PostPosted: Wed Jan 11, 2006 7:30 pm    Post subject: Reply with quote

Also auch, wenn das scheinbar nicht unbedingt auf riesiges Interesse stoßen wird: Man könnte auch sämtliche Probleme mit der Art und Weise, wie man USE-Flags notiert, umgehen, indem man die Bash das Parsen übernehemn läßt:
Code:
#!/usr/bin/perl
@use = split " ", `. /etc/make.conf && echo $USE`;

... oder so ... also auf der Shell funktioniert ". /etc/make.conf && echo $USE" jedenfalls ;-)
Back to top
View user's profile Send private message
Battlestar Gentoo
l33t
l33t


Joined: 23 Dec 2004
Posts: 708
Location: Wien

PostPosted: Wed Jan 11, 2006 8:05 pm    Post subject: Reply with quote

Ein or die "$!\n" nach der Open-Anweisung sollte aber schon vorhanden sein :)
_________________
vorher: Gentoo Reptile
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2538
Location: Konradsreuth (Germany)

PostPosted: Wed Jan 11, 2006 8:12 pm    Post subject: Reply with quote

Ach was, da tritt kein Fehler auf :-P
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) 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