Subversion Repositories DevTools

Rev

Rev 1568 | Rev 1572 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1568 Rev 1570
Line 250... Line 250...
250
our $RootDir            = "";
250
our $RootDir            = "";
251
our $BuildType          = "";
251
our $BuildType          = "";
252
our $AlternateBuildType = ""; # the opposite of $BuildType
252
our $AlternateBuildType = ""; # the opposite of $BuildType
253
our $MachType           = "";
253
our $MachType           = "";
254
our $MachArch           = "";
254
our $MachArch           = "";
-
 
255
our $MachISA            = "";
255
our $Platform           = "";
256
our $Platform           = "";
256
our $Product            = "";
257
our $Product            = "";
257
our $Target             = "";
258
our $Target             = "";
258
our $SrcDir             = "";
259
our $SrcDir             = "";
259
our $PkgDir             = "";
260
our $PkgDir             = "";
Line 409... Line 410...
409
    {
410
    {
410
        $Target = $opt_g;
411
        $Target = $opt_g;
411
        if ( $Target =~ /^SOLARIS/ )
412
        if ( $Target =~ /^SOLARIS/ )
412
        {
413
        {
413
            $MachType = 'sparc';
414
            $MachType = 'sparc';
414
            $MachArch = $MachType;
-
 
415
            if ( $Target  =~ /X86/i )
415
            if ( $Target =~ /X86/i )
416
            {
416
            {
417
                $MachArch = 'x86';
417
                $MachArch = 'i386';
-
 
418
                $MachISA = "";
-
 
419
            }
-
 
420
            elsif ( $Target =~ /X64/i )
-
 
421
            {
-
 
422
                $MachArch = 'i386';
-
 
423
                $MachISA = "amd64";
-
 
424
            }
-
 
425
            elsif ( $Target =~ /SPARC64/i )
-
 
426
            {
-
 
427
                $MachArch = 'sparc';
-
 
428
                $MachISA = "sparcv9";
-
 
429
            }
-
 
430
            else
-
 
431
            {
-
 
432
                $MachArch = 'sparc';
-
 
433
                $MachISA = "";
418
            }
434
            }
419
        }
435
        }
420
        elsif ( $Target =~ /^WCE/ )
436
        elsif ( $Target =~ /^WCE/ )
421
        {
437
        {
422
            $MachType = 'WinCE';
438
            $MachType = 'WinCE';
Line 450... Line 466...
450
    #
466
    #
451
    $Product = $opt_k ? $opt_k : $Platform;
467
    $Product = $opt_k ? $opt_k : $Platform;
452
 
468
 
453
    if ( $opt_d )
469
    if ( $opt_d )
454
    {
470
    {
-
 
471
        # if no targetbasedir then set it to "." to simulate targetbasedir
-
 
472
        if ( $opt_d eq "--NoDir" || $opt_d eq "--NoTargetBaseDir" )
-
 
473
        {
-
 
474
            $TargetBaseDir = ".";   
-
 
475
        }
-
 
476
        else
-
 
477
        {
455
        $TargetBaseDir = $opt_d;
478
            $TargetBaseDir = $opt_d;
-
 
479
        }
456
    }
480
    }
457
    else
481
    else
458
    {
482
    {
459
        Error("Package base directory not supplied!");
483
        Error("Package base directory not supplied!");
460
    }
484
    }
Line 523... Line 547...
523
 
547
 
524
    # Load all our build dependencies
548
    # Load all our build dependencies
525
    #
549
    #
526
    %BuildPkgArchive = $BuildFileInfo->getDpkgArchiveHash();
550
    %BuildPkgArchive = $BuildFileInfo->getDpkgArchiveHash();
527
 
551
 
528
    # lets define where we get our stuff from
552
    # TargetHomeDir should not really be used for anything
529
    #
553
    #
530
    if ( $ERGAFC_BASEDIR =~ m|/$| )
-
 
531
    {
-
 
532
        $TargetHomeDir= "$ERGAFC_BASEDIR$TargetBaseDir"; 
554
    $TargetHomeDir = ($TargetBaseDir ne ".") ? "$ERGAFC_BASEDIR/$TargetBaseDir" : "$ERGAFC_BASEDIR"; 
533
    }
-
 
534
    else
-
 
535
    {
-
 
536
        $TargetHomeDir= "$ERGAFC_BASEDIR/$TargetBaseDir"; 
555
    $TargetHomeDir =~ s|/{2,}|/|g;
537
    }
556
 
538
    $PkgDir       = "$RootDir/pkg";
557
    $PkgDir       = "$RootDir/pkg";
539
    $SrcDir       = "$RootDir/src"; 
558
    $SrcDir       = "$RootDir/src"; 
540
    $InterfaceDir = "$RootDir/interface";
559
    $InterfaceDir = "$RootDir/interface";
541
    $ReleaseDir   = "$RootDir/build/deploy";
560
    $ReleaseDir   = "$RootDir/build/deploy";
542
 
561
 
Line 784... Line 803...
784
 
803
 
785
    Information("ProjectAcronym   =[$ProjectAcronym]");
804
    Information("ProjectAcronym   =[$ProjectAcronym]");
786
    Information("BuildType        =[$BuildType]");
805
    Information("BuildType        =[$BuildType]");
787
    Information("MachType         =[$MachType]");
806
    Information("MachType         =[$MachType]");
788
    Information("MachArch         =[$MachArch]") if ( $MachArch );
807
    Information("MachArch         =[$MachArch]") if ( $MachArch );
-
 
808
    Information("MachISA          =[$MachISA]") if ( $MachISA );
789
    Information("Platform         =[$Platform]");
809
    Information("Platform         =[$Platform]");
790
    Information("Product          =[$Product]");
810
    Information("Product          =[$Product]");
791
    Information("Target           =[$Target]");
811
    Information("Target           =[$Target]");
792
    Verbose("BuildParts       =[" . join(',',$BuildFileInfo->getPlatformParts($Platform)) . "]");
812
    Verbose("BuildParts       =[" . join(',',$BuildFileInfo->getPlatformParts($Platform)) . "]");
793
    
813
    
794
    Information("CurrentDir       =[$CurrentDir]");
814
    Information("CurrentDir       =[$CurrentDir]");
795
    Information("RootDir          =[$RootDir]");
815
    Information("RootDir          =[$RootDir]");
796
    Information("SandBoxName      =[$SandBoxName]");
816
    Information("SandBoxName      =[$SandBoxName]");
797
    Information("Username         =[$Username]");
817
    Information("Username         =[$Username]");
798
 
818
 
799
    Information("TargetBaseDir    =[$TargetBaseDir]");
819
    Information("TargetBaseDir    =[" . ($TargetBaseDir ne "." ? $TargetBaseDir : $opt_d) . "]");
800
    Information("TargetHomeDir    =[$TargetHomeDir]");
820
    Information("TargetHomeDir    =[$TargetHomeDir]");
801
 
821
 
802
    Information("PkgBaseDir       =[$PkgBaseDir]");
822
    Information("PkgBaseDir       =[$PkgBaseDir]");
803
    Information("SrcDir           =[$SrcDir]");
823
    Information("SrcDir           =[$SrcDir]");
804
    Information("PkgDir           =[$PkgDir]");
824
    Information("PkgDir           =[$PkgDir]");
Line 1702... Line 1722...
1702
    # if does not the process with log an error.
1722
    # if does not the process with log an error.
1703
    #
1723
    #
1704
    my $targetValue;
1724
    my $targetValue;
1705
    if ( $targetTag eq "--NoTag" )
1725
    if ( $targetTag eq "--NoTag" )
1706
    {
1726
    {
1707
        $targetValue = "$PkgBaseDir/$TargetBaseDir";
1727
        $targetValue = ($TargetBaseDir ne ".") ? "$PkgBaseDir/$TargetBaseDir" : $PkgBaseDir;
1708
    }
1728
    }
1709
    else
1729
    else
1710
    {
1730
    {
1711
       $targetValue = getTargetDstDirValue($targetTag, "A");
1731
       $targetValue = getTargetDstDirValue($targetTag, "A");
1712
    }
1732
    }
Line 4355... Line 4375...
4355
#------------------------------------------------------------------------------
4375
#------------------------------------------------------------------------------
4356
{
4376
{
4357
    Information("Cleaning any previous target file items...");
4377
    Information("Cleaning any previous target file items...");
4358
 
4378
 
4359
    my ($i);
4379
    my ($i);
4360
 
-
 
-
 
4380
    my $dirRoot;
4361
    #   Clean out PkgBaseDir
4381
    #   Clean out PkgBaseDir
4362
    #   This is the directory in which the final package image will be assembled
4382
    #   This is the directory in which the final package image will be assembled
4363
    #   Recreate the directory. Ensure that it does not have setgid on the directory
4383
    #   Recreate the directory. Ensure that it does not have setgid on the directory
4364
    #   as this will affect all the subdirectories that are created and will
4384
    #   as this will affect all the subdirectories that are created and will
4365
    #   propergate into the target package.
4385
    #   propergate into the target package.
Line 4368... Line 4388...
4368
    make_directory( $PkgDir, 0777, "Create target base dir");
4388
    make_directory( $PkgDir, 0777, "Create target base dir");
4369
 
4389
 
4370
    # lets create.
4390
    # lets create.
4371
    #
4391
    #
4372
    Information ("Creating target directory structure...");
4392
    Information ("Creating target directory structure...");
-
 
4393
    
-
 
4394
    $dirRoot = ($TargetBaseDir ne ".") ? "$PkgBaseDir/$TargetBaseDir" : $PkgBaseDir;
4373
    make_directory( "$PkgBaseDir/$TargetBaseDir", 0777, "Create target dir");
4395
    make_directory( $dirRoot, 0777, "Create target dir");
-
 
4396
 
4374
    foreach $i ( sort {$a cmp $b} values %TargetDstDirStructure )
4397
    foreach $i ( sort {$a cmp $b} values %TargetDstDirStructure )
4375
    {
4398
    {
4376
        make_directory("$PkgBaseDir/$TargetBaseDir/$i", 0777);
4399
        make_directory("$dirRoot/$i", 0777);
4377
    }
4400
    }
4378
 
4401
 
4379
 
4402
 
4380
    # lets determine if we have a InstallShield config dir
4403
    # lets determine if we have a InstallShield config dir
4381
    #
4404
    #
Line 4724... Line 4747...
4724
        Error("Incorrect number of params passed to " .
4747
        Error("Incorrect number of params passed to " .
4725
                  "getTargetDstDirValue() function.");
4748
                  "getTargetDstDirValue() function.");
4726
    }
4749
    }
4727
 
4750
 
4728
    my ($m_key, $m_type) = @_;
4751
    my ($m_key, $m_type) = @_;
4729
    my $tdir;
4752
    my $tdir = ($TargetBaseDir ne ".") ? "$TargetBaseDir/" : "";
4730
 
4753
 
4731
    #
4754
    #
4732
    #   Look up the users tag conversion hash
4755
    #   Look up the users tag conversion hash
4733
    #
4756
    #
4734
    if ( exists $TargetDstDirStructure{$m_key} )
4757
    if ( exists $TargetDstDirStructure{$m_key} )
4735
    {
4758
    {
4736
        $tdir = $TargetBaseDir . '/' . $TargetDstDirStructure{$m_key};
4759
        $tdir .= $TargetDstDirStructure{$m_key};
4737
    }
4760
    }
4738
    else
4761
    else
4739
    {
4762
    {
4740
        Error("Target destination dir tag [$m_key] does not exist in " .
4763
        Error("Target destination dir tag [$m_key] does not exist in " .
4741
             "TargetDstDirStructure. " ,
4764
             "TargetDstDirStructure. " ,
Line 4897... Line 4920...
4897
    printf FILE ("---------------------------------------------------------------\n");
4920
    printf FILE ("---------------------------------------------------------------\n");
4898
    close FILE;
4921
    close FILE;
4899
 
4922
 
4900
    # now we need to get the contents of the patch we are creating.
4923
    # now we need to get the contents of the patch we are creating.
4901
    #
4924
    #
4902
    File::Find::find(\&getPatchContents, "$PkgBaseDir/$TargetBaseDir");
4925
    File::Find::find(\&getPatchContents, ($TargetBaseDir ne ".") ? "$PkgBaseDir/$TargetBaseDir" : $PkgBaseDir );
4903
   
4926
   
4904
    return 1;
4927
    return 1;
4905
}
4928
}
4906
 
4929
 
4907
 
4930
 
Line 5243... Line 5266...
5243
    }
5266
    }
5244
 
5267
 
5245
    # lets take the passed in args.
5268
    # lets take the passed in args.
5246
    my ($uid, $gid) = @_;
5269
    my ($uid, $gid) = @_;
5247
 
5270
 
5248
 
-
 
5249
    # we need to determine which file we are dealing with
-
 
5250
    my ($protoTypeFile);
-
 
5251
    my ($targetBaseDir);
-
 
5252
    my ($pkgBaseDir);
-
 
5253
    $protoTypeFile = "$ProtoTypeFile"; 
-
 
5254
    $targetBaseDir = "$PkgBaseDir/$TargetBaseDir"; 
-
 
5255
    $pkgBaseDir    = "$PkgBaseDir"; 
-
 
5256
 
-
 
5257
 
-
 
5258
    # we need to locate the prototype file
5271
    # we need to locate the prototype file
5259
    if ( -f "$protoTypeFile" )
5272
    if ( -f "$ProtoTypeFile" )
5260
    {
5273
    {
5261
        unlink("$protoTypeFile");
5274
        unlink("$ProtoTypeFile");
5262
        Verbose("Removing prototype file [$protoTypeFile].");
5275
        Verbose("Removing prototype file [$ProtoTypeFile].");
5263
    }
5276
    }
5264
 
5277
 
5265
    # lets open the prototype file.
5278
    # lets open the prototype file.
5266
    #    
5279
    #    
5267
    local *FILE;
5280
    local *FILE;
5268
    open ( FILE, "> $protoTypeFile") or
5281
    open ( FILE, "> $ProtoTypeFile") or
5269
        Error("Failed to open file [$protoTypeFile].");
5282
        Error("Failed to open file [$ProtoTypeFile].");
5270
 
5283
 
5271
    # lets populate the prototype file.
5284
    # lets populate the prototype file.
5272
    printf FILE ("i pkginfo\n");
5285
    printf FILE ("i pkginfo\n");
5273
 
-
 
5274
    if ( "x$TargetBaseDir" ne "x." )
-
 
5275
    {
-
 
5276
        printf FILE ("!search $TargetBaseDir");
-
 
5277
    }
-
 
5278
    else
-
 
5279
    {
-
 
5280
        printf FILE ("!search ");
5286
    printf FILE ("!search");
5281
    }
5287
    close(FILE);
5282
 
5288
 
5283
    # now we need to add entries for each directory we will 
5289
    # now we need to add entries for each directory we will 
5284
    # be installing 
5290
    # be installing 
5285
    File::Find::find(\&prototypeFind, "$targetBaseDir");
5291
    File::Find::find( \&prototypeFind, ($TargetBaseDir ne ".") ? "$PkgBaseDir/$TargetBaseDir" : $PkgBaseDir );
5286
 
5292
 
5287
    # lets populate the prototype file with a newline.
5293
    # lets populate the prototype file with a newline.
5288
    open ( FILE, ">> $protoTypeFile") or
5294
    open ( FILE, ">> $ProtoTypeFile") or
5289
        Error("Failed to open file [$protoTypeFile].");
5295
        Error("Failed to open file [$ProtoTypeFile].");
5290
    printf FILE ("\n");
5296
    printf FILE ("\n");
5291
    close (FILE);
5297
    close (FILE);
5292
 
5298
 
5293
 
5299
 
5294
    # lets put the pre-deinfed generic entries into the 
5300
    # lets put the pre-deinfed generic entries into the 
Line 5300... Line 5306...
5300
    }
5306
    }
5301
 
5307
 
5302
 
5308
 
5303
    # we need to expand and complete the creation of the 
5309
    # we need to expand and complete the creation of the 
5304
    # prototype file
5310
    # prototype file
5305
    # if targetbasedir is "." the pkgproto will pick up the pkginfo and
5311
    # if Targetbasedir is "." the pkgproto will pick up the pkginfo and
5306
    # prototype files so we need to remove them
5312
    # prototype files so we need to remove them
5307
    my ($m_cmd) = "pkgproto " .
5313
    my ($m_cmd) = "pkgproto " .
5308
                  "$TargetBaseDir " .
5314
                  "$TargetBaseDir " .
5309
                  "| egrep -v \"($ProtoTypeFileName|$PkgInfoFileName)\"" .
5315
                  "| egrep -v \"($ProtoTypeFileName|$PkgInfoFileName)\"" .
5310
                  "| cut -f1-4 -d' ' | sed " . '"s/\$/ ' . "$uid $gid" . '/g"' . 
5316
                  "| cut -f1-4 -d' ' | sed " . '"s/\$/ ' . "$uid $gid" . '/g"' . 
5311
                  " >> $protoTypeFile";
5317
                  " >> $ProtoTypeFile";
5312
 
5318
 
5313
    my ($retVal) = system("cd $pkgBaseDir; $m_cmd");
5319
    my ($retVal) = system("cd $PkgBaseDir; $m_cmd");
5314
    if ( $retVal != 0 )
5320
    if ( $retVal != 0 )
5315
    {
5321
    {
5316
        Error("Failed to create prototype file [$protoTypeFile].");
5322
        Error("Failed to create prototype file [$ProtoTypeFile].");
5317
    }
5323
    }
5318
 
5324
 
5319
    Information("Created prototype file [$protoTypeFile].");
5325
    Information("Created prototype file [$ProtoTypeFile].");
5320
 
5326
 
5321
    return 1;
5327
    return 1;
5322
}
5328
}
5323
 
