root/contributed_modules/modules/publish.pl

Revision 5054, 1.9 kB (checked in by p_lindheimer, 6 years ago)

ok fixed publish.pl script

  • 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 $debug = 0;
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   if ($debug) {
31     print "svn ci -m \"Auto Check-in of any outstanding patches\" $files\n";
32   } else {
33     system("svn ci -m \"Auto Check-in of any outstanding patches\" $files");
34   }
35   chdir("..");
36   # Now we know the version. Create the tar.gz
37   $filename = "$rawname-$vers.tgz";
38   system("tar zcf $filename --exclude .svn $rawname");
39   # Update the md5 info
40   open MD5, "md5sum $filename|";
41   $md5 = <MD5>;
42   close MD5;
43   ($md5sum, $null) = split(/ /, $md5);
44   $newxml =~ s/<md5sum>.+<\/md5sum>/<md5sum>$md5sum<\/md5sum>/;
45   $newxml =~ s/<location>.+<\/location>/<location>$reldir\/$filename<\/location>/;
46   open FH, ">$moddir/module.xml";
47   print FH $newxml;
48   close FH;
49   if ($debug) {
50     print "mv $filename ../release/\n";
51     print "svn add ../release/$filename\n";
52     print "svn ps svn:mime-type application/tgz ../release/$filename\n";
53     print "svn ci ../release/$filename $rawname/module.xml -m \"Module Publish Script: $rawname $vers\"\n";
54   } else {
55     system("mv $filename ../release/");
56     system("svn add ../release/$filename");
57     system("svn ps svn:mime-type application/tgz ../release/$filename");
58     system("svn ci ../release/$filename $rawname/module.xml -m \"Module Publish Script: $rawname $vers\"");
59   }
60 }
61
Note: See TracBrowser for help on using the browser.