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

Collapse All | Expand All

(-)/usr/lib/portage/bin/dohtml.old (-15 / +21 lines)
Lines 14-21 Link Here
14
# Detailed usage:
14
# Detailed usage:
15
# dohtml <list-of-files> 
15
# dohtml <list-of-files> 
16
#  - will install the files in the list of files (space-separated list) into 
16
#  - will install the files in the list of files (space-separated list) into 
17
#    /usr/share/doc/${PF}/html, provided the file ends in .html, .png, .jpg 
17
#    /usr/share/doc/${PF}/html, provided the file ends in .css, .gif, .htm,
18
#     or .css
18
#    .html, .jpg, .js or .png
19
# dohtml -r <list-of-files-and-directories>
19
# dohtml -r <list-of-files-and-directories>
20
#  - will do as 'dohtml', but recurse into all directories, as long as the 
20
#  - will do as 'dohtml', but recurse into all directories, as long as the 
21
#    directory name is not CVS
21
#    directory name is not CVS
Lines 34-39 Link Here
34
import sys
34
import sys
35
import types
35
import types
36
36
37
from output import EOutput
38
37
def dodir(path):
39
def dodir(path):
38
	os.system("install -d '%s'" % path)
40
	os.system("install -d '%s'" % path)
39
41
Lines 48-69 Link Here
48
	if dirname: fullpath = dirname + "/" + fullpath
50
	if dirname: fullpath = dirname + "/" + fullpath
49
51
50
	if options.DOCDESTTREE:
52
	if options.DOCDESTTREE:
51
		destdir = options.D + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix
53
		docdesttree = options.DOCDESTTREE
52
	else:
54
	else:
53
		destdir = options.D + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix
55
		docdesttree = 'html'
56
	destdir = options.D + '/'.join (('usr/share/doc',
57
					 options.PF,
58
					 docdesttree,
59
					 options.doc_prefix,
60
					 prefix))
54
61
55
	if os.path.isfile(fullpath):
62
	if os.path.isfile(fullpath):
56
		ext = os.path.splitext(basename)[1]
63
		ext = os.path.splitext(basename)[1]
57
		if (len(ext) and ext[1:] in options.allowed_exts) or basename in options.allowed_files:
64
		if (len(ext) and ext[1:] in options.allowed_exts) or basename in options.allowed_files:
58
			dodir(destdir)
65
			dodir(destdir)
59
			dofile(fullpath, destdir + "/" + basename)
66
			dofile(fullpath, destdir + "/" + basename)
60
	elif options.recurse and os.path.isdir(fullpath) and \
67
	elif os.path.isdir (fullpath) and basename not in options.disallowed_dirs:
61
	     basename not in options.disallowed_dirs:
68
		if options.recurse:
62
		for i in os.listdir(fullpath):
69
		for i in os.listdir(fullpath):
63
			pfx = basename
70
			pfx = basename
64
			if prefix: pfx = prefix + "/" + pfx
71
			if prefix: pfx = prefix + "/" + pfx
65
			install(i, dirname, options, pfx)
72
			install(i, dirname, options, pfx)
66
	else:
73
	else:
74
                        # bug #149745
75
			EOutput().ewarn ('QA Notice: directory %s given to dohtml without recursion (option -r)' % fullpath)
76
			return False
77
	else:
67
		return False
78
		return False
68
	return True
79
	return True
69
80
Lines 151-172 Link Here
151
162
152
	if options.verbose:
163
	if options.verbose:
153
		print "Allowed extensions:", options.allowed_exts
164
		print "Allowed extensions:", options.allowed_exts
154
		print "Document prefix : '" + options.doc_prefix	 + "'"
165
		print "Document prefix : '%s'" % options.doc_prefix
155
		print "Allowed files :", options.allowed_files
166
		print "Allowed files :", options.allowed_files
156
167
157
	success = True
168
	success = True
158
	
159
	for x in args:
169
	for x in args:
160
		basename = os.path.basename(x)
170
		basename = os.path.basename(x)
161
		dirname  = os.path.dirname(x)
171
		dirname  = os.path.dirname(x)
162
		success = success and install(basename, dirname, options)
172
                # bug #149745, comment #1
163
	
173
		success &= install (basename, dirname, options)
164
	if success:
165
		retcode = 0
166
	else:
167
		retcode = 1
168
	
174
	
169
	sys.exit(retcode)
175
	sys.exit (int (not success)) # 0 True, 1 False
170
176
171
if __name__ == "__main__":
177
if __name__ == "__main__":
172
	main()
178
	main()

Return to bug 149745