View previous topic :: View next topic |
Author |
Message |
sridharinfinity Tux's lil' helper
Joined: 07 Feb 2004 Posts: 84 Location: INDIA
|
Posted: Sun Aug 01, 2004 11:16 am Post subject: HOWTO Use backup distfiles |
|
|
Suppose you had backed up your distfiles content to seperate CDs or something. You could simply get needed files from them instead of fetching from internet just because portage doesn't have support for multiple distfiles path.
Run
Code: |
emerge -fp pacakge 2> list
|
Then do a
Code: |
cat list | ./putdist.py
|
for copying the files to your DISTDIR
Here's the script (putdist.py)
ChangeLog:
* bug: last file not processed - fixed.
Code: |
#!/usr/bin/python
import sys
import os
distdir = '/usr/portage/distfiles'
backups = ['/mnt/cdrom', '/mnt/cdrom1']
cached = 0
downloads = 0
for url in sys.stdin.readlines():
# last line contains some stupid characters
ig_index = url.find(chr(033))
if ig_index != -1:
url = url[:ig_index]
url = url.strip()
if url == "": continue
filename = url.split('/')[-1]
target = os.path.join(distdir, filename)
for bdir in backups:
source = os.path.join(bdir, filename)
sexists = os.path.exists(source)
texists = os.path.exists(target)
if not texists and sexists:
print 'Copying', filename, 'from', bdir
os.system('cp %s %s' % (source, target) )
cached = cached + 1
elif not texists:
downloads = downloads + 1
print cached, 'files cached'
print downloads, 'files need to be downloaded'
|
_________________ Sridhar R
WWW: http://cs.annauniv.edu/~rsridhar
Last edited by sridharinfinity on Tue Aug 03, 2004 2:14 pm; edited 1 time in total |
|
Back to top |
|
|
revertex l33t
Joined: 23 Apr 2003 Posts: 806
|
Posted: Tue Aug 03, 2004 1:40 pm Post subject: |
|
|
nice, you may submmit to bugzilla, it should be a nice portage feature or maybe part of gentoolkit |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|