[wpkg-users] Package Download patch

Tomasz Chmielewski mangoo at wpkg.org
Sun May 7 21:04:01 CEST 2006

Andre Ilie wrote:
> Hi
>     Just had some time to implement this package downloading stuff. I 

0.9.8 patched with newest "package download" patch wouldn't work due to 
undefined 'newPrio' variable (one has to add something like "var 
newPrio;" at the beginning of wpkg.js).

>     Downloading of packages is implemented like this:
>     1. You can define an environment variable called WPKG_SOURCE where 
> the packages get downloaded to. If its not defined we use %TEMP%\wpkg. 
> You can use this environment var in your <install>, <remove> and 
> <upgrade> commands. After successfull installation the downloaded files 
> get removed. Files get overwritten on download if there. I've used an 
> environment var because you can access it from the scripts/programs run 
> from wpkg.

For some reason it doesn't work for me.
I tried to install a program off a web server in LAN.

WPKG says:

Downloading "http://server/file.exe" to 
Instalation error...

Could not download required files.

However, when I look into C:\Dokume~1\Admini~1\Lokale~1\Temp\wpkg\ I can 
see the file is downloaded there.

My package entry looks like this:

<file name="file-downloaded.exe"
<source url="http://server/file.exe" />
<install cmd='"%WPKG_SOURCE%\file-downloaded.exe"' />

I tried also changing %WPKG_SOURCE% and other things and names, but in 
the end, I just changed the install command to:

<install cmd='notepad' />

And still got the same error (and notepad didn't show up).

Any clue what's wrong? Or am I blind and it doesn't work just for me? :)

Other thing: perhaps it would be wise if the thing worked like that:

* if source url / file name has md5 sum set do:
   - check if the file is in %WPKG_SOURCE%
   - if the file is there, calculate md5 sum
   - if the sum matches, launch the installer (don't download)
   - if the sum doesn't match, download

This way, if someone has a big network without a proxy, he could 
download to a central location on a server?
This also means we would need something like:
- remove="no" to <file ...>
- download with a temp name, and when the download is complete, move it 
to the correct name (in case several hosts in the network download at 
the same time).

But before we do that, we should decide if it would be useful and safe 
to download to a central location.

>     2. Added some code to installPackage() to allow downloading of 
> several files for a package from several sources. You can define source 
> files either with or without MD5 checksum. When its there, it will be 
> checked using an external tool (md5.exe, which you can get from here: 
> http://www.fourmilab.ch/md5/ . I gave up on using a native MD5 
> implementation in JScript as its really really slow (3MB in ~30 
> seconds). You can also define a HTTP timeout, to skip the source if it 
> takes too much time (default timeout is 7200s). The XML format is:

I guess and external md5 is fine.
It's not very big (~50k uncompressed binary), has source code, and even 
its license allows us to bundle it with WPKG:


This software is in the public domain. Permission to use, copy, modify,
and distribute this software and its documentation for any purpose and
without fee is hereby granted, without any conditions or restrictions.

So perhaps we could put it into "wpkg/tools" in a WPKG download package?


Tomasz Chmielewski

wpkg-users mailing list
wpkg-users at lists.wpkg.org

More information about the wpkg-users mailing list