root/modules/branches/2.2/publish.pl

Revision 3382, 1.6 kB (checked in by qldrob, 5 years ago)

Fix <version> being incorrectly picked up.

  • Property svn:mime-type set to text/plain
  • Property svn_eol-style set to native
  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1 #!/usr/bin/perl
2
3 $rver = "2.2";
4
5 my $reldir = "release/";
6
7 while ($moddir = shift @ARGV) {
8   next if (!-d $moddir);
9   open FH, "$moddir/module.xml";
10   $newxml = "";
11   $vers = "unset";
12   $rawname = "unset";
13   while (<FH>) {
14     if ($vers == 'unset' && /<version>(.+)<\/version>/) { $vers = $1; }
15     if (/<rawname>(.+)<\/rawname>/) { $rawname = $1; }
16     $newxml .= $_;
17   }
18   close FH;
19   die "Don't know version of $moddir" if ($vers eq "unset");
20   die "Don't know rawname of $moddir" if ($rawname eq "unset");
21   # Automatically check in any files that were modified but weren't checked into SVN
22   chdir($moddir);
23   @arr = <*>;
24   $files = "";
25   while ($x = shift @arr) {
26     # Excluding module.xml which gets checked in later..
27     next if ($x =~ /module.xml/);
28     $files .= "$x ";
29   }
30   system("svn ci -m \"Auto Check-in of any outstanding patches\" $files");
31   chdir("..");
32   # Now we know the version. Create the tar.gz
33   $filename = "$rawname-$vers.tgz";
34   system("tar zcf $filename --exclude .svn $rawname");
35   # Update the md5 info
36   open MD5, "md5sum $filename|";
37   $md5 = <MD5>;
38   close MD5;
39   ($md5sum, $null) = split(/ /, $md5);
40   $newxml =~ s/<md5sum>.+<\/md5sum>/<md5sum>$md5sum<\/md5sum>/;
41   $newxml =~ s/<location>.+<\/location>/<location>$reldir$rver\/$filename<\/location>/;
42   open FH, ">$moddir/module.xml";
43   print FH $newxml;
44   close FH;
45   system("mv $filename ../../release/$rver");
46   system("svn add ../../release/$rver/$filename");
47   system("svn ps svn:mime-type application/tgz ../../release/$rver/$filename");
48   system("svn ci ../../release/$rver/$filename $rawname/module.xml -m \"Module Publish Script: $rawname $vers\"");
49 }
Note: See TracBrowser for help on using the browser.