[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:fix-stormify-logintoken into launchpad:master

2023-07-10 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:fix-stormify-logintoken 
into launchpad:master.

Commit message:
Fix bugs in conversion of LoginToken to Storm

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/446419

`LoginTokenSet.new` needs to explicitly add the new token to the store, as it 
may not be linked to any other object if it doesn't have a requester (e.g. 
`LoginTokenType.BUGTRACKER` tokens).

`test_LoginTokenPruner` needs to flush SQL statements for new tokens to the 
database before trying to get their IDs.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:fix-stormify-logintoken into launchpad:master.
diff --git a/lib/lp/scripts/tests/test_garbo.py b/lib/lp/scripts/tests/test_garbo.py
index 71d302f..ea92f5a 100644
--- a/lib/lp/scripts/tests/test_garbo.py
+++ b/lib/lp/scripts/tests/test_garbo.py
@@ -2609,15 +2609,17 @@ class TestGarboTasks(TestCaseWithFactory):
 email="whatever", tokentype=LoginTokenType.NEWACCOUNT
 )
 old_token.date_created = now - timedelta(days=666)
-old_token_id = old_token.id
 store.add(old_token)
+store.flush()
+old_token_id = old_token.id
 
 # Create a token that will not be pruned.
 current_token = LoginToken(
 email="whatever", tokentype=LoginTokenType.NEWACCOUNT
 )
-current_token_id = current_token.id
 store.add(current_token)
+store.flush()
+current_token_id = current_token.id
 
 # Run the pruner. Batching is tested by the BulkPruner tests so
 # no need to repeat here.
diff --git a/lib/lp/services/verification/model/logintoken.py b/lib/lp/services/verification/model/logintoken.py
index 572cce2..03a5bc6 100644
--- a/lib/lp/services/verification/model/logintoken.py
+++ b/lib/lp/services/verification/model/logintoken.py
@@ -395,14 +395,16 @@ class LoginTokenSet:
 "tokentype is not an item of LoginTokenType: %s" % tokentype
 )
 token = create_token(20)
-return LoginToken(
-requester=requester,
-requesteremail=requesteremail,
-email=email,
-token=token,
-tokentype=tokentype,
-fingerprint=fingerprint,
-redirection_url=redirection_url,
+return IStore(LoginToken).add(
+LoginToken(
+requester=requester,
+requesteremail=requesteremail,
+email=email,
+token=token,
+tokentype=tokentype,
+fingerprint=fingerprint,
+redirection_url=redirection_url,
+)
 )
 
 def __getitem__(self, tokentext):
___
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] ~jugmac00/launchpad:fix-formatting into launchpad:master

2023-07-10 Thread Jürgen Gmach
Jürgen Gmach has proposed merging ~jugmac00/launchpad:fix-formatting into 
launchpad:master.

Commit message:
Fix link formatting

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/446416
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~jugmac00/launchpad:fix-formatting into launchpad:master.
diff --git a/doc/explanation/charms.rst b/doc/explanation/charms.rst
index 4fca9d7..712279e 100644
--- a/doc/explanation/charms.rst
+++ b/doc/explanation/charms.rst
@@ -136,7 +136,7 @@ these guidelines to build your charm for Launchpad:
charm, if your charm is based on other layers. The actual values that will
be running in each environment (production, dogfood, staging, qastaging),
should later be set in the ``lp/bundle.yaml`` file within the
-   `launchpad-mojo-specs `
+   `launchpad-mojo-specs `_
repo (you should only worry about these specs after your charm is ready).
 
 5. **Write your reactive code:** Start adding code that it might need
___
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] ~pelpsi/launchpad:ftpmaster-charm into launchpad:master

2023-07-10 Thread Simone Pelosi
Simone Pelosi has proposed merging ~pelpsi/launchpad:ftpmaster-charm into 
launchpad:master.

Commit message:
FTPMaster charms

