Merge branch 'master' of ssh://kebab.indexdata.dk:222/home/git/pub/git-tools
authorWolfram Schneider <wosch@indexdata.dk>
Fri, 16 Nov 2012 10:35:19 +0000 (10:35 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Fri, 16 Nov 2012 10:35:19 +0000 (10:35 +0000)
aptcheck/aptcheck.pl
id-deb-build/id-pbuild.sh
id-rpm-build/upload-rpms.sh
update-archive/update-yum-archive.sh

index 3866de9..2dac01a 100755 (executable)
@@ -19,6 +19,8 @@
 # 11-Mar-2011 Heikki: Started this
 # 22-Mar-2011 Heikki: Adding manually maintained packages
 # 15-Aug-2011 Heikki: Adding a total in the headline, for nagiosgrapher
+# 21-May-2012 Heikki: Added a date since when a package has been pending
+# 31-May-2012 Heikki: Pointing to the new wiki
 #
 # TODO: Assumes that we release our restricted packages for all versions
 # and architectures at the same time. Gets only the highest version from
@@ -32,7 +34,8 @@
 use strict;
 my $debug= $ARGV[0] || 0; # 0=none, 1=some, 2=more, 3=much
 my $year =`date +%Y`;
-my $wikilink = 'http://twiki.indexdata.dk/cgi-bin/twiki/view/ID/';
+#my $wikilink = 'http://twiki.indexdata.dk/cgi-bin/twiki/view/ID/';
+my $wikilink = 'https://twiki.indexdata.com/twiki/bin/view/ID/';
 my $restrictedpackages = "ssh -q kebab cat /home/ftp/pub/debian/dists/*/restricted/*/Packages";
 
 #### Host comments
@@ -76,7 +79,7 @@ for my $pline ( split("\n",$restplines) ) {
             print "found $pname, first version $pver\n" if $debug>1;
         } else {
             my $bver = $restrpkgs{$pname};
-            `dpkg --compare-versions "$bver" lt "$pver" `;
+            `dpkg --compare-versions "$bver" lt "$pver" 2>/dev/null `;
             if ( ! $? ) {
                 print "found $pname, better version $pver (better than $bver)\n"
                     if $debug>1;
@@ -112,6 +115,7 @@ my $owntot = 0;
 my $mantot = 0;
 my $normtot = 0;
 my %updlinks;
+my %debversions;
 
 # Pending modification dates
 my %olddates;  # Read in from the file
@@ -146,11 +150,12 @@ for my $hline ( split("\n",$hostlist) ) {
     next if ($H =~ /^servicegroups/ );
     print "Checking $H\n" if $debug;
     $allhosts{$H}=1;
+    my $cmd0 = "cat /etc/debian_version";
     my $cmd1 = "apt-cache -q policy " . join(" ",sort(keys(%restrpkgs)));
     my $cmd2 = "apt-get upgrade -s -o 'Debug::NoLocking=true' ";
     # Note, do not append -qq, we want some output even when nothing to do
-    print "ssh -q $H \"$cmd1 ; $cmd2 \" 2>/dev/null" if ($debug>1);
-    my $apt = `ssh -q $H "$cmd1 ; $cmd2 " 2>/dev/null`;
+    print "ssh -q $H \"$cmd0; $cmd1 ; $cmd2 \" 2>/dev/null \n" if ($debug>1);
+    my $apt = `ssh -q $H "$cmd0; $cmd1 ; $cmd2 " 2>/dev/null`;
     if ( !$apt ) {
         $table .= "<tr><td colspan='3'>&nbsp;</td></tr>\n";
         $table .= "<tr><td colspan='3'><b><u>$H</u></b> (skipped)\n";
@@ -166,7 +171,18 @@ for my $hline ( split("\n",$hostlist) ) {
     my $restrname = "";
     my $restrinst = "";
     my $restrcand = "";
+    my $debver = 0;
     for my $p ( split("\n",$apt) ) {
+        if ( !$debver ) {  # first line
+          $debver = 1;
+          $p =~ s/(5[0-9.]+)/$1 LENNY !!!/;
+          $p =~ s/(6[0-9.]+)/$1 squeeze/;
+          $p =~ s/(7[0-9.]+)/$1 wheezy/;
+          $p = "&nbsp;Debian $p";
+          $debversions{$H} = $p;
+          print "Deb version for $H is $p\n" if ($debug>1);
+          next;
+        }
         # parse apt-cache output
         $restrname = $1 if $p =~ /^(\S+):$/;
         $restrinst = $1 if $p =~ /^\s+Installed:\s+(\S+)$/;
@@ -177,7 +193,7 @@ for my $hline ( split("\n",$hostlist) ) {
                  ( $restrinst ne $bver ) ) { 
                 # if different, it is a regular apt upgrade, and will be seen
                 # later. AND we want to have a different version in our repo
-                `dpkg --compare-versions "$bver" lt "$restrinst" `;
+                `dpkg --compare-versions "$bver" lt "$restrinst"  2>/dev/null`;
                 if ( $? ) { # It was not a downgrade 
                             # manual packages may be ahead of the repo!
                     $mantot++;
@@ -252,8 +268,8 @@ for my $hline ( split("\n",$hostlist) ) {
         $det .= "</tr>\n";
 
     }
-    $table .= "<tr><td colspan='3'>&nbsp;</td></tr>\n";
-    $table .= "<tr><td colspan='3'><a name='$H'><b><u>$H</u></b></a> &nbsp;\n";
+    $table .= "<tr><td colspan='4'>&nbsp;</td></tr>\n";
+    $table .= "<tr><td colspan='4'><a name='$H'><b><u>$H</u></b></a> &nbsp;\n";
     if ( $pkgs ) {
         $table .= "<b>$pkgs</b> packages to upgrade. ";
         $table .= "<b>$secs security</b>. " if $secs;
@@ -270,6 +286,7 @@ for my $hline ( split("\n",$hostlist) ) {
     $updlink =~ s/Opencontent-solrUpdates/OpenContentSolrUpdates/; 
     $updlinks{$H} = $updlink;
     $table .= "&nbsp;<a href='$updlink' >Upd</a>";
+    $table .= "&nbsp;" . $debversions{$H};
     $table .= "</td></tr>\n";
     $table .= "<tr><td>$hostcomments{$H}</td></tr>\n"
         if ( $hostcomments{$H} );
@@ -282,7 +299,7 @@ $table .= "</table>\n";
 # Save the date file
 `mv -f $datefilename $dateoldfilename`;
 open F, ">$datefilename" or die "Could not open date file $datefilename for writing";
-for  my $k (keys(%newdates) ) {
+for  my $k (sort(keys(%newdates)) ) {
     print F "$k " . $newdates{$k}. "\n";
     print "date for '$k' '" . $newdates{$k}. "'\n" if $debug;
 }
index 51cb8e0..004f892 100755 (executable)
@@ -161,7 +161,7 @@ if $upload; then
     echo "cd ~/proj/git-tools/update-archive"
     echo "sudo su"
     echo "./update-archive.sh"
-    if test ${CENTOS_DIST}; then
+    if test "${CENTOS_DIST}"; then
        echo "./update-yum-archive.sh"
     fi
     echo "===================================================="
index ee83ce9..bc4e6c7 100755 (executable)
@@ -1,9 +1,9 @@
+#!/bin/sh
 PWD=`pwd`
 UPLOAD_PATH=${UPLOAD_PATH:=/home/ftp/pub}
 UPLOAD_HOST=${UPLOAD_HOST:=ftp.indexdata.dk}
-DISTRO=${DISTRO:="centos/5.5"}
 specfile=$1
-if test ! -f ${specfile}; then
+if test ! -f "${specfile}"; then
        echo "Missing .spec file argument."
        exit 1
 fi
@@ -11,9 +11,20 @@ if test ! -x /bin/rpm; then
         echo "$0: /bin/rpm missing. Install rpm"
         exit 1
 fi
+if test ! -f /etc/redhat-release; then
+       echo "/etc/redhat-release missing"
+       exit 1
+fi
+if test -z "$DISTRO"; then
+       if grep 'release 6' /etc/redhat-release >/dev/null; then
+               DISTRO="centos/6"
+       else
+               DISTRO="centos/5.5"
+       fi
+fi
 topdir=`rpm --eval "%{_topdir}"`
 BUILD_DIR=${BUILD_DIR:=${topdir}}
-pkg_names=`rpm -q --specfile ${specfile}`
+pkg_names=`rpm -q --specfile ${specfile} --queryformat "%{NAME}-%{VERSION}-%{RELEASE}\n"`
 pkg_short=`rpm -q --specfile ${specfile} --queryformat "%{NAME};" | cut -d ";" -f1`
 
 UPLOAD_DIR=${UPLOAD_DIR:=${pkg_short}}
index 482fc09..1e3f633 100755 (executable)
@@ -31,7 +31,7 @@ signage=8000
 confdir=`pwd`
 architectures="i386 x86_64"
 dirs_to_upd=""
-for vdist in centos/5.5 rhel/5.5; do
+for vdist in centos/5.5 rhel/5.5 centos/6; do
   dist=`basename $vdist`
   vendor=`dirname $vdist`
   ftpdir=/home/ftp/pub/yum/$vendor/$dist