Conversor de logs do svn para rss
Publicado por Pedro Robson Leão 29/10/2008
[ Hits: 4.562 ]
<pre>
script -h (help)
uso: script >file.xml
Os seguintes parâmetros podem estar incluídos em um arquivo /home/pleao/../snvlog2rss.sh.rc
</pre>
<pre>
#default
action="SNV_CHANGE";
webrepository="http://localhost/svnwebclient/content.jsp";
webparam="crev";
domain="localhost";
title="SVN TAGS";
description="Tags SVN";
lang="pt-br";
repository="http://svn/repositorio";
revisions=20;
function manpage() {
cat ${1} | grep "##" | grep -v cat | cut -c 3- | while read line ; do
eval "echo \"${line}\"";
done
exit;
}
###############################################
## Pedro Robson Leao - 20081021
##
## Conversor de log svn para rss
##
## Versao 1.0
##
## uso: script >file.xml
##
## Os seguinte parametros podem estar incluidos em um arquivo ${HOME}/.${0}.rc
##
###acao incluida no xml
##action="SNV_CHANGE";
###url do snvwebclient ou similar #testado com svnwebclient
##webrepository="http://localhost/svnwebclient/content.jsp";
###parametro para pegar revisao na interface web do controlador de versao
##webparam="crev";
###domain para os usuarios - composicao do email
##domain="localhost";
###titulo do rss
##title="SVN TAGS";
###descricao do rss
##description="Tags SVN";
###language do rss
##lang="pt-br";
###endereco do repositorio
##repository="http://svn/repositorio";
###quantidade de revisoes para ser verificada
##revisions=20;
################################################
[ "${1}" == "-h" ] && manpage "${0}";
rev=$( svn --non-interactive info ${repository} | grep ^Revision: | cut -d : -f 2 );
rev2=$((rev-revisions));
[ "${rev2}" -lt "0" ] && {
rev2=0;
}
[ -f ~/.${0}.rc ] && {
source ~/.${0}.rc;
}
date=$(date +%Y%m%d );
svn --non-interactive log ${repository} -r ${rev}:${rev2} -v | awk \
-v action="${action}" \
-v webrepository="${webrepository}" \
-v webparam="${webparam}" \
-v domain="${domain}" \
-v title="${title}" \
-v description="${description}" \
-v lang="${lang}" \
-v date="${date}" \
'
BEGIN {
# x=i="a";
# action="SNV_CHANGE";
# webrepository="http://csaad:8085/svnwebclient/content.jsp";
# webparam="crev";
# domain="okto.com.br";
# title="SVN TAGS";
# description"Tags SVN";
# lang="pt-br";
# date="20081020";
STATUS[" "] = "no modifications";
STATUS["A"] = "Added";
STATUS["C"] = "Conflicted";
STATUS["D"] = "Deleted";
STATUS["I"] = "Ignored";
STATUS["M"] = "Modified";
STATUS["R"] = "Replaced";
STATUS["X"] = "item is unversioned, but is used by an externals definition";
STATUS["?"] = "item is not under version control";
STATUS["!"] = "item is missing (removed by non-svn command) or incomplete";
STATUS["~"] = "versioned item obstructed by some item of a different kind";
print "<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\" xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" >";
print "<channel>";
print "<title>" title "</title>";
print "<link>" webrepository "</link>";
print "<description>" description "</description>";
print "<pubDate>" date "</pubDate>";
print "<generator>http://wordpress.org/?v=MU</generator>";
print "<language>" lang "</language>";
}
function mount_item() {
repository = webrepository;
if(webparam) {
repository = sprintf("%s%s%s%s%s", repository, "?", webparam, "=", release);
}
if(domain) {
user = sprintf("%s@%s", user, domain);
}
print "<item>";
print " <title>Revision " release, "by", user"</title>";
print " <link>", repository, "</link>"; #trocar parametrizavel
print " <dc:creator>" user "</dc:creator>";
print " <pubDate>" date, hour "</pubDate>";
print " <category><![CDATA[",action,"]]></category>";
print " <description><![CDATA[";
print ":: <b>Links:</b><br>";
for (s in _src) {
if(_src[s]) {
a=_action[s];
status = STATUS[a] ? STATUS[a] : a;
print "<b>" status "</b>: " "<a href=" repository "&url=" substr(_src[s],2) ">" _src[s] "</a><br>";
}
_src[s]=0;
}
print "<br><br>:: <b>Info:</b><br>";
for (c in comment) {
if(comment[c]) {
#if(!index(coment[c],"<br>$")) {
# print comment[c];
#} else {
print comment[c], "<br>";
#}
}
comment[c]=0;
}
print " <hr>]]></description>";
print "</item>";
}
/^---------/ { #start
if(flg) {
mount_item();
i=x="a";
}
flg=1;
}
/r[0-9]/ { #release
#r3075 | pleao | 2008-10-17 11:53:08 -0300 (Fri, 17 Oct 2008) | 7 lines
release=substr($1,2);
user=$3;
date=$5;
hour=$6;
tz=$4;
}
/Changed paths:/ {
#tira o changed paths
}
/^ [A-Z] \// { #Changed paths:
# M /legacy/gkpromo/trunk/interface/front-end/default.css
_action[i]=$1;
_src[i]=$2;
i++;
}
{
comment[x]=$0;
x++;
}
END {
mount_item();
print "</channel></rss>";
}
';
</pre>
slacklibre - Seu Slackware 100% Livre
Ispeed - Medidor de velocidade de download
Unificando arquivos de bloqueio e liberação no squid
Script para fazer funcionar o bloqueio por horário - Squid
Nenhum comentário foi encontrado.
Faça suas próprias atualizações de pacotes/programas no Void Linux e torne-se um Contribuidor
Como rodar o Folding@home no Linux
Criando um painel de controle (Dashboard) para seu servidor com o Homepage
O Abismo entre o Código e o Chão: Saltos Tecnológicos e a Exclusão Estrutural no Brasil
Instalar e Configurar a santíssima trindade (PAP) no Void Linux
Pisando no acelerador do Linux Mint: Kernel XanMod, zRAM e Ajustes de Swap
Como compilar kernel no Linux Mint
Lançamento do Brutal DOOM test 6
Consertando o erro no Brave de webgl
Solução para ter de volta as bordas e barra de títulos das janelas em zenity no Debian 13.x
Seno, Coseno, Tangente em CLIPPER (0)
Inserir uma URL num arquvo pelo Ubuntu (CLIPPER) (0)
VMWare Player não conecta na rede nem consigo intercambiar arquivos (1)









