From: "Zac Medico (zmedico)" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] portage r12910 - main/branches/2.1.6/bin
Date: Wed, 11 Mar 2009 05:48:37 +0000 [thread overview]
Message-ID: <E1LhHIz-0000oQ-KH@stork.gentoo.org> (raw)
Author: zmedico
Date: 2009-03-11 05:48:37 +0000 (Wed, 11 Mar 2009)
New Revision: 12910
Modified:
main/branches/2.1.6/bin/repoman
Log:
Use a regular expression for the file.name check. This replaces some odd
map() usage that 2to3 warns about. (trunk r12638)
Modified: main/branches/2.1.6/bin/repoman
===================================================================
--- main/branches/2.1.6/bin/repoman 2009-03-11 05:48:16 UTC (rev 12909)
+++ main/branches/2.1.6/bin/repoman 2009-03-11 05:48:37 UTC (rev 12910)
@@ -73,11 +73,7 @@
# 14 is the length of DESCRIPTION=""
max_desc_len = 100
allowed_filename_chars="a-zA-Z0-9._-+:"
-allowed_filename_chars_set = {}
-map(allowed_filename_chars_set.setdefault, map(chr, range(ord('a'), ord('z')+1)))
-map(allowed_filename_chars_set.setdefault, map(chr, range(ord('A'), ord('Z')+1)))
-map(allowed_filename_chars_set.setdefault, map(chr, range(ord('0'), ord('9')+1)))
-map(allowed_filename_chars_set.setdefault, map(chr, map(ord, [".", "-", "_", "+", ":"])))
+disallowed_filename_chars_re = re.compile(r'[^a-zA-Z0-9._\-+:]')
bad = create_color_func("BAD")
# A sane umask is needed for files that portage creates.
@@ -864,11 +860,11 @@
continue
for y in checkdirlist:
- for c in y.strip(os.path.sep):
- if c not in allowed_filename_chars_set:
- stats["file.name"] += 1
- fails["file.name"].append("%s/%s: char '%s'" % (checkdir, y, c))
- break
+ m = disallowed_filename_chars_re.search(y.strip(os.sep))
+ if m is not None:
+ stats["file.name"] += 1
+ fails["file.name"].append("%s/%s: char '%s'" % \
+ (checkdir, y, m.group(0)))
if not (y in ("ChangeLog", "metadata.xml") or y.endswith(".ebuild")):
continue
@@ -1003,11 +999,12 @@
stats["file.size"] += 1
fails["file.size"].append("("+ str(mystat.st_size/1024) + "K) "+x+"/files/"+y)
- for c in os.path.basename(y.rstrip(os.path.sep)):
- if c not in allowed_filename_chars_set:
- stats["file.name"] += 1
- fails["file.name"].append("%s/files/%s: char '%s'" % (checkdir, y, c))
- break
+ m = disallowed_filename_chars_re.search(
+ os.path.basename(y.rstrip(os.sep)))
+ if m is not None:
+ stats["file.name"] += 1
+ fails["file.name"].append("%s/files/%s: char '%s'" % \
+ (checkdir, y, m.group(0)))
if desktop_file_validate and desktop_pattern.match(y):
status, cmd_output = commands.getstatusoutput(
reply other threads:[~2009-03-11 5:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E1LhHIz-0000oQ-KH@stork.gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@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