Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 106544 | Differences between
and this patch

Collapse All | Expand All

(-)repoman (+41 lines)
Lines 13-18 Link Here
13
sys.path = ["/usr/lib/portage/pym"]+sys.path
13
sys.path = ["/usr/lib/portage/pym"]+sys.path
14
version="1.2"	
14
version="1.2"	
15
15
16
allowed_filename_chars="a-zA-Z0-9._-+:"
17
allowed_filename_chars_set = {}
18
map(allowed_filename_chars_set.setdefault, map(chr, range(ord('a'), ord('z')+1)))
19
map(allowed_filename_chars_set.setdefault, map(chr, range(ord('A'), ord('Z')+1)))
20
map(allowed_filename_chars_set.setdefault, map(chr, range(ord('0'), ord('9')+1)))
21
map(allowed_filename_chars_set.setdefault, map(chr, map(ord, [".", "-", "_", "+", ":"])))
22
16
import string,signal,re,pickle,tempfile
23
import string,signal,re,pickle,tempfile
17
24
18
import portage
25
import portage
Lines 21-26 Link Here
21
import portage_dep
28
import portage_dep
22
import cvstree
29
import cvstree
23
import time
30
import time
31
import codecs
32
24
from output import *
33
from output import *
25
#bold, darkgreen, darkred, green, red, turquoise, yellow
34
#bold, darkgreen, darkred, green, red, turquoise, yellow
26
35
Lines 85-90 Link Here
85
	"filedir.missing":"Package lacks a files directory",
94
	"filedir.missing":"Package lacks a files directory",
86
	"file.executable":"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do note need the executable bit",
95
	"file.executable":"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do note need the executable bit",
87
	"file.size":"Files in the files directory must be under 20k",
96
	"file.size":"Files in the files directory must be under 20k",
97
	"file.name":"File/dir name must be composed of only the following chars: %s " % allowed_filename_chars,
98
	"file.UTF8":"File is not UTF8 compliant",
88
	"KEYWORDS.missing":"Ebuilds that have a missing KEYWORDS variable",
99
	"KEYWORDS.missing":"Ebuilds that have a missing KEYWORDS variable",
89
	"LICENSE.missing":"Ebuilds that have a missing LICENSE variable",
100
	"LICENSE.missing":"Ebuilds that have a missing LICENSE variable",
90
	"DESCRIPTION.missing":"Ebuilds that have a missing DESCRIPTION variable",
101
	"DESCRIPTION.missing":"Ebuilds that have a missing DESCRIPTION variable",
Lines 663-668 Link Here
663
				stats["file.executable"] += 1
674
				stats["file.executable"] += 1
664
				fails["file.executable"].append(checkdir+"/"+y)
675
				fails["file.executable"].append(checkdir+"/"+y)
665
	digestlist=[]
676
	digestlist=[]
677
678
	for y in checkdirlist:
679
		for c in y.strip(os.path.sep):
680
			if c not in allowed_filename_chars_set:
681
				stats["file.name"] += 1
682
				fails["file.name"].append("%s/%s: char '%s'" % (checkdir, y, c))
683
				break
684
685
		if not (y in ("ChangeLog", "metadata.xml") or y.endswith(".ebuild")):
686
			continue
687
		try:
688
			line = 1
689
			for l in codecs.open(y, "r", "utf8"):
690
				line +=1
691
		except UnicodeDecodeError, ue:
692
			stats["file.UTF8"] += 1
693
			s = ue.object[:ue.start]
694
			l2 = s.count("\n")
695
			line += l2
696
			if l2 != 0:
697
				s = s[s.rfind("\n") + 1:]
698
			fails["file.UTF8"].append("%s/%s: line %i, just after: '%s'" % (checkdir, y, line, s))
699
666
	if isCvs:
700
	if isCvs:
667
		try:
701
		try:
668
			mystat=os.stat(checkdir+"/files")[0]
702
			mystat=os.stat(checkdir+"/files")[0]
Lines 799-804 Link Here
799
				stats["file.size"] += 1
833
				stats["file.size"] += 1
800
				fails["file.size"].append("("+ str(mystat.st_size/1024) + "K) "+x+"/files/"+y)
834
				fails["file.size"].append("("+ str(mystat.st_size/1024) + "K) "+x+"/files/"+y)
801
835
836
			for c in y.strip(os.path.sep):
837
				if c not in allowed_filename_chars_set:
838
					stats["file.name"] += 1
839
					fails["file.name"].append("%s/%s: char '%s'" % (checkdir, y, c))
840
					break
841
842
802
	if "ChangeLog" not in checkdirlist:
843
	if "ChangeLog" not in checkdirlist:
803
		stats["changelog.missing"]+=1
844
		stats["changelog.missing"]+=1
804
		fails["changelog.missing"].append(x+"/ChangeLog")
845
		fails["changelog.missing"].append(x+"/ChangeLog")

Return to bug 106544