ajout initial
darcs-hash:20000521150604-92525-490d85e00895021d1097c096d621057b5fb9da33.gz
This commit is contained in:
parent
f1d3de9de7
commit
ff5e7b2cee
1 changed files with 65 additions and 0 deletions
65
to-cvs-checkins.py
Executable file
65
to-cvs-checkins.py
Executable file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# Hack par CC 13/07/1999 pour envoyer sur crans.cvs-checkins un
|
||||||
|
# compte-rendu d'activité de ce qui se passe...
|
||||||
|
#
|
||||||
|
# modif par SamK 22/11/99: splitter les lignes, sinon nntplib refuse le message
|
||||||
|
# si ya des lignes trop longues..
|
||||||
|
#
|
||||||
|
# modif par OS 15/05/00 ajout d'un Reply-To...
|
||||||
|
#
|
||||||
|
# Intimement lié à CVSROOT/loginfo
|
||||||
|
#
|
||||||
|
|
||||||
|
import nntplib,string,os,StringIO
|
||||||
|
|
||||||
|
def LFsplit(s):
|
||||||
|
res=""
|
||||||
|
while len(s)>80 :
|
||||||
|
pos=string.find(s,' ',65,80)
|
||||||
|
if pos < 0 :
|
||||||
|
res=res+s[0:75]+'\n'
|
||||||
|
s=s[75:len(s)+1]
|
||||||
|
else :
|
||||||
|
res=res+s[0:pos]+'\n'
|
||||||
|
s=s[pos+1:len(s)+1]
|
||||||
|
if len(s)>0:
|
||||||
|
res=res+s
|
||||||
|
return res
|
||||||
|
|
||||||
|
for uid in os.listdir('/var/cvs'):
|
||||||
|
try:
|
||||||
|
so = []
|
||||||
|
fi = open('/var/cvs/'+uid,'r')
|
||||||
|
|
||||||
|
so.append("From: CVS admin <root@crans.ens-cachan.fr>\n" + \
|
||||||
|
("Subject: CVS Commit par %s\n" % uid)+ \
|
||||||
|
"Organization: Radio ragots\n" + \
|
||||||
|
"Newsgroups: crans.cvs-checkins\n" + \
|
||||||
|
"Reply-To: Nounous <nounous@crans.ens-cachan.fr>\n" + \
|
||||||
|
"Followup-To: crans.informatique\n" )
|
||||||
|
|
||||||
|
so.append("MIME-Version: 1.0\n" + \
|
||||||
|
"Content-Type: text/plain\n")
|
||||||
|
so.append("\n")
|
||||||
|
envoie = 0
|
||||||
|
while 1:
|
||||||
|
s = fi.readline()
|
||||||
|
if not s: break
|
||||||
|
envoie = 1
|
||||||
|
s=LFsplit(s)
|
||||||
|
so.append(s)
|
||||||
|
|
||||||
|
|
||||||
|
# maintenant, on envoie :
|
||||||
|
|
||||||
|
if envoie:
|
||||||
|
sso = string.join(so,'')
|
||||||
|
fso = StringIO.StringIO(sso)
|
||||||
|
nntplib.NNTP('news.crans.ens-cachan.fr').post(fso)
|
||||||
|
#print sso
|
||||||
|
os.unlink('/var/cvs/'+uid)
|
||||||
|
except:
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue