Subversion Repositories DevTools

Rev

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

Rev 2449 Rev 2476
Line 68... Line 68...
68
my $opt_workDir = '/work';
68
my $opt_workDir = '/work';
69
my $opt_vobMap;
69
my $opt_vobMap;
70
my $opt_preserveProjectBase;
70
my $opt_preserveProjectBase;
71
my $opt_ignoreProjectBaseErrors;
71
my $opt_ignoreProjectBaseErrors;
72
my $opt_ignoreMakeProjectErrors;
72
my $opt_ignoreMakeProjectErrors;
-
 
73
my $opt_ignoreBadPaths;
73
my $opt_delete;
74
my $opt_delete;
74
my $opt_recentAge = 14;             # Days
75
my $opt_recentAge = 14;             # Days
75
my $opt_relabel = 0;
76
my $opt_relabel = 0;
76
my $opt_protected;
77
my $opt_protected;
77
my $opt_useSvn = 1;
78
my $opt_useSvn = 1;
78
my $opt_testRmDatabase;
79
my $opt_testRmDatabase;
-
 
80
my $opt_extractFromSvn;
79
 
81
 
80
################################################################################
82
################################################################################
81
#   List of Projects Suffixes and Branch Names to be used within SVN
83
#   List of Projects Suffixes and Branch Names to be used within SVN
82
#
84
#
83
#       Name        - Name of branch for the project
85
#       Name        - Name of branch for the project
Line 158... Line 160...
158
    'WinCEDeviceAutoInject'   => ',IgnoreMakeProject,',  # Looks OK
160
    'WinCEDeviceAutoInject'   => ',IgnoreMakeProject,',  # Looks OK
159
    'WinCEReboot'             => ',IgnoreMakeProject,',  # Looks OK
161
    'WinCEReboot'             => ',IgnoreMakeProject,',  # Looks OK
160
 
162
 
161
 
163
 
162
    'ftp'                   => 'SetProjectBase,',
164
    'ftp'                   => 'SetProjectBase,',
163
    'ddu_app_manager'       => 'SetProjectBase,',
165
    'ddu_app_manager'       => 'SetProjectBase,IgnoreMakeProject,',
164
    'ddu_afc'               => 'SetProjectBase,IgnoreMakeProject,',
166
    'ddu_afc'               => 'SetProjectBase,IgnoreMakeProject,',
-
 
167
    'ddu_dog'               => 'IgnoreMakeProject,',
165
 
168
 
166
    'icl'                   => 'IgnoreProjectBase,',
169
    'icl'                   => 'IgnoreProjectBase,',
167
    'itso'                  => 'IgnoreProjectBase,',
170
    'itso'                  => 'IgnoreProjectBase,',
168
#    'daf_osa_mos'           => 'IgnoreProjectBase,',
171
#    'daf_osa_mos'           => 'IgnoreProjectBase,',
169
    'daf_utils_mos'         => 'IgnoreProjectBase,',
172
    'daf_utils_mos'         => 'IgnoreProjectBase,',
Line 252... Line 255...
252
my $processCount = 0;
255
my $processCount = 0;
253
my $processTotal = 0;
256
my $processTotal = 0;
254
my $recentCount = 0;
257
my $recentCount = 0;
255
my $packageReLabelCount = 0;
258
my $packageReLabelCount = 0;
256
my %saneLabels;
259
my %saneLabels;
-
 
260
my $adjustedPath = 0;
257
 
261
 
258
our $GBE_RM_URL;
262
our $GBE_RM_URL;
259
my $UNIX = $ENV{'GBE_UNIX'};
263
my $UNIX = $ENV{'GBE_UNIX'};
260
 
264
 
261
my $result = GetOptions (
265
my $result = GetOptions (
Line 280... Line 284...
280
                "postimage!"    => \$opt_postimage,
284
                "postimage!"    => \$opt_postimage,
281
                'workdir:s'     => \$opt_workDir,
285
                'workdir:s'     => \$opt_workDir,
282
                'relabel!'      => \$opt_relabel,
286
                'relabel!'      => \$opt_relabel,
283
                'svn!'          => \$opt_useSvn,
287
                'svn!'          => \$opt_useSvn,
284
                'testRmDatabase'    => \$opt_testRmDatabase,
288
                'testRmDatabase'    => \$opt_testRmDatabase,
-
 
289
                'fromSvn!'          => \$opt_extractFromSvn,
285
                );
290
                );
286
 
291
 
287
#
292
#
288
#   Process help and manual options
293
#   Process help and manual options
289
#
294
#
Line 654... Line 659...
654
 
659
 
655
        if ( index( $data, 'IgnoreMakeProject,' ) >= 0) {
660
        if ( index( $data, 'IgnoreMakeProject,' ) >= 0) {
656
            $opt_ignoreMakeProjectErrors = 1;
661
            $opt_ignoreMakeProjectErrors = 1;
657
            Message ("Ignore MakeProject Usage");
662
            Message ("Ignore MakeProject Usage");
658
        }
663
        }
659
        
-
 
660
 
664
 
-
 
665
        if ( index( $data, 'IgnoreBadPath,' ) >= 0) {
-
 
666
            $opt_ignoreBadPaths = 1;
-
 
667
            Message ("Ignore Bad Paths in makefilest Usage");
-
 
668
        }
-
 
669
        
661
        if ( index( $data, 'utf8,' ) >= 0) {
670
        if ( index( $data, 'utf8,' ) >= 0) {
662
            $mustConvertFileNames = 1;
671
            $mustConvertFileNames = 1;
663
            Message ("Convert filenames to UTF8");
672
            Message ("Convert filenames to UTF8");
664
        }
673
        }
665
    }
674
    }
Line 1678... Line 1687...
1678
#
1687
#
1679
sub newPackageVersionBody
1688
sub newPackageVersionBody
1680
{
1689
{
1681
    my ($data, $entry) = @_;
1690
    my ($data, $entry) = @_;
1682
    my $rv;
1691
    my $rv;
-
 
1692
    my $vcs_type;
1683
    my $cc_label;
1693
    my $cc_label;
1684
    my $cc_path;
1694
    my $cc_path;
1685
    my $cc_path_original;
1695
    my $cc_path_original;
1686
 
1696
 
1687
    #
1697
    #
Line 1719... Line 1729...
1719
        return 1;
1729
        return 1;
1720
    }
1730
    }
1721
 
1731
 
1722
 
1732
 
1723
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
1733
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
-
 
1734
    $vcs_type = $1;
1724
    $cc_label = $4;
1735
    $cc_label = $4;
1725
    $cc_path = $2;
1736
    $cc_path = $2;
1726
    $cc_path = '/' . $cc_path;
1737
    $cc_path = '/' . $cc_path;
1727
    $cc_path =~ tr~\\/~/~s;
1738
    $cc_path =~ tr~\\/~/~s;
1728
    $cc_path_original = $cc_path;
1739
    $cc_path_original = $cc_path;
1729
 
1740
 
1730
    #
1741
    #
1731
    #   Correct well known path mistakes
1742
    #   Correct well known path mistakes in CC paths
1732
    #
1743
    #
1733
    $cc_path =~ s~/build.pl$~~i;
-
 
1734
    $cc_path =~ s~/src$~~i;
-
 
1735
    $cc_path =~ s~/cpp$~~i;
-
 
1736
    $cc_path =~ s~/MASS_Dev/Infra/~/MASS_Dev_Infra/~i;
-
 
1737
    $cc_path =~ s~/MASS_Dev/Tools/~/MASS_Dev_Tools/~i;
-
 
1738
    $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
-
 
1739
    $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
-
 
1740
    $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
-
 
1741
    $cc_path =~ s~/MREF_../MREF_Package/~/MREF_Package/~i;
-
 
1742
    $cc_path =~ s~/MREF_Package/mass_ergocdp/~/MREF_Package/ergocdp/~i;
-
 
1743
    $cc_path =~ s~/MASS_Dev_Bus/CBP/systemCD.ejb~/MASS_Dev_Bus/CBP/systemCD/ejb~i;
-
 
1744
    $cc_path =~ s~/MASS_Dev_Bus/Financial/cpp/paymentmanager~/MASS_Dev_Bus/Financial/cpp/paymentmanager~i;
-
 
1745
    $cc_path =~ s~/MASS_Dev_Bus/WebServices~/MASS_Dev_Bus/WebServices~i;
-
 
1746
    $cc_path =~ s~/MASS_Dev_Bus/CBP/nullAdapter~//MASS_Dev_Bus/CBP/nullAdaptor~i;
-
 
1747
 
-
 
1748
    $cc_path = '/MASS_Dev_Bus' if ( $cc_path =~ m~/MASS_Dev_Bus/ImageCapture(/|$)~i );
-
 
1749
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'EJBEnqPxyConnector');
-
 
1750
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'proxyif4j');
-
 
1751
    $cc_path = '/MASS_Dev_Bus' if ( $versions{$entry}{name} eq 'ImageCaptureTomcatDeployment');
-
 
1752
    $cc_path = '/MASS_Dev_Bus/WebServices/MassWS' if ( $versions{$entry}{name} eq 'MassWebServicesImpl');
-
 
1753
 
-
 
1754
    if (   $versions{$entry}{name} =~ m/^ERGagency$/i
-
 
1755
        || $versions{$entry}{name} =~ m/^ERGavm$/i
-
 
1756
        || $versions{$entry}{name} =~ m/^ERGboi$/i
-
 
1757
        || $versions{$entry}{name} =~ m/^ERGcallcenter$/i
-
 
1758
        || $versions{$entry}{name} =~ m/^ERGcardholder$/i
-
 
1759
        || $versions{$entry}{name} =~ m/^ERGcdaimports$/i
-
 
1760
        || $versions{$entry}{name} =~ m/^ERGcda$/i
-
 
1761
        || $versions{$entry}{name} =~ m/^ERGcscedit$/i
-
 
1762
        || $versions{$entry}{name} =~ m/^ERGcs$/i
-
 
1763
        || $versions{$entry}{name} =~ m/^ERGofs$/i
-
 
1764
        || $versions{$entry}{name} =~ m/^ERGols$/i
-
 
1765
        || $versions{$entry}{name} =~ m/^ERGtpf$/i
-
 
1766
        || $versions{$entry}{name} =~ m/^ERGorasys$/i
-
 
1767
        || $versions{$entry}{name} =~ m/^ERGoracs$/i
-
 
1768
        || $versions{$entry}{name} =~ m/^ERGpxyif$/i
-
 
1769
        || $versions{$entry}{name} =~ m/^ERGtp5upg$/i
-
 
1770
        || $versions{$entry}{name} =~ m/^ERGinstitutional$/i
-
 
1771
        || $versions{$entry}{name} =~ m/^ERGinfra$/i
-
 
1772
        || $versions{$entry}{name} =~ m/^ERGcrrpts$/i
-
 
1773
        || $versions{$entry}{name} =~ m/^ERGmiddle$/i
-
 
1774
        || $versions{$entry}{name} =~ m/^ERGmiddleapi$/i
-
 
1775
        || $versions{$entry}{name} =~ m/^ERGwebapi$/i
-
 
1776
        || $versions{$entry}{name} =~ m/^ERGwebtestui$/i
-
 
1777
        || $versions{$entry}{name} =~ m/^ERGwebesbui$/i
-
 
1778
        || $versions{$entry}{name} =~ m/^ERGwspiv$/i
-
 
1779
        || $versions{$entry}{name} =~ m/^ERGwscst$/i
-
 
1780
        || $versions{$entry}{name} =~ m/^sposMUG$/i
-
 
1781
        || $versions{$entry}{name} =~ m/^ERGfinman$/i
-
 
1782
        || $versions{$entry}{name} =~ m/^ERGkm$/i
-
 
1783
        || $versions{$entry}{name} =~ m/^ERGxml$/i
-
 
1784
        || $versions{$entry}{name} =~ m/^ERGoradacw$/i
-
 
1785
        || $versions{$entry}{name} =~ m/^ERGtru$/i
-
 
1786
        )
-
 
1787
    {
-
 
1788
        $cc_path = '/MREF_Package';
1744
    if ( $vcs_type eq 'CC' )
1789
    }
-
 
1790
 
-
 
1791
    if (   $versions{$entry}{name} =~ m/^tp5000_MUG$/i )
-
 
1792
    {
1745
    {
-
 
1746
        $cc_path =~ s~/build.pl$~~i;
-
 
1747
        $cc_path =~ s~/src$~~i;
-
 
1748
        $cc_path =~ s~/cpp$~~i;
-
 
1749
        $cc_path =~ s~/MASS_Dev/Infra/~/MASS_Dev_Infra/~i;
-
 
1750
        $cc_path =~ s~/MASS_Dev/Tools/~/MASS_Dev_Tools/~i;
-
 
1751
        $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
-
 
1752
        $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
-
 
1753
        $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
-
 
1754
        $cc_path =~ s~/MREF_../MREF_Package/~/MREF_Package/~i;
-
 
1755
        $cc_path =~ s~/MREF_Package/mass_ergocdp/~/MREF_Package/ergocdp/~i;
-
 
1756
        $cc_path =~ s~/MASS_Dev_Bus/CBP/systemCD.ejb~/MASS_Dev_Bus/CBP/systemCD/ejb~i;
-
 
1757
        $cc_path =~ s~/MASS_Dev_Bus/Financial/cpp/paymentmanager~/MASS_Dev_Bus/Financial/cpp/paymentmanager~i;
-
 
1758
        $cc_path =~ s~/MASS_Dev_Bus/WebServices~/MASS_Dev_Bus/WebServices~i;
-
 
1759
        $cc_path =~ s~/MASS_Dev_Bus/CBP/nullAdapter~//MASS_Dev_Bus/CBP/nullAdaptor~i;
-
 
1760
 
-
 
1761
        $cc_path = '/MASS_Dev_Bus' if ( $cc_path =~ m~/MASS_Dev_Bus/ImageCapture(/|$)~i );
-
 
1762
        $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'EJBEnqPxyConnector');
-
 
1763
        $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'proxyif4j');
-
 
1764
        $cc_path = '/MASS_Dev_Bus' if ( $versions{$entry}{name} eq 'ImageCaptureTomcatDeployment');
-
 
1765
        $cc_path = '/MASS_Dev_Bus/WebServices/MassWS' if ( $versions{$entry}{name} eq 'MassWebServicesImpl');
-
 
1766
 
-
 
