[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:testfix-drop-geoip-legacy into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:testfix-drop-geoip-legacy into launchpad:master. Commit message: Add a few more IP ranges used by the test suite Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/391586 This fixes lib/lp/translations/stories/standalone/xx-person-editlanguages.txt and lp.soyuz.scripts.tests.test_ppa_apache_log_parser.TestScriptRunning.test_script_run. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:testfix-drop-geoip-legacy into launchpad:master. diff --git a/lib/lp/services/geoip/tests/data/make-db.pl b/lib/lp/services/geoip/tests/data/make-db.pl index 279a99a..3139982 100755 --- a/lib/lp/services/geoip/tests/data/make-db.pl +++ b/lib/lp/services/geoip/tests/data/make-db.pl @@ -24,13 +24,16 @@ my $tree = MaxMind::DB::Writer::Tree->new( map_key_type_callback => sub { $types{$_[0]} }, # Arguments are ($sec, $min, $hour, $mday, $mon, $year); $mon is # 0-based. Bump this date when you change this script. -_build_epoch => timegm_modern(0, 38, 11, 29, 8, 2020), +_build_epoch => timegm_modern(0, 30, 23, 29, 8, 2020), ); $tree->insert_network('69.232.0.0/15', { country => { iso_code => 'US' } }); +$tree->insert_network('80.66.224.0/20', { country => { iso_code => 'LI' } }); $tree->insert_network('82.211.80.0/20', { country => { iso_code => 'GB' } }); $tree->insert_network('83.196.40.0/21', { country => { iso_code => 'FR' } }); +$tree->insert_network('84.112.0.0/15', { country => { iso_code => 'AT' } }); $tree->insert_network('121.44.0.0/15', { country => { iso_code => 'AU' } }); +$tree->insert_network('143.54.0.0/16', { country => { iso_code => 'BR' } }); $tree->insert_network('157.92.0.0/16', { country => { iso_code => 'AR' } }); $tree->insert_network('196.36.0.0/14', { country => { iso_code => 'ZA' } }); $tree->insert_network('201.13.0.0/16', { country => { iso_code => 'BR' } }); diff --git a/lib/lp/services/geoip/tests/data/test.mmdb b/lib/lp/services/geoip/tests/data/test.mmdb index 4d96205..a2e13d1 100644 Binary files a/lib/lp/services/geoip/tests/data/test.mmdb and b/lib/lp/services/geoip/tests/data/test.mmdb differ ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] lp:~pjdc/canonical-mojo-specs/lp-snap-proxy-anonster into lp:~canonical-launchpad-branches/canonical-mojo-specs/trunk
The proposal to merge lp:~pjdc/canonical-mojo-specs/lp-snap-proxy-anonster into lp:~canonical-launchpad-branches/canonical-mojo-specs/trunk has been updated. Status: Needs review => Merged For more details, see: https://code.launchpad.net/~pjdc/canonical-mojo-specs/lp-snap-proxy-anonster/+merge/391581 -- Your team Launchpad code reviewers is subscribed to branch lp:~canonical-launchpad-branches/canonical-mojo-specs/trunk. ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
Re: [Launchpad-reviewers] [Merge] lp:~pjdc/canonical-mojo-specs/lp-snap-proxy-anonster into lp:~canonical-launchpad-branches/canonical-mojo-specs/trunk
Review: Approve -- https://code.launchpad.net/~pjdc/canonical-mojo-specs/lp-snap-proxy-anonster/+merge/391581 Your team Launchpad code reviewers is subscribed to branch lp:~canonical-launchpad-branches/canonical-mojo-specs/trunk. ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] lp:~pjdc/canonical-mojo-specs/lp-snap-proxy-anonster into lp:~canonical-launchpad-branches/canonical-mojo-specs/trunk
Paul Collins has proposed merging lp:~pjdc/canonical-mojo-specs/lp-snap-proxy-anonster into lp:~canonical-launchpad-branches/canonical-mojo-specs/trunk. Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~pjdc/canonical-mojo-specs/lp-snap-proxy-anonster/+merge/391581 -- Your team Launchpad code reviewers is requested to review the proposed merge of lp:~pjdc/canonical-mojo-specs/lp-snap-proxy-anonster into lp:~canonical-launchpad-branches/canonical-mojo-specs/trunk. === modified file 'lp/mojo-lp-snap-proxy/production/deploy' --- lp/mojo-lp-snap-proxy/production/deploy 2020-08-18 16:40:51 + +++ lp/mojo-lp-snap-proxy/production/deploy 2020-09-29 21:33:09 + @@ -68,7 +68,7 @@ 91.189.89.228, 91.189.89.229, # ftpmaster.internal, used by apt during "snapcraft # pull". -91.189.89.99, +91.189.89.100, # launchpad.net, potentially used by add-apt-repository. 91.189.89.222, 91.189.89.223, # keyserver.ubuntu.com, potentially used by add-apt-repository. ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~pappacena/launchpad:oci-fill-build-request into launchpad:master
Thiago F. Pappacena has proposed merging ~pappacena/launchpad:oci-fill-build-request into launchpad:master. Commit message: Setting a build request object on every OCI build created using the web interface Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/391574 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/launchpad:oci-fill-build-request into launchpad:master. diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py index 594b93d..6174f99 100644 --- a/lib/lp/oci/browser/ocirecipe.py +++ b/lib/lp/oci/browser/ocirecipe.py @@ -645,9 +645,11 @@ class OCIRecipeRequestBuildsView(LaunchpadFormView): informational = {} builds = [] already_pending = [] +build_request = self.context.createBuildRequest(self.user) for arch in data['distro_arch_series']: try: -build = self.context.requestBuild(self.user, arch) +build = self.context.requestBuild( +self.user, arch, build_request=build_request) builds.append(build) except OCIRecipeBuildAlreadyPending: already_pending.append(arch) diff --git a/lib/lp/oci/browser/tests/test_ocirecipe.py b/lib/lp/oci/browser/tests/test_ocirecipe.py index c854d14..442021e 100644 --- a/lib/lp/oci/browser/tests/test_ocirecipe.py +++ b/lib/lp/oci/browser/tests/test_ocirecipe.py @@ -22,8 +22,10 @@ import soupmatchers from storm.locals import Store from testtools.matchers import ( Equals, +GreaterThan, Is, MatchesDict, +MatchesListwise, MatchesSetwise, MatchesStructure, ) @@ -851,6 +853,12 @@ class TestOCIRecipeRequestBuildsView(BaseTestOCIRecipeView): [build.distro_arch_series.architecturetag for build in builds]) self.assertContentEqual( [2510], set(build.buildqueue_record.lastscore for build in builds)) +# All builds should have the same build request. +self.assertThat([i.build_request for i in builds], MatchesListwise([ +MatchesStructure(id=GreaterThan(0)), +MatchesStructure(id=GreaterThan(0)), +])) +self.assertEqual(1, len({i.build_request.id for i in builds})) def test_request_builds_rejects_duplicate(self): # A duplicate build request causes a notification. diff --git a/lib/lp/oci/interfaces/ocirecipe.py b/lib/lp/oci/interfaces/ocirecipe.py index 9beb6af..687e932 100644 --- a/lib/lp/oci/interfaces/ocirecipe.py +++ b/lib/lp/oci/interfaces/ocirecipe.py @@ -262,6 +262,14 @@ class IOCIRecipeView(Interface): "Whether everything is set up to allow uploading builds of " "this OCI recipe to a registry.")) +def createBuildRequest(self, requester): +"""Creates a new BuildRequest object that will not be run, but can be +associated with build requests. + +:param requester: The person requesting the build. +:return: `IOCIRecipeBuildRequest`. +""" + def requestBuild(requester, architecture): """Request that the OCI recipe is built. diff --git a/lib/lp/oci/model/ocirecipe.py b/lib/lp/oci/model/ocirecipe.py index c167b15..3448982 100644 --- a/lib/lp/oci/model/ocirecipe.py +++ b/lib/lp/oci/model/ocirecipe.py @@ -405,6 +405,15 @@ class OCIRecipe(Storm, WebhookTargetMixin): def getBuildRequest(self, job_id): return OCIRecipeBuildRequest(self, job_id) +def createBuildRequest(self, requester): +"""See `IOCIRecipe`.""" +self._checkRequestBuild(requester) +job = getUtility(IOCIRecipeRequestBuildsJobSource).create( +self, requester, run_on_commit=False) +job.start() +job.complete() +return self.getBuildRequest(job.job_id) + def requestBuildsFromJob(self, requester, build_request=None): self._checkRequestBuild(requester) distro_arch_series_to_build = set(self.getAllowedArchitectures()) diff --git a/lib/lp/oci/model/ocirecipejob.py b/lib/lp/oci/model/ocirecipejob.py index 095181e..ca501d5 100644 --- a/lib/lp/oci/model/ocirecipejob.py +++ b/lib/lp/oci/model/ocirecipejob.py @@ -162,12 +162,13 @@ class OCIRecipeRequestBuildsJob(OCIRecipeJobDerived): config = config.IOCIRecipeRequestBuildsJobSource @classmethod -def create(cls, recipe, requester): +def create(cls, recipe, requester, run_on_commit=True): """See `OCIRecipeRequestBuildsJob`.""" metadata = {"requester": requester.id} recipe_job = OCIRecipeJob(recipe, cls.class_job_type, metadata) job = cls(recipe_job) -job.celeryRunOnCommit() +if run_on_commit: +job.celeryRunOnCommit() return job @classmethod ___ Mailing list:
Re: [Launchpad-reviewers] [Merge] ~pappacena/launchpad:oci-fill-build-request into launchpad:master
Diff comments: > diff --git a/lib/lp/oci/model/ocirecipe.py b/lib/lp/oci/model/ocirecipe.py > index c167b15..3448982 100644 > --- a/lib/lp/oci/model/ocirecipe.py > +++ b/lib/lp/oci/model/ocirecipe.py > @@ -405,6 +405,15 @@ class OCIRecipe(Storm, WebhookTargetMixin): > def getBuildRequest(self, job_id): > return OCIRecipeBuildRequest(self, job_id) > > +def createBuildRequest(self, requester): > +"""See `IOCIRecipe`.""" > +self._checkRequestBuild(requester) > +job = getUtility(IOCIRecipeRequestBuildsJobSource).create( > +self, requester, run_on_commit=False) > +job.start() > +job.complete() > +return self.getBuildRequest(job.job_id) Any better suggestion on how to create a job without executing it? > + > def requestBuildsFromJob(self, requester, build_request=None): > self._checkRequestBuild(requester) > distro_arch_series_to_build = set(self.getAllowedArchitectures()) -- https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/391574 Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/launchpad:oci-fill-build-request into launchpad:master. ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:testfix-swiftclient into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:testfix-swiftclient into launchpad:master. Commit message: Fix test failures with swiftclient 3.9.0 Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/391560 Newer versions of swiftclient (maybe >= 3.0.0?) do a better job of retrying when the server is flapping, so stop testing that they don't. Also, the fix for https://bugs.launchpad.net/python-swiftclient/+bug/1838775 caused an uncollectable reference cycle on Python 2. This was reported (in a somewhat different form) in https://bugs.launchpad.net/python-swiftclient/+bug/1873435 and has been fixed upstream, but the fix hasn't been released yet, so just back off a little to python-swiftclient 3.8.1. Dependencies MP: https://code.launchpad.net/~cjwatson/lp-source-dependencies/+git/lp-source-dependencies/+merge/391559 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:testfix-swiftclient into launchpad:master. diff --git a/constraints.txt b/constraints.txt index 81128f1..2f395d8 100644 --- a/constraints.txt +++ b/constraints.txt @@ -282,7 +282,7 @@ python-memcached==1.58 # https://github.com/ziima/python-openid/pull/47 # lp1 Fix normalization of non-ASCII query strings on Python 2. python-openid2==3.2+lp1 -python-swiftclient==3.9.0 +python-swiftclient==3.8.1 PyYAML==3.10 rabbitfixture==0.4.2 requests-file==1.4.3 diff --git a/lib/lp/testing/swift/tests/test_fixture.py b/lib/lp/testing/swift/tests/test_fixture.py index 234a80f..b03507f 100644 --- a/lib/lp/testing/swift/tests/test_fixture.py +++ b/lib/lp/testing/swift/tests/test_fixture.py @@ -175,11 +175,7 @@ class TestSwiftFixture(TestCase): def test_shutdown_and_startup(self): # This test demonstrates how the Swift client deals with a -# flapping Swift server. In particular, that once a connection -# has started failing it will continue failing so we need to -# ensure that once we encounter a fail we open a fresh -# connection. This is probably a property of our mock Swift -# server rather than reality but the mock is a required target. +# flapping Swift server. size = 30 # With no Swift server, a fresh connection fails with @@ -204,15 +200,8 @@ class TestSwiftFixture(TestCase): ConnectionError, client.get_object, "size", str(size)) -# And even if we bring it back up, existing connections -# continue to fail +# If we bring it back up, the client retries and succeeds. self.swift_fixture.startup() -self.assertRaises( -ClientException, -client.get_object, "size", str(size)) - -# But fresh connections are fine. -client = self.swift_fixture.connect() headers, body = client.get_object("size", str(size)) self.assertEqual(body, b"0" * size) ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/lp-source-dependencies:swiftclient-3.8.1 into lp-source-dependencies:master
Colin Watson has proposed merging ~cjwatson/lp-source-dependencies:swiftclient-3.8.1 into lp-source-dependencies:master. Commit message: Add python-swiftclient 3.8.1 Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/lp-source-dependencies/+git/lp-source-dependencies/+merge/391559 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lp-source-dependencies:swiftclient-3.8.1 into lp-source-dependencies:master. diff --git a/dist/python-swiftclient-3.8.1.tar.gz b/dist/python-swiftclient-3.8.1.tar.gz new file mode 100644 index 000..88e4f9a Binary files /dev/null and b/dist/python-swiftclient-3.8.1.tar.gz differ ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~pappacena/turnip:charm-celery-virtinfo-config into turnip:master
Thiago F. Pappacena has proposed merging ~pappacena/turnip:charm-celery-virtinfo-config into turnip:master. Commit message: Adding virtinfo endpoint config on celery charm Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~pappacena/turnip/+git/turnip/+merge/391554 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/turnip:charm-celery-virtinfo-config into turnip:master. diff --git a/charm/turnip-celery/config.yaml b/charm/turnip-celery/config.yaml index 9cf765d..6f8ffb1 100644 --- a/charm/turnip-celery/config.yaml +++ b/charm/turnip-celery/config.yaml @@ -3,3 +3,11 @@ options: type: string default: pyamqp://guest@localhost// description: Celery broker URL + virtinfo_endpoint: +type: string +default: http://localhost:6543/githosting +description: Virtinfo endpoint (Launchpad/Turnipcake) + virtinfo_timeout: +type: int +default: 15 +description: Timeout for virtinfo requests, in seconds. diff --git a/charm/turnip-celery/templates/turnip-celery.service.j2 b/charm/turnip-celery/templates/turnip-celery.service.j2 index 6370157..e6a2132 100644 --- a/charm/turnip-celery/templates/turnip-celery.service.j2 +++ b/charm/turnip-celery/templates/turnip-celery.service.j2 @@ -14,6 +14,8 @@ Environment=PATH={{ venv_dir }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/us Environment=REPO_STORE={{ data_dir }}/repos Environment=TURNIP_LOG_DIR={{ logs_dir }} Environment=CELERY_BROKER={{ celery_broker }} +Environment=VIRTINFO_ENDPOINT={{ virtinfo_endpoint }} +Environment=VIRTINFO_TIMEOUT={{ virtinfo_timeout }} ExecStart={{ venv_dir }}/bin/celery -A turnip.tasks worker --logfile={{ logs_dir }}/turnip-celery.log --pool=gevent ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~ilasc/turnip:add-statsd-metrics into turnip:master
Ioana Lasc has proposed merging ~ilasc/turnip:add-statsd-metrics into turnip:master. Commit message: Send maxrss, stime and utime metrics to statsd Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~ilasc/turnip/+git/turnip/+merge/391552 This MP is based on Colin's suggestion in MP 391365 and his patch for inter-process communication. Added the "send to statsd/Telegraf" code, the formatting and tags for metrics, the singleton for the Statsd client and Mock for unit tests. Tested locally the StatsdGitClient connection with Telegraf & Chronograf, but this branch still needs work and unit tests. This is a "please review direction" MP, thanks Colin! -- Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/turnip:add-statsd-metrics into turnip:master. diff --git a/config.yaml b/config.yaml index 99b0e7b..f7d8612 100644 --- a/config.yaml +++ b/config.yaml @@ -21,3 +21,6 @@ openid_provider_root: https://testopenid.test/ site_name: git.launchpad.test main_site_root: https://launchpad.test/ celery_broker: pyamqp://guest@localhost// +statsd_host: launchpad.test +statsd_port: 8125 +statsd_prefix: lp.turnip diff --git a/packbackendserver.tac b/packbackendserver.tac index 191ac16..e8157cc 100644 --- a/packbackendserver.tac +++ b/packbackendserver.tac @@ -20,7 +20,10 @@ from twisted.scripts.twistd import ServerOptions from turnip.config import config from turnip.log import RotatableFileLogObserver -from turnip.pack.git import PackBackendFactory +from turnip.pack.git import ( +PackBackendFactory, +StatsdGitClient, +) from turnip.pack.hookrpc import ( HookRPCHandler, HookRPCServerFactory, @@ -37,11 +40,14 @@ def getPackBackendServices(): hookrpc_path = config.get('hookrpc_path') or repo_store hookrpc_sock_path = os.path.join( hookrpc_path, 'hookrpc_sock_%d' % pack_backend_port) +statsd_client = StatsdGitClient(config.get('statsd_host'), config.get('statsd_port') +config.get('statsd_prefix')) pack_backend_service = internet.TCPServer( pack_backend_port, PackBackendFactory(repo_store, hookrpc_handler, - hookrpc_sock_path)) + hookrpc_sock_path, + statsd_client)) if os.path.exists(hookrpc_sock_path): os.unlink(hookrpc_sock_path) hookrpc_service = internet.UNIXServer( diff --git a/requirements.txt b/requirements.txt index fe3f1ac..ac502e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -58,6 +58,7 @@ scandir==1.10.0 setuptools-scm==1.17.0 simplejson==3.6.5 six==1.15.0 +statsd==3.3.0 testscenarios==0.5.0 testtools==2.4.0 traceback2==1.4.0 diff --git a/setup.py b/setup.py index 5cfae76..6bc2e94 100755 --- a/setup.py +++ b/setup.py @@ -28,6 +28,7 @@ requires = [ 'pygit2>=0.27.4,<0.28.0', 'python-openid2', 'PyYAML', +'statsd', 'Twisted[conch]', 'waitress', 'zope.interface', diff --git a/turnip/pack/git.py b/turnip/pack/git.py index 4407085..8998462 100644 --- a/turnip/pack/git.py +++ b/turnip/pack/git.py @@ -11,9 +11,13 @@ from __future__ import ( __metaclass__ = type +import json +import os.path import uuid - import six +import socket +import statsd +import threading from twisted.internet import ( defer, error, @@ -47,6 +51,32 @@ VIRT_ERROR_PREFIX = b'turnip virt error: ' SAFE_PARAMS = frozenset([b'host', b'version']) +class ThreadSafeSingleton(type): +_instances = {} +_singleton_lock = threading.Lock() + +def __call__(cls, *args, **kwargs): +if cls not in cls._instances: +with cls._singleton_lock: +if cls not in cls._instances: +cls._instances[cls] = super( +ThreadSafeSingleton, cls).__call__(*args, **kwargs) +return cls._instances[cls] + + +class StatsdGitClient(): +__metaclass__ = ThreadSafeSingleton + +def __init__(self, *args, **kwargs): +self.host = args[0] +self.port = args[1] +self.prefix = args[2] +self.client = statsd.StatsClient(self.host, self.port, self.prefix) + +def get_client(self): +return self.client + + class RequestIDLogger(Logger): def emit(self, level, format=None, **kwargs): @@ -235,13 +265,15 @@ class PackServerProtocol(PackProxyProtocol): return auth_params -class GitProcessProtocol(protocol.ProcessProtocol): +class GitProcessProtocol(protocol.ProcessProtocol, object): _err_buffer = b'' +_resource_usage_buffer = b'' def __init__(self, peer): self.peer = peer self.out_started = False +self.client = self.peer.factory.statsd_client.get_client() def connectionMade(self): self.peer.setPeer(self) @@ -250,6 +282,12 @@ class GitProcessProtocol(protocol.ProcessProtocol):
[Launchpad-reviewers] [Merge] ~twom/launchpad:export-source-properties-on-BPPH into launchpad:master
Tom Wardill has proposed merging ~twom/launchpad:export-source-properties-on-BPPH into launchpad:master. Commit message: Export source package name and version on BPPH Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/391538 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:export-source-properties-on-BPPH into launchpad:master. diff --git a/lib/lp/soyuz/interfaces/binarypackagerelease.py b/lib/lp/soyuz/interfaces/binarypackagerelease.py index 2ee397e..592d515 100644 --- a/lib/lp/soyuz/interfaces/binarypackagerelease.py +++ b/lib/lp/soyuz/interfaces/binarypackagerelease.py @@ -90,6 +90,8 @@ class IBinaryPackageRelease(Interface): name = Attribute("Binary Package Name") sourcepackagename = Attribute( "The name of the source package from where this binary was built.") +sourcepackageversion = Attribute( +"The version of the source package from where this binary was built.") def addFile(file): """Create a BinaryPackageFile record referencing this build diff --git a/lib/lp/soyuz/interfaces/publishing.py b/lib/lp/soyuz/interfaces/publishing.py index 4443284..162fb17 100644 --- a/lib/lp/soyuz/interfaces/publishing.py +++ b/lib/lp/soyuz/interfaces/publishing.py @@ -604,8 +604,17 @@ class IBinaryPackagePublishingHistoryPublic(IPublishingView): required=False, readonly=False) binarypackagerelease = Attribute( "The binary package release being published") -source_package_name = Attribute( -'The source package name that built this binary.') +source_package_name = exported( +TextLine( +title=_("Source Package Name"), +description=_('The source package name that built this binary.'), +required=False, readonly=True)) +source_package_version = exported( +TextLine( +title=_("Source Package Version"), +description=_( +'The source package version that built this binary.'), +required=False, readonly=True)) distroarchseriesID = Int( title=_("The DB id for the distroarchseries."), required=False, readonly=False) diff --git a/lib/lp/soyuz/model/binarypackagerelease.py b/lib/lp/soyuz/model/binarypackagerelease.py index 3458b70..8866723 100644 --- a/lib/lp/soyuz/model/binarypackagerelease.py +++ b/lib/lp/soyuz/model/binarypackagerelease.py @@ -125,6 +125,11 @@ class BinaryPackageRelease(SQLBase): """See `IBinaryPackageRelease`.""" return self.build.source_package_release.sourcepackagename.name +@property +def sourcepackageversion(self): +"""See `IBinaryPackageRelease`.""" +return self.build.source_package_release.version + @cachedproperty def files(self): return list( diff --git a/lib/lp/soyuz/model/publishing.py b/lib/lp/soyuz/model/publishing.py index 33390b5..86db3c1 100644 --- a/lib/lp/soyuz/model/publishing.py +++ b/lib/lp/soyuz/model/publishing.py @@ -704,6 +704,11 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase): return self.binarypackagerelease.sourcepackagename @property +def source_package_version(self): +"""See `IBinaryPackagePublishingHistory`""" +return self.binarypackagerelease.sourcepackageversion + +@property def architecture_specific(self): """See `IBinaryPackagePublishingHistory`""" return self.binarypackagerelease.architecturespecific diff --git a/lib/lp/soyuz/tests/test_publishing_models.py b/lib/lp/soyuz/tests/test_publishing_models.py index 6ed7adc..d5cb65a 100644 --- a/lib/lp/soyuz/tests/test_publishing_models.py +++ b/lib/lp/soyuz/tests/test_publishing_models.py @@ -10,6 +10,7 @@ from zope.security.proxy import removeSecurityProxy from lp.app.errors import NotFoundError from lp.buildmaster.enums import BuildStatus +from lp.registry.enums import PersonVisibility from lp.registry.interfaces.sourcepackage import SourcePackageFileType from lp.services.database.constants import UTC_NOW from lp.services.librarian.browser import ProxiedLibraryFileAlias @@ -24,11 +25,15 @@ from lp.soyuz.interfaces.publishing import ( PackagePublishingStatus, ) from lp.soyuz.tests.test_binarypackagebuild import BaseTestCaseWithThreeBuilds -from lp.testing import TestCaseWithFactory +from lp.testing import ( +person_logged_in, +TestCaseWithFactory, +) from lp.testing.layers import ( LaunchpadFunctionalLayer, LaunchpadZopelessLayer, ) +from zope.security.interfaces import Unauthorized class TestPublishingSet(BaseTestCaseWithThreeBuilds): @@ -297,3 +302,49 @@ class TestBinaryPackagePublishingHistory(TestCaseWithFactory): bpph = self.factory.makeBinaryPackagePublishingHistory( binpackageformat=BinaryPackageFormat.DDEB)
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:testfix-drop-geoip-legacy into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:testfix-drop-geoip-legacy into launchpad:master. Commit message: Add a couple more IP ranges used by the test suite Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/391519 Also arrange for the output of make-db.pl to be reproducible by explicitly setting a timestamp. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:testfix-drop-geoip-legacy into launchpad:master. diff --git a/lib/lp/services/geoip/tests/data/make-db.pl b/lib/lp/services/geoip/tests/data/make-db.pl index 74f01f1..279a99a 100755 --- a/lib/lp/services/geoip/tests/data/make-db.pl +++ b/lib/lp/services/geoip/tests/data/make-db.pl @@ -6,6 +6,8 @@ # Create a tiny test database in the style of GeoLite2-Country, for use by # the Launchpad test suite. Requires libmaxmind-db-writer-perl. +use Time::Local qw(timegm_modern); + use MaxMind::DB::Writer::Tree; my %types = ( @@ -20,12 +22,17 @@ my $tree = MaxMind::DB::Writer::Tree->new( languages => ['en'], description => { en => 'Launchpad test data' }, map_key_type_callback => sub { $types{$_[0]} }, +# Arguments are ($sec, $min, $hour, $mday, $mon, $year); $mon is +# 0-based. Bump this date when you change this script. +_build_epoch => timegm_modern(0, 38, 11, 29, 8, 2020), ); $tree->insert_network('69.232.0.0/15', { country => { iso_code => 'US' } }); $tree->insert_network('82.211.80.0/20', { country => { iso_code => 'GB' } }); +$tree->insert_network('83.196.40.0/21', { country => { iso_code => 'FR' } }); $tree->insert_network('121.44.0.0/15', { country => { iso_code => 'AU' } }); $tree->insert_network('157.92.0.0/16', { country => { iso_code => 'AR' } }); +$tree->insert_network('196.36.0.0/14', { country => { iso_code => 'ZA' } }); $tree->insert_network('201.13.0.0/16', { country => { iso_code => 'BR' } }); $tree->insert_network('202.214.0.0/16', { country => { iso_code => 'JP' } }); diff --git a/lib/lp/services/geoip/tests/data/test.mmdb b/lib/lp/services/geoip/tests/data/test.mmdb index ddeaded..4d96205 100644 Binary files a/lib/lp/services/geoip/tests/data/test.mmdb and b/lib/lp/services/geoip/tests/data/test.mmdb differ ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~twom/launchpad:buildd-sha-export into launchpad:master
Tom Wardill has proposed merging ~twom/launchpad:buildd-sha-export into launchpad:master. Commit message: Update docstring for getChrootHash Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/391504 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:buildd-sha-export into launchpad:master. diff --git a/lib/lp/soyuz/interfaces/distroarchseries.py b/lib/lp/soyuz/interfaces/distroarchseries.py index 4f70996..76d1930 100644 --- a/lib/lp/soyuz/interfaces/distroarchseries.py +++ b/lib/lp/soyuz/interfaces/distroarchseries.py @@ -220,7 +220,7 @@ class IDistroArchSeriesPublic(IHasBuildRecords, IHasOwner): @export_read_operation() @operation_for_version("devel") def getChrootHash(pocket, image_type): -"""Return the sha1sum of the current chroot for the given pocket.""" +"""Return applicable hashes for the current chroot of this pocket.""" def addOrUpdateChroot(chroot, pocket=None, image_type=None): """Return the just added or modified PocketChroot. ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp