Changeset 5908

Show
Ignore:
Timestamp:
07/04/08 18:36:06 (3 months ago)
Author:
p_lindheimer
Message:

create script to extract log of framework since last publish

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.4/frameworksvn.pl

    r5513 r5908  
    11#!/usr/bin/perl 
    22 
    3 # Developers: Use $debug to keep all svn ci activity from occuring, messages will then be printed. All files will still be created 
    4 #              and module.xml modifications made since these can be reverted. Review carefully if you care concerned that it will 
    5 #              lose work
     3# This script (sculpted from publish.pl) will check the last tarball (which must be there) 
     4# based on the framework xml version number and then run svn log against all updates since 
     5# framework was last published
    66# 
    7 $debug = 0; 
    8 $checkphp = 1; 
    97$rver = "2.4"; 
    10 $fwbranch = "branches/2.4"; 
    118$framework = "framework"; 
    129 
     10$moddir = 'framework'; 
     11 
    1312my $reldir = "release/"; 
    14  
    15 while ($moddir = shift @ARGV) { 
    16         next if (!-d $moddir); 
    17         if ($moddir =~ /$framework/) { 
    18  
    19                 # Framework module is special case. We export and pull in all the files of framework that we are going to want to udpate. For now this is 
    20                 # all files under htdocs, agi-bin and bin. We have not included astetc since such files should be done with core modules. We have also 
    21                 # temporarily chosen not to include FOP since it is likely FOP may be handled by a FOP module going forward. Othewise we will add it here. 
    22                 # 
    23                 # TODO: ADD FOP until we can get into a module 
    24                 # 
    25                 if (system("rm -rf $framework/agi-bin $framework/bin $framework/htdocs $framework/htdocs_panel $framework/upgrades $framework/libfreepbx.install.php $framework/CHANGES")) { 
    26                         die "FATAL: failed to remove previoulsly exported directories\n"; 
    27                 } 
    28                 if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/amp_conf/agi-bin $framework/agi-bin")) { 
    29                         die "FATAL: failed to export agi-bin directory\n"; 
    30                 } 
    31                 if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/amp_conf/bin $framework/bin")) { 
    32                         die "FATAL: failed to export bin directory\n"; 
    33                 } 
    34                 if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/amp_conf/htdocs $framework/htdocs")) { 
    35                         die "FATAL: failed to export htdocs directory\n"; 
    36                 } 
    37                 if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/amp_conf/htdocs_panel $framework/htdocs_panel")) { 
    38                         die "FATAL: failed to export htdocs_panel directory\n"; 
    39                 } 
    40                 if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/upgrades $framework/upgrades")) { 
    41                         die "FATAL: failed to export upgrades directory\n"; 
    42                 } 
    43                 # svn doesn't seem to allow for a single file to be checked out so we need to do a kludgey workaround 
    44                 # this is what we wanted: 
    45                 # 
    46                 # if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/libfreepbx.install.php $framework/libfreepbx.install.php")) 
    47                 # 
    48                 if (system("svn co --non-recursive http://svn.freepbx.org/freepbx/$fwbranch $framework/tmp")) { 
    49                         die "FATAL: failed to checkout branch with libfreepbx.install.php\n"; 
    50                 } 
    51                 # Create the svnversion information for this framework snapshot 
    52                 # 
    53                 if (system("echo SVN VERSION: `svnversion $framework/tmp` > $framework/svnversion.txt")) { 
    54                         die "FATAL: svnversion failed to create svnversion.txt\n"; 
    55                 } 
    56  
    57                 if (system("mv $framework/tmp/libfreepbx.install.php $framework/")) { 
    58                         die "FATAL: failed to mv libfreepbx.install.php to $framework\n"; 
    59                 } 
    60                 if (system("mv $framework/tmp/CHANGES $framework/")) { 
    61                         die "FATAL: failed to mv CHANGES to $framework\n"; 
    62                 } 
    63                 if (system("rm -rf $framework/tmp")) { 
    64                         die "FATAL: failed to remove $framework/tmp\n"; 
    65                 } 
    66  
    67                 # Now we must remove a few files which users may have legitimately edited. For now this is the main.conf.php file which is the current 
    68                 # ARI file used for editing paramters and options. 
    69                 # 
    70                 if (system("rm -rf $framework/htdocs/recordings/includes/main.conf.php")) { 
    71                         die "FATAL: failed to trim main.conf.php ARI file\n"; 
    72                 } 
    73                  
    74                 # Remove from htdocs root mainstyle.css and index.html as these are owned by root (need to investigate why these are there 
    75                 # and change that. Also some others 
    76                 # 
    77                 # TODO: check if these are stiff there and need to be special cased 
    78                 # 
    79                 if (system("rm -rf $framework/htdocs/mainstyle.css")) { 
    80                         die "FATAL: failed to trim htdocs/mainstyle.css\n"; 
    81                 } 
    82                 if (system("rm -rf $framework/htdocs/index.html")) { 
    83                         die "FATAL: failed to trim htdocs/index.html\n"; 
    84                 } 
    85                 if (system("rm -rf $framework/htdocs/admin/modules/_cache")) { 
    86                         die "FATAL: failed to trim modules/_cache\n"; 
    87                 } 
    88         } 
    8913 
    9014        open FH, "$moddir/module.xml";  
    9115        $newxml = ""; 
    9216        $vers = "unset"; 
    93         $rawname = "unset"; 
    9417        while (<FH>) { 
    9518                if ($vers == 'unset' && /<version>(.+)<\/version>/) { $vers = $1; } 
    96                 if (/<rawname>(.+)<\/rawname>/) { $rawname = $1; } 
    9719                $newxml .= $_; 
    9820        } 
    9921        close FH; 
     22 
    10023        die "Don't know version of $moddir" if ($vers eq "unset"); 
    101         die "Don't know rawname of $moddir" if ($rawname eq "unset"); 
    10224        # Automatically check in any files that were modified but weren't checked into SVN 
    103         chdir($moddir); 
    104         @arr = <*>; 
    105         $files = ""; 
    106         if ($moddir =~ /$framework/) { 
    107                 while ($x = shift @arr) { 
    108                         # Excluding module.xml which gets checked in later.. 
    109                         next if ($x =~ /module.xml/); 
    110                         next if ($x =~ /agi-bin/); 
    111                         next if ($x =~ /bin/); 
    112                         next if ($x =~ /htdocs/); 
    113                         next if ($x =~ /htdocs_panel/); 
    114                         next if ($x =~ /upgrades/); 
    115                         next if ($x =~ /libfreepbx.install.php/); 
    116                         next if ($x =~ /svnversion.txt/); 
    117                         $files .= "$x "; 
    118                 } 
    119         } else { 
    120                 while ($x = shift @arr) { 
    121                         # Excluding module.xml which gets checked in later.. 
    122                         next if ($x =~ /module.xml/); 
    123                         $files .= "$x "; 
    12425 
    125                         # Quick and dirty check for php syntax errors at the top level of module directories. Should probably 
    126                         # do this recursively in the future. Also - checks all files now but php -l seems to be ok with that. 
    127                         # 
    128                         if (-f $x && $checkphp) { 
    129                                 if (system("php -l $x")) { 
    130                                         die "FATAL: php syntax error detected in $x\n"; 
    131                                 } 
    132                         } 
    133                 } 
    134         } 
    135         if ($debug) { 
    136                 print "svn ci -m \"Auto Check-in of any outstanding patches\" $files\n"; 
    137         } else { 
    138                 system("svn ci -m \"Auto Check-in of any outstanding patches\" $files"); 
    139         } 
    140         chdir(".."); 
    141         # Now we know the version. Create the tar.gz 
    142         $filename = "$rawname-$vers.tgz"; 
    143         system("tar zcf $filename --exclude .svn $rawname"); 
    144         # Update the md5 info 
    145         open MD5, "md5sum $filename|"; 
    146         $md5 = <MD5>; 
    147         close MD5; 
    148         ($md5sum, $null) = split(/ /, $md5); 
    149         $newxml =~ s/<md5sum>.+<\/md5sum>/<md5sum>$md5sum<\/md5sum>/; 
    150         $newxml =~ s/<location>.+<\/location>/<location>$reldir$rver\/$filename<\/location>/; 
    151         open FH, ">$moddir/module.xml"; 
    152         print FH $newxml; 
    153         close FH; 
    154         if ($debug) { 
    155                 print "mv $filename ../../release/$rver\n"; 
    156                 print "svn add ../../release/$rver/$filename\n"; 
    157                 print "svn ps svn:mime-type application/tgz ../../release/$rver/$filename\n"; 
    158                 print "svn ci ../../release/$rver/$filename $rawname/module.xml -m \"Module Publish Script: $rawname $vers\"\n"; 
    159         } else { 
    160                 system("mv $filename ../../release/$rver"); 
    161                 system("svn add ../../release/$rver/$filename"); 
    162                 system("svn ps svn:mime-type application/tgz ../../release/$rver/$filename"); 
    163                 system("svn ci ../../release/$rver/$filename $rawname/module.xml -m \"Module Publish Script: $rawname $vers\""); 
    164         } 
    165 
     26        # Now we know the version. Get the svnversion.txt from the last update. 
     27        $filename = "../../$reldir"."$rver/$framework-$vers.tgz"; 
     28        print "CHECKING VERSION: ..... "; 
     29        #print "CHECKING VERSION WITH: tar -zxOf $filename $moddir/svnversion.txt: ...  "; 
     30        system("tar -zxOf ".$filename." ".$moddir."/svnversion.txt"); 
     31        print "Geting svn log since that version for $rver : .... \n\n"; 
     32        $svnver = system("svn log http://svn.freepbx.org/freepbx/branches/$rver -r `tar -zxOf ".$filename." ".$moddir."/svnversion.txt | sed -e s/SVN\\\ VERSION://`:HEAD"); 
    16633 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads