| 6887 |
dpurdie |
1 |
########################################################################
|
|
|
2 |
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
|
|
|
3 |
#
|
|
|
4 |
# Module name : rmMerge_process.pl
|
|
|
5 |
# Module type : JATS Utility
|
|
|
6 |
# Compiler(s) : Perl
|
|
|
7 |
# Environment(s): jats
|
|
|
8 |
#
|
|
|
9 |
# Description : Transfer a package from New dpkg_archive to the old dpkg_archive
|
|
|
10 |
#
|
|
|
11 |
#
|
|
|
12 |
# Usage : See POD at the end of this file
|
|
|
13 |
#
|
|
|
14 |
#......................................................................#
|
|
|
15 |
|
|
|
16 |
require 5.008_002;
|
|
|
17 |
use strict;
|
|
|
18 |
use warnings;
|
|
|
19 |
|
|
|
20 |
use Pod::Usage;
|
|
|
21 |
use Getopt::Long;
|
|
|
22 |
|
|
|
23 |
use JatsError;
|
|
|
24 |
use JatsRmApi;
|
|
|
25 |
use JatsSystem;
|
|
|
26 |
use FileUtils;
|
|
|
27 |
use ConfigurationFile;
|
|
|
28 |
use JatsProperties;
|
|
|
29 |
use File::Copy;
|
|
|
30 |
use DBI;
|
|
|
31 |
my $RM_DB;
|
|
|
32 |
|
|
|
33 |
my $opt_help=0;
|
|
|
34 |
my $opt_verbose=0;
|
|
|
35 |
my $opt_debug=0;
|
|
|
36 |
my $opt_replace;
|
|
|
37 |
|
|
|
38 |
my $VERSION = "1.0";
|
|
|
39 |
my $newDpkg = '/net/auawsaarc002/export/devl/dpkg_archive';
|
|
|
40 |
my $oldDpkg = '/export/devl/dpkg_archive';
|
|
|
41 |
|
|
|
42 |
my $pname;
|
|
|
43 |
my $pversion;
|
|
|
44 |
|
|
|
45 |
#-------------------------------------------------------------------------------
|
|
|
46 |
# Function : Mainline Entry Point
|
|
|
47 |
#
|
|
|
48 |
# Description :
|
|
|
49 |
#
|
|
|
50 |
# Inputs :
|
|
|
51 |
#
|
|
|
52 |
my $result = GetOptions (
|
|
|
53 |
"help:+" => \$opt_help,
|
|
|
54 |
"manual:3" => \$opt_help,
|
|
|
55 |
"verbose:+" => \$opt_verbose,
|
|
|
56 |
"debug:+" => \$opt_debug,
|
|
|
57 |
"replace!" => \$opt_replace,
|
|
|
58 |
);
|
|
|
59 |
|
|
|
60 |
#
|
|
|
61 |
# UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
|
|
|
62 |
#
|
|
|
63 |
|
|
|
64 |
#
|
|
|
65 |
# Process help and manual options
|
|
|
66 |
#
|
|
|
67 |
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
|
|
|
68 |
pod2usage(-verbose => 1) if ( $opt_help == 2 );
|
|
|
69 |
pod2usage(-verbose => 2) if ( $opt_help > 2 );
|
|
|
70 |
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ( $#ARGV != 1 );
|
|
|
71 |
|
|
|
72 |
#
|
|
|
73 |
# Configure the error reporting rmMerge_process now that we have the user options
|
|
|
74 |
#
|
|
|
75 |
ErrorConfig( 'name' =>'DPKG_TRANSFER',
|
|
|
76 |
'verbose' => $opt_verbose,
|
|
|
77 |
'debug' => $opt_debug,
|
|
|
78 |
);
|
|
|
79 |
|
|
|
80 |
#
|
|
|
81 |
#
|
|
|
82 |
$pname = $ARGV[0];
|
|
|
83 |
$pversion = $ARGV[1];
|
|
|
84 |
|
|
|
85 |
#
|
|
|
86 |
# Ensure the pakage exists in the 'pulse' dpkg_archive
|
|
|
87 |
#
|
|
|
88 |
testPath($newDpkg);
|
|
|
89 |
testPath($oldDpkg);
|
|
|
90 |
my $srcDir = testPath( catdir($newDpkg, $pname, $pversion));
|
|
|
91 |
my $dstDir = catdir ($oldDpkg, $pname);
|
|
|
92 |
my $dstPkg = catdir ($oldDpkg, $pname, $pversion);
|
|
|
93 |
Message("Source: $srcDir") ;
|
|
|
94 |
Message("Target: $dstDir");
|
|
|
95 |
Error ("Package aleady exists: $dstPkg ") if -x $dstPkg;
|
|
|
96 |
if ( ! -d $dstDir) {
|
|
|
97 |
Message ("Create Package directory");
|
|
|
98 |
mkdir $dstDir;
|
|
|
99 |
}
|
|
|
100 |
testPath( $dstDir );
|
|
|
101 |
System ('--Show','cp', '-a', $srcDir, $dstDir);
|
|
|
102 |
Error("Package not copied") unless -d $dstPkg;
|
|
|
103 |
|
|
|
104 |
# Need to set the facl stuff - its not done by the 'cp' command
|
|
|
105 |
System('setfacl', '-R', '-x', 'user:releasem',$dstPkg);
|
|
|
106 |
System('setfacl', '-R', '-x', 'user:buildadm',$dstPkg);
|
|
|
107 |
System('setfacl', '-R', '-x', 'group:ccperdev',$dstPkg);
|
|
|
108 |
System('setfacl', '-R', '-m', 'default:user:buildadm:rwx','-m','default:user::rwx','-m','mask::r-x',$dstPkg);
|
|
|
109 |
System('setfacl', '-R', '-m', 'user::r-X,group::r-X,other::r-X',$dstPkg);
|
|
|
110 |
|
|
|
111 |
#-------------------------------------------------------------------------------
|
|
|
112 |
# Function : testPath
|
|
|
113 |
#
|
|
|
114 |
# Description : Test that a directory exists
|
|
|
115 |
#
|
|
|
116 |
# Inputs : $path
|
|
|
117 |
#
|
|
|
118 |
# Returns :
|
|
|
119 |
#
|
|
|
120 |
sub testPath
|
|
|
121 |
{
|
|
|
122 |
my ($path) = @_;
|
|
|
123 |
Debug("Testing: $path");
|
|
|
124 |
return $path if -d $path;
|
|
|
125 |
Error ("Path not found: $path");
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
#-------------------------------------------------------------------------------
|
|
|
129 |
# Documentation
|
|
|
130 |
#
|
|
|
131 |
|
|
|
132 |
=pod
|
|
|
133 |
|
|
|
134 |
=for htmltoc GENERAL::ClearCase::
|
|
|
135 |
|
|
|
136 |
=head1 NAME
|
|
|
137 |
|
|
|
138 |
rmMerge_transfer_dpkg - Transfer package
|
|
|
139 |
|
|
|
140 |
=head1 SYNOPSIS
|
|
|
141 |
|
|
|
142 |
jats rmMerge_transfer_dpkg [options] PackageName PackageVersion
|
|
|
143 |
|
|
|
144 |
Options:
|
|
|
145 |
-help - brief help message
|
|
|
146 |
-help -help - Detailed help message
|
|
|
147 |
-man - Full documentation
|
|
|
148 |
|
|
|
149 |
=head1 OPTIONS
|
|
|
150 |
|
|
|
151 |
=over 8
|
|
|
152 |
|
|
|
153 |
=item B<-help>
|
|
|
154 |
|
|
|
155 |
Print a brief help message and exits.
|
|
|
156 |
|
|
|
157 |
=item B<-help -help>
|
|
|
158 |
|
|
|
159 |
Print a detailed help message with an explanation for each option.
|
|
|
160 |
|
|
|
161 |
=back
|
|
|
162 |
|
|
|
163 |
=head1 EXAMPLE
|
|
|
164 |
|
|
|
165 |
jats rmMerge_transfer_dpkg PackageName PackageVersion
|
|
|
166 |
|
|
|
167 |
=cut
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
|