launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24535
[Merge] lp:~abrody/launchpad/https-mirror into lp:launchpad
api.ng has proposed merging lp:~abrody/launchpad/https-mirror into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1255120 in Launchpad itself: "Support listing HTTPS archive mirrors"
https://bugs.launchpad.net/launchpad/+bug/1255120
For more details, see:
https://code.launchpad.net/~abrody/launchpad/https-mirror/+merge/381344
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abrody/launchpad/https-mirror into lp:launchpad.
=== modified file 'lib/lp/registry/browser/distributionmirror.py'
--- lib/lp/registry/browser/distributionmirror.py 2019-09-02 14:15:10 +0000
+++ lib/lp/registry/browser/distributionmirror.py 2020-03-28 10:05:53 +0000
@@ -207,9 +207,9 @@
class DistributionMirrorAddView(LaunchpadFormView):
schema = IDistributionMirror
field_names = [
- "display_name", "description", "whiteboard", "http_base_url",
- "ftp_base_url", "rsync_base_url", "speed", "country", "content",
- "official_candidate",
+ "display_name", "description", "whiteboard", "https_base_url",
+ "http_base_url", "ftp_base_url", "rsync_base_url", "speed", "country",
+ "content", "official_candidate",
]
@property
@@ -234,6 +234,7 @@
content=data['content'], display_name=data['display_name'],
description=data['description'],
whiteboard=data['whiteboard'],
+ https_base_url=data['https_base_url'],
http_base_url=data['http_base_url'],
ftp_base_url=data['ftp_base_url'],
rsync_base_url=data['rsync_base_url'],
@@ -278,8 +279,8 @@
schema = IDistributionMirror
field_names = [
"name", "display_name", "description", "whiteboard",
- "http_base_url", "ftp_base_url", "rsync_base_url", "speed",
- "country", "content", "official_candidate",
+ "https_base_url", "http_base_url", "ftp_base_url", "rsync_base_url",
+ "speed", "country", "content", "official_candidate",
]
@property
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2019-09-02 13:47:15 +0000
+++ lib/lp/registry/configure.zcml 2020-03-28 10:05:53 +0000
@@ -1988,6 +1988,7 @@
description
distribution
http_base_url
+ https_base_url
ftp_base_url
rsync_base_url
enabled
@@ -2026,9 +2027,16 @@
<require
permission="launchpad.Edit"
set_attributes="name display_name description whiteboard
+<<<<<<< TREE
http_base_url ftp_base_url rsync_base_url enabled
speed country content official_candidate owner"
attributes="official_candidate whiteboard resubmitForReview" />
+=======
+ http_base_url https_base_url ftp_base_url
+ rsync_base_url enabled speed country content
+ official_candidate owner"
+ attributes="official_candidate whiteboard" />
+>>>>>>> MERGE-SOURCE
<require
permission="launchpad.Admin"
set_attributes="status reviewer date_reviewed"
=== modified file 'lib/lp/registry/interfaces/distribution.py'
--- lib/lp/registry/interfaces/distribution.py 2015-10-13 13:22:08 +0000
+++ lib/lp/registry/interfaces/distribution.py 2020-03-28 10:05:53 +0000
@@ -491,13 +491,13 @@
"""Return the country DNS mirror for a country and content type."""
def newMirror(owner, speed, country, content, display_name=None,
- description=None, http_base_url=None,
+ description=None, http_base_url=None, https_base_url=None,
ftp_base_url=None, rsync_base_url=None, enabled=False,
official_candidate=False, whiteboard=None):
"""Create a new DistributionMirror for this distribution.
- At least one of http_base_url or ftp_base_url must be provided in
- order to create a mirror.
+ At least one of {http,https,ftp}_base_url must be provided in order to
+ create a mirror.
"""
@operation_parameters(
=== modified file 'lib/lp/registry/interfaces/distributionmirror.py'
--- lib/lp/registry/interfaces/distributionmirror.py 2019-08-29 17:04:15 +0000
+++ lib/lp/registry/interfaces/distributionmirror.py 2020-03-28 10:05:53 +0000
@@ -302,6 +302,12 @@
return getUtility(IDistributionMirrorSet).getByHttpUrl(url)
+class DistroMirrorHTTPSURIField(DistroMirrorURIField):
+
+ def getMirrorByURI(self, url):
+ return getUtility(IDistributionMirrorSet).getByHttpsUrl(url)
+
+
class DistroMirrorFTPURIField(DistroMirrorURIField):
def getMirrorByURI(self, url):
@@ -349,6 +355,11 @@
allowed_schemes=['http'], allow_userinfo=False,
allow_query=False, allow_fragment=False, trailing_slash=True,
description=_('e.g.: http://archive.ubuntu.com/ubuntu/')))
+ https_base_url = exported(DistroMirrorHTTPSURIField(
+ title=_('HTTPS URL'), required=False, readonly=False,
+ allowed_schemes=['https'], allow_userinfo=False,
+ allow_query=False, allow_fragment=False, trailing_slash=True,
+ description=_('e.g.: https://archive.ubuntu.com/ubuntu/')))
ftp_base_url = exported(DistroMirrorFTPURIField(
title=_('FTP URL'), required=False, readonly=False,
allowed_schemes=['ftp'], allow_userinfo=False,
@@ -435,8 +446,9 @@
@invariant
def mirrorMustHaveHTTPOrFTPURL(mirror):
- if not (mirror.http_base_url or mirror.ftp_base_url):
- raise Invalid('A mirror must have at least an HTTP or FTP URL.')
+ if not (mirror.http_base_url or mirror.https_base_url or
+ mirror.ftp_base_url):
+ raise Invalid('A mirror must have at least an HTTP(S) or FTP URL.')
def getSummarizedMirroredSourceSeries():
"""Return a summarized list of this distribution_mirror's
@@ -614,6 +626,9 @@
def getByHttpUrl(url):
"""Return the mirror with the given HTTP URL or None."""
+ def getByHttpsUrl(url):
+ """Return the mirror with the given HTTPS URL or None."""
+
def getByFtpUrl(url):
"""Return the mirror with the given FTP URL or None."""
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2018-05-14 09:25:45 +0000
+++ lib/lp/registry/model/distribution.py 2020-03-28 10:05:53 +0000
@@ -708,7 +708,7 @@
country_dns_mirror=True).one()
def newMirror(self, owner, speed, country, content, display_name=None,
- description=None, http_base_url=None,
+ description=None, http_base_url=None, https_base_url=None,
ftp_base_url=None, rsync_base_url=None,
official_candidate=False, enabled=False,
whiteboard=None):
@@ -721,15 +721,17 @@
return None
urls = {'http_base_url': http_base_url,
+ 'https_base_url': https_base_url,
'ftp_base_url': ftp_base_url,
'rsync_base_url': rsync_base_url}
for name, value in urls.items():
if value is not None:
urls[name] = IDistributionMirror[name].normalize(value)
- url = urls['http_base_url'] or urls['ftp_base_url']
+ url = (urls['https_base_url'] or urls['http_base_url'] or
+ urls['ftp_base_url'])
assert url is not None, (
- "A mirror must provide either an HTTP or FTP URL (or both).")
+ "A mirror must provide at least one HTTP/HTTPS/FTP URL.")
dummy, host, dummy, dummy, dummy, dummy = urlparse(url)
name = sanitize_name('%s-%s' % (host, content.name.lower()))
@@ -743,6 +745,7 @@
distribution=self, owner=owner, name=name, speed=speed,
country=country, content=content, display_name=display_name,
description=description, http_base_url=urls['http_base_url'],
+ https_base_url=urls['https_base_url'],
ftp_base_url=urls['ftp_base_url'],
rsync_base_url=urls['rsync_base_url'],
official_candidate=official_candidate, enabled=enabled,
=== modified file 'lib/lp/registry/model/distributionmirror.py'
--- lib/lp/registry/model/distributionmirror.py 2019-09-02 14:04:54 +0000
+++ lib/lp/registry/model/distributionmirror.py 2020-03-28 10:05:53 +0000
@@ -129,6 +129,8 @@
notNull=False, default=None)
http_base_url = StringCol(
notNull=False, default=None, unique=True)
+ https_base_url = StringCol(
+ notNull=False, default=None, unique=True)
ftp_base_url = StringCol(
notNull=False, default=None, unique=True)
rsync_base_url = StringCol(
@@ -155,7 +157,9 @@
@property
def base_url(self):
"""See IDistributionMirror"""
- if self.http_base_url is not None:
+ if self.https_base_url is not None:
+ return self.https_base_url
+ elif self.http_base_url is not None:
return self.http_base_url
else:
return self.ftp_base_url
@@ -677,6 +681,10 @@
"""See IDistributionMirrorSet"""
return DistributionMirror.selectOneBy(http_base_url=url)
+ def getByHttpsUrl(self, url):
+ """See IDistributionMirrorSet"""
+ return DistributionMirror.selectOneBy(https_base_url=url)
+
def getByFtpUrl(self, url):
"""See IDistributionMirrorSet"""
return DistributionMirror.selectOneBy(ftp_base_url=url)
=== modified file 'lib/lp/registry/templates/distributionmirror-index.pt'
--- lib/lp/registry/templates/distributionmirror-index.pt 2010-10-10 21:54:16 +0000
+++ lib/lp/registry/templates/distributionmirror-index.pt 2020-03-28 10:05:53 +0000
@@ -118,6 +118,10 @@
<h2>Mirror location information</h2>
<ul class="webref" id="mirror-urls">
+ <li tal:condition="context/https_base_url" >
+ <a tal:content="context/https_base_url"
+ tal:attributes="href context/https_base_url">https://url/</a>
+ </li>
<li tal:condition="context/http_base_url" >
<a tal:content="context/http_base_url"
tal:attributes="href context/http_base_url">http://url/</a>
=== modified file 'lib/lp/registry/templates/distributionmirror-macros.pt'
--- lib/lp/registry/templates/distributionmirror-macros.pt 2015-02-18 18:44:32 +0000
+++ lib/lp/registry/templates/distributionmirror-macros.pt 2020-03-28 10:05:53 +0000
@@ -17,7 +17,7 @@
<tbody>
<tal:country_and_mirrors repeat="country_and_mirrors mirrors_by_country">
<tr class="head">
- <th colspan="2"
+ <th colspan="2"
tal:content="country_and_mirrors/country" />
<th tal:content="country_and_mirrors/throughput"/>
<th tal:condition="show_mirror_type">
@@ -35,6 +35,8 @@
tal:content="mirror/title">Mirror Name</a>
</td>
<td>
+ <a tal:condition="mirror/https_base_url"
+ tal:attributes="href mirror/https_base_url">https</a>
<a tal:condition="mirror/http_base_url"
tal:attributes="href mirror/http_base_url">http</a>
<a tal:condition="mirror/ftp_base_url"
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2019-09-27 09:47:38 +0000
+++ lib/lp/testing/factory.py 2020-03-28 10:05:53 +0000
@@ -3518,13 +3518,13 @@
return proberecord
def makeMirror(self, distribution, displayname=None, country=None,
- http_url=None, ftp_url=None, rsync_url=None,
+ http_url=None, https_url=None, ftp_url=None, rsync_url=None,
official_candidate=False):
"""Create a mirror for the distribution."""
if displayname is None:
displayname = self.getUniqueString("mirror")
# If no URL is specified create an HTTP URL.
- if http_url is None and ftp_url is None and rsync_url is None:
+ if http_url is https_url is ftp_url is rsync_url is None:
http_url = self.getUniqueURL()
# If no country is given use Argentina.
if country is None:
@@ -3538,6 +3538,7 @@
display_name=displayname,
description=None,
http_base_url=http_url,
+ https_base_url=https_url,
ftp_base_url=ftp_url,
rsync_base_url=rsync_url,
official_candidate=official_candidate)