Updated Tizen 2.0 SDK source code 2.0alpha master 2.0_alpha
authordonghee <donghee.yang@samsung.com>
Tue, 18 Sep 2012 07:51:33 +0000 (16:51 +0900)
committerdonghee <donghee.yang@samsung.com>
Tue, 18 Sep 2012 07:51:33 +0000 (16:51 +0900)
Change-Id: I64f91bbb528213821f193380f9a41ab03cc21e68

27 files changed:
bin/controllers/OBS/controller.rb
bin/controllers/OBS2/controller.rb [new file with mode: 0644]
bin/controllers/SBS/controller.rb
bin/controllers/SBSTools/controller.rb
bin/generators/TizenBase/generator.rb
bin/generators/TizenPlatform/generator.rb
bin/generators/TizenPlatformToolchain/generator.rb
bin/generators/TizenPublic/generator.rb
bin/image.rb
bin/optparser.rb
bin/package.rb
bin/rogen.cfg
bin/rogen.rb
bin/rootstrap.rb
package/.log [new file with mode: 0644]
package/build.linux
package/pkginfo.manifest
workspace/tizen-device-1.0.base.obs/tizen-device-1.0.base.cfg [new file with mode: 0644]
workspace/tizen-device-1.0.base.obs/tizen-device-1.0.base.ks [new file with mode: 0644]
workspace/tizen-device-1.0.base.obs/tizen-emulator-1.0.base.cfg [new file with mode: 0644]
workspace/tizen-device-1.0.base.obs/tizen-emulator-1.0.base.ks [new file with mode: 0644]
workspace/tizen-device-1.0.obs/framework [new file with mode: 0644]
workspace/tizen-device-1.0.obs/tizen-device-1.0.cfg [new file with mode: 0644]
workspace/tizen-device-1.0.obs/tizen-device-1.0.ks [new file with mode: 0644]
workspace/tizen-emulator-1.0.obs/framework [new file with mode: 0644]
workspace/tizen-emulator-1.0.obs/tizen-emulator-1.0.cfg [new file with mode: 0644]
workspace/tizen-emulator-1.0.obs/tizen-emulator-1.0.ks [new file with mode: 0644]

index 54c4500..89a378e 100644 (file)
@@ -2,12 +2,11 @@ require 'fileutils'
 
 class RootstrapController
        @@installed = false
-       @@zypper_initiated = false 
+       @@zypper_initiated = false
     attr_accessor :type
 
        @rootstrap = nil
     @arch=""
-    @arch_rpm=""
     @obs_http_proxy=""
 
        def initialize
@@ -19,27 +18,25 @@ class RootstrapController
        # create new rootstrap
        def create_new_rootstrap( rootstrap )
                @rootstrap = rootstrap
+               @arch = @rootstrap.arch
 
-               arch = @rootstrap.arch
-               if arch == "arm" then
-                       @arch = "armv7el"
-                       @arch_rpm = "armv7l"
-               else
-                       @arch = "i586"
-                       @arch_rpm = "i586"
+               # check mic
+               if `which mic`.empty? then
+                       $log.error "mic is not installed"
+                       exit 1
                end
-               
+
                # extract base image into rootstrap path
                path = @rootstrap.path
                system "sudo rm -rf #{path}"
                system "mkdir -p #{path}"
-               system "sudo chown root #{path}"
+               system "sudo rm -rf mic-output/#{@rootstrap.base_pkg_list[0][0..-4]}/"
 
-        if @rootstrap.http_proxy.nil? then 
+        if @rootstrap.http_proxy.nil? then
             @obs_http_proxy=nil
-        else 
+        else
             @obs_http_proxy=@rootstrap.http_proxy
-        end 
+        end
         # extract base image
         # system "fakeroot tar -xpf #{$WORKING_DIR}/baseimage_#{arch}.tar.gz -C #{path}"
 
@@ -48,109 +45,25 @@ class RootstrapController
 
        # install packages
        def install_packages
-
-        if @arch == "armv7el" then 
-            # generate base.spec
-            system "rm -rf dummy.spec"
-            File.open( "dummy.spec", "w") do |w|
-                w.puts "Name:       dummy"
-                w.puts "Summary:    Tempory project for building base image"
-                w.puts "Version:    1.0.0"
-                w.puts "Release:    1"
-                w.puts "Group:      Utility"
-                w.puts "License:    Apache License, Version 2.0"
-                w.puts "Source0:    %{name}-%{version}.tar.gz"
-                pkg_list = @rootstrap.base_pkg_list
-                pkg_list.each do |pkg|
-                    if pkg.protocol.eql? "rpm" then 
-                    w.puts "BuildRequires: #{pkg.name}"
-                    end 
-                end
-                w.puts "%description"
-                w.puts "Application utility library"
-                w.puts ""
-                w.puts "%prep"
-                w.puts "%setup -q"
-                w.puts ""
-                w.puts "%build"
-                w.puts ""
-                w.puts "%install"
-                w.puts ""
-                w.puts "%files"
-                w.puts ""
-                w.puts "%description"
-                w.puts "Application utility library"
-            end
-            # generate dymmy-1.0.0.tar.gz
-            system "rm -rf dummy-1.0.0"
-            system "mkdir dummy-1.0.0"
-            system "tar cvzf dummy-1.0.0.tar.gz dummy-1.0.0/"  
-            # build
-            if not @obs_http_proxy.nil? then
-                $log.info "export http_proxy=#{@obs_http_proxy}; osc build --no-verify --clean --local-package --alternative-project=TIZEN:1.0:Public --root=#{@rootstrap.path} #{@arch}"
-                system "export http_proxy=#{@obs_http_proxy}; osc build --no-verify --clean --local-package --alternative-project=TIZEN:1.0:Public --root=#{@rootstrap.path} #{@arch}"
-            else
-                $log.info "osc build --no-verify --clean --local-package --alternative-project=TIZEN:1.0:Public --root=#{@rootstrap.path} #{@arch}"
-                system "osc build --no-verify --clean --local-package --alternative-project=TIZEN:1.0:Public --root=#{@rootstrap.path} #{@arch}"
-            end
-            # install packages
-            command "echo \"armv7l-tizen-linux\" > /etc/rpm/platform"
-            system("sudo chmod +w #{@rootstrap.path}")
-            pkg_list = @rootstrap.base_pkg_list
-            pkg_list.each do |pkg|
-                if pkg.protocol.eql? "cp" then 
-                    system("sudo cp #{pkg.url} #{@rootstrap.path}")
-                    $log.info "rpm -i #{pkg.url}"
-                    command "rpm -i #{pkg.url}"
-                    system("sudo rm -rf #{@rootstrap.path}/#{File.basename(pkg.url)}")
-                end 
-            end
-        else 
-            # generate base.spec
-            system "rm -rf dummy.spec"
-            File.open( "dummy.spec", "w") do |w|
-                w.puts "Name:       dummy"
-                w.puts "Summary:    Tempory project for building base image"
-                w.puts "Version:    1.0.0"
-                w.puts "Release:    1"
-                w.puts "Group:      Utility"
-                w.puts "License:    Apache License, Version 2.0"
-                w.puts "Source0:    %{name}-%{version}.tar.gz"
-                w.puts "BuildRequires: zypper"
-                w.puts "%description"
-                w.puts "Application utility library"
-                w.puts ""
-                w.puts "%prep"
-                w.puts "%setup -q"
-                w.puts ""
-                w.puts "%build"
-                w.puts ""
-                w.puts "%install"
-                w.puts ""
-                w.puts "%files"
-                w.puts ""
-                w.puts "%description"
-                w.puts "Application utility library"
-            end
-            # generate dymmy-1.0.0.tar.gz
-            system "rm -rf dummy-1.0.0"
-            system "mkdir dummy-1.0.0"
-            system "tar cvzf dummy-1.0.0.tar.gz dummy-1.0.0/"  
-            # build
-            if not @obs_http_proxy.nil? then
-                $log.info "export http_proxy=#{@obs_http_proxy}; osc build --no-verify --clean --local-package --alternative-project=TIZEN:1.0:Public --root=#{@rootstrap.path} #{@arch}"
-                system "export http_proxy=#{@obs_http_proxy}; osc build --no-verify --clean --local-package --alternative-project=TIZEN:1.0:Public --root=#{@rootstrap.path} #{@arch}"
-            else
-                $log.info "osc build --no-verify --clean --local-package --alternative-project=TIZEN:1.0:Public --root=#{@rootstrap.path} #{@arch}"
-                system "osc build --no-verify --clean --local-package --alternative-project=TIZEN:1.0:Public --root=#{@rootstrap.path} #{@arch}"
-            end
-            # install packages
-            pkg_list = @rootstrap.base_pkg_list
-            pkg_list.each do |pkg|
-                install_using_zypper pkg
-            end
-        end 
-    end
+               # install packages
+               result = system "sudo mic create fs -A #{@arch} #{@rootstrap.base_pkg_list[0]} --pkgmgr=zypp"
+               if not result then return result end
+               result = system "sudo cp -r mic-output/#{@rootstrap.base_pkg_list[0][0..-4]}/* #{@rootstrap.path}"
+               if not result then return result end
+
+               # copy binary interpreter for chroot
+               if @arch.include? "arm" then
+                       qemu_path = `which qemu-arm-static`.strip
+                       if qemu_path.empty? then
+                               qemu_path = `which qemu-user-static`.strip
+                       end
+                       if not qemu_path.empty? then
+                               puts "Copying #{qemu_path} ..."
+                               system "sudo cp #{qemu_path} #{@rootstrap.path}/usr/bin"
+                       end
+               end
+               return result
+       end
 
 
        # remove packages
@@ -163,7 +76,7 @@ class RootstrapController
 
     def reload ( rootstrap )
         @rootstrap = rootstrap
-    end 
+    end
 
        # get all package list installed
        def get_all_installed_packages
@@ -172,7 +85,7 @@ class RootstrapController
                        result.push line.strip
         end
 
-               return result 
+               return result
        end
 
 
@@ -183,7 +96,7 @@ class RootstrapController
                        file_path = line.strip!
                        result.push file_path
                end
-        
+
         return result
        end
 
@@ -192,19 +105,19 @@ class RootstrapController
        def get_all_dependent_packages(pkg_name)
                result = []
         command_and_return("zypper info --requires #{pkg_name}").each_line do |line|
-            if not line.include? "(" and 
-                               (line.include? "==" or line.include? ">=" or line.include? "<=") then 
+            if not line.include? "(" and
+                               (line.include? "==" or line.include? ">=" or line.include? "<=") then
                 #remove "Depends: (xxx) , "
                 package = line.split("==")[0].strip
                                result.push package
                        end
-        end 
+        end
 
         return result
        end
 
 
-       # get include search paths of package 
+       # get include search paths of package
        def get_include_search_paths_using_pkgconfig(pc_list)
                result = []
 
@@ -212,13 +125,13 @@ class RootstrapController
         result = ["/usr/include"]
 
         # get package Include list using pkg-config
-        pc_list.each do |x|
-               result = result | 
+               pc_list.each do |x|
+                       result = result |
                                ((command_and_return "pkg-config --cflags-only-I #{x}").split.map {|i| i.sub("-I","")})
-        end 
-               
+               end
+
                # remove dup
-        result.uniq!
+               result.uniq!
 
         return result
        end
@@ -226,13 +139,13 @@ class RootstrapController
 
     # write self information to file that will save
     def write_info ( file_path )
-    end 
+    end
 
 
     # compare saved information file with self
     def same_as? ( file_path )
         return false
-    end 
+    end
 
 
        # PRIVATE METHODS/VARIABLES
@@ -248,7 +161,7 @@ class RootstrapController
 
                # execute zypper command
         case pkg.protocol
-        when "rpm" then 
+        when "rpm" then
             if not @obs_http_proxy.nil? then
                 $log.info "export http_proxy=#{@obs_http_proxy}; zypper --non-interactive install #{pkg.name}"
                 command "export http_proxy=#{@obs_http_proxy}; zypper --non-interactive install #{pkg.name}"
@@ -256,61 +169,26 @@ class RootstrapController
                 $log.info "zypper --non-interactive install #{pkg.name}"
                 command "zypper --non-interactive install #{pkg.name}"
             end
-        when "cp" then 
-            system("sudo cp #{pkg.url} #{@rootstrap.path}")
-            $log.info "zypper install -y ./#{File.basename(pkg.url)}"
-            command "zypper install -y ./#{File.basename(pkg.url)}"
-            system("sudo rm -rf #{@rootstrap.path}/#{File.basename(pkg.url)}")
-        else $log.warn "pkg protocol is unknown #{pkg.protocol}"
-        end 
-    end
-
-
-       # step for preparation
-    def initiated_zypper_installation (protocol, url)
-        system("sudo chmod +w #{@rootstrap.path}")
-        # Set /etc/rpm/platform
-        $log.info "echo -n '#{@arch_rpm}-generic-linux' > /etc/rpm/platform"
-        command "echo -n '#{@arch_rpm}-generic-linux' > /etc/rpm/platform"
-
-               # Reset package db information
-               $log.info "rm -rf /var/lib/rpm/__db*"
-               command "rm -rf /var/lib/rpm/__db*"
-
-               # zypper a
-#              $log.info "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Public/standard tizen_public"
-#              command "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Public/standard tizen_public"
-#              $log.info "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Shared/standard tizen_shared"
-#              command "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Shared/standard tizen_shared"
-#              $log.info "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Hidden/standard tizen_hidden"
-#              command "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Hidden/standard tizen_hidden"
-#              $log.info "zypper ar http://165.213.148.149:82/SLP:/Bootstrap/standard slp_bootstrap"
-#              command "zypper ar http://165.213.148.149:82/SLP:/Bootstrap/standard slp_bootstrap"
-#              $log.info "zypper ar http://165.213.148.149:82/SLP:/System/standard slp_system"
-#              command "zypper ar http://165.213.148.149:82/SLP:/System/standard slp_system"
-        count=0
-        @rootstrap.url_list.each do |url|
-            $log.info "zypper ar #{url} url#{count}"
-            command "zypper ar #{url} url#{count}"
-            count+=1
-        end 
-
-               # zypper refesh
-               if not @obs_http_proxy.nil? then
-                       $log.info "export http_proxy=#{@obs_http_proxy}; zypper refresh"
-                       command "export http_proxy=#{@obs_http_proxy}; zypper refresh"
-               else
-                       command "zypper refresh"
+               when "cp" then
+                       system("sudo cp #{pkg.url} #{@rootstrap.path}")
+                       $log.info "rpm --install ./#{File.basename(pkg.url)}"
+                       command "rpm --install ./#{File.basename(pkg.url)}"
+                       system("sudo rm -rf #{@rootstrap.path}/#{File.basename(pkg.url)}")
+
+                       # Reset package db information
+                       $log.info "rm -rf /var/lib/rpm/*"
+                       command "rm -rf /var/lib/rpm/*"
+               else $log.warn "pkg protocol is unknown #{pkg.protocol}"
                end
        end
 
-       
+
        # command to SBOX2 target
        def command(cmd)
                path = @rootstrap.path
                $log.info "sudo chroot #{@rootstrap.path} sh -c \"#{cmd}\""
                system "sudo chroot #{@rootstrap.path} sh -c \"#{cmd}\""
-       end
+       end
 
 
        # return result of command
diff --git a/bin/controllers/OBS2/controller.rb b/bin/controllers/OBS2/controller.rb
new file mode 100644 (file)
index 0000000..238acd0
--- /dev/null
@@ -0,0 +1,264 @@
+require 'fileutils'
+
+class RootstrapController
+       @@installed = false
+       @@zypper_initiated = false
+    attr_accessor :type
+
+       @rootstrap = nil
+    @arch=""
+    @arch_rpm=""
+    @obs_http_proxy=""
+
+       def initialize
+        @type = File.basename(File.dirname(__FILE__))
+               # Let's assume OBS is installed
+       end
+
+
+       # create new rootstrap
+       def create_new_rootstrap( rootstrap )
+               @rootstrap = rootstrap
+
+               arch = @rootstrap.arch
+               if arch == "arm" then
+                       @arch = "armv7el"
+                       @arch_rpm = "armv7l"
+               else
+                       @arch = "i586"
+                       @arch_rpm = "i586"
+               end
+
+               # extract base image into rootstrap path
+               path = @rootstrap.path
+               system "sudo rm -rf #{path}"
+               system "mkdir -p #{path}"
+               system "sudo chown root #{path}"
+
+        if @rootstrap.http_proxy.nil? then
+            @obs_http_proxy=nil
+        else
+            @obs_http_proxy=@rootstrap.http_proxy
+        end
+        # extract base image
+        # system "fakeroot tar -xpf #{$WORKING_DIR}/baseimage_#{arch}.tar.gz -C #{path}"
+
+       end
+
+
+       # install packages
+       def install_packages
+               # generate base.spec
+               system "rm -rf dummy"
+               system "mkdir -p dummy/packaging"
+               File.open( "dummy/packaging/dummy.spec", "w") do |w|
+                       w.puts "Name:       dummy"
+                       w.puts "Summary:    Tempory project for building base image"
+                       w.puts "Version:    1.0.0"
+                       w.puts "Release:    1"
+                       w.puts "Group:      Utility"
+                       w.puts "License:    Apache License, Version 2.0"
+                       w.puts "Source0:    %{name}-%{version}.tar.gz"
+                       w.puts "BuildRequires: zypper"
+                       w.puts "%description"
+                       w.puts "Application utility library"
+                       w.puts ""
+                       w.puts "%prep"
+                       w.puts "%setup -q"
+                       w.puts ""
+                       w.puts "%build"
+                       w.puts ""
+                       w.puts "%install"
+                       w.puts ""
+                       w.puts "%files"
+                       w.puts ""
+                       w.puts "%description"
+                       w.puts "Application utility library"
+               end
+
+               FileUtils.cd "dummy"
+               system( "git init" )
+               system( "git add *" )
+               system( "git commit -m init")
+               # build
+               if not @obs_http_proxy.nil? then
+                       $log.info "export http_proxy=#{@obs_http_proxy}; gbs build -A #{@arch_rpm} --clean --buildroot=#{@rootstrap.path} -R #{@rootstrap.url_list.join(" -R ")}"
+                       system "export http_proxy=#{@obs_http_proxy}; gbs build -A #{@arch_rpm} --clean --buildroot=#{@rootstrap.path} -R #{@rootstrap.url_list.join(" -R ")}"
+               else
+                       #$log.info "osc build --no-verify --clean --local-package --alternative-project=SLP:Main --root=#{@rootstrap.path} #{@arch}"
+                       #system "osc build --no-verify --clean --local-package --alternative-project=SLP:Main --root=#{@rootstrap.path} #{@arch}"
+                       $log.info "gbs build -A #{@arch} --clean --buildroot=#{@rootstrap.path} -R #{@rootstrap.url_list.join(" -R ")}"
+                       system "gbs build -A #{@arch} --clean --buildroot=#{@rootstrap.path} -R #{@rootstrap.url_list.join(" -R ")}"
+               end
+               FileUtils.cd ".."
+               # install packages
+               pkg_list = @rootstrap.base_pkg_list
+               pkg_list.each do |pkg|
+                       install_using_zypper pkg
+               end
+       end
+
+
+       # remove packages
+       def remove_packages
+               @rootstrap.remove_pkg_list.each do |pkg|
+                       command("rpm -e --nodeps #{pkg.name}")
+               end
+       end
+
+
+    def reload ( rootstrap )
+        @rootstrap = rootstrap
+    end
+
+       # get all package list installed
+       def get_all_installed_packages
+               result = []
+               command_and_return("rpm -qa --queryformat=\\\"%{NAME}\\n\\\"").each_line do |line|
+                       result.push line.strip
+        end
+
+               return result
+       end
+
+
+       # get all file list in package
+       def get_all_package_files(pkg_name)
+               result = []
+               command_and_return("rpm -ql #{pkg_name}").each_line do |line|
+                       file_path = line.strip!
+                       result.push file_path
+               end
+
+        return result
+       end
+
+
+       # get all dependent packages
+       def get_all_dependent_packages(pkg_name)
+               result = []
+        command_and_return("zypper info --requires #{pkg_name}").each_line do |line|
+            if not line.include? "(" and
+                               (line.include? "==" or line.include? ">=" or line.include? "<=") then
+                #remove "Depends: (xxx) , "
+                package = line.split("==")[0].strip
+                               result.push package
+                       end
+        end
+
+        return result
+       end
+
+
+       # get include search paths of package
+       def get_include_search_paths_using_pkgconfig(pc_list)
+               result = []
+
+               # default search path
+        result = ["/usr/include"]
+
+        # get package Include list using pkg-config
+               pc_list.each do |x|
+                       result = result |
+                               ((command_and_return "pkg-config --cflags-only-I #{x}").split.map {|i| i.sub("-I","")})
+               end
+
+               # remove dup
+               result.uniq!
+
+        return result
+       end
+
+
+    # write self information to file that will save
+    def write_info ( file_path )
+    end
+
+
+    # compare saved information file with self
+    def same_as? ( file_path )
+        return false
+    end
+
+
+       # PRIVATE METHODS/VARIABLES
+       private
+
+       # zypper install ...
+       def install_using_zypper pkg
+               # prepare for installation if first entered
+               if not @@zypper_initiated  then
+                       initiated_zypper_installation(pkg.protocol, pkg.url)
+                       @@zypper_initiated = true
+               end
+
+               # execute zypper command
+        case pkg.protocol
+        when "rpm" then
+                       if not @obs_http_proxy.nil? then
+                               command "export http_proxy=#{@obs_http_proxy}; zypper --non-interactive install #{pkg.name}"
+                       else
+                               command "zypper --non-interactive install #{pkg.name}"
+                       end
+               when "cp" then
+                       system("sudo cp #{pkg.url} #{@rootstrap.path}")
+                       command "rpm --install ./#{File.basename(pkg.url)}"
+                       system("sudo rm -rf #{@rootstrap.path}/#{File.basename(pkg.url)}")
+
+               else $log.warn "pkg protocol is unknown #{pkg.protocol}"
+               end
+       end
+
+
+       # step for preparation
+    def initiated_zypper_installation (protocol, url)
+        system("sudo chmod +w #{@rootstrap.path}")
+        # Set /etc/rpm/platform
+        command "echo -n '#{@arch_rpm}-generic-linux' > /etc/rpm/platform"
+
+               # Reset package db information
+               # command "rm -rf /var/lib/rpm/__db*"
+               # command "rpmdb --rebuilddb"
+
+               # zypper a
+#              $log.info "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Public/standard tizen_public"
+#              command "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Public/standard tizen_public"
+#              $log.info "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Shared/standard tizen_shared"
+#              command "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Shared/standard tizen_shared"
+#              $log.info "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Hidden/standard tizen_hidden"
+#              command "zypper ar http://165.213.148.149:82/TIZEN:/1.0:/Hidden/standard tizen_hidden"
+#              $log.info "zypper ar http://165.213.148.149:82/SLP:/Bootstrap/standard slp_bootstrap"
+#              command "zypper ar http://165.213.148.149:82/SLP:/Bootstrap/standard slp_bootstrap"
+#              $log.info "zypper ar http://165.213.148.149:82/SLP:/System/standard slp_system"
+#              command "zypper ar http://165.213.148.149:82/SLP:/System/standard slp_system"
+        count=0
+        @rootstrap.url_list.each do |url|
+            command "zypper ar #{url} url#{count}"
+            count+=1
+        end
+
+               # zypper refesh
+               if not @obs_http_proxy.nil? then
+                       command "export http_proxy=#{@obs_http_proxy}; zypper refresh"
+               else
+                       command "zypper refresh"
+               end
+       end
+
+
+       # command to SBOX2 target
+       def command(cmd)
+               path = @rootstrap.path
+               $log.info "sudo chroot #{@rootstrap.path} sh -c \"#{cmd}\""
+               system "sudo chroot #{@rootstrap.path} sh -c \"#{cmd}\""
+       end
+
+
+       # return result of command
+    def command_and_return(cmd)
+               path = @rootstrap.path
+               $log.info "sudo chroot #{@rootstrap.path} sh -c \"#{cmd}\""
+               return `sudo chroot #{@rootstrap.path} sh -c \"#{cmd}\"`
+    end
+end
+
index 61f2aa7..7fafa2b 100644 (file)
@@ -64,15 +64,19 @@ class RootstrapController
                pkg_list = @rootstrap.base_pkg_list
                pkg_list.each do |pkg|
             case pkg.protocol
