Last week, I posted about python-sense,
and API wrapper for the internal Sense API. I wrote this so that I could
pull data about myself into my own databases, allowing me to use that
information for myself.
One way I'm doing this is by pulling my room data into an
InfluxDB database, letting me run time series
queries against my environmental data.
I'm able to run this on a cron, automatically loading data from the Sense
API into my Influx database. I can then use that with something like
Grafana, to check out what my room looks like over
time.
FTP assistant
This month I marked 233 packages for accept and rejected 29. I also sent 11 emails to maintainers asking questions. Currently there are 33 packages in NEW and the minimum this week has been as low as 24 packages. Come on you fellow developers, where are your packages? I am sure you can do better .
Debian LTS
This was my twenty-fourth month that I did some work for the Debian LTS initiative, started by Raphael Hertzog at Freexian.
This month my all in all workload has been 18.75h. This resulted in patches for 13 CVEs and the following uploads:
[DLA 522-1] python2.7 security update
[DLA 533-1] php5 security update
[DLA 534-1] libgd2 security update
[DLA 536-1] wget security update
I also looked at mxml and libstruts1.2-java and marked CVEs for these packages as no-dsa . I also reviewed a patch of Salvatore for an embargoed CVE of xerces-c. Last but not least I looked at the remaining two CVEs for asterisk, but was not really able to create working patches
This month I called again for testing php5. Thanks a lot to Stefan and anybody else who sent in their reports! As there are already new CVEs for php5 available, I am afraid I need your support again in July
This month I also had another term of frontdesk work and answered questions or looked for CVEs that are important for Wheezy LTS or could be ignored.
Other stuff
I made some progress with the Alljoyn framework. Up to now the following packages are available:
alljoyn-core-1504
alljoyn-core-1509
alljoyn-core-1604
alljoyn-gateway-1504
alljoyn-services-1504
alljoyn-services-1509
alljoyn-thin-client-1504
alljoyn-thin-client-1509
alljoyn-thin-client-1604
duktape
Unfortunately as some of those modules still need to be released in current versions, there are some gaps.
Anyway, the next uploads will include an XMPP connector, to basically bridge a local AllJoyn bus to a remote AllJoyn bus over XMPP. Further, with the lighting module, real lamps can be switched on and off and much more. Also the Home Appliances and Entertainment Service Framework seems to be interesting as well.
In the Javascript world I uploaded some new packages
node-strip-ansi
node-lodash-compat
node-has-flag
node-errs
node-ejs
node-absolute-path
and uploaded new versions for the following packages:
My monthly report covers a large part of what I have been doing in the free software world. I write it for my donators (thanks to them!) but also for the wider Debian community because it can give ideas to newcomers and it s one of the best ways to find volunteers to work with me on projects that matter to me.
Debian packaging
Django and Python. I uploaded Django 1.9.7 and filed an upstream ticket (#26755) for a failure seen in its DEP-8 tests.
I packaged/sponsored python-django-modeltranslation and python-paypal. I opened a pull request on model-translation to fix failing tests in the Debian package build.
I packaged a new python-django-jsonfield (1.0.0), filed a bug and discovered some regression in its PostgreSQL support. I helped on the upstream ticket and I have been granted commit rights. I used this opportunity to do some bug triage and push a fewfixes. I also discussed the future of the module and ended up starting a discussion on Django s developer list about the possibility to add a JSONField to the core.
CppUTest. I uploaded a new upstream version (3.8) with more than a year of work. I found out that make install does not install a required header so I opened a ticket with a patch. The package ended up not compiling on quite a few architectures so I opened a ticket and prepared a fix for some of those failures with the help of the upstream developers. I also added a DEP-8 tests after having uploaded a broken (untested) package
systemd support in net-snmp and postfix. I worked on adding native systemd service units to net-snmp (#782243) and postfix (#715188). In both cases, the maintainers have not been very reactive so far so I uploaded my changes as delayed NMU.
pkg-security team. The team that I started quietly a few months ago is now growing, both with new members and new packages. I created the required Teams/pkg-security wiki page. I sponsored xprobe, hydra, made an upload of medusa to merge Kali changes into Debian (and at the same time submitting the patch to upstream).
fontconfig. After having read Jonathan McDowell s analysis of a bug that I experienced multiple times (and that many Kali users had too), I opened bug #828037 to get it fixed once for all. Unfortunately, nothing happened yet.
DebConf 16
I spent some time to prepare the 2 talks and the BoF that I will give/manage in Cape Town next week:
Kali Linux s Experience https://debconf16.debconf.org/talks/39/
2 Years of Work of Paid Contributors in the Debian LTS Project https://debconf16.debconf.org/talks/40/
Using Debian Money to Fund Debian Projects https://debconf16.debconf.org/talks/41/
Distro Tracker
I continued to mentor Vladimir Likic who managed to finish his first patch. He is now working on documentation for new contributors based on his recent experience.
I enhanced the tox configuration to run tests with Django 1.8 LTS with fatal warnings (python -Werror) so as to ensure that I m not relying on any deprecated feature and so that I can be sure that the codebase will work on the next Django LTS release (1.11). Thanks to this, I did discover quite a few places where I have been using deprecated API and I fixed them all (the JSONField update to 1.0.0 I mentionned above was precisely to fix such a warning).
I also fixed a fewmoreissues with folded mail headers that you can t inject back in a new Message object and with messages lacking the subject field. All those have been caught through real (spam) email generating exceptions wich are then mailed to me.
Kali related work
I uploaded a new live-boot (5.20160608) to Debian to fix a bug where the boot process was blocking on some timeout.
I forwarded a Kali bug against libatk-wrapper-java (#827741) which turned out to be an OpenJDK bug.
I filed #827749 against reprepro to request a way to remove selected internal file references. This is required if you want to be able to make a file disappear and if that file is part of a snapshot that you want to keep despite this. But in truth, my real need is to be able to replace the .orig.tar.gz used by Kali by the orig.tar.gz used by Debian those conflicts break the mirroring/import script.
Salt
I have been using salt to deploy a new service, and I developed patchesfor a fewissues in salt formulas. I also created a new letsencrypt-sh formula to manage TLS certificates with the letsencrypt.sh ACME client.
Thanks
See you next month for a new summary of my activities.
Support appending arbitrary text in the Compose textarea to the subject via a context menu. (#4)
Avoid brittle parsing of the page and use the Javascript API instead. (diff)
Updated my Strava Enhancement Suite, a Chrome extension that improves and fixes annoyances in the web interface of the Strava cycling and running tracker:
Merge support from Jeff Schuler to support "Flyby" activity defaults. (#50)
Correctly fallback to the default value after introducing a new value. (diff)
Started work on packaging lute-tab, but upstream was unwilling to relicense to a DFSG-friendly license so the enterprise was aborted.
Updated the SSL certificate for try.diffoscope.org, a hosted version of the diffoscope in-depth and content-aware diff utility. Thanks to Bytemark for sponsoring the hardware.
Started on the slides for the Reproducible Builds talk at DebConf16.
This isn't actually answering the question, but it's close. It's also horrible, so whoever adopts
Enrico's script should also
completely rewrite this or burn it along with the stack of pizza boxes and the grand piano.
Input:
In a prior post,
I gave an overview of the OpenStack CI system and how jobs were
started. In that I said
(It is a gross oversimplification, but for the purposes of OpenStack
CI, Jenkins is pretty much used as a glorified ssh/scp wrapper. Zuul
Version 3, under development, is working to remove the need for
Jenkins to be involved at all).
Well some recent security issues with Jenkins and other changes has
led to a roll-out of what is being called Zuul 2.5, which has indeed
removed Jenkins and makes extensive use of Ansible as the basis for
running CI tests in OpenStack. Since I already had the diagram, it
seems worth updating it for the new reality.
OpenStack CI Overview
While previous post was really focused on the image-building
components of the OpenStack CI system, overview is the same but more
focused on the launchers that run the tests.
The process starts when a developer uploads their code to
gerrit via the git-review tool. There is no further action
required on their behalf and the developer simply waits for
results of their jobs.
Gerrit provides a JSON-encoded "fire-hose" output of everything
happening to it. New reviews, votes, updates and more all get sent
out over this pipe. Zuul is the overall scheduler
that subscribes itself to this information and is responsible for
managing the CI jobs appropriate for each change.
Zuul has a configuration
that tells it what jobs to run for what projects. Zuul can do lots
of interesting things, but for the purposes of this discussion we
just consider that it puts the jobs it wants run into gearman
for a launcher to consume. gearman is a
job-server; as they explain it "[gearman] provides a generic
application framework to farm out work to other machines or
processes that are better suited to do the work". Zuul puts into
gearman basically a tuple (job-name,node-type) for each
job it wants run, specifying the unique job name to run and what
type of node it should be run on.
A group of Zuul launchers
are subscribed to gearman as workers. It is these Zuul
launchers that will consume the job requests from the queue and
actually get the tests running. However, a launcher needs two
things to be able to run a job a job definition (what to actually
do) and a worker node (somewhere to do it).
The first part what to do is provided by job-definitions
stored in external YAML files. The Zuul launcher knows how to
process these files (with some help from Jenkins Job Builder, which
despite the name is not outputting XML files for Jenkins to
consume, but is being used to help parse templates and macros
within the generically defined job definitions). Each Zuul
launcher gets these definitions pushed to it constantly by Puppet,
thus each launcher knows about all the jobs it can run
automatically. Of course Zuul also knows about these same job
definitions; this is the job-name part of the tuple we said it
put into gearman.
The second part somewhere to run the test takes some more
explaining. To the next point...
Several cloud companies donate capacity in their clouds for
OpenStack to run CI tests. Overall, this capacity is managed by a
customized management tool called nodepool
(you can see the details of this capacity at any given time by
checking the nodepool configuration).
Nodepool watches the gearman queue and sees what requests are
coming out of Zuul. It looks at node-type of jobs in the queue
(i.e. what platform the job has requested to run on) and decides
what types of nodes need to start and which cloud providers have
capacity to satisfy demand.
Nodepool will start fresh virtual machines (from images built daily
as described in the prior post), monitor their start-up and, when
they're ready, put a new "assignment job" back into gearman with
the details of the fresh node. One of the active Zuul launchers
will pick up this assignment job and register the new node to
itself.
At this point, the Zuul launcher has what it needs to actually get
jobs started. With an fresh node registered to it and waiting for
something to do, the Zuul launcher can advertise its ability to
consume one of the waiting jobs from the gearman queue. For
example, if a ubuntu-trusty node is provided to the Zuul
launcher, the launcher can now consume from gearman any job it
knows about that is intended to run on an ubuntu-trusty node
type. If you're looking at the launcher code
this is driven by the NodeWorker class you can see this being
created in response to an assignment via
LaunchServer.assignNode.
To actually run the job where the "job hits the metal" as it were
the Zuul launcher will dynamically construct an Ansible playbook to run. This
playbook is a concatenation of common setup and teardown operations
along with the actual test scripts the jobs wants to run. Using
Ansible to run the job means all the flexibility an orchestration
tool provides is now available to the launcher. For example, there
is a custom console streamer
library that allows us to live-stream the console output for the
job over a plain TCP connection, and there is the possibility to
use projects like ARA
for visualisation of CI runs. In the future, Ansible will allow
for better coordination when running multiple-node testing jobs
after all, this is what orchestration tools such as Ansible are
made for! While the Ansible run can be fairly heavyweight
(especially when you're talking about launching thousands of jobs
an hour), the system scales horizontally with more launchers able
to consume more work easily.
When checking your job results on logs.openstack.org you will
see a _zuul_ansible directory now which contains copies of the
inventory, playbooks and other related files that the launcher used
to do the test run.
Eventually, the test will finish. The Zuul launcher will put the
result back into gearman, which Zuul will consume (log copying
is interesting but a topic for another day). The testing node will
be released back to nodepool, which destroys it and starts all over
again nodes are not reused and also have no sensitive details on
them, as they are essentially publicly accessible. Zuul will wait
for the results of all jobs for the change and post the result back
to Gerrit; it either gives a positive vote or the dreaded negative
vote if required jobs failed (it also handles merges to git, but
that is also a topic for another day).
Work will continue within OpenStack Infrastructure to further enhance
Zuul; including better support for multi-node jobs and "in-project"
job definitions (similar to the https://travis-ci.org/ model);
for full details see the spec.
This year a significant number of students are working on RTC-related projects as part of Google Summer of Code, under the umbrella of the Debian Project. You may have already encountered some of them blogging on Planet or participating in mailing lists and IRC.
WebRTC plugins for popular CMS and web frameworks
There are already a range of pseudo-WebRTC plugins available for CMS and blogging platforms like WordPress, unfortunately, many of them are either not releasing all their source code, locking users into their own servers or requiring the users to download potentially untrustworthy browser plugins (also without any source code) to use them.
Mesut is making plugins for genuinely free WebRTC with open standards like SIP. He has recently created the WPCall plugin for WordPress, based on the highly successful DruCall plugin for WebRTC in Drupal.
Keerthana has started creating a similar plugin for MediaWiki.
What is great about these plugins is that they don't require any browser plugins and they work with any server-side SIP infrastructure that you choose. Whether you are routing calls into a call center or simply using them on a personal blog, they are quick and convenient to install. Hopefully they will be made available as packages, like the DruCall packages for Debian and Ubuntu, enabling even faster installation with all dependencies.
Would you like to try running these plugins yourself and provide feedback to the students? Would you like to help deploy them for online communities using Drupal, WordPress or MediaWiki to power their web sites? Please come and discuss them with us in the Free-RTC mailing list.
You can read more about how to run your own SIP proxy for WebRTC in the RTC Quick Start Guide.
Finding all the phone numbers and ham radio callsigns in old emails
Do you have phone numbers and other contact details such as ham radio callsigns in old emails? Would you like a quick way to data-mine your inbox to find them and help migrate them to your address book?
Jaminy is working on Python scripts to do just that. Her project takes some inspiration from the Telify plugin for Firefox, which detects phone numbers in web pages and converts them to hyperlinks for click-to-dial. The popular libphonenumber from Google, used to format numbers on Android phones, is being used to help normalize any numbers found. If you would like to test the code against your own mailbox and address book, please make contact in the #debian-data channel on IRC.
A truly peer-to-peer alternative to SIP, XMPP and WebRTC
The team at Savoir Faire Linux has been busy building the Ring softphone, a truly peer-to-peer solution based on the OpenDHT distribution hash table technology.
Several students (Simon, Olivier, Nicolas and Alok) are actively collaborating on this project, some of them have been fortunate enough to participate at SFL's offices in Montreal, Canada. These GSoC projects have also provided a great opportunity to raise Debian's profile in Montreal ahead of DebConf17 next year.
Linux Desktop Telepathy framework and reSIProcate
Another group of students, Mateus, Udit and Balram have been busy working on C++ projects involving the Telepathy framework and the reSIProcate SIP stack. Telepathy is the framework behind popular softphones such as GNOME Empathy that are installed by default on the GNU/Linux desktop.
I previously wrote about starting a new SIP-based connection manager for Telepathy based on reSIProcate. Using reSIProcate means more comprehensive support for all the features of SIP, better NAT traversal, IPv6 support, NAPTR support and TLS support. The combined impact of all these features is much greater connectivity and much greater convenience.
The students are extending that work, completing the buddy list functionality, improving error handling and looking at interaction with XMPP.
Streamlining provisioning of SIP accounts
Currently there is some manual effort for each user to take the SIP account settings from their Internet Telephony Service Provider (ITSP) and transpose these into the account settings required by their softphone.
Pranav has been working to close that gap, creating a JAR that can be embedded in Java softphones such as Jitsi, Lumicall and CSipSimple to automate as much of the provisioning process as possible. ITSPs are encouraged to test this client against their services and will be able to add details specific to their service through Github pull requests.
The project also hopes to provide streamlined provisioning mechanisms for privately operated SIP PBXes, such as the Asterisk and FreeSWITCH servers used in small businesses.
Improving SIP support in Apache Camel and the Jitsi softphone
Apache Camel's SIP component and the widely known Jitsi softphone both use the JAIN SIP library for Java.
Nik has been looking at issues faced by SIP users in both projects, adding support for the MESSAGE method in camel-sip and looking at why users sometimes see multiple password prompts for SIP accounts in Jitsi.
If you are trying either of these projects, you are very welcome to come and discuss them on the mailing lists, Camel users and Jitsi users.
GSoC students at DebConf16 and DebConf17 and other events
Many of us have been lucky to meet GSoC students attending DebConf, FOSDEM and other events in the past. From this year, Google now expects the students to complete GSoC before they become eligible for any travel assistance. Some of the students will still be at DebConf16 next month, assisted by the regular travel budget and the diversity funding initiative. Nik and Mesut were already able to travel to Vienna for the recent MiniDebConf / LinuxWochen.at
As mentioned earlier, several of the students and the mentors at Savoir Faire Linux are based in Montreal, Canada, the destination for DebConf17 next year and it is great to see the momentum already building for an event that promises to be very big.
Explore the world of Free Real-Time Communications (RTC)
If you are interesting in knowing more about the Free RTC topic, you may find the following resources helpful:
Try Lumicall and Ring apps for Android with your freinds
RTC mentoring team 2016
We have been very fortunate to build a large team of mentors around the RTC-themed projects for 2016. Many of them are first time GSoC mentors and/or new to the Debian community. Some have successfully completed GSoC as students in the past. Each of them brings unique experience and leadership in their domain.
Helping GSoC projects in 2016 and beyond
Not everybody wants to commit to being a dedicated mentor for a GSoC student. In fact, there are many ways to help without being a mentor and many benefits of doing so.
Simply looking out for potential applicants for future rounds of GSoC and referring them to the debian-outreach mailing list or an existing mentor helps ensure we can identify talented students early and design projects around their capabilities and interests.
Testing the projects on an ad-hoc basis, greeting the students at DebConf and reading over the student wikis to find out where they are and introduce them to other developers in their area are all possible ways to help the projects succeed and foster long term engagement.
Google gives Debian a USD $500 grant for each student who completes a project successfully this year. If all 2016 students pass, that is over $10,000 to support Debian's mission.
As some of the world knows full well by now, I've been noodling with Go
for a few years, working through its pros, its cons, and thinking a lot
about how humans use code to express thoughts and ideas. Go's got a lot of
neat use cases, suited to particular problems, and used in the right place,
you can see some clear massive wins.
I've started writing Debian tooling in Go, because it's a pretty natural fit.
Go's fairly tight, and overhead shouldn't be taken up by your operating system.
After a while, I wound up hitting the usual blockers, and started to build up
abstractions. They became pretty darn useful, so, this blog post is announcing
(a still incomplete, year old and perhaps API changing) Debian package for Go.
The Go importable name is pault.ag/go/debian. This contains a lot of utilities
for dealing with Debian packages, and will become an edited down "toolbelt"
for working with or on Debian packages.
Module Overview
Currently, the package contains 4 major sub packages. They're a changelog
parser, a control file parser, deb file format parser, dependency parser
and a version parser. Together, these are a set of powerful building blocks
which can be used together to create higher order systems with reliable
understandings of the world.
changelog
The first (and perhaps most incomplete and least tested) is a changelog file
parser.. This provides the
programmer with the ability to pull out the suite being targeted in the
changelog, when each upload was, and the version for each. For example, let's
look at how we can pull when all the uploads of Docker to sid took place:
funcmain()resp,err:=http.Get("http://metadata.ftp-master.debian.org/changelogs/main/d/docker.io/unstable_changelog")iferr!=nilpanic(err)allEntries,err:=changelog.Parse(resp.Body)iferr!=nilpanic(err)for_,entry:=rangeallEntriesfmt.Printf("Version %s was uploaded on %s\n",entry.Version,entry.When)
The output of which looks like:
Version 1.8.3~ds1-2 was uploaded on 2015-11-04 00:09:02 -0800 -0800
Version 1.8.3~ds1-1 was uploaded on 2015-10-29 19:40:51 -0700 -0700
Version 1.8.2~ds1-2 was uploaded on 2015-10-29 07:23:10 -0700 -0700
Version 1.8.2~ds1-1 was uploaded on 2015-10-28 14:21:00 -0700 -0700
Version 1.7.1~dfsg1-1 was uploaded on 2015-08-26 10:13:48 -0700 -0700
Version 1.6.2~dfsg1-2 was uploaded on 2015-07-01 07:45:19 -0600 -0600
Version 1.6.2~dfsg1-1 was uploaded on 2015-05-21 00:47:43 -0600 -0600
Version 1.6.1+dfsg1-2 was uploaded on 2015-05-10 13:02:54 -0400 EDT
Version 1.6.1+dfsg1-1 was uploaded on 2015-05-08 17:57:10 -0600 -0600
Version 1.6.0+dfsg1-1 was uploaded on 2015-05-05 15:10:49 -0600 -0600
Version 1.6.0+dfsg1-1~exp1 was uploaded on 2015-04-16 18:00:21 -0600 -0600
Version 1.6.0~rc7~dfsg1-1~exp1 was uploaded on 2015-04-15 19:35:46 -0600 -0600
Version 1.6.0~rc4~dfsg1-1 was uploaded on 2015-04-06 17:11:33 -0600 -0600
Version 1.5.0~dfsg1-1 was uploaded on 2015-03-10 22:58:49 -0600 -0600
Version 1.3.3~dfsg1-2 was uploaded on 2015-01-03 00:11:47 -0700 -0700
Version 1.3.3~dfsg1-1 was uploaded on 2014-12-18 21:54:12 -0700 -0700
Version 1.3.2~dfsg1-1 was uploaded on 2014-11-24 19:14:28 -0500 EST
Version 1.3.1~dfsg1-2 was uploaded on 2014-11-07 13:11:34 -0700 -0700
Version 1.3.1~dfsg1-1 was uploaded on 2014-11-03 08:26:29 -0700 -0700
Version 1.3.0~dfsg1-1 was uploaded on 2014-10-17 00:56:07 -0600 -0600
Version 1.2.0~dfsg1-2 was uploaded on 2014-10-09 00:08:11 +0000 +0000
Version 1.2.0~dfsg1-1 was uploaded on 2014-09-13 11:43:17 -0600 -0600
Version 1.0.0~dfsg1-1 was uploaded on 2014-06-13 21:04:53 -0400 EDT
Version 0.11.1~dfsg1-1 was uploaded on 2014-05-09 17:30:45 -0400 EDT
Version 0.9.1~dfsg1-2 was uploaded on 2014-04-08 23:19:08 -0400 EDT
Version 0.9.1~dfsg1-1 was uploaded on 2014-04-03 21:38:30 -0400 EDT
Version 0.9.0+dfsg1-1 was uploaded on 2014-03-11 22:24:31 -0400 EDT
Version 0.8.1+dfsg1-1 was uploaded on 2014-02-25 20:56:31 -0500 EST
Version 0.8.0+dfsg1-2 was uploaded on 2014-02-15 17:51:58 -0500 EST
Version 0.8.0+dfsg1-1 was uploaded on 2014-02-10 20:41:10 -0500 EST
Version 0.7.6+dfsg1-1 was uploaded on 2014-01-22 22:50:47 -0500 EST
Version 0.7.1+dfsg1-1 was uploaded on 2014-01-15 20:22:34 -0500 EST
Version 0.6.7+dfsg1-3 was uploaded on 2014-01-09 20:10:20 -0500 EST
Version 0.6.7+dfsg1-2 was uploaded on 2014-01-08 19:14:02 -0500 EST
Version 0.6.7+dfsg1-1 was uploaded on 2014-01-07 21:06:10 -0500 EST
control
Next is one of the most complex, and one of the oldest parts of go-debian,
which is the control file parser
(otherwise sometimes known as deb822). This module was inspired by the way
that the json module works in Go, allowing for files to be defined in code
with a struct. This tends to be a bit more declarative, but also winds up
putting logic into struct tags, which can be a nasty anti-pattern if used too
much.
The first primitive in this module is the concept of a Paragraph, a struct
containing two values, the order of keys seen, and a map of string to string.
All higher order functions dealing with control files will go through this
type, which is a helpful interchange format to be aware of. All parsing of
meaning from the Control file happens when the Paragraph is unpacked into
a struct using reflection.
The idea behind this strategy that you define your struct, and let the Control
parser handle unpacking the data from the IO into your container, letting you
maintain type safety, since you never have to read and cast, the conversion
will handle this, and return an Unmarshaling error in the event of failure.
Additionally, Structs that define an anonymous member of control.Paragraph
will have the raw Paragraph struct of the underlying file, allowing the
programmer to handle dynamic tags (such as X-Foo), or at least, letting
them survive the round-trip through go.
The default decoder
contains an argument, the ability to verify the input control file using an
OpenPGP keyring, which is exposed to the programmer through the
(*Decoder).Signer() function. If the passed argument is nil, it will not
check the input file signature (at all!), and if it has been passed, any
signed data must be found or an error will fall out of the NewDecoder call.
On the way out, the opposite happens, where the struct is introspected,
turned into a control.Paragraph, and then written out to the io.Writer.
Here's a quick (and VERY dirty) example showing the basics of reading and
writing Debian Control files with go-debian.
packagemainimport("fmt""io""net/http""strings""pault.ag/go/debian/control")typeAllowedPackagestructPackagestringFingerprintstringfunc(a*AllowedPackage)UnmarshalControl(instring)errorin=strings.TrimSpace(in)chunks:=strings.SplitN(in," ",2)iflen(chunks)!=2returnfmt.Errorf("Syntax sucks: '%s'",in)a.Package=chunks[0]a.Fingerprint=chunks[1][1:len(chunks[1])-1]returnniltypeDMUAstructFingerprintstringUidstringAllowedPackages[]AllowedPackage control:"Allow" delim:"," funcmain()resp,err:=http.Get("http://metadata.ftp-master.debian.org/dm.txt")iferr!=nilpanic(err)decoder,err:=control.NewDecoder(resp.Body,nil)iferr!=nilpanic(err)fordmua:=DMUAiferr:=decoder.Decode(&dmua);err!=niliferr==io.EOFbreakpanic(err)fmt.Printf("The DM %s is allowed to upload:\n",dmua.Uid)for_,allowedPackage:=rangedmua.AllowedPackagesfmt.Printf(" %s [granted by %s]\n",allowedPackage.Package,allowedPackage.Fingerprint)
Output (truncated!) looks a bit like:
...
The DM Allison Randal <allison@lohutok.net> is allowed to upload:
parrot [granted by A4F455C3414B10563FCC9244AFA51BD6CDE573CB]
...
The DM Benjamin Barenblat <bbaren@mit.edu> is allowed to upload:
boogie [granted by 3224C4469D7DF8F3D6F41A02BBC756DDBE595F6B]
dafny [granted by 3224C4469D7DF8F3D6F41A02BBC756DDBE595F6B]
transmission-remote-gtk [granted by 3224C4469D7DF8F3D6F41A02BBC756DDBE595F6B]
urweb [granted by 3224C4469D7DF8F3D6F41A02BBC756DDBE595F6B]
...
The DM <aelmahmoudy@sabily.org> is allowed to upload:
covered [granted by 41352A3B4726ACC590940097F0A98A4C4CD6E3D2]
dico [granted by 6ADD5093AC6D1072C9129000B1CCD97290267086]
drawtiming [granted by 41352A3B4726ACC590940097F0A98A4C4CD6E3D2]
fonts-hosny-amiri [granted by BD838A2BAAF9E3408BD9646833BE1A0A8C2ED8FF]
...
...
deb
Next up, we've got the deb module. This contains code to handle reading
Debian 2.0 .deb files. It contains a wrapper that will parse the control
member, and provide the data member through the
archive/tar interface.
Here's an example of how to read a .deb file, access some metadata, and
iterate over the tar archive, and print the filenames of each of the
entries.
dependency
The dependency package provides an interface to parse and compute
dependencies. This package is a bit odd in that, well, there's no other
library that does this. The issue is that there are actually two different
parsers that compute our Dependency lines, one in Perl (as part of dpkg-dev)
and another in C (in dpkg).
To date, this has resulted in me filing
threedifferentbugs.
I also found a broken package in the
archive,
which actually resulted in another bug being (totally accidentally)
already fixed.
I hope to continue to run the archive through my parser in hopes of finding
more bugs! This package is a bit complex, but it basically just returns what
amounts to be an AST
for our Dependency lines. I'm positive there are bugs, so file them!
funcmain()dep,err:=dependency.Parse("foo bar, baz, foobar [amd64] bazfoo [!sparc], fnord:armhf [gnu-linux-sparc]")iferr!=nilpanic(err)anySparc,err:=dependency.ParseArch("sparc")iferr!=nilpanic(err)for_,possi:=rangedep.GetPossibilities(*anySparc)fmt.Printf("%s (%s)\n",possi.Name,possi.Arch)
Gives the output:
foo (<nil>)
baz (<nil>)
fnord (armhf)
version
Right off the bat, I'd like to thank
Michael Stapelberg for letting me graft this
out of dcs and into the go-debian package.
This was nearly entirely his work (with a one or two line function I added
later), and was amazingly helpful to have. Thank you!
This module implements Debian version comparisons and parsing, allowing for
sorting in lists, checking to see if it's native or not, and letting the
programmer to implement smart(er!) logic based on upstream (or Debian)
version numbers.
This module is extremely easy to use and very straightforward, and not worth
writing an example for.
Final thoughts
This is more of a "Yeah, OK, this has been useful enough to me at this point
that I'm going to support this" rather than a "It's stable!" or even
"It's alive!" post. Hopefully folks can report bugs and help iterate on
this module until we have some really clean building blocks to build
solid higher level systems on top of. Being able to have multiple libraries
interoperate by relying on go-debian will be a massive ease.
I'm in need of more documentation, and to finalize some parts of the older
sub package APIs, but I'm hoping to be at a "1.0" real soon now.
I should probably document the purple server I hacked together in Perl and mentioned in my last post. In short it allows you to centralise notifications. Send "alerts" to it, and when they are triggered they will be routed from that central location. There is only a primitive notifier included, which sends data to the console, but there are sample stubs for sending by email/pushover, and escalation.
In brief you create alerts by sending a JSON object via HTTP-POST. These objects contain a bunch of fields, but the two most important are:
id
A human-name for the alert. e.g. "disk-space", "heartbeat", or "unread-mail".
raise
When to raise the alert. e.g. "now", "+5m", "1466006086".
When an update is received any existing alert has its values updated, which
makes heartbeat alerts trivial. Send a message with:
"id": "heartbeat",
"raise": "+5m",
..
The existing alert will be updated each time such a new event is submitted,
which means that the time at which that alert will raise will be pushed back
by five minutes. If you send this every 60 seconds then you'll get informed
of an outage five minutes after your server explodes (because the "+5m"
will have been turned into an absolute time, and that time will eventually
become in the past - triggering a notification).
Alerts are keyed on the source IP which sent the submission and
the id field, meaning you can send the same update from multiple
hosts without causing any problems.
Notifications can be viewed in a reasonably pretty Web UI, so you can
clear raised-alerts, see the pending ones, and suppress further notifications
on something that has been raised. (By default notifications are issued
every sixty seconds, until the alert is cleared. There is support for
only raising an alert once, which is useful for services you might deliver
events via, such as pushover which will repeat themselves.)
Anyway this is a fun project, which is a significantly simplified and
less scalable version of a project which is open-sourced already and
used at Bytemark.
Back in 2014, Mako ran a Boston Iron Blogger chapter, where you had to blog once a week, or you owed $5 into the pot. A while later, I ran it (along with Molly and Johns), and things were great.
When I moved to DC, I had already talked with Tom Lee and Eric Mill about running a DC Iron Blogger chapter, but it hasn t happened in the year and a half I ve been in DC.
This week, I make good on that, with a fantastic group set up at dc.iron-blogger.com; with more to come (I m sure!).
Looking forward to many parties and though provoking blog posts in my future. I m also quite pleased I ll be resuming my blogging. Hi, again, planet Debian!
The wiki page TimestampsProposal has been extended to cover more usage examples and to list more softwares supporting SOURCE_DATE_EPOCH. (Axel Beckert, Dhole and Ximin Luo)
h01ger started a reference card for tools and information about reproducible builds but hasn't progressed much yet. Help with it is much welcome, this is also a good opportunity to learn about this project The idea is simply to have one coherent place with pointers to all the stuff we have and provide, without repeating nor replacing other documentation.
Toolchain fixes
Alexis Bienven e submitted a patch (#824050) against emacs24 for SOURCE_DATE_EPOCH support in autoloads files, but upstream already disabled timestamps by default some time before.
proj/4.9.2-3 uploaded by Bas Couwenberg (original patch by Alexis Bienven ) properly initializes memory with zero to prevent the nad2bin tool from leaking random memory content into output artefacts.
Reiner Herrmann submitted a patch (#825569, upstream) against Ruby to sort object files in generated Makefiles, which are used to compile C sources that are part of Ruby projects.
The kde pkg set was extended, though the change ain't visible yet, as there are currently non-installable packages in it (and so the set can't be computed). (h01ger)
Misc.
Mattia improved misc.git/reports (=the tools to help writing the weekly statistics for this blog) some more.
This week's edition was written by Reiner Herrmann and Holger Levsen and reviewed by a bunch of Reproducible builds folks on IRC.
What happened in the Reproducible Builds effort between May 8th and May 14th 2016:
Documentation updates
Ximin Luo spent some work on improving and updating our documentation:
updated the SOURCE_DATE_EPOCH adoption page at wiki.debian.org/ReproducibleBuilds/TimestampsProposal with a compilation of our reasonings versus common arguments encountered with package maintainers and upstream developers.
#824049 against emacs24 by Alexis Bienven e: make start value of gensym-counter reproducible
#824050 against emacs24 by Alexis Bienven e: make autoloads files reproducible
#824182 against codeblocks by Fabian Wolff: honour SOURCE_DATE_EPOCH
#824263 against cmake by Reiner Herrmann: sort file lists from file(GLOB ...)
Package reviews
344 reviews have been added, 125 have been updated and 20 have been removed in this week.
14 FTBFS bugs have been reported by Chris Lamb.
tests.reproducible-builds.org
bpi0 has been reinstalled with a new ssd. (vagrant/h01ger)
Misc.
Dan Kegel sent a mail to report about his experiments with a reproducible dpkg PPA for Ubuntu. According to him sudo add-apt-repository ppa:dank/dpkg && sudo apt-get update && sudo apt-get install dpkg should be enough to get reproducible builds on Ubuntu 16.04.
This week's edition was written by Ximin Luo and Holger Levsen and reviewed by a bunch of Reproducible builds folks on IRC.
For the last few months, it seems that my posts haven't been reaching
the Planet Debian aggregator correctly. I timed the last two posts
and they both arrived roughly 10 days late in the feed.
SNI issues
At first, I suspected I was a victim of the
SNI bug in Planet Venus: since it is still running in Python 2.7
and uses httplib2 (as opposed to, say, Requests), it has
trouble with sites running under SNI. In January, there were 9
blogs with that problem on Planet. When this was
discussed elsewhere in February, there were now 18, and then 21
reported in March. With everyone enabling (like me) Let's Encrypt
on their website, this number is bound to grow.
I was able to reproduce the Debian Planet setup locally to do further
tests and ended up sending two (unrelated) patches to the Debian
bug tracker against Planet Venus, the software running Debian
planet. In my local tests, I found 22 hosts with SNI
problems. I also posted some pointers on how the code could be ported
over to the more modern Requests and Cachecontrol modules.
Expiry issues
However, some of those feeds were working fine on philp, the
host I found was running as the Planet Master. Even more strange, my
own website was working fine!
Now that was strange: why was my feed fetched, but noted as unchanged?
For that, I found that there was a FAQ question buried down in the
PlanetDebian wikipage which explicitly said that Planet obeys
Expires headers diligently and will not get new content again if the
headers say they did. Skeptical, I looked my own headers and, ta-da!
they were way off:
So I lowered the expires timeout on my RSS feeds to 3 hours:
root@marcos:/etc/apache2# git diff
diff --git a/apache2/conf-available/expires.conf b/apache2/conf-available/expires.conf
index 214f3dd..a983738 100644
--- a/apache2/conf-available/expires.conf
+++ b/apache2/conf-available/expires.conf
@@ -3,8 +3,18 @@
# Enable expirations.
ExpiresActive On
- # Cache all files for 2 weeks after access (A).
- ExpiresDefault A1209600
+ # Cache all files 12 hours after access
+ ExpiresDefault "access plus 12 hours"
+
+ # RSS feeds should refresh more often
+ <FilesMatch \.(rss)$>
+ ExpiresDefault "modification plus 4 hours"
+ </FilesMatch>
+
+ # images are *less* likely to change
+ <FilesMatch "\.(gif jpg png js css)$">
+ ExpiresDefault "access plus 1 month"
+ </FilesMatch>
<FilesMatch \.(php cgi)$>
# Do not allow scripts to be cached unless they explicitly send cache
I also lowered the general cache expiry, except for images, Javascript
and CSS.
Planet Venus maintenance
A small last word about all this: I'm surprised to see that Planet
Debian is running a 6 year old software that hasn't seen a single
official release yet, with local patches on top. It seems that Venus
is well designed, I must give them that, but it's a little worrisome
to see great software just rotting around like this.
A good "planet" site seems like a resource a lot of FLOSS communities
would need: is there another "Planet-like" aggregator out there that
is well maintained and more reliable? In Python, preferably.
PlanetPlanet, which Venus was forked from, is out of the question:
it is even less maintained than the new fork, which itself seems to
have died in 2011.
There is a discussion about the state of Venus on Github which
reflects some of the concerns expressed here, as well as
on the mailing list. The general consensus seems to be that
everyone should switch over to Planet Pluto, which is written in
Ruby.
I am not sure which planet Debian sits on - Pluto? Venus? Besides,
Pluto is not even a planet anymore...
Mike check!
So this is also a test to see if my posts reach Debian Planet
correctly. I suspect no one will ever see this on the top of their
feeds, since the posts do get there, but with a 10 days delay and
with the original date, so they are "sunk" down. The above expiration
fixes won't take effect until the 10 days delay is over... But if you
did see this as noise, retroactive apologies in advance for the
trouble.
If you are reading this from somewhere else and wish to say hi, don't
hesitate, it's always nice to hear from my readers.
In the ARM world, to which I am still mostly a newcomer (although I've been already playing with ARM machines for over two years, I am a complete newbie compared to my Debian friends who live and breathe that architecture), the most common way to distribute operating systems is to distribute complete, already-installed images. I have ranted in the past on how those images ought to be distributed.
Some time later, I also discussed on my blog on how most of this hardware requires unauditable binary blobs and other non-upstreamed modifications to Linux.
In the meanwhile, I started teaching on the Embedded Linux diploma course in Facultad de Ingenier a, UNAM. It has been quite successful And fun.
Anyway, one of the points we make emphasis on to our students is that the very concept of embedded makes the mere idea of downloading a pre-built, 4GB image, loaded with a (supposedly lightweight, but far fatter than my usual) desktop environment and whatnot an irony.
As part of the "Linux Userspace" and "Boot process" modules, we make a lot of emphasis on how to build a minimal image. And even leaving installed size aside, it all boils down to trust. We teach mainly four different ways of setting up a system:
Using our trusty Debian Installer in the (unfortunately few) devices where it is supported
Installing via Debootstrap, as I did in my CuBox-i tutorial (note that the tutorial is nowadays obsolete. The CuBox-i can boot with Debian Installer!) and just keeping the boot partition (both for u-boot and for the kernel) of the vendor-provided install
Building a barebones system using the great Buildroot set of scripts and hacks
Downloading a full, but minimal, installed image, such as OpenWRT (I have yet to see what's there about its fork, LEDE)
Now... In the past few days, a huge vulnerability / oversight was discovered and made public, supporting my distrust of distribution forms that do not come from, well... The people we already know and trust to do this kind of work!
Most current ARM chips cannot run with the stock, upstream Linux kernel. Then require a set of patches that different vendors pile up to support their basic hardware (remember those systems are almost always systems-on-a-chip (SoC)). Some vendors do take the hard work to try to upstream their changes that is, push the changes they did to the kernel for inclusion in mainstream Linux. This is a very hard task, and many vendors just abandon it.
So, in many cases, we are stuck running with nonstandard kernels, full with huge modifications... And we trust them to do things right. After all, if they are knowledgeable enough to design a SoC, they should do at least decent kernel work, right?
Turns out, it's far from the case. I have a very nice and nifty Banana Pi M3, based on the Allwinner A83T SoC. 2GB RAM, 8 ARM cores... A very nice little system, almost usable as a desktop. But it only boots with their modified 3.4.x kernel.
This kernel has a very ugly flaw: A debugging mode left open, that allows any local user to become root. Even on a mostly-clean Debian system, installed by a chrooted debootstrap:
Why? Oh, well, in this kernel somebody forgot to comment out (or outright remove!) the sunxi-debug.c file, or at the very least, a horrid part of code therein (it's a very small, simple file):
if(!strncmp("rootmydevice",(char*)buf,12))
cred =(struct cred *)__task_cred(current);
cred->uid =0;
cred->gid =0;
cred->suid =0;
cred->euid =0;
cred->euid =0;
cred->egid =0;
cred->fsuid =0;
cred->fsgid =0;
printk("now you are root\n");
Now... Just by looking at this file, many things should be obvious. For example, this is not only dangerous and lazy (it exists so developers can debug by touching a file instead of... typing a password?), but also goes against the kernel coding guidelines the file is not documented nor commented at all. Peeking around other files in the repository, it gets obvious that many files lack from this same basic issue and having this upstreamed will become a titanic task. If their programmers tried to adhere to the guidelines to begin with, integration would be a much easier path. Cutting the wrong corners will just increase the needed amount of work.
Anyway, enough said by me. Some other sources of information:
Commit fixing it on the SinoVoip repository Of course, the fun part will be delivering it to users. If affected machines are effectively running as embedded systems of any sort... good luck with it! :-P
There are surely many other mentions of this. I just had to repeat it for my local echo chamber, and for future reference in class! ;-)
While the creation of Debian packages is abundantlydocumented, most tutorials are targeted to
packages implementing the Debian policy. Moreover, Debian
packaging has a reputation of being unnecessarily
difficult1 and many people prefer to use less
constrained tools2 like fpm or CheckInstall.
However, I would like to show how building Debian packages with the
official tools can become straightforward if you bend some rules:
No source package will be generated. Packages will be built
directly from a checkout of a VCS repository.
Additional dependencies can be downloaded during
build. Packaging individually each dependency is a painstaking
work, notably when you have to deal with some fast-paced
ecosystems like Java, Javascript and Go.
The produced packages may bundle dependencies. This is likely
to raise some concerns about security and long-term maintenance,
but this is a common trade-off in many ecosystems, notably Java,
Javascript and Go.
Pragmatic packages 101
In the Debian archive, you have two kinds of packages: the source
packages and the binary packages. Each binary package is built
from a source package. You need a name for each package.
As stated in the introduction, we won t generate a source package but
we will work with its unpacked form which is any source tree
containing a debian/ directory. In our examples, we will start with
a source tree containing only a debian/ directory but you are free
to include this debian/ directory into an existing project.
As an example, we will package memcached, a distributed memory
cache. There are four files to create:
The only important information is the name of the source package,
memcached, on the first line. Everything else can be left as is as
it won t influence the generated binary packages.
The control filedebian/control describes the metadata of both the source package and
the generated binary packages. We have to write a block for each of them.
Source: memcachedMaintainer: Vincent Bernat <bernat@debian.org>Package: memcachedArchitecture: anyDescription: high-performance memory object caching system
The source package is called memcached. We have to use the same name
as in debian/changelog.
We generate only one binary package: memcached. In the remaining of
the example, when you see memcached, this is the name of a binary
package. The Architecture field should be set to either any or
all. Use all exclusively if the package contains only
arch-independent files. In doubt, just stick to any.
The Description field contains a short description of the binary package.
The build recipe
The last mandatory file is debian/rules. It s the recipe of the
package. We need to retrieve memcached, build it and install its
file tree in debian/memcached/. It looks like this:
#!/usr/bin/make -fDISTRIBUTION=$(shell lsb_release -sr)VERSION= 1.4.25
PACKAGEVERSION=$(VERSION)-0~$(DISTRIBUTION)0
TARBALL= memcached-$(VERSION).tar.gz
URL= http://www.memcached.org/files/$(TARBALL)%:
dh $@override_dh_auto_clean:override_dh_auto_test:override_dh_auto_build:override_dh_auto_install:
wget -N --progress=dot:mega $(URL)
tar --strip-components=1 -xf $(TARBALL)
./configure --prefix=/usr
make
make install DESTDIR=debian/memcached
override_dh_gencontrol:
dh_gencontrol -- -v$(PACKAGEVERSION)
The empty targets override_dh_auto_clean, override_dh_auto_test
and override_dh_auto_build keep debhelper from being too
smart. The override_dh_gencontrol target sets the package
version3 without updating debian/changelog. If you ignore
the slight boilerplate, the recipe is quite similar to what you would
have done with fpm:
DISTRIBUTION=$(lsb_release -sr)VERSION=1.4.25
PACKAGEVERSION=$ VERSION-0~$ DISTRIBUTION0
TARBALL=memcached-$ VERSION.tar.gz
URL=http://www.memcached.org/files/$ TARBALL
wget -N --progress=dot:mega $ URL
tar --strip-components=1 -xf $ TARBALL
./configure --prefix=/usr
make
make install DESTDIR=/tmp/installdir
# Build the final package
fpm -s dir -t deb \
-n memcached \
-v $ PACKAGEVERSION\
-C /tmp/installdir \
--description "high-performance memory object caching system"
You can review the whole package tree on GitHub
and build it with dpkg-buildpackage -us -uc -b.
Pragmatic packages 102
At this point, we can iterate and add several improvements to our
memcached package. None of those are mandatory but they are
usually worth the additional effort.
Build dependencies
Our initial build recipe only work when several packages are
installed, like wget and libevent-dev. They are not present on all
Debian systems. You can easily express that you need them by adding a
Build-Depends section for the source package in debian/control:
Always specify the debhelper (>= 9) dependency as we heavily rely on
it. We don t require make or a C compiler because it is assumed that
the build-essential meta-package is installed and it pulls
those. dpkg-buildpackage will complain if the dependencies are not
met. If you want to install those packages from your CI system, you
can use the following command4:
You may also want to investigate pbuilder or sbuild, two tools
to build Debian packages in a clean isolated environment.
Runtime dependencies
If the resulting package is installed on a freshly installed machine,
it won t work because it will be missing libevent, a required
library for memcached. You can express the dependencies needed by
each binary package by adding a Depends field. Moreover, for dynamic
libraries, you can automatically get the right dependencies by using
some substitution variables:
Integration with init system
Most packaged daemons come with some integration with the init
system. This integration ensures the daemon will be started on boot
and restarted on upgrade. For Debian-based distributions, there are
several init systems available. The most prominent ones are:
System-V init is the historical init system. More modern
inits are able to reuse scripts written for this init, so this is a
safe common denominator for packaged daemons.
Upstart is the less-historical init system for Ubuntu (used in
Ubuntu 14.10 and previous releases).
systemd is the default init system for Debian since Jessie and
for Ubuntu since 15.04.
Writing a correct script for the System-V init is
error-prone. Therefore, I usually prefer to provide a native
configuration file for the default init system of the targeted
distribution (Upstart and systemd).
System-V
If you want to provide a System-V init script, have a look at
/etc/init.d/skeleton on the most ancient distribution you want to
target and adapt it5. Put the result in
debian/memcached.init. It will be installed at the right place,
invoked on install, upgrade and removal. On Debian-based systems, many
init scripts allow user customizations by providing a
/etc/default/memcached file. You can ship one by putting its content
in debian/memcached.default.
Upstart
Providing an Upstart job is similar: put it in
debian/memcached.upstart. For example:
When writing an Upstart job, the most important directive is
expect. Be sure to get it right. Here, we use expect daemon and
memcached is started with the -d flag.
systemd
Providing a systemd unit is a bit more complex. The content of the
file should go in debian/memcached.service. For example:
We reuse /etc/default/memcached even if it is not considered a good
practice with systemd6. Like for Upstart, the directive
Type is quite important. We used forking as memcached is started
with the -d flag.
You also need to add a build-dependency to dh-systemd in
debian/control:
And you need to modify the default rule in debian/rules:
%:
dh $@ --with systemd
The extra complexity is a bit unfortunate but systemd integration
is not part of debhelper7. Without those additional modifications,
the unit will get installed but you won t get a proper integration and
the service won t be enabled on install or boot.
Dedicated user
Many daemons don t need to run as root and it is a good practice to
ship a dedicated user. In the case of memcached, we can provide a
_memcached user8.
Add a debian/memcached.postinst file with the following content:
The #DEBHELPER# marker is important as it will be replaced by some
code to handle the service configuration files (or some other stuff).
You can review the whole package tree on
GitHub and build it with
dpkg-buildpackage -us -uc -b.
Pragmatic packages 103
It is possible to leverage debhelper to reduce the recipe size
and to make it more declarative. This section is quite optional
and it requires understanding a bit more how a Debian package is
built. Feel free to skip it.
The big picture
There are four steps to build a regular Debian package:
debian/rules clean should clean the source tree to make it pristine.
debian/rules build should trigger the build. For an
autoconf-based software, like memcached, this step should
execute something like ./configure && make.
debian/rules install should install the file tree of each
binary package. For an autoconf-based software, this step should
execute make install DESTDIR=debian/memcached.
debian/rules binary will pack the different file trees into
binary packages.
You don t directly write each of those targets. Instead, you let dh,
a component of debhelper, do most of the work. The following
debian/rules file should do almost everything correctly with many
source packages:
#!/usr/bin/make -f%:
dh $@
For each of the four targets described above, you can run dh
with --no-act to see what it would do. For example:
Each of those helpers has a manual page. Helpers starting with
dh_auto_ are a bit magic . For example, dh_auto_configure will
try to automatically configure a package prior to building: it will
detect the build system and invoke ./configure, cmake or
Makefile.PL.
If one of the helpers do not do the right thing, you can replace it
by using an override target:
This way, ./configure will be called with your custom flag but also
with a lot of default flags like --prefix=/usr for better integration.
In the initial memcached example, we overrode all those magic
targets. dh_auto_clean, dh_auto_configure and dh_auto_build are
converted to no-ops to avoid any unexpected
behaviour. dh_auto_install is hijacked to do all the build
process. Additionally, we modified the behavior of the dh_gencontrol
helper by forcing the version number instead of using the one from
debian/changelog.
Automatic builds
As memcached is an autoconf-enabled package, dh knows how
to build it: ./configure && make && make install. Therefore, we
can let it handle most of the work with this debian/rules file:
#!/usr/bin/make -fDISTRIBUTION=$(shell lsb_release -sr)VERSION= 1.4.25
PACKAGEVERSION=$(VERSION)-0~$(DISTRIBUTION)0
TARBALL= memcached-$(VERSION).tar.gz
URL= http://www.memcached.org/files/$(TARBALL)%:
dh $@ --with systemd
override_dh_auto_clean:
wget -N --progress=dot:mega $(URL)
tar --strip-components=1 -xf $(TARBALL)override_dh_auto_test: # Don't run the whitespace test
rm t/whitespace.t
dh_auto_test
override_dh_gencontrol:
dh_gencontrol -- -v$(PACKAGEVERSION)
The dh_auto_clean target is hijacked to download and setup the
source tree9. We don t override the dh_auto_configure step,
so dh will execute the ./configure script with the appropriate
options. We don t override the dh_auto_build step either: dh will
execute make. dh_auto_test is invoked after the build and it will
run the memcached test suite. We need to override it because one of
the test is complaining about odd whitespaces in the debian/
directory. We suppress this rogue test and let dh_auto_test executes
the test suite. dh_auto_install is not overriden either, so dh
will execute some variant of make install.
To get a better sense of the difference, here is a diff:
--- memcached-intermediate/debian/rules 2016-04-30 14:02:37.425593362 +0200+++ memcached/debian/rules 2016-05-01 14:55:15.815063835 +0200@@ -12,10 +12,9 @@
override_dh_auto_clean:
-override_dh_auto_test:-override_dh_auto_build:-override_dh_auto_install:
wget -N --progress=dot:mega $(URL)
tar --strip-components=1 -xf $(TARBALL)
- ./configure --prefix=/usr- make- make install DESTDIR=debian/memcached++override_dh_auto_test:+ # Don't run the whitespace test+ rm t/whitespace.t+ dh_auto_test
It is up to you to decide if dh can do some work for you, but
you could try to start from a minimal debian/rules and only override
some targets.
Install additional files
While make install installed the essential files for memcached,
you may want to put additional files in the binary package. You
could use cp in your build recipe, but you can also declare them:
files listed in debian/memcached.docs will be copied to
/usr/share/doc/memcached by dh_installdocs,
files listed in debian/memcached.examples will be copied to
/usr/share/doc/memcached/examples by dh_installexamples,
files listed in debian/memcached.manpages will be copied to the
appropriate subdirectory of /usr/share/man by dh_installman,
Here is an example using wildcards for debian/memcached.docs:
doc/*.txt
If you need to copy some files to an arbitrary location, you can list
them along with their destination directories in
debian/memcached.install and dh_install will take care of the
copy. Here is an example:
scripts/memcached-tool usr/bin
Using those files make the build process more declarative. It is a
matter of taste and you are free to use cp in debian/rules
instead. You can review the whole package tree on
GitHub.
Other examples
The GitHub repository contains some additional
examples. They all follow the same scheme:
dh_auto_clean is hijacked to download and setup the source tree
dh_gencontrol is modified to use a computed version
Notably, you ll find daemons in Java, Go, Python and
Node.js. The goal of those examples is to demonstrate that using
Debian tools to build Debian packages can be straightforward. Hope
this helps.
People may remember the time before debhelper 7.0.50
(circa 2009) where debian/rules was a daunting
beast. However, nowaday, the boilerplate is quite
reduced.
The complexity is not the only reason. Those alternative tools
enable the creation of RPM packages, something that Debian
tools obviously don t.
There are many ways to version a package. Again, if you
want to be pragmatic, the proposed solution should be good
enough for Ubuntu. On Debian, it doesn t cover upgrade
from one distribution version to another, but we assume
that nowadays, systems get reinstalled instead of being
upgraded.
You also need to install devscripts and equivs package.
It s also possible to use a script provided by
upstream. However, there is no such thing as an init
script that works on all distributions. Compare the
proposed with the skeleton, check if it is using
start-stop-daemon and if it sources
/lib/lsb/init-functions before considering it. If it
seems to fit, you can install it yourself in
debian/memcached/etc/init.d/. debhelper will ensure
its proper integration.
Instead, a user wanting to customize the options is
expected to edit the unit with systemctl edit.
The Debian Policy doesn t provide any hint for the naming
convention of those system users. A common usage is to
prefix the daemon name with an underscore (like
_memcached). Another common usage is to use Debian- as
a prefix. The main drawback of the latest solution is that
the name is likely to be replaced by the UID in ps and
top because of its length.
We could call dh_auto_clean at the end of the target to
let it invoke make clean. However, it is assumed that a
fresh checkout is used before each build.
Corrected a subtle bug in my django-staticfiles-dotd "staticfiles" library where the Content-Length HTTP header was calculated incorrectly in the presence of Unicode characters resulting in truncated output. (#2)
Various fixes to django-slack, a library to easily post messages to the Slack group-messaging utility from projects using the Django web development framework:
Don't require an explicit backend import when using the Celery task queue backend. (#41)
Actually generate and send messages asynchronously when using the Celery backend. (#44)
Fixed an issue with my local-debian-mirror tool where the option to disable DEP-11 mirroring wasn't working. (#1)
Fixed an issue in django-hipchat, a library to easily post messages to the Hipchat group-messaging utility from projects using the Django web development framework where the templates were not includes when installing via PyPI. (#1)
Created a quick-and-dirty tool to scrape a Squarespace blog and convert it to a PDF so I can read them on my Kindle e-reader. (tree)
Updated django-keyerror a library to post exceptions to the KeyError.com error tracking service to silence an AttributeError exception in some error-reporting edge-cases. (commit)
Suggested an improvement to the documentation for the upcoming Twitter Bootstrap version for the deprecated .hidden and .show CSS classes. (#19789)
Submitted a documentation update to the Ansible sever configuration tool's ufw firewall module. (commit)
On any given server, or workstation, knowing what is at the other end
of the network cable is often very useful.
There s a protocol for that: LLDP. This is a link layer protocol, so
it is not routed. Each end transmits information about itself
periodically.
You can typically see the type of equipment, the server or switch
name, and the network port name of the other end, although there are
lots of other bits of information available, too.
This is often used between switches and routers in a server centre,
but it is useful to enable on server hardware as well.
There are a few different packages available. I ve looked at a few of
them available for the RedHat OS family (Red Hat Enterprise Linux,
CentOS, ) as well as the Debian OS family (Debian, Ubuntu, )
(Updated 2016-04-29, added more recent information about lldpd, and
gathered the switch output at the end.)
ladvd
A simple daemon, with no configuration needed. This runs as a
privilege-separated daemon, and has a command line control
utility. You invoke it with a list of interfaces as command line
arguments to restrict the interfaces it should use.
ladvd is not available on RedHat, but is available on Debian.
Install the ladvd package, and run ladvdc to query the daemon for
information.
root@turbotape:~# ladvdc
Capability Codes:
r - Repeater, B - Bridge, H - Host, R - Router, S - Switch,
W - WLAN Access Point, C - DOCSIS Device, T - Telephone, O - Other
Device ID Local Intf Proto Hold-time Capability Port ID
office1-switch23 eno1 LLDP 98 B 42
Even better, it has output that can be parsed for scripting:
lldpd
Another package is lldpd , which is also simple to configure and
use.
lldpd is not available on RedHat, but it is present on Debian.
It features a command line interface, lldpcli , which can show output
with different level of detail, and on different formats, as well as
configure the running daemon.
root@turbotape:~# lldpcli show neighbors
-------------------------------------------------------------------------------
LLDP neighbors:
-------------------------------------------------------------------------------
Interface: eno1, via: LLDP, RID: 1, Time: 0 day, 00:00:59
Chassis:
ChassisID: mac 00:11:22:33:44:55
SysName: office1-switch23
SysDescr: ProCurve J9280A Switch 2510G-48, revision Y.11.12, ROM N.10.02 (/sw/code/build/cod(cod11))
Capability: Bridge, on
Port:
PortID: local 42
PortDescr: 42
-------------------------------------------------------------------------------
Among the output formats are json , which is easy to re-use elsewhere.
lldpad
A much more featureful LLDP daemon, available for both the Debian and
RedHat OS families. This has lots of features, but is less trivial to
set up.
Configure lldp for each interface
#!/bin/sh
find /sys/class/net/ -maxdepth 1 -name 'en*'whileread device;do
basename "$device"donewhileread interface;do
lldptool set-lldp -i "$interface"adminStatus=rxtx
for item in sysName portDesc sysDesc sysCap mngAddr;do
lldptool set-tlv -i "$interface" -V "$item"enableTx=yes
sed -e "s/^/$item /"done
sed -e "s/^/$interface /"done
[...]
enp3s0f0
Chassis ID TLV
MAC: 01:23:45:67:89:ab
Port ID TLV
Local: 588
Time to Live TLV
120
System Name TLV
site3-row2-rack1
System Description TLV
Juniper Networks, Inc. ex2200-48t-4g , version 12.3R12.4 Build date: 2016-01-20 05:03:06 UTC
System Capabilities TLV
System capabilities: Bridge, Router
Enabled capabilities: Bridge, Router
Management Address TLV
IPv4: 10.21.0.40
Ifindex: 36
OID: $
Port Description TLV
some important server, port 4
MAC/PHY Configuration Status TLV
Auto-negotiation supported and enabled
PMD auto-negotiation capabilities: 0x0001
MAU type: Unknown [0x0000]
Link Aggregation TLV
Aggregation capable
Currently aggregated
Aggregated Port ID: 600
Maximum Frame Size TLV
9216
Port VLAN ID TLV
PVID: 2000
VLAN Name TLV
VID 2000: Name bumblebee
VLAN Name TLV
VID 2001: Name stumblebee
VLAN Name TLV
VID 2002: Name fumblebee
LLDP-MED Capabilities TLV
Device Type: netcon
Capabilities: LLDP-MED, Network Policy, Location Identification, Extended Power via MDI-PSE
End of LLDPDU TLV
enp3s0f1
[...]
on the switch side
On the switch, it is a bit easier to see what s connected to each
interface:
office switch
On the switch side, this system looks like:
office1-switch23# show lldp info remote-device
LLDP Remote Devices Information
LocalPort ChassisId PortId PortDescr SysName
--------- + ------------------------- ------ --------- ----------------------
[...]
42 22 33 44 55 66 77 eno1 Intel ... turbotape.example.com
[...]
office1-switch23# show lldp info remote-device 42
LLDP Remote Device Information Detail
Local Port : 42
ChassisType : mac-address
ChassisId : 00 11 22 33 33 55
PortType : interface-name
PortId : eno1
SysName : turbotape.example.com
System Descr : Debian GNU/Linux testing (stretch) Linux 4.5.0-1-amd64 #1...
PortDescr : Intel Corporation Ethernet Connection I217-LM
System Capabilities Supported : bridge, router
System Capabilities Enabled : bridge, router
Remote Management Address
Type : ipv4
Address : 192.0.2.93
Type : ipv6
Address : 20 01 0d b8 00 00 00 00 00 00 00 00 00 00 00 01
Type : all802
Address : 22 33 44 55 66 77
datacenter switch
ssm@site3-row2-rack1> show lldp neighbors
Local Interface Parent Interface Chassis Id Port info System Name
[...]
ge-0/0/38.0 ae1.0 01:23:45:67:89:58 Interface 2 as enp3s0f0 server.example.com
ge-1/0/38.0 ae1.0 01:23:45:67:89:58 Interface 3 as enp3s0f1 server.example.com
[...]
ssm@site3-row2-rack1> show lldp neighbors interface ge-0/0/38
LLDP Neighbor Information:
Local Information:
Index: 157 Time to live: 120 Time mark: Fri Apr 29 13:00:19 2016 Age: 24 secs
Local Interface : ge-0/0/38.0
Parent Interface : ae1.0
Local Port ID : 588
Ageout Count : 0
Neighbour Information:
Chassis type : Mac address
Chassis ID : 01:23:45:67:89:58
Port type : Mac address
Port ID : 01:23:45:67:89:58
Port description : Interface 2 as enp3s0f0
System name : server.example.com
System Description : Linux server.example.com 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 4
System capabilities
Supported : Station Only
Enabled : Station Only
Management Info
Type : IPv6
Address : 2001:0db8:0000:0000:0000:dead:beef:cafe
Port ID : 2
Subtype : 2
Interface Subtype : ifIndex(2)
OID : 1.3.6.1.2.1.31.1.1.1.1.2
In order to decrease the number of blacklisted packages, the first build is now run with a timeout of 18h (previously: 12h) and the 2nd with 24h timeout (previously: 18h). (h01ger)
We now also vary the CPU model on amd64 (and soon on i386 too) so that one build is performed using a "AMD Opteron 62xx class CPU" while the other is done using a "Intel Core Processor (Haswell)". This is now possible as proftitbricks.com offers VMs running both types of CPU and have generously increased their sponsorship once more. (h01ger)
Profitbricks increased our storage space by 400 GB which will be used to setup a 2nd build node for the coreboot/OpenWrt/NetBSD/Arch Linux/Fedora tests. This 2nd build node will run 398 days in the future for testing reproducibility on a different date.
diffoscope development
diffoscope 52 was released with changes from Mattia Rizzolo, h01ger, Satyam Zode and Reiner Herrmann, who also did the release. Notable changes included:
Drop transitional debbindiff package.
Let objdump demangle symbols for better readability.
Install bin/diffoscope instead of auto-generated script. (Closes: #821777)
As usual, diffoscope 52 is available on Debian, Archlinux and PyPI, other distributions will hopefully soon update.
Package reviews
28 reviews have been added, 11 have been updated and 94 have been removed in this week.
14 FTBFS bugs were reported by Chris Lamb (one being was a duplicate of a bug filed by Sebastian Ramacher an hour earlier).
Misc.
This week's edition was written by Lunar, Holger 'h01ger' Levsen and Chris Lamb and reviewed by a bunch of Reproducible builds folks on IRC.