User:John64/Hacky Scrtipts

From CDOT Wiki
< User:John64
Revision as of 13:22, 19 October 2008 by John64 (talk | contribs) (Dependency Generation)
Jump to: navigation, search

Here are my hacky scripts. They aren't great they may not even be useful to you.

Create JBossAS tarball

This script checks out JBoss from the subversion. It is broken right now, as it doesn't copy the tarball back to the initial pwd.

#!/bin/sh
# Check out JBoss sources from their subversion server. 
# This script creates a temporary directory, checks the
# code out then tars it and moves the tarball to where 
# the script was invoked.

# Store where the result should end up
TARGETDIR=`pwd`

# This is the version tag for releases
SVNVERSION="5_0_0_CR2"
# This is the version to use for the folder and archive
# name
PLAINVERSION="5.0.0"
# This is the command to make the temporary directory
TEMPDIR=`mktemp -d`

## Check out source
cd ${TEMPDIR}
svn export http://anonsvn.jboss.org/repos/jbossas/tags/JBoss_${SVNVERSION} --quiet
mv JBoss_${SVNVERSION} jboss-${PLAINVERSION}
tar jcf jboss-${PLAINVERSION}.tar.bz2 jboss-${PLAINVERSION}
cp jboss-${PLAINVERSION}.tar.bz2 ${TARGETDIR}
rm -rf ${TEMPDIR}

Dependency Generation

This perl script reads the output of find .m2/repository -name "*.jar" through standard input and formats it into a general HTML table. It is not complete and it is not accurate. This was used as a first pass so i didn't have to write the table from scratch

#!/usr/bin/perl
use strict;
use warnings;

print "<html>\n<body>\n<table>\n";
print "  <thead>\n";
print "    <td>Provider</td>\n";
print "    <td>Package</td>\n";
print "    <td>Version</td>\n";
print "    <td>Source</td>\n";
print "    <td>In Fedora</td>\n";
print "  </thead>\n";

while( <STDIN> ) {
  #do something with $_
  #$_;
  if(not $_ =~ m/-sources.jar$/){
    $_ =~ /^[.](.*[\/])(.*?)-(.*?)[.]jar$/;
    if(defined($1) && defined($2) && defined($3)){
      my $provider = $1;
      my $package = $2;
      my $version = $3;
      $provider =~ s/^\///;
      $provider =~ s/\/$//;
      #$provider =~ s/\/[\w\_\-.]\/[\w\_\-.]$/*/;
      $provider =~ s/[\/]/\./g;
      $provider =~ s/^\.//;
      print "  <tr>\n";
      print "    <td>$provider</td>\n";
      print "    <td>$package</td>\n";
      print "    <td>$version</td>\n";
      print "    <td>???</td>\n";
      print "    <td>???</td>\n";
      print "  </tr>\n\n"
    } else {
      print "*Check this line: $_";
    }
  }
}

print "</table>\n</body>\n</html>";