| Home | Trees | Indices | Help |
|
|---|
|
|
1 # Copyright (c) 2004-2008 rPath, Inc.
2 #
3 # This program is distributed under the terms of the Common Public License,
4 # version 1.0. A copy of this license should have been distributed with this
5 # source file in a file called LICENSE. If it is not present, the license
6 # is always available at http://www.rpath.com/permanent/licenses/CPL-1.0.
7 #
8 # This program is distributed in the hope that it will be useful, but
9 # without any warranty; without even the implied warranty of merchantability
10 # or fitness for a particular purpose. See the Common Public License for
11 # full details.
12 #
13
14 """
15 Modules used by recipes to find source code, check GPG signatures on
16 it, unpack it, and patch it in the correct directory. Each of the
17 public classes in this module is accessed from a recipe as addI{Name}.
18 """
19
20 import itertools
21 import gzip
22 import os
23 import re
24 import shutil, subprocess
25 import sha
26 import sys
27 import tempfile
28
29 from conary.lib import debugger, log, magic
30 from conary.build import lookaside
31 from conary import rpmhelper
32 from conary.lib import openpgpfile, util
33 from conary.build import action, errors
34 from conary.build.errors import RecipeFileError
35 from conary.build.manifest import Manifest
36 from conary.repository import transport
37
43
45 keywords = {'rpm': '',
46 'dir': '',
47 'keyid': None,
48 'httpHeaders': {},
49 'package': None,
50 'sourceDir': None}
51
53 sourcename = args[0]
54 action.RecipeAction.__init__(self, recipe, *args, **keywords)
55 if isinstance(sourcename, (list, tuple)):
56 # This adds support for multiple URLs in a source.
57 # We stash them in recipe.multiurlMap, keyed on a digest computed
58 # over them. We replace the source with a multiurl:// one that
59 # includes the digest, and we pass that to the lookaside cache.
60 sourcename = [ x % recipe.macros for x in sourcename ]
61 # Create a hash of the URLs in the source
62 archiveName = ''
63 nsources = []
64 for x in sourcename:
65 # Do some of the work _guessName does - if an archive is
66 # provided, use its name
67 if x.endswith('/'):
68 baseUrl = x[:-1]
69 else:
70 idx = x.rindex('/')
71 baseUrl = x[:idx]
72 fName = x[idx+1:]
73 if not archiveName:
74 archiveName = fName
75 elif archiveName != fName:
76 raise SourceError("Inconsistent archive names: '%s' "
77 "and '%s'" % (archiveName, fName))
78
79 nsources.append(baseUrl)
80 s = sha.