Add support for atch paths.

This commit is contained in:
Chris Johns 2012-11-05 23:12:01 +11:00
parent 3cb08b5230
commit ec26725433
2 changed files with 10 additions and 3 deletions

View File

@ -125,6 +125,8 @@ class build:
_notice(self.opts, 'warning: cannot make directory: %s' % (mkpath))
def get_file(self, url, local):
if local is None:
raise error.general('source/patch path invalid')
if not path.isdir(path.dirname(local)):
if not self.opts.force():
raise error.general('source path not found: %s; (--force to create)' \
@ -200,7 +202,12 @@ class build:
#
# Get the file. Checks the local source directory first.
#
source['local'] = path.join(self.config.abspath(pathkey), source['file'])
source['local'] = None
for p in self.config.define(pathkey).split(':'):
local = path.join(path.abspath(p), source['file'])
if source['local'] is None or path.exists(local):
source['local'] = local
break
#
# Is the file compressed ?
#
@ -260,7 +267,7 @@ class build:
#
# If not in the source builder package check the source directory.
#
if not path.isfile(patch['local']):
if not path.exists(patch['local']):
patch = self.parse_url(url, '_sourcedir')
self.get_file(patch['url'], patch['local'])
if 'compressed' in patch:

View File

@ -63,7 +63,7 @@ defaults = {
'_configdir': ('dir', 'optional', '%{_topdir}/config:%{_sbdir}/config'),
'_tardir': ('dir', 'optional', '%{_topdir}/tar'),
'_sourcedir': ('dir', 'optional', '%{_topdir}/sources'),
'_patchdir': ('dir', 'required', '%{_sbdir}/patches'),
'_patchdir': ('dir', 'optional', '%{_topdir}/patches:%{_sbdir}/patches'),
'_builddir': ('dir', 'optional', '%{_topdir}/build/%{name}-%{version}-%{release}'),
'_docdir': ('dir', 'none', '%{_defaultdocdir}'),
'_tmppath': ('dir', 'none', '%{_topdir}/build/tmp'),