Merge ppa-dev-tools:packaging-debian into ppa-dev-tools:main

Proposed by Bryce Harrington
Status: Merged
Merge reported by: Bryce Harrington
Merged at revision: b08453d9ef3d6f952dfe05586f3a0cff06e77814
Proposed branch: ppa-dev-tools:packaging-debian
Merge into: ppa-dev-tools:main
Diff against target: 190 lines (+96/-6)
9 files modified
debian/changelog (+14/-0)
debian/control (+37/-0)
debian/copyright (+24/-0)
debian/install (+1/-0)
debian/rules (+4/-0)
debian/source/format (+1/-0)
tests/test_result.py (+3/-2)
tests/test_scripts_ppa.py (+9/-1)
tox.ini (+3/-3)
Reviewer Review Type Date Requested Status
Canonical Server Pending
Canonical Server packageset reviewers Pending
Canonical Server Reporter Pending
Review via email: mp+430594@code.launchpad.net

Description of the change

Implementation of the Debian packaging. This successfully produces an installable .deb for me, that sets up a functional /usr/bin/ppa and modules. Broader testing is appreciated of course, but in review I'm hoping for some detailed nitpicking of the packaging itself.

In particular one issue I'm scratching my head over is when running `debuild` I see lintian errors like these::

dpkg-buildpackage: info: full upload; Debian-native package (full source is included)
Now running lintian ppa-dev-tools_0.2.0~focal3_amd64.changes ...
E: ppa-dev-tools: bad-owner-for-doc-file usr/share/doc/ppa-dev-tools/ root/0 != root/root (or 0/0)
E: ppa-dev-tools: bad-owner-for-doc-file usr/share/doc/ppa-dev-tools/changelog.gz root/0 != root/root (or 0/0)
E: ppa-dev-tools: bad-owner-for-doc-file usr/share/doc/ppa-dev-tools/copyright root/0 != root/root (or 0/0)
E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/ 0/1001
E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/bin/ 0/1001
E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/bin/ppa 0/1001
E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/ 0/1001
E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/ 0/1001
E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-packages/ 0/1001
E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-packages/ppa/ 0/1001
E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-packages/ppa/__init__.py 0/1001
E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-packages/ppa/_version.py 0/1001
...

I'm not sure what's causing the group to be set to 1001. The installation still works, and I don't think the group permission should affect anything, but it's definitely incorrect:

  triage-jammy+22.04:~/src/PpaDevTools$ ls -l /usr/bin/ppa
  -rwxr-xr-x 1 root 1001 18303 Sep 21 03:30 /usr/bin/ppa*

I'm going to continue debugging this and get it sorted before landing this branch, but if anyone has advice or knows what's going on it'd be appreciated.

Another question I've pondered is whether to keep the debian packaging on a separate branch and/or repo from the upstream tree, as we do with ordinary upstream packages. However, I'm leaning towards keeping it all in the same repo both for simplicity and to facilitate future release automation via the Makefile (ultimately I'd like to run one command to generate all the various packages).

Although this seems to package 0.2.0 adequately, my intent is to produce a 0.2.1 release that includes this branch as well as the snap branch, to pick up all the documentation and other misc. fixups.

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote (last edit ):

Hey,
FYI building this in sbuild locally as I usually do does NOT show those ownership issues.

The only W I see is
 W: ppa-dev-tools: no-manual-page [usr/bin/ppa]

Which I think you could fix to be warning-free :-)

buildlog: https://paste.ubuntu.com/p/m5DG9mPVf7/

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Tuesday, September 27 2022, Bryce Harrington wrote:

> In particular one issue I'm scratching my head over is when running `debuild` I see lintian errors like these::
>
> dpkg-buildpackage: info: full upload; Debian-native package (full source is included)
> Now running lintian ppa-dev-tools_0.2.0~focal3_amd64.changes ...
> E: ppa-dev-tools: bad-owner-for-doc-file usr/share/doc/ppa-dev-tools/ root/0 != root/root (or 0/0)
> E: ppa-dev-tools: bad-owner-for-doc-file usr/share/doc/ppa-dev-tools/changelog.gz root/0 != root/root (or 0/0)
> E: ppa-dev-tools: bad-owner-for-doc-file usr/share/doc/ppa-dev-tools/copyright root/0 != root/root (or 0/0)
> E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/ 0/1001
> E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/bin/ 0/1001
> E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/bin/ppa 0/1001
> E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/ 0/1001
> E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/ 0/1001
> E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-packages/ 0/1001
> E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-packages/ppa/ 0/1001
> E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-packages/ppa/__init__.py 0/1001
> E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-packages/ppa/_version.py 0/1001
> ...

