mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] opkg-utils: Added patch to fill out Installed-Size
@ 2012-03-23 21:25 George McCollister
  2012-03-24 10:21 ` Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: George McCollister @ 2012-03-23 21:25 UTC (permalink / raw)
  To: ptxdist

Installed-Size wasn't being filled out in the Packages file. If
Installed-Size is omitted no disk free space check are performed.
opkg will perform proper disk free space checks when installing
packages from repositories generated using opkg-utils with this patch.

Signed-off-by: George McCollister <george.mccollister@gmail.com>
---
 ...tils-use-env-python-instead-of-fixed-path.patch |   10 +++---
 .../0006-Fill-out-Installed-Size.patch             |   36 ++++++++++++++++++++
 patches/opkg-utils-r4747/series                    |    3 +-
 3 files changed, 43 insertions(+), 6 deletions(-)
 create mode 100644 patches/opkg-utils-r4747/0006-Fill-out-Installed-Size.patch

diff --git a/patches/opkg-utils-r4747/0001-opkg-utils-use-env-python-instead-of-fixed-path.patch b/patches/opkg-utils-r4747/0001-opkg-utils-use-env-python-instead-of-fixed-path.patch
index e6e00be..fb55bcd 100644
--- a/patches/opkg-utils-r4747/0001-opkg-utils-use-env-python-instead-of-fixed-path.patch
+++ b/patches/opkg-utils-r4747/0001-opkg-utils-use-env-python-instead-of-fixed-path.patch
@@ -16,7 +16,7 @@ Signed-off-by: George McCollister <george.mccollister@gmail.com>
  5 files changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/opkg-list-fields b/opkg-list-fields
-index d263b90..da78d53 100755
+index d263b90..96057f0 100755
 --- a/opkg-list-fields
 +++ b/opkg-list-fields
 @@ -1,4 +1,4 @@
@@ -26,7 +26,7 @@ index d263b90..da78d53 100755
  import sys, opkg
  
 diff --git a/opkg-make-index b/opkg-make-index
-index ae829e6..6ebba5f 100755
+index ae829e6..e691f3c 100755
 --- a/opkg-make-index
 +++ b/opkg-make-index
 @@ -1,4 +1,4 @@
@@ -36,7 +36,7 @@ index ae829e6..6ebba5f 100755
  import sys, os, posixpath
  from glob import glob
 diff --git a/opkg-show-deps b/opkg-show-deps
-index a6681f4..9de1aac 100755
+index a6681f4..af6e7e5 100755
 --- a/opkg-show-deps
 +++ b/opkg-show-deps
 @@ -1,4 +1,4 @@
@@ -46,7 +46,7 @@ index a6681f4..9de1aac 100755
  import sys, os, posixpath
  from glob import glob
 diff --git a/opkg-unbuild b/opkg-unbuild
-index eff604b..b5c5227 100755
+index eff604b..d39791c 100755
 --- a/opkg-unbuild
 +++ b/opkg-unbuild
 @@ -1,4 +1,4 @@
@@ -56,7 +56,7 @@ index eff604b..b5c5227 100755
  import sys, os, re
  
 diff --git a/opkg-update-index b/opkg-update-index
-index 807f8f4..3864fa5 100755
+index 807f8f4..3f3a98f 100755
 --- a/opkg-update-index
 +++ b/opkg-update-index
 @@ -1,4 +1,4 @@
diff --git a/patches/opkg-utils-r4747/0006-Fill-out-Installed-Size.patch b/patches/opkg-utils-r4747/0006-Fill-out-Installed-Size.patch
new file mode 100644
index 0000000..fbdde2f
--- /dev/null
+++ b/patches/opkg-utils-r4747/0006-Fill-out-Installed-Size.patch
@@ -0,0 +1,36 @@
+From: George McCollister <george.mccollister@gmail.com>
+Date: Fri, 23 Mar 2012 13:13:41 -0500
+Subject: [PATCH] Fill out Installed-Size
+
+Fill out Installed-Size so opkg can check to make sure there is enough
+space to install the package before attempting to do so.
+
+Signed-off-by: George McCollister <george.mccollister@gmail.com>
+---
+ opkg.py |    6 +++++-
+ 1 files changed, 5 insertions(+), 1 deletions(-)
+
+diff --git a/opkg.py b/opkg.py
+index b000082..2531871 100644
+--- a/opkg.py
++++ b/opkg.py
+@@ -162,6 +162,10 @@ class Package:
+             ## sys.stderr.write("  extracting control.tar.gz from %s\n"% (fn,)) 
+ 
+             ar = arfile.ArFile(f)
++            tarStream = ar.open("data.tar.gz")
++            tarf = tarfile.open("data.tar.gz", "r", tarStream)
++            self.installed_size = sum([f.size for f in tarf.getmembers()])
++
+             tarStream = ar.open("control.tar.gz")
+             tarf = tarfile.open("control.tar.gz", "r", tarStream)
+ 
+@@ -437,7 +441,7 @@ class Package:
+         if self.md5: out = out + "MD5Sum: %s\n" % (self.md5)
+         if self.sha256: out = out + "SHA256Sum: %s\n" % (self.sha256)
+         if self.size: out = out + "Size: %d\n" % int(self.size)
+-        if self.installed_size: out = out + "InstalledSize: %d\n" % int(self.installed_size)
++        if self.installed_size: out = out + "Installed-Size: %d\n" % int(self.installed_size)
+         if self.filename: out = out + "Filename: %s\n" % (self.filename)
+         if self.source: out = out + "Source: %s\n" % (self.source)
+         if self.description: out = out + "Description: %s\n" % (self.description)
diff --git a/patches/opkg-utils-r4747/series b/patches/opkg-utils-r4747/series
index af02bbc..3258139 100644
--- a/patches/opkg-utils-r4747/series
+++ b/patches/opkg-utils-r4747/series
@@ -5,4 +5,5 @@
 0003-opkg-build-don-t-use-bashism.patch
 0004-opkg-Added-sha256-support.patch
 0005-opkg-build-use-CROSS_COMPILE-ar.patch
-# 3a9d9f3edf82a47598bc29fe4458b0fd  - git-ptx-patches magic
+0006-Fill-out-Installed-Size.patch
+# 5aded1e9c50a39f9e0f80584cc2f2aaf  - git-ptx-patches magic
-- 
1.7.8.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] [PATCH] opkg-utils: Added patch to fill out Installed-Size
  2012-03-23 21:25 [ptxdist] [PATCH] opkg-utils: Added patch to fill out Installed-Size George McCollister
@ 2012-03-24 10:21 ` Michael Olbrich
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2012-03-24 10:21 UTC (permalink / raw)
  To: ptxdist

