defect 3406 createrepo for RH5 and 3407 correctly handle blank osminorversion value

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15786 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
mellor 2013-04-02 16:31:21 +00:00
parent 9a639e015e
commit 28d75b347f

View File

@ -607,12 +607,14 @@ sub kit_buildrepo1
my $repodir = $::base_repodir;
my $srcdir = $::workdir."/source_packages/";
my $basedir = $repodir;
my $repo;
# find the repo
my $found = 0;
foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}}) {
if ( $kr->{kitrepoid} eq $repoid ) {
$found = 1;
$repo = $kr;
if ( &validate_os($kr)) {
print "The buildrepo operation will continue, but errors may occur. You may need to run this command on a host with the same OS.\n";
}
@ -745,7 +747,12 @@ sub kit_buildrepo1
}
# run createrepo
if ( system("createrepo $repodir") ) {
my $cr_opts = '';
if (( $repo->{osbasename} =~ m/rh|RH/ ) &&
( $repo->{osmajorversion} eq '5') ) {
$cr_opts = '-s md5';
}
if ( system("createrepo $cr_opts $repodir") ) {
print "Error building the repository meta-data with the createrepo command \n";
return 1;
}
@ -1116,7 +1123,7 @@ sub load_bldkitconf
$val =~ s/\s*$//;
if ( defined( $::buildkit_def{$current_section}{$attr} ) ) {
$current_entry{$attr} = $val;
if ( $val ne '') { $current_entry{$attr} = $val; }
} else {
if ( $current_section eq 'no section' ) {
$syntax_error = "No section specified for attribute $attr.";
@ -2412,7 +2419,9 @@ sub create_kitconf
my @lines;
my $li=0;
$lines[$li++] = "# Kit Configuration File for $kitname generated by buildkit\n";
$lines[$li++] = "# ".localtime()."\n";
my $xCAT_buildkit_version = `rpm -q --qf \"%{VERSION}-%{RELEASE}\" xCAT-buildkit`;
$lines[$li++] = "# kit_built_by_xCAT_version: $xCAT_buildkit_version \n";
$lines[$li++] = "# kit_built_on: ".localtime()."\n";
foreach my $s ('kit','kitrepo','kitcomponent','EXTERNALPKG', 'NONNATIVEPKGS') {
foreach my $se (@{$::kit_config->{$s}{entries}}) {
$lines[$li++] = "$s: \n";
@ -2911,11 +2920,17 @@ sub kit_addpkgs
chomp($tmp_kit_conf);
my $tmpdir = dirname($tmp_kit_conf);
### Check if this is a new partial kit
### Check if this is a new partial kit built with xCAT 2.8.1 or newer
if (-d "$tmpdir/build_input") {
system ("mv $tmpdir/build_input $tmpdir_base");
return &NEW_kit_addpkgs($tmpdir_base,$tmpdir);
}
if (defined($::KITVERSION) || defined($::KITRELEASE)) {
print "kitversion and kitrelease substitution is not supported for this incomplete kit. Run \"buildkit addpkgs\" without the \"-k|--kitversion\" and \"-r| --kitrelease\" options. \n";
exit 1;
}
# read in the file
my $CKF;
unless ( open( $CKF, "<", $tmp_kit_conf ) ) {
@ -3322,7 +3337,12 @@ sub NEW_kit_addpkgs
foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}}) {
my $repodir = "$::base_repodir/$kr->{kitreponame}";
if ( -d $repodir ) {
if ( system("createrepo $repodir") ) {
my $cr_opts = '';
if (( $kr->{osbasename} =~ m/rh|RH/ ) &&
( $kr->{osmajorversion} eq '5') ) {
$cr_opts = '-s md5';
}
if ( system("createrepo $cr_opts $repodir") ) {
print "Error building the repository meta-data with the createrepo command \n";
return 1;
}