mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 12:12:47 +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
|
--test
|
||||||
--tgz
|
--tgz
|
||||||
--verbose
|
--verbose
|
||||||
|
--fetch-sources
|
||||||
'
|
'
|
||||||
|
|
||||||
__tito_release_opts='
|
__tito_release_opts='
|
||||||
|
|
|
@ -21,6 +21,7 @@ import sys
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import rpm
|
import rpm
|
||||||
|
import urllib.request
|
||||||
from pkg_resources import require
|
from pkg_resources import require
|
||||||
from distutils.version import LooseVersion as loose_version
|
from distutils.version import LooseVersion as loose_version
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
@ -79,6 +80,7 @@ class BuilderBase(object):
|
||||||
|
|
||||||
self.quiet = self._get_optional_arg(kwargs, 'quiet', False)
|
self.quiet = self._get_optional_arg(kwargs, 'quiet', False)
|
||||||
self.verbose = self._get_optional_arg(kwargs, 'verbose', 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)
|
rpmbuildopts = self._get_optional_arg(args, 'rpmbuild_options', None)
|
||||||
if rpmbuildopts:
|
if rpmbuildopts:
|
||||||
|
@ -86,6 +88,9 @@ class BuilderBase(object):
|
||||||
else:
|
else:
|
||||||
self.rpmbuild_options = self._get_optional_arg(kwargs, 'rpmbuild_options', '')
|
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)
|
self.test = self._get_optional_arg(kwargs, 'test', False)
|
||||||
# Allow a builder arg to override the test setting passed in, used by
|
# Allow a builder arg to override the test setting passed in, used by
|
||||||
# releasers in their config sections.
|
# releasers in their config sections.
|
||||||
|
|
|
@ -274,6 +274,9 @@ class BaseCliModule(object):
|
||||||
"offline"):
|
"offline"):
|
||||||
self.options.offline = True
|
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:
|
# TODO: Not ideal:
|
||||||
if self.options.debug:
|
if self.options.debug:
|
||||||
os.environ['DEBUG'] = "true"
|
os.environ['DEBUG'] = "true"
|
||||||
|
@ -355,6 +358,10 @@ class BuildModule(BaseCliModule):
|
||||||
default='',
|
default='',
|
||||||
metavar="COLLECTION", help="Build package for software collection.")
|
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):
|
def main(self, argv):
|
||||||
BaseCliModule.main(self, argv)
|
BaseCliModule.main(self, argv)
|
||||||
|
|
||||||
|
@ -375,6 +382,7 @@ class BuildModule(BaseCliModule):
|
||||||
'scl': self.options.scl,
|
'scl': self.options.scl,
|
||||||
'quiet': self.options.quiet,
|
'quiet': self.options.quiet,
|
||||||
'verbose': self.options.verbose,
|
'verbose': self.options.verbose,
|
||||||
|
'fetch_sources': self.options.fetch_sources,
|
||||||
}
|
}
|
||||||
|
|
||||||
builder = create_builder(package_name, build_tag,
|
builder = create_builder(package_name, build_tag,
|
||||||
|
|
Loading…
Add table
Reference in a new issue