mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 20:22:46 +00:00
Add support for string replacing MEAD_SCM_USERNAME in push URL.
This commit is contained in:
parent
0588b096ec
commit
6878b60b3b
2 changed files with 23 additions and 2 deletions
|
@ -27,7 +27,7 @@ class TitoException(Exception):
|
|||
self.message = message
|
||||
|
||||
def __str__(self):
|
||||
return "TitoException: %s" % self.message
|
||||
return "%s" % self.message
|
||||
|
||||
|
||||
class RunCommandException(Exception):
|
||||
|
@ -37,3 +37,10 @@ class RunCommandException(Exception):
|
|||
self.command = command
|
||||
self.status = status
|
||||
self.output = output
|
||||
|
||||
|
||||
class ConfigException(TitoException):
|
||||
"""
|
||||
Exception thrown when the user has specified invalid configuration.
|
||||
"""
|
||||
pass
|
||||
|
|
|
@ -22,7 +22,9 @@ from tito.compat import getoutput, getstatusoutput, write
|
|||
from tito.release import Releaser
|
||||
from tito.release.main import PROTECTED_BUILD_SYS_FILES
|
||||
from tito.buildparser import BuildTargetParser
|
||||
from tito.exception import RunCommandException
|
||||
from tito.exception import RunCommandException, ConfigException
|
||||
|
||||
MEAD_SCM_USERNAME = 'MEAD_SCM_USERNAME'
|
||||
|
||||
|
||||
class FedoraGitReleaser(Releaser):
|
||||
|
@ -426,6 +428,18 @@ class DistGitMeadReleaser(DistGitReleaser):
|
|||
else:
|
||||
self.push_url = self.mead_scm
|
||||
|
||||
# If the push URL contains MEAD_SCM_URL, we require the user to set this
|
||||
# in ~/.titorc before they can run this releaser. This allows us to
|
||||
# use push URLs that require username auth, but still check a generic
|
||||
# URL into source control:
|
||||
if MEAD_SCM_USERNAME in self.push_url:
|
||||
debug("Push URL contains %s, checking for value in ~/.titorc" %
|
||||
MEAD_SCM_USERNAME)
|
||||
if MEAD_SCM_USERNAME not in user_config:
|
||||
raise ConfigException('Must specify MEAD_SCM_USERNAME in ~/.titorc')
|
||||
self.push_url = self.push_url.replace(MEAD_SCM_USERNAME,
|
||||
user_config[MEAD_SCM_USERNAME])
|
||||
|
||||
def _sync_mead_scm(self):
|
||||
cmd = "git push %s %s" % (self.push_url, self.builder.build_tag)
|
||||
if self.dry_run:
|
||||
|
|
Loading…
Add table
Reference in a new issue