From ff5e7b2ceeda1765a077b3799c20d1bca4df3e4f Mon Sep 17 00:00:00 2001 From: krempp Date: Sun, 21 May 2000 17:06:04 +0200 Subject: [PATCH] ajout initial darcs-hash:20000521150604-92525-490d85e00895021d1097c096d621057b5fb9da33.gz --- to-cvs-checkins.py | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 to-cvs-checkins.py diff --git a/to-cvs-checkins.py b/to-cvs-checkins.py new file mode 100755 index 00000000..c360d74f --- /dev/null +++ b/to-cvs-checkins.py @@ -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 \n" + \ + ("Subject: CVS Commit par %s\n" % uid)+ \ + "Organization: Radio ragots\n" + \ + "Newsgroups: crans.cvs-checkins\n" + \ + "Reply-To: Nounous \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 + +