19780544fSAndrew Rist#************************************************************** 29780544fSAndrew Rist# 39780544fSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 49780544fSAndrew Rist# or more contributor license agreements. See the NOTICE file 59780544fSAndrew Rist# distributed with this work for additional information 69780544fSAndrew Rist# regarding copyright ownership. The ASF licenses this file 79780544fSAndrew Rist# to you under the Apache License, Version 2.0 (the 89780544fSAndrew Rist# "License"); you may not use this file except in compliance 99780544fSAndrew Rist# with the License. You may obtain a copy of the License at 109780544fSAndrew Rist# 119780544fSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 129780544fSAndrew Rist# 139780544fSAndrew Rist# Unless required by applicable law or agreed to in writing, 149780544fSAndrew Rist# software distributed under the License is distributed on an 159780544fSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169780544fSAndrew Rist# KIND, either express or implied. See the License for the 179780544fSAndrew Rist# specific language governing permissions and limitations 189780544fSAndrew Rist# under the License. 199780544fSAndrew Rist# 209780544fSAndrew Rist#************************************************************** 219780544fSAndrew Rist 229780544fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweirpackage packager::check; 25cdf0e10cSrcweir 26cdf0e10cSrcweiruse packager::exiter; 27cdf0e10cSrcweiruse packager::globals; 28cdf0e10cSrcweir 29cdf0e10cSrcweir############################################## 30cdf0e10cSrcweir# Check 1: The package list has to exist 31cdf0e10cSrcweir############################################## 32cdf0e10cSrcweir 33cdf0e10cSrcweirsub check_packlist 34cdf0e10cSrcweir{ 35*72bd2d34SAriel Constenla-Haile my $custompacklist = $ENV{'CUSTOM_PACK_LIST'}; 36*72bd2d34SAriel Constenla-Haile if ( defined $custompacklist && length $custompacklist > 0 ) 37*72bd2d34SAriel Constenla-Haile { 38*72bd2d34SAriel Constenla-Haile $packager::globals::packlistname = $custompacklist; 39*72bd2d34SAriel Constenla-Haile } 40*72bd2d34SAriel Constenla-Haile else 41*72bd2d34SAriel Constenla-Haile { 42*72bd2d34SAriel Constenla-Haile my $projectdir = $ENV{'PRJ'}; 43*72bd2d34SAriel Constenla-Haile $projectdir =~ s/$packager::globals::separator\s*$//; 44*72bd2d34SAriel Constenla-Haile $packager::globals::packlistname = $projectdir . $packager::globals::separator . "util" . $packager::globals::separator . $packager::globals::packlistname; 45*72bd2d34SAriel Constenla-Haile } 46*72bd2d34SAriel Constenla-Haile 47*72bd2d34SAriel Constenla-Haile print "Using pack list " . $packager::globals::packlistname . "\n"; 48cdf0e10cSrcweir 49cdf0e10cSrcweir if ( ! -f $packager::globals::packlistname ) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir packager::exiter::exit_program("ERROR: Package list not found: $packager::globals::packlistname", "check_packlist"); 52cdf0e10cSrcweir } 53cdf0e10cSrcweir} 54cdf0e10cSrcweir 55cdf0e10cSrcweir############################################################# 56cdf0e10cSrcweir# Check 2: The environment variable OUTPATH has to be set 57cdf0e10cSrcweir############################################################# 58cdf0e10cSrcweir 59cdf0e10cSrcweirsub check_environment 60cdf0e10cSrcweir{ 61cdf0e10cSrcweir if ( ! $ENV{'OUTPATH'} ) 62cdf0e10cSrcweir { 63cdf0e10cSrcweir packager::exiter::exit_program("ERROR: Environment variable OUTPATH not set!", "check_environment"); 64cdf0e10cSrcweir } 65cdf0e10cSrcweir 66cdf0e10cSrcweir if ( ! $ENV{'PRJ'} ) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir packager::exiter::exit_program("ERROR: Environment variable PRJ not set!", "check_environment"); 69cdf0e10cSrcweir } 70cdf0e10cSrcweir} 71cdf0e10cSrcweir 72cdf0e10cSrcweir############################################################# 73cdf0e10cSrcweir# Check 3: Checking the parameter. Only "-i" is valid 74cdf0e10cSrcweir############################################################# 75cdf0e10cSrcweir 76cdf0e10cSrcweirsub check_parameter 77cdf0e10cSrcweir{ 78cdf0e10cSrcweir while ( $#ARGV >= 0 ) 79cdf0e10cSrcweir { 80cdf0e10cSrcweir my $param = shift(@ARGV); 81cdf0e10cSrcweir 82cdf0e10cSrcweir if ($param eq "-i") { $packager::globals::ignoreerrors = 1; } 83cdf0e10cSrcweir else 84cdf0e10cSrcweir { 85cdf0e10cSrcweir print("\n*************************************\n"); 86cdf0e10cSrcweir print("Sorry, unknown parameter: $param"); 87cdf0e10cSrcweir print("\n*************************************\n"); 88cdf0e10cSrcweir usage(); 89cdf0e10cSrcweir exit(-1); 90cdf0e10cSrcweir } 91cdf0e10cSrcweir } 92cdf0e10cSrcweir} 93cdf0e10cSrcweir 94cdf0e10cSrcweir1; 95