DIBS: Added make-image option [-i] for installmanager 69/13469/1
authorjonghwan2.park <jonghwan2.park@samsung.com>
Fri, 6 Dec 2013 08:31:27 +0000 (17:31 +0900)
committerjonghwan2.park <jonghwan2.park@samsung.com>
Fri, 6 Dec 2013 08:31:27 +0000 (17:31 +0900)
"image.info" file will be generated automatically. This file is used to decision for update.

Change-Id: Iea610e26ea1d75fa2f5173e49c6f7ce4d777359c
Signed-off-by: jonghwan2.park <jonghwan2.park@samsung.com>
package/changelog
package/pkginfo.manifest
pkg-cli
src/pkg_server/client.rb
src/pkg_server/clientOptParser.rb

index ea275d5cb64561444d9386caf6c9586ecf96dac2..109af28d75b7e815f4d8e6a88ff8d51ad5b73fe0 100644 (file)
@@ -1,3 +1,6 @@
+* 2.1.54
+- added make-image option [-i] for installmanager
+== jonghwan park <jonghwan2.park@samsung.com> 2013-12-06
 * 2.1.53
 - Fixed bug that transferred job failed when it has no "master" branch
 == donghee yang <donghee.yang@samsung.com> 2013-11-19
index 2a8669408717a095adee5a22c5ccd3e5dcbbf09a..e957d94b494a34d841faefde493c83961da8ac83 100644 (file)
@@ -1,5 +1,5 @@
 Source : dibs
-Version :2.1.53
+Version :2.1.54
 Maintainer : taejun ha<taejun.ha@samsung.com>, jiil hyoun <jiil.hyoun@samsung.com>, donghyuk yang <donghyouk.yang@samsung.com>, donghee yang <donghee.yang@samsung.com>, sungmin kim <dev.sungmin.kim@samsung.com
 
 Package : tizen-dibs-test
diff --git a/pkg-cli b/pkg-cli
index 14226ebfdcb29f070a9909abd98b50851f5398f3..a3c10ae269947acc241e9ba5c9597f93f02f5531 100755 (executable)
--- a/pkg-cli
+++ b/pkg-cli
@@ -88,7 +88,7 @@ when "make-img" then
                puts "Error: Cannot create package client!"
                exit 1
        end
-       client.make_img( option[:os] )
+       client.make_img( option[:os], option[:info] )
 when "install" then
        client = Client.create( option[:url], option[:loc], nil )
        if client.nil? then
index e2c73579ed321138d39014c14fc6d59e9dcc55f0..2622512f5ca3ae1117c530a7776ca3b5c00b8e06 100644 (file)
@@ -368,17 +368,17 @@ class Client
        end
 
        public
-       def make_img(os)
+       def make_img(os, img_info)
                if (os == "all") then
-                       @support_os_list.each do |os| image_generator(os) end
+                       @support_os_list.each do |os| image_generator(os, img_info) end
                else
-                       image_generator(os)
+                       image_generator(os, img_info)
                end
        end
 
        private
        # make sdk image
-       def  image_generator(os)
+       def  image_generator(os, img_info)
                # get package list
                all_pkg_list = @pkg_hash_os[os].values
 
@@ -397,7 +397,7 @@ class Client
                # init workspace
                workspace = @location+"/temp_for_tizen_sdk_imgs_#{os}"
                if File.directory? workspace then FileUtils.remove_dir(workspace, true) end
-               
+
                # download packages
                img_pkg_list.each do |pkg| download(pkg, os, false, "#{workspace}/binary") end
 
@@ -407,6 +407,28 @@ class Client
                # write os_info file
                File.open("#{workspace}/#{OS_INFO_FILE}", 'w') do |f| f.puts os end
 
+        # set image.info
+        message = "";
+        message = img_info;
+        
+        if message.to_s.eql? "" then
+            server = @server_addr;
+            origin = File.dirname( server );
+            dist = get_distribution
+        else
+            # chop server address, if end with "/"
+            if message.strip.end_with? "/" then message = message.chop end
+            message.strip!
+            server = message;
+            origin = File.dirname( server );
+            dist = File.basename( server ); 
+        end        
+
+        # write image.info
+        f = File.new("#{workspace}/image.info", "w");
+        f.write("origin : #{origin}\ndistribution : #{dist}\n");
+        f.close
+
                # compress files
                snapshot = snapshot_path.split('/')[-1]
                img_name = "TIZEN-SDK-IMG_#{snapshot}_#{os}.zip"
index 76b6e5185527e3e9eeb81e6c5e934d6c5f514ba5..7ca31fefeb7ba51026843a888e972110eaa47b75 100644 (file)
@@ -60,7 +60,7 @@ def option_error_check( options )
                end
        when "make-img" then
                if options[:url].nil? or options[:url].empty? then
-                       raise ArgumentError, "Usage: pkg-cli make-img -u <package server url> [-o <os>]"
+                       raise ArgumentError, "Usage: pkg-cli make-img -u <package server url> [-o <os>] [-m <image info>]"
                end
        when "install" then
                if options[:pkg].nil? or options[:pkg].empty? or
@@ -148,7 +148,7 @@ def option_parse
                + "\n" + "Subcommand usage:" + "\n" \
                + "\t" + "pkg-cli clean [-l <location>] [--force]" + "\n" \
                + "\t" + "pkg-cli download -P <package name> -u <package server url> [-o <os>] [-l <location>] [--trace]" + "\n" \
-               + "\t" + "pkg-cli make-img -u <package server url> [-o <os>]" + "\n" \
+               + "\t" + "pkg-cli make-img -u <package server url> [-o <os>] [-i <image info>]" + "\n" \
                + "\t" + "pkg-cli install -P <package name> -u <package server url> [-o <os>] [-l <location>] [--trace] [--force]" + "\n" \
                + "\t" + "pkg-cli install-file -P <package file> [-l <location>] [-u <package server url>] [--trace] [--force]" + "\n" \
                + "\t" + "pkg-cli uninstall -P <package name> [-l <location>] [--trace]" + "\n" \
@@ -208,6 +208,10 @@ def option_parse
                        options[:f] = true
                end
 
+        opts.on( '-i', '--info <image info>', 'sdk image information : http://download.tizen.org/sdk/packages/official' ) do |image_info|
+                       options[:info] = image_info
+               end
+
                opts.on( '-h', '--help', 'display help' ) do
                        puts opts
                        exit