+ thename = self.friendly_name()
+ do_print = False
+ if self.options.www and diff_output:
+ self.html_store_title("Diffs in module {} ({}) : {} chars"\
+ .format(thename, self.last_tag(spec_dict), len(diff_output)))
+
+ self.html_store_raw('<p> < (left) {} </p>'.format(tag_name))
+ self.html_store_raw('<p> > (right) {} </p>'.format(thename))
+ self.html_store_pre(diff_output)
+ elif not self.options.www:
+ print('x'*30, 'module', thename)
+ print('x'*20, '<', tag_name)
+ print('x'*20, '>', thename)
+ print(diff_output)
+
+##############################
+ # store and restitute html fragments
+ @staticmethod
+ def html_href(url,text):
+ return '<a href="{}">{}</a>'.format(url, text)
+
+ @staticmethod
+ def html_anchor(url,text):
+ return '<a name="{}">{}</a>'.format(url,text)
+
+ @staticmethod
+ def html_quote(text):
+ return text.replace('&', '&').replace('<', '<').replace('>', '>')
+
+ # only the fake error module has multiple titles
+ def html_store_title(self, title):
+ if not hasattr(self,'titles'):
+ self.titles=[]
+ self.titles.append(title)
+
+ def html_store_raw(self, html):
+ if not hasattr(self,'body'):
+ self.body=''
+ self.body += html
+
+ def html_store_pre(self, text):
+ if not hasattr(self,'body'):
+ self.body=''
+ self.body += '<pre>{}</pre>'.format(self.html_quote(text))
+
+ def html_print(self, txt):
+ if not self.options.www:
+ print(txt)
+ else:
+ if not hasattr(self, 'in_list') or not self.in_list:
+ self.html_store_raw('<ul>')
+ self.in_list = True
+ self.html_store_raw('<li>{}</li>'.format(txt))
+
+ def html_print_end(self):
+ if self.options.www:
+ self.html_store_raw('</ul>')
+
+ @staticmethod
+ def html_dump_header(title):
+ nowdate = time.strftime("%Y-%m-%d")
+ nowtime = time.strftime("%H:%M (%Z)")
+ print("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<title> {} </title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<style type="text/css">
+body {{ font-family:georgia, serif; }}
+h1 {{font-size: large; }}
+p.title {{font-size: x-large; }}
+span.error {{text-weight:bold; color: red; }}
+</style>
+</head>
+<body>
+<p class='title'> {} - status on {} at {}</p>
+<ul>
+""".format(title, title, nowdate, nowtime))
+
+ @staticmethod
+ def html_dump_middle():
+ print("</ul>")
+
+ @staticmethod
+ def html_dump_footer():
+ print("</body></html")
+
+ def html_dump_toc(self):
+ if hasattr(self,'titles'):
+ for title in self.titles:
+ print('<li>', self.html_href('#'+self.friendly_name(),title), '</li>')
+
+ def html_dump_body(self):
+ if hasattr(self,'titles'):
+ for title in self.titles:
+ print('<hr /><h1>', self.html_anchor(self.friendly_name(),title), '</h1>')
+ if hasattr(self,'body'):
+ print(self.body)
+ print('<p class="top">', self.html_href('#','Back to top'), '</p>')
+
+
+
+class Build(Module):
+
+ def __get_modules(self, tagfile):
+ self.init_module_dir()
+ modules = {}
+
+ tagfile = os.path.join(self.module_dir, tagfile)
+ for line in open(tagfile):
+ try:
+ name, url = line.split(':=')
+ name, git_path = name.rsplit('-', 1)
+ modules[name] = (git_path.strip(), url.strip())
+ except:
+ pass
+ return modules
+
+ def get_modules(self, tagfile):
+ modules = self.__get_modules(tagfile)
+ for module in modules:
+ module_type = tag_or_branch = ""
+
+ path_type, url = modules[module]
+ if path_type == "GITPATH":
+ module_spec = os.path.split(url)[-1].replace(".git","")
+ name, tag_or_branch, module_type = self.parse_module_spec(module_spec)
+ else:
+ tag_or_branch = os.path.split(url)[-1].strip()
+ if url.find('/tags/') >= 0:
+ module_type = "tag"
+ elif url.find('/branches/') >= 0:
+ module_type = "branch"