Github user dangogh commented on a diff in the pull request:

    
https://github.com/apache/incubator-trafficcontrol/pull/126#discussion_r95028313
  
    --- Diff: traffic_ops/install/lib/BuildPerlDeps.pm ---
    @@ -0,0 +1,97 @@
    +#!/usr/bin/perl
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +# http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +use lib qw(/opt/traffic_ops/install/lib /opt/traffic_ops/lib/perl5 
/opt/traffic_ops/app/lib);
    +
    +package BuildPerlDeps;
    +
    +use InstallUtils qw{ :all };
    +
    +use base qw{ Exporter };
    +our @EXPORT_OK = qw{ build };
    +our %EXPORT_TAGS = ( all => \@EXPORT_OK );
    +
    +sub build {
    +    my $opt_i = shift;
    +
    +    my @dependencies = ( "expat-devel", "mod_ssl", "mkisofs", "libpcap", 
"libpcap-devel", "libcurl", "libcurl-devel", "mysql-server", "mysql-devel", 
"openssl", "openssl-devel", "cpan", "gcc", "make", "pkgconfig", "automake", 
"autoconf", "libtool", "gettext", "libidn-devel" );
    +
    +    my $msg = << 'EOF';
    +
    +This script will build and package the required Traffic Ops perl modules.
    +In order to complete this operation, Development tools such as the gcc
    +compiler will be installed on this machine.
    +
    +EOF
    +
    +    $ENV{PERL_MM_USE_DEFAULT}    = 1;
    +    $ENV{PERL_MM_NONINTERACTIVE} = 1;
    +    $ENV{AUTOMATED_TESTING}      = 1;
    +
    +    my $result;
    +
    +    if ( $ENV{USER} ne "root" ) {
    +        errorOut("You must run this script as the root user");
    +    }
    +
    +    logger( $msg, "info" );
    +
    +    chdir("/opt/traffic_ops/app");
    +
    +    if ( defined $opt_i && $opt_i == 1 ) {
    +        if ( !-x "/usr/bin/yum" ) {
    +            errorOut("You must install 'yum'");
    +        }
    +
    +        logger( "Installing dependencies", "info" );
    +        $result = execCommand( "/usr/bin/yum", "-y", "install", 
@dependencies );
    +        if ( $result != 0 ) {
    +            errorOut("Dependency installation failed, look through the 
output and correct the problem");
    +        }
    +        logger( "Building perl modules", "info" );
    +
    +        $result = execCommand( "/usr/bin/cpan", "pi_custom_log=" . 
$::cpanLogFile, "-if", "YAML" );
    --- End diff --
    
    Noticed this in most of the lib/ files -- please don't use main-package 
variables ($::cpanLogFile) in a module -- that ties the module to a specific 
main script..   Instead,  find a clean way to set the variable within this 
package from the main script.   If there are a number of variables,  consider 
creating a function in the module to set variables within the package.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to