-            when "deb" then install_using_apt_get pkg
-            when "scp" then install_using_dpkg pkg
-            when "cp" then install_using_dpkg pkg
+            when "deb" then
+                               if not install_using_apt_get pkg then return false end
+            when "scp" then
+                               if not install_using_dpkg pkg then return false end
+            when "cp" then
+                               if not install_using_dpkg pkg then return false end
             else $log.warn "pkg protocol is unknown #{pkg.protocol}"
                        end
-               end     
+               end
         #remove cache
         system "rm -rf #{@rootstrap.path}/var/cache/apt/archives/*.deb"
                # TODO: return installed package list
+               return true
        end
 
 
@@ -299,10 +303,7 @@ class RootstrapController
                # execute apt-get command
                name = pkg.name 
         $log.info "apt-get install #{pkg.name}"
-               if not command "apt-get install --force-yes -y #{pkg.name}" then 
-            $log.error "#{pkg.name} is not installed"
-            exit 1
-        end 
+               return command "apt-get install --force-yes -y #{pkg.name}"
        end
 
 
@@ -312,8 +313,9 @@ class RootstrapController
                file =  download_file_from_url pkg.protocol, pkg.url
                if not file.empty? then 
             $log.info "dpkg -i #{file}"
-                       command "dpkg -i #{file}"
+                       return command "dpkg -i #{file}"
                end
+               return true
        end
 
 
index 49891d1..3fa0fa7 100644 (file)
@@ -85,15 +85,19 @@ class RootstrapController
                pkg_list = @rootstrap.base_pkg_list
                pkg_list.each do |pkg|
             case pkg.protocol
-            when "deb" then install_using_apt_get pkg
-            when "scp" then install_using_dpkg pkg
-            when "cp" then install_using_dpkg pkg
+            when "deb" then
+                               if not install_using_apt_get pkg then return false end
+            when "scp" then
+                               if not install_using_dpkg pkg then return false end
+            when "cp" then
+                               if not install_using_dpkg pkg then return false end
             else $log.warn "pkg protocol is unknown #{pkg.protocol}"
                        end
-               end     
+               end
         #remove cache
         system "rm -rf #{@rootstrap.path}/var/cache/apt/archives/*.deb"
                # TODO: return installed package list
+               return true
        end
 
 
@@ -212,21 +216,21 @@ class RootstrapController
                # get CPU transparency command of architecure
         transp = ""
                arch = @rootstrap.arch
-       
+
                # create/initialze SBOX2 target
                path = @rootstrap.path
-               FileUtils.cd path
-            $log.info "sb2-init -N -n -m slp2 #{transp} -t /bin -A #{arch} #{name} /bin/false"
-               system "sb2-init -N -n -m slp2 #{transp} -t /bin -A #{arch} #{name} /bin/false"
-               FileUtils.cd "#{$WORKING_DIR}"
+               FileUtils.cd path
+               $log.info "#{$HOME}/sbs-install/bin/sb2-init -N -n -m slp2 #{transp} -t /bin -A #{arch} #{name} /bin/false"
+               system "#{$HOME}/sbs-install/bin/sb2-init -N -n -m slp2 #{transp} -t /bin -A #{arch} #{name} /bin/false"
+               FileUtils.cd "#{$WORKING_DIR}"
 
-        #link .ssh folder 
+        #link .ssh folder
         if File.exist? "#{$HOME}/.ssh" then
             FileUtils.mkdir_p "#{name}/root"
             FileUtils.rm_rf "#{name}/root/.ssh"
             FileUtils.ln_sf "#{$HOME}/.ssh", "#{name}/root"
         end
-       end 
+       end
 
 
        # apt-get install ...
@@ -240,10 +244,7 @@ class RootstrapController
                # execute apt-get command
                name = pkg.name 
         $log.info "apt-get install #{pkg.name}"
-               if not command "apt-get install --force-yes -y #{pkg.name}" then 
-            $log.error "#{pkg.name} is not installed"
-            exit 1
-        end 
+               return command "apt-get install --force-yes -y #{pkg.name}"
        end
 
 
@@ -253,30 +254,31 @@ class RootstrapController
                file =  download_file_from_url pkg.protocol, pkg.url
                if not file.empty? then 
             $log.info "dpkg -i #{file}"
-                       command "dpkg -i #{file}"
+                       return command "dpkg -i #{file}"
                end
+               return true
        end
 
 
 
        # step for preparation
        def initiated_deb_installation (protocol, url_list)
-               
+
        end
 
-       
+
        # command to SBOX2 target
        def command(cmd)
                name = @rootstrap.name
-           $log.info "sb2 -R -t #{name} -m emulate -- #{cmd}"
-               system "export LC_ALL=\"C\"; sb2 -R -t #{name} -m emulate -- #{cmd}"
-       end
+               $log.info "#{$HOME}/sbs-install/bin/sb2 -R -t #{name} -m emulate -- #{cmd}"
+               system "export LC_ALL=\"C\"; #{$HOME}/sbs-install/bin/sb2 -R -t #{name} -m emulate -- #{cmd}"
+       end
 
 
        # return result of command
     def command_and_return(cmd)
                name = @rootstrap.name
-        return `export LC_ALL=\"C\"; sb2 -R -t #{name} -m emulate -- #{cmd}`
+        return `export LC_ALL=\"C\"; #{$HOME}/sbs-install/bin/sb2 -R -t #{name} -m emulate -- #{cmd}`
     end
 end
 
index f20526c..50b20e0 100644 (file)
@@ -1,6 +1,6 @@
 class ImageGenerator
        @analyzer = nil
-       @image = nil    
+       @image = nil
        @rootstrap = nil
 
        # process rootstrap
@@ -9,7 +9,7 @@ class ImageGenerator
                @rootstrap = @image.rootstrap
 
                # change permission if OBS
-        if @rootstrap.ctrl.type.eql? "OBS"  then 
+        if @rootstrap.ctrl.type.eql? "OBS" then
                        username=`whoami`
                        puts "===>sudo chown -R #{username.strip}:#{username.strip} #{@rootstrap.path}"
                        system "sudo chown -R #{username.strip}:#{username.strip} #{@rootstrap.path}"
@@ -20,76 +20,63 @@ class ImageGenerator
 
                # fix symbolic links
                fix_symbolic_links
-
-        # change sources.list
-        change_sources_list
        end
 
 
        # make package
        def zip
-               # install files
-               install_files
-
-               # generate package for linux
-               if @image.os == "linux" or @image.os == "all" then
-                       build_package "linux"
-               end
-
-               # generate package for windows
-               if @image.os == "windows" or @image.os == "all" then
-                       build_package "windows"
-               end
+               FileUtils.cd @rootstrap.name
+        system "tar cvfz ../#{@rootstrap.name}.tar.gz ."
+               FileUtils.cd ".."
        end
 
 
-
        #
-       # PRIVATE 
+       # PRIVATE
        #
        private
 
 
 
-       # remove unnecessary files      
-    def remove_files
-        #remove aclocal m4 files
-        #ls -F show when link file with @ character at last
+       # remove unnecessary files
+       def remove_files
+               #remove aclocal m4 files
+               #ls -F show when link file with @ character at last
                if File.exist? "#{@rootstrap.name}/usr/share/aclocal" then
-               aclocal = `ls -F #{@rootstrap.name}/usr/share/aclocal/*`
-               aclocal.each_line do |ac|
-                       if ac.include? "@" then
-                       FileUtils.rm_rf ac.strip[0..-2]
-               end 
-               end 
+                       aclocal = `ls -F #{@rootstrap.name}/usr/share/aclocal/*`
+                       aclocal.each_line do |ac|
+                               if ac.include? "@" then
+                                       FileUtils.rm_rf ac.strip[0..-2]
+                               end
+                       end
                end
-        #remove .build files
-        if @rootstrap.ctrl.type.eql? "OBS"  then 
-            $log.info "remove build files"
-            FileUtils.rm_rf "#{@rootstrap.name}/.build"
-            FileUtils.rm_rf "#{@rootstrap.name}/.build.command"
-            FileUtils.rm_rf "#{@rootstrap.name}/.build.log"
-            FileUtils.rm_rf "#{@rootstrap.name}/.build.packages"
-            FileUtils.rm_rf "#{@rootstrap.name}/.buildenv"
-            FileUtils.rm_rf "#{@rootstrap.name}/.guessed_dist"
-            FileUtils.rm_rf "#{@rootstrap.name}/dev"
-            FileUtils.rm_rf "#{@rootstrap.name}/home"
-            FileUtils.mkdir_p "#{@rootstrap.name}/home"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/bin"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/sbin"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/lib/locale"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/lib/perl5"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/share"
-            FileUtils.rm_rf "#{@rootstrap.name}/mnt"
-            FileUtils.rm_rf "#{@rootstrap.name}/installed-pkg"
-            FileUtils.rm_rf "#{@rootstrap.name}/emul"
-        end 
-
-        #remove static libray files when dynamic library is exist
-        d = Dir.entries("#{@rootstrap.name}/usr/lib")
-        s = d.select {|a| a.include? ".a" or a.include? ".la" }
-        s.each do |a|
-            if File.exist? "#{@rootstrap.name}/usr/lib/#{a.sub(/\.l*a/,".so")}" then 
+               #remove .build files
+               if @rootstrap.ctrl.type.eql? "OBS"  then 
+                       $log.info "remove build files"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.build"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.build.command"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.build.log"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.build.packages"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.buildenv"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.guessed_dist"
+                       FileUtils.rm_rf "#{@rootstrap.name}/dev"
+                       FileUtils.rm_rf "#{@rootstrap.name}/home"
+                       FileUtils.mkdir_p "#{@rootstrap.name}/home"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/bin"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/sbin"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/lib/locale"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/lib/perl5"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/share"
+                       FileUtils.rm_rf "#{@rootstrap.name}/mnt"
+                       FileUtils.rm_rf "#{@rootstrap.name}/installed-pkg"
+                       FileUtils.rm_rf "#{@rootstrap.name}/emul"
+               end 
+
+               #remove static libray files when dynamic library is exist
+               d = Dir.entries("#{@rootstrap.name}/usr/lib")
+               s = d.select {|a| a.include? ".a" or a.include? ".la" }
+               s.each do |a|
+                       if File.exist? "#{@rootstrap.name}/usr/lib/#{a.sub(/\.l*a/,".so")}" then 
                 if File.exist?("#{@rootstrap.name}/usr/lib/#{a}") then 
                     if File.stat("#{@rootstrap.name}/usr/lib/#{a}").owned? then
                         system "rm -rf #{@rootstrap.name}/usr/lib/#{a}"
@@ -98,37 +85,18 @@ class ImageGenerator
                     end
                 else
                     system "unlink #{@rootstrap.name}/usr/lib/#{a}"
-                end 
-            end 
-        end 
+                end
+            end
+        end
     end
 
 
-    def change_sources_list
-        if File.exist? "#{@rootstrap.name}/etc/apt/sources.list" then 
-            case @rootstrap.arch 
-            when "armel" then 
-                File.open "#{@rootstrap.name}/etc/apt/sources.list","w" do |x| 
-                    x.puts ""
-                end 
-            when "arm" then  
-                File.open "#{@rootstrap.name}/etc/apt/sources.list","w" do |x| 
-                    x.puts ""
-                end 
-            when "i386" then  
-                File.open "#{@rootstrap.name}/etc/apt/sources.list","w" do |x| 
-                    x.puts "deb http://source.tizen.org/home/tizen/apt.sbs/i386 slp2-target main contrib non-free"
-                end 
-            else $log.error "rootstrap architecture is :[#{@rootstrap.arch}]"
-            end 
-        end 
-    end 
 
 
        # fix symbolic links
