From: R. Steve McKown Date: Mon, 18 Aug 2014 17:45:44 +0000 (-0600) Subject: Revamp build strategy X-Git-Tag: debian/0.11.4-1tmi^0 X-Git-Url: https://oss.titaniummirror.com/gitweb?p=cp210x.git;a=commitdiff_plain Revamp build strategy * Use git-buildpackage (see debian/gbp.conf) * Move examples to /usr/share/doc/cp210x-module-dkms... * Source files in binary aren't under src/ as this is kinda redundant * Don't package some things into the binary image that are in the source --- diff --git a/Makefile b/Makefile deleted file mode 100644 index 853dd93..0000000 --- a/Makefile +++ /dev/null @@ -1,118 +0,0 @@ -# Makefile for newer cp2101 driver, we call cp210x -# Essentially, it makes a debian source package which -# then can be built by pbuilder, etc. - -# Change or override these values as necessary for each package release - -PKGVER = 0.11.3 -DEBRELEASE = 7tmi - - -# No need to change anything below this line - -REPOID := $(shell svn info 2>/dev/null | grep "Revision: " | sed -e s'/^[^0-9]*\([0-9]*\).*$$/svn:revision \1/') -ifeq (,$(REPOID)) - REPOID := $(shell git svn info 2>/dev/null | grep "Revision: " | sed -e s'/^[^0-9]*\([0-9]*\).*$$/svn:revision \1/') -ifeq (,$(REPOID)) - REPOID := $(shell git log --no-decorate -n1 2>/dev/null | head -1 | sed -e s'/^/git:/') -endif -endif -ifeq (,$(REPOID)) - $(error You much check the code out via svn, git-svn, or git) -endif - -USER := $(shell whoami) -REPOHOST := repo -BUILD := build -#DEBDIST := $(shell lsb_release -cs) -DEBDIST := hardy -DEBVER := $(PKGVER)-$(DEBRELEASE) -RFC822DATE := $(shell date --rfc-822) -ROOTNAME := cp210x -PACKAGE := $(ROOTNAME)-module-dkms -TARFILE := $(PACKAGE)_$(DEBVER).orig.tar.gz -DEBSRC := $(PACKAGE)-$(PKGVER) -ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) -DEBFILE := $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).deb -DEBSRCFILE := $(BUILD)/$(PACKAGE)_$(DEBVER).dsc -CHANGESFILE := $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).changes -UPLOADFILE := $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).upload - - -source: $(DEBSRCFILE) -$(DEBSRCFILE): $(BUILD)/debian-stamp - cd $(BUILD) && dpkg-source -b $(DEBSRC) - touch $@ - - -release: $(UPLOADFILE) -$(UPLOADFILE): $(CHANGESFILE) - : # Requires ~/.dput.cf and upload server configured properly - dput $(REPOHOST) $(CHANGESFILE) - - -pbuilder: $(CHANGESFILE) -$(CHANGESFILE): $(DEBSRCFILE) - : # Requires ~/.dput.cf and upload server configured properly - sudo pbuilder build $(DEBSRCFILE) - sudo mv /var/cache/pbuilder/result/$(PACKAGE)_$(DEBVER)* $(BUILD)/ - sudo chown $(USER) $(BUILD)/* - debsign $(CHANGESFILE) - - -binary: $(DEBFILE) -$(DEBFILE): $(BUILD)/debian-stamp - cd $(BUILD)/$(DEBSRC) && dpkg-buildpackage -sa - - -$(BUILD)/src-stamp: Makefile.dkms dkms.conf $(wildcard src/*) - mkdir -p $(BUILD) - rm -rf $(BUILD)/$(DEBSRC) - cp -a src $(BUILD)/$(DEBSRC) - perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/cp210x.c - perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/cp210x.c.karmic - perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/cp210x.c.lucid - perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/cp210x.c.maverick - cp Makefile.dkms $(BUILD)/$(DEBSRC) - cp dkms.conf $(BUILD)/$(DEBSRC) - perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/dkms.conf - find $(BUILD)/$(DEBSRC) -name .svn -type d -exec rm -rf "{}" ";" 2>/dev/null || exit 0 - rm -rf $(BUILD)/$(DEBSRC)/.git || exit 0 - tar -C $(BUILD) -czf $(BUILD)/$(TARFILE) $(DEBSRC) - touch $@ - - -configure: $(BUILD)/debian-stamp -$(BUILD)/debian-stamp: $(BUILD)/src-stamp $(wildcard debian.in/*) - mkdir -p $(BUILD)/$(DEBSRC)/debian - rsync --quiet -avz --exclude=.svn/ --exclude=.git/ debian.in/ $(BUILD)/$(DEBSRC)/debian/ - perl -i -pe 's/xxPACKAGExx/$(PACKAGE)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxROOTNAMExx/$(ROOTNAME)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxPKGVERxx/$(PKGVER)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxDEBDISTxx/$(DEBDIST)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxRFC822DATExx/$(RFC822DATE)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxREPOIDxx/$(REPOID)/g' $(BUILD)/$(DEBSRC)/debian/* - touch $@ - - -clean: - rm -rf $(BUILD) - - -debug: - @echo "BUILD = $(BUILD)" - @echo "PKGVER = $(PKGVER)" - @echo "REPOID = $(REPOID)" - @echo "DEBRELEASE = $(DEBRELEASE)" - @echo "DEBVER = $(DEBVER)" - @echo "RFC822DATE = $(RFC822DATE)" - @echo "PACKAGE = $(PACKAGE)" - @echo "TARFILE = $(TARFILE)" - @echo "DEBSRC = $(DEBSRC)" - @echo "ARCH = $(ARCH)" - @echo "DEBFILE = $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).deb" - @echo "DEBSRCFILE = $(BUILD)/$(PACKAGE)_$(DEBVER).dsc" - - -.PHONY: clean binary source configure pbuilder release diff --git a/debian.in/changelog b/debian.in/changelog deleted file mode 100644 index ef28246..0000000 --- a/debian.in/changelog +++ /dev/null @@ -1,5 +0,0 @@ -xxPACKAGExx (xxDEBVERxx) xxDEBDISTxx; urgency=low - - * Auto packaged - - -- TMI Packages xxRFC822DATExx diff --git a/debian.in/control b/debian.in/control deleted file mode 100644 index 7cdc3e0..0000000 --- a/debian.in/control +++ /dev/null @@ -1,26 +0,0 @@ -Source: xxPACKAGExx -Section: devel -Priority: optional -Maintainer: TMI Packages -Standards-Version: 3.7.2.0 -Build-Depends: dpkg-dev (>= 1.13.9), lsb-release - -Package: xxPACKAGExx -Architecture: all -Depends: dkms (>> 2.0.20), linux-headers-generic, linux-image, - binutils (>= 2.9.5.0.12), gcc (>= 4:4.2.2), dpatch, file, bzip2, lsb-release -Conflicts: cp210x-module-2.6.24-19-generic, cp210x-module-2.6.24-21-generic, - cp210x-module-2.6.24-22-generic, cp210x-module-2.6.24-23-generic, - cp210x-module-2.6.24-24-generic, cp210x-module-2.6.24-25-generic -Replaces: cp210x-module-2.6.24-19-generic, cp210x-module-2.6.24-21-generic, - cp210x-module-2.6.24-22-generic, cp210x-module-2.6.24-23-generic, - cp210x-module-2.6.24-24-generic, cp210x-module-2.6.24-25-generic -Priority: extra -Description: Enhanced USB/serial kernel module for cp210x based devices. - This module blacklists the standard cp2101 module installed in the kernel, - effectively taking its place. This code is an enhanced version of Silicon - Lab's v0.11 driver, released under the GPLv2 with their permission. It - provides support for setting USB metadata, configuring port state, and - interacting with the GPIO pins. This package will be obsolete once the - new features of this module have been incorporated into the mainline kernel - driver. Built from xxREPOIDxx diff --git a/debian.in/copyright b/debian.in/copyright deleted file mode 100644 index e2fb7d2..0000000 --- a/debian.in/copyright +++ /dev/null @@ -1,13 +0,0 @@ -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/debian.in/postinst b/debian.in/postinst deleted file mode 100755 index d1dbc4d..0000000 --- a/debian.in/postinst +++ /dev/null @@ -1,84 +0,0 @@ -#! /bin/sh - -set -e - -NAME=xxPACKAGExx -VERSION=xxDEBVERxx - -case "$1" in - configure) - # Use a distro-specific source file, if present - c_src=/usr/src/$NAME-$VERSION/cp210x.c - c_dist=$(lsb_release -cs) - if [ -f "$c_src.$c_dist" ]; then - mv $c_src.$c_dist $c_src - fi - - # Unload old cp210x modules, if in use - modprobe -rq cp2101 || true - modprobe -rq cp210x || true - - # Determine current arch / kernel - c_arch=`uname -m` - c_kern=`uname -r` - - if [ -e "/var/lib/dkms/$NAME/$VERSION" ]; then - echo "Removing old $NAME-$VERSION DKMS files..." - dkms remove -m $NAME -v $VERSION --all - fi - - echo "Loading new $NAME-$VERSION DKMS files..." - if [ -f "/usr/src/$NAME-$VERSION.dkms.tar.gz" ]; then - dkms ldtarball --archive "/usr/src/$NAME-$VERSION.dkms.tar.gz" - else - dkms add -m $NAME -v $VERSION - fi - - echo "Installing prebuilt kernel module binaries (if any)" - set +e - IFS=' -' - for kern in `dkms status -m $NAME -v $VERSION -a $c_arch | grep ": built" | awk {'print $3'} | sed 's/,$//'`; do - echo "Trying kernel: $kern" - dkms install --force -m $NAME -v $VERSION -k $kern -a $c_arch - done - unset IFS - set -e - - # If none installed, install. - ##if [ `dkms status -m $NAME -v $VERSION -k $c_kern -a $c_arch | grep -c ": installed"` -eq 0 ]; then - dkms_status=`dkms status -m $NAME -v $VERSION -k $c_kern -a $c_arch` - if [ `echo $dkms_status | grep -c ": installed"` -eq 0 ]; then - if [ `echo $c_kern | grep -c "BOOT"` -eq 0 ] && [ -e "/lib/modules/$c_kern/build/include" ]; then - # Only build if we need to. - if [ `echo $dkms_status | grep -c ": built"` -eq 0 ]; then - echo "Building module..." - dkms build -m $NAME -v $VERSION - fi - echo "Installing module..." - dkms install -m $NAME -v $VERSION - elif [ `echo $c_kern | grep -c "BOOT"` -gt 0 ]; then - echo "" - echo "Module build for the currently running kernel was skipped since you" - echo "are running a BOOT variant of the kernel." - else - echo "" - echo "Module build for the currently running kernel was skipped since the" - echo "kernel source for this kernel does not seem to be installed." - fi - fi - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -#DEBHELPER# - -exit 0 - diff --git a/debian.in/postrm b/debian.in/postrm deleted file mode 100755 index 30f451d..0000000 --- a/debian.in/postrm +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -NAME=xxPACKAGExx -VERSION=xxDEBVERxx - -set -e - -case "$1" in - purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - depmod - if [ -d "/usr/src/$NAME-$VERSION" ]; then - echo "Removing old module source..." - rm -rf "/usr/src/$NAME-$VERSION" - fi - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -#DEBHELPER# - -exit 0 - diff --git a/debian.in/prerm b/debian.in/prerm deleted file mode 100755 index 9985327..0000000 --- a/debian.in/prerm +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -NAME=xxPACKAGExx -VERSION=xxDEBVERxx - -set -e - -case "$1" in - remove|upgrade|deconfigure) - rmmod xxROOTNAMExx 2>/dev/null || true - if [ "`dkms status -m $NAME`" ]; then - dkms remove -m $NAME -v $VERSION --all - fi - ;; - - failed-upgrade) - ;; - - *) - echo "prerm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -#DEBHELPER# - -exit 0 - diff --git a/debian.in/rules b/debian.in/rules deleted file mode 100755 index 16cadf1..0000000 --- a/debian.in/rules +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/make -f -# debian/rules file - for cp210x-module-dkms -# Based on sample debian/rules file - for GNU Hello (1.3). -# Copyright 1994,1995 by Ian Jackson. -# Copyright 1998-2007 James Troup -# I hereby give you perpetual unlimited permission to copy, -# modify and relicense this file, provided that you do not remove -# my name from the file itself. (I assert my moral right of -# paternity under the Copyright, Designs and Patents Act 1988.) -# This file may have to be extensively modified - -package = xxPACKAGExx -inst_dir = debian/tmp/usr/src/xxPACKAGExx-xxDEBVERxx - -install_dir = install -d -m 755 -install_file = install -m 644 -install_script = install -m 755 -install_binary = install -m 755 -s - -DISTRIBUTION := $(shell lsb_release -is) - - -configure-stamp: - touch $@ - - -build: build-stamp -build-stamp: configure-stamp - $(checkdir) - touch $@ - - -install: install-stamp -install-stamp: checkroot build-stamp - $(checkdir) - rm -rf debian/tmp - $(install_dir) $(inst_dir) - mv debian ../ - cp -a . ../$(inst_dir) - mv ../debian . - $(install_dir) debian/tmp/etc/modprobe.d - echo "blacklist cp2101" > debian/tmp/etc/modprobe.d/$(package).conf - touch $@ - - -binary-indep: checkroot build install - : # Nothing to do - - -binary-arch: checkroot build install - $(checkdir) - : # install maintainer scripts - $(install_dir) debian/tmp/DEBIAN - $(install_script) debian/postinst debian/tmp/DEBIAN/postinst - $(install_script) debian/prerm debian/tmp/DEBIAN/prerm - $(install_script) debian/postrm debian/tmp/DEBIAN/postrm - : # install docs - $(install_dir) debian/tmp/usr/share/doc/$(package)/ - $(install_file) debian/changelog \ - debian/tmp/usr/share/doc/$(package)/changelog.Debian - $(install_file) debian/copyright debian/tmp/usr/share/doc/$(package)/ - : # Compress stuff that needs it - find debian/tmp/usr/share/doc/$(package)/ -type f ! -name copyright | \ - xargs gzip -9 - : # Finish it all up - dpkg-gencontrol -isp $(CONFLICTS) - chown -R root:root debian/tmp - chmod -R go=rX debian/tmp - dpkg --build debian/tmp .. - - -binary: binary-indep binary-arch - - -clean: - $(checkdir) - -rm -rf debian/tmp - -rm -fr debian/patched debian/files* debian/substvars - -rm -f *-stamp - - -define checkdir - test -f debian/rules -endef - - -checkroot: - $(checkdir) - test root = "`whoami`" - - -.PHONY: binary clean checkroot diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..98e1902 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +cp210x-module-dkms (0.11.4-1tmi) trusty; urgency=medium + + * Support Ubuntu 14.04 Trusty Tahr + + -- R. Steve McKown Mon, 18 Aug 2014 13:17:31 -0600 diff --git a/debian/control.in b/debian/control.in new file mode 100644 index 0000000..7cdc3e0 --- /dev/null +++ b/debian/control.in @@ -0,0 +1,26 @@ +Source: xxPACKAGExx +Section: devel +Priority: optional +Maintainer: TMI Packages +Standards-Version: 3.7.2.0 +Build-Depends: dpkg-dev (>= 1.13.9), lsb-release + +Package: xxPACKAGExx +Architecture: all +Depends: dkms (>> 2.0.20), linux-headers-generic, linux-image, + binutils (>= 2.9.5.0.12), gcc (>= 4:4.2.2), dpatch, file, bzip2, lsb-release +Conflicts: cp210x-module-2.6.24-19-generic, cp210x-module-2.6.24-21-generic, + cp210x-module-2.6.24-22-generic, cp210x-module-2.6.24-23-generic, + cp210x-module-2.6.24-24-generic, cp210x-module-2.6.24-25-generic +Replaces: cp210x-module-2.6.24-19-generic, cp210x-module-2.6.24-21-generic, + cp210x-module-2.6.24-22-generic, cp210x-module-2.6.24-23-generic, + cp210x-module-2.6.24-24-generic, cp210x-module-2.6.24-25-generic +Priority: extra +Description: Enhanced USB/serial kernel module for cp210x based devices. + This module blacklists the standard cp2101 module installed in the kernel, + effectively taking its place. This code is an enhanced version of Silicon + Lab's v0.11 driver, released under the GPLv2 with their permission. It + provides support for setting USB metadata, configuring port state, and + interacting with the GPIO pins. This package will be obsolete once the + new features of this module have been incorporated into the mainline kernel + driver. Built from xxREPOIDxx diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..e2fb7d2 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,13 @@ +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..2a61b08 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,32 @@ +# gbp.conf +# +# Assist building. Requires specific setup in ~/.pbuilderrc and cow images +# created for the distribution/architecture combinations to be built. +# +# To build: +# DIST=trusty ARCH=amd64 git-buildpackage -sa +# +# There is no need to build for different architectures, as the resulting +# Debian package is architecture independent. +# +# To post to server (requires properly configured ~/dput.cf): +# cd ../cp210x-build +# dput repo-trusty cp210x*.changes + +[DEFAULT] +builder = /usr/bin/git-pbuilder +cleaner = fakeroot debian/rules clean +prebuild = debian/rules configure +# Remove lintian check until warnings are fixed +#postbuild = lintian $GBP_CHANGES_FILE +pristine-tar = False + +upstream-tree=HEAD +debian-branch=master +debian-tag=debian/%(version)s + +[git-buildpackage] +export-dir = ../cp210x-build/ + +[git-import-orig] +dch = false diff --git a/debian/postinst.in b/debian/postinst.in new file mode 100755 index 0000000..04bba6b --- /dev/null +++ b/debian/postinst.in @@ -0,0 +1,84 @@ +#! /bin/sh + +set -e + +PACKAGE=xxPACKAGExx +VERSION=xxDEBVERxx + +case "$1" in + configure) + # Use a distro-specific source file, if present + c_src=/usr/src/$PACKAGE-$VERSION/cp210x.c + c_dist=$(lsb_release -cs) + if [ -f "$c_src.$c_dist" ]; then + mv $c_src.$c_dist $c_src + fi + + # Unload old cp210x modules, if in use + modprobe -rq cp2101 || true + modprobe -rq cp210x || true + + # Determine current arch / kernel + c_arch=`uname -m` + c_kern=`uname -r` + + if [ -e "/var/lib/dkms/$PACKAGE/$VERSION" ]; then + echo "Removing old $PACKAGE-$VERSION DKMS files..." + dkms remove -m $PACKAGE -v $VERSION --all + fi + + echo "Loading new $PACKAGE-$VERSION DKMS files..." + if [ -f "/usr/src/$PACKAGE-$VERSION.dkms.tar.gz" ]; then + dkms ldtarball --archive "/usr/src/$PACKAGE-$VERSION.dkms.tar.gz" + else + dkms add -m $PACKAGE -v $VERSION + fi + + echo "Installing prebuilt kernel module binaries (if any)" + set +e + IFS=' +' + for kern in `dkms status -m $PACKAGE -v $VERSION -a $c_arch | grep ": built" | awk {'print $3'} | sed 's/,$//'`; do + echo "Trying kernel: $kern" + dkms install --force -m $PACKAGE -v $VERSION -k $kern -a $c_arch + done + unset IFS + set -e + + # If none installed, install. + ##if [ `dkms status -m $PACKAGE -v $VERSION -k $c_kern -a $c_arch | grep -c ": installed"` -eq 0 ]; then + dkms_status=`dkms status -m $PACKAGE -v $VERSION -k $c_kern -a $c_arch` + if [ `echo $dkms_status | grep -c ": installed"` -eq 0 ]; then + if [ `echo $c_kern | grep -c "BOOT"` -eq 0 ] && [ -e "/lib/modules/$c_kern/build/include" ]; then + # Only build if we need to. + if [ `echo $dkms_status | grep -c ": built"` -eq 0 ]; then + echo "Building module..." + dkms build -m $PACKAGE -v $VERSION + fi + echo "Installing module..." + dkms install -m $PACKAGE -v $VERSION + elif [ `echo $c_kern | grep -c "BOOT"` -gt 0 ]; then + echo "" + echo "Module build for the currently running kernel was skipped since you" + echo "are running a BOOT variant of the kernel." + else + echo "" + echo "Module build for the currently running kernel was skipped since the" + echo "kernel source for this kernel does not seem to be installed." + fi + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 + diff --git a/debian/postrm.in b/debian/postrm.in new file mode 100755 index 0000000..46325a0 --- /dev/null +++ b/debian/postrm.in @@ -0,0 +1,26 @@ +#!/bin/sh + +PACKAGE=xxPACKAGExx +VERSION=xxDEBVERxx + +set -e + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + depmod + if [ -d "/usr/src/$PACKAGE-$VERSION" ]; then + echo "Removing old module source..." + rm -rf "/usr/src/$PACKAGE-$VERSION" + fi + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 + diff --git a/debian/prerm.in b/debian/prerm.in new file mode 100755 index 0000000..59babc2 --- /dev/null +++ b/debian/prerm.in @@ -0,0 +1,29 @@ +#!/bin/sh + +PACKAGE=xxPACKAGExx +VERSION=xxDEBVERxx +MODULE=xxMODULExx + +set -e + +case "$1" in + remove|upgrade|deconfigure) + rmmod $ROOTNAME 2>/dev/null || true + if [ "`dkms status -m $PACKAGE`" ]; then + dkms remove -m $PACKAGE -v $VERSION --all + fi + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..db69878 --- /dev/null +++ b/debian/rules @@ -0,0 +1,123 @@ +#!/usr/bin/make -f +# debian/rules file - for cp210x-module-dkms +# Based on sample debian/rules file - for GNU Hello (1.3). +# Copyright 1994,1995 by Ian Jackson. +# Copyright 1998-2007 James Troup +# I hereby give you perpetual unlimited permission to copy, +# modify and relicense this file, provided that you do not remove +# my name from the file itself. (I assert my moral right of +# paternity under the Copyright, Designs and Patents Act 1988.) +# This file may have to be extensively modified + +package = $(shell dpkg-parsechangelog --show-field Source) +version = $(shell dpkg-parsechangelog --show-field Version) +module = $(shell echo "$(package)" | sed -e 's|-module-dkms||g') +distribution = $(shell dpkg-parsechangelog --show-field Distribution) +repoid = $(git describe --tags --always --long --dirty) +inst_dir = debian/tmp/usr/src/$(package)-$(version) + +install_dir = install -d -m 755 +install_file = install -m 644 +install_script = install -m 755 +install_binary = install -m 755 -s + + +configure: configure-stamp +configure-stamp: + @find . -name "*.in" | while read file; do \ + t=$$(dirname $$file)/$$(basename $$file .in); \ + echo "Preprocessing $$t ..."; \ + cp -a $$file $$t; \ + perl -i -pe 's/xxPACKAGExx/$(package)/g' $$t; \ + perl -i -pe 's/xxDEBVERxx/$(version)/g' $$t; \ + perl -i -pe 's/xxMODULExx/$(module)/g' $$t; \ + perl -i -pe 's/xxREPOIDxx/$(repoid)/g' $$t; \ + done + touch $@ + + +build: build-stamp +build-stamp: configure-stamp + $(checkdir) + touch $@ + + +install: install-stamp +install-stamp: checkroot build-stamp + $(checkdir) + : # install dkms configuration + rm -rf debian/tmp + $(install_dir) $(inst_dir) + $(install_file) dkms.conf Makefile.dkms $(inst_dir)/ + : # install source files (configure must be executable) + cp -a src/* $(inst_dir)/ + rm -rf $(inst_dir)/Docs + rm -rf $(inst_dir)/examples + rm -rf $(inst_dir)/rpm + : # Include file to shared path + $(install_dir) debian/tmp/usr/include + cp -a $(inst_dir)/cp210x.h debian/tmp/usr/include/ + : # install module configuration (blacklist) + $(install_dir) debian/tmp/etc/modprobe.d + echo "blacklist cp2101" > debian/tmp/etc/modprobe.d/$(package).conf + touch $@ + + +binary-indep: checkroot build install + : # Nothing to do + + +binary-arch: checkroot build install + $(checkdir) + : # install maintainer scripts + $(install_dir) debian/tmp/DEBIAN + $(install_script) debian/postinst debian/tmp/DEBIAN/postinst + $(install_script) debian/prerm debian/tmp/DEBIAN/prerm + $(install_script) debian/postrm debian/tmp/DEBIAN/postrm + : # install docs + $(install_dir) debian/tmp/usr/share/doc/$(package)/ + $(install_file) debian/changelog \ + debian/tmp/usr/share/doc/$(package)/changelog.Debian + $(install_file) debian/copyright debian/tmp/usr/share/doc/$(package)/ + : # Compress stuff that needs it + find debian/tmp/usr/share/doc/$(package)/ -type f ! -name copyright | \ + xargs gzip -9 + : # install examples (after compression) + $(install_dir) debian/tmp/usr/share/doc/$(package)/examples + for i in src/examples/*; do \ + $(install_file) $$i debian/tmp/usr/share/doc/$(package)/examples/; \ + done + : # Finish it all up + dpkg-gencontrol -isp $(CONFLICTS) + chown -R root:root debian/tmp + chmod -R go=rX debian/tmp + dpkg --build debian/tmp .. + + +binary: binary-indep binary-arch + + +clean: + $(checkdir) + -rm -rf debian/tmp + -rm -fr debian/patched debian/files* debian/substvars + : # Clean all but debian/control, since git-buildpackage cleans after + : # prebuild just before building + find . -name "*.in" | while read file; do \ + t=$$(dirname $$file)/$$(basename $$file .in); \ + [ "$$t" != "./debian/control" ] && rm -f $$t; \ + done + -rm -f *-stamp + + +define checkdir + test -f debian/rules +endef + + +checkroot: + $(checkdir) + test root = "`whoami`" + + +.PHONY: binary clean checkroot