From: Brian Harring <ferringb@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: [gentoo-portage-dev] PATCH glep31 checking
Date: Mon, 19 Sep 2005 16:12:08 -0500 [thread overview]
Message-ID: <20050919211208.GC20892@nightcrawler> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 331 bytes --]
Hola.
http://glep.gentoo.org/glep-0031.html <-- the details
http://bugs.gentoo.org/106544 <-- the bug
http://bugs.gentoo.org/attachment.cgi?=68828 <-- the patch
Attached the patch also; one additional tweak is that file.size is now
a fatal check, since the tree seem's to finally be clean.
~harring
[-- Attachment #1.2: glep31.patch --]
[-- Type: text/plain, Size: 3005 bytes --]
Index: repoman
===================================================================
--- repoman (revision 1992)
+++ repoman (working copy)
@@ -13,6 +13,13 @@
sys.path = ["/usr/lib/portage/pym"]+sys.path
version="1.2"
+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, [".", "-", "_", "+", ":"])))
+
import string,signal,re,pickle,tempfile
import portage
@@ -21,6 +28,8 @@
import portage_dep
import cvstree
import time
+import codecs
+
from output import *
#bold, darkgreen, darkred, green, red, turquoise, yellow
@@ -85,6 +94,8 @@
"filedir.missing":"Package lacks a files directory",
"file.executable":"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do note need the executable bit",
"file.size":"Files in the files directory must be under 20k",
+ "file.name":"File/dir name must be composed of only the following chars: %s " % allowed_filename_chars,
+ "file.UTF8":"File is not UTF8 compliant",
"KEYWORDS.missing":"Ebuilds that have a missing KEYWORDS variable",
"LICENSE.missing":"Ebuilds that have a missing LICENSE variable",
"DESCRIPTION.missing":"Ebuilds that have a missing DESCRIPTION variable",
@@ -146,7 +157,6 @@
"IUSE.invalid",
"ebuild.minorsyn",
"ebuild.badheader",
-"file.size",
"metadata.missing",
"metadata.bad",
"virtual.versioned"
@@ -663,6 +673,29 @@
stats["file.executable"] += 1
fails["file.executable"].append(checkdir+"/"+y)
digestlist=[]
+
+ 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
+
+ if not (y in ("ChangeLog", "metadata.xml") or y.endswith(".ebuild")):
+ continue
+ try:
+ line = 1
+ for l in codecs.open(y, "r", "utf8"):
+ line +=1
+ except UnicodeDecodeError, ue:
+ stats["file.UTF8"] += 1
+ s = ue.object[:ue.start]
+ l2 = s.count("\n")
+ line += l2
+ if l2 != 0:
+ s = s[s.rfind("\n") + 1:]
+ fails["file.UTF8"].append("%s/%s: line %i, just after: '%s'" % (checkdir, y, line, s))
+
if isCvs:
try:
mystat=os.stat(checkdir+"/files")[0]
@@ -799,6 +832,13 @@
stats["file.size"] += 1
fails["file.size"].append("("+ str(mystat.st_size/1024) + "K) "+x+"/files/"+y)
+ 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
+
+
if "ChangeLog" not in checkdirlist:
stats["changelog.missing"]+=1
fails["changelog.missing"].append(x+"/ChangeLog")
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2005-09-19 21:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-19 21:12 Brian Harring [this message]
2005-09-19 21:25 ` [gentoo-portage-dev] PATCH glep31 checking Brian Harring
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=20050919211208.GC20892@nightcrawler \
--to=ferringb@gentoo.org \
--cc=gentoo-portage-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