+15 Sep 2004 Aron Griffis <agriffis@gentoo.org>
+ * Update for GLEP 22 keywords
+ * Change copyright line for Gentoo Foundation
+
12 Apr 2004 Aron Griffis <agriffis@gentoo.org>
* Add ability to remove keywords with ^, for example:
ekeyword ^alpha blah.ebuild
#!/usr/bin/perl -w
#
-# Copyright 2003, Gentoo Technologies, Inc.
-# Author: Aron Griffis <agriffis@gentoo.org>
+# Copyright 2003-2004, Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Written by Aron Griffis <agriffis@gentoo.org>
#
# ekeyword: Update the KEYWORDS in an ebuild. For example:
#
# > 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
# 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);
# handle -* and ^*
if (defined $star) {
$leader = substr $star,0,1;
- $arch = 'star';
+ $arch = 'STAR';
}
# remove keywords
# 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";
}
}
- # replace -star with -*
- $quoted =~ s/-star\b/-*/;
+ # replace -STAR with -*
+ $quoted =~ s/-STAR\b/-*/;
# fixup spacing
$quoted =~ s/^\s*(.*?)\s*$/$1/; # leading/trailing