[Title] package info file update file size
authorhataejun <taejun.ha@samsung.com>
Fri, 8 Mar 2013 05:34:10 +0000 (14:34 +0900)
committerhataejun <taejun.ha@samsung.com>
Fri, 8 Mar 2013 05:34:10 +0000 (14:34 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#] 8548
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: I56c3f78c69f06bcd6831a9251cf5523a689eec44

src/builder/Builder.rb
src/pkg_server/distribution.rb

index 386cb944680807e8dff2b497399505a7fde0a4b3..c4855f5f780a45efc1ef55aae758274fe6c1c8a6 100644 (file)
@@ -296,12 +296,18 @@ class Builder
                if not execute_build_command("build", src_path, build_root_dir, os, pkginfo.get_version) then
                        return false
                end
+
                # execute install script
                @log.info( "Make install...", Log::LV_USER)
                if not execute_build_command("install", src_path, build_root_dir, os, pkginfo.get_version) then
                        return false
                end
 
+               # check uncompressed directory size
+               if not check_uncompressed_size(pkginfo, os, src_path ) then
+                       return false
+               end
+
                # write pkginfo
                @log.info( "Generatiing pkginfo.manifest...", Log::LV_USER)
                if not write_pkginfo_files(pkginfo,os,src_path) then
@@ -744,4 +750,27 @@ VERSION=\"#{version}\" "
                # execute
                return execute_build_command("clean", src_path, build_root_dir, target_os, pkginfo.get_version)
        end
+
+       def check_uncompressed_size(pkginfo, os, src_path)
+               # get category
+               os_category = Utils.get_os_category( os )
+
+               pkginfo.packages.each do |pkg|
+                       # skip if not support the target os
+                       if not pkg.os_list.include? os
+                               next
+                       end
+                       
+                       cmd = "du --block-size=1 -s #{src_path}/package/#{pkg.package_name}.package.#{os}"
+
+                       ret = Utils.execute_shell_return_ret(cmd)
+                       if not ret.nil? then
+                               uncompressed_size = ret.split(" ")[0]
+                               pkg.uncompressed_size = uncompressed_size
+                       end
+               end
+
+               return true
+
+       end
 end
index 54771d092df4e2a26df97e2f26c06bf2a988f874..5aa613b129fb992961d473044546ec4d328cb014 100644 (file)
@@ -95,14 +95,6 @@ class Distribution
                        pkg.size = `du -b #{file_path}`.split[0].strip
                end
 
-               if pkg.uncompressed_size.empty? then
-                       if File.extname( file_path ).eql? ".zip" then
-                               output = `zipinfo -t #{file_path}`
-
-                               pkg.uncompressed_size = output.scan(/\d+/)[1]
-                       end
-               end
-
                @pkg_hash_os[pkg.os][pkg.package_name] = pkg
 
                return pkg