From: agriffis Date: Thu, 16 Sep 2004 01:11:27 +0000 (-0000) Subject: update ekeyword for GLEP 22 keywords X-Git-Tag: gentoolkit-0.2.4.3~368 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=411e82dd0880bd907e2af16b8806f7f6b45c9e80;p=gentoolkit.git update ekeyword for GLEP 22 keywords svn path=/; revision=134 --- diff --git a/trunk/src/ekeyword/ChangeLog b/trunk/src/ekeyword/ChangeLog index 2748897..6af10dd 100644 --- a/trunk/src/ekeyword/ChangeLog +++ b/trunk/src/ekeyword/ChangeLog @@ -1,3 +1,7 @@ +15 Sep 2004 Aron Griffis + * Update for GLEP 22 keywords + * Change copyright line for Gentoo Foundation + 12 Apr 2004 Aron Griffis * Add ability to remove keywords with ^, for example: ekeyword ^alpha blah.ebuild diff --git a/trunk/src/ekeyword/ekeyword b/trunk/src/ekeyword/ekeyword index 67f2ea7..dc95294 100644 --- a/trunk/src/ekeyword/ekeyword +++ b/trunk/src/ekeyword/ekeyword @@ -1,7 +1,8 @@ #!/usr/bin/perl -w # -# Copyright 2003, Gentoo Technologies, Inc. -# Author: Aron Griffis +# Copyright 2003-2004, Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# Written by Aron Griffis # # ekeyword: Update the KEYWORDS in an ebuild. For example: # @@ -12,7 +13,7 @@ # > KEYWORDS="x86 ppc sparc ~alpha" -my ($kw_re) = '^(?:([-~^]?)(\w+)|([-^]\*))$'; +my ($kw_re) = '^(?:([-~^]?)(\w[\w-]*)|([-^]\*))$'; my (@kw); # make sure the cmdline consists of keywords and ebuilds @@ -43,8 +44,8 @@ for my $f (@ARGV) { # extract the quoted section from KEYWORDS (my $quoted = $_) =~ s/^.*["'](.*?)["'].*/$1/s; - # replace -* with -star for our convenience below - $quoted =~ s/-\*/-star/; + # replace -* with -STAR for our convenience below + $quoted =~ s/-\*/-STAR/; for my $k (@kw) { my ($leader, $arch, $star) = ($k =~ /$kw_re/o); @@ -52,7 +53,7 @@ for my $f (@ARGV) { # handle -* and ^* if (defined $star) { $leader = substr $star,0,1; - $arch = 'star'; + $arch = 'STAR'; } # remove keywords @@ -73,7 +74,7 @@ for my $f (@ARGV) { # modify or add keyword unless ($quoted =~ s/[-~]?\Q$arch\E\b/$leader$arch/) { # modification failed, need to add - if ($arch eq 'star') { + if ($arch eq 'STAR') { $quoted = "$leader$arch $quoted"; } else { $quoted .= " $leader$arch"; @@ -83,8 +84,8 @@ for my $f (@ARGV) { } } - # replace -star with -* - $quoted =~ s/-star\b/-*/; + # replace -STAR with -* + $quoted =~ s/-STAR\b/-*/; # fixup spacing $quoted =~ s/^\s*(.*?)\s*$/$1/; # leading/trailing