| 1 |
jeroen |
1154 |
#!/usr/bin/python
|
| 2 |
|
|
# -*- coding: utf8 -*-
|
| 3 |
hertzog |
376 |
|
| 4 |
|
|
# Make sure tabs expand to 8 spaces in vim
|
| 5 |
|
|
# vim: expandtab
|
| 6 |
|
|
|
| 7 |
jeroen |
1154 |
# Copyright 2002 Raphaƫl Hertzog
|
| 8 |
hertzog |
376 |
# This file is distributed under the terms of the General Public License
|
| 9 |
|
|
# version 2 or (at your option) any later version.
|
| 10 |
|
|
|
| 11 |
|
|
import os, os.path, sys, email, common
|
| 12 |
|
|
|
| 13 |
|
|
from config import dir, odir, root
|
| 14 |
|
|
|
| 15 |
|
|
while 1:
|
| 16 |
|
|
line = sys.stdin.readline()
|
| 17 |
|
|
if not line: break #eof
|
| 18 |
|
|
pkg = line.strip()
|
| 19 |
|
|
|
| 20 |
|
|
hash = pkg[0]
|
| 21 |
|
|
if pkg[:3] == "lib": hash = pkg[:4]
|
| 22 |
|
|
srcdir = "%s/base/%s/%s" % (root, hash, pkg)
|
| 23 |
|
|
if not os.path.isdir(srcdir):
|
| 24 |
|
|
sys.exit(0) # discard the mail
|
| 25 |
|
|
# It was probably a new package but since the existence of the
|
| 26 |
|
|
# directory will make other scripts to try to generate something
|
| 27 |
|
|
# out of it .... better not store anything until the source
|
| 28 |
|
|
# package is known via Sources.gz
|
| 29 |
|
|
# It's also to avoid a denial of service by sending properly
|
| 30 |
|
|
# formatted mails to the bot which would create hundreds of
|
| 31 |
|
|
# worthless directories and files...
|
| 32 |
|
|
outdir = srcdir + "/news"
|
| 33 |
|
|
htmldir = "%s/web/%s/%s/news" % (root, hash, pkg)
|
| 34 |
|
|
common.generate_html_msg(outdir, htmldir, 30)
|
| 35 |
|
|
# Synchronize the XML document
|
| 36 |
|
|
#f = os.popen("%s/bin/update_news.py" % root, "w")
|
| 37 |
|
|
#f.write(pkg+"\n")
|
| 38 |
|
|
#f.close()
|
| 39 |
|
|
# Regenerate the HTML page
|
| 40 |
|
|
#f = os.popen("%s/bin/generate_html.sh" % root, "w")
|
| 41 |
|
|
#f.write(pkg+"\n")
|
| 42 |
|
|
#f.close()
|
| 43 |
|
|
|