Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=homepage-ng.git;a=commitdiff;h=e2b2091169bb4c0c239d7f7b3365446479f4d44b

commit e2b2091169bb4c0c239d7f7b3365446479f4d44b
Author: Miklos Vajna <[EMAIL PROTECTED]>
Date:   Tue May 13 01:09:36 2008 +0200

move hooks to the hooks directory

diff --git a/Makefile b/Makefile
index 13479c0..7381122 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
hook:
cd .git && python /home/ftp/pub/other/git-hooks/git-hooks.py post-receive
-       python frugalware/darcs-posthook.py
-       python frugalware/darcs-posthook-security.py
+       python hooks/post-receive-news.py
+       python hooks/post-receive-security.py
diff --git a/frugalware/darcs-posthook-security.py 
b/frugalware/darcs-posthook-security.py
deleted file mode 100644
index 7cfbd46..0000000
--- a/frugalware/darcs-posthook-security.py
+++ /dev/null
@@ -1,97 +0,0 @@
-"""
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License v2 as published by
- the Free Software Foundation
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
- GNU General Public License for more details.
-
- Frugalware Linux Homepage - New Generation
- @author Miklos Vajna <[EMAIL PROTECTED]>
- @copyright Copyright (C) 2006, 2007 Miklos Vajna
-
-"""
-from xml.dom import minidom
-import sys, re, popen2, pwd, os
-
-class fsa:
-       def __init__(self, xmldoc):
-               self.lines = []
-               self.id = 
xmldoc.getElementsByTagName('id')[0].firstChild.toxml()
-               self.date = 
xmldoc.getElementsByTagName('date')[0].firstChild.toxml()
-               self.author = 
xmldoc.getElementsByTagName('author')[0].firstChild.toxml()
-               self.package = 
xmldoc.getElementsByTagName('package')[0].firstChild.toxml()
-               self.vulnerable = 
xmldoc.getElementsByTagName('vulnerable')[0].firstChild.toxml()
-               self.unaffected = 
xmldoc.getElementsByTagName('unaffected')[0].firstChild.toxml()
-               self.bts = 
xmldoc.getElementsByTagName('bts')[0].firstChild.toxml()
-               self.cve = 
xmldoc.getElementsByTagName('cve')[0].firstChild.toxml()
-               self.desc = re.sub(r'\n\t+', r'\n', 
xmldoc.getElementsByTagName('desc')[0].firstChild.toxml()).replace('&quot;', 
'"')
-               self.subject = "[ FSA-%s ] %s" % (self.id, self.package)
-               self.comment = "See http://ftp.frugalware.org/pub/README.GPG 
for info"
-
-               # now generate the mail
-               self.lines.append("Frugalware Security Advisory                 
          FSA-%s\n\n" % self.id)
-               self.lines.append("Date: %s\n" % self.date)
-               self.lines.append("Package: %s\n" % self.package)
-               self.lines.append("Vulnerable versions: <= %s\n" % 
self.vulnerable)
-               self.lines.append("Unaffected versions: >= %s\n" % 
self.unaffected)
-               self.lines.append("Related bugreport: %s\n" % self.bts)
-               self.lines.append("CVE: %s\n" % self.cve)
-               self.lines.append("""
-Description
-===========
-
-%s
-""" % self.desc)
-               self.lines.append("""
-Updated Packages
-================
-
-Check if you have %s installed:
-
-       # pacman-g2 -Q %s
-
-If found, then you should upgrade to the latest version:
-
-       # pacman-g2 -Sy %s
-
-Availability
-============
-
-The latest revision of this advisory is available at
-http://frugalware.org/security/%s
-
-""" % (self.package, self.package, self.package, self.id))
-
-       def output(self):
-               pout, pin = popen2.popen2('gpg --comment "%s" --clearsign 
--homedir /home/%s/.gnupg -u 20F55619' % (self.comment, 
pwd.getpwuid(os.getuid())[0]))
-               pin.write("".join(self.lines))
-               pin.close()
-               ret = "".join(pout.readlines())
-               pout.close()
-               return ret
-
-
-if __name__ == "__main__":
-       sock = open(".git/third_party/latest-security", "r")
-       latest = sock.read().strip()
-       sock.close()
-       f = fsa(minidom.parse('frugalware/xml/security.xml'))
-       if f.id != latest:
-               import smtplib
-               sock = os.popen('git log -1 --pretty=format:"%cn <%ce>"')
-               fro = sock.read().strip()
-               sock.close()
-               to = "[EMAIL PROTECTED]"
-               msg = "From: %s \r\nTo: %s\r\nSubject: %s\r\n\r\n" \
-                       % (fro, to, f.subject)
-               msg += f.output()
-               server = smtplib.SMTP('localhost')
-               server.set_debuglevel(1)
-               server.sendmail(fro, to, msg)
-               server.quit()
-               sock = open(".git/third_party/latest-security", "w")
-               sock.write(f.id + "\n")
-               sock.close()
diff --git a/frugalware/darcs-posthook.py b/frugalware/darcs-posthook.py
deleted file mode 100644
index 9a4e5f5..0000000
--- a/frugalware/darcs-posthook.py
+++ /dev/null
@@ -1,118 +0,0 @@
-"""
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License v2 as published by
- the Free Software Foundation
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
- GNU General Public License for more details.
-
- Frugalware Linux Homepage - New Generation
- @author Miklos Vajna <[EMAIL PROTECTED]>
- @copyright Copyright (C) 2006 Miklos Vajna
-
-"""
-from sgmllib import SGMLParser
-import htmlentitydefs
-import string
-from xml.dom import minidom
-
-class BaseHTMLProcessor(SGMLParser):
-       def reset(self):
-               self.enum = 0
-               self.enumstrs = ("", "  * ", "     + ")
-               self.enumbrks = ("", "    ", "       ")
-               self.pieces = []
-               self.refs = []
-               SGMLParser.reset(self)
-
-       def wrap(self, text, width):
-               return reduce(lambda line, word, width=width: '%s%s%s' %
-                                         (line,
-                                          ' \n'[(len(line)-line.rfind('\n')-1
-                                                        + 
len(word.split('\n',1)[0]
-                                                                 ) >= width)],
-                                          word),
-                                         text.split(' ')
-                                        )
-       def start_br(self, attrs):
-               if self.enum == 0:
-                       self.pieces.append("\n" + self.enumstrs[self.enum])
-
-       def start_li(self, attrs):
-               if self.enum > 0:
-                       self.pieces.append("\n" + self.enumstrs[self.enum])
-
-       def start_a(self, attrs):
-               for k, v in attrs:
-                       if k == "href":
-                               self.refs.append(v)
-               self.pieces.append(" [%d] " % len(self.refs))
-
-       def end_a(self):
-               self.pieces.append(" ")
-
-       def start_br(self, attrs):
-               self.pieces.append("\n")
-
-       def start_pre(self, attrs):
-               self.pieces.append("\n")
-
-       def end_pre(self):
-               self.pieces.append("\n")
-
-       def start_ul(self, attrs):
-               self.enum += 1
-
-       def end_ul(self):
-               self.enum -= 1
-               self.pieces.append("\n")
-
-       def handle_data(self, text):
-               self.pieces.append(self.wrap(text.strip(), 80).replace("\n", 
"\n" + self.enumbrks[self.enum]))
-
-       def output(self):
-               """Return processed HTML as a single string"""
-               if len(self.refs) > 0:
-                       self.pieces.append("\nReferences\n\n")
-                       for i in self.refs:
-                               str = i
-                               try:
-                                       str.index("http://";)
-                               except ValueError:
-                                       str = "http://frugalware.org"; + str
-                               self.pieces.append("%d. %s\n" % 
(self.refs.index(i)+1, str))
-               return string.strip("".join(self.pieces))
-
-
-if __name__ == "__main__":
-       sock = open(".git/third_party/latest", "r")
-       latest = sock.read().strip()
-       sock.close()
-       xmldoc = minidom.parse('frugalware/xml/news.xml')
-       for i in xmldoc.getElementsByTagName('post'):
-               if i.getElementsByTagName('hidden')[0].firstChild.toxml() == 
"0":
-                       id = i.getElementsByTagName('id')[0].firstChild.toxml()
-                       break
-       if id != latest:
-               title = 
xmldoc.getElementsByTagName('title')[0].firstChild.toxml()
-               author = 
xmldoc.getElementsByTagName('author')[0].firstChild.toxml()
-               htmlSource = 
xmldoc.getElementsByTagName('content')[0].firstChild.toxml()
-               htmlSource = htmlSource.replace("<![CDATA[", "").replace("]]>", 
"").strip()
-               parser = BaseHTMLProcessor()
-               parser.feed(htmlSource)
-               parser.close()
-               import smtplib
-               fro = author + " <[EMAIL PROTECTED]>"
-               to = "[EMAIL PROTECTED]"
-               msg = "From: %s \r\nTo: %s\r\nSubject: %s\r\n\r\n" \
-                       % (fro, to, title)
-               msg += parser.output()
-               server = smtplib.SMTP('localhost')
-               server.set_debuglevel(1)
-               server.sendmail(fro, to, msg)
-               server.quit()
-               sock = open(".git/third_party/latest", "w")
-               sock.write(id + "\n")
-               sock.close()
diff --git a/hooks/post-receive-news.py b/hooks/post-receive-news.py
new file mode 100644
index 0000000..9a4e5f5
--- /dev/null
+++ b/hooks/post-receive-news.py
@@ -0,0 +1,118 @@
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 as published by
+ the Free Software Foundation
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ GNU General Public License for more details.
+
+ Frugalware Linux Homepage - New Generation
+ @author Miklos Vajna <[EMAIL PROTECTED]>
+ @copyright Copyright (C) 2006 Miklos Vajna
+
+"""
+from sgmllib import SGMLParser
+import htmlentitydefs
+import string
+from xml.dom import minidom
+
+class BaseHTMLProcessor(SGMLParser):
+       def reset(self):
+               self.enum = 0
+               self.enumstrs = ("", "  * ", "     + ")
+               self.enumbrks = ("", "    ", "       ")
+               self.pieces = []
+               self.refs = []
+               SGMLParser.reset(self)
+
+       def wrap(self, text, width):
+               return reduce(lambda line, word, width=width: '%s%s%s' %
+                                         (line,
+                                          ' \n'[(len(line)-line.rfind('\n')-1
+                                                        + 
len(word.split('\n',1)[0]
+                                                                 ) >= width)],
+                                          word),
+                                         text.split(' ')
+                                        )
+       def start_br(self, attrs):
+               if self.enum == 0:
+                       self.pieces.append("\n" + self.enumstrs[self.enum])
+
+       def start_li(self, attrs):
+               if self.enum > 0:
+                       self.pieces.append("\n" + self.enumstrs[self.enum])
+
+       def start_a(self, attrs):
+               for k, v in attrs:
+                       if k == "href":
+                               self.refs.append(v)
+               self.pieces.append(" [%d] " % len(self.refs))
+
+       def end_a(self):
+               self.pieces.append(" ")
+
+       def start_br(self, attrs):
+               self.pieces.append("\n")
+
+       def start_pre(self, attrs):
+               self.pieces.append("\n")
+
+       def end_pre(self):
+               self.pieces.append("\n")
+
+       def start_ul(self, attrs):
+               self.enum += 1
+
+       def end_ul(self):
+               self.enum -= 1
+               self.pieces.append("\n")
+
+       def handle_data(self, text):
+               self.pieces.append(self.wrap(text.strip(), 80).replace("\n", 
"\n" + self.enumbrks[self.enum]))
+
+       def output(self):
+               """Return processed HTML as a single string"""
+               if len(self.refs) > 0:
+                       self.pieces.append("\nReferences\n\n")
+                       for i in self.refs:
+                               str = i
+                               try:
+                                       str.index("http://";)
+                               except ValueError:
+                                       str = "http://frugalware.org"; + str
+                               self.pieces.append("%d. %s\n" % 
(self.refs.index(i)+1, str))
+               return string.strip("".join(self.pieces))
+
+
+if __name__ == "__main__":
+       sock = open(".git/third_party/latest", "r")
+       latest = sock.read().strip()
+       sock.close()
+       xmldoc = minidom.parse('frugalware/xml/news.xml')
+       for i in xmldoc.getElementsByTagName('post'):
+               if i.getElementsByTagName('hidden')[0].firstChild.toxml() == 
"0":
+                       id = i.getElementsByTagName('id')[0].firstChild.toxml()
+                       break
+       if id != latest:
+               title = 
xmldoc.getElementsByTagName('title')[0].firstChild.toxml()
+               author = 
xmldoc.getElementsByTagName('author')[0].firstChild.toxml()
+               htmlSource = 
xmldoc.getElementsByTagName('content')[0].firstChild.toxml()
+               htmlSource = htmlSource.replace("<![CDATA[", "").replace("]]>", 
"").strip()
+               parser = BaseHTMLProcessor()
+               parser.feed(htmlSource)
+               parser.close()
+               import smtplib
+               fro = author + " <[EMAIL PROTECTED]>"
+               to = "[EMAIL PROTECTED]"
+               msg = "From: %s \r\nTo: %s\r\nSubject: %s\r\n\r\n" \
+                       % (fro, to, title)
+               msg += parser.output()
+               server = smtplib.SMTP('localhost')
+               server.set_debuglevel(1)
+               server.sendmail(fro, to, msg)
+               server.quit()
+               sock = open(".git/third_party/latest", "w")
+               sock.write(id + "\n")
+               sock.close()
diff --git a/hooks/post-receive-security.py b/hooks/post-receive-security.py
new file mode 100644
index 0000000..7cfbd46
--- /dev/null
+++ b/hooks/post-receive-security.py
@@ -0,0 +1,97 @@
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 as published by
+ the Free Software Foundation
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ GNU General Public License for more details.
+
+ Frugalware Linux Homepage - New Generation
+ @author Miklos Vajna <[EMAIL PROTECTED]>
+ @copyright Copyright (C) 2006, 2007 Miklos Vajna
+
+"""
+from xml.dom import minidom
+import sys, re, popen2, pwd, os
+
+class fsa:
+       def __init__(self, xmldoc):
+               self.lines = []
+               self.id = 
xmldoc.getElementsByTagName('id')[0].firstChild.toxml()
+               self.date = 
xmldoc.getElementsByTagName('date')[0].firstChild.toxml()
+               self.author = 
xmldoc.getElementsByTagName('author')[0].firstChild.toxml()
+               self.package = 
xmldoc.getElementsByTagName('package')[0].firstChild.toxml()
+               self.vulnerable = 
xmldoc.getElementsByTagName('vulnerable')[0].firstChild.toxml()
+               self.unaffected = 
xmldoc.getElementsByTagName('unaffected')[0].firstChild.toxml()
+               self.bts = 
xmldoc.getElementsByTagName('bts')[0].firstChild.toxml()
+               self.cve = 
xmldoc.getElementsByTagName('cve')[0].firstChild.toxml()
+               self.desc = re.sub(r'\n\t+', r'\n', 
xmldoc.getElementsByTagName('desc')[0].firstChild.toxml()).replace('&quot;', 
'"')
+               self.subject = "[ FSA-%s ] %s" % (self.id, self.package)
+               self.comment = "See http://ftp.frugalware.org/pub/README.GPG 
for info"
+
+               # now generate the mail
+               self.lines.append("Frugalware Security Advisory                 
          FSA-%s\n\n" % self.id)
+               self.lines.append("Date: %s\n" % self.date)
+               self.lines.append("Package: %s\n" % self.package)
+               self.lines.append("Vulnerable versions: <= %s\n" % 
self.vulnerable)
+               self.lines.append("Unaffected versions: >= %s\n" % 
self.unaffected)
+               self.lines.append("Related bugreport: %s\n" % self.bts)
+               self.lines.append("CVE: %s\n" % self.cve)
+               self.lines.append("""
+Description
+===========
+
+%s
+""" % self.desc)
+               self.lines.append("""
+Updated Packages
+================
+
+Check if you have %s installed:
+
+       # pacman-g2 -Q %s
+
+If found, then you should upgrade to the latest version:
+
+       # pacman-g2 -Sy %s
+
+Availability
+============
+
+The latest revision of this advisory is available at
+http://frugalware.org/security/%s
+
+""" % (self.package, self.package, self.package, self.id))
+
+       def output(self):
+               pout, pin = popen2.popen2('gpg --comment "%s" --clearsign 
--homedir /home/%s/.gnupg -u 20F55619' % (self.comment, 
pwd.getpwuid(os.getuid())[0]))
+               pin.write("".join(self.lines))
+               pin.close()
+               ret = "".join(pout.readlines())
+               pout.close()
+               return ret
+
+
+if __name__ == "__main__":
+       sock = open(".git/third_party/latest-security", "r")
+       latest = sock.read().strip()
+       sock.close()
+       f = fsa(minidom.parse('frugalware/xml/security.xml'))
+       if f.id != latest:
+               import smtplib
+               sock = os.popen('git log -1 --pretty=format:"%cn <%ce>"')
+               fro = sock.read().strip()
+               sock.close()
+               to = "[EMAIL PROTECTED]"
+               msg = "From: %s \r\nTo: %s\r\nSubject: %s\r\n\r\n" \
+                       % (fro, to, f.subject)
+               msg += f.output()
+               server = smtplib.SMTP('localhost')
+               server.set_debuglevel(1)
+               server.sendmail(fro, to, msg)
+               server.quit()
+               sock = open(".git/third_party/latest-security", "w")
+               sock.write(f.id + "\n")
+               sock.close()
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to