-    def fix_symbolic_links
+       def fix_symbolic_links
 
-        #delete toolchain link 
+        #delete toolchain link
         FileUtils.cd @rootstrap.name
 
         #show link type 
@@ -139,56 +107,25 @@ class ImageGenerator
             if not l[1].include? "`" then next end 
             src = l[1].split('`')[1].strip[0..-2]
 
-            #fix link only absolute path link 
-            if src.start_with? "/"  then 
-                depth = "/.." * (link.count("/") -1)
-                               if File.exist?(link) then
-                                       if File.stat(link).owned? then
-                               system "unlink #{link}" 
-                               system "ln -s .#{depth}#{src} #{link}" 
-                                       else
-                               system "sudo unlink #{link}" 
-                               system "sudo ln -s .#{depth}#{src} #{link}" 
-                                       end
+                       #fix link only absolute path link 
+                       if src.start_with? "/"  then 
+                               depth = "/.." * (link.count("/") -1)
+                               if File.exist?("#{File.dirname(link)}/.#{depth}#{src}") then
+                                       puts "-> sudo unlink #{link}" 
+                                       system "sudo unlink #{link}" 
+                                       puts "-> sudo ln -s .#{depth}#{src} #{link}" 
+                                       system "sudo ln -s .#{depth}#{src} #{link}" 
                                else
-                       system "unlink #{link}" 
+                                       puts "-> sudo unlink #{link} : #{File.dirname(link)}/.#{depth}#{src}" 
+                                       system "sudo unlink #{link}" 
                                end
-            end 
-        end 
-        FileUtils.cd ".."
-    end
-
-
-       # install files
-    def install_files
-               # clean 
-               FileUtils.rm_rf "package"
-
-               # install rootstraps 
-               FileUtils.mkdir_p "package/data/SDK/build-system/rootstraps"
-        system "cp -rf #{@rootstrap.name} package/data/SDK/build-system/rootstraps"
-       
-    end 
-
-
-       # build package
-    def build_package(platform)
-        FileUtils.cd "package"
-
-               #Get package Version
-               package_version = "#{@image.ver}"
-
-               # In case of windows, symbolic link must be duplicated
-               if platform == "windows" then
-                       system "tar chf data.tar *"
-                       system "rm -rf data"
-                       system "tar xf data.tar"
-                       system "rm -rf data.tar"
-               end
-
-        system "rm -rf ../rootstrap-#{@rootstrap.name}_#{package_version}_#{platform}.zip"
-        system "zip -r -y -q ../rootstrap-#{@rootstrap.name}_#{package_version}_#{platform}.zip *"
-               $log.info "Result file is rootstrap-#{@rootstrap.name}_#{package_version}_#{platform}.zip"
-        FileUtils.cd ".."
-    end 
+                       else
+                               if not File.exist?("#{File.dirname(link)}/#{src}") then
+                                       puts "-> sudo unlink #{link} : #{File.dirname(link)}/#{src}" 
+                                       system "sudo unlink #{link}" 
+                               end
+                       end 
+               end 
+               FileUtils.cd ".."
+       end
 end
index 025a00d..23ee65e 100644 (file)
 class ImageGenerator
-    @image = nil     
-    @rootstrap = nil 
-    # process rootstrap
-    def post_process(image) 
-        @image = image
-        @rootstrap = @image.rootstrap 
+       @image = nil     
+       @rootstrap = nil 
+
+       # process rootstrap
+       def post_process(image) 
+               @image = image
+               @rootstrap = @image.rootstrap 
 
         # overwrite prelinked ld.so if ARM
         # prelink ld.so for compatibility to ARM device
         if @rootstrap.arch == "arm" and @rootstrap.ctrl.respond_to?("make_ldso_prelinked") then 
             @rootstrap.ctrl.make_ldso_prelinked
         end
+       end
 
 
-               # Add more preprocessing code here
-        
-        # change sources.list
-        change_sources_list
+       # make package
+       def zip
+               FileUtils.cd @rootstrap.name
+               system "sudo tar cvfz ../#{@rootstrap.name}.tar.gz ."
+               FileUtils.cd ".."
+       end
 
-    end 
-    # make package 
-    def zip 
-        # install files 
-        install_files 
-  
-        # add remove scripts 
-        add_remove_script 
-        # generate pkginfo.manifest 
-        generate_package_info 
-        # zipping 
-        build_package 
-    end 
 
-       
        # PRIVATE
        private
 
-    def change_sources_list
-        if File.exist? "#{@rootstrap.name}/etc/apt/sources.list" then 
-            case @rootstrap.arch 
-            when "armel" then 
-                File.open "#{@rootstrap.name}/etc/apt/sources.list","w" do |x| 
-                    x.puts "deb http://source.tizen.org/home/tizen/apt.sbs/armel slp2-target main contrib non-free"
-                end 
-            when "arm" then  
-                File.open "#{@rootstrap.name}/etc/apt/sources.list","w" do |x| 
-                    x.puts "deb http://source.tizen.org/home/tizen/apt.sbs/armel slp2-target main contrib non-free"
-                end 
-            when "i386" then  
-                File.open "#{@rootstrap.name}/etc/apt/sources.list","w" do |x| 
-                    x.puts "deb http://source.tizen.org/home/tizen/apt.sbs/i386 slp2-target main contrib non-free"
-                end 
-            else $log.error "rootstrap architecture is :[#{@rootstrap.arch}]"
-            end 
-        end 
-    end 
-
-
-       # install files
-    def install_files
-               # clean 
-               FileUtils.rm_rf "package"
-
-               # install rootstraps 
-               FileUtils.mkdir_p "package/data/SDK/build-system/rootstraps"
-        FileUtils.mv "#{@rootstrap.name}", "package/data/SDK/build-system/rootstraps"
-
-               # install sbi rootstrap plugin  
-               FileUtils.mkdir_p "package/data/SDK/build-system/plugins"
-        FileUtils.cp "#{@rootstrap.name}.xml", "package/data/SDK/build-system/plugins/#{@rootstrap.name}.xml"
-    end 
-
-
-       # generate package info
-    def generate_package_info
-
-       # Error CHECK
-       if not File.exist?(File.dirname(__FILE__) + "/pkginfo.manifest")
-           raise RuntimeError,"File does not exist [#{File.dirname(__FILE__)}/pkginfo.manifest]"
-       end
-               
-       # modify pkginfo.manifest
-       p = [] 
-       File.open( File.dirname(__FILE__) + "/pkginfo.manifest","r") do |f|
-           f.each_line do |line|
-               line.gsub!("@name@",@rootstrap.name)
-               line.gsub!("@version@",@image.ver)
-               line.gsub!("@arch@",@rootstrap.arch)
-               line.gsub!("@platform@",@image.os)
-               line.gsub!("@remove_script@","remove.sh") if @image.os == "linux"
-               line.gsub!("@remove_script@","remove.bat") if @image.os == "windows"
-               p.push line
-           end 
-       end 
-
-          # write pkginfo.manaifest
-       File.open("package/pkginfo.manifest","w")  do |f|
-           p.each do |line|
-               f.puts line
-           end
-          end
-       end
-
-
-       # add remove scripts
-    def add_remove_script
-       platform = @image.os 
-       # add removescript
-          if platform == "linux" then
-                  File.open("package/remove.sh","w")  do |f|
-                          f.puts "#!/bin/sh -e"
-                          f.puts ""
-                          f.puts "rm -rf ${INSTALLED_PATH}/SDK/build-system/rootstraps/#{@rootstrap.name}"
-                  end
-          elsif platform == "windows" then
-                  File.open("package/remove.bat","w")  do |f|
-                          f.puts ":: delims is a TAB followed by a space"
-                          f.puts "SET installed_path=%INSTALLED_PATH%"
-                          f.puts ""
-                          f.puts "RMDIR /S /Q %installed_path%\\SDK\\build-system\\rootstraps\\#{@rootstrap.name}"
-                  end
-          end
-    end 
-
 
-       # build package
-    def build_package
-        FileUtils.cd "package"
 
-               #Get package Version
-               package_version = "#{@image.ver}"
 
-        system "zip -r -y -q ../rootstrap-#{@rootstrap.name}_#{package_version}_#{@image.os}.zip *"
-               $log.info "Result file is rootstrap-#{@rootstrap.name}_#{package_version}_#{@image.os}.zip"
-        FileUtils.cd ".."
-    end 
 end
index 0a0a4de..37db655 100644 (file)
 class ImageGenerator
-    @image = nil     
-    @rootstrap = nil 
-    # process rootstrap
-    def post_process(image) 
-        @image = image
-        @rootstrap = @image.rootstrap 
+       @image = nil
+       @rootstrap = nil
+
+       # process rootstrap
+       def post_process(image)
+               @image = image
+               @rootstrap = @image.rootstrap
 
                # Add more preprocessing code here
                #remove autoconf.m4f
                system "rm -rf #{@rootstrap.name}/usr/share/autoconf/autoconf/autoconf.m4f"
-    end 
-    # make package 
-    def zip 
-        # install files 
-        install_files 
-  
-        # generate pkginfo.manifest 
-        generate_package_info "linux"
-
-        # generate remove script
-        add_remove_script "linux"
-        # zipping 
-        build_package 
-    end 
-
-       
-       # PRIVATE
-       private
-
-       # install files
-    def install_files
-               # clean 
-               FileUtils.rm_rf "package2"
-
-        # install toolchain
-        FileUtils.mkdir_p "package2/data/SDK/build-system/toolchains"
-        FileUtils.mv "#{@rootstrap.name}", "package2/data/SDK/build-system/toolchains/"
+       end
 
-               # install scratchbox2
-               print "Installing ScratchBox2..."
-               FileUtils.mkdir_p "package2/data/SDK/build-system/toolchains/scratchbox2"
-               FileUtils.rm_rf "scratchbox2"
-               system "git clone git@165.213.180.234:/slp/tools/scratchbox2"
-        FileUtils.cd "scratchbox2"
-               system "make clean"     
-               system "./autogen.sh && .configure && make"     
-               system "make install prefix=#{$WORKING_DIR}/package2/data/SDK/build-system/toolchains/scratchbox2"
-               FileUtils.cd ".."
-               print "OK\n"
 
-               # install QEMU
-               print "Installing QEMU..."
-               FileUtils.rm_rf "qemu"
-               system "git clone git@165.213.180.234:slp/tools/qemu"
-               FileUtils.cd "qemu"
-               system "git checkout debian-sbs"
-               system "git pull"
-               system "make clean"
-               system "./configure --target-list=arm-linux-user,i386-linux-user --disable-blobs --disable-uuid && make"
-               system "make install prefix=#{$WORKING_DIR}/package2/data/SDK/build-system/toolchains/scratchbox2"
+       # make package
+       def zip
+               FileUtils.cd @rootstrap.name
+               system "tar cvfz ../#{@rootstrap.name}.tar.gz ."
                FileUtils.cd ".."
-               print "OK\n"
-               
-               # install sbi rootstrap plugin  
-               print "Copying SBI toolchain plugins..."
-               FileUtils.mkdir_p "package2/data/SDK/build-system/plugins"
-               FileUtils.cp "gcc45sbox2.armel.cdeb.xml", "package2/data/SDK/build-system/plugins/gcc45sbox2.armel.cdeb.xml"
-               FileUtils.cp "gcc45sbox2.i386.cdeb.xml", "package2/data/SDK/build-system/plugins/gcc45sbox2.i386.cdeb.xml"
-               print "OK\n"
-
-               # installing i386-gdb
-               #print "Copying i386-linux-gnueabi-gdb..."
-               #FileUtils.cp "#{$WORKING_DIR}/i386-linux-gnueabi-gdb", "package/data/SDK/build-system/toolchains/#{@rootstrap.name}/usr/bin/gdb"
-               #print "OK\n"
-               
-    end 
-
-
-       # generate package info
-    def generate_package_info(platform)
-
-               print "Generating pkginfo.manifest..."
-       # Error CHECK
-       if not File.exist?(File.dirname(__FILE__) + "/pkginfo.manifest")
-           raise RuntimeError,"File does not exist [#{File.dirname(__FILE__)}/pkginfo.manifest]"
-       end
-               
-       # modify pkginfo.manifest
-       p = [] 
-       File.open( File.dirname(__FILE__) + "/pkginfo.manifest","r") do |f|
-           f.each_line do |line|
-               line.gsub!("@name@",@rootstrap.name)
-               line.gsub!("@version@",@image.ver)
-               line.gsub!("@remove_script@","remove.sh") if platform == "linux"
-               line.gsub!("@remove_script@","remove.bat") if platform == "windows"
-               p.push line
-           end 
-       end 
-
-          # write pkginfo.manaifest
-       File.open("package2/pkginfo.manifest","w")  do |f|
-           p.each do |line|
-               f.puts line
-           end
-          end
-               print "OK\n"
        end
