Merge ~fourdollars/pc-enablement/+git/oem-scripts:master into ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master

Proposed by Shih-Yuan Lee
Status: Merged
Approved by: Shih-Yuan Lee
Approved revision: d3a0e89b2fda35391ff440b1f2050147699c0e7e
Merged at revision: 72224d23981feb43112294c7016a731674492178
Proposed branch: ~fourdollars/pc-enablement/+git/oem-scripts:master
Merge into: ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master
Diff against target: 82 lines (+35/-2)
3 files modified
debian/changelog (+7/-0)
debian/tests/launchpad-api (+12/-1)
launchpad-api (+16/-1)
Reviewer Review Type Date Requested Status
jeremyszu (community) Approve
Review via email: mp+402547@code.launchpad.net

Description of the change

LAUNCHPAD_API=https://api.staging.launchpad.net/ launchpad-api patch bugs/100 tags:='["lp-translations", "focal", "whatever", "tag"]'

To post a comment you must log in.
Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

[BOT]
$ cat oem-scripts-0.92-d3a0e89-in-docker-focal-summary.log
autopkgtest-collect-credentials PASS
autopkgtest-oem-scripts-auto PASS
pkg-somerville-meta PASS
pkg-stella-meta PASS
pkg-sutton-meta PASS
bug-bind PASS
get-private-ppa PASS
jq-lp PASS
launchpad-api PASS
lp-bug PASS
mir-bug PASS
oem-meta-packages PASS
pkg-list PASS
review-merge-proposal PASS
run-autopkgtest PASS
setup-apt-dir PASS
git-url-insteadof-setting PASS
recovery-from-iso.sh PASS
mir-bug-verification PASS
https://paste.ubuntu.com/p/2RHWs849bp/ oem-scripts-0.92-d3a0e89-in-docker-focal-complete.log

Revision history for this message
jeremyszu (os369510) wrote :

# ./launchpad-api patch bugs/1923555 tags:='["stella-decaf-c","cooexy"]'

works good but it will overwrite all tags instead of append.

@4$,

Is it expected?

review: Needs Information
Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

Yes, it is the design of Launchpad API.

Revision history for this message
jeremyszu (os369510) wrote :

got it, approve since this is a new feature.
Let's implement an append method if need.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index e1bfb43..7f3b9da 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+oem-scripts (0.92) UNRELEASED; urgency=medium
7+
8+ * debian/tests/launchpad-api,
9+ launchpad-api: Support PATCH method.
10+
11+ -- Shih-Yuan Lee (FourDollars) <sylee@canonical.com> Tue, 11 May 2021 14:10:31 +0800
12+
13 oem-scripts (0.91) focal; urgency=medium
14
15 * pkg-list: Fix the problem when checking the dependencies.
16diff --git a/debian/tests/launchpad-api b/debian/tests/launchpad-api
17index 3d6fa76..ff71689 100644
18--- a/debian/tests/launchpad-api
19+++ b/debian/tests/launchpad-api
20@@ -1,8 +1,19 @@
21 #!/bin/bash
22
23+export LAUNCHPAD_API="https://api.staging.launchpad.net/"
24+
25+launchpad-api patch bugs/100 tags:='["focal"]'
26+if [ "$(launchpad-api get bugs/100 | jq -r '.tags|join(" ")')" != "focal" ]; then
27+ exit 1
28+fi
29+
30+launchpad-api patch bugs/100 tags:='["lp-translations"]'
31+if [ "$(launchpad-api get bugs/100 | jq -r '.tags|join(" ")')" != "lp-translations" ]; then
32+ exit 1
33+fi
34+
35 export LAUNCHPAD_TOKEN="::"
36
37-export LAUNCHPAD_API="https://api.staging.launchpad.net/"
38 if [ "$(launchpad-api get bugs/1 | jq -r .web_link)" != "https://bugs.staging.launchpad.net/bugs/1" ]; then
39 exit 1
40 fi
41diff --git a/launchpad-api b/launchpad-api
42index e7736a5..d812b8f 100755
43--- a/launchpad-api
44+++ b/launchpad-api
45@@ -100,6 +100,18 @@ get_api()
46 "$@"
47 }
48
49+patch_api()
50+{
51+ api=$(parse_api "$1")
52+ if [ -z "$api" ]; then
53+ return
54+ fi
55+ shift
56+ http --check-status --ignore-stdin --json PATCH "$api" \
57+ Authorization:"OAuth realm=\"${LAUNCHPAD_API}/\", oauth_consumer_key=\"${oauth_consumer_key}\", oauth_nonce=\"$(date +%s)\", oauth_signature=\"%26${oauth_token_secret}\", oauth_signature_method=\"PLAINTEXT\", oauth_timestamp=\"$(date +%s)\", oauth_token=\"${oauth_token}\", oauth_version=\"1.0\"" \
58+ "$@"
59+}
60+
61 post_api()
62 {
63 api=$(parse_api "$1")
64@@ -119,7 +131,6 @@ post_api()
65 "$@"
66 }
67
68-
69 if [ -n "$LAUNCHPAD_TOKEN" ]; then
70 read -r oauth_token oauth_token_secret oauth_consumer_key < <(echo "$LAUNCHPAD_TOKEN" | tr ':' ' ')
71 if [ -z "$oauth_consumer_key" ]; then
72@@ -143,6 +154,10 @@ case "$1" in
73 shift
74 get_api "$@"
75 ;;
76+ ("patch"|"PATCH")
77+ shift
78+ patch_api "$@"
79+ ;;
80 ("post"|"POST")
81 shift
82 post_api "$@"

Subscribers

People subscribed via source and target branches