Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix svn sslverify and CentOS/RHEL 8 builds #356

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions TarSCM/scm/svn.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ def fetch_upstream_scm(self):

def update_cache(self):
"""Update sources via svn."""
command = self._get_scm_cmd() + ['update']
command = self._get_scm_cmd() + ['update', '--non-interactive']
if self.revision:
command.insert(3, "-r%s" % self.revision)
if not self.is_sslverify_enabled():
command.insert(3, '--trust-server-cert')

try:
self.helpers.safe_run(command, cwd=self.clone_dir,
Expand All @@ -130,7 +132,11 @@ def detect_version(self, args):
if versionformat is None:
versionformat = '%r'

svn_info = self.helpers.safe_run(self._get_scm_cmd() + ['info'],
command = self._get_scm_cmd() + ['info', '--non-interactive']
if not self.is_sslverify_enabled():
command.insert(3, '--trust-server-cert')

svn_info = self.helpers.safe_run(command,
self.clone_dir)[1]

version = ''
Expand All @@ -143,8 +149,11 @@ def detect_version(self, args):
return re.sub('%r', version, versionformat)

def get_timestamp(self):
svn_info = self.helpers.safe_run(self._get_scm_cmd() + ['info',
'-rHEAD'],
command = self._get_scm_cmd() + ['info', '--non-interactive', '-rHEAD']
if not self.is_sslverify_enabled():
command.insert(3, '--trust-server-cert')

svn_info = self.helpers.safe_run(command,
self.clone_dir)[1]

match = re.search(
Expand Down Expand Up @@ -199,12 +208,13 @@ def get_repocache_hash(self, subdir):

def _get_log(self, clone_dir, revision1, revision2):
new_lines = []
command = self._get_scm_cmd() + ['log', '--non-interactive',
'-r%s:%s' % (revision2, revision1),
'--xml']
if not self.is_sslverify_enabled():
command.insert(3, '--trust-server-cert')

xml_lines = self.helpers.safe_run(
self._get_scm_cmd() + ['log', '-r%s:%s' % (revision2, revision1),
'--xml'],
clone_dir
)[1]
xml_lines = self.helpers.safe_run(command, clone_dir)[1]

lines = re.findall(r"<msg>.*?</msg>", xml_lines, re.S)

Expand All @@ -216,7 +226,11 @@ def _get_log(self, clone_dir, revision1, revision2):

def _get_rev(self, clone_dir, num_commits):
cmd = self._get_scm_cmd()
cmd.extend(['log', '-l%d' % num_commits, '-q', '--incremental'])
cmd.extend(['log', '--non-interactive', '-l%d' % num_commits, '-q',
'--incremental'])
if not self.is_sslverify_enabled():
cmd.insert(3, '--trust-server-cert')

raw = self.helpers.safe_run(cmd, cwd=clone_dir)
revisions = raw[1].split("\n")
# remove blank entry on end
Expand Down
2 changes: 1 addition & 1 deletion dist/obs-service-tar_scm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
%bcond_with obs_scm_testsuite
%endif

%if 0%{?suse_version} >= 1315 || 0%{?fedora_version} >= 29
%if 0%{?suse_version} >= 1315 || 0%{?fedora_version} >= 29 || 0%{?rhel_version} >= 800 || 0%{?centos_version} >= 800 || 0%{?rhel} >= 8
%bcond_without python3
%else
%bcond_with python3
Expand Down