-
-
-       # add remove scripts
-    def add_remove_script(platform)
-       # add removescript
-               print "Generating remove.sh..."
-          File.open("package2/remove.sh","w")  do |f|
-                          f.puts "#!/bin/sh -e"
-                          f.puts ""
-                          f.puts "rm -rf ${INSTALLED_PATH}/SDK/build-system/toolchains/#{@rootstrap.name}"
-                          f.puts "rm -rf ${INSTALLED_PATH}/SDK/build-system/toolchains/scratchbox2"
-                  end
-               print "OK\n"
-    end 
-
-
-       # build package
-    def build_package
-               $log.info "Zipping ..."
-        FileUtils.cd "package2"
-
-               #Get package Version
-               package_version = "#{@image.ver}"
-
-        system "zip -r -y -q ../toolchain-#{@rootstrap.name}_#{package_version}_#{@image.os}.zip *"
-               $log.info "Result file is toolchain-#{@rootstrap.name}_#{package_version}_#{@image.os}.zip"
-        FileUtils.cd ".."
-    end 
 end
index 498e1d9..3f52009 100644 (file)
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + "/analyzer"
 
 class ImageGenerator
        @analyzer = nil
-       @image = nil    
+       @image = nil
        @rootstrap = nil
 
        # process rootstrap
@@ -11,7 +11,7 @@ class ImageGenerator
                @rootstrap = @image.rootstrap
 
                # change permission if OBS
-        if @rootstrap.ctrl.type.eql? "OBS"  then 
+               if @rootstrap.ctrl.type.eql? "OBS"  then
                        username=`whoami`
                        puts "===>sudo chown -R #{username.strip}:#{username.strip} #{@rootstrap.path}"
                        system "sudo chown -R #{username.strip}:#{username.strip} #{@rootstrap.path}"
@@ -34,36 +34,19 @@ class ImageGenerator
 
                # fix symbolic links
                fix_symbolic_links
-
-        # change sources.list
-        change_sources_list
        end
 
 
        # make package
        def zip
-               # install files
-               install_files
-
-               # generate package for linux
-               if @image.os == "linux" or @image.os == "all" then
-                       add_remove_script "linux"
-                       generate_package_info "linux"
-                       build_package "linux"
-               end
-
-               # generate package for windows
-               if @image.os == "windows" or @image.os == "all" then
-                       add_remove_script "windows"
-                       generate_package_info "windows"
-                       build_package "windows"
-               end
+               FileUtils.cd @rootstrap.name
+               system "tar cvfz ../#{@rootstrap.name}.tar.gz ."
+               FileUtils.cd ".."
        end
 
 
-
        #
-       # PRIVATE 
+       # PRIVATE
        #
        private
 
@@ -71,99 +54,78 @@ class ImageGenerator
        # strip unnecessary section in binary files
        def strip_binary_files
                sos = `find #{@rootstrap.name}/usr/lib -name *.so`
-               sos.each_line do |so|
-                       system "strip -R .text -R .ARM.exidx -s #{so}"
-               end 
-       end
+               sos.each_line do |so|
+                       system "strip -R .text -R .ARM.exidx -s #{so}"
+               end 
+       end
 
 
-       # remove unnecessary files      
-    def remove_files
-        #remove aclocal m4 files
-        #ls -F show when link file with @ character at last
+       # remove unnecessary files
+       def remove_files
+               #remove aclocal m4 files
+               #ls -F show when link file with @ character at last
                if File.exist? "#{@rootstrap.name}/usr/share/aclocal" then
-               aclocal = `ls -F #{@rootstrap.name}/usr/share/aclocal/*`
-               aclocal.each_line do |ac|
-                       if ac.include? "@" then
-                       FileUtils.rm_rf ac.strip[0..-2]
-               end 
-               end 
+                       aclocal = `ls -F #{@rootstrap.name}/usr/share/aclocal/*`
+                       aclocal.each_line do |ac|
+                               if ac.include? "@" then
+                                       FileUtils.rm_rf ac.strip[0..-2]
+                               end 
+                       end 
                end
-        #remove .build files
-        if @rootstrap.ctrl.type.eql? "OBS"  then 
-            $log.info "remove build files"
-            FileUtils.rm_rf "#{@rootstrap.name}/.build"
-            FileUtils.rm_rf "#{@rootstrap.name}/.build.command"
-            FileUtils.rm_rf "#{@rootstrap.name}/.build.log"
-            FileUtils.rm_rf "#{@rootstrap.name}/.build.packages"
-            FileUtils.rm_rf "#{@rootstrap.name}/.buildenv"
-            FileUtils.rm_rf "#{@rootstrap.name}/.guessed_dist"
-            FileUtils.rm_rf "#{@rootstrap.name}/dev"
-            FileUtils.rm_rf "#{@rootstrap.name}/home"
-            FileUtils.mkdir_p "#{@rootstrap.name}/home"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/bin"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/sbin"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/lib/locale"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/lib/perl5"
-            FileUtils.rm_rf "#{@rootstrap.name}/usr/share"
-            FileUtils.rm_rf "#{@rootstrap.name}/mnt"
-            FileUtils.rm_rf "#{@rootstrap.name}/installed-pkg"
-            FileUtils.rm_rf "#{@rootstrap.name}/emul"
-        end 
-
-        #remove static libray files when dynamic library is exist
-        d = Dir.entries("#{@rootstrap.name}/usr/lib")
-        s = d.select {|a| a.include? ".a" or a.include? ".la" }
-        s.each do |a|
-            if File.exist? "#{@rootstrap.name}/usr/lib/#{a.sub(/\.l*a/,".so")}" then 
+               #remove .build files
+               if @rootstrap.ctrl.type.eql? "OBS"  then 
+                       $log.info "remove build files"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.build"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.build.command"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.build.log"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.build.packages"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.buildenv"
+                       FileUtils.rm_rf "#{@rootstrap.name}/.guessed_dist"
+                       FileUtils.rm_rf "#{@rootstrap.name}/dev"
+                       FileUtils.rm_rf "#{@rootstrap.name}/home"
+                       FileUtils.mkdir_p "#{@rootstrap.name}/home"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/bin"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/sbin"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/lib/locale"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/lib/perl5"
+                       FileUtils.rm_rf "#{@rootstrap.name}/usr/share"
+                       FileUtils.rm_rf "#{@rootstrap.name}/mnt"
+                       FileUtils.rm_rf "#{@rootstrap.name}/installed-pkg"
+                       FileUtils.rm_rf "#{@rootstrap.name}/emul"
+               end 
+
+               #remove static libray files when dynamic library is exist
+               d = Dir.entries("#{@rootstrap.name}/usr/lib")
+               s = d.select {|a| a.include? ".a" or a.include? ".la" }
+               s.each do |a|
+                       if File.exist? "#{@rootstrap.name}/usr/lib/#{a.sub(/\.l*a/,".so")}" then 
                 if File.exist?("#{@rootstrap.name}/usr/lib/#{a}") then 
                     if File.stat("#{@rootstrap.name}/usr/lib/#{a}").owned? then
                         system "rm -rf #{@rootstrap.name}/usr/lib/#{a}"
                     else
                         system "sudo rm -rf #{@rootstrap.name}/usr/lib/#{a}"
                     end
-                else 
+                else
                     system "unlink #{@rootstrap.name}/usr/lib/#{a}"
-                end 
-            end 
-        end 
+                end
+            end
+        end
 
         #remove invalid_header_lists
-        invalid_header_list = @analyzer.get_unused_header_list
-        invalid_header_list.each do |i|
-                       $log.info "Removing a unused header file ... #{i}"
-                       abs_path = @rootstrap.path + i
-                       abs_path.gsub!("//","/")        
-            FileUtils.rm_rf abs_path
-        end 
+        #invalid_header_list = @analyzer.get_unused_header_list
+        #invalid_header_list.each do |i|
+               #       $log.info "Removing a unused header file ... #{i}"
+               #       abs_path = @rootstrap.path + i
+               #       abs_path.gsub!("//","/")
+        #    FileUtils.rm_rf abs_path
+        #end
     end
 
 
-    def change_sources_list
-        if File.exist? "#{@rootstrap.name}/etc/apt/sources.list" then 
-            case @rootstrap.arch 
-            when "armel" then 
-                File.open "#{@rootstrap.name}/etc/apt/sources.list","w" do |x| 
-                    x.puts ""
-                end 
-            when "arm" then  
-                File.open "#{@rootstrap.name}/etc/apt/sources.list","w" do |x| 
-                    x.puts ""
-                end 
-            when "i386" then  
-                File.open "#{@rootstrap.name}/etc/apt/sources.list","w" do |x| 
-                    x.puts "deb http://source.tizen.org/home/tizen/apt.sbs/i386 slp2-target main contrib non-free"
-                end 
-            else $log.error "rootstrap architecture is :[#{@rootstrap.arch}]"
-            end 
-        end 
-    end 
-
-
        # fix symbolic links
-    def fix_symbolic_links
+       def fix_symbolic_links
 
-        #delete toolchain link 
+        #delete toolchain link
         FileUtils.cd @rootstrap.name
 
         #show link type 
@@ -174,111 +136,25 @@ class ImageGenerator
             if not l[1].include? "`" then next end 
             src = l[1].split('`')[1].strip[0..-2]
 
-            #fix link only absolute path link 
-            if src.start_with? "/"  then 
-                depth = "/.." * (link.count("/") -1)
-                               if File.exist?(link) then
-                                       if File.stat(link).owned? then
-                               system "unlink #{link}" 
-                               system "ln -s .#{depth}#{src} #{link}" 
-                                       else
-                               system "sudo unlink #{link}" 
-                               system "sudo ln -s .#{depth}#{src} #{link}" 
-                                       end
+                       #fix link only absolute path link 
+                       if src.start_with? "/"  then 
+                               depth = "/.." * (link.count("/") -1)
+                               if File.exist?("#{File.dirname(link)}/.#{depth}#{src}") then
+                                       puts "-> sudo unlink #{link}" 
+                                       system "sudo unlink #{link}" 
+                                       puts "-> sudo ln -s .#{depth}#{src} #{link}" 
+                                       system "sudo ln -s .#{depth}#{src} #{link}" 
                                else
-                       system "unlink #{link}" 
+                                       puts "-> sudo unlink #{link} : #{File.dirname(link)}/.#{depth}#{src}" 
+                                       system "sudo unlink #{link}" 
                                end
