root/modules/branches/2.3/publish.pl

Revision 11616, 6.8 kB (checked in by p_lindheimer, 2 years ago)

Merged revisions 11615 via svnmerge from
http://www.freepbx.org/v2/svn/modules/branches/2.4

................

r11615 | p_lindheimer | 2011-02-27 15:46:57 -0800 (Sun, 27 Feb 2011) | 37 lines


Merged revisions 11614 via svnmerge from
http://www.freepbx.org/v2/svn/modules/branches/2.5


................

r11614 | p_lindheimer | 2011-02-27 15:45:23 -0800 (Sun, 27 Feb 2011) | 30 lines


Merged revisions 11613 via svnmerge from
http://www.freepbx.org/v2/svn/modules/branches/2.6


................

r11613 | p_lindheimer | 2011-02-27 15:43:56 -0800 (Sun, 27 Feb 2011) | 23 lines


Merged revisions 11612 via svnmerge from
http://www.freepbx.org/v2/svn/modules/branches/2.7


................

r11612 | p_lindheimer | 2011-02-27 15:42:56 -0800 (Sun, 27 Feb 2011) | 16 lines


Merged revisions 11611 via svnmerge from
http://www.freepbx.org/v2/svn/modules/branches/2.8


................

r11611 | p_lindheimer | 2011-02-27 15:41:32 -0800 (Sun, 27 Feb 2011) | 9 lines


Merged revisions 11610 via svnmerge from
http://www.freepbx.org/v2/svn/modules/branches/2.9


........

r11610 | p_lindheimer | 2011-02-27 15:40:01 -0800 (Sun, 27 Feb 2011) | 1 line


don't include any '.' hidden directory/file in the tarball

........

................

................

................

................

................

  • 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 #  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.