1767
        if (   $versions{$entry}{name} =~ m/^ERGagency$/i
-
 
1768
            || $versions{$entry}{name} =~ m/^ERGavm$/i
-
 
1769
            || $versions{$entry}{name} =~ m/^ERGboi$/i
-
 
1770
            || $versions{$entry}{name} =~ m/^ERGcallcenter$/i
-
 
1771
            || $versions{$entry}{name} =~ m/^ERGcardholder$/i
-
 
1772
            || $versions{$entry}{name} =~ m/^ERGcdaimports$/i
-
 
1773
            || $versions{$entry}{name} =~ m/^ERGcda$/i
-
 
1774
            || $versions{$entry}{name} =~ m/^ERGcscedit$/i
-
 
1775
            || $versions{$entry}{name} =~ m/^ERGcs$/i
-
 
1776
            || $versions{$entry}{name} =~ m/^ERGofs$/i
-
 
1777
            || $versions{$entry}{name} =~ m/^ERGols$/i
-
 
1778
            || $versions{$entry}{name} =~ m/^ERGtpf$/i
-
 
1779
            || $versions{$entry}{name} =~ m/^ERGorasys$/i
-
 
1780
            || $versions{$entry}{name} =~ m/^ERGoracs$/i
-
 
1781
            || $versions{$entry}{name} =~ m/^ERGpxyif$/i
-
 
1782
            || $versions{$entry}{name} =~ m/^ERGtp5upg$/i
-
 
1783
            || $versions{$entry}{name} =~ m/^ERGinstitutional$/i
-
 
1784
            || $versions{$entry}{name} =~ m/^ERGinfra$/i
-
 
1785
            || $versions{$entry}{name} =~ m/^ERGcrrpts$/i
-
 
1786
            || $versions{$entry}{name} =~ m/^ERGmiddle$/i
-
 
1787
            || $versions{$entry}{name} =~ m/^ERGmiddleapi$/i
-
 
1788
            || $versions{$entry}{name} =~ m/^ERGwebapi$/i
-
 
1789
            || $versions{$entry}{name} =~ m/^ERGwebtestui$/i
-
 
1790
            || $versions{$entry}{name} =~ m/^ERGwebesbui$/i
-
 
1791
            || $versions{$entry}{name} =~ m/^ERGwspiv$/i
-
 
1792
            || $versions{$entry}{name} =~ m/^ERGwscst$/i
-
 
1793
            || $versions{$entry}{name} =~ m/^sposMUG$/i
-
 
1794
            || $versions{$entry}{name} =~ m/^ERGfinman$/i
1793
        if ( $versions{$entry}{version} =~ m~vtk$~ )
1795
            || $versions{$entry}{name} =~ m/^ERGkm$/i
-
 
1796
            || $versions{$entry}{name} =~ m/^ERGxml$/i
-
 
1797
            || $versions{$entry}{name} =~ m/^ERGoradacw$/i
-
 
1798
            || $versions{$entry}{name} =~ m/^ERGtru$/i
-
 
1799
            )
1794
        {
1800
        {
1795
            $cc_path = '/MREF_Package';
1801
            $cc_path = '/MREF_Package';
1796
        }
1802
        }
1797
    }
-
 
1798
 
1803
 
-
 
1804
        if (   $versions{$entry}{name} =~ m/^tp5000_MUG$/i )
-
 
1805
        {
-
 
1806
            if ( $versions{$entry}{version} =~ m~vtk$~ )
-
 
1807
            {
-
 
1808
                $cc_path = '/MREF_Package';
-
 
1809
            }
-
 
1810
        }
-
 
1811
 
1799
    if ( $cc_path_original ne $cc_path )
1812
        if ( $cc_path_original ne $cc_path )
1800
    {
1813
        {
1801
            Message ("Package: $versions{$entry}{name}. Forcing CC path to: $cc_path" );
1814
                Message ("Package: $versions{$entry}{name}. Forcing CC path to: $cc_path" );
-
 
1815
        }
1802
    }
1816
    }
1803
    
1817
    
1804
#print "--- Path: $cc_path, Label: $cc_label\n";
1818
#print "--- Path: $cc_path, Label: $cc_label\n";
1805
 
1819
 
-
 
1820
    if ( $vcs_type eq 'SVN' )
1806
    #
1821
    {
-
 
1822
        $rv = extractFilesFromSubversion( $data, $entry );
-
 
1823
        return $rv if ( $rv );
-
 
1824
    }
-
 
1825
    else
-
 
1826
    {
-
 
1827
        #
1807
    #   Create CC view
1828
        #   Create CC view
1808
    #   Import into Subversion View
1829
        #   Import into Subversion View
1809
    #
1830
        #
1810
    $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
1831
        $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
1811
    return $rv if ( $rv );
1832
        return $rv if ( $rv );
-
 
1833
    }
1812
 
1834
 
1813
    #
1835
    #
1814
    #   Developers have been slack
1836
    #   Developers have been slack
1815
    #       Sometime the mark the source path as 'GMTPE2005'
1837
    #       Sometime the mark the source path as 'GMTPE2005'
1816
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
1838
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
Line 1829... Line 1851...
1829
        unless ( $data->{ViewPath} eq $testDir  )
1851
        unless ( $data->{ViewPath} eq $testDir  )
1830
        {
1852
        {
1831
            Message ("Adjust Base Dir: $testDir");
1853
            Message ("Adjust Base Dir: $testDir");
1832
            $data->{adjustedPath} = $data->{ViewPath};
1854
            $data->{adjustedPath} = $data->{ViewPath};
1833
            $data->{ViewPath} = $testDir;
1855
            $data->{ViewPath} = $testDir;
-
 
1856
            $adjustedPath++;
1834
        }
1857
        }
1835
    }
1858
    }
1836
    Message ("BaseDir: $data->{ViewPath}");
1859
    Message ("BaseDir: $data->{ViewPath}");
-
 
1860
 
1837
    
1861
    #
-
 
1862
    #   Check for bad source paths
-
 
1863
    #
-
 
1864
    if (detectBadMakePaths($data) )
-
 
1865
    {
-
 
1866
        unless ( $opt_ignoreBadPaths )
-
 
1867
        {
-
 
1868
            $data->{BadPath}++;
-
 
1869
            $data->{errStr} = 'Bad Paths in Makefile';
-
 
1870
            return 4;           # Lets see what the others look like too
-
 
1871
#            return 14;
-
 
1872
        }
-
 
1873
    }
-
 
1874
 
1838
    #
1875
    #
1839
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1876
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1840
    #   Detect such packages as we will need to handle them differently
