From 96c92e083abed1e25ad66dda5f46f51cd7c8c28d Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 2 Apr 2013 17:39:03 +0000 Subject: [PATCH] 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/branches/2.8@15789 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-buildkit/bin/buildkit | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 46ccf1c39..c574d7c37 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -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; }