diff --git a/sb/build.py b/sb/build.py index 2ee0e68..bd1305b 100644 --- a/sb/build.py +++ b/sb/build.py @@ -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: diff --git a/sb/defaults.py b/sb/defaults.py index b0b6fc5..09b0922 100644 --- a/sb/defaults.py +++ b/sb/defaults.py @@ -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'),