Subversion Repositories DevTools

Rev

Rev 6863 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6863 Rev 6865
Line 70... Line 70...
70
#                       IsAlias                 - Flow control
70
#                       IsAlias                 - Flow control
71
#                       RpmSetDefAttr           - Specify default file properties (RPM Only)
71
#                       RpmSetDefAttr           - Specify default file properties (RPM Only)
72
#                       RpmSetAttr              - Specify file properties (RPM Only)    
72
#                       RpmSetAttr              - Specify file properties (RPM Only)    
73
#                       SetBaseDir              - Sets base for installed files (RPM Hint for directory ownership)
73
#                       SetBaseDir              - Sets base for installed files (RPM Hint for directory ownership)
74
#                       Section                 - Set current section
74
#                       Section                 - Set current section
-
 
75
#                       PackageVersion          - Return the version of a named package
75
#
76
#
76
#                 Thoughts for expansion:
77
#                 Thoughts for expansion:
77
#                       SrcDir                  - Extend path for resolving local files
78
#                       SrcDir                  - Extend path for resolving local files
78
#
79
#
79
#                   Less used:
80
#                   Less used:
Line 2704... Line 2705...
2704
sub IsTar()
2705
sub IsTar()
2705
{
2706
{
2706
    return $opt_tarFile ? 1 : 0;
2707
    return $opt_tarFile ? 1 : 0;
2707
}
2708
}
2708
 
2709
 
-
 
2710
#-------------------------------------------------------------------------------
-
 
2711
# Function        : PackageVersion 
-
 
2712
#
-
 
2713
# Description     : Return the version of the named package 
-
 
2714
#
-
 
2715
# Inputs          : pkgName - Name of the package 
-
 
2716
#                   Options
-
 
2717
#                       --format=SomeString. The text replacements
-
 
2718
#                           {VERSION}
-
 
2719
#                           {VERSIONNUMVER}
-
 
2720
#                           {PROJECT}
-
 
2721
#                           {NAME}
-
 
2722
#                           {TYPE}
-
 
2723
#                           {ARCH}
-
 
2724
#
-
 
2725
# Returns         : A string 
-
 
2726
#
-
 
2727
sub PackageVersion
-
 
2728
{
-
 
2729
    my ($pkgName, @args) = @_;
-
 
2730
    my ($version, $versionNumber, $project, $format);
-
 
2731
 
-
 
2732
    foreach ( @args)
-
 
2733
    {
-
 
2734
        if (m~^--format=(.+)~i) {
-
 
2735
            $format = $1
-
 
2736
        } else {
-
 
2737
            Error ("PackageVersion: Unknown option: $_")
-
 
2738
        }
-
 
2739
    }
-
 
2740
    
-
 
2741
    foreach my $entry ( getPackageList() )
-
 
2742
    {
-
 
2743
        if ($entry->getName() eq $pkgName ) {
-
 
2744
            $version = $entry->getVersion();
-
 
2745
            ($versionNumber = $version ) =~ s~\.[^.]+$~~;
-
 
2746
            ($project = $version ) =~ s~.*\.~~;
-
 
2747
            last;
-
 
2748
        }
-
 
2749
    }
-
 
2750
 
-
 
2751
    Error ("PackageVersion: $pkgName is not a dependent package") unless defined $version;
-
 
2752
 
-
 
2753
    #
-
 
2754
    #   Format the string
-
 
2755
    #
-
 
2756
    if ($format) {
-
 
2757
        $format =~ s~{NAME}~$pkgName~g;
-
 
2758
        $format =~ s~{VERSION}~$version~g;
-
 
2759
        $format =~ s~{VERSIONNUMBER}~$versionNumber~g;
-
 
2760
        $format =~ s~{PROJECT}~$project~g;
-
 
2761
        $format =~ s~{TYPE}~$opt_type~g;
-
 
2762
        $format =~ s~{ARCH}~$opt_pkgarch~g;
-
 
2763
        
-
 
2764
        $version = $format;
-
 
2765
    }
-
 
2766
 
-
 
2767
    return $version;
-
 
2768
}
-
 
2769
 
2709
 
2770
 
2710
#************ INTERNAL USE ONLY  **********************************************
2771
#************ INTERNAL USE ONLY  **********************************************
2711
# Function        : FindFiles
2772
# Function        : FindFiles
2712
#
2773
#
2713
# Description     : Locate files within a given dir tree
2774
# Description     : Locate files within a given dir tree