Commit d768aadb68ddb8965cc13581bd9b61e3021267df

Authored by perry.werneck@gmail.com
1 parent 094ac81b

Incluindo script para atualização automática do ChangeLog igual ao do projeto CodeBlocks

Showing 2 changed files with 436 additions and 0 deletions   Show diff stats
ChangeLog.xsl 0 → 100644
@@ -0,0 +1,384 @@ @@ -0,0 +1,384 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +
  3 +<!--
  4 +
  5 + Changelog.xsl - xslt stylesheet for converting codeblocks svn log
  6 + to a normal changelog
  7 +
  8 + version 0.1
  9 +
  10 + based on svn2cl.xsl version 0.9
  11 +
  12 + original copyright-notice:
  13 +
  14 + <snip>
  15 +
  16 + This file is based on several implementations of this conversion
  17 + that I was not completely happy with and some other common
  18 + xslt constructs found on the web.
  19 +
  20 + Copyright (C) 2004, 2005, 2006, 2007 Arthur de Jong.
  21 +
  22 + </snip>
  23 +
  24 + Copyright (c) 2008-2010 Jens Lody
  25 +
  26 +
  27 + Usage (replace ++ with two minus signs which aren't allowed
  28 + inside xml comments):
  29 + svn ++verbose ++xml log | \
  30 + xsltproc ++stringparam strip-prefix `basename $(pwd)` \
  31 + ++stringparam linelen 75 \
  32 + ++stringparam groupbyday yes \
  33 + ++stringparam separate-daylogs yes \
  34 + ++stringparam include-rev yes \
  35 + ++stringparam breakbeforemsg yes/2 \
  36 + ++stringparam reparagraph yes \
  37 + ++stringparam authorsfile FILE \
  38 + ++stringparam ignore-message-starting \
  39 + Changelog.xsl - > ChangeLog
  40 +
  41 + Redistribution and use in source and binary forms, with or without
  42 + modification, are permitted provided that the following conditions
  43 + are met:
  44 + 1. Redistributions of source code must retain the above copyright
  45 + notice, this list of conditions and the following disclaimer.
  46 + 2. Redistributions in binary form must reproduce the above copyright
  47 + notice, this list of conditions and the following disclaimer in
  48 + the documentation and/or other materials provided with the
  49 + distribution.
  50 + 3. The name of the author may not be used to endorse or promote
  51 + products derived from this software without specific prior
  52 + written permission.
  53 +
  54 + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  55 + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  56 + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  57 + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  58 + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  59 + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  60 + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  61 + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  62 + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  63 + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  64 + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  65 +
  66 +-->
  67 +
  68 +<!DOCTYPE xsl:stylesheet [
  69 + <!ENTITY space "&#32;">
  70 +]>
  71 +
  72 +<xsl:stylesheet
  73 + version="1.0"
  74 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  75 +
  76 + <xsl:output
  77 + method="text"
  78 + encoding="utf-8"
  79 + media-type="text/plain"
  80 + omit-xml-declaration="yes"
  81 + standalone="yes"
  82 + indent="no" />
  83 +
  84 + <xsl:strip-space elements="*" />
  85 +
  86 + <!-- the prefix of pathnames to strip -->
  87 + <xsl:param name="strip-prefix" select="'/'" />
  88 +
  89 + <!-- the length of a line to wrap messages at -->
  90 + <xsl:param name="linelen" select="75" />
  91 +
  92 + <!-- whether entries should be grouped by day -->
  93 + <xsl:param name="groupbyday" select="'no'" />
  94 +
  95 + <!-- whether to seperate log messages by empty lines -->
  96 + <xsl:param name="separate-daylogs" select="'no'" />
  97 +
  98 + <!-- whether a revision number should be included -->
  99 + <xsl:param name="include-rev" select="'no'" />
  100 +
  101 + <!-- whether the log message should start on a new line -->
  102 + <xsl:param name="breakbeforemsg" select="'no'" />
  103 +
  104 + <!-- whether the message should be rewrapped within one paragraph -->
  105 + <xsl:param name="reparagraph" select="'no'" />
  106 +
  107 + <!-- whether certain messages should be ignored -->
  108 + <xsl:param name="ignore-message-starting" select="''" />
  109 +
  110 + <!-- location of authors file if any -->
  111 + <xsl:param name="authorsfile" select="''" />
  112 + <xsl:key name="author-lookup" match="author" use="@uid" />
  113 + <xsl:variable name="authors-top" select="document($authorsfile)/authors" />
  114 +
  115 + <!-- match the topmost log entry -->
  116 + <xsl:template match="log">
  117 + <xsl:choose>
  118 + <xsl:when test="$ignore-message-starting != ''">
  119 + <!-- only handle logentries with don't contain the string -->
  120 + <xsl:apply-templates select="logentry[not(starts-with(msg,$ignore-message-starting))]" />
  121 + </xsl:when>
  122 + <xsl:otherwise>
  123 + <xsl:apply-templates select="logentry" />
  124 + </xsl:otherwise>
  125 + </xsl:choose>
  126 + <!-- add newlines at the end of the changelog -->
  127 + <xsl:text>&#xA;</xsl:text>
  128 + </xsl:template>
  129 +
  130 + <!-- format one entry from the log -->
  131 + <xsl:template match="logentry">
  132 + <xsl:choose>
  133 + <!-- if we're grouping we should omit some headers -->
  134 + <xsl:when test="$groupbyday='yes'">
  135 + <!-- save log entry number -->
  136 + <xsl:variable name="pos" select="position()" />
  137 + <!-- fetch previous entry's date -->
  138 + <xsl:variable name="prevdate">
  139 + <xsl:apply-templates select="../logentry[position()=(($pos)-1)]/date" />
  140 + </xsl:variable>
  141 + <!-- fetch previous entry's author -->
  142 + <xsl:variable name="prevauthor">
  143 + <xsl:value-of select="normalize-space(../logentry[position()=(($pos)-1)]/author)" />
  144 + </xsl:variable>
  145 + <!-- fetch this entry's date -->
  146 + <xsl:variable name="date">
  147 + <xsl:apply-templates select="date" />
  148 + </xsl:variable>
  149 + <!-- fetch this entry's author -->
  150 + <xsl:variable name="author">
  151 + <xsl:value-of select="normalize-space(author)" />
  152 + </xsl:variable>
  153 + <!-- check if header is changed -->
  154 + <xsl:if test="($prevdate!=$date) or ($prevauthor!=$author)">
  155 + <!-- add newline -->
  156 + <xsl:if test="not(position()=1)">
  157 + <xsl:text>&#xA;</xsl:text>
  158 + </xsl:if>
  159 + <!-- date -->
  160 + <xsl:value-of select="$date" />
  161 + <!-- two spaces -->
  162 + <xsl:text>&space;&space;</xsl:text>
  163 + <!-- author's name -->
  164 + <xsl:apply-templates select="author" />
  165 + <!-- two newlines -->
  166 + <xsl:text>&#xA;</xsl:text>
  167 + <xsl:if test="$separate-daylogs!='yes'"><xsl:text>&#xA;</xsl:text></xsl:if>
  168 + </xsl:if>
  169 + </xsl:when>
  170 + <!-- write the log header -->
  171 + <xsl:otherwise>
  172 + <!-- add newline -->
  173 + <xsl:if test="not(position()=1)">
  174 + <xsl:text>&#xA;</xsl:text>
  175 + </xsl:if>
  176 + <!-- date -->
  177 + <xsl:apply-templates select="date" />
  178 + <!-- two spaces -->
  179 + <xsl:text>&space;&space;</xsl:text>
  180 + <!-- author's name -->
  181 + <xsl:apply-templates select="author" />
  182 + <!-- two newlines -->
  183 + <xsl:text>&#xA;&#xA;</xsl:text>
  184 + </xsl:otherwise>
  185 + </xsl:choose>
  186 + <!-- get revision number -->
  187 + <xsl:variable name="rev">
  188 + <xsl:if test="$include-rev='yes'">
  189 + <xsl:text>svn</xsl:text>
  190 + <xsl:value-of select='format-number(@revision,"0000")' />
  191 + <xsl:text>:&#x00a0;&#x00a0;</xsl:text>
  192 + </xsl:if>
  193 + </xsl:variable>
  194 + <!-- trim trailing newlines -->
  195 + <xsl:variable name="msg">
  196 + <!-- add a line break before the log message -->
  197 + <xsl:choose>
  198 + <xsl:when test="$breakbeforemsg='yes'">
  199 + <xsl:text>&#xA;</xsl:text>
  200 + </xsl:when>
  201 + <xsl:when test="number($breakbeforemsg)&gt;0">
  202 + <xsl:call-template name="newlines">
  203 + <xsl:with-param name="count" select="number($breakbeforemsg)" />
  204 + </xsl:call-template>
  205 + </xsl:when>
  206 + </xsl:choose>
  207 + <xsl:call-template name="trim-newln">
  208 + <xsl:with-param name="txt" select="msg" />
  209 + </xsl:call-template>
  210 + </xsl:variable>
  211 + <!-- add newline here if separate-daylogs is in effect -->
  212 + <xsl:if test="$groupbyday='yes' and $separate-daylogs='yes'"><xsl:text>&#xA;</xsl:text></xsl:if>
  213 + <!-- print the message nicely wrapped -->
  214 + <xsl:call-template name="wrap">
  215 + <xsl:with-param name="txt" select="concat($rev,$msg)" />
  216 + </xsl:call-template>
  217 + </xsl:template>
  218 +
  219 + <!-- format date -->
  220 + <xsl:template match="date">
  221 + <xsl:variable name="date" select="normalize-space(.)" />
  222 + <!-- output date part -->
  223 + <xsl:value-of select="substring($date,1,10)" />
  224 + <!-- output time part -->
  225 + <xsl:if test="$groupbyday!='yes'">
  226 + <xsl:text>&space;</xsl:text>
  227 + <xsl:value-of select="substring($date,12,5)" />
  228 + </xsl:if>
  229 + </xsl:template>
  230 +
  231 + <!-- format author -->
  232 + <xsl:template match="author">
  233 + <xsl:variable name="uid" select="normalize-space(.)" />
  234 + <!-- try to lookup author in authorsfile -->
  235 + <xsl:choose>
  236 + <xsl:when test="$authorsfile!=''">
  237 + <xsl:for-each select="$authors-top">
  238 + <xsl:variable name="author" select="key('author-lookup',$uid)" />
  239 + <!-- present result -->
  240 + <xsl:choose>
  241 + <xsl:when test="string($author/.)">
  242 + <xsl:apply-templates select="$author/node()" mode="copy" />
  243 + </xsl:when>
  244 + <xsl:otherwise>
  245 + <xsl:value-of select="$uid" />
  246 + </xsl:otherwise>
  247 + </xsl:choose>
  248 + </xsl:for-each>
  249 + </xsl:when>
  250 + <xsl:otherwise>
  251 + <xsl:value-of select="$uid" />
  252 + </xsl:otherwise>
  253 + </xsl:choose>
  254 + </xsl:template>
  255 +
  256 + <!-- copy but normalize text -->
  257 + <xsl:template match="text()" mode="copy">
  258 + <xsl:value-of select="normalize-space(.)" />
  259 + </xsl:template>
  260 +
  261 + <!-- simple copy template -->
  262 + <xsl:template match="@*|node()" mode="copy">
  263 + <xsl:copy>
  264 + <xsl:apply-templates select="@*|node()" mode="copy" />
  265 + </xsl:copy>
  266 + </xsl:template>
  267 +
  268 + <!-- string-wrapping template -->
  269 + <xsl:template name="wrap">
  270 + <xsl:param name="txt" />
  271 + <xsl:variable name="normtxt" select="normalize-space($txt)" />
  272 + <xsl:choose>
  273 + <xsl:when test="contains($txt,'&#xA;')">
  274 + <!-- text contains newlines, do the first line -->
  275 + <xsl:call-template name="wrap">
  276 + <xsl:with-param name="txt" select="substring-before($txt,'&#xA;')" />
  277 + </xsl:call-template>
  278 + <!-- print tab -->
  279 + <xsl:text>&#x9;&space;&space;</xsl:text>
  280 + <!-- wrap the rest of the text -->
  281 + <xsl:call-template name="wrap">
  282 + <xsl:with-param name="txt" select="substring-after($txt,'&#xA;')" />
  283 + </xsl:call-template>
  284 + </xsl:when>
  285 + <xsl:when test="(string-length($normtxt) &lt; (($linelen)-9)) or not(contains($normtxt,' '))">
  286 + <!-- this is easy, nothing to do -->
  287 + <xsl:value-of select="$normtxt" />
  288 + <!-- add newline -->
  289 + <xsl:text>&#xA;</xsl:text>
  290 + </xsl:when>
  291 + <xsl:otherwise>
  292 + <!-- find the first line -->
  293 + <xsl:variable name="tmp" select="substring($normtxt,1,(($linelen)-9))" />
  294 + <xsl:variable name="line">
  295 + <xsl:choose>
  296 + <!-- if our attempt contains spaces wrap on that -->
  297 + <xsl:when test="contains($tmp,' ')">
  298 + <xsl:call-template name="find-line">
  299 + <xsl:with-param name="txt" select="$tmp" />
  300 + </xsl:call-template>
  301 + </xsl:when>
  302 + <!-- otherwise use the first non-space characters from the text -->
  303 + <xsl:otherwise>
  304 + <xsl:value-of select="substring-before($normtxt,' ')" />
  305 + </xsl:otherwise>
  306 + </xsl:choose>
  307 + </xsl:variable>
  308 + <!-- print line -->
  309 + <xsl:value-of select="$line" />
  310 + <!-- print newline and tab -->
  311 + <xsl:text>&#xA;&#x9;&space;&space;</xsl:text>
  312 + <!-- wrap the rest of the text -->
  313 + <xsl:call-template name="wrap">
  314 + <xsl:with-param name="txt" select="normalize-space(substring($normtxt,string-length($line)+1))" />
  315 + </xsl:call-template>
  316 + </xsl:otherwise>
  317 + </xsl:choose>
  318 + </xsl:template>
  319 +
  320 + <!-- template to trim line to contain space as last char -->
  321 + <xsl:template name="find-line">
  322 + <xsl:param name="txt" />
  323 + <xsl:choose>
  324 + <xsl:when test="substring($txt,string-length($txt),1)=' '">
  325 + <xsl:value-of select="substring($txt,1,string-length($txt)-1)" />
  326 + </xsl:when>
  327 + <xsl:otherwise>
  328 + <xsl:call-template name="find-line">
  329 + <xsl:with-param name="txt" select="substring($txt,1,string-length($txt)-1)" />
  330 + </xsl:call-template>
  331 + </xsl:otherwise>
  332 + </xsl:choose>
  333 + </xsl:template>
  334 +
  335 + <!-- template to trim trailing and starting newlines -->
  336 + <xsl:template name="trim-newln">
  337 + <xsl:param name="txt" />
  338 + <xsl:choose>
  339 + <!-- find starting newlines -->
  340 + <xsl:when test="substring($txt,1,1) = '&#xA;'">
  341 + <xsl:call-template name="trim-newln">
  342 + <xsl:with-param name="txt" select="substring($txt,2)" />
  343 + </xsl:call-template>
  344 + </xsl:when>
  345 + <!-- find trailing newlines -->
  346 + <xsl:when test="substring($txt,string-length($txt),1) = '&#xA;'">
  347 + <xsl:call-template name="trim-newln">
  348 + <xsl:with-param name="txt" select="substring($txt,1,string-length($txt)-1)" />
  349 + </xsl:call-template>
  350 + </xsl:when>
  351 + <!-- if the message has paragrapgs, find the first one -->
  352 + <xsl:when test="$reparagraph='yes' and contains($txt,'&#xA;&#xA;')">
  353 + <!-- remove newlines from first paragraph -->
  354 + <xsl:value-of select="normalize-space(substring-before($txt,'&#xA;&#xA;'))" />
  355 + <!-- paragraph separator -->
  356 + <xsl:text>&#xA;&#xA;</xsl:text>
  357 + <!-- do the rest of the text -->
  358 + <xsl:call-template name="trim-newln">
  359 + <xsl:with-param name="txt" select="substring-after($txt,'&#xA;&#xA;')" />
  360 + </xsl:call-template>
  361 + </xsl:when>
  362 + <!-- remove more single newlines -->
  363 + <xsl:when test="$reparagraph='yes'">
  364 + <xsl:value-of select="normalize-space($txt)" />
  365 + </xsl:when>
  366 + <!-- no newlines found, we're done -->
  367 + <xsl:otherwise>
  368 + <xsl:value-of select="$txt" />
  369 + </xsl:otherwise>
  370 + </xsl:choose>
  371 + </xsl:template>
  372 +
  373 + <!-- insert a number of newlines -->
  374 + <xsl:template name="newlines">
  375 + <xsl:param name="count" />
  376 + <xsl:text>&#xA;</xsl:text>
  377 + <xsl:if test="$count&gt;1">
  378 + <xsl:call-template name="newlines">
  379 + <xsl:with-param name="count" select="($count)-1" />
  380 + </xsl:call-template>
  381 + </xsl:if>
  382 + </xsl:template>
  383 +
  384 +</xsl:stylesheet>
