- support 'binarytype' so that we can have different package creation frontends
authorMichael Schroeder <mls@suse.de>
Fri, 8 Jun 2012 10:33:27 +0000 (12:33 +0200)
committerMichael Schroeder <mls@suse.de>
Fri, 8 Jun 2012 10:33:27 +0000 (12:33 +0200)
Build.pm
gettype
init_buildsystem

index 8c35ac6..44f097f 100644 (file)
--- a/Build.pm
+++ b/Build.pm
@@ -267,8 +267,10 @@ sub read_config {
       }
     } elsif ($l0 eq 'repotype:') { #type of generated repository data
       $config->{'repotype'} = [ @l ];
-    } elsif ($l0 eq 'type:') { #kind of packaging system (spec, dsc or kiwi)
+    } elsif ($l0 eq 'type:') { #kind of packaging system (spec,dsc,arch,kiwi,...)
       $config->{'type'} = $l[0];
+    } elsif ($l0 eq 'binarytype:') { #rpm,deb,arch,...
+      $config->{'binarytype'} = $l[0];
     } elsif ($l0 eq 'patterntype:') { #kind of generated patterns in repository
       $config->{'patterntype'} = [ @l ];
     } elsif ($l0 eq 'release:') {
@@ -307,6 +309,12 @@ sub read_config {
       $config->{'type'} = 'UNDEFINED';
     }
   }
+  if (!$config->{'binarytype'}) {
+    $config->{'binarytype'} = 'rpm' if $config->{'type'} eq 'spec' || $config->{'type'} eq 'kiwi';
+    $config->{'binarytype'} = 'deb' if $config->{'type'} eq 'dsc';
+    $config->{'binarytype'} = 'arch' if $config->{'type'} eq 'arch';
+    $config->{'binarytype'} ||= 'UNDEFINED';
+  }
   # add rawmacros to our macro list
   if ($config->{'rawmacros'} ne '') {
     for my $rm (split("\n", $config->{'rawmacros'})) {
@@ -576,7 +584,7 @@ sub addproviders {
       if ($pp eq $rn) {
        # debian: unversioned provides do not match
        # kiwi: supports only rpm, so we need to hand it like it
-       next if $config->{'type'} eq 'dsc';
+       next if $config->{'binarytype'} eq 'deb';
        push @p, $rp;
        last;
       }
@@ -597,7 +605,7 @@ sub addproviders {
       $rr &= 5 unless $pf & 2;
       # verscmp for spec and kiwi types
       my $vv;
-      if ($config->{'type'} eq 'dsc') {
+      if ($config->{'binatytype'} eq 'deb') {
        $vv = Build::Deb::verscmp($pv, $rv, 1);
       } else {
        $vv = Build::Rpm::verscmp($pv, $rv, 1);
diff --git a/gettype b/gettype
index e07483a..1ceb746 100755 (executable)
--- a/gettype
+++ b/gettype
@@ -32,5 +32,5 @@ while (@ARGV)  {
 die("Usage: gettype --dist <dist> --archpath <archpath> [--configdir <configdir>]\n") if @ARGV;
 
 my $cf = Build::read_config_dist($dist, $archs, $configdir);
-exit 0 unless $cf->{'type'};
-print "$cf->{'type'}\n";
+exit 0 unless $cf->{'binarytype'};
+print "$cf->{'binarytype'}\n";
index 1eca42b..0d309f5 100755 (executable)
@@ -732,12 +732,9 @@ else
 
     echo "$GUESSED_DIST" > $BUILD_ROOT/.guessed_dist
     test -n "$BUILD_DIST" || BUILD_DIST="$GUESSED_DIST"
-    DIST_TYPE=`gettype --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"`
-    case "$DIST_TYPE" in
-       spec)  PSUF=rpm ;;
-       dsc)   PSUF=deb ;;
-       arch)  PSUF=arch ;;
-       *)
+    PSUF=`gettype --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"`
+    case "$PSUF" in
+       UNKNOWN|'')
            # auto detect from packages
            PSUF=rpm
            test -L $BUILD_ROOT/.init_b_cache/rpms/dpkg.deb && PSUF=deb