* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: /, src/ekeyword/
@ 2012-04-23 3:02 Christian Ruppert
0 siblings, 0 replies; 3+ messages in thread
From: Christian Ruppert @ 2012-04-23 3:02 UTC (permalink / raw
To: gentoo-commits
commit: 5be9cd2d2feb4f6276a9ff7d205e7d1b44c1af9b
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 23 02:08:01 2012 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Mon Apr 23 02:08:01 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=5be9cd2d
Some cleanup
---
ChangeLog | 3 +++
src/ekeyword/ekeyword | 38 ++++++++++++++++++++------------------
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index afc9383..256cfde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2012-04-23: Christian Ruppert <idl0r@gentoo.org>
+ * ekeyword: Some cleanup
+
2012-04-09: Christian Ruppert <idl0r@gentoo.org>
* echangelog: Improve the VCS check by adding a fallback/default PATH in
case $PATH is empty.
diff --git a/src/ekeyword/ekeyword b/src/ekeyword/ekeyword
index 1ac0403..0c68773 100755
--- a/src/ekeyword/ekeyword
+++ b/src/ekeyword/ekeyword
@@ -10,6 +10,8 @@
# - ppc sparc x86
# + ~alpha ppc sparc x86
+use strict;
+
my ($kw_re) = '^(?:([-~^]?)(\w[\w-]*)|([-^]\*))$';
my (@kw);
@@ -25,8 +27,8 @@ sub file_parse {
exit(1);
}
- open(FILE, '<', $fname);
- while(defined(my $line = <FILE>)) {
+ open(my $fh, '<', $fname);
+ while(defined(my $line = <$fh>)) {
chomp($line);
$line =~ s/^\s*//g;
$line =~ s/\s*$//g;
@@ -37,15 +39,15 @@ sub file_parse {
push(@content, $line);
}
- close(FILE);
+ close($fh);
return @content;
}
-sub get_portdir() {
- open(PORTAGEQ, '-|', 'portageq portdir');
- chomp(my $portdir = <PORTAGEQ>);
- close(PORTAGEQ);
+sub get_portdir {
+ open(my $ph, '-|', 'portageq portdir');
+ chomp(my $portdir = <$ph>);
+ close($ph);
if (length($portdir) eq 0) {
printf STDERR ("Error: Couldn't determine your PORTDIR...\n");
@@ -54,13 +56,13 @@ sub get_portdir() {
return $portdir;
}
-sub get_architectures() {
+sub get_architectures {
foreach my $arch (file_parse("${PORTDIR}/profiles/arch.list")) {
$ARCH{$arch} = 0;
}
}
-sub get_architectures_status() {
+sub get_architectures_status {
foreach my $line (file_parse("${PORTDIR}/profiles/profiles.desc")) {
my ($arch, undef, $status) = split(/\s/, $line, 3);
@@ -108,23 +110,23 @@ for my $f (@ARGV) {
print "$f\n";
- open I, "<$f" or die "Can't read $f: $!\n";
- open O, ">$f.new" or die "Can't create $f.new: $!\n";
- select O;
+ open(my $fh_in, "<", $f) or die "Can't read $f: $!\n";
+ open(my $fh_out, ">", "${f}.new") or die "Can't create ${f}.new: ${!}\n";
+ select($fh_out);
my $count = 0;
- while(<I>) {
+ while(<$fh_in>) {
$count++ if m/^\s*KEYWORDS=/;
}
- seek(I, 0, 0);
+ seek($fh_in, 0, 0);
- while (<I>) {
+ while (<$fh_in>) {
if (/^\s*KEYWORDS=/) {
# extract the quoted section from KEYWORDS
while (not /^\s*KEYWORDS=["'].*?["']/) {
chomp;
- my $next = <I>;
+ my $next = <$fh_in>;
$_ = join " ", $_, $next;
}
(my $quoted = $_) =~ s/^.*?["'](.*?)["'].*/$1/s;
@@ -222,8 +224,8 @@ for my $f (@ARGV) {
}
}
- close I;
- close O;
+ close($fh_in);
+ close($fh_out);
select STDOUT;
system("diff -U 0 ${f} ${f}.new");
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: /, src/ekeyword/
@ 2012-04-23 3:02 Christian Ruppert
0 siblings, 0 replies; 3+ messages in thread
From: Christian Ruppert @ 2012-04-23 3:02 UTC (permalink / raw
To: gentoo-commits
commit: 2eaf95dd07d7066d561b7d3c1736a151c75b5d0e
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 23 02:54:09 2012 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Mon Apr 23 02:54:09 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=2eaf95dd
Do a basic pre sort to get a rid of duplicates
NOTE: e.g. ~amd64 and -amd64 wouldn't be detected as duplicate!
X-Gentoo-Bug: 399575
X-Gentoo-Bug-URL: https://bugs.gentoo.org/399575
---
ChangeLog | 2 ++
src/ekeyword/ekeyword | 6 ++++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 256cfde..8a767a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2012-04-23: Christian Ruppert <idl0r@gentoo.org>
* ekeyword: Some cleanup
+ Do a basic pre sort to get a rid of duplicates, bug 399575.
+ NOTE: e.g. ~amd64 and -amd64 wouldn't be detected as duplicate!
2012-04-09: Christian Ruppert <idl0r@gentoo.org>
* echangelog: Improve the VCS check by adding a fallback/default PATH in
diff --git a/src/ekeyword/ekeyword b/src/ekeyword/ekeyword
index d680e26..2b1ac94 100755
--- a/src/ekeyword/ekeyword
+++ b/src/ekeyword/ekeyword
@@ -141,6 +141,12 @@ for my $f (@ARGV) {
# replace -* with -STAR for our convenience below
$quoted =~ s/-\*/-STAR/;
+ # Pre sort/unique
+ # NOTE: It will not detect duplicates where one is e.g. ~amd64 and
+ # one amd64
+ my %hash = map { $_, 1 } split(/\s+/, $quoted);
+ $quoted = join(" ", keys(%hash));
+
for my $k (@kw) {
my ($leader, $arch, $star) = ($k =~ /$kw_re/o);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: /, src/ekeyword/
@ 2012-04-23 3:16 Christian Ruppert
0 siblings, 0 replies; 3+ messages in thread
From: Christian Ruppert @ 2012-04-23 3:16 UTC (permalink / raw
To: gentoo-commits
commit: 89fe45b61ff192c463f9de8ee7a01a48ec42b680
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 23 03:15:07 2012 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Mon Apr 23 03:15:07 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=89fe45b6
Improve removal handling
Fix "ekeyword ^sparc *.ebuild" removing the "sparc" from e.g.
~sparc-solaris
Reported-by: Raúl Porcel <armin76 <AT> gentoo.org>
X-Gentoo-Bug: 413133
X-Gentoo-Bug-URL: https://bugs.gentoo.org/413133
---
ChangeLog | 2 ++
src/ekeyword/ekeyword | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8a767a5..ad6a8ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
* ekeyword: Some cleanup
Do a basic pre sort to get a rid of duplicates, bug 399575.
NOTE: e.g. ~amd64 and -amd64 wouldn't be detected as duplicate!
+ Fix "ekeyword ^sparc *.ebuild" removing the "sparc" from e.g.
+ ~sparc-solaris, bug 413133.
2012-04-09: Christian Ruppert <idl0r@gentoo.org>
* echangelog: Improve the VCS check by adding a fallback/default PATH in
diff --git a/src/ekeyword/ekeyword b/src/ekeyword/ekeyword
index 2b1ac94..33ebb4f 100755
--- a/src/ekeyword/ekeyword
+++ b/src/ekeyword/ekeyword
@@ -161,7 +161,7 @@ for my $f (@ARGV) {
if ($arch eq 'all') {
$quoted = '';
} else {
- $quoted =~ s/[-~]?\Q$arch\E\b//;
+ $quoted =~ s/[-~]?\Q$arch\E(\s|$)/$1/;
}
# add or modify keywords
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-23 3:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-23 3:02 [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: /, src/ekeyword/ Christian Ruppert
-- strict thread matches above, loose matches on Subject: below --
2012-04-23 3:16 Christian Ruppert
2012-04-23 3:02 Christian Ruppert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox