- make link from "gitpath" to gitweb server.
- make link from "commitId" to gitweb server.
- add profile.yaml to config mapping between download server and gitweb
server.
Change-Id: Ia44c508786369a263b512259f8f6bd983cf78013
--- /dev/null
+profile:
+ - name: https://download.tizendev.org
+ gitweb: https://review.tizendev.org/gerrit/gitweb
+ - name: https://download.tz.otcshare.org
+ gitweb: https://tz.otcshare.org/gerrit/gitweb
+ - name: http://download.tizen.org
+ gitweb: https://review.tizen.org/gerrit/gitweb
BuildRequires: python-jinja2
BuildRequires: python-requests
BuildRequires: python-xml
+BuildRequires: python-yaml
BuildRequires: python-setuptools
Requires: python >= 2.7
Requires: python-jinja2
Requires: python-requests
Requires: python-xml
+Requires: python-yaml
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
+install -D -m 644 distfiles/profile.yaml %{buildroot}/etc/%{name}/profile.yaml
%clean
rm -rf %{buildroot}
%defattr(-,root,root)
%{_bindir}/*
%{python_sitelib}/*
+%dir %{_sysconfdir}/%{name}
+%{_sysconfdir}/%{name}/profile.yaml
import shutil
import re
+import yaml
+
from .image import ks_diff, packages
from .render import output_html
from .repo import Repo
added, removed, modified, rebuilded = [], [], [], []
package_names = set(old.__dict__.keys() + new.__dict__.keys())
+ def _get_git_web(url):
+ matchdomain = re.match(r"http[s]?://[a-z0-9\.]*", url)
+ if not matchdomain:
+ return "#"
+ srcdomain = matchdomain.group(0)
+ profile = '/etc/%s/profile.yaml' % __title__
+ gitweb_dict = {}
+ if not os.path.exists(profile):
+ return "#"
+ with open(profile, 'r') as pfile:
+ gitweb_dict = yaml.load(pfile)
+ for domain in gitweb_dict['profile']:
+ if domain['name'] == srcdomain:
+ return domain['gitweb']
+ return "#"
+
def _pair_old_new():
"""Generate old and new pkg pair"""
for name in package_names:
if style == 'image':
obj['diff']['ks'] = ks_diff(old_url, new_url)
+ obj['gitweb'] = {'old': _get_git_web(old_url),
+ 'new': _get_git_web(new_url)}
+
return json.dumps(obj, indent=4)
def diff_to_html(old_url, new_url, **kwargs):
'new': {'url': new_url,
'name': re.search(r'\w*_\d{8}\.\d*', new_url).group(0)},
'diff': data['diff'],
+ 'gitweb': data['gitweb']
}
if style == 'repo':
return output_html('diff.html', **context) # pylint: disable=W0142
</ul>
<table>
<tr><td colspan="6" class="tableTitle"><h3><a>Added Packages</a></h3></td></tr>
+ {% set git_web = gitweb %}
{% if diff['added'] %}
<tbody>
<tr>
<tr>
<td>{{ item['newpkg']['name'] }}</td>
<td colspan="2">{{ item['newpkg']['version']['ver'] }}-{{item['newpkg']['version']['rel']}}</td>
- <td>{{ item['newpkg']['git_path'] }}</td>
- <td colspan="2">{{ item['newpkg']['commit_id'] }}</td>
+ <td><a href="{{ git_web['new'] }}?p={{ item['newpkg']['git_path'] }}.git">{{ item['newpkg']['git_path'] }}</a></td>
+ <td colspan="2"><a href="{{ git_web['new'] }}?p={{ item['newpkg']['git_path'] }}.git;a=commit;h={{ item['newpkg']['commit_id'] }}">{{ item['newpkg']['commit_id'] }}</a></td>
</tr>
{% endfor %}
</tbody>
<tr>
<td>{{ item['oldpkg']['name'] }}</td>
<td colspan="2">{{ item['oldpkg']['version']['ver'] }}-{{item['oldpkg']['version']['rel']}}</td>
- <td>{{ item['oldpkg']['git_path'] }}</td>
- <td colspan="2">{{ item['oldpkg']['commit_id'] }}</td>
+ <td><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git">{{ item['oldpkg']['git_path'] }}</a></td>
+ <td colspan="2"><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git;a=commit;h={{ item['oldpkg']['commit_id'] }}">{{ item['oldpkg']['commit_id'] }}</a></td>
</tr>
{% endfor %}
</tbody>
<td>
<ul>
{% if item['oldpkg']['git_path'] != item['newpkg']['git_path'] %}
- <li>{{ item['oldpkg']['git_path'] }} </li>
- <li>{{ item['newpkg']['git_path'] }} </li>
+ <li><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git">{{ item['oldpkg']['git_path'] }}</a> </li>
+ <li><a href="{{ git_web['new'] }}?p={{ item['newpkg']['git_path'] }}.git">{{ item['newpkg']['git_path'] }}</a> </li>
{% else %}
- <li>{{ item['oldpkg']['git_path'] }}</li>
+ <li><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git">{{ item['oldpkg']['git_path'] }}</a></li>
{% endif %}
</ul>
</td>
- <td>{{ item['oldpkg']['commit_id'] }}</td>
- <td>{{ item['newpkg']['commit_id'] }}</td>
+ <td><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git;a=commit;h={{ item['oldpkg']['commit_id'] }}">{{ item['oldpkg']['commit_id'] }}</a></td>
+ <td><a href="{{ git_web['new'] }}?p={{ item['newpkg']['git_path'] }}.git;a=commit;h={{ item['newpkg']['commit_id'] }}">{{ item['newpkg']['commit_id'] }}</a></td>
</td>
</tr>
{% endfor %}
<td>{{ item['oldpkg']['name'] }}</td>
<td>{{ item['oldpkg']['version']['ver'] }}-{{item['oldpkg']['version']['rel']}}</td>
<td>{{ item['newpkg']['version']['ver'] }}-{{item['newpkg']['version']['rel']}}</td>
- <td>{{ item['oldpkg']['git_path'] }}</td>
- <td colspan="2">{{ item['oldpkg']['commit_id'] }}</td>
+ <td><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git">{{ item['oldpkg']['git_path'] }}</a></td>
+ <td colspan="2"><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git;a=commit;h={{ item['oldpkg']['commit_id'] }}">{{ item['oldpkg']['commit_id'] }}</a></td>
</tr>
{% endfor %}
</tbody>
</ul>
<table>
<tr><td colspan="6" class="tableTitle"><h3><a>Added Packages</a></h3></td></tr>
+ {% set git_web = gitweb %}
{% if diff['added'] %}
<tbody>
<tr>
<tr>
<td>{{ item['newpkg']['name'] }}</td>
<td colspan="2">{{ item['newpkg']['version']['ver'] }}-{{item['newpkg']['version']['rel']}}</td>
- <td>{{ item['newpkg']['git_path'] }}</td>
- <td colspan="2">{{ item['newpkg']['commit_id'] }}</td>
+ <td><a href="{{ git_web['new'] }}?p={{ item['newpkg']['git_path'] }}.git">{{ item['newpkg']['git_path'] }}</a></td>
+ <td colspan="2"><a href="{{ git_web['new'] }}?p={{ item['newpkg']['git_path'] }}.git;a=commit;h={{ item['newpkg']['commit_id'] }}">{{ item['newpkg']['commit_id'] }}</a></td>
</tr>
{% endfor %}
</tbody>
<tr>
<td>{{ item['oldpkg']['name'] }}</td>
<td colspan="2">{{ item['oldpkg']['version']['ver'] }}-{{item['oldpkg']['version']['rel']}}</td>
- <td>{{ item['oldpkg']['git_path'] }}</td>
- <td colspan="2">{{ item['oldpkg']['commit_id'] }}</td>
+ <td><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git">{{ item['oldpkg']['git_path'] }}</a></td>
+ <td colspan="2"><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git;a=commit;h={{ item['oldpkg']['commit_id'] }}">{{ item['oldpkg']['commit_id'] }}</a></td>
</tr>
{% endfor %}
</tbody>
<td>
<ul>
{% if item['oldpkg']['git_path'] != item['newpkg']['git_path'] %}
- <li>{{ item['oldpkg']['git_path'] }} </li>
- <li>{{ item['newpkg']['git_path'] }} </li>
+ <li><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git">{{ item['oldpkg']['git_path'] }}</a> </li>
+ <li><a href="{{ git_web['new'] }}?p={{ item['newpkg']['git_path'] }}.git">{{ item['newpkg']['git_path'] }}</a> </li>
{% else %}
- <li>{{ item['oldpkg']['git_path'] }}</li>
+ <li><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git">{{ item['oldpkg']['git_path'] }}</a></li>
{% endif %}
</ul>
</td>
- <td>{{ item['oldpkg']['commit_id'] }}</td>
- <td>{{ item['newpkg']['commit_id'] }}</td>
+ <td><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git;a=commit;h={{ item['oldpkg']['commit_id'] }}">{{ item['oldpkg']['commit_id'] }}</a></td>
+ <td><a href="{{ git_web['new'] }}?p={{ item['newpkg']['git_path'] }}.git;a=commit;h={{ item['newpkg']['commit_id'] }}">{{ item['newpkg']['commit_id'] }}</a></td>
</td>
</tr>
{% endfor %}
<td>{{ item['oldpkg']['name'] }}</td>
<td>{{ item['oldpkg']['version']['ver'] }}-{{item['oldpkg']['version']['rel']}}</td>
<td>{{ item['newpkg']['version']['ver'] }}-{{item['newpkg']['version']['rel']}}</td>
- <td>{{ item['oldpkg']['git_path'] }}</td>
- <td colspan="2">{{ item['oldpkg']['commit_id'] }}</td>
+ <td><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git">{{ item['oldpkg']['git_path'] }}</a></td>
+ <td colspan="2"><a href="{{ git_web['old'] }}?p={{ item['oldpkg']['git_path'] }}.git;a=commit;h={{ item['oldpkg']['commit_id'] }}">{{ item['oldpkg']['commit_id'] }}</a></td>
</tr>
{% endfor %}
</tbody>