--- /usr/lib/portage/bin/dohtml.old 2007-01-07 16:11:16.000000000 -0700 +++ /usr/lib/portage/bin/dohtml 2007-01-07 18:03:54.000000000 -0700 @@ -14,8 +14,8 @@ # Detailed usage: # dohtml # - will install the files in the list of files (space-separated list) into -# /usr/share/doc/${PF}/html, provided the file ends in .html, .png, .jpg -# or .css +# /usr/share/doc/${PF}/html, provided the file ends in .css, .gif, .htm, +# .html, .jpg, .js or .png # dohtml -r # - will do as 'dohtml', but recurse into all directories, as long as the # directory name is not CVS @@ -34,6 +34,8 @@ import sys import types +from output import EOutput + def dodir(path): os.system("install -d '%s'" % path) @@ -48,22 +50,31 @@ if dirname: fullpath = dirname + "/" + fullpath if options.DOCDESTTREE: - destdir = options.D + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix + docdesttree = options.DOCDESTTREE else: - destdir = options.D + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix + docdesttree = 'html' + destdir = options.D + '/'.join (('usr/share/doc', + options.PF, + docdesttree, + options.doc_prefix, + prefix)) if os.path.isfile(fullpath): ext = os.path.splitext(basename)[1] if (len(ext) and ext[1:] in options.allowed_exts) or basename in options.allowed_files: dodir(destdir) dofile(fullpath, destdir + "/" + basename) - elif options.recurse and os.path.isdir(fullpath) and \ - basename not in options.disallowed_dirs: + elif os.path.isdir (fullpath) and basename not in options.disallowed_dirs: + if options.recurse: for i in os.listdir(fullpath): pfx = basename if prefix: pfx = prefix + "/" + pfx install(i, dirname, options, pfx) else: + # bug #149745 + EOutput().ewarn ('QA Notice: directory %s given to dohtml without recursion (option -r)' % fullpath) + return False + else: return False return True @@ -151,22 +162,17 @@ if options.verbose: print "Allowed extensions:", options.allowed_exts - print "Document prefix : '" + options.doc_prefix + "'" + print "Document prefix : '%s'" % options.doc_prefix print "Allowed files :", options.allowed_files success = True - for x in args: basename = os.path.basename(x) dirname = os.path.dirname(x) - success = success and install(basename, dirname, options) - - if success: - retcode = 0 - else: - retcode = 1 + # bug #149745, comment #1 + success &= install (basename, dirname, options) - sys.exit(retcode) + sys.exit (int (not success)) # 0 True, 1 False if __name__ == "__main__": main()