diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-09-23 15:43:04 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-09-23 15:43:04 -0700 |
commit | 6d8d0c02457c2e94c759fe89db0bef196b78158a (patch) | |
tree | 70dd61dca7eb0d7a57cd382f68b5e1860e9ffb28 /bin | |
parent | 0d5b0fbd79ba8b2e7dd5d2f2db7d69cad3e56766 (diff) | |
download | portage-6d8d0c02457c2e94c759fe89db0bef196b78158a.tar.gz portage-6d8d0c02457c2e94c759fe89db0bef196b78158a.tar.bz2 portage-6d8d0c02457c2e94c759fe89db0bef196b78158a.zip |
RepoConfig: add find_invalid_path_char method
This binds filename validation to the RepoConfig, so that eventually
we'll be able to control it via a layout.conf setting as discussed in
bug #435934.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/repoman | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/bin/repoman b/bin/repoman index bc2ac9be6..b463cbe7c 100755 --- a/bin/repoman +++ b/bin/repoman @@ -71,8 +71,6 @@ from portage import cvstree, normalize_path from portage import util from portage.exception import (FileNotFound, MissingParameter, ParseError, PermissionDenied) -from portage.manifest import _prohibited_filename_chars_re as \ - disallowed_filename_chars_re from portage.process import find_binary, spawn from portage.output import bold, create_color_func, \ green, nocolor, red @@ -1431,19 +1429,19 @@ for x in effective_scanlist: ebuildlist = [pkg.pf for pkg in ebuildlist] for y in checkdirlist: - m = disallowed_filename_chars_re.search(y.strip(os.sep)) - if m is not None: + index = repo_config.find_invalid_path_char(y) + if index != -1: y_relative = os.path.join(checkdir_relative, y) if vcs is not None and not vcs_new_changed(y_relative): # If the file isn't in the VCS new or changed set, then # assume that it's an irrelevant temporary file (Manifest # entries are not generated for file names containing # prohibited characters). See bug #406877. - m = None - if m is not None: + index = -1 + if index != -1: stats["file.name"] += 1 fails["file.name"].append("%s/%s: char '%s'" % \ - (checkdir, y, m.group(0))) + (checkdir, y, y[index])) if not (y in ("ChangeLog", "metadata.xml") or y.endswith(".ebuild")): continue @@ -1609,20 +1607,19 @@ for x in effective_scanlist: stats["file.size"] += 1 fails["file.size"].append("("+ str(mystat.st_size//1024) + " KiB) "+x+"/files/"+y) - m = disallowed_filename_chars_re.search( - os.path.basename(y.rstrip(os.sep))) - if m is not None: + index = repo_config.find_invalid_path_char(y) + if index != -1: y_relative = os.path.join(checkdir_relative, "files", y) if vcs is not None and not vcs_new_changed(y_relative): # If the file isn't in the VCS new or changed set, then # assume that it's an irrelevant temporary file (Manifest # entries are not generated for file names containing # prohibited characters). See bug #406877. - m = None - if m is not None: + index = -1 + if index != -1: stats["file.name"] += 1 fails["file.name"].append("%s/files/%s: char '%s'" % \ - (checkdir, y, m.group(0))) + (checkdir, y, y[index])) del mydigests if check_changelog and "ChangeLog" not in checkdirlist: |