Add get_version tool
authorAlexander Wirt <formorer@grml.org>
Sun, 20 May 2007 20:37:17 +0000 (22:37 +0200)
committerAlexander Wirt <formorer@grml.org>
Sun, 20 May 2007 20:37:17 +0000 (22:37 +0200)
Makefile
source-report/grml-64-0.1/grml-64.yaml
tools/get_version [new file with mode: 0644]

index 7179b92..f32020d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,14 +2,15 @@ all: doc_html
 
 doc_html: html-stamp
 
-html-stamp: setup repo-cookbook 
+html-stamp: setup repo-cookbook ml-mmj 
        asciidoc -a toc -a numbered setup
        asciidoc -a toc -a numbered repo-cookbook 
+       asciidoc -a toc -a numbered ml-mmj
        touch html-stamp
 
 clean:
        rm -rf html-stamp setup.html \
-              repo-cookbook.html 
+              repo-cookbook.html ml-mmj.html 
 
 online: doc_html
        scp setup.html grml:/var/www/grml/infrastructure/index.html
index 10aef4b..bc3f492 100644 (file)
@@ -1,4 +1,4 @@
-title: GRML64 rc1
+title: GRML64 0.1
 statusfile: /home/sources/source-report/grml-64-0.1/grep-status.grml64
 sourceslist: /home/sources/source-report/grml-64-0.1/sources.list
 reportdir: /home/sources/reports/grml-64-0.1/
diff --git a/tools/get_version b/tools/get_version
new file mode 100644 (file)
index 0000000..21848da
--- /dev/null
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+get_version - get released upstream versions
+
+=cut
+
+use strict; 
+use warnings; 
+
+use Pod::Usage;
+use LWP::Simple;
+use Compress::Zlib;
+use Getopt::Long; 
+
+=head1 SYNOPSIS
+
+get_version [OPTIONS] <packagenames>
+
+=head1 OPTIONS
+
+=item B<--release>=VERSION
+
+Releaseversion where you are looking for (e.g. 1.0, grml-testing would also
+work).
+
+=back EXAMPLES
+
+  get_version --release 1.0 zsh-lovers
+
+  get_version --release grml-testing grml2hd
+
+=cut
+
+my ($grml_release, $package); 
+
+GetOptions(
+    "release=s" => \$grml_release,
+    "help" => sub { pod2usage(-exitval => 0, -verbose => 2); },
+);
+
+pod2usage("$0: Please provide a releasename.\n") unless $grml_release;
+pod2usage("$0: Need a packagename to process.\n")  unless @ARGV;
+
+if ($grml_release =~ /[0-9]/) {
+    $grml_release = "grml-$grml_release"; 
+}
+
+my $sources_file =
+    get("http://deb.grml.org/dists/$grml_release/main/source/Sources.gz")
+       or die "Could not open Sources.gz: $!"; 
+
+$sources_file = Compress::Zlib::memGunzip($sources_file);
+
+foreach my $package (@ARGV) {
+    my ($found_version,$found); 
+
+    foreach my $line (split("\n", $sources_file)) {
+       if ($line =~ /^Package: $package/) {
+           $found = 1; 
+       }
+       if ($line =~ /^Version: (.*)/ && $found) { 
+           $found_version = $1; 
+           last;
+       }
+    }
+
+    if ($found) {
+       print "$package: $found_version\n";
+    } else {
+       print "$package not found in GRML $grml_release\n"; 
+    }
+}