-            end 
-        end 
-        FileUtils.cd ".."
-    end
-
-
-       # install files
-    def install_files
-               # clean 
-               FileUtils.rm_rf "package"
-
-               # install rootstraps 
-               FileUtils.mkdir_p "package/data/SDK/build-system/rootstraps"
-        system "cp -rf #{@rootstrap.name} package/data/SDK/build-system/rootstraps"
-       
-               # install sbi rootstrap plugin  
-               FileUtils.mkdir_p "package/data/SDK/build-system/plugins"
-        FileUtils.cp "#{@rootstrap.name}.xml", "package/data/SDK/build-system/plugins/#{@rootstrap.name}.xml"
-    end 
-
-
-       # generate package info
-    def generate_package_info(platform)
-
-       # Error CHECK
-       if not File.exist?(File.dirname(__FILE__) + "/pkginfo.manifest")
-           raise RuntimeError,"File does not exist [#{File.dirname(__FILE__)}/pkginfo.manifest]"
-       end
-               
-       # modify pkginfo.manifest
-       p = [] 
-       File.open( File.dirname(__FILE__) + "/pkginfo.manifest","r") do |f|
-           f.each_line do |line|
-               line.gsub!("@name@",@rootstrap.name)
-               line.gsub!("@version@",@image.ver)
-               line.gsub!("@arch@",@rootstrap.arch)
-               #line.gsub!("@type@",@type)
-               line.gsub!("@platform@",platform)
-               line.gsub!("@remove_script@","remove.sh") if platform == "linux"
-               line.gsub!("@remove_script@","remove.bat") if platform == "windows"
-               p.push line
-           end 
-       end 
-
-          # write pkginfo.manaifest
-       File.open("package/pkginfo.manifest","w")  do |f|
-           p.each do |line|
-               f.puts line
-           end
-          end
+                       else
+                               if not File.exist?("#{File.dirname(link)}/#{src}") then
+                                       puts "-> sudo unlink #{link} : #{File.dirname(link)}/#{src}" 
+                                       system "sudo unlink #{link}" 
+                               end
+                       end 
+               end 
+               FileUtils.cd ".."
        end
-
-
-       # add remove scripts
-    def add_remove_script(platform)
-       # add removescript
-          if platform == "linux" then
-                  File.open("package/remove.sh","w")  do |f|
-                          f.puts "#!/bin/sh -e"
-                          f.puts ""
-                          f.puts "rm -rf ${INSTALLED_PATH}/SDK/build-system/rootstraps/#{@rootstrap.name}"
-                  end
-          elsif platform == "windows" then
-                  File.open("package/remove.bat","w")  do |f|
-                          f.puts ":: delims is a TAB followed by a space"
-                          f.puts "SET installed_path=%INSTALLED_PATH%"
-                          f.puts ""
-                          f.puts "RMDIR /S /Q %installed_path%\\SDK\\build-system\\rootstraps\\#{@rootstrap.name}"
-                  end
-          end
-    end 
-
-
-       # build package
-    def build_package(platform)
-        FileUtils.cd "package"
-
-               #Get package Version
-               package_version = "#{@image.ver}"
-
-               # In case of windows, symbolic link must be duplicated
-               if platform == "windows" then
-                       system "tar chf data.tar *"
-                       system "rm -rf data"
-                       system "tar xf data.tar"
-                       system "rm -rf data.tar"
-               end
-
-        system "rm -rf ../rootstrap-#{@rootstrap.name}_#{package_version}_#{platform}.zip"
-        system "zip -r -y -q ../rootstrap-#{@rootstrap.name}_#{package_version}_#{platform}.zip *"
-               $log.info "Result file is rootstrap-#{@rootstrap.name}_#{package_version}_#{platform}.zip"
-        FileUtils.cd ".."
-    end 
 end
index 570719b..9590a45 100644 (file)
@@ -1,19 +1,15 @@
 require File.dirname(__FILE__) + "/default_generator"
 
-class Image 
-       attr_accessor :rootstrap, :ver, :os, :wrapper
+class Image
+       attr_accessor :rootstrap, :wrapper
        @rootstrap = nil
-       @ver = nil
-       @os = nil
        @wrapper = nil
        @zipped = false
 
        # init
-       def initialize (t, ver, os, generator)
+       def initialize (t, generator)
                @rootstrap = t
-               @ver = ver
-               @os = os
-               @generator = generator  
+               @generator = generator
        end
 
 
index db09dee..e0209a6 100644 (file)
@@ -8,13 +8,6 @@ def read_cfg (options)
             options[:name] = "tizen-emulator-1.0.sb2"
         end
     end 
-    if options[:version].nil? then 
-        options[:version] = get_value_from_file options[:cfg], "version"
-
-        if options[:version].empty?
-            options[:version] = "0.17.0"
-        end
-    end 
     if options[:arch].nil? then 
         options[:arch] = get_value_from_file options[:cfg], "arch"
 
@@ -22,13 +15,6 @@ def read_cfg (options)
             options[:arch] = "i386"
         end
     end 
-    if options[:os].nil? then 
-        options[:os] = get_value_from_file options[:cfg], "os"
-
-        if options[:os].empty?
-            options[:os] = "linux"
-        end
-    end 
     if options[:pkglist].nil? then 
         options[:pkglist] = get_value_from_file options[:cfg], "pkglist"
 
@@ -84,15 +70,9 @@ def set_default (options)
     if options[:name].nil? then 
         options[:name] = "slp-emulator-1.0.sb2"
     end 
-    if options[:version].nil? then 
-        options[:version] = "0.17.0"
-    end 
     if options[:arch].nil? then 
         options[:arch] = "i386"
     end 
-    if options[:os].nil? then 
-        options[:os] = "linux"
-    end 
     if options[:pkglist].nil? then 
         options[:pkglist] = "./pkglist_arm"
     end 
@@ -112,116 +92,96 @@ def set_default (options)
         options[:save] = false
     end 
 end 
+
+
 def option_parse 
     options = {}
     optparse = OptionParser.new do|opts|
         # Set a banner, displayed at the top
         # of the help screen.
-        opts.banner = "Usage: rootstrap-gnerator -n <name> -v <version> -a <arch> -o <os> -l <packagelist> -g <generator> -t <controller> -u <default_url> -p <default_protocol> -c <cfg_file> -s <save>"
+        opts.banner = "Usage: rootstrap-gnerator -n <name> -a <arch> -l <packagelist> -g <generator> -t <controller> -u <default_url> -p <default_protocol> -c <cfg_file> -s <save>"
 
         # Define the options, and what they do
         opts.on( '-n', '--name <name>', 'name' ) do|name|
-            options[:name] = name 
-        end
-    
-        opts.on( '-v', '--version <001>', 'minor version information' ) do|version|
-            options[:version] = version 
+            options[:name] = name
         end
-    
+
         opts.on( '-a', '--arch <arch>', 'architecture <arm/i386>' ) do|arch|
             options[:arch] = arch
         end
-    
-        opts.on( '-o', '--os <linux/windows/all>', 'operating system type' ) do|platform|
-            options[:os] = platform
-       end
-    
+
         opts.on( '-l', '--pkglist <package_list>', 'package list file' ) do|pkglist|
             options[:pkglist] = pkglist
         end
-    
+
         opts.on( '-g', '--gen <image generator folder>', 'image generator type' ) do|gen|
             options[:gen] = gen
         end
-        
+
         opts.on( '-t', '--ctrl <rootstrap controller folder>', 'rootstrap controller type' ) do|ctrl|
             options[:ctrl] = ctrl
         end
-        
+
         opts.on( '-u', '--default_url <default_url>', 'package repository url list delemeta (\";\")') do|url|
-            options[:url] = url 
+            options[:url] = url
         end
-    
+
         opts.on( '-x', '--http_proxy <http_proxy>', 'http proxy') do|http_proxy|
             options[:http_proxy] =  http_proxy
         end
-    
-        opts.on( '-p', '--default_protocol <default_protocol>', 'how to get package' ) do|protocol|
-            options[:protocol] = protocol 
-       end
-    
-        opts.on( '-c', '--config <cfg_file>', 'config file' ) do|cfg|
-            options[:cfg] = cfg
-        end
-    
-        opts.on( '-s', '--save', 'save ctrl cache' ) do
-            options[:save] = true
-        end
-        # This displays the help screen, all programs are
-        # assumed to have this option.
-        opts.on( '-h', '--help', 'Display this information ' ) do
-            puts opts
-            exit
-        end
-    end
-    
-    $log.info "option parsing start" 
-    $log.info "option is : " + ARGV * "," 
-    
-    optparse.parse!
-
-    $log.info "option parsing end" 
-    
-    ################# parameter error check start ######################
-    
-    options_path = $WORKING_DIR +  "/"
-    if not options[:cfg].nil? then 
-        if File.exist?(options[:cfg]) then
-            $log.info "cfg file path is [#{options[:cfg]}]" 
-            read_cfg options
-            options_path = File.dirname(options[:cfg]) + "/"
-        else
-            $log.error "cfg file is not exist input : [#{options[:cfg]}]" 
-            raise ArgumentError, "cfg file does not exist, your input is [#{options[:cfg]}]" 
-        end 
-    else 
-        $log.info options_path
-        set_default options
-    end 
+
+               opts.on( '-p', '--default_protocol <default_protocol>', 'how to get package' ) do|protocol|
+                       options[:protocol] = protocol 
+               end
+
+               opts.on( '-c', '--config <cfg_file>', 'config file' ) do|cfg|
+                       options[:cfg] = cfg
+               end
+
+               opts.on( '-s', '--save', 'save ctrl cache' ) do
+                       options[:save] = true
+               end
+               # This displays the help screen, all programs are
+               # assumed to have this option.
+               opts.on( '-h', '--help', 'Display this information ' ) do
+                       puts opts
+                       exit
+               end
+       end
+
+       $log.info "option parsing start" 
+       $log.info "option is : " + ARGV * "," 
+
+       optparse.parse!
+
+       $log.info "option parsing end" 
+
+       ################# parameter error check start ######################
+
+       options_path = $WORKING_DIR +  "/"
+       if not options[:cfg].nil? then 
+               if File.exist?(options[:cfg]) then
+                       $log.info "cfg file path is [#{options[:cfg]}]" 
+                       read_cfg options
+                       options_path = File.dirname(options[:cfg]) + "/"
+               else
+                       $log.error "cfg file is not exist input : [#{options[:cfg]}]" 
+                       raise ArgumentError, "cfg file does not exist, your input is [#{options[:cfg]}]" 
+               end 
+       else 
+               $log.info options_path
+               set_default options
+       end 
 
     if options[:name].nil? or options[:name].empty? then 
         $log.error "-n option is not setted"
         raise ArgumentError, "-n option is not setted"
-    end 
-    
-    if options[:version].nil? or options[:version].empty? then 
-        $log.error "-v option is not setted"
-        raise ArgumentError, "-v option is not setted"
-    else 
-        $log.info "version is #{options[:version]} "
-    end 
+       end 
 
-    if options[:arch].nil? or options[:arch].empty? then 
-        $log.error "-a option is not setted"
-        raise ArgumentError, "-a option is not setted"
-    end 
-
-    if options[:os] == "linux" || options[:os] == "windows" || options[:os] == "all" then
-        options[:os].downcase!
-    else
-        $log.error "os option is invalid : #{options[:os]}"
-        raise ArgumentError, "os option is only valid is linux/windows/all : input is [#{options[:os]}]" 
-    end
+       if options[:arch].nil? or options[:arch].empty? then 
+               $log.error "-a option is not setted"
+               raise ArgumentError, "-a option is not setted"
+       end 
 
     if File.exist?(options_path + options[:pkglist]) then
         $log.info "pkglist file path is [#{options[:pkglist]}]" 
index 8cffd31..23def76 100644 (file)
@@ -10,45 +10,47 @@ class Package
         @remove = false
     end
 
-    def Package.load_package_list_from_file (file, protocol)
-        list = []
-        File.open(file,"r") do |f|
-            f.each_line do |line|
-
-                               # check install or remove 
-                               if line.start_with?("-") then
-                                       remove_flag = true 
-                                       line = line[1..-1]
-                               elsif line.start_with?("+") then
-                                       remove_flag = false
-                                       line = line[1..-1]
-                               else
-                                       remove_flag = false
-                               end
-
-                l = line.split(',')
-                if l[0].empty? then 
-                    $log.warn "blank is set in pkg_list"
-                else 
-                                       if l[1].nil? then 
-                               p = Package.new l[0].strip, protocol.strip, nil
-                       elsif l[2].nil? then 
-                       p = Package.new l[0].strip, l[1].strip, nil
-                       else 
-                       p = Package.new l[0].strip, l[1].strip, l[2].strip
-                       end 
-                                       p.remove = remove_flag
-                    list.push p
+       def Package.load_package_list_from_file (file, protocol)
+               list = []
+               case protocol
+               when "mic" then
+                       return [file,"mic"]
+               else
+                       File.open(file,"r") do |f|
+                               f.each_line do |line|
+                                       # check install or remove
+                                       if line.start_with?("-") then
+                                               remove_flag = true
+                                               line = line[1..-1]
+                                       elsif line.start_with?("+") then
+                                               remove_flag = false
+                                               line = line[1..-1]
+                                       else
+                                               remove_flag = false
+                                       end
+                                       l = line.split(',')
+                                       if l[0].empty? then
+                                               $log.warn "blank is set in pkg_list"
+                                       else
+                                               if l[1].nil? then
+                                                       p = Package.new l[0].strip, protocol.strip, nil
+                                               elsif l[2].nil? then
+                                                       p = Package.new l[0].strip, l[1].strip, nil
+                                               else
+                                                       p = Package.new l[0].strip, l[1].strip, l[2].strip
+                                               end
+                                               p.remove = remove_flag
+                                               list.push p
+                                       end
                                end
