New commit in Git/spar/
[sunny256-utils.git] / create_svn
blob36837ba0b165851ad13db503bfa35902d603ed3c
1 #!/usr/bin/env perl
3 #=======================================================================
4 # create_svn
5 # File ID: 8cc27860-f742-11dd-82e0-000475e441b9
6 # Configures, compiles and installs new groovy Subversion from the
7 # repository at svn.collab.net .
9 # Character set: UTF-8
10 # ©opyleft 2004- Øyvind A. Holm <sunny@sunbase.org>
11 # License: GNU General Public License version 2 or later, see end of
12 # file for legal stuff.
13 #=======================================================================
15 use strict;
16 use warnings;
17 use Getopt::Long;
19 $| = 1;
21 our $Debug = 0;
23 our %Opt = (
25 'debug' => 0,
26 'help' => 0,
27 'verbose' => 0,
28 'version' => 0,
32 die("Unfinished.\n");
34 our $progname = $0;
35 $progname =~ s/^.*\/(.*?)$/$1/;
36 our $VERSION = "0.00";
38 my $svn_base = "$ENV{HOME}/src/other/subversion";
39 my $svn_clean = "$ENV{HOME}/src/other/subversioni/1.1.x.clean";
41 Getopt::Long::Configure("bundling");
42 GetOptions(
44 "debug" => \$Opt{'debug'},
45 "help|h" => \$Opt{'help'},
46 "verbose|v+" => \$Opt{'verbose'},
47 "version" => \$Opt{'version'},
49 ) || die("$progname: Option error. Use -h for help.\n");
51 $Opt{'debug'} && ($Debug = 1);
52 $Opt{'help'} && usage(0);
53 if ($Opt{'version'}) {
54 print_version();
55 exit(0);
58 unless (chdir($svn_clean)) {
59 warn("$svn_clean: Directory not found, installing newest svn-1.x.x .\n");
60 mkpath($svn_base, 1);
61 unless (chdir($svn_base)) {
62 die("chdir($svn_base): $!");
64 my_system("svn co http://svn.collab.net/repos/svn/branches/1.1.x 1.1.x.clean");
67 unless (chdir($svn_clean)) {
68 die("chdir($svn_clean): $!");
71 my_system("svn up");
73 my $Revnum = "";
75 if (open(PipeFP, "svn info|")) {
76 while(<PipeFP>) {
77 # FIXME: Pussyble i18n stuff fucking up grepping here
78 if (/^Revision: (\d+)$/) {
79 $Revnum = $1;
80 last;
83 length($Revnum) || die("$svn_clean: Revision number not found in directory: $!");
86 my $dest_dir = "$svn_base/subversion-1.1.x.r$Revnum";
89 sub ERR {
90 my $Cmd = shift;
91 print("== Running \"$Cmd\"...\n");
92 return($Cmd || die("$Cmd: $!"));
95 sub my_system {
96 my $Cmd = shift;
97 print("==== Executing system(\"$Cmd\")...\n");
98 return(system($Cmd));
101 sub print_version {
102 # Print program version {{{
103 print("$progname v$VERSION\n");
104 # }}}
105 } # print_version()
107 sub usage {
108 # Send the help message to stdout {{{
109 my $Retval = shift;
111 if ($Opt{'verbose'}) {
112 print("\n");
113 print_version();
115 print(<<END);
117 Usage: $progname [options] [file [files [...]]]
119 Options:
121 -h, --help
122 Show this help.
123 -v, --verbose
124 Increase level of verbosity. Can be repeated.
125 --version
126 Print version information.
127 --debug
128 Print debugging messages.
131 exit($Retval);
132 # }}}
133 } # usage()
135 sub msg {
136 # Print a status message to stderr based on verbosity level {{{
137 my ($verbose_level, $Txt) = @_;
139 if ($Opt{'verbose'} >= $verbose_level) {
140 print(STDERR "$progname: $Txt\n");
142 # }}}
143 } # msg()
145 sub D {
146 # Print a debugging message {{{
147 $Debug || return;
148 my @call_info = caller;
149 chomp(my $Txt = shift);
150 my $File = $call_info[1];
151 $File =~ s#\\#/#g;
152 $File =~ s#^.*/(.*?)$#$1#;
153 print(STDERR "$File:$call_info[2] $$ $Txt\n");
154 return("");
155 # }}}
156 } # D()
158 __END__
160 # Plain Old Documentation (POD) {{{
162 =pod
164 =head1 NAME
168 =head1 SYNOPSIS
170 [options] [file [files [...]]]
172 =head1 DESCRIPTION
176 =head1 OPTIONS
178 =over 4
180 =item B<-h>, B<--help>
182 Print a brief help summary.
184 =item B<-v>, B<--verbose>
186 Increase level of verbosity. Can be repeated.
188 =item B<--version>
190 Print version information.
192 =item B<--debug>
194 Print debugging messages.
196 =back
198 =head1 BUGS
202 =head1 AUTHOR
204 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
206 =head1 COPYRIGHT
208 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
209 This is free software; see the file F<COPYING> for legalese stuff.
211 =head1 LICENCE
213 This program is free software: you can redistribute it and/or modify it
214 under the terms of the GNU General Public License as published by the
215 Free Software Foundation, either version 2 of the License, or (at your
216 option) any later version.
218 This program is distributed in the hope that it will be useful, but
219 WITHOUT ANY WARRANTY; without even the implied warranty of
220 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
221 See the GNU General Public License for more details.
223 You should have received a copy of the GNU General Public License along
224 with this program.
225 If not, see L<http://www.gnu.org/licenses/>.
227 =head1 SEE ALSO
229 =cut
231 # }}}
233 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :