summary refs log tree commit diff
path: root/pkgs/desktops/gnome/make-listing.pl
blob: 3fc6d3fee6675bff84e225cac619bb333a378e06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /usr/bin/perl -w

use strict;

# Example use:
# ./make-listing.sh \
#   http://ftp.gnome.org/pub/GNOME/platform/2.10/2.10.1/sources/ \
#   http://ftp.gnome.org/pub/GNOME/platform/2.10/2.10.1/sources/MD5SUMS-for-bz2

my $baseURL = shift;
my $md5URL = shift;

print <<EOF
# Note: this file was generated automatically by make-listing.sh!

{fetchurl} : {
EOF
    ;
    
open FOO, "curl '$md5URL' |" or die;

while (<FOO>) {
    chomp;
    /^(\S+)\s+(\S+)$/ or die;
    my $md5 = $1;
    my $fileName = $2;
    my $name = $fileName;
    $name =~ s/\.tar.*$//;
    my $attrName = $name;
    $attrName =~ s/\-[0-9].*$//;
    $attrName =~ s/\-//g;
    $attrName =~ s/\+//g;
    print <<EOF
  $attrName = {
    name = "$name";
    src = fetchurl {
      url = $baseURL$fileName;
      md5 = "$md5";
    };
  };
EOF
    ;
    
}

close FOO;

print "}\n";