-            end 
-        end 
-
-        return list
-    end 
+                       end
+                       return list
+               end
+       end
 
     def ==(other)
         if  @name == other.name and @url == other.url and @protocol == other.protocol then return true
-        else return false    
-        end 
-    end 
+        else return false
+        end
+    end
 end
index 1cc64e7..2a2fe47 100644 (file)
@@ -1,2 +1,2 @@
-local_save_path = ~/image-pool/
+#local_save_path = ~/image-pool/
 #remote_save_path = buildsystem:~/image-pool/
index e4d9985..6f5a21f 100755 (executable)
@@ -41,7 +41,7 @@ t = RootstrapManager.create(option[:name], option[:arch], pkglist, option[:ctrl]
 load File.dirname(__FILE__) + "/generators/" + option[:gen] + "/generator.rb"
 
 # create new image
-r = Image.new( t, option[:version] , option[:os], ImageGenerator.new )
+r = Image.new( t, ImageGenerator.new )
 r.build
 
 $log.info "!!!Image is generated!!!"
index 80b63d8..19f6312 100644 (file)
@@ -9,7 +9,7 @@ class Rootstrap
        @path = ""
        @ctrl = nil
 
-       # initialize rootstrap  
+       # initialize rootstrap
        def initialize  ( name, arch, pkg_list, ctrl, url_list, http_proxy )
                @base_pkg_list = []
                @remove_pkg_list = []
@@ -17,15 +17,23 @@ class Rootstrap
                @arch = arch
         @http_proxy = http_proxy
         @url_list = url_list
-               for pkg in pkg_list
-                       if pkg.remove then
-                               @remove_pkg_list.push pkg
-                       else
-                               @base_pkg_list.push pkg
-                       end 
+               @ctrl = ctrl
+               if "#{@ctrl.type}" == "OBS" then
+                       if not pkg_list[0] =~ /.*\.ks/ then
+                               $log.error "ks file is not exist"
+                               exit 1
+                       end
+                       @base_pkg_list = pkg_list
+               else
+                       for pkg in pkg_list
+                               if pkg.remove then
+                                       @remove_pkg_list.push pkg
+                               else
+                                       @base_pkg_list.push pkg
+                               end
+                       end
                end
                @path = $WORKING_DIR + "/" + name
-               @ctrl = ctrl
        end
 
        # get all package list installed
@@ -50,14 +58,17 @@ class Rootstrap
                @ctrl.create_new_rootstrap( self )
 
                $log.info "Install packages"
-               @ctrl.install_packages
+               if @ctrl.install_packages == false then
+                       $log.error "install failed"
+                       exit 1
+               end
 
                $log.info "Remove unnecessary packages"
                @ctrl.remove_packages
     end
 
-    def regenerate()  
+    def regenerate()
         $log.info "reinitialize rootstrap using controller"
         @ctrl.reload( self )
-    end 
+    end
 end
diff --git a/package/.log b/package/.log
new file mode 100644 (file)
index 0000000..d739a34
--- /dev/null
@@ -0,0 +1,4 @@
+# Logfile created on Mon Feb 06 23:18:31 +0900 2012 by logger.rb/22285
+I, [2012-02-06T23:18:31.266112 #30127]  INFO -- : option parsing start
+I, [2012-02-06T23:18:31.266200 #30127]  INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
+I, [2012-02-06T23:18:31.266322 #30127]  INFO -- : option parsing end
index 21b45d6..f60c0b5 100755 (executable)
@@ -23,17 +23,10 @@ build()
 # install
 install() 
 {
-       BIN_DIR=$SRCDIR/package/image-creator.package.${BUILD_TARGET_OS}/data/SDK/build-system/image-creator/bin
-       DOC_DIR=$SRCDIR/package/image-creator.package.${BUILD_TARGET_OS}/data/SDK/build-system/image-creator/doc
+       BIN_DIR=$SRCDIR/package/image-creator.package.${TARGET_OS}/data/tools/rogen/bin
+       DOC_DIR=$SRCDIR/package/image-creator.package.${TARGET_OS}/data/tools/rogen/doc
        mkdir -p $BIN_DIR
        mkdir -p $DOC_DIR
        cp -rf $SRCDIR/bin/* $BIN_DIR/
        #cp -rf $SRCDIR/doc/* $DOC_DIR/
 }
-
-
-
-[ "$1" = "clean" ] && clean
-[ "$1" = "build" ] && build
-[ "$1" = "install" ] && install
-echo "success"
index 2bb1d28..7de7a9e 100644 (file)
@@ -1,7 +1,8 @@
-Package : image-creator
-Version : 0.20.18
-OS : linux
-Build-host-os : linux
 Source : image-creator
+Version : 0.99.2
 Maintainer : Taejun Ha <taejun.ha@samsung.com>, Jiil Hyoun <jiil.hyoun@samsung.com>, Donghyuk Yang <donghyuk.yang@samsung.com>, Donghee Yang<donghee.yang@samsung.com>
+
+Package : image-creator
+OS : ubuntu-32
+Build-host-os : ubuntu-32
 Description : Image creator for Tizen SDK
diff --git a/workspace/tizen-device-1.0.base.obs/tizen-device-1.0.base.cfg b/workspace/tizen-device-1.0.base.obs/tizen-device-1.0.base.cfg
new file mode 100644 (file)
index 0000000..f5d6f20
--- /dev/null
@@ -0,0 +1,9 @@
+name = tizen-device-1.0.base
+arch = armv7l
+pkglist = tizen-device-1.0.base.ks
+generator = TizenBase
+controller = OBS
+http_proxy = http://172.21.17.105:3128
+
+default_protocol = mic
+default_url = http://165.213.148.149:82/TIZEN:/1.0:/Public/standard; http://165.213.148.149:82/TIZEN:/1.0:/Shared/standard; http://165.213.148.149:82/TIZEN:/1.0:/Hidden/standard; http://165.213.148.149:82/SLP:/Bootstrap/standard; http://165.213.148.149:82/SLP:/System/standard; http://165.213.148.149:82/SLP:/Main/standard
diff --git a/workspace/tizen-device-1.0.base.obs/tizen-device-1.0.base.ks b/workspace/tizen-device-1.0.base.obs/tizen-device-1.0.base.ks
new file mode 100644 (file)
index 0000000..541af25
--- /dev/null
@@ -0,0 +1,73 @@
+# -*-mic2-options-*- -f raw -*-mic2-options-*-
+
+# 
+# Do not Edit! Generated by:
+# kickstarter.py
+# 
+
+lang en_US.UTF-8
+keyboard us
+timezone --utc America/Los_Angeles
+# ROOT fs partition
+part / --size=1800 --ondisk mmcblk0p --fstype=ext4 --label=platform
+# DATA partition
+part /opt/ --size=1500 --ondisk mmcblk0p --fstype=ext4 --label=data
+# UMS partition
+part /opt/media/ --size=1300 --ondisk mmcblk0p --fstype=vfat --label=ums
+
+bootloader  --timeout=0  --append="rootdelay=5"   
+
+desktop --autologinuser=root  
+user --name root  --groups audio,video --password '' 
+
+repo --name=tizen_public --baseurl=http://165.213.148.149:82/TIZEN:/1.0:/Public/standard
+repo --name=slp-main --baseurl=http://165.213.148.149:82/SLP:/Main/standard
+repo --name=slp-bootstrap --baseurl=http://165.213.148.149:82/SLP:/Bootstrap/standard
+
+%packages
+-fuse
+-libfuse
+-libsqlfs
+-smack
+-insserv
+-sysv-rc
+-sysvinit-utils
+-initscripts
+
+-coreutils
+-autoconf
+-automake
+-intltool
+-gzip
+-grep
+-zless
+busybox
+
+passwd
+filesystem
+zypper
+#add your packages
+eglibc-devel
+eglibc-headers
+libstdc++-devel
+libwbxml2-devel
+osp-foundation-devel
+osp-face-devel
+osp-locations-services-devel
+openal-soft-devel
+
+%end
+
+%pre
+
+%end
+
+
+%post
+
+
+%end
+
+%post --nochroot
+
+%end
diff --git a/workspace/tizen-device-1.0.base.obs/tizen-emulator-1.0.base.cfg b/workspace/tizen-device-1.0.base.obs/tizen-emulator-1.0.base.cfg
new file mode 100644 (file)
index 0000000..299f7ac
--- /dev/null
@@ -0,0 +1,9 @@
+name = tizen-emulator-1.0.base
+arch = i686
+pkglist = tizen-emulator-1.0.base.ks
+generator = TizenBase
+controller = OBS
+http_proxy = http://172.21.17.105:3128
+
+default_protocol = mic
+default_url = http://165.213.148.149:82/TIZEN:/1.0:/Public/standard; http://165.213.148.149:82/TIZEN:/1.0:/Shared/standard; http://165.213.148.149:82/TIZEN:/1.0:/Hidden/standard; http://165.213.148.149:82/SLP:/Bootstrap/standard; http://165.213.148.149:82/SLP:/System/standard; http://165.213.148.149:82/SLP:/Main/standard
diff --git a/workspace/tizen-device-1.0.base.obs/tizen-emulator-1.0.base.ks b/workspace/tizen-device-1.0.base.obs/tizen-emulator-1.0.base.ks
new file mode 100644 (file)
index 0000000..541af25
--- /dev/null
@@ -0,0 +1,73 @@
+# -*-mic2-options-*- -f raw -*-mic2-options-*-
+
+# 
+# Do not Edit! Generated by:
+# kickstarter.py
+# 
+
+lang en_US.UTF-8
+keyboard us
+timezone --utc America/Los_Angeles
+# ROOT fs partition
+part / --size=1800 --ondisk mmcblk0p --fstype=ext4 --label=platform
+# DATA partition
+part /opt/ --size=1500 --ondisk mmcblk0p --fstype=ext4 --label=data
+# UMS partition
+part /opt/media/ --size=1300 --ondisk mmcblk0p --fstype=vfat --label=ums
+
+bootloader  --timeout=0  --append="rootdelay=5"   
+
+desktop --autologinuser=root  
+user --name root  --groups audio,video --password '' 
+
+repo --name=tizen_public --baseurl=http://165.213.148.149:82/TIZEN:/1.0:/Public/standard
+repo --name=slp-main --baseurl=http://165.213.148.149:82/SLP:/Main/standard
+repo --name=slp-bootstrap --baseurl=http://165.213.148.149:82/SLP:/Bootstrap/standard
+
+%packages
+-fuse
+-libfuse
+-libsqlfs
+-smack
+-insserv
+-sysv-rc
+-sysvinit-utils
+-initscripts
+
+-coreutils
+-autoconf
+-automake
+-intltool
+-gzip
+-grep
+-zless
+busybox
+
+passwd
+filesystem
+zypper
+#add your packages
+eglibc-devel
+eglibc-headers
+libstdc++-devel
+libwbxml2-devel
+osp-foundation-devel
+osp-face-devel
+osp-locations-services-devel
+openal-soft-devel
+
+%end
+
+%pre
+
+%end
+
+
+%post
+
+
+%end
+
+%post --nochroot
+
+%end
diff --git a/workspace/tizen-device-1.0.obs/framework b/workspace/tizen-device-1.0.obs/framework
new file mode 100644 (file)
index 0000000..34c94a4
--- /dev/null
@@ -0,0 +1,50 @@
+/Base
+ libdlog-devel
+ dbus-devel
+ dbus-glib-devel
+ edbus-devel
+ sqlite-devel
+ libxml2-devel
+ openssl-devel
+ json-glib-devel
+ eglibc-devel
+ eglibc-headers
+ libstdc++-devel
+/Base/Glib2.0
+ glib2-devel
+/Base/ICU
+ libicu-devel
+/Multimedia
+ freealut-devel
+ openal-soft-devel
+/Network
+ libsoup2.4-devel
+ libcurl-devel
+/UI
+ edje-devel
+ eina-devel
+ elementary-devel
+ eet-devel
+ elm-webview-devel
+ webkit-engine-dev
+/UI/Cairo
+ cairo-devel
+/UI/Edbus
+ edbus-devel
+/UI/Efreet
+ efreet-devel
+/UI/Ecore
+ ecore-devel
+/UI/Ethumb
+ ethumb-devel
+/UI/Evas
+ evas-devel
+/UI/OpenGL
+ simulator-opengl-devel
+ opengl-es-virtual-drv-devel
+/Uncategorized
+ gtest
+*gles11 opengl-es-11
+*gles20 opengl-es-20
+*opengl opengl-es-11
+*opengl2 opengl-es-20
diff --git a/workspace/tizen-device-1.0.obs/tizen-device-1.0.cfg b/workspace/tizen-device-1.0.obs/tizen-device-1.0.cfg
new file mode 100644 (file)
index 0000000..52760ea
--- /dev/null
@@ -0,0 +1,9 @@
+name = tizen-device-1.0
+arch = armv7l
+pkglist = tizen-device-1.0.ks
+generator = TizenPublic
+controller = OBS
+http_proxy = http://172.21.17.105:3128
+
+default_protocol = mic
+default_url = 
diff --git a/workspace/tizen-device-1.0.obs/tizen-device-1.0.ks b/workspace/tizen-device-1.0.obs/tizen-device-1.0.ks
new file mode 100644 (file)
index 0000000..ca39eee
--- /dev/null
@@ -0,0 +1,142 @@
+# -*-mic2-options-*- -f raw -*-mic2-options-*-
+
+# 
+# Do not Edit! Generated by:
+# kickstarter.py
+# 
+
+lang en_US.UTF-8
+keyboard us
+timezone --utc America/Los_Angeles
+# ROOT fs partition
+part / --size=3000 --ondisk=sda --fstype=ext3 --label=platform
+bootloader  --timeout=0  --append="rootdelay=5"   
+
+desktop --autologinuser=root  
+user --name root  --groups audio,video --password '' 
+
+repo --name=c210-base --baseurl=http://165.213.148.149:8008/snapshots/latest/repos/slp-base/armv7l/packages/ --ssl_verify=no --proxy=http://172.21.17.105:3128
+repo --name=c210-system --baseurl=http://165.213.148.149:8008/snapshots/latest/repos/slp-system/armv7l/packages/ --save  --ssl_verify=no --proxy=http://172.21.17.105:3128
+repo --name=c210-device --baseurl=http://165.213.148.149:8008/snapshots/latest/repos/slp-c210/armv7l/packages/ --save  --ssl_verify=no --proxy=http://172.21.17.105:3128
+
+
+%packages
+@slp-base
+@slp-system
+#@slp-c210-u1-image
+busybox-symlinks-passwd
+opengl-es-virtual-drv-devel
+capi-appfw-application-devel
+capi-appfw-app-manager-devel
+capi-base-common-devel
+capi-content-media-content-devel
+capi-location-geocoder-devel
+capi-location-manager-devel
+capi-location-poi-devel
+capi-location-route-devel
+capi-media-audio-io-devel
+capi-media-camera-devel
+capi-media-image-util-devel
+capi-media-metadata-extractor-devel
+capi-media-player-devel
+capi-media-radio-devel
+capi-media-recorder-devel
+capi-media-sound-manager-devel
+capi-media-tone-player-devel
+capi-media-wav-player-devel
+capi-messaging-email-devel
+capi-messaging-messages-devel
+capi-network-bluetooth-devel
+capi-network-connection-devel
+capi-network-nfc-devel
+capi-social-calendar-devel
+capi-social-call-log-devel
+capi-social-contacts-devel
+capi-system-device-devel
+capi-system-haptic-devel
+capi-system-info-devel
+capi-system-power-devel
+capi-system-runtime-info-devel
+capi-system-sensor-devel
+capi-telephony-call-devel
+capi-telephony-network-info-devel
+capi-telephony-sim-devel
+capi-ui-efl-util-devel
+capi-uix-feedback-devel
+capi-uix-stt-devel
+capi-uix-tts-devel
+capi-web-favorites-devel
+capi-web-url-download-devel
+dbus-devel
+dbus-glib-devel
+glib2-devel
+sqlite-devel
+ecore-devel
+edbus-devel
+edje-devel
+eet-devel
+efreet-devel
+eina-devel
+elementary-devel
+ethumb-devel
+evas-devel
+elm-webview-devel
+freealut-devel
+opengl-es-devel
+libdlog-devel
+eglibc-devel
+eglibc-headers
+libicu-devel
+openal-soft-devel
+libxml2-devel
+webkit-engine-devel
+cairo-devel
+#libcurl-devel
+openssl-devel
+json-glib-devel
+libstdc++-devel
+
+-glib2-static
+-insserv
+-gettext-tools
+-eglibc-utils
+-imake
+-giflib-utils
+-u-boot-tools
+%end
+
+%prepackages
+eglibc
+systemd
+busybox
+libacl
+libcap
+dbus-libs
+libgcc
+libudev
+libattr
+default-files-slp
+openssl
+libprivilege-control
+libprivilege-control-conf
+security-server
+libdlog
+libsecurity-server-client
+sqlite
+tzdata-slp
+vconf
+%end
+
+%pre
+
+%end
+
+
+%post
+
+
+%end
+
+%post --nochroot
+
+%end
diff --git a/workspace/tizen-emulator-1.0.obs/framework b/workspace/tizen-emulator-1.0.obs/framework
new file mode 100644 (file)
index 0000000..34c94a4
--- /dev/null
@@ -0,0 +1,50 @@
+/Base
+ libdlog-devel
+ dbus-devel
+ dbus-glib-devel
+ edbus-devel
+ sqlite-devel
+ libxml2-devel
+ openssl-devel
+ json-glib-devel
+ eglibc-devel
+ eglibc-headers
+ libstdc++-devel
+/Base/Glib2.0
+ glib2-devel
+/Base/ICU
+ libicu-devel
+/Multimedia
+ freealut-devel
+ openal-soft-devel
+/Network
+ libsoup2.4-devel
+ libcurl-devel
+/UI
+ edje-devel
+ eina-devel
+ elementary-devel
+ eet-devel
+ elm-webview-devel
+ webkit-engine-dev
+/UI/Cairo
+ cairo-devel
+/UI/Edbus
+ edbus-devel
+/UI/Efreet
+ efreet-devel
+/UI/Ecore
+ ecore-devel
+/UI/Ethumb
+ ethumb-devel
+/UI/Evas
+ evas-devel
+/UI/OpenGL
+ simulator-opengl-devel
+ opengl-es-virtual-drv-devel
+/Uncategorized
+ gtest
+*gles11 opengl-es-11
+*gles20 opengl-es-20
+*opengl opengl-es-11
+*opengl2 opengl-es-20
diff --git a/workspace/tizen-emulator-1.0.obs/tizen-emulator-1.0.cfg b/workspace/tizen-emulator-1.0.obs/tizen-emulator-1.0.cfg
new file mode 100644 (file)
index 0000000..7ddaa16
--- /dev/null
@@ -0,0 +1,9 @@
+name = tizen-emulator-1.0
+arch = i686
+pkglist = tizen-emulator-1.0.ks
+generator = TizenPublic
+controller = OBS
+http_proxy = http://172.21.17.105:3128
+
+default_protocol = mic
+default_url = 
diff --git a/workspace/tizen-emulator-1.0.obs/tizen-emulator-1.0.ks b/workspace/tizen-emulator-1.0.obs/tizen-emulator-1.0.ks
new file mode 100644 (file)
index 0000000..8cc0871
--- /dev/null
@@ -0,0 +1,141 @@
+# -*-mic2-options-*- -f raw -*-mic2-options-*-
+
+# 
+# Do not Edit! Generated by:
+# kickstarter.py
+# 
+
+lang en_US.UTF-8
+keyboard us
+timezone --utc America/Los_Angeles
+# ROOT fs partition
+part / --size=3000 --ondisk=sda --fstype=ext3 --label=platform
+bootloader  --timeout=0  --append="rootdelay=5"   
+
+desktop --autologinuser=root  
+user --name root  --groups audio,video --password '' 
+
+repo --name=c210-base --baseurl=http://165.213.148.149:8008/snapshots/latest/repos/slp-base/ia32/packages/ --ssl_verify=no --proxy=http://172.21.17.105:3128
+repo --name=c210-system --baseurl=http://165.213.148.149:8008/snapshots/latest/repos/slp-system/ia32/packages/ --save  --ssl_verify=no --proxy=http://172.21.17.105:3128
+repo --name=c210-device --baseurl=http://165.213.148.149:8008/snapshots/latest/repos/slp-c210/ia32/packages/ --save  --ssl_verify=no --proxy=http://172.21.17.105:3128
+
+
+%packages
+@slp-base
+@slp-system
+#@slp-c210-u1-image
+busybox-symlinks-passwd
+capi-appfw-application-devel
+capi-appfw-app-manager-devel
+capi-base-common-devel
+capi-content-media-content-devel
+capi-location-geocoder-devel
+capi-location-manager-devel
+capi-location-poi-devel
+capi-location-route-devel
+capi-media-audio-io-devel
+capi-media-camera-devel
+capi-media-image-util-devel
+capi-media-metadata-extractor-devel
+capi-media-player-devel
+capi-media-radio-devel
+capi-media-recorder-devel
+capi-media-sound-manager-devel
+capi-media-tone-player-devel
+capi-media-wav-player-devel
+capi-messaging-email-devel
+capi-messaging-messages-devel
+capi-network-bluetooth-devel
+capi-network-connection-devel
+capi-network-nfc-devel
+capi-social-calendar-devel
+capi-social-call-log-devel
+capi-social-contacts-devel
+capi-system-device-devel
+capi-system-haptic-devel
+capi-system-info-devel
+capi-system-power-devel
+capi-system-runtime-info-devel
+capi-system-sensor-devel
+capi-telephony-call-devel
+capi-telephony-network-info-devel
+capi-telephony-sim-devel
+capi-ui-efl-util-devel
+capi-uix-feedback-devel
+capi-uix-stt-devel
+capi-uix-tts-devel
+capi-web-favorites-devel
+capi-web-url-download-devel
+dbus-devel
+dbus-glib-devel
+glib2-devel
+sqlite-devel
+ecore-devel
+edbus-devel
+edje-devel
+eet-devel
+efreet-devel
+eina-devel
+elementary-devel
+ethumb-devel
+evas-devel
+elm-webview-devel
+freealut-devel
+opengl-es-devel
+libdlog-devel
+eglibc-devel
+eglibc-headers
+libicu-devel
+openal-soft-devel
+libxml2-devel
+webkit-engine-devel
+cairo-devel
+#libcurl-devel
+openssl-devel
+json-glib-devel
+libstdc++-devel
+
+-glib2-static
+-insserv
+-gettext-tools
+-eglibc-utils
+-imake
+-giflib-utils
+-u-boot-tools
+%end
+
+%prepackages
+eglibc
+systemd
+busybox
+libacl
+libcap
+dbus-libs
+libgcc
+libudev
+libattr
+default-files-slp
+openssl
+libprivilege-control
+libprivilege-control-conf
+security-server
+libdlog
+libsecurity-server-client
+sqlite
+tzdata-slp
+vconf
+%end
+
+%pre
+
+%end
+
+
+%post
+
+
+%end
+
+%post --nochroot
+
+%end