updateChangeLog.sh 0 → 100755
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
  1 +#!/bin/bash
  2 +#
  3 +# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  4 +# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  5 +# aplicativos mainframe. Registro no INPI sob o nome G3270.
  6 +#
  7 +# Copyright (C) <2008> <Banco do Brasil S.A.>
  8 +#
  9 +# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  10 +# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  11 +# Free Software Foundation.
  12 +#
  13 +# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  14 +# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  15 +# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  16 +# obter mais detalhes.
  17 +#
  18 +# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  19 +# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
  20 +# Place, Suite 330, Boston, MA, 02111-1307, USA
  21 +#
  22 +# Contatos:
  23 +#
  24 +# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  25 +# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  26 +# licinio@bb.com.br (Licínio Luis Branco)
  27 +# kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  28 +#
  29 +
  30 +REV_TO=${1:-"HEAD"}
  31 +REV_LAST=`cat ChangeLog | head -3 - | tr -d '\r\n' | sed -e 's/.*svn\([0-9]*\).*/\1/'`
  32 +
  33 +echo $PACKAGE_SOURCE
  34 +
  35 +REV_MAX=`svn --xml info | tr -d '\r\n' | sed -e 's/.*<commit.*revision="\([0-9]*\)".*<\/commit>.*/\1/'`
  36 +
  37 +REV_FROM=${2:-$(($REV_LAST + 1))}
  38 +
  39 +if [ $REV_FROM -gt $REV_MAX ]; then
  40 + exit 0;
  41 +fi
  42 +
  43 +echo "Downloading svn-log from revision $REV_FROM to revision $REV_MAX"
  44 +
  45 +svn --verbose --xml log -r "$REV_TO:$REV_FROM" | xsltproc --stringparam strip-prefix "trunk" --stringparam linelen "75" --stringparam groupbyday "no" --stringparam separate-daylogs "no" --stringparam include-rev "yes" --stringparam breakbeforemsg "no" --stringparam reparagraph "no" --stringparam authorsfile "" --stringparam title "ChangeLog" --stringparam revision-link "#r" --stringparam ignore-message-starting "" --nowrite --nomkdir --nonet "ChangeLog.xsl" - > "ChangeLog.new"
  46 +if [ "$?" != "0" ]; then
  47 + exit -1
  48 +fi
  49 +
  50 +cat "ChangeLog" >> "ChangeLog.new"
  51 +
  52 +mv "ChangeLog.new" "ChangeLog"