Wild guess here, but maybe you're doing the build inside a container
where your $USER doesn't exist, but where you've mounted your $HOME (or
some of its subdirectories) in order to have access to your project.
Since this directory is externally owned by your $USER, and since $USER
doesn't exist in the container, you end up with files owned by the 1001
UID.

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

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

> On Tuesday, September 27 2022, Bryce Harrington wrote:
>
> > In particular one issue I'm scratching my head over is when running
> `debuild` I see lintian errors like these::
> >
> > dpkg-buildpackage: info: full upload; Debian-native package (full source is
> included)
> > Now running lintian ppa-dev-tools_0.2.0~focal3_amd64.changes ...
> > E: ppa-dev-tools: bad-owner-for-doc-file usr/share/doc/ppa-dev-tools/ root/0
> != root/root (or 0/0)
> > E: ppa-dev-tools: bad-owner-for-doc-file usr/share/doc/ppa-dev-
> tools/changelog.gz root/0 != root/root (or 0/0)
> > E: ppa-dev-tools: bad-owner-for-doc-file usr/share/doc/ppa-dev-
> tools/copyright root/0 != root/root (or 0/0)
> > E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/ 0/1001
> > E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/bin/ 0/1001
> > E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/bin/ppa 0/1001
> > E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/ 0/1001
> > E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/ 0/1001
> > E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-packages/
> 0/1001
> > E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-
> packages/ppa/ 0/1001
> > E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-
> packages/ppa/__init__.py 0/1001
> > E: ppa-dev-tools: wrong-file-owner-uid-or-gid usr/lib/python3/dist-
> packages/ppa/_version.py 0/1001
> > ...
>
> Wild guess here, but maybe you're doing the build inside a container
> where your $USER doesn't exist, but where you've mounted your $HOME (or
> some of its subdirectories) in order to have access to your project.
> Since this directory is externally owned by your $USER, and since $USER
> doesn't exist in the container, you end up with files owned by the 1001
> UID.

Interesting guess, but weirdly it seems the situation is the opposite. I'm doing the devel and packaging in my regular focal desktop ($USER set properly and all) but getting these E's. However, if I do exactly the same but in a jammy or focal LXC container it works fine, no lint E's.

Since I plan to do the official packaging in LXC containers anyway, I guess that's my solution.

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

Thanks for the feedback, I did some additional debugging and testing and added a few more fixes, and just now landed it:

To git+ssh://git.launchpad.net/ppa-dev-tools
   0ac612e..01fe475 main -> main

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
2new file mode 100644
3index 0000000..376e9d6
4--- /dev/null
5+++ b/debian/changelog
6@@ -0,0 +1,14 @@
7+ppa-dev-tools (0.2.0) focal; urgency=medium
8+
9+ * New release
10+ - Adds 'tests' subcommand
11+ - Fixes parsing errors for ppa addresses
12+ - Improves packaging support
13+
14+ -- Bryce Harrington <bryce@canonical.com> Mon, 19 Sep 2022 23:12:02 -0700
15+
16+ppa-dev-tools (0.1.0) focal; urgency=medium
17+
18+ * Initial release.
19+
20+ -- Bryce Harrington <bryce@canonical.com> Mon, 25 Jul 2022 19:49:19 -0700
21diff --git a/debian/control b/debian/control
22new file mode 100644
23index 0000000..f1a4699
24--- /dev/null
25+++ b/debian/control
26@@ -0,0 +1,37 @@
27+Source: ppa-dev-tools
28+Section: devel
29+Priority: optional
30+Standards-Version: 4.5.0
31+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
32+Build-Depends:
33+ dh-python,
34+ debhelper-compat (= 12),
35+ python3 (>= 3.6),
36+ python3-appdirs,
37+ python3-debian,
38+ python3-distro-info,
39+ python3-launchpadlib,
40+ python3-lazr.restfulclient,
41+ python3-mock,
42+ python3-pytest,
43+ python3-pytest-runner,
44+ python3-setuptools,
45+ python3-software-properties,
46+ python3-yaml,
47+
48+Package: ppa-dev-tools
49+Architecture: all
50+Depends:
51+ ${misc:Depends},
52+ ${python3:Depends},
53+ python3-debian,
54+ python3-launchpadlib,
55+ python3-lazr.restfulclient,
56+ python3-setuptools,
57+ python3-software-properties,
58+ python3-xdg,
59+ python3-yaml,
60+Description: command line client for managing PPAs in Launchpad.
61+ Provides a command line tool for creating, deleting, and configuring PPAs.
62+ Includes functionality to wait/block until all packages have built.
63+
64diff --git a/debian/copyright b/debian/copyright
65new file mode 100644
66index 0000000..944d56b
67--- /dev/null
68+++ b/debian/copyright
69@@ -0,0 +1,24 @@
70+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
71+Upstream-Name: ppa-dev-tools
72+Upstream-Contact: Bryce Harrington <bryce@canonical.com>
73+
74+Files: *
75+Copyright: 2022, Bryce Harrington <bryce@canonical.com>
76+License: GPL-2+
77+ This program is free software; you can redistribute it and/or modify
78+ it under the terms of the GNU General Public License as published by
79+ the Free Software Foundation; either version 2 of the License, or
80+ (at your option) any later version.
81+ .
82+ This program is distributed in the hope that it will be useful,
83+ but WITHOUT ANY WARRANTY; without even the implied warranty of
84+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
85+ GNU General Public License for more details.
86+ .
87+ You should have received a copy of the GNU General Public License along
88+ with this program; if not, write to the Free Software Foundation, Inc.,
89+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
90+ .
91+ On Debian systems, the full text of the GNU General Public
92+ License version 2 can be found in the file
93+ '/usr/share/common-licenses/GPL-2'.
94diff --git a/debian/install b/debian/install
95new file mode 100644
96index 0000000..bef6191
97--- /dev/null
98+++ b/debian/install
99@@ -0,0 +1 @@
100+scripts/ppa usr/bin/
101diff --git a/debian/rules b/debian/rules
102new file mode 100755
103index 0000000..641186e
104--- /dev/null
105+++ b/debian/rules
106@@ -0,0 +1,4 @@
107+#!/usr/bin/make -f
108+
109+%:
110+ dh $@ --with python3 --buildsystem=pybuild
111diff --git a/debian/source/format b/debian/source/format
112new file mode 100644
113index 0000000..89ae9db
114--- /dev/null
115+++ b/debian/source/format
116@@ -0,0 +1 @@
117+3.0 (native)
118diff --git a/tests/test_result.py b/tests/test_result.py
119index 836bbd1..cbd574c 100644
120--- a/tests/test_result.py
121+++ b/tests/test_result.py
122@@ -18,6 +18,8 @@ import gzip
123
124 sys.path.insert(0, os.path.realpath(
125 os.path.join(os.path.dirname(__file__), "..")))
126+DATA_DIR = os.path.realpath(
127+ os.path.join(os.path.dirname(__file__), "data"))
128
129 from ppa.result import Result
130
131@@ -61,6 +63,5 @@ def test_log(tmp_path):
132
133 def test_triggers():
134 """Checks that autopkgtest triggers can be extracted from test result logs."""
135- data_dir = "/home/bryce/src/PpaDevTools/ppa-dev-tools-result-class/tests/data"
136- result = Result(f"file://{data_dir}/results-six-s390x.log.gz", None, None, None, None)
137+ result = Result(f"file://{DATA_DIR}/results-six-s390x.log.gz", None, None, None, None)
138 assert result.triggers == ['pygobject/3.42.2-2', 'six/1.16.0-4']
139diff --git a/tests/test_scripts_ppa.py b/tests/test_scripts_ppa.py
140index ca6d1fe..d344340 100644
141--- a/tests/test_scripts_ppa.py
142+++ b/tests/test_scripts_ppa.py
143@@ -17,9 +17,17 @@ import pytest
144
145 SCRIPT_NAME = 'ppa'
146 BASE_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
147-scripts_path = os.path.join(BASE_PATH, 'scripts')
148 sys.path.insert(0, BASE_PATH)
149
150+if '.pybuild' in BASE_PATH:
151+ python_version = '.'.join([str(v) for v in sys.version_info[0:2]])
152+ scripts_path = os.path.join(
153+ BASE_PATH.replace(f'/.pybuild/cpython3_{python_version}/', '/'),
154+ f'scripts-{python_version}'
155+ )
156+else:
157+ scripts_path = os.path.join(BASE_PATH, 'scripts')
158+
159 script_path = os.path.join(scripts_path, SCRIPT_NAME)
160 loader = importlib.machinery.SourceFileLoader(SCRIPT_NAME, script_path)
161 script = types.ModuleType(loader.name)
162diff --git a/tox.ini b/tox.ini
163index 5340f7c..5e56ea0 100644
164--- a/tox.ini
165+++ b/tox.ini
166@@ -7,21 +7,21 @@ skipsdist = true
167 deps =
168 flake8
169 flake8-docstrings
170-commands = flake8 dsctriage setup.py
171+commands = flake8 ppa tests setup.py
172
173 [testenv:pylint]
174 deps =
175 pylint
176 pytest
177 commands =
178- pylint --max-line-length=100 dsctriage setup.py
179+ pylint --max-line-length=100 ppa tests setup.py
180
181 [testenv:pytest]
182 deps =
183 pytest
184 pytest-cov
185 commands =
186- py.test --cov dsctriage dsctriage
187+ py.test --cov ppa tests
188
189 [flake8]
190 max-line-length = 100

Subscribers

People subscribed via source and target branches

to all changes: