OLD | NEW |
1 # getbinpkg.py -- Portage binary-package helper functions | 1 # getbinpkg.py -- Portage binary-package helper functions |
2 # Copyright 2003-2004 Gentoo Foundation | 2 # Copyright 2003-2004 Gentoo Foundation |
3 # Distributed under the terms of the GNU General Public License v2 | 3 # Distributed under the terms of the GNU General Public License v2 |
4 | 4 |
5 from portage.output import colorize | 5 from portage.output import colorize |
6 from portage.cache.mappings import slot_dict_class | 6 from portage.cache.mappings import slot_dict_class |
7 from portage.localization import _ | 7 from portage.localization import _ |
8 import portage | 8 import portage |
9 from portage import os | 9 from portage import os |
10 from portage import _encodings | 10 from portage import _encodings |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 del xpak_data | 424 del xpak_data |
425 else: | 425 else: |
426 myid = None,None | 426 myid = None,None |
427 | 427 |
428 if not keepconnection: | 428 if not keepconnection: |
429 conn.close() | 429 conn.close() |
430 | 430 |
431 return myid | 431 return myid |
432 | 432 |
433 | 433 |
434 def file_get(baseurl,dest,conn=None,fcmd=None): | 434 def file_get(baseurl,dest,conn=None,fcmd=None,filename=None): |
435 """(baseurl,dest,fcmd=) -- Takes a base url to connect to and read from. | 435 """(baseurl,dest,fcmd=) -- Takes a base url to connect to and read from. |
436 URI should be in the form <proto>://[user[:pass]@]<site>[:port]<path>""" | 436 URI should be in the form <proto>://[user[:pass]@]<site>[:port]<path>""" |
437 | 437 |
438 if not fcmd: | 438 if not fcmd: |
439 return file_get_lib(baseurl,dest,conn) | 439 return file_get_lib(baseurl,dest,conn) |
| 440 if not filename: |
| 441 filename = os.path.basename(baseurl) |
440 | 442 |
441 variables = { | 443 variables = { |
442 "DISTDIR": dest, | 444 "DISTDIR": dest, |
443 "URI": baseurl, | 445 "URI": baseurl, |
444 » » "FILE": os.path.basename(baseurl) | 446 » » "FILE": filename |
445 } | 447 } |
446 | 448 |
447 from portage.util import varexpand | 449 from portage.util import varexpand |
448 from portage.process import spawn | 450 from portage.process import spawn |
449 myfetch = portage.util.shlex_split(fcmd) | 451 myfetch = portage.util.shlex_split(fcmd) |
450 myfetch = [varexpand(x, mydict=variables) for x in myfetch] | 452 myfetch = [varexpand(x, mydict=variables) for x in myfetch] |
451 fd_pipes= { | 453 fd_pipes= { |
452 0:sys.stdin.fileno(), | 454 0:sys.stdin.fileno(), |
453 1:sys.stdout.fileno(), | 455 1:sys.stdout.fileno(), |
454 2:sys.stdout.fileno() | 456 2:sys.stdout.fileno() |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 if v is not None and v == metadata.get(k
): | 852 if v is not None and v == metadata.get(k
): |
851 del metadata[k] | 853 del metadata[k] |
852 if self._default_pkg_data: | 854 if self._default_pkg_data: |
853 for k, v in self._default_pkg_data.items(): | 855 for k, v in self._default_pkg_data.items(): |
854 if metadata.get(k) == v: | 856 if metadata.get(k) == v: |
855 metadata.pop(k, None) | 857 metadata.pop(k, None) |
856 keys = list(metadata) | 858 keys = list(metadata) |
857 keys.sort() | 859 keys.sort() |
858 self._writepkgindex(pkgfile, | 860 self._writepkgindex(pkgfile, |
859 [(k, metadata[k]) for k in keys if metadata[k]]) | 861 [(k, metadata[k]) for k in keys if metadata[k]]) |
OLD | NEW |