Let say, I try to emerge xyz Calculating dependencies ...done! >>> emerge (1 of 1) media-sound/xyz-0.9.8 to / ... If the file is corrupt or incomplete, emerge recognise it and try to make a new download, but didn't give any error message. *I* have *no* internet connection, so I have to make the download myself and transfer the file with a memory stick. BUT my file was incomplete and emerge don't say it to me! As in the case the md5 is not correct, I suggest a ligth modification of the emerge command, in the file "portage.py" such we get a better error message and can do the necessary about the xyz-file, and restart the emerge: ============================ File: portage.py if mydigests!=None and mydigests.has_key(myfile): #if we have the digest file, we know the #final size if mystat[ST_SIZE]<mydigests[myfile]["size"]: #fetched=1 print print red("!!! File is corrupt or incomplete. (Length do not match)") print green(">>> our recorded length:"),mydigests[myfile]["size"] print green(">>> your file's length:"),mystat[ST_SIZE] print red("!!! File: "),mysettings["DISTDIR"]+"/"+myfile print return 0 ========================== The line fetched=1 is no more necessary. With this modification, I get: # emerge xyz Calculating dependencies ...done! >>> emerge (1 of 1) media-sound/xyz-0.9.8 to / !!! File is corrupt or incomplete. (Length do not match) >>> our recorded length: 1491132 >>> your file's length: 757632 !!! File: /usr/portage/distfiles/xyz-0.9.8.tar.bz2 Have a nice day Reproducible: Always Steps to Reproduce: 1. 2. 3.
Test Case: 1) emerge -pf ftp to get a listing of places to download the ftp package from. 2) use wget to get the file. 3) Transfer that file to /tmp for now. 4) Create a file with nano/vi/cat/echo that says the following: This is a test. 5) mv that file to /usr/portage/distfiles with the same name as the file downloaded in step 2 6) emerge ftp 7) emerge should compalin about a corrupted file
oops, forgot the rest: 8) Just to make sure, move the file from step 3 to /usr/portage/distfiles, making sure it's replaced. 9) emerge ftp and emerge should not complain.
Results of the test case for me: bash-2.05b# emerge ftp Calculating dependencies ...done! >>> emerge (1 of 1) net-ftp/ftp-0.17-r3 to / >>> Resuming download... >>> Downloading http://mirrors.tds.net/gentoo/distfiles/netkit-ftp-0.17.tar.gz --04:42:37-- http://mirrors.tds.net/gentoo/distfiles/netkit-ftp-0.17.tar.gz => `/usr/portage/distfiles/netkit-ftp-0.17.tar.gz' mirrors.tds.net をDNSに問いあわせています... 216.170.153.145 mirrors.tds.net[216.170.153.145]:80 に接続しています... 接続しました。 HTTP による接続要求を送信しました、応答を待っています... 206 Partial Content 長さ: 53,934 (のこり53,918) [application/x-gzip] 100%[====================================>] 53,934 182.87K/s 04:42:38 (182.84 KB/s) - `/usr/portage/distfiles/netkit-ftp-0.17.tar.gz' を保存しました [53934/53934] !!! File is corrupt or incomplete. (Digests do not match) >>> our recorded digest: 94441610c9b86ef45c4c6ec609444060 >>> your file's digest: 618f0fa0da136e870ff64cf781e77dda !!! File does not exist: /usr/portage/distfiles//netkit-ftp-0.17.tar.gz One note I may add is that portage here tries to resume the file. If your computer does not have internet access, that may be the issue. Please let me know by running this test case with the output. Also: sys-apps/portage-2.0.50-r6 * Is my version of portage.
The fetched=1 is necessary to resume aborted downloads. If you don't have internet access at the box in general I't probably an idea to change FETCHCOMMAND and RESUMECOMMAND in make.conf to "echo trying to download ${URI}" so portage will just print the URL instead of trying to fetch it.