File: extract

package info (click to toggle)
magnus 20060324-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 19,404 kB
  • ctags: 20,466
  • sloc: cpp: 130,118; ansic: 37,076; tcl: 10,970; perl: 1,109; makefile: 963; sh: 403; yacc: 372; csh: 57; awk: 33; asm: 10
file content (187 lines) | stat: -rwxr-xr-x 4,741 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/usr/bin/perl

## Copyright (C) 1995 The New York Group Theory Cooperative
## See magnus/doc/COPYRIGHT for the full notice.

## Contents: extract
##           This extracts all files necessary to have a bare minimum
##           executable copy of magnus (without compiling) from your
##           working directory.
##
## Principal Author: Roger Needham
##
## Status: in progress
##
## Revision History:
##
## Next implementation steps:
##

# Hard-wired parameters:

$working_parent = "/usr/bormotov";
$working_root = "$working_parent/magnus";
$alpha_root = "$working_parent/admin/alpha";


# Make the destination dir:

@lt = localtime(time);
$mm = substr("0".($lt[4]+1),-2);
$dd = substr("0".$lt[3],-2);
$yy = substr("0".$lt[5],-2);

$dest_name = "magnus"."_".$mm."_".$dd."_".$yy;
$dest_root = "$working_parent/$dest_name";

if ( -e "$dest_root.gz" ) {
  print "\n** $dest_root.gz already exists -- bailing.\n";
  exit 1;
}
if ( -e $dest_root ) {
  print "\n** $dest_root already exists -- bailing.\n";
  exit 1;
}

system "mkdir $dest_root";


# Strip and copy the back end executable:

$be_exec = "back_end/SessionManager/test/bin/magnus";
system "strip $working_root/$be_exec";
&make_path("$dest_root/$be_exec");
system "cp $working_root/$be_exec $dest_root/$be_exec";
system "chmod ug+x $dest_root/$be_exec";

#@db
$tmpdir = "$dest_root/back_end/SessionManager/test/bin/tmp";
system "mkdir $tmpdir";

# Copy the black boxes. They should already be stripped:

$rkbp = "back_end/black_boxes/rkbp/bin/rkbp";
&make_path("$dest_root/$rkbp");
system "cp $working_root/$rkbp $dest_root/$rkbp";
system "chmod ug+x $dest_root/$rkbp";

$kbmag = "back_end/black_boxes/kbmag/bin";
&make_path("$dest_root/$kbmag/foo");
system "cp $working_root/$kbmag/* $dest_root/$kbmag";
system "chmod ug+x $dest_root/$kbmag/*";

$homology = "back_end/black_boxes/homology/bin";
&make_path("$dest_root/$homology/foo");
system "cp $working_root/$homology/* $dest_root/$homology";
system "chmod ug+x $dest_root/$homology/*";

$orwp = "back_end/black_boxes/orwp/orwp";
&make_path("$dest_root/$orwp");
system "cp $working_root/$orwp $dest_root/$orwp";
system "chmod ug+x $dest_root/$orwp";

$tc = "back_end/black_boxes/tc5/tc";
&make_path("$dest_root/$tc");
system "cp $working_root/$tc $dest_root/$tc";
system "chmod ug+x $dest_root/$tc";

$ace = "back_end/black_boxes/ace/ace";
&make_path("$dest_root/$ace");
system "cp $working_root/$ace $dest_root/$ace";
system "cp $working_root/back_end/black_boxes/ace/ace3001.ps \
$dest_root/back_end/black_boxes/ace/";
system "chmod ug+x $dest_root/$ace";

$TietzeTrek = "back_end/black_boxes/TietzeTrek/TietzeTrek";
&make_path("$dest_root/$TietzeTrek");
system "cp $working_root/$TietzeTrek $dest_root/$TietzeTrek";
system "chmod ug+x $dest_root/$TietzeTrek";

# Copy the $TietzeTrek/Resources directory:

system "cp -r $working_root/back_end/black_boxes/TietzeTrek/Resources $dest_root/back_end/black_boxes/TietzeTrek/";


# Copy the entire front directory:

system "cp -r $working_root/front_end $dest_root";


# Remove unneeded stuff in front end:

system "cd $dest_root/front_end; rm -rf magnus dmagnus dummySM RCS to_do *~ help/*~";

# Put release date in magnus.in:

#@rn system "$alpha_root/timestamp $dest_root/front_end/magnus.in";


# @db Create directory for packages

$pdir = "$dest_root/packages";
system "mkdir $pdir";


# Copy ancillary files:

$copying = "doc/COPYING";
&make_path("$dest_root/$copying");
system "cp $working_root/$copying $dest_root/$copying";

$copyright = "doc/COPYRIGHT";
&make_path("$dest_root/$copyright");
system "cp $working_root/$copyright $dest_root/$copyright";


# Put special alpha release README in the root:

system "cp $alpha_root/README $dest_root/README";


# Put special alpha release Configure in the root:

system "cp $working_root/aConfigure $dest_root/Configure";
system "chmod ug+x $dest_root/Configure";


# Tar the release:

system "cd $dest_root/..; tar cf $dest_name.tar $dest_name";
system "rm -rf $dest_root";
$tar_size = -s "$dest_root.tar";
print "tar file is $tar_size bytes\n";


# gzip the release:

system "gzip $dest_root.tar";
system "chgrp magnus $dest_root.tar.gz";
$rel_size = -s "$dest_root.tar.gz";
print "release file is $rel_size bytes\n";


print "\n\nThe alpha release is in $dest_root.tar.gz\n\n";



## Subroutines:

sub make_path {
  local($path_name) = $_[0];
  local($pos, $path);

  # See whether any part of the pathname must be mkdir-ed.
  # Check for files with path a proper prefix of $path_name!

  $pos = 0;
  while( ($pos = index($path_name, "/", $pos + 1)) >= 0 ) {
    $path = substr($path_name, 0, $pos);
    if ( -e $path ) {
      if ( !( -d $path ) ) { return 0; }
    } else {
      system "mkdir $path";
    }
  }
  1;
}