Conversor de log SVN para RSS
Publicado por Pedro Robson Leão 21/10/2008 (última atualização em 20/10/2009)
[ Hits: 4.932 ]
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>";
}
';
Cria ambiente virtual (VirtualHost no Apache e Virtual Mail no Postfix) para desenvolvimento web
Script de instalação do Xorg 7.2 modificado para processadores AMD64
Criação de pasta com senha no Apache
Instalação do Nagios por script
Nenhum comentário foi encontrado.
Porque Gentoo semi-binário atualmente (desabafo)
A combinação de WMs com compositores feitos por fora
Audacious, VLC e QMMP - que saudades do XMMS
SUNO OpenSource: Crie um servidor de gerador de música com IA
Plantar o Singrante Google Chrome no Void Linux
Lançando Java e Netbeans no Linux
Instalando SVP4 e MPV (VapourSynth) no Gentoo
Migração do KDE Plasma para Cinnamon no Gentoo (com systemd) + Tema Colloid
Como desativar a economia de energia no Gentoo (Systemd, Wi-Fi, USB e SSH)
Comportamento "inesper... ao executar 'apt full-upgrade&... (3)
instalar iso sem pendrive ou dvd (2)
Um filme, uma banda, um jogo, um livro, um anime (ou mangá) (11)









