Build Service/KIWI/Inside OBS

From openSUSE

DRAFT!


Here are some changes i did to get the kiwi-in-obs working - at least partly. It is still not perfect and loops building the image.

1st, we need some changes in bs_worker to accept other output filetypes (in my case a raw image).

diff -Naur bs_worker bs_worker.jsm
--- bs_worker   2008-09-30 04:35:12.000000000 +0200
+++ bs_worker.jsm       2008-09-30 02:33:43.000000000 +0200
@@ -690,6 +692,7 @@

     # loop to create all images specified in kiwi file
     my @imagetypes = @{$buildinfo->{'imagetype'} || []};
+    print "\n\n @imagetypes \n\n";
     mkdir("$buildroot/.build.packages") || die("mkdir $buildroot/.build.packages");
     mkdir("$buildroot/.build.packages/KIWI") || die("mkdir $buildroot/.build.packages/KIWI");
     for my $itype (@imagetypes) {
@@ -1085,13 +1088,45 @@
   push @d, 'SRPMS';
   @d = ('DEBS') if $buildinfo->{'file'} =~ /\.dsc$/;
   @d = ('KIWI') if $buildinfo->{'file'} =~ /\.kiwi$/;
+  print "\n\n@d\n\n";
   for my $d (@d) {
-    if (opendir(D, "$buildroot/.build.packages/$d")) {
-      push @send, map {"$buildroot/.build.packages/$d/$_"} grep {/\.(?:deb|rpm|iso)$/} readdir(D);
-      close D;
+    if ($d =~ /KIWI/i) {
+      system("find $buildroot/.build.packages/");
+      if (opendir(D, "$buildroot/.build.packages/$d")) {
+        print "D\n";
+       my @x;
+       @x = readdir(D);
+       #print join(/\n/.@x);
+        my @y;
+       @y = map {"$buildroot/.build.packages/$d/$_"} grep {/-0.0.1$/} @x; # my image ends in "-0.0.1"
+       print "x: @x\n";
+       print "y: @y\n";
+        push @send, @y;
+       print "\n \n \n";
+       print "@send";
+       print "\n \n \n";
+        close D;
+      }
     }
-  }
+    else {
+      if (opendir(D, "$buildroot/.build.packages/$d")) {
+        push @send, map {"$buildroot/.build.packages/$d/$_"} grep {/\.(?:deb|rpm|iso)$/} readdir(D);
+        close D;
+      }
+    }
+  }
+        system("find $buildroot/.build.packages/");
+       print "\n \n \n";
+       print "@send";
+       print "\n \n \n";
+
   @send = map {{name => (split('/', $_))[-1], filename => $_}} @send;
+       print "\n \n \n";
+       for my $i (@send){
+       print "$i";
+       print "\n \n \n";
+       }
+
   if (!@send) {
     print "build did not create packages\n";
     $ex = 1;
@@ -1105,6 +1140,7 @@
   push @send, {name => 'meta', filename => "$buildroot/.build.meta"} if -e "$buildroot/.build.meta";
 }
 push @send, {name => 'logfile', filename => "$buildroot/.build.log"};
+print Dumper(\@send);

 if (!$testmode) {
   my $param = {

Also the repserver needs these changes:

--- bs_repserver        2008-09-30 22:22:29.000000000 +0200
+++ bs_repserver.jsm    2008-09-30 04:20:10.000000000 +0200
@@ -720,7 +720,7 @@
   # right job, fetch everything!
   my $dir = "$jobsdir/$arch/$job:dir";
   mkdir_p($dir);
-  my $uploaded = BSServer::read_cpio($dir, 'accept' => '^(meta|.*\.rpm|.*\.deb|.*\.iso|logfile)$');
+  my $uploaded = BSServer::read_cpio($dir, 'accept' => '^(meta|.*\.rpm|.*\.deb|.*\.iso|.*0.1|logfile)$');
   die("upload error\n") unless $uploaded;
   if ($BSConfig::sign) {
     my @signargs;
@@ -753,7 +753,7 @@

   my $success = 0;
   for my $file (@$uploaded) {
-    next unless $file->{'name'} =~ /\.(?:rpm|deb|iso)$/;
+    next unless $file->{'name'} =~ /\.(?:rpm|deb|iso|.*0.1)$/;
     $success = 1;
     last;
   }

Possibly i missed a place, because the image gets created, but the build-process restarts again and again.

To get everything running, we need e.g. a project/repository "image" and extend our projects metadata with:

osc meta prjconf <foo> -e

%if "%_repository" == "image"
Type: kiwi
%else
Type: spec
%endif

And add the "image" repo to our repository.