Python script to download packages from the download repository
Hi all, For a couple of months now I am using a python script to automate the downloading of packages for windows. as it might by of interest for more people, I have now cleaned it up a bit. See attached file. Keep in mind that although very much usable, this is still work in progress. The only dependencies are Python (>= v3.1) and 7zip. I use it mainly from cygwin on Windows, but is also works from cmd.exe (make sure you have 7z.exe in the path) and Linux. The simplest usage form is: ./download-mingw-rpm.py libpoppler This downloads DLLs of poppler(mingw32-libpoppler package + dependencies) and extracts the packages below the location of the script. You can also specify another repository and build a zip file of the extracted packages. This is what I use to build a zip file of a mingw build of PulseAudio, to provide an easy download for people that want to try PulseAudio on Windows: ./download-mingw-rpm.py --make-zip --project home:mkbosmans:mingw32:pulseaudio pulseaudio I hope this can be of convenience for some people. Feedback appreciated. Maarten
Maarten, On 21/03/2011 15:38, Maarten Bosmans wrote:
For a couple of months now I am using a python script to automate the downloading of packages for windows. as it might by of interest for more people, I have now cleaned it up a bit. See attached file. Keep in mind that although very much usable, this is still work in progress.
I love this script. I used it on Linux with python 3.1 and p7zip as well as on Cygwin with the python 3.1 from cygwinports.org and the p7zip that comes with Cygwin. I just wanted to ask you how hard would it be to add two possibilities: 1) Download all packages in a noarch part of a repository (each one without dependencies) and convert them to zip. 2) Add an option which would be triggering a creation of a kind of manifest inside a zip that would list the dependencies and provides of the given package, naturally, if it is mingw32-<somepackage> only <somepackage> and if it is mingw32(<somedll>) only <somedll>. Such a script would maybe allow us to be able to run it regularily and provide zip files for download. I am ~zero in python, so asking you :) Thanks again F. -- To unsubscribe, e-mail: opensuse-mingw+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-mingw+help@opensuse.org
2011/4/6 Fridrich Strba
Maarten,
On 21/03/2011 15:38, Maarten Bosmans wrote:
For a couple of months now I am using a python script to automate the downloading of packages for windows. as it might by of interest for more people, I have now cleaned it up a bit. See attached file. Keep in mind that although very much usable, this is still work in progress.
I love this script. I used it on Linux with python 3.1 and p7zip as well as on Cygwin with the python 3.1 from cygwinports.org and the p7zip that comes with Cygwin.
Nice!
I just wanted to ask you how hard would it be to add two possibilities:
1) Download all packages in a noarch part of a repository (each one without dependencies) and convert them to zip.
I added the evaluation of *, ? and [] glob expansion. So for example you can specify pixman* to also download the debug and devel packages. You can use '*' (quote to avoid expansion by the shell) to download all packages from a repo. Upon rereading your question, I think that you would like to have a separate zipfile for each packages instead of one. Currently the script makes only one zipfile per invocation (useful for bundeling packages together). But it also prints all the rpm names to stdout. I use this functionality to save the used versions to a file in a Makefile that invokes the script. You can use it as follows to make separate zipfiles: ./download-mingw-rpm.py -p home:mkbosmans:mingw32:pulseaudio --no-deps --quiet '*' | xargs -n1 ./download-mingw-rpm.py -p home:mkbosmans:mingw32:pulseaudio --no-deps --make-zip --add-metadata
2) Add an option which would be triggering a creation of a kind of manifest inside a zip that would list the dependencies and provides of the given package, naturally, if it is mingw32-<somepackage> only <somepackage> and if it is mingw32(<somedll>) only <somedll>.
As you can see above, I added an --add-metadata option. It adds a .metadata file in the zipfile containing lines with dependencies and provides. For examle, the libflac-1.2.1-7.15.metadata reads: provides:libflac provides:libflac-8.dll requires:libogg-0.dll Please specify a better filename/format if you want it changed.
Such a script would maybe allow us to be able to run it regularily and provide zip files for download.
I am ~zero in python, so asking you :)
The new version of the script is online at: http://www.bosmans.ch/pulseaudio/download-mingw-rpm.py I made some minor other improvements. For example, it turns out that Python by default generates uncompressed zipfiles. That is changed to zlib compression now.
Thanks again
F.
Maarten -- To unsubscribe, e-mail: opensuse-mingw+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-mingw+help@opensuse.org
participants (2)
-
Fridrich Strba
-
Maarten Bosmans