Merge pdbq:add-pkg-mp into pdbq:main

Proposed by Bryce Harrington
Status: Merged
Approved by: Bryce Harrington
Approved revision: dcac3d40f9d98e0e7fdaa6f2eaf6dbb6be82d37c
Merge reported by: Bryce Harrington
Merged at revision: dcac3d40f9d98e0e7fdaa6f2eaf6dbb6be82d37c
Proposed branch: pdbq:add-pkg-mp
Merge into: pdbq:main
Diff against target: 815 lines (+767/-4)
5 files modified
.flake8 (+3/-1)
.pylintrc (+10/-3)
pdbq/merge_proposal.py (+302/-0)
scripts/pkg-mp (+199/-0)
tests/test_merge_proposal.py (+253/-0)
Reviewer Review Type Date Requested Status
Andreas Hasenack (community) Approve
Canonical Server Reporter Pending
Review via email: mp+443933@code.staging.launchpad.net

Description of the change

This creates a new cli tool named 'pkg-mp' and associated MergeProposal class.

Initially, this tool just focuses on listing all of the active reviews for a given team. I plan to add filtering on top of this so you can see just MPs needing a reviewer, etc. That logic will eventually be used to build the Reviews web page (a live mockup of this can be seen at http://pinot.endarchy.org/reviews). Later, I plan to expand the tool with more functionality to interact with MPs, such as posting comments, or looking up info from the MP record.

You'll note that this screenscrapes the +activereviews page rather than load the MPs from the Launchpad API. The reason for this is that the API is limited in what info it provides, particularly for *package* MPs (as opposed to *code* MPs). This tool intends to handle both package and code style MPs, and to fill in some of the missing support for package MPs.

So, for example, with package MPs it assumes the presence of debian/changelog, and uses that as a data source to extract information such as the source package name and version.

This also uses external tools to lookup additional information; specifically it uses rmadison to get official version info. I'd like to minimize dependence on external tools where I can, but this is fine for now.

I've stubbed in some test cases, but haven't actually implemented them yet. I will be working on that implementation work next; if I complete it before this gets reviewed I'll update this MP to include it, otherwise just pretend tests haven't been written yet for this. :-)

To post a comment you must log in.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I think this needs rebasing, the diff looks odd here in LP.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

> I think this needs rebasing, the diff looks odd here in LP.

Never mind, my mistake.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Some initial comments.

Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks, I've started implementing some of this feedback, but some stuff is proving more involved so didn't get it finished today.

Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

You can postpone the changes if you want, just have a way to track them if you agree with them.

Revision history for this message
Bryce Harrington (bryce) wrote :

Ok, yes I've narrowed this MP down a bit, postponing a couple of the more involved bits to the next MP. Comments below.

I also noticed the default team hadn't been updated to canonical-server-reporter so fixed that. Now `pkg-mp list` returns data that looks like more of a match to our +activereviews page. (I'll probably change that default to the current lp_username eventually, but this is convenient for now.)

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Checking the changes.

Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

+1

I miss a link to the MP in the output, but that's cosmetic

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :
Download full text (7.4 KiB)

On Wed, Jun 07, 2023 at 05:17:02PM -0000, Andreas Hasenack wrote:
>
>
> Diff comments:
>
> > diff --git a/tests/test_merge_proposal.py b/tests/test_merge_proposal.py
> > new file mode 100644
> > index 0000000..99430e3
> > --- /dev/null
> > +++ b/tests/test_merge_proposal.py
> > @@ -0,0 +1,188 @@
> > +#!/usr/bin/env python3
> > +# -*- coding: utf-8 -*-
> > +#
> > +# Copyright (C) 2021 Bryce Harrington <email address hidden>
> > +#
> > +# Permission is hereby granted, free of charge, to any person obtaining
> > +# a copy of this software and associated documentation files (the
> > +# "Software"), to deal in the Software without restriction, including
> > +# without limitation the rights to use, copy, modify, merge, publish,
> > +# distribute, sublicense, and/or sell copies of the Software, and to
> > +# permit persons to whom the Software is furnished to do so, subject to
> > +# the following conditions:
> > +#
> > +# The above copyright notice and this permission notice shall be included
> > +# in all copies or substantial portions of the Software.
> > +#
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> > +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> > +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> > +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> > +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
>
> I don't know about this copyright notice, just noticed that it's different from what's in other files. Just thought I should mention it, in case it came from a boilerplate test file and you forgot about it.

