Skip to content

Commit 594ce64

Browse files
committed
Update debian packaging docs for pbuilder-ev3dev
1 parent 5d5daf2 commit 594ce64

File tree

1 file changed

+37
-55
lines changed

1 file changed

+37
-55
lines changed

docs/devtools/packaging-for-ev3dev.md

Lines changed: 37 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ subject: Packaging
66
* Table of Contents
77
{:toc}
88

9-
Being a Debian distribution, debian packaging is an important part of ev3dev.
9+
Being a Debian distribution, Debian packaging is an important part of ev3dev.
1010
We maintain quite a few packages of our own and also modify some upstream
1111
packages.
1212

@@ -16,7 +16,7 @@ Whether you are creating a new package or modifying an existing one, there are
1616
some tools that you are going to need. We currently use Ubuntu trusty as the
1717
development environment. (We will only support trusty, but any thing newer should
1818
work - same goes for jessie or newer on Debian). If you are using Windows or Mac
19-
you can use [VirtualBox] to run trusty in a virtual machine.
19+
you can use [VirtualBox] or [Docker] to run trusty in a virtual machine.
2020

2121
On your Ubuntu machine, you will need to install some packages.
2222
Note: If you are the kind of person that doesn't install recommends, make sure
@@ -28,10 +28,6 @@ you install *all* of the recommended packages. If you don't know what
2828
If you haven't already, you will also need to [add the ev3dev archive to apt][ev3dev-archive].
2929
Be sure to install the `ev3dev-archive-keyring` package. We will need it later.
3030

31-
(Optional) If you want to build packages for Raspberry Pi (1 - not 2), then you
32-
need to grab the patched [pbuilder-dist] script from [ev3dev-buildscripts].
33-
Save it somewhere in your `$PATH` (`/usr/local/bin` is a good choice).
34-
3531
If you have never used `git` before, you need to configure your name and email.
3632
In a terminal, run...
3733

@@ -53,60 +49,47 @@ And we need to configure [quilt] as well. Save the following to `~/.quiltrc`.
5349
QUILT_REFRESH_ARGS="-p ab"
5450
QUILT_DIFF_ARGS="--color=auto"
5551

56-
And one more config file. Save the following to `~/.pbuilderrc`.
52+
Finally, we need to get the `pbuilder-ev3dev` script.
53+
54+
wget https://raw.githubusercontent.com/ev3dev/ev3dev-buildscripts/master/pbuilder-ev3dev
55+
chmod +x pbuilder-ev3dev
56+
sudo mv pbuilder-ev3dev /usr/local/bin
57+
58+
## Initializing/Updating pbuilder-ev3dev
5759

58-
APTKEYRINGS="/usr/share/keyrings/ev3dev-archive-keyring.gpg"
59-
# OTHERMIRROR is ignored when using pbuilder-dist. :-(
60-
# LP bug #1004579
61-
OTHERMIRROR="deb http://archive.ev3dev.org/debian jessie main"
60+
You need to initialize a base image for each distribution and architecture that
61+
you are building for. These base images also need to be periodically updated,
62+
otherwise packages may fail to install during build because they are no longer
63+
available (as in the case with security updates).
6264

63-
Finally, we need to setup `pbuilder-dist` to create a clean environment where
64-
the packages will actually be built. Run the following in a terminal...
65+
The same command is used for both creating and updating:
6566

66-
# we have to work around a bug in pbuilder-dist.
67-
export OTHERMIRROR="deb http://archive.ev3dev.org/debian jessie main"
68-
# For the EV3
69-
pbuilder-dist jessie armel create
70-
# For Raspberry Pi 1 (raspbian) - see "(Optional)" note above.
71-
pbuilder-dist jessie rpi create
72-
# For Raspberry Pi 2
73-
pbuilder-dist jessie armhf create
67+
OS=debian DIST=jessie ARCH=armel pbuilder-ev3deb base
68+
69+
Replace the variables as needed. `OS` can be `debian` or `rasbian`. `DIST` can
70+
be any Debian distribution supported by ev3dev (currently only `jessie`). `ARCH`
71+
is any valid Debian architecture (`armel`, `armhf`, etc.). The images are stored
72+
in `~/pbuilder-ev3dev`.
7473

7574
## Building an Existing Package
7675

77-
All ev3dev debian packages are hosted at <https://github.com/ev3dev>. To get the
78-
package source code, you need to clone it using `git`. If you are planning
79-
on making changes, you should [fork] the repository on GitHub first and then
80-
clone your repository so that you can push the changes back to GitHub. After you
81-
have forked the repository on GitHub, run...
76+
All ev3dev Debian package source code is hosted at <https://github.com/ev3dev>.
77+
To get the package source code, you need to clone it using `git`. If you are
78+
planning on making changes, you should [fork] the repository on GitHub first
79+
and then clone your repository so that you can push the changes back to GitHub.
80+
After you have forked the repository on GitHub, run...
8281

