[164] | 1 | #! /usr/bin/perl
|
---|
| 2 | #
|
---|
| 3 | # TOPPERS Software
|
---|
| 4 | # Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
| 5 | #
|
---|
| 6 | # Copyright (C) 2006-2011 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 2253 2011-09-11 01:23:40Z ertl-hiro $
|
---|
| 43 | #
|
---|
| 44 |
|
---|
| 45 | require 'getcwd.pl';
|
---|
| 46 |
|
---|
| 47 | $cwd = getcwd();
|
---|
| 48 | $cwd =~ s/^.*[\/\\]([^\/\\]+)$/$1/;
|
---|
| 49 | $prefix = "./".$cwd;
|
---|
| 50 |
|
---|
| 51 | @file_list = ();
|
---|
| 52 | %file_list = ();
|
---|
| 53 |
|
---|
| 54 | if ($#ARGV >= 0) {
|
---|
| 55 | $arg1 = $ARGV[0];
|
---|
| 56 | $arg1 =~ s/\.\///;
|
---|
| 57 | }
|
---|
| 58 | else {
|
---|
| 59 | $arg1 = "MANIFEST";
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | sub gen_path
|
---|
| 63 | {
|
---|
| 64 | local($base, $path) = @_;
|
---|
| 65 |
|
---|
| 66 | while ($path =~ /^..\/(.*)$/) {
|
---|
| 67 | $path = $1;
|
---|
| 68 | $base =~ s/(\/?)[^\/]*\/$/$1/;
|
---|
| 69 | }
|
---|
| 70 | return($base.$path);
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | sub read_file {
|
---|
| 74 | local($filename) = @_;
|
---|
| 75 | local($fh, $dirname);
|
---|
| 76 |
|
---|
| 77 | if ($filename =~ /^(.*\/)[^\/]*$/) {
|
---|
| 78 | $dirname = $1;
|
---|
| 79 | }
|
---|
| 80 | else {
|
---|
| 81 | $dirname = "";
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | open($fh, $filename) || die "Cannot open $filename";
|
---|
| 85 | while ($line = <$fh>) {
|
---|
| 86 | chomp $line;
|
---|
| 87 | $line =~ s/\r$//;
|
---|
| 88 | $line =~ s/[ \t]*\#.*$//;
|
---|
| 89 | next if ($line =~ /^[ \t]*$/);
|
---|
| 90 |
|
---|
| 91 | if ($line =~ /^E_PACKAGE[ \t]+(.*)$/) {
|
---|
| 92 | if ($package) {
|
---|
| 93 | die "Duplicated E_PACKAGE directive.";
|
---|
| 94 | }
|
---|
| 95 | else {
|
---|
| 96 | $package = $1;
|
---|
| 97 | $e_package = 1;
|
---|
| 98 | }
|
---|
| 99 | }
|
---|
| 100 | elsif ($line =~ /^PACKAGE[ \t]+(.*)$/) {
|
---|
| 101 | if ($package) {
|
---|
| 102 | if (!$e_package && $package != $1) {
|
---|
| 103 | die "Inconsistent PACKAGE directive.";
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 | else {
|
---|
| 107 | $package = $1;
|
---|
| 108 | }
|
---|
| 109 | }
|
---|
| 110 | elsif ($line =~ /^VERSION[ \t]+(.*)$/) {
|
---|
| 111 | if ($version) {
|
---|
| 112 | if (!$e_package && $version != $1) {
|
---|
| 113 | die "Inconsistent VERSION directive.";
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
| 116 | else {
|
---|
| 117 | $version = $1;
|
---|
| 118 | if ($version =~ /%date/) {
|
---|
| 119 | @current_time = localtime();
|
---|
| 120 | $vdate = sprintf("%04d%02d%02d", $current_time[5]+1900,
|
---|
| 121 | $current_time[4]+1, $current_time[3]);
|
---|
| 122 | $version =~ s/%date/$vdate/;
|
---|
| 123 | }
|
---|
| 124 | }
|
---|
| 125 | }
|
---|
| 126 | elsif ($line =~ /^INCLUDE[ \t]+(.*)$/) {
|
---|
| 127 | read_file(gen_path($dirname, $1));
|
---|
| 128 | }
|
---|
| 129 | else {
|
---|
| 130 | $filename = $prefix."/".$dirname.$line;
|
---|
| 131 | while ($filename =~ s|/[^/]+/\.\./|/|) {}
|
---|
| 132 | if ($file_list{$filename}) {
|
---|
| 133 | die "$filename is duplicated.";
|
---|
| 134 | }
|
---|
| 135 | else {
|
---|
| 136 | push(@file_list, $filename);
|
---|
| 137 | $file_list{$filename} = $filename;
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
| 140 | }
|
---|
| 141 | close($fh);
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | read_file($arg1);
|
---|
| 145 | unless ($package) {
|
---|
| 146 | die "PACKAGE/E_PACKAGE directive not found.";
|
---|
| 147 | }
|
---|
| 148 | unless ($version) {
|
---|
| 149 | die "VERSION directive not found.";
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | if (! -d "RELEASE") {
|
---|
| 153 | mkdir("RELEASE");
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | $archive_name = $package."-".$version.".tar.gz";
|
---|
| 157 | $file_list = join(" ", @file_list);
|
---|
| 158 | $command = "tar cvfz RELEASE/$archive_name -C .. $file_list\n";
|
---|
| 159 | die if (system($command));
|
---|
| 160 | print STDERR "== RELEASE/$archive_name is generated. ==\n";
|
---|