exit 1
end
file_loc = client.download( option[:pkg], option[:os], option[:t] )
+when "make-img" then
+ client = Client.create( option[:url], option[:loc], nil )
+ if client.nil? then
+ puts "Error: Cannot create package client!"
+ exit 1
+ end
+ client.make_img( option[:os] )
when "install" then
client = Client.create( option[:url], option[:loc], nil )
if client.nil? then
return file_local_path
end
+ public
+ # make sdk image
+ def make_img(os)
+ # get package list
+ all_pkg_list = @pkg_hash_os[os].values
+
+ # select meta and install-type packages
+ img_pkg_list = []
+ all_pkg_list.each { |pkg|
+ attr = get_attr_from_pkg(pkg.package_name, os, "attribute")
+ if attr.nil? or attr.empty? then next end
+ if attr[0].strip.upcase.eql? "ROOT" or attr[0].strip.upcase.eql? "INSTALL" then
+ dependent_pkg_list = get_install_dependent_packages(pkg.package_name, os, true, true)
+ img_pkg_list = img_pkg_list + dependent_pkg_list
+ end
+ }
+ img_pkg_list.uniq!
+
+ # 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
+
+ # write pkg_list_os file
+ FileUtils.cp("#{get_pkglist_path}/pkg_list_#{os}", "#{workspace}")
+
+ # write os_info file
+ File.open("#{workspace}/#{OS_INFO_FILE}", 'w') do |f| f.puts os end
+
+ # compress files
+ snapshot = snapshot_path.split('/')[-1]
+ img_name = "TIZNE-SDK-IMG_#{snapshot}_#{os}.zip"
+ cmd = "cd #{workspace}; zip -q -r #{@location}/TIZNE-SDK-IMG_#{snapshot_path.split('/')[-1]}_#{os}.zip *;"
+ Utils.execute_shell_with_log(cmd, @log.path)
+
+ # clean workspace
+ FileUtils.remove_dir(workspace, true)
+ @log.info "<< SDK-Image Info. >>"
+ @log.info " - server addr : #{@server_addr}"
+ @log.info " - snapshot : #{snapshot}"
+ @log.info " - os : #{os}"
+ @log.info " - location : #{location}/"
+ @log.info " - name : #{img_name}"
+
+ return
+ end
+
private
def get_file_from_cache(filename, pkg_checksum, pkg_size, location)
if not File.directory? location then return nil end
if addr.nil? then addr = @server_addr end
addr_arr = addr.split('/')
if addr_arr[-2].eql? "snapshots" then
- return addr_arr[0..-3].join("/"), addr_arr[-2..-1].join("/")
+ return addr_arr[0..-3].join("/"), "/"+addr_arr[-2..-1].join("/")
else
return nil
end
attr = get_attr_from_pkg(pkg_name, os, "attribute")
if attr.nil? or attr.empty? then return false end
- if attr[0].strip.upcase.eql? "META" then return true
+ if attr[0].strip.upcase.eql? "ROOT" then return true
else return false end
end
options[:url].nil? or options[:url].empty? then
raise ArgumentError, "Usage: pkg-cli download -P <package name> -u <package server url> [-o <os>] [-l <location>] [--trace]"
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>]"
+ end
when "install" then
if options[:pkg].nil? or options[:pkg].empty? or
options[:url].nil? or options[:url].empty? then
+ "\n" + "Subcommands:" + "\n" \
+ "\t" + "clean Delete the package in your SDK environment." + "\n" \
+ "\t" + "download Download the package in your SDK environment." + "\n" \
+ + "\t" + "make-img Make SDK-Image." + "\n" \
+ "\t" + "install Download the package from package-server and install the package in your SDK environment." + "\n" \
+ "\t" + "install-file Install the package in your SDK environment." + "\n" \
+ "\t" + "uninstall Uninstall the package in your SDK environment." + "\n" \
+ "\t" + "list-rpkg Show the all packages in the package-server." + "\n" \
+ "\t" + "show-lpkg Show the package in your SDK environment." + "\n" \
+ "\t" + "list-lpkg Show the all packages in your SDK environment." + "\n" \
- + "\t" + "snapshotlist Show the snapshot list in your SDK environment." + "\n" \
- + "\t" + "changelog Show the change log in your SDK environment." + "\n" \
+ + "\t" + "snapshotlist Show the snapshot list in your SDK environment." + "\n" \
+ + "\t" + "changelog Show the change log in your SDK environment." + "\n" \
+ "\t" + "build-dep Show build-dependency packages" + "\n" \
+ "\t" + "install-dep Show install-dependency packages" + "\n" \
+ "\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 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" \
+ "\t" + "pkg-cli list-rpkg -u <package server url> [-o <os>]" + "\n" \
+ "\t" + "pkg-cli show-lpkg -P <package name> [-l <location>]" + "\n" \
+ "\t" + "pkg-cli list-lpkg [-l <location>]" + "\n" \
- + "\t" + "pkg-cli snapshotlist -u <package server url> [--all]" + "\n" \
- + "\t" + "pkg-cli changelog -u <package server url> [-snapshot <snapshot name,snapshot name>]" + "\n" \
+ + "\t" + "pkg-cli snapshotlist -u <package server url> [--all]" + "\n" \
+ + "\t" + "pkg-cli changelog -u <package server url> [-snapshot <snapshot name,snapshot name>]" + "\n" \
+ "\t" + "pkg-cli build-dep -P <package name> -u <package server url> [-o <os>]" + "\n" \
+ "\t" + "pkg-cli install-dep -P <package name> -u <package server url> [-o <os>]" + "\n" \
+ "\t" + "pkg-cli register -P <package file path> -a <server address> -d <distribution name> -w <password>" + "\n" \
end
cmd = ARGV[0]
- if cmd.eql? "download" or
+ if cmd.eql? "download" or cmd.eql? "make-img" or
cmd.eql? "install" or cmd.eql? "show-rpkg" or
cmd.eql? "list-rpkg" or
cmd.eql? "uninstall" or cmd.eql? "show-lpkg" or