SVN: people/hawk/ftp_admin/version-comparison.sh
hawk
hawk at pld-linux.org
Wed Feb 20 12:32:31 CET 2008
Author: hawk
Date: Wed Feb 20 12:32:30 2008
New Revision: 9469
Added:
people/hawk/ftp_admin/version-comparison.sh (contents, props changed)
Log:
- simple shell script for generating html pages with list
of packages for which version or release is different
between FTP and CVS
Added: people/hawk/ftp_admin/version-comparison.sh
==============================================================================
--- (empty file)
+++ people/hawk/ftp_admin/version-comparison.sh Wed Feb 20 12:32:30 2008
@@ -0,0 +1,169 @@
+#!/bin/sh
+
+file_header()
+{
+cat > $1 << EOF
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
+ <link rel="StyleSheet" href="styles.css" type="text/css">
+ <title>PLD Titanium Info Page</title>
+</head>
+<body>
+<table width="100%" border="1px" cellpadding="3" cellspacing="0">
+EOF
+}
+
+file_footer()
+{
+cat >> $1 << EOF
+</table>
+</body>
+</html>
+EOF
+}
+
+cd $HOME/scripts/
+
+export CVSROOT=":pserver:cvs at cvs.pld-linux.org:/cvsroot"
+
+if [ "x$1" = "x-t" ]; then
+ VERSION_LOG="$HOME/scripts/version-comparison.html"
+ RELEASE_LOG="$HOME/scripts/release-comparison.html"
+else
+ VERSION_LOG="$HOME/www/version-comparison.html"
+ RELEASE_LOG="$HOME/www/release-comparison.html"
+fi
+rm -f $VERSION_LOG $RELEASE_LOG
+
+
+file_header $VERSION_LOG
+cat >> $VERSION_LOG << EOF
+ <tr>
+ <td colspan=3>PLD Titanium, main tree FTP vs CVS version comparison, $(date +'%d %B %Y, %H:%M')</td>
+ </tr>
+ <tr>
+ <td colspan="3"> </td>
+ </tr>
+ <tr>
+ <td>Package</td>
+ <td>FTP Version</td>
+ <td>CVS Version</td>
+ </tr>
+EOF
+
+file_header $RELEASE_LOG
+cat >> $RELEASE_LOG << EOF
+ <tr>
+ <td colspan=3>PLD Titanium, main tree FTP vs CVS release comparison, $(date +'%d %B %Y, %H:%M')</td>
+ </tr>
+ <tr>
+ <td colspan="3"> </td>
+ </tr>
+ <tr>
+ <td>Package</td>
+ <td>FTP Version</td>
+ <td>CVS Version</td>
+ </tr>
+EOF
+
+for pkg in ~/ftp/PLD/SRPMS/RPMS/*.rpm; do
+ CVS_VERSION_BRANCH=""
+ CVS_RELEASE_BRANCH=""
+ CVS_VERSION_HEAD=""
+ CVS_RELEASE_HEAD=""
+ CVS_VERSION=""
+ CVS_VERSION_2=""
+ CVS_RELEASE=""
+ CVS_REVISION=""
+ SPEC_QUERY=$(rpm -qp --queryformat="%{version} %{release}\n" $pkg 2>/dev/null | head -n 1)
+ SPEC_NAME=$(rpm -qpl $pkg | egrep "\.spec$")
+ FTP_VERSION=$(echo $SPEC_QUERY | awk '{print $1}')
+ FTP_RELEASE=$(echo $SPEC_QUERY | awk '{print $2}')
+ FTP_REVISION=$(rpm -qp --changelog $pkg | egrep "^Revision" | head -n 1 | awk '{print $2}')
+ if test -z "$SPEC_NAME"; then
+ exit
+ fi
+ echo "Processing $SPEC_NAME"
+ rm -f ./SPECS/$SPEC_NAME
+ cvs up -r Titanium ./SPECS/$SPEC_NAME 1>/dev/null 2>&1
+ if test -f ./SPECS/$SPEC_NAME; then
+ SPEC_QUERY=$(rpm --specfile ./SPECS/$SPEC_NAME --define 'prep %dump' -q --queryformat="%{version} %{release}\n" 2>/dev/null | head -n 1)
+ CVS_VERSION_BRANCH=$(echo $SPEC_QUERY | awk '{print $1}')
+ CVS_RELEASE_BRANCH=$(echo $SPEC_QUERY | awk '{print $2}')
+ fi
+ cvs up -A ./SPECS/$SPEC_NAME 1>/dev/null 2>&1
+ if test -f ./SPECS/$SPEC_NAME; then
+ SPEC_QUERY=$(rpm --specfile ./SPECS/$SPEC_NAME --define 'prep %dump' -q --queryformat="%{version} %{release}\n" 2>/dev/null | head -n 1)
+ CVS_VERSION_HEAD=$(echo $SPEC_QUERY | awk '{print $1}')
+ CVS_RELEASE_HEAD=$(echo $SPEC_QUERY | awk '{print $2}')
+ fi
+ if ! test -z "$CVS_VERSION_BRANCH"; then
+ if ! test -z "$CVS_VERSION_HEAD"; then
+ if [ "x$CVS_VERSION_BRANCH" != "x$CVS_VERSION_HEAD" ]; then
+ if ! /usr/bin/rpmvercmp $CVS_VERSION_BRANCH $CVS_VERSION_HEAD | grep -q ">"; then
+ CVS_VERSION="$CVS_VERSION_BRANCH at <a href=\"http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/$SPEC_NAME?only_with_tag=Titanium\">Titanium</a>"
+ CVS_VERSION_2="$CVS_VERSION_HEAD at <a href=\"http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/$SPEC_NAME?only_with_tag=MAIN\">HEAD</a>"
+ CVS_RELEASE="$CVS_RELEASE_BRANCH"
+ else
+ CVS_VERSION_HEAD=""
+ fi
+ else
+ CVS_VERSION="$CVS_VERSION_BRANCH"
+ CVS_RELEASE="$CVS_RELEASE_BRANCH"
+ fi
+ else
+ CVS_VERSION="$CVS_VERSION_BRANCH"
+ CVS_RELEASE="$CVS_RELEASE_BRANCH"
+ fi
+ else
+ CVS_VERSION="$CVS_VERSION_HEAD"
+ CVS_RELEASE="$CVS_RELEASE_HEAD"
+ fi
+ CVS_REVISION=$(head -n 1 ./SPECS/$SPEC_NAME | awk '{print $3}')
+ if echo "$CVS_RELEASE_HEAD" | egrep -q "^[0-9]+\.[0-9]+$"; then
+ CVS_VERSION=""
+ fi
+ if ! test -z "$CVS_VERSION"; then
+ if [ "x$FTP_VERSION" != "x$CVS_VERSION" ]; then
+ if ! grep -q ">$SPEC_NAME<" $VERSION_LOG; then
+cat >> $VERSION_LOG << EOF
+ <tr>
+ <td><a href="http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/$SPEC_NAME">$SPEC_NAME</a></td>
+ <td>$FTP_VERSION</td>
+EOF
+ if test -z "$CVS_VERSION_2"; then
+cat >> $VERSION_LOG << EOF
+ <td>$CVS_VERSION</td>
+EOF
+ else
+cat >> $VERSION_LOG << EOF
+ <td>$CVS_VERSION<br>$CVS_VERSION_2</td>
+ </tr>
+EOF
+ fi
+cat >> $VERSION_LOG << EOF
+ </tr>
+EOF
+ fi
+ else
+ if [ "x$FTP_RELEASE" != "x$CVS_RELEASE" ]; then
+ if ! grep -q ">$SPEC_NAME<" $RELEASE_LOG; then
+cat >> $RELEASE_LOG << EOF
+ <tr>
+ <td><a href="http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/$SPEC_NAME.diff?r1=text&tr1=$FTP_REVISION&r2=text&tr2=$CVS_REVISION">$SPEC_NAME</a></td>
+ <td>$FTP_VERSION-$FTP_RELEASE</td>
+ <td>$CVS_VERSION-$CVS_RELEASE</td>
+ </tr>
+EOF
+ fi
+ fi
+ fi
+ fi
+ rm -f ./SPECS/$SPEC_NAME
+done
+
+file_footer $VERSION_LOG
+file_footer $RELEASE_LOG
+chmod 644 $VERSION_LOG $RELEASE
More information about the pld-cvs-commit
mailing list