6 #
7 system("which md5sum"); # typical linux format
8 if ($? == 0) {
9     $md5_command = 'md5sum';
10 } else {
11   system("which md5"); # OSX format
12   if ($? == 0) {
13     $md5_command = 'md5 -r';
14   } else {
15     die "no md5sum command\n";
16   }
17 }
18
19 $debug = 0;
20 $checkphp = 1;
21 $rver = "2.3";
22 $fwbranch = "branches/2.3";
23 $framework = "framework";
24
25 my $reldir = "release/";
26
27 while ($moddir = shift @ARGV) {
28   next if (!-d $moddir);
29   if ($moddir =~ /$framework/) {
30
31     # 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
32     # 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
33     # 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.
34     #
35     # TODO: ADD FOP until we can get into a module
36     #
37     if (system("rm -rf $framework/agi-bin $framework/bin $framework/htdocs $framework/htdocs_panel $framework/upgrades $framework/libfreepbx.install.php $framework/CHANGES")) {
38       die "FATAL: failed to remove previoulsly exported directories\n";
39     }
40     if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/amp_conf/agi-bin $framework/agi-bin")) {
41       die "FATAL: failed to export agi-bin directory\n";
42     }
43     if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/amp_conf/bin $framework/bin")) {
44       die "FATAL: failed to export bin directory\n";
45     }
46     if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/amp_conf/htdocs $framework/htdocs")) {
47       die "FATAL: failed to export htdocs directory\n";
48     }
49     if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/amp_conf/htdocs_panel $framework/htdocs_panel")) {
50       die "FATAL: failed to export htdocs_panel directory\n";
51     }
52     if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/upgrades $framework/upgrades")) {
53       die "FATAL: failed to export upgrades directory\n";
54     }
55     # svn doesn't seem to allow for a single file to be checked out so we need to do a kludgey workaround
56     # this is what we wanted:
57     #
58     # if (system("svn export http://svn.freepbx.org/freepbx/$fwbranch/libfreepbx.install.php $framework/libfreepbx.install.php"))
59     #
60     if (system("svn co --non-recursive http://svn.freepbx.org/freepbx/$fwbranch $framework/tmp")) {
61       die "FATAL: failed to checkout branch with libfreepbx.install.php\n";
62     }
63     # Create the svnversion information for this framework snapshot
64     #
65     if (system("echo SVN VERSION: `svnversion $framework/tmp` > $framework/svnversion.txt")) {
66       die "FATAL: svnversion failed to create svnversion.txt\n";
67     }
68
69     if (system("mv $framework/tmp/libfreepbx.install.php $framework/")) {
70       die "FATAL: failed to mv libfreepbx.install.php to $framework\n";
71     }
72     if (system("mv $framework/tmp/CHANGES $framework/")) {
73       die "FATAL: failed to mv CHANGES to $framework\n";
74     }
75     if (system("rm -rf $framework/tmp")) {
76       die "FATAL: failed to remove $framework/tmp\n";
77     }
78
79     # 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
80     # ARI file used for editing paramters and options.
81     #
82     if (system("rm -rf $framework/htdocs/recordings/includes/main.conf.php")) {
83       die "FATAL: failed to trim main.conf.php ARI file\n";
84     }
85    
86     # Remove from htdocs root mainstyle.css and index.html as these are owned by root (need to investigate why these are there
87     # and change that. Also some others
88     #
89     # TODO: check if these are stiff there and need to be special cased
90     #
91     if (system("rm -rf $framework/htdocs/mainstyle.css")) {
92       die "FATAL: failed to trim htdocs/mainstyle.css\n";
93     }
94     if (system("rm -rf $framework/htdocs/index.html")) {
95       die "FATAL: failed to trim htdocs/index.html\n";
96     }
97     if (system("rm -rf $framework/htdocs/admin/modules/_cache")) {
98       die "FATAL: failed to trim modules/_cache\n";
99     }
100   }
101
102   open FH, "$moddir/module.xml";
103   $newxml = "";
104   $vers = "unset";
105   $rawname = "unset";
106   while (<FH>) {
107     if ($vers == 'unset' && /<version>(.+)<\/version>/) { $vers = $1; }
108     if (/<rawname>(.+)<\/rawname>/) { $rawname = $1; }
109     $newxml .= $_;
110   }
111   close FH;
112   die "Don't know version of $moddir" if ($vers eq "unset");
113   die "Don't know rawname of $moddir" if ($rawname eq "unset");
114   # Automatically check in any files that were modified but weren't checked into SVN
115   chdir($moddir);
116   @arr = <*>;
117   $files = "";
118   if ($moddir =~ /$framework/) {
119     while ($x = shift @arr) {
120       # Excluding module.xml which gets checked in later..
121       next if ($x =~ /module.xml/);
122       next if ($x =~ /agi-bin/);
123       next if ($x =~ /bin/);
124       next if ($x =~ /htdocs/);
125       next if ($x =~ /htdocs_panel/);
126       next if ($x =~ /upgrades/);
127       next if ($x =~ /libfreepbx.install.php/);
128       next if ($x =~ /svnversion.txt/);
129       $files .= "$x ";
130     }
131   } else {
132     while ($x = shift @arr) {
133       # Excluding module.xml which gets checked in later..
134       next if ($x =~ /module.xml/);
135       $files .= "$x ";
136
137       # Quick and dirty check for php syntax errors at the top level of module directories. Should probably
138       # do this recursively in the future. Also - checks all files now but php -l seems to be ok with that.
139       #
140       if (-f $x && $checkphp) {
141         if (system("php -l $x")) {
142           die "FATAL: php syntax error detected in $x\n";
143         }
144       }
145     }
146   }
147   if ($debug) {
148     print "svn ci -m \"Auto Check-in of any outstanding patches\" $files\n";
149   } else {
150     system("svn ci -m \"Auto Check-in of any outstanding patches\" $files");
151   }
152   chdir("..");
153   # Now we know the version. Create the tar.gz
154   $filename = "$rawname-$vers.tgz";
155   system("tar zcf $filename --exclude '.*' $rawname");
156   # Update the md5 info
157   open MD5, "$md5_command $filename|";
158   $md5 = <MD5>;
159   close MD5;
160   ($md5sum, $null) = split(/ /, $md5);
161   $newxml =~ s/<md5sum>.+<\/md5sum>/<md5sum>$md5sum<\/md5sum>/;
162   $newxml =~ s/<location>.+<\/location>/<location>$reldir$rver\/$filename<\/location>/;
163   open FH, ">$moddir/module.xml";
164   print FH $newxml;
165   close FH;
166   if ($debug) {
167     print "mv $filename ../../release/$rver\n";
168     print "svn add ../../release/$rver/$filename\n";
169     print "svn ps svn:mime-type application/tgz ../../release/$rver/$filename\n";
170     print "svn ci ../../release/$rver/$filename $rawname/module.xml -m \"Module Publish Script: $rawname $vers\"\n";
171   } else {
172     system("mv $filename ../../release/$rver");
173     system("svn add ../../release/$rver/$filename");
174     system("svn ps svn:mime-type application/tgz ../../release/$rver/$filename");
175     system("svn ci ../../release/$rver/$filename $rawname/module.xml -m \"Module Publish Script: $rawname $vers\"");
176   }
177 }
178
Note: See TracBrowser for help on using the browser.