ROOT Debian packaging is often late or broken. Users are trying their best themselves. I've decided to join and remake ROOT Debian packaging from scratch.
Debian ROOT packaging system is published on github.
Currently it builds only two packages: libroot and libroot-dev which contain whole ROOT installation. xrootd is not included due to the bug in it's build system. Many more components and plugins are not built to keep dependencies at minimum. Fine grained packaging and useful dependency tags are subject for further improvement.
Debian wiki page watches the progress of main official and unofficial ROOT repositories.
2011-11-22
2011-11-09
How to build a DKMS Debian package
Dynamic Kernel Module Support is a very simple concept allowing to always keep your kernel and modules up to date. DKMS builds module source on each change of active kernel. All you need is to install source files and register them with one-line command. On the other hand packaging system of Linux distributions makes those tasks even easier managing versioning, conflicts resolution and automated registration.
Suppose you have "mydriver" kernel module. Following is annotated process of packaging for it step by step.
Futher reading: Debian packaging
sudo apt-get install debhelper
debhelper is a set of perl scripts for automated Debian packaging. It helps creating a minimal debian package example in your source tree:
dh_make --single --packagename mydriver-1.2 --native --copyright gpl2
- --single - creates a single deb package template
- --native - tells dh_make to consider current directory as the root of source tree
- --copyright - should be gpl2 (defaults to gpl3) to be compatible with current Linux kernel license
- --packagename - should take argument of form mydriver-version
rm debian/*.ex debian/*.EX debian/README* install
This leaves following files and directories: changelog compat control copyright README rules source substvars
- changelog, copyright, README files are to be (optionally) fixed with your name and comments
- compat and source are file and directory controlling Debian helper behaviour and are to be left as they are
- control file contains your package metainformation. If you are sure that your driver will compile and work on any architecture change Architecture: field to "all".
- substrvars contains variable values that are used in control file. It can be ignored.
#!/usr/bin/make -f
VERSION=$(shell dpkg-parsechangelog |grep ^Version:|cut -d ' ' -f 2)
%:
dh $@ --with dkms
override_dh_install:
dh_install Makefile mydriver.c usr/src/mydriver-$(VERSION)/
override_dh_dkms:
dh_dkms -V $(VERSION)
Rules file does almost everything related to Debian packaging. Follows the explanation of its content.
- VERSION of your package is determined by changelog and Debian policies require changelog to always be up to date. dpkg-parsechangelog parses debian/changelog and outputs information as key: value pairs, one per line. We are selecting "Version" key with grep and obtain its value with cut.
- % target redirects every unknown target to dh perl program provided by debhelper. dh implements all required targets for debian standard rules Makefile, but it can't guess everything and provide "override" mechanism to configure every aspect of packaging, if rules define override_dh_* target it replaces default action that dh usually does.
- override_dh_install installs our sources to the required target location. Actually dh has default dh_install step, which may do this for you (using debian/install configuration file), but it is limited to constant path only, which renders it unusable for dkms installation (requiring module version to be present in target folder name).
- override_dh_dkms it needed for the very same purpose - to avoid updating packet version inside you DKMS configuration file (see below).
PACKAGE_VERSION="#MODULE_VERSION#"
PACKAGE_NAME="mydriver"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="mydriver"
BUILT_MODULE_LOCATION[0]="./"
DEST_MODULE_LOCATION[0]="/kernel/net"
MAKE[1]="make"
AUTOINSTALL="yes"
It will be copied to usr/src/mydriver-$(VERSION)/ by dh_dkms. #MODULE_VERSION# will be replaced by your module version (note that this won't happen if we omit -V key in dh_dkms invocation).
All required files are ready now, we can proceed to building our package with
dpkg-buildpackage -us -uc -b
It will (list nesting shows call nesting):
- clean source tree
- "debian/rules clean"
- "dh clean"
- "make clean"
- "dh clean"
- "debian/rules clean"
- build source tree
- "debian/rules build"
- "dh build"
- "make" which is probably doing nothing as your module actually using Kbuild mechanism leaving Makefile in your source without targets.
- "dh build"
- "debian/rules build"
- build package
- "debian/rules binary"
- install files to a temporary path with
- "dh_dkms" which uses override_dh_dkms, patching dkms configuration and installing it in an appropriate temporary folder
- "make override_dh_install" that installs our sources in the very same temporary folder
- "dh_builddeb" that packages temporary folder into deb package.
- install files to a temporary path with
- "debian/rules binary"
Futher reading: Debian packaging
2010-10-23
A while ago I wrote a python library for parse and statistical analysis of network usage logs generated by net-acct.
A python was used for that implementation.
Later I began to learn Scala in order to make it closer to functional programming world. It seemed that writing simple log parser was an adequate task to take a feeling of language without experiencing extra difficulties.
A nice timing bonus makes me develop scala version futher and drop the python one.
python
real 2m32.052s
user 2m24.957s
sys 0m3.840s
scala
real 0m21.942s
user 0m15.653s
sys 0m0.456s
Tests were done on 6 Mb of gzipped logs with 1833.650 Mhz Athlon (3667.30 bogomips).
P.S. Improvements of configuration subsystem are now making Scala version useful for non-programmers. Documentation is still lacking, but I'm publishing it nevertheless.
A python was used for that implementation.
Later I began to learn Scala in order to make it closer to functional programming world. It seemed that writing simple log parser was an adequate task to take a feeling of language without experiencing extra difficulties.
A nice timing bonus makes me develop scala version futher and drop the python one.
python
real 2m32.052s
user 2m24.957s
sys 0m3.840s
scala
real 0m21.942s
user 0m15.653s
sys 0m0.456s
Tests were done on 6 Mb of gzipped logs with 1833.650 Mhz Athlon (3667.30 bogomips).
P.S. Improvements of configuration subsystem are now making Scala version useful for non-programmers. Documentation is still lacking, but I'm publishing it nevertheless.
2010-07-26
A shortest complete list of packages that should be installed on a Debian system to repeat current configuration can be obtained by the following command:
To use output in scripting add a key: -F %p
This package list can be passed as an argument list an apt-get install program on your new system.
aptitude search '?installed?not(?automatic)?not(?reverse-depends(?installed))'
To use output in scripting add a key: -F %p
This package list can be passed as an argument list an apt-get install program on your new system.
2010-07-20
How to register your private key on the remote SSH server running on Linux
I've forgot which program from SSH toolchain does this (ssh-copy-id), and replaced it with my own method.
~/.ssh/id_dsa should be replaced with your private key file.
remote.org - SSH sever address
ssh-keygen -y -f ~/.ssh/id_dsa | ssh remote.org tee -a ~/.ssh/authorized_keys
~/.ssh/id_dsa should be replaced with your private key file.
remote.org - SSH sever address
2010-05-17
sudo in Debian squeeze
Debian squeeze creates an advanced config file for sudo package. File contains the following lines:
The first one allows all users from sudo group to do everything they want and the second one demonstrates a way to create a flexible sudo configuration.
%sudo ALL=(ALL) ALL
#includedir /etc/sudoers.d
The first one allows all users from sudo group to do everything they want and the second one demonstrates a way to create a flexible sudo configuration.
2010-05-12
Unattended shutdown
My notebook seems to have a hardware defect. It might self power on after being powered off for some time.
This bug quickly degrades the battery making me recharge it too often. To prevent the system from discharging the battery I've wrote the following startup script:
This script checks if a user is logged on in 30 seconds after system boot and if he is not, shuts the system down.
Commented lines at the top of the script are Debian LSB header that drives its new dependecy based boot system. This header requests starting the script after gdb making measured time interval for user to login more precise.
This bug quickly degrades the battery making me recharge it too often. To prevent the system from discharging the battery I've wrote the following startup script:
#!/bin/sh
### BEGIN INIT INFO
# Provides: haltIfNousers
# Required-Start:
# Required-Stop:
# Should-Start: gdm
# Default-Start: 2 3
# Default-Stop: 4 5
# Short-Description: Execute the halt command.
# Description:
### END INIT INFO
#Powers off the system if no user is logged in in 30 seconds
BLOCK_FILE=/tmp/haltIfNousers
case "$1" in
start)
$0 wait &
;;
wait)
touch "$BLOCK_FILE"
sleep 30
[ -e "$BLOCK_FILE" ] || exit 0
if ! who|grep '.*' -q ; then
echo $0: No users are logged in. Halting now.
shutdown -h now
exit 0
fi
rm -f "$BLOCK_FILE"
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
rm -f "$BLOCK_FILE"
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
This script checks if a user is logged on in 30 seconds after system boot and if he is not, shuts the system down.
Commented lines at the top of the script are Debian LSB header that drives its new dependecy based boot system. This header requests starting the script after gdb making measured time interval for user to login more precise.
Подписаться на:
Сообщения (Atom)