mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 04:02:46 +00:00
Adding option to fetch sources
This commit is contained in:
parent
24b8f3d7d4
commit
5de167e0ff
3 changed files with 14 additions and 0 deletions
|
@ -32,6 +32,7 @@ __tito_build_opts='
|
|||
--test
|
||||
--tgz
|
||||
--verbose
|
||||
--fetch-sources
|
||||
'
|
||||
|
||||
__tito_release_opts='
|
||||
|
|
|
@ -21,6 +21,7 @@ import sys
|
|||
import re
|
||||
import shutil
|
||||
import rpm
|
||||
import urllib.request
|
||||
from pkg_resources import require
|
||||
from distutils.version import LooseVersion as loose_version
|
||||
from tempfile import mkdtemp
|
||||
|
@ -79,6 +80,7 @@ class BuilderBase(object):
|
|||
|
||||
self.quiet = self._get_optional_arg(kwargs, 'quiet', False)
|
||||
self.verbose = self._get_optional_arg(kwargs, 'verbose', False)
|
||||
self.fetch_sources = self._get_optional_arg(kwargs, 'fetch_sources', False)
|
||||
|
||||
rpmbuildopts = self._get_optional_arg(args, 'rpmbuild_options', None)
|
||||
if rpmbuildopts:
|
||||
|
@ -86,6 +88,9 @@ class BuilderBase(object):
|
|||
else:
|
||||
self.rpmbuild_options = self._get_optional_arg(kwargs, 'rpmbuild_options', '')
|
||||
|
||||
if self.fetch_sources:
|
||||
self.rpmbuild_options += "--define '%_disable_source_fetch 0'"
|
||||
|
||||
self.test = self._get_optional_arg(kwargs, 'test', False)
|
||||
# Allow a builder arg to override the test setting passed in, used by
|
||||
# releasers in their config sections.
|
||||
|
|
|
@ -274,6 +274,9 @@ class BaseCliModule(object):
|
|||
"offline"):
|
||||
self.options.offline = True
|
||||
|
||||
if self.config.has_option(BUILDCONFIG_SECTION, "fetch-sources"):
|
||||
self.options.fetch_sources = self.config.get(BUILDCONFIG_SECTION, "fetch-sources")
|
||||
|
||||
# TODO: Not ideal:
|
||||
if self.options.debug:
|
||||
os.environ['DEBUG'] = "true"
|
||||
|
@ -355,6 +358,10 @@ class BuildModule(BaseCliModule):
|
|||
default='',
|
||||
metavar="COLLECTION", help="Build package for software collection.")
|
||||
|
||||
self.parser.add_option("--fetch-sources", dest='fetch_sources',
|
||||
action="store_true",
|
||||
help="Download sources from predefined Source<N> addresses to the SOURCE folder")
|
||||
|
||||
def main(self, argv):
|
||||
BaseCliModule.main(self, argv)
|
||||
|
||||
|
@ -375,6 +382,7 @@ class BuildModule(BaseCliModule):
|
|||
'scl': self.options.scl,
|
||||
'quiet': self.options.quiet,
|
||||
'verbose': self.options.verbose,
|
||||
'fetch_sources': self.options.fetch_sources,
|
||||
}
|
||||
|
||||
builder = create_builder(package_name, build_tag,
|
||||
|
|
Loading…
Add table
Reference in a new issue