From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/ekeyword/
Date: Sat, 25 Jan 2014 22:00:57 +0000 (UTC) [thread overview]
Message-ID: <1390248375.080519f882c622f4fbd44858801b39aaad4e88ad.vapier@gentoo> (raw)
commit: 080519f882c622f4fbd44858801b39aaad4e88ad
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 20 20:06:15 2014 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Jan 20 20:06:15 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=080519f8
ekeyword: skip known paths rather than fail
There are commonly files in an ebuild dir that we don't care about.
Issue a warning, but otherwise skip them without aborting. This let's
you do things like:
ekeyword x86 some-package/*
Which is nice when you know there's only one or two ebuilds in there.
---
src/ekeyword/ekeyword.py | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/src/ekeyword/ekeyword.py b/src/ekeyword/ekeyword.py
index 7a6c630..d8e0ed1 100755
--- a/src/ekeyword/ekeyword.py
+++ b/src/ekeyword/ekeyword.py
@@ -54,6 +54,10 @@ VERSION = '1.0 awesome'
Op = collections.namedtuple('Op', ('op', 'arch', 'ref_arch'))
+def warning(msg):
+ print('warning: %s' % msg, file=sys.stderr)
+
+
def keyword_to_arch(keyword):
"""Given a keyword, strip it down to its arch value
@@ -309,8 +313,8 @@ def load_profile_data(portdir=None, repo='gentoo'):
if arch_status:
arch_status['all'] = None
else:
- print('warning: could not read profile files: %s' % arch_list, file=sys.stderr)
- print('warning: will not be able to verify args are correct', file=sys.stderr)
+ warning('could not read profile files: %s' % arch_list)
+ warning('will not be able to verify args are correct')
return arch_status
@@ -334,7 +338,30 @@ def arg_to_op(arg):
return Op(op, arch, refarch)
-def args_to_work(args, arch_status=None, repo='gentoo'):
+def ignorable_arg(arg, quiet=0):
+ """Whether it's ok to ignore this argument"""
+ if os.path.isdir(arg):
+ if not quiet:
+ warning('ignoring directory %s' % arg)
+ return True
+
+ WHITELIST = (
+ 'Manifest',
+ 'metadata.xml',
+ )
+ base = os.path.basename(arg)
+ if (base.startswith('ChangeLog') or
+ base in WHITELIST or
+ base.startswith('.') or
+ base.endswith('~')):
+ if not quiet:
+ warning('ignoring file: %s' % arg)
+ return True
+
+ return False
+
+
+def args_to_work(args, arch_status=None, repo='gentoo', quiet=0):
"""Process |args| into a list of work itmes (ebuild/arches to update)"""
work = []
todo_arches = []
@@ -353,7 +380,7 @@ def args_to_work(args, arch_status=None, repo='gentoo'):
op = arg_to_op(arg)
if not arch_status or op.arch in arch_status:
todo_arches.append(op)
- else:
+ elif not ignorable_arg(arg, quiet=quiet):
raise ValueError('unknown arch/argument: %s' % arg)
if todo_arches:
@@ -425,7 +452,7 @@ def main(argv):
arch_status = load_profile_data()
try:
- work = args_to_work(work_args, arch_status=arch_status)
+ work = args_to_work(work_args, arch_status=arch_status, quiet=opts.quiet)
except ValueError as e:
parser.error(e)
next reply other threads:[~2014-01-25 22:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-25 22:00 Mike Frysinger [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-03-08 0:16 [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/ekeyword/ Mike Frysinger
2017-03-08 0:16 Mike Frysinger
2017-02-18 5:24 Mike Frysinger
2017-02-16 7:25 Mike Frysinger
2017-02-16 7:25 Mike Frysinger
2016-01-27 23:35 Mike Frysinger
2016-01-27 23:35 Mike Frysinger
2015-04-04 21:26 Mike Frysinger
2015-04-04 21:26 Mike Frysinger
2015-04-04 21:26 Mike Frysinger
2014-11-18 18:24 Mike Gilbert
2014-11-13 22:51 Mike Frysinger
2014-01-27 23:14 Mike Frysinger
2014-01-25 22:00 Mike Frysinger
2014-01-25 22:00 Mike Frysinger
2014-01-20 16:29 Mike Frysinger
2014-01-20 6:17 Mike Frysinger
2012-04-23 3:02 Christian Ruppert
2012-04-23 3:02 Christian Ruppert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1390248375.080519f882c622f4fbd44858801b39aaad4e88ad.vapier@gentoo \
--to=vapier@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox