diff --git a/etc/Makefile b/etc/Makefile index 6bff501955127c3bfda9bafe97edc6c34a144eac..f0e55f84aa4d37d28f6430c88cd7025b713bdfe9 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -48,5 +48,4 @@ else # cp asciiart/*.txt $(ETCDIR)/asciiart mkdir -p $(ETCDIR)/scripts cp scripts/*.py $(ETCDIR)/scripts - cp scripts/ttcn3_archive $(BINDIR) endif diff --git a/etc/scripts/ttcn3_archive b/etc/scripts/ttcn3_archive deleted file mode 100755 index aef646beef0216afbadf706ffa7c82e9be169064..0000000000000000000000000000000000000000 --- a/etc/scripts/ttcn3_archive +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/perl -############################################################################### -# Copyright (c) 2000-2016 Ericsson Telecom AB -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Baji, Laszlo -# Balasko, Jeno -# -############################################################################### -############################################################################### -# This script is intended to archive the project hierarchy from a TPD file structure -############################################################################### -use 5.010; -use strict; -use warnings; -use Cwd; -use File::Copy; - -my $ttcn3_dir = $ENV{'TTCN3_DIR'}; -my $bindir = $ttcn3_dir . "/bin"; -my $home = cwd(); -my @list = readFile(); -my $tpd = getTPDFileName(\@list); -chomp ($tpd); -if (-l $tpd) #get the path if it is a symlink -{ - $tpd = `readlink $tpd`; - chomp ($tpd); -} -my $root = getPathToRootDir(\@list); # get the workspace directory of the OS -chomp ($root); -chdir ($root) or die "cannot change: $!\n"; -my $cutstring = cwd; # this is string generated from the the absolute path to the workspace -my $archiveDir = getArchiveDir(\@list); #directory to place the archive -$archiveDir = $home . "/" . $archiveDir; -chomp ($archiveDir); -my $createDir = "mkdir -p " . $archiveDir; -my $res = system($createDir); -my $backupFileName = createBackupFileName(); -my $backupfile = $archiveDir . "/" . $backupFileName; -if ($res != 0) { die (" creating directory " . $archiveDir ." failed\n"); } -my $archive = $bindir . "/" . "ttcn3_makefilegen" ." -V -P " . $cutstring . " -t " . $tpd . " | xargs tar cfz ". $archiveDir . "/" . $backupFileName . " 2> /dev/null"; -system($archive); #running it -if (-e $backupfile) { print ("archiving succeeded\n"); } -else { print ("archiving failed\n"); } -chdir ($home) or die "cannot change: $!\n"; -############################################################ -sub readFile -{ - my $makefile = "Makefile"; - open ( FILE, "<", $makefile ) or die ( "failed to open file: $home\/$makefile\n" ); - my @lines = <FILE>; - close FILE; - return @lines; -} -############################################################ -sub getPathToRootDir #get the relative path to OS workspace -{ - my @list = @{$_[0]}; - my $search = qr/^ROOT_DIR =/s; - my $offset = 0; - my $line; - for my $i ( 0 .. $#list ) - { - if ( $list[$i] =~ $search ) - { - $line = $list[$i]; - my $dot = '.'; - $offset = index($list[$i], $dot); - last; - } - } - if ($offset == 0) { die ( "no ROOT_DIR variable was found in the Makefile\n" ); } - my $path = substr $line, $offset; - return $path; -} -############################################################ -sub getTPDFileName # TPD filename what the Makefile is created from -{ - my @list = @{$_[0]}; - my $search = qr/^TPD =/s; - my $offset = 0; - my $line; - for my $i ( 0 .. $#list ) - { - if ( $list[$i] =~ $search ) - { - $line = $list[$i]; - my $assign = '='; - $offset = index($list[$i], $assign); - last; - } - } - if ($offset == 0) { die ( "no TPD variable was found in the Makefile\n" ); } - my $file = substr $line, $offset + 1; - $file =~ s/^\s+|\s+$//; # remove heading and traling whitespaces - return $file; -} -############################################################ -sub getArchiveDir # the name of the archive directory -{ - my @list = @{$_[0]}; - my $search = qr/^ARCHIVE_DIR =/s; - my $offset = 0; - my $line; - for my $i ( 0 .. $#list ) - { - if ( $list[$i] =~ $search ) - { - $line = $list[$i]; - my $assign = '='; - $offset = index($list[$i], $assign); - last; - } - } - if ($offset == 0) { die ( "no ARCHIVE_DIR variable was found in the Makefile\n" ); } - my $dir = substr $line, $offset + 1; - $dir =~ s/^\s+|\s+$//; # remove heading and trailing whitespaces - return $dir; -} -############################################################ -sub getExecutableName # the name of the target executable -{ - my @list = @{$_[0]}; - my $search = qr/^EXECUTABLE =/s; - my $offset = 0; - my $line; - for my $i ( 0 .. $#list ) - { - if ( $list[$i] =~ $search ) - { - $line = $list[$i]; - my $assign = '='; - $offset = index($list[$i], $assign); - last; - } - } - if ($offset == 0) { die ( "no EXCUTABLE variable was found in the Makefile\n" ); } - my $exec = substr $line, $offset + 1; - $exec =~ s/^\s+|\s+$//; # remove heading and trailing whitespaces - return $exec; -} -############################################################ -sub createBackupFileName -{ - my $backupFile = getExecutableName(\@list); - my $dot = '.'; - my $result = index($backupFile, $dot); - if ($result > -1) - { - $backupFile = substr $backupFile, 0, $result; - } - chomp ($backupFile); - my $date = `date '+%y%m%d-%H%M'`; - chomp ($date); - my $baseName = $backupFile . "-" . $date . ".tgz"; - chomp ($baseName); - return $baseName; -}