5329
 
5324
#------------------------------------------------------------------------------
5330
#------------------------------------------------------------------------------
Line 5328... Line 5334...
5328
#        This subroutine is used to locate all associated package dirs.
5334
#        This subroutine is used to locate all associated package dirs.
5329
#        It also adds an entry into the prototype file for each dir.
5335
#        It also adds an entry into the prototype file for each dir.
5330
#
5336
#
5331
#------------------------------------------------------------------------------
5337
#------------------------------------------------------------------------------
5332
{
5338
{
5333
    my($file)= "$File::Find::name";
5339
    my ($file)  = $File::Find::name;
5334
    my($base)= File::Basename::basename($file);
-
 
5335
 
-
 
5336
    # we get the absolute path from the find, but we only require
-
 
5337
    # a relative path from the starting dir.
-
 
5338
    # so our start dir.
-
 
5339
 
-
 
5340
    # we need to determine whiich file we are dealing with
-
 
5341
    my ($pfile);
-
 
5342
    my ($tDir);
-
 
5343
    $pfile = "$ProtoTypeFile"; 
-
 
5344
    $tDir = "$PkgBaseDir/$TargetBaseDir"; 
-
 
5345
    if ( "$file" ne "$tDir" )
-
 
5346
    {
-
 
5347
        if ( -d "$file" )  
-
 
5348
        {
-
 
5349
            my ($m_sfile) = $file;
-
 
5350
 
5340
 
5351
            if ( "x$TargetBaseDir" eq "x." )
5341
    # Our topdir will either be $PkgBaseDir or $PkgBaseDir/$TargetBaseDir (if there is a TargetBaseDir).
5352
            {
-
 
5353
                $tDir = $tDir . "/";
5342
    # if we have PKgBaseDir only we dont want to include this in the search path, 
5354
                $file =~ s/$tDir//;
5343
    # if TargetBaseDir is defined we include it in the search paths
5355
            }
-
 
5356
            else
5344
    if ( $file ne $PkgBaseDir && -d $file )
5357
            {
5345
    {
-
 
5346
        # we get the absolute path from the find, but we only require a relative path from the starting dir.
5358
                $file =~ s/$tDir/$TargetBaseDir/;
5347
        # So remove PkgBaseDir from path and include all dirs below it including TargetBaseDir if there is one
5359
            }
5348
        $file =~ s|$PkgBaseDir/*||;    
5360
 
5349
    
5361
            open ( FILE, ">> $pfile") or
5350
        open ( FILE, ">> $ProtoTypeFile") or
5362
                 Error("Failed to open file [$pfile].");
5351
             Error("Failed to open file [$ProtoTypeFile].");
5363
 
5352
 
5364
            # lets populate the prototype file.
5353
        # lets populate the prototype file.
5365
            printf FILE (" $file");
5354
        printf FILE (" $file");
5366
            close (FILE);
5355
        close (FILE);
5367
        }
-
 
5368
    }
5356
    }
5369
}
5357
}
5370
 
5358
 
5371
 
5359
 
5372
#------------------------------------------------------------------------------
5360
#------------------------------------------------------------------------------
Line 5665... Line 5653...
5665
    #
5653
    #
5666
    Error ("Internal: MachArch is not defined") unless ( $MachArch );
5654
    Error ("Internal: MachArch is not defined") unless ( $MachArch );
5667
    printf FILE ("NAME=$PkgNameLong\n");
5655
    printf FILE ("NAME=$PkgNameLong\n");
5668
    printf FILE ("VERSION=$PkgVersion.$ProjectAcronym\n");
5656
    printf FILE ("VERSION=$PkgVersion.$ProjectAcronym\n");
5669
    printf FILE ("ARCH=$MachArch\n");
5657
    printf FILE ("ARCH=$MachArch\n");
-
 
5658
    printf FILE ("SUNW_ISA=$MachISA\n") if ( $MachISA );
5670
    printf FILE ("VENDOR=$VENDOR_DESC\n");
5659
    printf FILE ("VENDOR=$VENDOR_DESC\n");
5671
    printf FILE ("DESC=$PkgDesc\n");
5660
    printf FILE ("DESC=$PkgDesc\n");
5672
    printf FILE ("CATEGORY=$CATEGORY_DESC\n");
5661
    printf FILE ("CATEGORY=$CATEGORY_DESC\n");
5673
    printf FILE ("BASEDIR=$ERGAFC_BASEDIR\n");
5662
    printf FILE ("BASEDIR=$ERGAFC_BASEDIR\n");
5674
    printf FILE ("TARGETBASEDIR=$TargetBaseDir\n");
5663
    printf FILE ("TARGETBASEDIR=$TargetBaseDir\n") unless ( $TargetBaseDir eq "." );
5675
    printf FILE ("CLASSES=$PkgInfoClasses\n");
5664
    printf FILE ("CLASSES=$PkgInfoClasses\n");
5676
 
5665
 
5677
    foreach my $param ( @_ )
5666
    foreach my $param ( @_ )
5678
    {
5667
    {
5679
        printf FILE "$param\n";
5668
        printf FILE "$param\n";
Line 6229... Line 6218...
6229
 
6218
 
6230
    # lets take the passed in args.
6219
    # lets take the passed in args.
6231
    my ($uid, $gid, $mask) = @args;
6220
    my ($uid, $gid, $mask) = @args;
6232
 
6221
 
6233
 
6222
 
6234
    # we need to determine whiich file we are dealing with
-
 
6235
    my ($protoTypeFile);
-
 
6236
    my ($targetBaseDir);
-
 
6237
    my ($pkgBaseDir);
-
 
6238
    $protoTypeFile = "$ProtoTypeFile"; 
-
 
6239
    $targetBaseDir = "$PkgBaseDir/$TargetBaseDir"; 
-
 
6240
    $pkgBaseDir    = "$PkgBaseDir"; 
-
 
6241
 
-
 
6242
 
-
 
6243
    # we need to locate the prototype file
6223
    # we need to locate the prototype file
6244
    if ( -f "$protoTypeFile" )
6224
    if ( -f "$ProtoTypeFile" )
6245
    {
6225
    {
6246
        unlink("$protoTypeFile");
6226
        unlink("$ProtoTypeFile");
6247
        Verbose("Removing prototype file [$protoTypeFile].");
6227
        Verbose("Removing prototype file [$ProtoTypeFile].");
6248
    }
6228
    }
6249
 
6229
 
6250
    # lets open the prototype file.
6230
    # lets open the prototype file.
6251
    #    
6231
    #    
6252
    local *FILE;
6232
    local *FILE;
6253
    open ( FILE, "> $protoTypeFile") or
6233
    open ( FILE, "> $ProtoTypeFile") or
6254
        Error("Failed to open file [$protoTypeFile].");
6234
        Error("Failed to open file [$ProtoTypeFile].");
6255
    # lets populate the prototype file.
6235
    # lets populate the prototype file.
6256
    printf FILE ("!default $mask $uid $gid\n");
6236
    printf FILE ("!default $mask $uid $gid\n");
6257
    printf FILE ("i pkginfo\n");
6237
    printf FILE ("i pkginfo\n");
6258
    close (FILE);
6238
    close (FILE);
6259
 
6239
 
Line 6277... Line 6257...
6277
    $m_KEEP_LINKS = $opt_keep_links;
6257
    $m_KEEP_LINKS = $opt_keep_links;
6278
 
6258
 
6279
 
6259
 
6280
    # now we need to add entries for each directory we will 
6260
    # now we need to add entries for each directory we will 
6281
    # be installing 
6261
    # be installing 
6282
    File::Find::find(\&prototype2Find, "$targetBaseDir");
6262
    File::Find::find( \&prototype2Find, ($TargetBaseDir ne ".") ? "$PkgBaseDir/$TargetBaseDir" : $PkgBaseDir );
6283
 
6263
 
6284
 
6264
 
6285
    # lets populate the prototype file with a newline.
6265
    # lets populate the prototype file with a newline.
6286
    open ( FILE, ">> $protoTypeFile") or
6266
    open ( FILE, ">> $ProtoTypeFile") or
6287
        Error("Failed to open file [$protoTypeFile].");
6267
        Error("Failed to open file [$ProtoTypeFile].");
6288
    printf FILE ("\n");
6268
    printf FILE ("\n");
6289
    close (FILE);
6269
    close (FILE);
6290
 
6270
 
6291
 
6271
 
6292
    Information("Created prototype file [$protoTypeFile].");
6272
    Information("Created prototype file [$ProtoTypeFile].");
6293
 
6273
 
6294
    return 1;
6274
    return 1;
6295
}
6275
}
6296
 
6276
 
-
 
6277
 
-
 
6278
#------------------------------------------------------------------------------
-
 
6279
sub prototype2Find
-
 
6280
#
-
 
6281
#    Description:
-
 
6282
#        This subroutine is used to locate all associated package dirs.
-
 
6283
#        It also adds an entry into the prototype file for each dir.
-
 
6284
#
-
 
6285
#------------------------------------------------------------------------------
-
 
6286
{
-
 
6287
    my $file = $File::Find::name;
-
 
6288
 
-
 
6289
    # Our topdir will either be $PkgBaseDir or $PkgBaseDir/$TargetBaseDir (if there is a TargetBaseDir).
-
 
6290
    # if we have PkgBaseDir only we dont want to include this in the prototype file, 
-
 
6291
    # if TargetBaseDir is defined we include it in the prototype
-
 
6292
    if ( $file ne $PkgBaseDir )
-
 
6293
    {
-
 
6294
        my ($sfile) = $file;
-
 
6295
 
-
 
6296
        # we get the absolute path from the find, but we only require a relative path from the starting dir.
-
 
6297
        # So remove PkgBaseDir from path and include all dirs below it including TargetBaseDir if there is one
-
 
6298
        $file =~ s|$PkgBaseDir/*||;    
-
 
6299
 
-
 
6300
        # if TargetBaseDir is "." then find will find the pkginfo & prototype files so we need to exclude them
-
 
6301
        if ( $file ne $ProtoTypeFileName && $file ne $PkgInfoFileName )
-
 
6302
        {
-
 
6303
            my $fmask = $m_MASK;
-
 
6304
            if ( $m_KEEP_MASK )
-
 
6305
            {
-
 
6306
                $fmask = sprintf "%lo", ( (stat($sfile))[2]) & 07777;
-
 
6307
            }
-
 
6308
 
-
 
6309
            open ( FILE, ">> $ProtoTypeFile") or
-
 
6310
                Error("Failed to open file [$ProtoTypeFile].");
-
 
6311
 
-
 
6312
            if ( $m_KEEP_LINKS && -l "$sfile" )
-
 
6313
            {
-
 
6314
                my $linkDest = readlink($sfile);
-
 
6315
                Warning("Link $sfile has an absolute path, may not be a problem but make sure its what you want") if ( $linkDest =~ /^\// );
-
 
6316
                printf FILE ("s none $file=$linkDest\n");
-
 
6317
            }
-
 
6318
            elsif ( -f $sfile )
-
 
6319
            {
-
 
6320
                printf FILE ("f none $file=$file $fmask $m_UID $m_GID\n");
-
 
6321
            }
-
 
6322
            elsif ( -d $sfile )
-
 
6323
            {
-
 
6324
                printf FILE ("d none $file $fmask $m_UID $m_GID\n");
-
 
6325
            }
-
 
6326
 
-
 
6327
            close (FILE);
-
 
6328
        }
-
 
6329
    }
-
 
6330
}
-
 
6331
 
6297
#-------------------------------------------------------------------------------
6332
#-------------------------------------------------------------------------------
6298
# Function        : createZip
6333
# Function        : createZip
6299
#
6334
#
6300
# Description     : Create a ZIp file of a given directory
6335
# Description     : Create a ZIp file of a given directory
6301
#
6336
#
Line 6400... Line 6435...
6400
 
6435
 
6401
    Error ("createZip: Zip file not created") if ( $rv );
6436
    Error ("createZip: Zip file not created") if ( $rv );
6402
}
6437
}
6403
 
6438
 
6404
 
6439
 
6405
#------------------------------------------------------------------------------
-
 
6406
sub prototype2Find
-
 
6407
#
-
 
6408
#    Description:
-
 
6409
#        This subroutine is used to locate all associated package dirs.
-
 
6410
#        It also adds an entry into the prototype file for each dir.
-
 
6411
#
-
 
6412
#------------------------------------------------------------------------------
-
 
6413
{
-
 
6414
    my $file = $File::Find::name;
-
 
6415
    my $fullfile = $file;
-
 
6416
    my $base = File::Basename::basename($file);
-
 
6417
 
-
 
6418
    # we get the absolute path from the find, but we only require
-
 
6419
    # a relative path from the starting dir.
-
 
6420
    # so our start dir.
-
 
6421
 
-
 
6422
    # we need to determine which file we are dealing with
-
 
6423
    my ($pfile);
-
 
6424
    my ($tDir);
-
 
6425
    $pfile = "$ProtoTypeFile";
-
 
6426
    $tDir = "$PkgBaseDir/$TargetBaseDir";
-
 
6427
 
-
 
6428
    if ( "$file" ne "$tDir" )
-
 
6429
    {
-
 
6430
        my ($m_sfile) = $file;
-
 
6431
        if ( "x$TargetBaseDir" eq "x." )
-
 
6432
        {
-
 
6433
            $tDir = $tDir . "/";
-
 
6434
            $file =~ s/$tDir//;
-
 
6435
        }
-
 
6436
        else
-
 
6437
        {
-
 
6438
            $file =~ s/$tDir/$TargetBaseDir/;
-
 
6439
        }
-
 
6440
 
-
 
6441
        # if TargetBaseDir is "." then find will find the pkginfo & prototype 
-
 
6442
        # files so we need to exclude them
-
 
6443
        if ( "$file" ne "$ProtoTypeFileName" &&
-
 
6444
             "$file" ne "$PkgInfoFileName")
-
 
6445
        {
-
 
6446
 
-
 
6447
            my $fmask = $m_MASK;
-
 
6448
            if ( $m_KEEP_MASK )
-
 
6449
            {
-
 
6450
                $fmask = sprintf "%lo", ( (stat($fullfile))[2]) & 07777;
-
 
6451
            }
-
 
6452
 
-
 
6453
            open ( FILE, ">> $pfile") or
-
 
6454
                Error("Failed to open file [$pfile].");
-
 
6455
 
-
 
6456
            if ( $m_KEEP_LINKS && -l "$m_sfile" )
-
 
6457
            {
-
 
6458
                my $linkDest = readlink($m_sfile);
-
 
6459
                Warning("Link $m_sfile has an absolute path, may not be a problem but make sure its what you want") if ( $linkDest =~ /^\// );
-
 
6460
                printf FILE ("s none $file=$linkDest\n");
-
 
6461
            }
-
 
6462
            elsif ( -f "$m_sfile" )
-
 
6463
            {
-
 
6464
                printf FILE ("f none $file=$file $fmask $m_UID $m_GID\n");
-
 
6465
            }
-
 
6466
            elsif ( -d "$m_sfile" )
-
 
6467
            {
-
 
6468
                printf FILE ("d none $file $fmask $m_UID $m_GID\n");
-
 
6469
            }
-
 
6470
 
-
 
6471
            close (FILE);
-
 
6472
        }
-
 
6473
    }
-
 
6474
}
-
 
6475
 
-
 
6476
#-------------------------------------------------------------------------------
6440
#-------------------------------------------------------------------------------
6477
# Function        : convertFile
6441
# Function        : convertFile
6478
#
6442
#
6479
# Description     : This sub-routine is used to remove all carrage return\line
6443
# Description     : This sub-routine is used to remove all carrage return\line
6480
#                   feeds from a line and replace them with the platform
6444
#                   feeds from a line and replace them with the platform
Line 6909... Line 6873...
6909
    my ($m_tmpDir) = "$PkgBaseDir/dpkg_archive";
6873
    my ($m_tmpDir) = "$PkgBaseDir/dpkg_archive";
6910
    make_directory( $m_tmpDir, 0777 );
6874
    make_directory( $m_tmpDir, 0777 );
6911
 
6875
 
6912
    # 2. we create a sub-directory with the package name
6876
    # 2. we create a sub-directory with the package name
6913
    #
6877
    #
6914
    $m_tmpDir = "$PkgBaseDir/dpkg_archive/$TargetBaseDir";
6878
    $m_tmpDir = ($TargetBaseDir ne ".") ? "$PkgBaseDir/dpkg_archive/$TargetBaseDir" : "$PkgBaseDir/dpkg_archive";
6915
    make_directory( $m_tmpDir, 0777 );
6879
    make_directory( $m_tmpDir, 0777 );
6916
 
6880
 
6917
    # 3. we create a sub-directory with the package version number
6881
    # 3. we create a sub-directory with the package version number
6918
    #
6882
    #
6919
    my ($m_tmpDir2) = "$PkgBaseDir/dpkg_archive/$TargetBaseDir/" .
6883
    my ($m_tmpDir2) = "$m_tmpDir/${PkgVersion}.${ProjectAcronym}";
6920
                      "$PkgVersion" .  "." . "$ProjectAcronym";
-
 
6921
    make_directory( $m_tmpDir2, 0777 );
6884
    make_directory( $m_tmpDir2, 0777 );
6922
 
6885
 
6923
 
6886
 
6924
    # 4. we replacate the contents of the original outputdir/package name
6887
    # 4. we replacate the contents of the original outputdir/package name
6925
    #    to do this we shall execute a find starting within the original package target dir
6888
    #    to do this we shall execute a find starting within the original package target dir
6926
    #    any copy all items we find to the new location under the dpkg_archive/package/version dir.
6889
    #    any copy all items we find to the new location under the dpkg_archive/package/version dir.
6927
    #
6890
    #
6928
    File::Find::find( \&DpkgFind, "$PkgBaseDir/$TargetBaseDir");
6891
    File::Find::find( \&DpkgFind, ($TargetBaseDir ne ".") ? "$PkgBaseDir/$TargetBaseDir" : $PkgBaseDir );
6929
 
6892
 
6930
 
6893
 
6931
    # 5. we create a descpkg file, with the Package Name, Version and Desc
6894
    # 5. we create a descpkg file, with the Package Name, Version and Desc
6932
    #
6895
    #
6933
    my ($m_DescPkgFile) = "$PkgBaseDir/dpkg_archive/$TargetBaseDir/$PkgVersion\.$ProjectAcronym/descpkg";
6896
    my ($m_DescPkgFile) = "$m_tmpDir2/descpkg";
6934
 
6897
 
6935
    # now we need to update the prototype file
6898
    # now we need to update the prototype file
6936
    #
6899
    #
6937
    local *FILE;
6900
    local *FILE;
6938
    open ( FILE, ">> $m_DescPkgFile") or
6901
    open ( FILE, ">> $m_DescPkgFile") or
Line 6962... Line 6925...
6962
 
6925
 
6963
 
6926
 
6964
    # we get the absolute path from the find, but we only require
6927
    # we get the absolute path from the find, but we only require
6965
    # a relative path from the starting dir.
6928
    # a relative path from the starting dir.
6966
 
6929
 
6967
 
-
 
-
 
6930
    my $srcdir = ($TargetBaseDir ne ".") ? "$PkgBaseDir/$TargetBaseDir" : $PkgBaseDir;
-
 
6931
    my $dstdir = ($TargetBaseDir ne ".") ? "$PkgBaseDir/dpkg_archive/$TargetBaseDir" : "$PkgBaseDir/dpkg_archive";
6968
    # we need to determine which file we are dealing with
6932
    # we need to determine which file we are dealing with
6969
    if ( ! -d "$item")
6933
    if ( ! -d "$item")
6970
    {
6934
    {
6971
        my ($m_sfile) = $item;
6935
        my ($m_sfile) = $item;
6972
        $item =~ s/$PkgBaseDir\/$TargetBaseDir/$PkgBaseDir\/dpkg_archive\/$TargetBaseDir\/$PkgVersion\.$ProjectAcronym/;
6936
        $item =~ s|$srcdir|$dstdir/$PkgVersion\.$ProjectAcronym|;
6973
 
6937
 
6974
        if(File::Copy::copy("$m_sfile", "$item"))
6938
        if(File::Copy::copy("$m_sfile", "$item"))
6975
        {
6939
        {
6976
            Verbose("Copied [$base] to [$item] ...");
6940
            Verbose("Copied [$base] to [$item] ...");
6977
        }
6941
        }
Line 6980... Line 6944...
6980
            Error("Failed to copy pkg file [$m_sfile] to [$item]: $!");
6944
            Error("Failed to copy pkg file [$m_sfile] to [$item]: $!");
6981
        }
6945
        }
6982
    }
6946
    }
6983
    else
6947
    else
6984
    {
6948
    {
-
 
6949
        # if no TargetBaseDir then we will pick up dpkg_archive dir so lets prune it
-
 
6950
        if ( $_ eq "dpkg_archive" )
-
 
6951
        {
-
 
6952
            $File::Find::prune = 1;
-
 
6953
        }
-
 
6954
        else
-
 
6955
        {
6985
        # we have found a dir
6956
            # we have found a dir
6986
        my ($m_sDir) = $item;
6957
            my ($m_sDir) = $item;
6987
        $item =~ s~$PkgBaseDir/$TargetBaseDir~$PkgBaseDir/dpkg_archive/$TargetBaseDir/$PkgVersion\.$ProjectAcronym~;
6958
            $item =~ s|$srcdir|$dstdir/$PkgVersion\.$ProjectAcronym|;
6988
        make_directory( $item, 0777 );
6959
            make_directory( $item, 0777 );
-
 
6960
        }
6989
    }
6961
    }
6990
}
6962
}
6991
 
6963
 
6992
 
6964
 
6993
# This is now depricated
6965
# This is now depricated
Line 7134... Line 7106...
7134
    {
7106
    {
7135
        $targetValue = getTargetDstDirValue($targetTag, "A");
7107
        $targetValue = getTargetDstDirValue($targetTag, "A");
7136
    }
7108
    }
7137
    else
7109
    else
7138
    {
7110
    {
7139
        $targetValue = "$PkgBaseDir/$TargetBaseDir";
7111
        $targetValue = ($TargetBaseDir ne ".") ? "$PkgBaseDir/$TargetBaseDir" : $PkgBaseDir;
7140
    }
7112
    }
7141
    $filename = $targetValue . '/' . $filename;
7113
    $filename = $targetValue . '/' . $filename;
7142
    
7114
    
7143
 
7115
 
7144
    #
7116
    #