---------- Changelog ----------
(25/September/2002):
To make it work with Portage 2.0.37, check MoonWalker's patch.
(13/July/2002):
The new script is there now.
(12/July/2002):
Warning: this script does not work with newer versions of portage, due to changes made to the format and name of the dependency file. I'll hopefully have it fixed by tomorrow.
---------- End Changelog ----------

I wrote an awk script to generate a list of files to be downloaded based on the output of emerge -p. It is intended to help those who don't have a fast Internet connection dowload their files elsewhere.

Any of the above will output a list of files to be downloaded. (2.1) and (2.2) will output the list to the screen (not very useful). (2.3) and (2.4) will save the list in the file download_list (recommended).

3. Take the generated list (download_list, or whatever you've called it) to any place where you have access to a fast Internet connection and get the files with wget:

4. Take the downloaded files back to your computer (via CD-Rs, Zip disks, hard disks, whatever) and put them in /usr/portage/distfiles. Now you can run

Code:

# emerge xfree

or

Code:

# time emerge xfree

without even needing to be connected to the Internet.

Known problems/limitations:
1. This was my first experience with awk. I wrote this script using only Daniel Robbin's Awk by example articles and the GNU Awk User's Guide. This means it is far away from being perfect. Any good programmer out there can, and is encouraged to, make it much better.
2. The way it is implemented now, the generated list can (and does) contain several entries for the same file. Fortunately, wget is smart enough to download each file only once.
3. I don't know how to handle the new "mirror://" syntax. I just left it out.

Comments:
1. The script now runs emerge internally, so you don't need to run emerge -p before. In fact, you can run it exactly as you would run emerge. You can even specify several packages or specific versions for packages. The script adds -p automatically, in case you forget.
2. mirror://sourceforge is now handled correctly, but mirror://gnome is just left out...
2.1 Update: mirror://kde is also left out.
3. The script now displays a progress bar (sort of) and some statistics.
4. The rest is basically the same.

I just installed the script and ran 'dl-list kde' and it generated a list. What version of portage are you using?

I run 2.0.37 of portage, the latest afai understand. My system is a P4 originally 1.3b upgraded with the official upgrade scripts step 1 to 4 to 1.4rc1 and after this I have run a

Code:

# emerge -e world

without any errors so I can't really figure what is going wrong here. I have no experience of bash shell scripts so not sure were it goes wrong, but some simple tries of debuging shows it seam to be the part

EDIT:
Not sure if this matter, but after upgrade to 1.4 there was actually one problem, my keymap had changes from "se-latin1" to "us" so I changed this back in rc.conf to get keyboard work as before - maybe I need to do more in this regard?
Joakim_________________/Joakim

Living on earth is expensive, but it includes a free trip around the sun
every year.

The script doesn't work on portage 2.0.37. It worked for me on 1.4rc1 with previous versions of portage. So I guess it needs an upgrade

Ok thanks, did you "hear" that fghellar? Will there be an upgrade within reasonable time or someone else capable of doing it? I guess this is pretty simple stuff, if you know how to write regexp and shell scripts...

joakim_________________/Joakim

Living on earth is expensive, but it includes a free trip around the sun
every year.

I'll send fghellar a PM. He's been busy lately, so he may not see it. May not have time to update it either. Honestly though, Portage 2.0.37 is buggy right now. I wouldn't expect any updates until some new features are working 100%._________________lolgov. 'cause where we're going, you don't have civil liberties.

I went on and stuck my noze deeper into this reading some docs... and figure out what differs with portage 2.0.37 is it don't add "to /" (or something like it) to end of row. Dispite my absolute lack of knowledge in regular expressions I managed to figure what represented this in

Posted: Tue Feb 04, 2003 3:32 pm Post subject: The bashscript does not work on all ebuilds.

Hello!
I tried the script with the patch with the latest portage (2.40? don't remember), but with some packages like kde and gnome it doesn't work.
The message I got is something like this '!!! doebuild: /usr/portage/ *the adress for the ebuild*'. I tried some debugging but i don't understand sed at all. But I think it is the packeges were ebuild add some extra information after the packeges name like this '[0.2.43]'. That text is also saved in the $temp_file_2 textfile just before the loop:

# process each package in turn
while read category package version
do

If some smart person know how to fix the script please do so.
Bye /Pontelonten

Posted: Tue Feb 04, 2003 6:35 pm Post subject: Re: The bashscript does not work on all ebuilds.

pompe wrote:

But I think it is the packeges were ebuild add some extra information after the packeges name like this '[0.2.43]'. That text is also saved in the $temp_file_2 textfile just before the loop:

# process each package in turn
while read category package version
do

Thanks for your feedbak.

Here is a quick hack for it:

Change this:

Code:

# process each package in turn
while read category package version
do

Into this:

Code:

# process each package in turn
while read category package version rest
do

This should make it work for now.

There's another issue, in that it may output some garbage along with the urls. I'm short of time right now to debug it, but I hope I'll be able to look at it this weekend._________________| www.gentoo.org | www.tldp.org | www.google.com |

Bad news #1: This donwload-list-generator script will no longer be supported, and will probably also be removed from here in the future.
Good news #1: Portage has now (since version 2.0.40) incorporated this feature, via emerge -p -f <package>.
Bad news #2: The output of emerge -p -f <package> may contain some garbage URLs sometimes.
Good news #2: This is easy to fix!

Here's what you need to do: after running emerge -p <package(s)> and making sure that that's what you want, run

Code:

emerge -p -f <package(s)> | xargs -n1 echo | grep '://'

In case you don't have xargs available, or if for any other reason you don't want to use it, this also works:

Unfortunately, this list can contain some garbage URLs, due to the fact that the use() function (defined in /usr/sbin/ebuild.sh and used in the ebuilds) generates output to the screen. Fortunately, it's very easy to "fix" this without causing any harm. Here's how:

Open the file /usr/sbin/ebuild.sh and scroll down until you find the definition of the use() function. It should look like this:

I usually (with portage-2.0.48-r5) got the list of the files to download in the file download_list, but with the newer portage I get these output written to my screen, and it generates an empty download_list file.

Anybody has the same experience? I've been trying with this quite sometime now, maybe I'm overlooking something.