Thanks, yes I have been making the codebase itself copylefted but the
tests more permissively licensed. I might change that some day but at
least for now it's not accidental. :-)

> > +# A Merge represents an operation that pulls in a new Release of a Package from
> > +# one Project to another. Typically Merges require some Task to perform them,
> > +# and can involve one or more Issues preventing them from working; one or more
> > +# Hypothesis objects can assist in resolving the Issues to allow the Merge to
> > +# be performed.
> > +
> > +import sys
> > +import os.path
> > +
> > +from mock import Mock
> > +import pytest
> > +
> > +sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
> > +
> > +from pdbq.merge_proposal import MergeProposal
> > +from pdbq.lp import Lp
> > +from pdbq.lp import Config
> > +from launchpadlib.launchpad import Launchpad
> > +
> > +APPNAME = 'test-merge-proposal'
> > +
> > +# TODO: Should these be called fake* or mock*? What does g-u do?
> > +
> > +@pytest.fixture
> > +def fakemp():
> > + """Connect to Launchpad."""
> > + mock_service = Mock(spec=Launchpad)
> > + mock_lp = Lp(
> > + application_name=APPNAME,
> > + service=mock_launchpad,
> > + config=TestConfig)
> > + return MergeProposal(mock_lp, "test.url")
> > +
> > +def test_merge_proposal_create():
> > + """Verify Merge objects c...

Read more...

Revision history for this message
Bryce Harrington (bryce) wrote :
Download full text (7.4 KiB)

On Wed, Jun 07, 2023 at 05:18:29PM -0000, Andreas Hasenack wrote:
>
>
> Diff comments:
>
> > diff --git a/tests/test_merge_proposal.py b/tests/test_merge_proposal.py
> > new file mode 100644
> > index 0000000..99430e3
> > --- /dev/null
> > +++ b/tests/test_merge_proposal.py
> > @@ -0,0 +1,188 @@
> > +#!/usr/bin/env python3
> > +# -*- coding: utf-8 -*-
> > +#
> > +# Copyright (C) 2021 Bryce Harrington <email address hidden>
> > +#
> > +# Permission is hereby granted, free of charge, to any person obtaining
> > +# a copy of this software and associated documentation files (the
> > +# "Software"), to deal in the Software without restriction, including
> > +# without limitation the rights to use, copy, modify, merge, publish,
> > +# distribute, sublicense, and/or sell copies of the Software, and to
> > +# permit persons to whom the Software is furnished to do so, subject to
> > +# the following conditions:
> > +#
> > +# The above copyright notice and this permission notice shall be included
> > +# in all copies or substantial portions of the Software.
> > +#
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> > +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> > +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> > +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> > +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> > +
> > +# A Merge represents an operation that pulls in a new Release of a Package from
> > +# one Project to another. Typically Merges require some Task to perform them,
> > +# and can involve one or more Issues preventing them from working; one or more
> > +# Hypothesis objects can assist in resolving the Issues to allow the Merge to
> > +# be performed.
> > +
>
> Don't know if this blurb is still current, or if it should be in a test file. I don't see some of these words ("Hypothesis") anywhere else in this branch.

Thanks, yeah this is not accurate for the file.
I think this comment is leftover from an earlier incarnation of the code
that had had different plans for.

> > +import sys
> > +import os.path
> > +
> > +from mock import Mock
> > +import pytest
> > +
> > +sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
> > +
> > +from pdbq.merge_proposal import MergeProposal
> > +from pdbq.lp import Lp
> > +from pdbq.lp import Config
> > +from launchpadlib.launchpad import Launchpad
> > +
> > +APPNAME = 'test-merge-proposal'
> > +
> > +# TODO: Should these be called fake* or mock*? What does g-u do?
> > +
> > +@pytest.fixture
> > +def fakemp():
> > + """Connect to Launchpad."""
> > + mock_service = Mock(spec=Launchpad)
> > + mock_lp = Lp(
> > + application_name=APPNAME,
> > + service=mock_launchpad,
> > + config=TestConfig)
> > + return MergeProposal(mock_lp, "test.url")
> > +
> > +def test_merge_proposal_create():
> > + """Verify Merge objects can be instantiated."""
> > + mock_lp = Mock(spec=Lp)
> > + mp = M...

Read more...

Revision history for this message
Bryce Harrington (bryce) wrote :

Pushed to main:

To git+ssh://git.launchpad.net/pdbq
   3187b79..9caaa4e main -> main

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: