Lines 1-7
Link Here
|
1 |
#!/usr/bin/python -O |
1 |
#!/usr/bin/python -O |
2 |
# Copyright 1999-2005 Gentoo Foundation |
2 |
# Copyright 1999-2005 Gentoo Foundation |
3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# $Header: /var/cvsroot/gentoo-src/portage/bin/repoman,v 1.98.2.22 2005/05/18 15:19:52 jstubbs Exp $ |
4 |
# $Id: /var/cvsroot/gentoo-src/portage/bin/repoman,v 1.98.2.23 2005/06/18 01:00:43 vapier Exp $ |
5 |
|
5 |
|
6 |
# Next to do: dep syntax checking in mask files |
6 |
# Next to do: dep syntax checking in mask files |
7 |
# Then, check to make sure deps are satisfiable (to avoid "can't find match for" problems) |
7 |
# Then, check to make sure deps are satisfiable (to avoid "can't find match for" problems) |
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(checkdir+"/"+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 792-797
Link Here
|
792 |
else: |
826 |
else: |
793 |
raise oe |
827 |
raise oe |
794 |
if S_ISDIR(mystat.st_mode): |
828 |
if S_ISDIR(mystat.st_mode): |
|
|
829 |
if y == "CVS": |
830 |
continue |
795 |
for z in os.listdir(checkdir+"/files/"+y): |
831 |
for z in os.listdir(checkdir+"/files/"+y): |
796 |
filesdirlist.append(y+"/"+z) |
832 |
filesdirlist.append(y+"/"+z) |
797 |
# current policy is no files over 20k, this is the check. |
833 |
# current policy is no files over 20k, this is the check. |
Lines 799-804
Link Here
|
799 |
stats["file.size"] += 1 |
835 |
stats["file.size"] += 1 |
800 |
fails["file.size"].append("("+ str(mystat.st_size/1024) + "K) "+x+"/files/"+y) |
836 |
fails["file.size"].append("("+ str(mystat.st_size/1024) + "K) "+x+"/files/"+y) |
801 |
|
837 |
|
|
|
838 |
for c in os.path.basename(y.rstrip(os.path.sep)): |
839 |
if c not in allowed_filename_chars_set: |
840 |
stats["file.name"] += 1 |
841 |
fails["file.name"].append("%s/files/%s: char '%s'" % (checkdir, y, c)) |
842 |
break |
843 |
|
844 |
|
802 |
if "ChangeLog" not in checkdirlist: |
845 |
if "ChangeLog" not in checkdirlist: |
803 |
stats["changelog.missing"]+=1 |
846 |
stats["changelog.missing"]+=1 |
804 |
fails["changelog.missing"].append(x+"/ChangeLog") |
847 |
fails["changelog.missing"].append(x+"/ChangeLog") |
Lines 1412-1417
Link Here
|
1412 |
rValue = os.system(gpgcmd+" "+filename) |
1455 |
rValue = os.system(gpgcmd+" "+filename) |
1413 |
if rValue == 0: |
1456 |
if rValue == 0: |
1414 |
os.rename(filename+".asc", filename) |
1457 |
os.rename(filename+".asc", filename) |
|
|
1458 |
else: |
1459 |
print "!!! gpg exited with '" + str(rValue) + "' status" |
1415 |
return rValue |
1460 |
return rValue |
1416 |
|
1461 |
|
1417 |
if myheaders or myupdates or myremoved or mynew: |
1462 |
if myheaders or myupdates or myremoved or mynew: |