A user recently asked if we could show the size of the port/package. Getting the size of the distfiles is relatively easy. It’s in the distinfo
file. For slave ports, we already know the master port, so we get the information from there.
It might also be nice to show the size of the package. But what package? There are different packages for different platforms and architectures. I think that one is a little too hard.
Now, if someone can just create a perl function that will return a hash/array of distfile and size, that would help me a lot!
Will the new Perl function that you speak of be independent, or will it have to work and/or can depend on other existing Perl code?
It can be created independently. It will will be incorporated into existing perl code. It won’t depend on anything else. The in parameter will be the [full] pathname to the distfile.
Ok (about the solution being independent).
How a distfile (as in source for a port) help in finding a port’s package size? Or, is it assumed that package name can be derived from a distfile name? Mind that some ports do not have a distfile like devel/portlint and some may need more than one distfile which may possibly cause the pkg-name to be modified (due to options & such).
I was thinking that input would be the port origin, and better yet port-name-version string, that will be used to create a query to search FreeBSD ports to find links to the package. Then the package link will be used to get size information from the ftp/web server.
Getting the package size is a totally different approach to the problem. I wanted to start with distfile size because that’s easy to do and is an indication of how much you’re going to need to download. Getting that information from the distinfo file is pretty straight forward. To be complete, and give the user information about how much is going to be downloaded, FreshPorts could then go through the dependencies to find out the size of everything required.
For package size, this is a different issue. I think the easiest way there is a directory listing, taken from a mirror.
Ah, ok. I will work on getting distfile sizes and post the code here (unless you would prefer some other way).
If the input will be the distfile name, how would i get the location of distinfo? If both the port origin & distfile name given, that would help a lot.
Sorry, I mean the name of the distinfo file, not the name of the distfile.
By port origin, do you mean ‘sysutils/bacula-server’?
For what it’s worth, this function won’t get called called for ports without distinfo files (e.g. some slave ports).
BTW: why do you want the port origin? I think distinfo filename should be enough.
I wanted the port origin (yes like “sysutils/bacula-server”) for the case of slave port. Now that you mention that code will not be called for slave port, i would not be needing it.
I have finished it which accounted for slave ports; code will need very minor adjustments to reflect the reality (of not being called for slave ports).
Try it until then from
FreshPorts-File-Size-Dist-0.01.tar.gz; i will update it later today under different version number.
Hi Dan, I have uploaded FreshPorts::File::Size::Dist v0.02 which takes only a path to readble distinfo file, per your most recent reply.
coolcoolhu coolhu
Hi Dan, could you please let me know if you (like|hate|use)d the posted code?
Given that I am noticing access to previously mentioned FreshPorts::File::Size::Dist file(s), I should mention that that had been removed given lack of response.
Oh, sorry about that. I wish you left it up there. Sometimes it takes a while for things to happen.