Conversor de log SVN para RSS
Publicado por Pedro Robson Leão 21/10/2008 (última atualização em 20/10/2009)
[ Hits: 4.908 ]
Uso: script > file.xml
Os seguinte parâmetros podem estar incluídos em um arquivo snvlog2rss.sh.rc:
#acao incluída no xml
action=SNV_CHANGE;
#url do snvwebclient ou similar - testado com svnwebclient
webrepository=http://localhost/svnwebclient/content.jsp;
#parâmetro para pegar revisão na interface web do controlador de versão
webparam=crev;
#domain para os usuários - composição do email
domain=localhost;
#título do rss
title=SVN TAGS;
#descrição do rss
description=Tags SVN;
#language do rss
lang=pt-br;
#endereço do repositório
repository=http://svn/repositorio;
#quantidade de revisões para ser verificada
revisions=20;
#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>";
}
';
Script para criar usuarios Dialup
Alterando resolução de monitor externo
Bashblog v3.0 - cria um microblog em HTML5
Nenhum comentário foi encontrado.
Papagaiando o XFCE com temas e recursos
WhatsApp com Chamadas no Linux via Waydroid
XFCE - quase um Gnome ou Plasma mas muito mais leve
LXQT - funcional para máquinas pererecas e usuários menos exigentes
Como cortar as partes de um vídeo com passagens de áudio em branco
Tiling automático no KDE Plasma
SNMP Scan no OCS Inventory só funciona com HTTPS corretamente configurado
Links importantes de usuários do vol (4)
GOG confirma suporte oficial ao sistema Linux: "o trabalho começo... (2)
Para os fãs de DOOM, um vídeo do Romero (com dublagem em pt-br disponí... (2)









