]> granicus.if.org Git - sudo/commitdiff
Add support for Installed-Size header in control file, required by
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 4 Jun 2012 18:53:58 +0000 (14:53 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 4 Jun 2012 18:53:58 +0000 (14:53 -0400)
newer debian versions.

--HG--
branch : 1.7

pp

diff --git a/pp b/pp
index 21baadfc1c5d7d5299aae66e93683a7241666b4b..d637bd6c7ffca2a5c17da7958364f832d43af791 100755 (executable)
--- a/pp
+++ b/pp
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Copyright 2012 Quest Software, Inc. ALL RIGHTS RESERVED
-pp_revision="359"
+pp_revision="361"
  # Copyright 2012 Quest Software, Inc.  ALL RIGHTS RESERVED.
  #
  # Redistribution and use in source and binary forms, with or without
@@ -3894,7 +3894,7 @@ pp_deb_munge_description () {
     # Insert a leading space on each line, replace blank lines with a
     #space followed by a full-stop.
     pp_deb_control_description="`echo ${pp_deb_description:-$description} | \
-        sed 's,^\(.*\)$, \1, " \ | sed 's,^[ \t]*$, .,g' | fmt -w 80`"
+        sed 's,^\(.*\)$, \1, ' | sed 's,^[ \t]*$, .,g' | fmt -w 80`"
 }
 
 pp_deb_detect_arch () {
@@ -3929,7 +3929,13 @@ pp_deb_conflict () {
 }
 
 pp_deb_make_control() {
-    package_name=`pp_deb_cmp_full_name "$1"`
+    local cmp="$1"
+    local installed_size
+
+    # compute the installed size
+    installed_size=`pp_deb_files_size < $pp_wrkdir/%files.$cmp`
+
+    package_name=`pp_deb_cmp_full_name "$cmp"`
     cat <<-.
        Package: ${package_name}
        Version: `pp_deb_version_final`-${pp_deb_release:-1}
@@ -3939,13 +3945,14 @@ pp_deb_make_control() {
        Maintainer: ${pp_deb_maintainer:-$maintainer}
        Description: ${pp_deb_summary:-$summary}
        ${pp_deb_control_description}
+       Installed-Size: ${installed_size}
 .
-    if test -s $pp_wrkdir/%depend."$1"; then
+    if test -s $pp_wrkdir/%depend."$cmp"; then
        sed -ne '/^[    ]*$/!s/^[       ]*/Depends: /p' \
-           < $pp_wrkdir/%depend."$1"
+           < $pp_wrkdir/%depend."$cmp"
     fi
-    if test -s $pp_wrkdir/%conflict."$1"; then
-       pp_deb_conflict < $pp_wrkdir/%conflict."$1"
+    if test -s $pp_wrkdir/%conflict."$cmp"; then
+       pp_deb_conflict < $pp_wrkdir/%conflict."$cmp"
     fi
 }
 
@@ -4025,6 +4032,16 @@ pp_deb_fakeroot () {
     fi
 }
 
+pp_deb_files_size () {
+    local t m o g f p st
+    while read t m o g f p st; do
+        case $t in
+            f|s) du -k "${pp_destdir}$p";;
+            d)   echo 4;;
+        esac
+    done | awk '{n+=$1} END {print n}'
+}
+
 pp_deb_make_DEBIAN() {
     local cmp="${1:-run}"
     local data cmp_full_name