Manpreet Singh wrote:
Bart Smaalders wrote:
Manpreet Singh wrote:
Hi,
    The Update Center 2.0 project needs to show the actual size
of the 'download' that will occur if a pkg is downloaded. The
'sum of pkg.size over actions' currently being used represents
the uncompressed size of the pkg content. Is there currently a
way to get at the compressed size so we can provide users with
the correct download size (to avoid putting them off the download)?

Thanks
Manpreet Singh
Not at present; I take it this would be a useful thing to keep track
of in the future?


I certainly think so.


- Bart



I've filed an RFE at

http://defect.opensolaris.org/bz/show_bug.cgi?id=1018

though I am not sure how to mark it RFE and not a bug.

Thanks
Manpreet

Attaching a possible implementation. I've tried it out on a local instance.

Thanks
Manpreet
--
(Randomly selected sig)
There are perfectly good answers to those questions, but they'll have
to wait for another night.
 -- Homer Simpson - Homers Barbershop Quartet
diff -r 88f8e588cf60 src/client.py
--- a/src/client.py     Mon Apr 07 16:24:49 2008 -0700
+++ b/src/client.py     Mon Apr 07 17:25:20 2008 -0700
@@ -699,7 +699,7 @@
 
         valid_special_attrs = [ "action.name", "action.key", "action.raw",
             "pkg.name", "pkg.fmri", "pkg.shortfmri", "pkg.authority",
-            "pkg.size" ]
+            "pkg.size", "pkg.csize" ]
 
         display_headers = True
         display_raw = False
diff -r 88f8e588cf60 src/modules/server/transaction.py
--- a/src/modules/server/transaction.py Mon Apr 07 16:24:49 2008 -0700
+++ b/src/modules/server/transaction.py Mon Apr 07 17:25:20 2008 -0700
@@ -29,6 +29,7 @@
 import sha
 import shutil
 import socket
+import sys
 import time
 import urllib
 import httplib
@@ -256,6 +257,10 @@
                         m = nbuf * bufsz
                         ofile.write(data[m:])
                         ofile.close()
+                        try:
+                                action.attrs["pkg.csize"] = 
str(os.stat(os.path.join(self.dir, fname))[6])
+                        except:
+                                action.attrs["pkg.csize"] = 
action.attrs["pkg.size"]
 
                 tfile = file("%s/manifest" % self.dir, "a")
                 print >>tfile, action
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to