buildkit support on debian/ubuntu
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15850 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
c308aa725e
commit
4de74e13fb
@ -333,12 +333,24 @@ if ($::HELP)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
my $debianflag = 0;
|
||||
my $tempstring = xCAT::BuildKitUtils->osver();
|
||||
if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){
|
||||
$debianflag = 1;
|
||||
}
|
||||
|
||||
# display the version statement if -v or --version is specified
|
||||
if ($::VERSION)
|
||||
{
|
||||
if ( system("rpm -q --qf \"%{NAME}: %{VERSION}-%{RELEASE} \n\" xCAT-buildkit") ) {
|
||||
my $versioncmd = "rpm -q --qf \"%{NAME}: %{VERSION}-%{RELEASE} \n\" xCAT-buildkit";
|
||||
my $message = "Error quering xCAT-buildkit rpm. Version info is not available. \n";
|
||||
if ( $debianflag ){
|
||||
$versioncmd = "dpkg-query --show -f='\${PackageSpec}: \${Version}\n' xcat-buildkit";
|
||||
$message = "Error quering xcat-buildkit pakcage. Version info is not available. \n";
|
||||
}
|
||||
if ( system($versioncmd) ) {
|
||||
# non-zero return from system call
|
||||
print "Error quering xCAT-buildkit rpm. Version info is not available. \n";
|
||||
print $message;
|
||||
exit 1;
|
||||
}
|
||||
exit 0;
|
||||
@ -350,12 +362,6 @@ if ( ! $arg ) {
|
||||
exit (0);
|
||||
}
|
||||
|
||||
my $debianflag = 0;
|
||||
my $tempstring = xCAT::BuildKitUtils->osver();
|
||||
if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){
|
||||
$debianflag = 1;
|
||||
}
|
||||
|
||||
while ($arg) {
|
||||
my $command = $arg;
|
||||
$command =~ tr/A-Z/a-z/; # convert to lowercase
|
||||
@ -2081,7 +2087,18 @@ sub build_kitcomp_debian{
|
||||
my $comp = shift;
|
||||
my %repo;
|
||||
my $debbuilddir = $::workdir."/debbuild/".$comp->{kitcompname};
|
||||
my $kcmetaname = comppkgname($comp);
|
||||
|
||||
#If this kitcomponent has external non-native pkgs,
|
||||
#skip the meta package build
|
||||
if ( defined($::NON_NATIVE_PKGS) &&
|
||||
defined($::NON_NATIVE_PKGS->{$comp->{kitcompname}}) &&
|
||||
$::NON_NATIVE_PKGS->{$comp->{kitcompname}} ) {
|
||||
if ($::VERBOSE) {
|
||||
print "Kit component $comp->{kitcompname} has external non-native packages. Skipping rpm build for $kcmetaname. \n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
# find the kitrepo hash for this component
|
||||
foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}}) {
|
||||
if ($comp->{kitrepoid} eq $kr->{kitrepoid}) {
|
||||
@ -2099,19 +2116,14 @@ sub build_kitcomp_debian{
|
||||
#Create debian directory for this kit component
|
||||
if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; }
|
||||
|
||||
my $kcmetaname = comppkgname($comp);
|
||||
|
||||
if (defined($comp->{non_native_pkgs}) ) {
|
||||
my $sourcedir = $::workdir."/source_packages";
|
||||
|
||||
if ($comp->{non_native_pkgs} =~ /EXTERNALPKGS/) {
|
||||
$::NON_NATIVE_PKGS->{$comp->{kitcompname}} = 1;
|
||||
}
|
||||
foreach my $pkgfile (split(/,/, $comp->{non_native_pkgs})) {
|
||||
my $pkg_file;
|
||||
my ($key,$value) = split /:/,$pkgfile;
|
||||
if ("$key" =~ /EXTERNALPKGS/) {
|
||||
next;
|
||||
$pkg_file = $value;
|
||||
} else {
|
||||
$pkg_file = $key;
|
||||
}
|
||||
@ -2419,7 +2431,13 @@ sub create_kitconf
|
||||
my @lines;
|
||||
my $li=0;
|
||||
$lines[$li++] = "# Kit Configuration File for $kitname generated by buildkit\n";
|
||||
my $xCAT_buildkit_version = `rpm -q --qf \"%{VERSION}-%{RELEASE}\" xCAT-buildkit`;
|
||||
my $xCAT_buildkit_version = '';
|
||||
if ( $debianflag ){
|
||||
$xCAT_buildkit_version = `dpkg-query --show -f='\${Version}' xcat-buildkit`;
|
||||
}
|
||||
else{
|
||||
$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') {
|
||||
@ -2614,11 +2632,6 @@ sub create_builddir
|
||||
print "Error copying buildkit config file $::full_buildkit_conf to build directory $::deploy_dir/build_input \n";
|
||||
return 1;
|
||||
}
|
||||
if ( system("cp -fpR $::full_buildkit_conf $::deploy_dir/build_input") ) {
|
||||
# non-zero return from system call
|
||||
print "Error copying buildkit config file $::full_buildkit_conf to build directory $::deploy_dir/build_input \n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -2658,24 +2671,6 @@ sub create_PARTIAL_builddir
|
||||
}
|
||||
}
|
||||
|
||||
# Copy the kitcomponent meta rpm spec if there is external non_native_pkgs.
|
||||
if ( $debianflag ) {
|
||||
foreach my $comp (keys %{$::NON_NATIVE_PKGS}) {
|
||||
my $kitrepo;
|
||||
foreach my $kc (@{$::bldkit_config->{kitcomponent}{entries}}) {
|
||||
if ($comp eq $kc->{kitcompname}) {
|
||||
$kitrepo = $kc->{kitreponame}
|
||||
}
|
||||
}
|
||||
mkpath("$::deploy_dir/tmp/");
|
||||
my $cmd = "cp -fRP $::workdir/debbuild/$comp $::deploy_dir/tmp/$comp";
|
||||
if ( system("$cmd") ) {
|
||||
print "Error copying kitcomponent meta debian build file $::workdir/debbuild/$comp to build directory $::deploy_dir \n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Copy over the original buildkit.conf file and input files
|
||||
# to help make addpkgs processing easier later
|
||||
mkpath("$::deploy_dir/build_input/");
|
||||
@ -3330,7 +3325,14 @@ sub NEW_kit_addpkgs
|
||||
$::HAVE_NON_NATIVE_PKGS = '';
|
||||
$::NON_NATIVE_PKGS = {};
|
||||
foreach my $kc (@{$::bldkit_config->{kitcomponent}{entries}}) {
|
||||
if (&build_kitcomp($kc )) {
|
||||
my $rc=0;
|
||||
if ( $debianflag ){
|
||||
$rc = &build_kitcomp_debian($kc);
|
||||
}
|
||||
else{
|
||||
$rc = &build_kitcomp($kc);
|
||||
}
|
||||
if ( $rc ) {
|
||||
print "Error building kitcomponent metapackage for $kc->{basename} \n";
|
||||
return 1;
|
||||
}
|
||||
@ -3344,7 +3346,14 @@ sub NEW_kit_addpkgs
|
||||
( $kr->{osmajorversion} eq '5') ) {
|
||||
$cr_opts = '-s md5';
|
||||
}
|
||||
if ( system("createrepo $cr_opts $repodir") ) {
|
||||
my $repocmd = "";
|
||||
if ( $debianflag ){
|
||||
$repocmd = "cd $repodir;dpkg-scanpackages . > Packages";
|
||||
}
|
||||
else{
|
||||
$repocmd = "createrepo $cr_opts $repodir";
|
||||
}
|
||||
if ( system( $repocmd ) ) {
|
||||
print "Error building the repository meta-data with the createrepo command \n";
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user