1 | #! /usr/bin/perl
|
---|
2 | #
|
---|
3 | # TOPPERS Software
|
---|
4 | # Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
5 | #
|
---|
6 | # Copyright (C) 2006-2010 by Embedded and Real-Time Systems Laboratory
|
---|
7 | # Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
8 | #
|
---|
9 | # ãLì ÒÍCȺÌ(1)`(4)Ìðð½·êÉÀèC{\tgEF
|
---|
10 | # Ai{\tgEFAðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»Eü
|
---|
11 | # ÏEÄzziȺCpÆÄÔj·é±Æð³Åø·éD
|
---|
12 | # (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
13 | # \¦C±Ìpð¨æÑºLÌ³ÛØKèªC»ÌÜÜÌ`Å\[
|
---|
14 | # XR[hÉÜÜêĢ鱯D
|
---|
15 | # (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉg
|
---|
16 | # pÅ«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
17 | gip
|
---|
18 | # Ò}j
|
---|
19 | AÈÇjÉCãLÌì \¦C±Ìpð¨æÑºL
|
---|
20 | # Ì³ÛØKèðfÚ·é±ÆD
|
---|
21 | # (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉg
|
---|
22 | # pūȢ`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±
|
---|
23 | # ÆD
|
---|
24 | # (a) Äzzɺ¤hL
|
---|
25 | gipÒ}j
|
---|
26 | AÈÇjÉCãLÌ
|
---|
27 | # ì \¦C±Ìpð¨æÑºLÌ³ÛØKèðfÚ·é±ÆD
|
---|
28 | # (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉ
|
---|
29 | # ñ·é±ÆD
|
---|
30 | # (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹
|
---|
31 | # Q©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
32 | # ܽC{\tgEFAÌ[UܽÍGh[U©çÌ¢©Èé
|
---|
33 | # RÉîÿ©çàCãLì Ò¨æÑTOPPERSvWFNgð
|
---|
34 | # ÆÓ·é±ÆD
|
---|
35 | #
|
---|
36 | # {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨
|
---|
37 | # æÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄCÁèÌgpÚI
|
---|
38 | # ÉηéK«àÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEF
|
---|
39 | # AÌpÉæè¼ÚIܽÍÔÚIɶ¶½¢©Èé¹QÉÖµÄàC»
|
---|
40 | # ÌÓCðíÈ¢D
|
---|
41 | #
|
---|
42 | # @(#) $Id: makerelease 1866 2010-07-25 13:19:17Z ertl-hiro $
|
---|
43 | #
|
---|
44 |
|
---|
45 | use Cwd;
|
---|
46 |
|
---|
47 |
|
---|
48 | $cwd = getcwd();
|
---|
49 | $cwd =~ s/^.*[\/\\]([^\/\\]+)$/$1/;
|
---|
50 | $prefix = "./".$cwd;
|
---|
51 |
|
---|
52 | @file_list = ();
|
---|
53 | %file_list = ();
|
---|
54 |
|
---|
55 | if ($#ARGV >= 0) {
|
---|
56 | $arg1 = $ARGV[0];
|
---|
57 | $arg1 =~ s/\.\///;
|
---|
58 | }
|
---|
59 | else {
|
---|
60 | $arg1 = "MANIFEST";
|
---|
61 | }
|
---|
62 |
|
---|
63 | sub gen_path
|
---|
64 | {
|
---|
65 | local($base, $path) = @_;
|
---|
66 |
|
---|
67 | while ($path =~ /^..\/(.*)$/) {
|
---|
68 | $path = $1;
|
---|
69 | $base =~ s/(\/?)[^\/]*\/$/$1/;
|
---|
70 | }
|
---|
71 | return($base.$path);
|
---|
72 | }
|
---|
73 |
|
---|
74 | sub read_file {
|
---|
75 | local($filename) = @_;
|
---|
76 | local($fh, $dirname);
|
---|
77 |
|
---|
78 | if ($filename =~ /^(.*\/)[^\/]*$/) {
|
---|
79 | $dirname = $1;
|
---|
80 | }
|
---|
81 | else {
|
---|
82 | $dirname = "";
|
---|
83 | }
|
---|
84 |
|
---|
85 | open($fh, $filename) || die "Cannot open $filename";
|
---|
86 | while ($line = <$fh>) {
|
---|
87 | chomp $line;
|
---|
88 | $line =~ s/\r$//;
|
---|
89 | $line =~ s/[ \t]*\#.*$//;
|
---|
90 | next if ($line =~ /^[ \t]*$/);
|
---|
91 |
|
---|
92 | if ($line =~ /^E_PACKAGE[ \t]+(.*)$/) {
|
---|
93 | if ($package) {
|
---|
94 | die "Duplicated E_PACKAGE directive.";
|
---|
95 | }
|
---|
96 | else {
|
---|
97 | $package = $1;
|
---|
98 | $e_package = 1;
|
---|
99 | }
|
---|
100 | }
|
---|
101 | elsif ($line =~ /^PACKAGE[ \t]+(.*)$/) {
|
---|
102 | if ($package) {
|
---|
103 | if (!$e_package && $package != $1) {
|
---|
104 | die "Inconsistent PACKAGE directive.";
|
---|
105 | }
|
---|
106 | }
|
---|
107 | else {
|
---|
108 | $package = $1;
|
---|
109 | }
|
---|
110 | }
|
---|
111 | elsif ($line =~ /^VERSION[ \t]+(.*)$/) {
|
---|
112 | if ($version) {
|
---|
113 | if (!$e_package && $version != $1) {
|
---|
114 | die "Inconsistent VERSION directive.";
|
---|
115 | }
|
---|
116 | }
|
---|
117 | else {
|
---|
118 | $version = $1;
|
---|
119 | if ($version =~ /%date/) {
|
---|
120 | @current_time = localtime();
|
---|
121 | $vdate = sprintf("%04d%02d%02d", $current_time[5]+1900,
|
---|
122 | $current_time[4]+1, $current_time[3]);
|
---|
123 | $version =~ s/%date/$vdate/;
|
---|
124 | }
|
---|
125 | }
|
---|
126 | }
|
---|
127 | elsif ($line =~ /^INCLUDE[ \t]+(.*)$/) {
|
---|
128 | read_file(gen_path($dirname, $1));
|
---|
129 | }
|
---|
130 | else {
|
---|
131 | $filename = $prefix."/".$dirname.$line;
|
---|
132 | while ($filename =~ s|/[^/]+/\.\./|/|) {}
|
---|
133 | if ($file_list{$filename}) {
|
---|
134 | die "$filename is duplicated.";
|
---|
135 | }
|
---|
136 | else {
|
---|
137 | push(@file_list, $filename);
|
---|
138 | $file_list{$filename} = $filename;
|
---|
139 | }
|
---|
140 | }
|
---|
141 | }
|
---|
142 | close($fh);
|
---|
143 | }
|
---|
144 |
|
---|
145 | read_file($arg1);
|
---|
146 | unless ($package) {
|
---|
147 | die "PACKAGE/E_PACKAGE directive not found.";
|
---|
148 | }
|
---|
149 | unless ($version) {
|
---|
150 | die "VERSION directive not found.";
|
---|
151 | }
|
---|
152 |
|
---|
153 | if (! -d "RELEASE") {
|
---|
154 | mkdir("RELEASE");
|
---|
155 | }
|
---|
156 |
|
---|
157 | $archive_name = $package."-".$version.".tar.gz";
|
---|
158 | $file_list = join(" ", @file_list);
|
---|
159 | $command = "tar cvfz RELEASE/$archive_name -C .. $file_list\n";
|
---|
160 | die if (system($command));
|
---|
161 | print STDERR "== RELEASE/$archive_name is generated. ==\n";
|
---|