Ftpmaster publisher and uploader.
Ftpmaster publisher publishes packages to the ubuntu archives,
running scripts contained in the ubuntu-archive-publishing repository.
Ftpmaster uploader process uploads of src packages intended
for publishing to ubuntu archive.


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pelpsi/launchpad/+git/launchpad/+merge/446413
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~pelpsi/launchpad:ftpmaster-charm into launchpad:master.
diff --git a/charm/launchpad-ftpmaster-publisher/README.md b/charm/launchpad-ftpmaster-publisher/README.md
new file mode 100644
index 000..1cc4969
--- /dev/null
+++ b/charm/launchpad-ftpmaster-publisher/README.md
@@ -0,0 +1,3 @@
+# Launchpad ftpmaster-publisher
+
+This charm runs Launchpad ftpmaster-publisher.
diff --git a/charm/launchpad-ftpmaster-publisher/charmcraft.yaml b/charm/launchpad-ftpmaster-publisher/charmcraft.yaml
new file mode 100644
index 000..01c2133
--- /dev/null
+++ b/charm/launchpad-ftpmaster-publisher/charmcraft.yaml
@@ -0,0 +1,64 @@
+type: charm
+bases:
+  - build-on:
+- name: ubuntu
+  channel: "20.04"
+  architectures: [amd64]
+run-on:
+- name: ubuntu
+  channel: "20.04"
+  architectures: [amd64]
+parts:
+  charm-wheels:
+source: https://git.launchpad.net/~ubuntuone-hackers/ols-charm-deps/+git/wheels
+source-commit: "59b32ae07f98051385c96d6d8e7e02ca4f197fe5"
+source-submodules: []
+source-type: git
+plugin: dump
+organize:
+  "*": charm-wheels/
+prime:
+  - "-charm-wheels"
+  ols-layers:
+source: https://git.launchpad.net/ols-charm-deps
+source-commit: "56d219f60a293a6c73759b8439ef5fdb11e19d1f"
+source-submodules: []
+source-type: git
+plugin: dump
+organize:
+  "*": layers/
+stage:
+  - layers
+prime:
+  - "-layers"
+  launchpad-layers:
+after:
+  - ols-layers
+source: https://git.launchpad.net/launchpad-layers
+source-commit: "fe273e9f446f84243be2070334cacd03c09da946"
+source-submodules: []
+source-type: git
+plugin: dump
+organize:
+  launchpad-base: layers/layer/launchpad-base
+  launchpad-db: layers/layer/launchpad-db
+  launchpad-payload: layers/layer/launchpad-payload
+  launchpad-publisher-parts: layers/layer/launchpad-publisher-parts
+stage:
+  - layers
+prime:
+  - "-layers"
+  launchpad-ftpmaster-publisher:
+after:
+  - charm-wheels
+  - launchpad-layers
+source: .
+plugin: reactive
+build-snaps: [charm]
+build-packages: [libpq-dev, python3-dev]
+build-environment:
+  - CHARM_LAYERS_DIR: $CRAFT_STAGE/layers/layer
+  - CHARM_INTERFACES_DIR: $CRAFT_STAGE/layers/interface
+  - PIP_NO_INDEX: "true"
+  - PIP_FIND_LINKS: $CRAFT_STAGE/charm-wheels
+reactive-charm-build-arguments: [--binary-wheels-from-source]
diff --git a/charm/launchpad-ftpmaster-publisher/config.yaml b/charm/launchpad-ftpmaster-publisher/config.yaml
new file mode 100644
index 000..3dedb19
--- /dev/null
+++ b/charm/launchpad-ftpmaster-publisher/config.yaml
@@ -0,0 +1,31 @@
+options:
+  active:
+type: boolean
+default: true
+description: If true, enable jobs that may change the database.
+  publisher_parts_repository:
+type: string
+description: Repository URL for the Ubuntu specific scripts. 
+default: lp:ubuntu-archive-publishing
+  publisher_parts_revision: 
+type: int
+description: Revision number for the Ubuntu specific scripts.
+default: 120
+  client_public_key:
+type: string
+description: Client public key.
+default: ""
+  # TEMP
+  build_label:
+type: string
+default: fe329353bc9b398511715c0135e456204a8f39bd
+description: Build label to run.
+  swift_container_name:
+type: string
+default: "launchpad-builds"
+description: TBD
+  swift_storage_url:
+type: string
+default: "https://objectstorage.prodstack5.canonical.com/swift/v1/AUTH_318a449e4c8e40e2865c120a597a9644;
+description: TBD
+  
\ No newline at end of file
diff --git a/charm/launchpad-ftpmaster-publisher/layer.yaml b/charm/launchpad-ftpmaster-publisher/layer.yaml
new file mode 100644
index 000..597af9c
--- /dev/null
+++ b/charm/launchpad-ftpmaster-publisher/layer.yaml
@@ -0,0 +1,19 @@
+includes:
+  - layer:launchpad-db
+  - layer:launchpad-publisher-parts
+repo: https://git.launchpad.net/launchpad
+options:
+  apt:
+packages:
+  - nodejs
+  - python3-convoy
+  ols-pg:
+databases:
+  db:
+name: launchpad_dev
+roles:
+  - publish_ftpmaster
+  - generate_contents_files
+  - process_death_row
+  launchpad-payload:
+build_target: build
\ No newline at end of file
diff --git 

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:stormify-logintoken into launchpad:master

2023-07-10 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:stormify-logintoken into 
launchpad:master.

Commit message:
Convert LoginToken to Storm

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/446394
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:stormify-logintoken into launchpad:master.
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index 53e2358..10f2342 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -49,6 +49,7 @@ from storm.expr import (
 Desc,
 Exists,
 In,
+Is,
 Join,
 LeftJoin,
 Min,
@@ -3178,16 +3179,22 @@ class Person(
 @property
 def unvalidatedemails(self):
 """See `IPerson`."""
-query = """
-requester = %s
-AND (tokentype=%s OR tokentype=%s)
-AND date_consumed IS NULL
-""" % sqlvalues(
-self.id,
-LoginTokenType.VALIDATEEMAIL,
-LoginTokenType.VALIDATETEAMEMAIL,
+return sorted(
+{
+token.email
+for token in IStore(LoginToken).find(
+LoginToken,
+LoginToken.requester == self,
+LoginToken.tokentype.is_in(
+(
+LoginTokenType.VALIDATEEMAIL,
+LoginTokenType.VALIDATETEAMEMAIL,
+)
+),
+Is(LoginToken.date_consumed, None),
+)
+}
 )
-return sorted({token.email for token in LoginToken.select(query)})
 
 @property
 def guessedemails(self):
diff --git a/lib/lp/registry/stories/gpg-coc/xx-gpg-coc.rst b/lib/lp/registry/stories/gpg-coc/xx-gpg-coc.rst
index d5b1fc6..d6f3073 100644
--- a/lib/lp/registry/stories/gpg-coc/xx-gpg-coc.rst
+++ b/lib/lp/registry/stories/gpg-coc/xx-gpg-coc.rst
@@ -227,13 +227,14 @@ token to a fixed value:
 >>> from datetime import datetime, timezone
 >>> import hashlib
 >>> from lp.services.verification.model.logintoken import LoginToken
->>> logintoken = LoginToken.selectOneBy(
-... _token=hashlib.sha256(token_value).hexdigest()
+>>> logintoken = (
+... IStore(LoginToken)
+... .find(LoginToken, _token=hashlib.sha256(token_value).hexdigest())
+... .one()
 ... )
 >>> logintoken.date_created = datetime(
 ... 2005, 4, 1, 12, 0, 0, tzinfo=timezone.utc
 ... )
->>> logintoken.sync()
 
 Back to Sample User. They visit the token URL and is asked to sign some
 text to prove they own the key.
@@ -317,8 +318,10 @@ If they sign the text correctly, they are redirected to their home page.
 
 Now that the key has been validated, the login token is consumed:
 
->>> consumed_token = LoginToken.selectOneBy(
-... _token=hashlib.sha256(token_value).hexdigest()
+>>> consumed_token = (
+... IStore(LoginToken)
+... .find(LoginToken, _token=hashlib.sha256(token_value).hexdigest())
+... .one()
 ... )
 >>> consumed_token.date_consumed is not None
 True
diff --git a/lib/lp/services/verification/model/logintoken.py b/lib/lp/services/verification/model/logintoken.py
index 5aafa18..572cce2 100644
--- a/lib/lp/services/verification/model/logintoken.py
+++ b/lib/lp/services/verification/model/logintoken.py
@@ -10,7 +10,9 @@ import hashlib
 from datetime import timezone
 
 import six
-from storm.expr import And
+from storm.expr import And, Is
+from storm.properties import DateTime, Int, Unicode
+from storm.references import Reference
 from zope.component import getUtility
 from zope.interface import implementer
 
@@ -20,15 +22,9 @@ from lp.registry.interfaces.gpg import IGPGKeySet
 from lp.registry.interfaces.person import IPersonSet
 from lp.services.config import config
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import DBEnum
 from lp.services.database.interfaces import IPrimaryStore, IStore
-from lp.services.database.sqlbase import SQLBase, sqlvalues
-from lp.services.database.sqlobject import (
-ForeignKey,
-SQLObjectNotFound,
-StringCol,
-)
+from lp.services.database.stormbase import StormBase
 from lp.services.gpg.interfaces import IGPGHandler
 from lp.services.mail.helpers import get_email_template
 from lp.services.mail.sendmail import format_address, simple_sendmail
@@ -44,35 +40,51 @@ MAIL_APP = "services/verification"
 
 
 @implementer(ILoginToken)
-class LoginToken(SQLBase):
-_table = "LoginToken"
-
-redirection_url = StringCol(default=None)
-requester = ForeignKey(dbName="requester", foreignKey="Person")
-requesteremail = StringCol(
-dbName="requesteremail", 

[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:stormify-account into launchpad:master

2023-07-10 Thread Colin Watson
Colin Watson has proposed merging ~cjwatson/launchpad:stormify-account into 
launchpad:master.

Commit message:
Convert Account to Storm

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/446388
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad:stormify-account into launchpad:master.
diff --git a/lib/lp/registry/doc/person.rst b/lib/lp/registry/doc/person.rst
index 593fd24..eb3075a 100644
--- a/lib/lp/registry/doc/person.rst
+++ b/lib/lp/registry/doc/person.rst
@@ -147,7 +147,7 @@ using the createPersonAndEmail() method.
 
 >>> from lp.services.identity.model.account import Account
 >>> from lp.services.database.interfaces import IPrimaryStore
->>> account = IPrimaryStore(Account).get(Account, p.accountID)
+>>> account = IPrimaryStore(Account).get(Account, p.account_id)
 >>> account.reactivate("Activated by doc test.")
 >>> p.account_status
 
 >> from zope.interface.verify import verifyObject
 >>> from lp.registry.interfaces.person import IPersonSet
+>>> from lp.services.database.interfaces import IStore
 >>> from lp.services.identity.interfaces.account import (
 ... IAccount,
 ... IAccountSet,
@@ -116,8 +117,12 @@ database. Only an admin can change the status.
 >>> login("ad...@canonical.com")
 >>> account.setStatus(AccountStatus.SUSPENDED, None, "spammer")
 
-# Shouldn't be necessary with Storm!
->>> removeSecurityProxy(account).sync()
+date_status_set is maintained by a DB trigger, so we need to flush the
+status change and force the Account row to be reloaded from the database in
+order to check that the trigger works.
+
+>>> IStore(account).flush()
+>>> IStore(account).autoreload(account)
 >>> account.date_status_set > original_date_status_set
 True
 
diff --git a/lib/lp/services/identity/interfaces/account.py b/lib/lp/services/identity/interfaces/account.py
index eaff4a7..99615be 100644
--- a/lib/lp/services/identity/interfaces/account.py
+++ b/lib/lp/services/identity/interfaces/account.py
@@ -355,7 +355,7 @@ class AccountStatusChoice(Choice):
 if not IAccount.providedBy(self.context):
 # Not an account, eg. validating Person.setAccountStatus.
 return True
-if removeSecurityProxy(self.context)._SO_creating:
+if removeSecurityProxy(self.context)._creating:
 # This object is initializing.
 return True
 if self.context.status == value:
diff --git a/lib/lp/services/identity/model/account.py b/lib/lp/services/identity/model/account.py
index 5412f60..9096b01 100644
--- a/lib/lp/services/identity/model/account.py
+++ b/lib/lp/services/identity/model/account.py
@@ -8,17 +8,15 @@ __all__ = [
 "AccountSet",
 ]
 
-import datetime
+from datetime import datetime, timezone
 
-from storm.locals import ReferenceSet
+from storm.locals import DateTime, Int, ReferenceSet, Unicode
 from zope.interface import implementer
 
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import DBEnum
 from lp.services.database.interfaces import IPrimaryStore, IStore
-from lp.services.database.sqlbase import SQLBase
-from lp.services.database.sqlobject import StringCol
+from lp.services.database.stormbase import StormBase
 from lp.services.helpers import backslashreplace
 from lp.services.identity.interfaces.account import (
 AccountCreationRationale,
@@ -38,12 +36,21 @@ class AccountStatusDBEnum(DBEnum):
 
 
 @implementer(IAccount)
-class Account(SQLBase):
+class Account(StormBase):
 """An Account."""
 
-date_created = UtcDateTimeCol(notNull=True, default=UTC_NOW)
+__storm_table__ = "Account"
 
-displayname = StringCol(dbName="displayname", notNull=True)
+id = Int(primary=True)
+
+date_created = DateTime(
+name="date_created",
+allow_none=False,
+default=UTC_NOW,
+tzinfo=timezone.utc,
+)
+
+displayname = Unicode(name="displayname", allow_none=False)
 
 creation_rationale = DBEnum(
 name="creation_rationale",
@@ -51,15 +58,33 @@ class Account(SQLBase):
 allow_none=False,
 )
 status = AccountStatusDBEnum(
-enum=AccountStatus, default=AccountStatus.NOACCOUNT, allow_none=False
+name="status",
+enum=AccountStatus,
+default=AccountStatus.NOACCOUNT,
+allow_none=False,
 )
-date_status_set = UtcDateTimeCol(notNull=True, default=UTC_NOW)
-status_history = StringCol(dbName="status_comment", default=None)
+date_status_set = DateTime(
+name="date_status_set",
+allow_none=False,
+default=UTC_NOW,
+tzinfo=timezone.utc,
+)
+status_history = Unicode(name="status_comment", default=None)
 
 openid_identifiers = ReferenceSet(

Re: [Launchpad-reviewers] [Merge] ~ines-almeida/txpkgupload:refactor-makefile-commands into txpkgupload:master

2023-07-10 Thread Ines Almeida
Thank you for the suggestion! I updated the code, it seems to work nicely
-- 
https://code.launchpad.net/~ines-almeida/txpkgupload/+git/txpkgupload/+merge/446377
Your team Launchpad code reviewers is requested to review the proposed merge of 
~ines-almeida/txpkgupload:refactor-makefile-commands into txpkgupload: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] ~ines-almeida/launchpad:add-bug-webhooks/add-tags-to-payload into launchpad:master

2023-07-10 Thread Ines Almeida
Ines Almeida has proposed merging 
~ines-almeida/launchpad:add-bug-webhooks/add-tags-to-payload into 
launchpad:master.

Commit message:
Add tags to payload and trigger events on tags changed

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/446380

The reason why the `tags` events were not worked previously was because 
`get_string_representation()` wasn't returning representations of lists. This 
is fixed by this change, plus we now send the `tags` field within the payload 
for bug webhooks
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~ines-almeida/launchpad:add-bug-webhooks/add-tags-to-payload into 
launchpad:master.
diff --git a/lib/lp/bugs/subscribers/bugactivity.py b/lib/lp/bugs/subscribers/bugactivity.py
index d1d1bc8..f67491c 100644
--- a/lib/lp/bugs/subscribers/bugactivity.py
+++ b/lib/lp/bugs/subscribers/bugactivity.py
@@ -1,6 +1,8 @@
 # Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from typing import List
+
 from lazr.enum import BaseItem
 from zope.component import getUtility
 from zope.proxy import isProxy
@@ -57,6 +59,8 @@ def get_string_representation(obj):
 return obj
 elif isinstance(obj, bool):
 return str(obj)
+elif isinstance(obj, List):
+return ", ".join(obj)
 else:
 return None
 
diff --git a/lib/lp/bugs/subscribers/webhooks.py b/lib/lp/bugs/subscribers/webhooks.py
index 43a51c2..7f5b16c 100644
--- a/lib/lp/bugs/subscribers/webhooks.py
+++ b/lib/lp/bugs/subscribers/webhooks.py
@@ -81,7 +81,7 @@ def get_bugtask_attributes(bugtask: IBugTask, bug: IBug):
 data = compose_webhook_payload(
 IBug,
 bug,
-["title", "description", "owner"],
+["title", "description", "owner", "tags"],
 preferred_names={"owner": "reporter"},
 )
 data.update(
diff --git a/lib/lp/bugs/tests/test_subscribers.py b/lib/lp/bugs/tests/test_subscribers.py
index f6fce0d..5a7362b 100644
--- a/lib/lp/bugs/tests/test_subscribers.py
+++ b/lib/lp/bugs/tests/test_subscribers.py
@@ -109,6 +109,7 @@ class TestBugWebhooksTriggered(TestCaseWithFactory):
 "importance": Equals(bugtask.importance.title),
 "assignee": Equals(assignee),
 "date_created": Equals(bugtask.datecreated.isoformat()),
+"tags": Equals(bugtask.bug.tags),
 }
 
 expected_payload = {
@@ -225,3 +226,35 @@ class TestBugWebhooksTriggered(TestCaseWithFactory):
 self._assert_last_webhook_delivery(
 comment_hook, "bug:comment:0.1", c_exptd_payload
 )
+
+def test_tagging_bug_trigers_webhooks(self):
+"""Adding bug tags will trigger webhook"""
+bug = self.bugtask.bug
+with person_logged_in(self.owner), notify_modified(
+bug, ["tags"], user=self.owner
+):
+bug.tags = ["foo", "bar"]
+expected_payload = self._build_bugtask_expected_payload(
+self.bugtask, "tags-changed", {"tags": []}
+)
+self._assert_last_webhook_delivery(
+self.hook, "bug:0.1", expected_payload
+)
+
+def test_tags_changed_trigers_webhooks(self):
+"""Modifying the bug tags will trigger webhook"""
+bug = self.bugtask.bug
+
+with person_logged_in(bug.owner):
+bug.tags = ["foo"]
+
+with person_logged_in(self.owner), notify_modified(
+bug, ["tags"], user=self.owner
+):
+bug.tags = ["bar", "test"]
+expected_payload = self._build_bugtask_expected_payload(
+self.bugtask, "tags-changed", {"tags": ["foo"]}
+)
+self._assert_last_webhook_delivery(
+self.hook, "bug:0.1", expected_payload
+)
___
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] ~ines-almeida/txpkgupload:refactor-makefile-commands into txpkgupload:master

2023-07-10 Thread Colin Watson
This seems unnecessarily complicated.  `PIP_FIND_LINKS` can take multiple 
entries, and it isn't a problem if one of them doesn't exist.

Instead of this change, what happens if you:

 * add `--extra-search-dir=$(CURDIR)/wheels/ 
--extra-search-dir=$(DEPENDENCY_DIR)/` to the `$(VIRTUALENV)` command
 * change `PIP_FIND_LINKS=file://$(DEPENDENCY_DIR)/` to 
`PIP_FIND_LINKS="file://$(CURDIR)/wheels/ file://$(DEPENDENCY_DIR)/"`

?  I think that should work, and it's more in line with how Launchpad itself 
does things.
-- 
https://code.launchpad.net/~ines-almeida/txpkgupload/+git/txpkgupload/+merge/446377
Your team Launchpad code reviewers is requested to review the proposed merge of 
~ines-almeida/txpkgupload:refactor-makefile-commands into txpkgupload: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] ~ines-almeida/txpkgupload:refactor-makefile-commands into txpkgupload:master

2023-07-10 Thread Ines Almeida
Ines Almeida has proposed merging 
~ines-almeida/txpkgupload:refactor-makefile-commands into txpkgupload:master.

Commit message:
Install python packages from wheels when wheels directory exist

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ines-almeida/txpkgupload/+git/txpkgupload/+merge/446377

When building the 'env', it installs from the `wheels` directory when the 
directory exists - this assumes that if the `wheels` directory exists, it will 
contain the wheels we need, which I think it's a fair assumption.

I tested both the cases where there is a wheels directory with all the wheels, 
and where there isn't a wheels directory.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~ines-almeida/txpkgupload:refactor-makefile-commands into txpkgupload:master.
diff --git a/Makefile b/Makefile
index 98163b0..7f1eed2 100644
--- a/Makefile
+++ b/Makefile
@@ -74,13 +74,18 @@ $(DEPENDENCY_DIR):
 
 $(ENV):
 	mkdir -p $(ENV)
+	$(PYTHON) -m venv env
+	@if [ -d $(WHEELS) ]; then \
+		echo 'Found $(WHEELS) director, installing from folder...'; \
+		$(PIP) install -f $(WHEELS) --no-index -r bootstrap-requirements.txt; \
+		$(PIP) install -f $(WHEELS) --no-index -c requirements.txt -e '.[test]'; \
+	else \
 	(echo '[easy_install]'; \
 	 echo 'find_links = file://$(DEPENDENCY_DIR)/') \
-		>$(ENV)/.pydistutils.cfg
-	VIRTUALENV_SETUPTOOLS=1 $(VIRTUALENV) \
-		--python=$(PYTHON) --never-download $(ENV)
-	$(PIP) install $(PIP_ARGS) -r bootstrap-requirements.txt
-	$(PIP) install $(PIP_ARGS) -c requirements.txt -e '.[test]'
+		>$(ENV)/.pydistutils.cfg; \
+		$(PIP) install $(PIP_ARGS) -r bootstrap-requirements.txt; \
+		$(PIP) install $(PIP_ARGS) -c requirements.txt -e '.[test]'; \
+	fi
 	$(ENV)/bin/python -m compileall -q src
 	ln -nsf $(ENV)/bin bin
 
@@ -100,6 +105,7 @@ clean: clean_pip
 	$(RM) $(VERSION_INFO)
 	$(RM) -rf dist
 	$(RM) -rf build
+	$(RM) -rf $(ENV)
 
 
 .PHONY: compile check clean clean_pip default dist
___
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] ~lool/git-build-recipe:fetch-pristine-tar-tags into git-build-recipe:master

2023-07-10 Thread Richard Hansen
I opened an alternative merge request [1] that is the same as this one except:
  - Tags are put in refs/tags//* instead of refs/remotes//* (to 
avoid potential name collisions).
  - I added some comments explaining why fetching is done the way it is.
  - I added tests.

[1] 
https://code.launchpad.net/~rhansen/git-build-recipe/+git/git-build-recipe/+merge/446358
-- 
https://code.launchpad.net/~lool/git-build-recipe/+git/git-build-recipe/+merge/443942
Your team Launchpad code reviewers is requested to review the proposed merge of 
~lool/git-build-recipe:fetch-pristine-tar-tags into git-build-recipe: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