gar-2-vcheck (Was: Front-end preview)

Paul Gray <[email protected]> Sun, 12 Feb 2006 09:40:51 -0600
Newsgroups gmane.linux.bbc.devel
Message-ID <[email protected]>
--===============0525303300==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="yLVHuoLXiP9kZBkt"
Content-Disposition: inline


--yLVHuoLXiP9kZBkt
Content-Type: multipart/mixed; boundary="6sX45UoQRIJXqkqR"
Content-Disposition: inline


--6sX45UoQRIJXqkqR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Feb 12, 2006 at 09:28:44AM -0600, Paul Gray wrote:
>=20
> There's a vcheck-based approach that pulls the MASTER_SITES and versions =
=66rom
> the Makefiles and checks availability/latest versions.
>=20
> I'll see if I can resurrect the scripting foo that pulled that together.

Attached is the gar2vcheck script that Bill Immerman put together to do ver=
sion
checking.  It was posted, along with usage descriptions, circal Nov 2003.  =
It
parses the GAR tree and generates a file suitable for vcheck.

--=20
Paul Gray                                         -o)
323 Wright Hall                                   /\\
University of Northern Iowa                      _\_V
Message void if penguin violated ...  Don't mess with the penguin
No one says, "Hey, I can't read that ASCII attachment ya sent me."

--6sX45UoQRIJXqkqR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=gar2vcheck
Content-Transfer-Encoding: quoted-printable

#! /usr/bin/perl -w
# gar2vcheck - traverse gar tree, pick out and parse upstream pkg info
#  and format into vcheck config file for automatic version checking
# usage: cd /foo/bar/.../gar; gar2vcheck ; writes to stdout

use strict;
$|=3D 1;

use File::Find;

find( \&wanted, ".");

sub wanted {
  my ($garname, $garversion, $distfiles, $site);
  # operate only on Makefiles
  if ( $File::Find::name =3D~  /.*\/Makefile$/ ) {
    open(MAKEFILE, "<$_") or die "Error opening Makefile for read $_\n";
    while(<MAKEFILE>) {
      $garname=3D $1    if /^\s*GARNAME\s*=3D\s*(.*)\s*$/;
      $garversion=3D $1 if /^\s*GARVERSION\s*=3D\s*(.*)\s*$/;
      $site=3D $1       if /^\s*MASTER_SITES\s*=3D\s*(.*)\s*$/;
      $distfiles=3D $1  if /^\s*DISTFILES\s*=3D\s*(.*)\s*$/;
    }
    print_prog_section($garname, $garversion, $site, $distfiles) if=20
      ($garname && $site && $distfiles);
    close(MAKEFILE);
  }
}

sub normalize {
  my $str=3D shift;

  $str=3D $str || "";

  # just use the first word for now (e.g., first url in list)=20
  $str=3D (split(/\s+/, $str))[0];
 =20
  $str =3D~ s/\$\(DISTNAME\)/\$(GARNAME)-\$(GARVERSION)/g;
  $str =3D~ s/(^\s*|\s*$)//g;

  return $str;
}

sub print_prog_section {
  my ($name, $ver, $url, $files)=3D @_;
  $name=3D normalize($name);
  $ver=3D normalize($ver);
  $url=3D normalize($url);
  my $regex=3D normalize($files);

  $url =3D~ s/\$\(GARNAME\)/$name/g;
  $regex =3D~ s/\$\(GARNAME\)/$name/g;

  $url =3D~ s/\$\(GARVERSION\)/(__RAWVER__)/g;
  $regex =3D~ s/\$\(GARVERSION\)/(__VER__)/g;

  # hack to handle cloop case
  $regex =3D~ s/\$\(GAR_SUBVERSION\)//g;

  $regex =3D~ s/\./\\./g;

  print "prog $name =3D {\n";
  print "  version   =3D $ver\n";
  print "  dlversion =3D $ver\n";
  print "  url       =3D $url\n";
  print "  regex     =3D $regex\n";
  print "}\n";
}

--6sX45UoQRIJXqkqR--

--yLVHuoLXiP9kZBkt
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD71cDOH45TZW7mh4RAgJZAJ974gb0C5T0mHS/1eVySMh0dkyd4gCgj9m2
qywCKjh5PJcXGlEUR4hSgOY=
=jxqc
-----END PGP SIGNATURE-----

--yLVHuoLXiP9kZBkt--


--===============0525303300==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Lnx-bbc-devel mailing list
[email protected]
http://zork.net/mailman/listinfo/lnx-bbc-devel

--===============0525303300==--