On Fri, Mar 23, 2012 at 04:25:56PM -0500, George McCollister wrote:
> Installed-Size wasn't being filled out in the Packages file. If
> Installed-Size is omitted no disk free space check are performed.
> opkg will perform proper disk free space checks when installing
> packages from repositories generated using opkg-utils with this patch.

Thanks. Applied.

Michael

> Signed-off-by: George McCollister <george.mccollister@gmail.com>
> ---
>  ...tils-use-env-python-instead-of-fixed-path.patch |   10 +++---
>  .../0006-Fill-out-Installed-Size.patch             |   36 ++++++++++++++++++++
>  patches/opkg-utils-r4747/series                    |    3 +-
>  3 files changed, 43 insertions(+), 6 deletions(-)
>  create mode 100644 patches/opkg-utils-r4747/0006-Fill-out-Installed-Size.patch
> 
> diff --git a/patches/opkg-utils-r4747/0001-opkg-utils-use-env-python-instead-of-fixed-path.patch b/patches/opkg-utils-r4747/0001-opkg-utils-use-env-python-instead-of-fixed-path.patch
> index e6e00be..fb55bcd 100644
> --- a/patches/opkg-utils-r4747/0001-opkg-utils-use-env-python-instead-of-fixed-path.patch
> +++ b/patches/opkg-utils-r4747/0001-opkg-utils-use-env-python-instead-of-fixed-path.patch
> @@ -16,7 +16,7 @@ Signed-off-by: George McCollister <george.mccollister@gmail.com>
>   5 files changed, 5 insertions(+), 5 deletions(-)
>  
>  diff --git a/opkg-list-fields b/opkg-list-fields
> -index d263b90..da78d53 100755
> +index d263b90..96057f0 100755
>  --- a/opkg-list-fields
>  +++ b/opkg-list-fields
>  @@ -1,4 +1,4 @@
> @@ -26,7 +26,7 @@ index d263b90..da78d53 100755
>   import sys, opkg
>   
>  diff --git a/opkg-make-index b/opkg-make-index
> -index ae829e6..6ebba5f 100755
> +index ae829e6..e691f3c 100755
>  --- a/opkg-make-index
>  +++ b/opkg-make-index
>  @@ -1,4 +1,4 @@
> @@ -36,7 +36,7 @@ index ae829e6..6ebba5f 100755
>   import sys, os, posixpath
>   from glob import glob
>  diff --git a/opkg-show-deps b/opkg-show-deps
> -index a6681f4..9de1aac 100755
> +index a6681f4..af6e7e5 100755
>  --- a/opkg-show-deps
>  +++ b/opkg-show-deps
>  @@ -1,4 +1,4 @@
> @@ -46,7 +46,7 @@ index a6681f4..9de1aac 100755
>   import sys, os, posixpath
>   from glob import glob
>  diff --git a/opkg-unbuild b/opkg-unbuild
> -index eff604b..b5c5227 100755
> +index eff604b..d39791c 100755
>  --- a/opkg-unbuild
>  +++ b/opkg-unbuild
>  @@ -1,4 +1,4 @@
> @@ -56,7 +56,7 @@ index eff604b..b5c5227 100755
>   import sys, os, re
>   
>  diff --git a/opkg-update-index b/opkg-update-index
> -index 807f8f4..3864fa5 100755
> +index 807f8f4..3f3a98f 100755
>  --- a/opkg-update-index
>  +++ b/opkg-update-index
>  @@ -1,4 +1,4 @@
> diff --git a/patches/opkg-utils-r4747/0006-Fill-out-Installed-Size.patch b/patches/opkg-utils-r4747/0006-Fill-out-Installed-Size.patch
> new file mode 100644
> index 0000000..fbdde2f
> --- /dev/null
> +++ b/patches/opkg-utils-r4747/0006-Fill-out-Installed-Size.patch
> @@ -0,0 +1,36 @@
> +From: George McCollister <george.mccollister@gmail.com>
> +Date: Fri, 23 Mar 2012 13:13:41 -0500
> +Subject: [PATCH] Fill out Installed-Size
> +
> +Fill out Installed-Size so opkg can check to make sure there is enough
> +space to install the package before attempting to do so.
> +
> +Signed-off-by: George McCollister <george.mccollister@gmail.com>
> +---
> + opkg.py |    6 +++++-
> + 1 files changed, 5 insertions(+), 1 deletions(-)
> +
> +diff --git a/opkg.py b/opkg.py
> +index b000082..2531871 100644
> +--- a/opkg.py
> ++++ b/opkg.py
> +@@ -162,6 +162,10 @@ class Package:
> +             ## sys.stderr.write("  extracting control.tar.gz from %s\n"% (fn,)) 
> + 
> +             ar = arfile.ArFile(f)
> ++            tarStream = ar.open("data.tar.gz")
> ++            tarf = tarfile.open("data.tar.gz", "r", tarStream)
> ++            self.installed_size = sum([f.size for f in tarf.getmembers()])
> ++
> +             tarStream = ar.open("control.tar.gz")
> +             tarf = tarfile.open("control.tar.gz", "r", tarStream)
> + 
> +@@ -437,7 +441,7 @@ class Package:
> +         if self.md5: out = out + "MD5Sum: %s\n" % (self.md5)
> +         if self.sha256: out = out + "SHA256Sum: %s\n" % (self.sha256)
> +         if self.size: out = out + "Size: %d\n" % int(self.size)
> +-        if self.installed_size: out = out + "InstalledSize: %d\n" % int(self.installed_size)
> ++        if self.installed_size: out = out + "Installed-Size: %d\n" % int(self.installed_size)
> +         if self.filename: out = out + "Filename: %s\n" % (self.filename)
> +         if self.source: out = out + "Source: %s\n" % (self.source)
> +         if self.description: out = out + "Description: %s\n" % (self.description)
> diff --git a/patches/opkg-utils-r4747/series b/patches/opkg-utils-r4747/series
> index af02bbc..3258139 100644
> --- a/patches/opkg-utils-r4747/series
> +++ b/patches/opkg-utils-r4747/series
> @@ -5,4 +5,5 @@
>  0003-opkg-build-don-t-use-bashism.patch
>  0004-opkg-Added-sha256-support.patch
>  0005-opkg-build-use-CROSS_COMPILE-ar.patch
> -# 3a9d9f3edf82a47598bc29fe4458b0fd  - git-ptx-patches magic
> +0006-Fill-out-Installed-Size.patch
> +# 5aded1e9c50a39f9e0f80584cc2f2aaf  - git-ptx-patches magic
> -- 
> 1.7.8.4
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-24 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 21:25 [ptxdist] [PATCH] opkg-utils: Added patch to fill out Installed-Size George McCollister
2012-03-24 10:21 ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox