I have been experimenting with the pkg.client.api API to get the expected disk usage for the installer, given a set of packages. There are no examples in the documentation, which is in "pydoc pkg.client.api", but I came up with this (some code removed):

api_inst = api.ImageInterface(img_dir, CLIENT_API_VERSION, progresstracker, None, PKG_CLIENT_NAME) api.image_create(PKG_CLIENT_NAME, CLIENT_API_VERSION, img_dir, IMG_TYPE_ENTIRE, False, repo_uri="http://ipkg.sfbay/dev";, progtrack=progress.QuietProgressTracker(), mirrors = mirrors, force=True) api_inst.plan_install(pkglist,refresh_catalogs=True,noexecute=False,verbose=True, update_index=True)
ret = api_inst.info("*", True, api.PackageInfo.ALL_OPTIONS)
pis = ret[api.ImageInterface.INFO_FOUND]
for i, pi in enumerate(pis):
    print pi.pkg_stem,"size",pi.size

The bits are not actually downloaded, but the info() method returns a list of packages with size information.

Will summing pi.size be a good estimation of disk space usage?

Thanks,
William
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to