8382
# if you have ssh setup...
8483
git clone git@github.com:yourname/packagename
8584
# or if you don't have ssh...
8685
git clone https://github.com/yourname/packagename
8786

88-
We use [git-buildpackage] to manage packages, so to build a source package (.dsc),
89-
run...
90-
91-
git buildpackage -S -us -uc
87+
To build a package, simply run `pbuilder-ev3dev` from the source code directory.
9288

93-
The `-S` means to just build a source package and `-us -uc` means don't sign it.
94-
This creates several files in the parent directory.
89+
OS=debian DIST=jessie ARCH=armel pbuilder-ev3dev build
9590

96-
If you have not run `pbuilder-dist` in a while, you should update it to make sure
97-
you have the most recent package list. Replace `armel` with other architectures
98-
as needed.
99-
100-
# Don't forget our workaround.
101-
export OTHERMIRROR="deb http://archive.ev3dev.org/debian jessie main"
102-
pbuilder-dist jessie armel update
103-
104-
Now, we can actually build the package.
105-
106-
pbuilder-dist jessie armel build ../packagename_version.dsc
107-
108-
The .deb package(s) will be placed in `~/pbuilder/jessie-armel_result`. You can
109-
copy these files to your EV3 and install them.
91+
The .deb package(s) will be placed in `~/pbuilder-ev3dev/debian/jessie-armel`.
92+
You can copy these files to your EV3 and install them.
11093

11194
## Modifying a Package
11295

@@ -129,7 +112,7 @@ for changes. It will look something like this...
129112

130113
*
131114

132-
-- Your Name <youremail@example.com> Fri, 31 Jul 2015 17:34:04 -0500
115+
-- Your Name <youremail@example.com> Fri, 31 Jul 2016 17:34:04 -0500
133116

134117
...
135118

@@ -139,12 +122,10 @@ you install this package somewhere, you should bump the version number by runnin
139122

140123
Now, you can make any changes you want to the source code. When you are done
141124
making changes, you can try them out by building the package as described above
142-
with one difference. You need to add an option so that it will not fail because
143-
of your changes.
144-
145-
git buildpackage -S -us -uc --git-ignore-new
125+
with one difference. You need to use the `dev-build` command so that it will
126+
not fail because of your changes.
146127

147-
Then use `pbuilder-dist` to build the binary package as describe above.
128+
OS=debian DIST=jessie ARCH=armel pbuilder-ev3dev dev-build
148129

149130
Once you are happy with your changes, commit them and push them back to GitHub.
150131
**Note:** Some packages use [quilt] for managing patches. If you want to figure
@@ -174,7 +155,7 @@ building packages for yourself.
174155
6. Run `git-dch -R --commit` to create a `debian/changelog` entry. Edit it by
175156
hand if necessary.
176157
7. Run `git-buildpackage -S -us -uc --git-tag` to create the source package.
177-
8. Build the release packages using `pbuilder-dist`.
158+
8. Build the release packages using `pbuilder-ev3dev`.
178159
9. Sign the `.changes` file in `~/pbuilder/<release>-<arch>_result/` using `debsign`.
179160
10. Push the new release to the ev3dev archive using `dput`.
180161
11. Push the git branch and tag to GitHub.
@@ -185,13 +166,14 @@ building packages for yourself.
185166
## Additional Resources
186167

187168
* [Debian Policy Manual] - make sure your package conforms to this
188-
* [Debian New Maintainers Guide] - good intro to debian packaging
169+
* [Debian New Maintainers Guide] - good intro to Debian packaging
189170
* [git-buildpackage] - useful info that is not in the man pages
190171

191172

192173
[VirtualBox]: https://www.virtualbox.org
174+
[Docker]: http://www.docker.com
193175
[ev3dev-archive]: {{ github.site.url }}/docs/devtools/installing-the-ev3dev-archive
194-
[pbuilder-dist]: https://raw.githubusercontent.com/ev3dev/ev3dev-buildscripts/master/pbuilder-dist
176+
[pbuilder-ev3dev]: https://raw.githubusercontent.com/ev3dev/ev3dev-buildscripts/master/pbuilder-ev3dev
195177
[ev3dev-buildscripts]: https://github.com/ev3dev/ev3dev-buildscripts
196178
[quilt]: https://wiki.debian.org/UsingQuilt
197179
[fork]: https://help.github.com/articles/fork-a-repo/

0 commit comments

Comments
 (0)