+* 2.1.56
+- add gen dependency graph tool in pkg-cli
+== hyoun jiil <jiil.hyoun@samsung.com> 2014-01-17
* 2.1.55
- added uselatest option in build-cli
-- it support fullbuild using commit id
Source : dibs
-Version :2.1.55
+Version :2.1.56
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
exit 1
end
client.make_img( option[:os], option[:info] )
+when "dep-graph" then
+ client = Client.create( option[:url], option[:loc], nil )
+ if client.nil? then
+ puts "Error: Cannot create package client!"
+ exit 1
+ end
+ client.gen_dep_graph( option[:os], option[:type] )
when "install" then
client = Client.create( option[:url], option[:loc], nil )
if client.nil? then
if @log.path.nil? then
io.each do |l|
if l.start_with?("=TRANSFER_END") then
+ @log.info("transfered")
+ @log.info(l)
break
else
puts l
end
end
end
- result = Marshal.load(io.read)
+ ioread = io.read
+ @log.info("marshal load : [#{ioread}]")
+ result = Marshal.load(ioread)
end
return result
return file_local_path
end
+ public
+ def gen_dep_graph(os, type)
+ if (os == "all") then
+ puts "==graph explain=="
+ puts " box : package name"
+ puts " red arrow : install dependency"
+ puts " blue arrow : build dependency"
+ puts "execute below graph generate command on your shell\n"
+ @support_os_list.each do |os| make_dep_graph(os, type) end
+ else
+ if(@support_os_list.include? os)
+ puts "execute below command on your shell\n"
+ make_dep_graph(os, type)
+ else
+ @log.error "not support os name : #{os}\n server supports #{@support_os_list.join(',')}"
+ end
+ end
+ end
+
+ def dot_ident(string)
+ return string.gsub(/[^a-zA-z0-9_]/,'')
+ end
+
+ def make_dep_graph(os,type)
+ all_pkg_list = @pkg_hash_os[os].values
+ string = "digraph #{type}_dependency {\nranksep=1.5\n"
+ all_pkg_list.each { |pkg|
+ id_pkg = dot_ident(pkg.package_name)
+ string += "#{id_pkg} [label=\"#{pkg.package_name}\",shape=box];\n"
+ if(type.eql? 'install' or type.eql? 'all') then
+ pkg.install_dep_list.each { |dep|
+ if(dep.target_os_list.include? os or dep.target_os_list.empty?) then
+ string += "#{id_pkg} -> #{dot_ident(dep.package_name)} [color=red];\n"
+ else
+ string += "#{id_pkg} -> #{dot_ident(dep.package_name)} [color=red,label=\"#{dep.target_os_list[0]}\",fontcolor=red,style=bold];\n"
+ end
+ }
+ end
+ if(type.eql? 'build' or type.eql? 'all') then
+ pkg.build_dep_list.each { |dep|
+ if(dep.target_os_list.include? os or dep.target_os_list.empty?) then
+ string += "#{id_pkg} -> #{dot_ident(dep.package_name)} [color=blue];\n"
+ else
+ string += "#{id_pkg} -> #{dot_ident(dep.package_name)} [color=blue,label=\"#{dep.target_os_list[0]}\",fontcolor=blue,style=bold];\n"
+ end
+ }
+ end
+ }
+ string += "}"
+ File.open("#{type}_dep_#{os}.dot","w"){|file| file.write(string)}
+ puts "dot -Tpng -o #{type}_dep_#{os}.png #{type}_dep_#{os}.dot"
+ end
public
def make_img(os, img_info)
def set_default( options )
if options[:t].nil? then options[:t] = false end
+ if options[:type].nil? then options[:type] = 'all' end
if options[:f].nil? then options[:f] = false end
if options[:v].nil? then options[:v] = false end
if options[:all].nil? then options[:all] = false end
if options[:url].nil? or options[:url].empty? then
raise ArgumentError, "Usage: pkg-cli make-img -u <package server url> [-o <os>] [-m <image info>]"
end
+ when "dep-graph" then
+ if options[:url].nil? or options[:url].empty? then
+ raise ArgumentError, "Usage: pkg-cli dep-graph -u <package server url> [-o <os>] [--dep_type <dependency type>]"
+ end
when "install" then
if options[:pkg].nil? or options[:pkg].empty? or
options[:url].nil? or options[:url].empty? then
+ "\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>] [-i <image info>]" + "\n" \
+ + "\t" + "pkg-cli dep-graph -u <package server url> [-o <os>] [--dep_type <dependency type>]" + "\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" \
options[:f] = true
end
+ opts.on( '--dep_type <dependency type>', 'all/build/install' ) do |type|
+ options[:type] = type
+ 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
cmd.eql? "install" or cmd.eql? "show-rpkg" or
cmd.eql? "list-rpkg" or
cmd.eql? "uninstall" or cmd.eql? "show-lpkg" or
- cmd.eql? "list-lpkg" or
+ cmd.eql? "list-lpkg" or cmd.eql? "dep-graph" or
cmd.eql? "install-file" or cmd.eql? "clean" or
cmd.eql? "upgrade" or cmd.eql? "check-upgrade" or
cmd.eql? "build-dep" or cmd.eql? "install-dep" or