1877
    #   Detect such packages as we will need to handle them differently
1841
    #   Can't really handle it on the fly
1878
    #   Can't really handle it on the fly
1842
    #   All we can do is detect it and report it - at the moment
1879
    #   All we can do is detect it and report it - at the moment
Line 1861... Line 1898...
1861
    #       Vob Name is not a part of the migration
1898
    #       Vob Name is not a part of the migration
1862
    #       If we 'SuckUp' empty directories then this may break
1899
    #       If we 'SuckUp' empty directories then this may break
1863
    #       the pathing.
1900
    #       the pathing.
1864
    #   All we can do is detect it and report it - at the moment
1901
    #   All we can do is detect it and report it - at the moment
1865
    #
1902
    #
1866
    if (detectMakeProjectUsage($data, $cc_path) )
1903
    if (detectMakeProjectUsage($data) )
1867
    {
1904
    {
1868
        unless ( $opt_ignoreMakeProjectErrors )
1905
        unless ( $opt_ignoreMakeProjectErrors )
1869
        {
1906
        {
1870
            $data->{BadMakeProject}++;
1907
            $data->{BadMakeProject}++;
1871
            $data->{errStr} = 'Use of MakeProject detected';
1908
            $data->{errStr} = 'Use of MakeProject detected';
Line 1909... Line 1946...
1909
    #   Now we can create the SVN package and branching point before we
1946
    #   Now we can create the SVN package and branching point before we
1910
    #   import the CC data into SVN
1947
    #   import the CC data into SVN
1911
    #
1948
    #
1912
    if ( !$opt_useSvn )
1949
    if ( !$opt_useSvn )
1913
    {
1950
    {
1914
            $data->{errStr} = 'Subversion Import disabled';
1951
            $data->{errStr} = 'Subversion Import disabled' unless $data->{errStr};
1915
            return 5;
1952
            return 5;
1916
    }
1953
    }
1917
 
1954
 
1918
    my @args;
1955
    my @args;
1919
 
1956
 
Line 2337... Line 2374...
2337
#
2374
#
2338
sub endPackage
2375
sub endPackage
2339
{
2376
{
2340
    Message ("-- Import Summary ------------------------------------------------" );
2377
    Message ("-- Import Summary ------------------------------------------------" );
2341
    RmDirTree ('SvnImportDir');
2378
    RmDirTree ('SvnImportDir');
-
 
2379
    my $processedCount = 0;
-
 
2380
    my $inernalErrorCount = 0;
-
 
2381
    my $notProcessedCount = 0;
-
 
2382
    my $badPathCount = 0;
-
 
2383
    my $badProjectBaseCount = 0;
-
 
2384
    my $badMakeProjectCount = 0;
2342
 
2385
 
2343
    #
2386
    #
2344
    #   Display versions that did get captured
2387
    #   Display versions that did get captured
2345
    #
2388
    #
2346
    foreach my $entry ( @processOrder )
2389
    foreach my $entry ( @processOrder )
Line 2354... Line 2397...
2354
    #   Display versions that did not get created
2397
    #   Display versions that did not get created
2355
    #
2398
    #
2356
    foreach my $entry ( @processOrder )
2399
    foreach my $entry ( @processOrder )
2357
    {
2400
    {
2358
        $versions{$entry}{Scanned} = 1;
2401
        $versions{$entry}{Scanned} = 1;
2359
        next if ( $versions{$entry}{TagCreated} );
2402
        if ( $versions{$entry}{TagCreated} )
-
 
2403
        {
-
 
2404
            $processedCount++;
-
 
2405
            $badPathCount++ if ($versions{$entry}{data}{BadPath} );
-
 
2406
            $badProjectBaseCount++ if ($versions{$entry}{data}{BadProjectBase} );
-
 
2407
            $badMakeProjectCount++ if ($versions{$entry}{data}{BadMakeProject} );
-
 
2408
            next;
-
 
2409
        }
-
 
2410
 
2360
        my $reason = $versions{$entry}{data}{errStr} || '';
2411
        my $reason = $versions{$entry}{data}{errStr} || '';
2361
        my $tag = $versions{$entry}{vcsTag}|| 'No Tag';
2412
        my $tag = $versions{$entry}{vcsTag}|| 'No Tag';
2362
        Warning ("Not Processed: " . GetVname($entry) . ':' . $tag . ' : ' . $reason );
2413
        Warning ("Not Processed: " . GetVname($entry) . ':' . $tag . ' : ' . $reason );
-
 
2414
        $notProcessedCount++;
2363
    }
2415
    }
2364
 
2416
 
2365
    foreach my $entry ( keys(%versions) )
2417
    foreach my $entry ( keys(%versions) )
2366
    {
2418
    {
2367
        next if ( $versions{$entry}{Scanned} );
2419
        next if ( $versions{$entry}{Scanned} );
2368
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
2420
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
-
 
2421
        $inernalErrorCount++;
2369
    }
2422
    }
2370
 
2423
 
-
 
2424
    if ( $adjustedPath || 1 )
-
 
2425
    {
-
 
2426
        Information ("Package Paths");
-
 
2427
        foreach my $entry ( @processOrder )
-
 
2428
        {
-
 
2429
            my $viewPath = $versions{$entry}{data}{ViewPath} || '';
-
 
2430
            Information (sprintf "ViewPath: %20s : %s", GetVname($entry), $viewPath);
-
 
2431
        }
-
 
2432
    }
-
 
2433
 
-
 
2434
    Message ("Packages processed: $processedCount");
-
 
2435
    Warning ("Packages not processed: $notProcessedCount") if ( $notProcessedCount );
-
 
2436
    Warning ("Internal Errors: $inernalErrorCount") if ( $inernalErrorCount );
2371
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
2437
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
-
 
2438
    Warning ("Packages with Bad Paths: $badPathCount") if ( $badPathCount );
-
 
2439
    Warning ("Packages with Bad ProjectBase: $badProjectBaseCount") if ( $badProjectBaseCount );
-
 
2440
    Warning ("Packages with MakeProjects: $badMakeProjectCount") if ( $badMakeProjectCount );
-
 
2441
    Warning ("Global Error Detected") if ( $globalError );
2372
    Message ("All Done");
2442
    Message ("All Done");
2373
}
2443
}
2374
 
2444
 
2375
#-------------------------------------------------------------------------------
2445
#-------------------------------------------------------------------------------
2376
# Function        : extractFilesFromClearCase
2446
# Function        : extractFilesFromClearCase
Line 2482... Line 2552...
2482
    return 2;
2552
    return 2;
2483
 
2553
 
2484
}
2554
}
2485
 
2555
 
2486
#-------------------------------------------------------------------------------
2556
#-------------------------------------------------------------------------------
-
 
2557
# Function        : extractFilesFromSubversion
-
 
2558
#
-
 
2559
# Description     : Extract files from Subversion
-
 
2560
#                   May take a while as we handle nasty errors
-
 
2561
#
-
 
2562
# Inputs          : $data           - Hash of good stuff from newPackageVersionBody
-
 
2563
#                   $entry          - All the PV information
-
 
2564
#
-
 
2565
# Returns         : exit code
-
 
2566
#                   Sets up
-
 
2567
#                       $data->{errStr}
-
 
2568
#                       $data->{errCode}
-
 
2569
#                   As per newPackageVersionBody
-
 
2570
#
-
 
2571
sub extractFilesFromSubversion
-
 
2572
{
-
 
2573
    my ($data, $entry ) = @_;
-
 
2574
    my $tryCount = 0;
-
 
2575
    my $rv = 99;
-
 
2576
 
-
 
2577
    #
-
 
2578
    #   Create a nice name for the import
-
 
2579
    #
-
 
2580
    my $import_label = saneLabel($entry);
-
 
2581
    
-
 
2582
 
-
 
2583
    $data->{ViewRoot} = $opt_name ? $opt_name : $import_label;
-
 
2584
    $data->{ViewPath} =  $data->{ViewRoot};
-
 
2585
    $data->{ViewPath} =~  tr~/~/~s;
-
 
2586
 
-
 
2587
    if ( $opt_reuse && -d $data->{ViewPath}  )
-
 
2588
    {
-
 
2589
        Message ("Reusing view: $import_label");
-
 
2590
        return 0;
-
 
2591
    }
-
 
2592
 
-
 
2593
    #
-
 
2594
    #   Only allow import from SVN if asked nicely
-
 
2595
    #   May be used if we are correcting a package - and some have been
-
 
2596
    #   placed in SVN
-
 
2597
    #
-
 
2598
    unless ( $opt_extractFromSvn )
-
 
2599
    {
-
 
2600
        $data->{errStr} = 'Some Packages are in SVN';
-
 
2601
        return 15;
-
 
2602
    }
-
 
2603
    
-
 
2604
 
-
 
2605
#print "--- ViewRoot: $data->{ViewPath}\n";
-
 
2606
    $rv = JatsToolPrint ( 'jats_svnrelease',
-
 
2607
                          '-extractfiles',
-
 
2608
                          '-root=.' ,
-
 
2609
                          '-noprefix',
-
 
2610
                          '-DevMode=escrow',
-
 
2611
                          '-label', $data->{tag},
-
 
2612
                          '-view', $data->{ViewPath},
-
 
2613
                );
-
 
2614
 
-
 
2615
    if ( $rv == 10 ) {
-
 
2616
        $data->{errStr}  = 'No Files in the extracted view';
-
 
2617
        $data->{errCode} = '0';
-
 
2618
        return 2;
-
 
2619
 
-
 
2620
    } elsif ( $rv == 11 ) {
-
 
2621
        $data->{errStr} = 'Label not found';
-
 
2622
        $data->{errCode} = 'L';
-
 
2623
        return 2;
-
 
2624
    } elsif ( $rv ) {
-
 
2625
        $data->{errStr} = 'Subversion reported error';
-
 
2626
        return 2;
-
 
2627
    }
-
 
2628
 
-
 
2629
    unless ( -d $data->{ViewPath}  )
-
 
2630
    {
-
 
2631
        $data->{errStr} = 'Failed to extract files from Subversion';
-
 
2632
        return 2;
-
 
2633
    }
-
 
2634
 
-
 
2635
    #
-
 
2636
    #   Looks good
-
 
2637
    #
-
 
2638
    return 0;
-
 
2639
}
-
 
2640
 
-
 
2641
#-------------------------------------------------------------------------------
2487
# Function        : detectMakeProjectUsage
2642
# Function        : detectMakeProjectUsage
2488
#
2643
#
2489
# Description     : etect and report usage of the MakeProject directive
2644
# Description     : etect and report usage of the MakeProject directive
2490
#
2645
#
2491
# Inputs          : $data               - Ref to a hash of bits
2646
# Inputs          : $data               - Ref to a hash of bits
2492
#                   $cc_path            - Packages cc_path
-
 
2493
#
2647
#
2494
# Returns         : true    - Bad usage (Really good usage not detected)
2648
# Returns         : true    - Bad usage (Really good usage not detected)
2495
#                   false   - Good usage detected
2649
#                   false   - Good usage detected
2496
#
2650
#
2497
sub detectMakeProjectUsage
2651
sub detectMakeProjectUsage
2498
{
2652
{
2499
    my ($data, $cc_path) = @_;
2653
    my ($data) = @_;
2500
    my $retval = 0;
2654
    my $retval = 0;
2501
    my $eSuf = $opt_ignoreMakeProjectErrors ? '' : 'Error';
2655
    my $eSuf = $opt_ignoreMakeProjectErrors ? '' : 'Error';
2502
 
2656
 
2503
    #
2657
    #
2504
    #   Find makefile.pl
2658
    #   Find makefile.pl
2505
    #
2659
    #
2506
    Message ("Locate JATS makefiles");
2660
    Message ("Detect MakeProject Usage");
2507
    my $usesMakeProject = 0;
2661
    my $usesMakeProject = 0;
2508
    my $badIncludeFile = 0;
2662
    my $badIncludeFile = 0;
2509
 
2663
 
2510
    my $search = JatsLocateFiles->new("--Recurse=1",
2664
    my $search = JatsLocateFiles->new("--Recurse=1",
2511
                                       "--FilterIn=makefile.pl",
2665
                                       "--FilterIn=makefile.pl",
Line 2566... Line 2720...
2566
                        $myProjectDir = $myProject;
2720
                        $myProjectDir = $myProject;
2567
                        $myProjectDir =~ s~/[^/]+$~~;
2721
                        $myProjectDir =~ s~/[^/]+$~~;
2568
                        last;
2722
                        last;
2569
                    }
2723
                    }
2570
                    Error ("No project Found") unless ( defined $myProjectDir);
2724
                    Error ("No project Found") unless ( defined $myProjectDir);
-
 
2725
 
-
 
2726
                    #
-
 
2727
                    #   Look for 'include.txt' that may be bwteen the makefile and the project
-
 
2728
                    #
-
 
2729
 
-
 
2730
 
2571
                    if ( -f "$myProjectDir/include.txt" )
2731
                    if ( -f "$myProjectDir/include.txt" )
2572
                    {
2732
                    {
2573
                        Warning ("Co-located 'include.txt' file also found");
2733
                        Warning ("Co-located 'include.txt' file also found");
2574
                    }
2734
                    }
2575
 
2735
 
Line 2673... Line 2833...
2673
    
2833
    
2674
    return $retval;
2834
    return $retval;
2675
}
2835
}
2676
 
2836
 
2677
#-------------------------------------------------------------------------------
2837
#-------------------------------------------------------------------------------
-
 
2838
# Function        : detectBadMakePaths
-
 
2839
#
-
 
2840
# Description     : Detect and report bad usage of some directives
-
 
2841
#
-
 
2842
# Inputs          : $data               - Ref to a hash of bits
-
 
2843
#
-
 
2844
# Returns         : true    - Bad usage (Really good usage not detected)
-
 
2845
#                   false   - Good usage detected
-
 
2846
#
-
 
2847
sub detectBadMakePaths
-
 
2848
{
-
 
2849
    my ($data) = @_;
-
 
2850
    my $retval = 0;
-
 
2851
    my $eSuf = $opt_ignoreBadPaths ? '' : 'Error';
-
 
2852
 
-
 
2853
    #
-
 
2854
    #   Find makefile.pl
-
 
2855
    #
-
 
2856
    Message ("Detect Bad Source Paths");
-
 
2857
    my $badPath = 0;
-
 
2858
 
-
 
2859
    my $search = JatsLocateFiles->new("--Recurse=1",
-
 
2860
                                       "--FilterIn=makefile.pl",
-
 
2861
                                       );
-
 
2862
    my @makefiles = $search->search($data->{ViewPath});
-
 
2863
    foreach my $file ( @makefiles )
-
 
2864
    {
-
 
2865
        $file =~ tr~/~/~s;
-
 
2866
        my $max_up = ($file =~ tr~/~/~);
-
 
2867
        my $shownPath;
-
 
2868
#print "---Reading: $workDir/$data->{ViewPath}/$file\n";
-
 
2869
        if ( open( my $fh, '<', "$data->{ViewPath}/$file" ) )
-
 
2870
        {
-
 
2871
            my $eof = 0;
-
 
2872
            my $line = '';
-
 
2873
 
-
 
2874
            until ( $eof )
-
 
2875
            {
-
 
2876
                my $in = <$fh>;
-
 
2877
                unless ( defined $in )
-
 
2878
                {
-
 
2879
                    $eof = 1;
-
 
2880
                }
-
 
2881
                else
-
 
2882
                {
-
 
2883
                $in =~ s~\s+$~~;
-
 
2884
                $in =~ s~^\s+~~;
-
 
2885
                $in =~ s~^#.*$~~;
-
 
2886
                $in =~ s~\s*[^\$]#.*$~~;
-
 
2887
                $line .= ' ' if ( $line );
-
 
2888
                $line .= $in;
-
 
2889
                $line =~ s~\s+~ ~g;
-
 
2890
#print "====== '$line'\n";
-
 
2891
                redo unless ( $line =~ m~;$~  );
-
 
2892
                }
-
 
2893
                if ( $line =~ m~^AddDir~ || $line =~ m~^AddSrcDir~ || $line =~ m~^AddIncDir~ || $line =~ m~^Src~ )
-
 
2894
                {
-
 
2895
                    #
-
 
2896
                    #   Extract out the arguments
-
 
2897
                    #
-
 
2898
                    my @myArgs;
-
 
2899
                    my $myProjectDir;
-
 
2900
                    my $myProject = "$data->{ViewRoot}/$file";
-
 
2901
                    $myProject =~ s~/[^/]+$~~;
-
 
2902
                    $line =~ s~.*\(~push \@myArgs, (~;
-
 
2903
                    eval $line;
-
 
2904
                    Error("Line did not compiler: $line", "Err: $@" ) if ($@);
-
 
2905
                    shift @myArgs;
-
 
2906
                    foreach ( @myArgs )
-
 
2907
                    {
-
 
2908
                        next if ( m~^--~ );
-
 
2909
                        next unless ( m~^\.\./~ );
-
 
2910
                        my $tmp = $_;
-
 
2911
                        $tmp =~ s~Z~z~g;
-
 
2912
                        $tmp =~ s~\.\./~Z~g;
-
 
2913
                        my $upCount = ( $tmp =~ tr~Z~Z~ );
-
 
2914
                        if ( $upCount > $max_up )
-
 
2915
                        {
-
 
2916
                            Warning ("Makefile Path: $file ") unless $shownPath;
-
 
2917
                            Warning ("Path escapes view: $max_up, $upCount, $_");
-
 
2918
                            $badPath++;
-
 
2919
                            $shownPath = 1;
-
 
2920
                        }
-
 
2921
#print "---x Path : $max_up, $upCount, $_\n";
-
 
2922
                    }
-
 
2923
                }
-
 
2924
                $line = '';
-
 
2925
            }
-
 
2926
            close $fh;
-
 
2927
        }
-
 
2928
        else
-
 
2929
        {
-
 
2930
            Warning ("detectBadMakePaths$eSuf - Cannot open makefile: $file");
-
 
2931
            $retval = 1;
-
 
2932
        }
-
 
2933
    }
-
 
2934
 
-
 
2935
    #
-
 
2936
    #   Used
-
 
2937
    #   May be improved latter
-
 
2938
    #
-
 
2939
    if ( $badPath )
-
 
2940
    {
-
 
2941
        Warning ("detectBadMakePaths$eSuf - Bad Path seen. Must check manually");
-
 
2942
        $retval = 1;
-
 
2943
    }
-
 
2944
    
-
 
2945
    return $retval;
-
 
2946
}
-
 
2947
 
-
 
2948
 
-
 
2949
#-------------------------------------------------------------------------------
2678
# Function        : detectProjectBaseUsage
2950
# Function        : detectProjectBaseUsage
2679
#
2951
#
2680
# Description     : Detect and report usage of the SetProjectBase directive
2952
# Description     : Detect and report usage of the SetProjectBase directive
2681
#
2953
#
2682
# Inputs          : $data               - Ref to a hash of bits
2954
# Inputs          : $data               - Ref to a hash of bits
Line 2691... Line 2963...
2691
    my $eSuf = $opt_ignoreProjectBaseErrors ? '' : 'Error';
2963
    my $eSuf = $opt_ignoreProjectBaseErrors ? '' : 'Error';
2692
 
2964
 
2693
    #
2965
    #
2694
    #   Find makefile.pl
2966
    #   Find makefile.pl
2695
    #
2967
    #
2696
    Message ("Locate JATS makefiles");
2968
    Message ("Detect ProjectBase Usage");
2697
    my $usesProjectBase = 0;
2969
    my $usesProjectBase = 0;
2698
    my $definesProjectBase = 0;
2970
    my $definesProjectBase = 0;
2699
    my $definitionError = 0;
2971
    my $definitionError = 0;
2700
 
2972
 
2701
    my $search = JatsLocateFiles->new("--Recurse=1",
2973
    my $search = JatsLocateFiles->new("--Recurse=1",
Line 4334... Line 4606...
4334
    -[no]postimage     - Create image after transger: Def: -post
4606
    -[no]postimage     - Create image after transger: Def: -post
4335
    -workdir=path      - Use for temp storage (def:/work)
4607
    -workdir=path      - Use for temp storage (def:/work)
4336
    -delete            - Delete SVN package before test
4608
    -delete            - Delete SVN package before test
4337
    -[no]relabel       - Attempt to relabel dirs in packages that don't extract
4609
    -[no]relabel       - Attempt to relabel dirs in packages that don't extract
4338
    -testRmDatabase    - Use test database
4610
    -testRmDatabase    - Use test database
-
 
4611
    -[no]fromSvn       - Also extract packages from SVN
4339
 
4612
 
4340
=head1 OPTIONS
4613
=head1 OPTIONS
4341
 
4614
 
4342
=over 8
4615
=over 8
4343
 
4616