--- vrflash-0.24.orig/debian/control.in
+++ vrflash-0.24/debian/control.in
@@ -0,0 +1,18 @@
+Source: vrflash
+Section: otherosfs
+Priority: extra
+Maintainer: Jonas Smedegaard <dr@jones.dk>
+Build-Depends: @cdbs@
+Standards-Version: 3.7.3
+Vcs-Git: git://git.debian.org/git/collab-maint/vtflash.git
+Vcs-Browser: http://git.debian.org/?p=collab-maint/vrflash.git;a=summary
+Homapage: http://sourceforge.net/projects/agos
+
+Package: vrflash
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: tool to flash kernels and romdisks to Agenda VR
+ The Agenda VR is a handheld computer that runs Linux. VRFlash
+ communicates with the Agenda's boot monitor (PMON) over a serial
+ line to install new software on the device. The kernel and the
+ root image can be upgraded this way.
--- vrflash-0.24.orig/debian/rules
+++ vrflash-0.24/debian/rules
@@ -0,0 +1,23 @@
+#!/usr/bin/make -f
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2003, 2008, Jonas Smedegaard <dr@jones.dk>
+
+# NB! Local CDBS tweaks in use. More info in README.cdbs-tweaks
+include debian/cdbs/1/rules/upstream-tarball.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+include /usr/share/cdbs/1/rules/patchsys-quilt.mk
+include debian/cdbs/1/rules/buildinfo.mk
+include debian/cdbs/1/rules/copyright-check.mk
+
+DEB_UPSTREAM_URL = http://downloads.sourceforge.net/agos
+DEB_UPSTREAM_TARBALL_MD5 = 5899decef026b4ad0dad40c01e3f3d23
+
+DEB_INSTALL_DOCS_vrflash += doc/*
+DEB_INSTALL_MANPAGES_vrflash := debian/vrflash.1
+
+# Preserve upstream mess to please autopkgtest (see bug#446290)
+DEB_CLEAN_EXCLUDE='*.orig'
+
+# Fix double cdbs build-dependencies
+CDBS_BUILD_DEPENDS := $(shell echo '$(CDBS_BUILD_DEPENDS)' | sed -e '/\bcdbs (>= 0.4.39)/ s/ *,* *\bcdbs (>= \(0.4.23-1.1\|0.4.27\)) *,* */, /g' -e 's/^ *, *//' -e 's/ *, *$$//')
--- vrflash-0.24.orig/debian/copyright
+++ vrflash-0.24/debian/copyright
@@ -0,0 +1,52 @@
+Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=160
+Upstream-Name: VRFlash
+Upstream-Maintainer: Jeff Carneal <jeff@apex.net>
+Upstream-Source-Location: http://downloads.sourceforge.net/agos
+
+Files: *
+Copyright: © 2001, Jeff Carneal
+License: GPL-2+
+
+Files: debian/*
+Copyright: © 2007-2008, Jonas Smedegaard <dr@jones.dk>
+ © 2001-2003, Richard Braakman <dark@xs4all.nl>
+License: GPL-2+
+
+Files: ./etxack.c
+Copyright: © 2001, Jeff Carneal
+ © 2000, Brad LaRonde
+License: GPL-2+
+
+Files: ./xmodem-load.h, ./xmodem-load.h.orig
+Copyright: © 2001, PJ, with Agenda Computing, Inc.
+License: GPL-2+
+
+Files: ./config.guess, ./config.sub
+Copyright: © 1992-1996, Free Software Foundation, Inc.
+License: GPL-2+ | other
+ As a special exception to the GNU General Public License, if you
+ distribute this file as part of a program that contains a
+ configuration script generated by Autoconf, you may include it under
+ the same distribution terms that you use for the rest of that program.
+
+Files: ./configure
+Copyright: © 1992-1996, Free Software Foundation, Inc.
+License: GAP
+ This configure script is free software; the Free Software Foundation
+ gives unlimited permission to copy, distribute and modify it.
+
+Files: ./install-sh
+Copyright: © 1991, the Massachusetts Institute of Technology
+License: other
+ Permission to use, copy, modify, distribute, and sell this software and its
+ documentation for any purpose is hereby granted without fee, provided that
+ the above copyright notice appear in all copies and that both that
+ copyright notice and this permission notice appear in supporting
+ documentation, and that the name of M.I.T. not be used in advertising or
+ publicity pertaining to distribution of the software without specific,
+ written prior permission. M.I.T. makes no representations about the
+ suitability of this software for any purpose. It is provided "as is"
+ without express or implied warranty.
+
+On Debian systems, the complete text of the GNU General Public License
+can be found at /usr/share/common-licenses/GPL.
--- vrflash-0.24.orig/debian/copyright_hints
+++ vrflash-0.24/debian/copyright_hints
@@ -0,0 +1,34 @@
+*No copyright* UNKNOWN []: ChangeLog
+ INSTALL
+ Makefile.in
+ README
+ THANKS
+ acconfig.h
+ autoconf.h.in
+ config.h
+ config.h.orig
+ configure.in
+ doc/agenda-flashing-overview.txt
+ doc/pmon-protect-unprotect.txt
+ doc/troubleshooting.txt
+ doc/usage.txt
+ etxack.h
+ main.h
+ port.h
+ progress.h
+ vrerror.h
+ vrfile.h
+ xmodem.h
+GPL-2+ [2001 Jeff Carneal]: progress.c
+ vrerror.c
+ vrfile.c
+ xmodem.c
+GPL-2+ [2001 Jeff]: port.c
+ port.c.orig
+GPL-2+ [2001 PJ, with Agenda Computing, Inc]: xmodem-load.h
+ xmodem-load.h.orig
+GPL-2+ [2001 Jeff Carneal / 2000 Brad LaRonde]: etxack.c
+GPL-2+ [2001 Jeff Carneal / 2001 Jeff Carneal <jeff@apex.net>";]: main.c
+UNKNOWN [1989, 1991 Free Software Foundation, Inc / the software, and]: LICENSE
+UNKNOWN [1991 by the Massachusetts Institute of Technology]: install-sh
+UNKNOWN [1992, 93, 94, 95, 96 Free Software Foundation, Inc]: configure
--- vrflash-0.24.orig/debian/compat
+++ vrflash-0.24/debian/compat
@@ -0,0 +1 @@
+6
--- vrflash-0.24.orig/debian/control
+++ vrflash-0.24/debian/control
@@ -0,0 +1,18 @@
+Source: vrflash
+Section: otherosfs
+Priority: extra
+Maintainer: Jonas Smedegaard <dr@jones.dk>
+Build-Depends: cdbs (>= 0.4.39), autotools-dev, debhelper (>= 5.0.44), quilt, patchutils (>= 0.2.25), dh-buildinfo, devscripts (>= 2.10.7)
+Standards-Version: 3.7.3
+Vcs-Git: git://git.debian.org/git/collab-maint/vtflash.git
+Vcs-Browser: http://git.debian.org/?p=collab-maint/vrflash.git;a=summary
+Homepage: http://sourceforge.net/projects/agos
+
+Package: vrflash
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: tool to flash kernels and romdisks to Agenda VR
+ The Agenda VR is a handheld computer that runs Linux. VRFlash
+ communicates with the Agenda's boot monitor (PMON) over a serial
+ line to install new software on the device. The kernel and the
+ root image can be upgraded this way.
--- vrflash-0.24.orig/debian/README.cdbs-tweaks
+++ vrflash-0.24/debian/README.cdbs-tweaks
@@ -0,0 +1,111 @@
+CDBS tweak
+==========
+
+CDBS is great. In some corner cases, however, some parts of CDBS
+sometimes needs a few tweaks to work optimally.
+
+This is a collection of such tweaks. The goal is for these tweaks to be
+absorbed into upstream CDBS. We just haven't found time yet to discuss
+them at the CDBS developers' mailinglist. And possible we do not all
+agree that the tweaks are so great - therefore this "staging area".
+
+If you found this file below debian/ subdir in a source package, most
+probably only a subset of the below mentioned tweaks are relevant and
+have been shipped with the package. The repository of all these tweaks
+is here: svn://svn.debian.org/build-common/people/js/overlay/
+
+Web access: http://svn.debian.org/wsvn/build-common/people/js/overlay/
+
+
+
+New buildinfo rule
+------------------
+
+See package description for "buildinfo" for more info.
+
+
+
+Improved support for multiple compilations
+------------------------------------------
+
+Create and clean builddir _after_ resolving per-package DEB_BUILDDIR.
+
+Honour per-package DEB_BUILDDIR in makefile and autotools classes.
+
+Support multiple build flavors in makefile and autotools classes.
+
+
+
+Various improvements to python-distutils class
+----------------------------------------------
+
+Use full path to Python interpreter (Python Policy section 1.3.2).
+
+Add CDBS_BUILD_DEPENDS to old policy method.
+
+Fix CDBS_BUILD_DEPENDS in new policy methods to only depend on debhelper
+when actually used.
+
+Fix DEB_PYTHON_SIMPLE_PACKAGES sometimes installed twice (and only one
+of them honouring DEB_PYTHON_COMPILE_VERSION).
+
+Unify install path using new DEB_PYTHON_DESTDIR.
+
+Quote install path.
+
+
+
+New python-autotools class
+--------------------------
+
+Handle autotools-based Python packaging.
+
+
+
+New python-sugar class
+----------------------
+
+Handle packaging of Sugar activities.
+
+
+
+New copyright-check rule
+------------------------
+
+Refuse to build if the source is found to contain different copyright
+info than earlier builds.
+
+
+
+New kernelpatches rule
+----------------------
+
+Small wrapper around dh-kpatches, taking care of build-dependencies too.
+
+
+
+New routines for handling upstream tarball
+------------------------------------------
+
+Rules and variables to help downloading, validating and repackaging
+upstream tarball.
+
+Implements the rules print-version and get-orig-source commonly used
+for group-maintained packages with Debian-specific patches maintained in
+SVN or some other VCS, and automated fetching virgin upstream tarball
+(possibly massaged after download e.g. to strip non-DFSG material).
+
+
+
+Support for custom BTS info
+---------------------------
+
+Include BTS control info found in debian/*.bts files, or alternatively
+redirect bug reports to the email address defined in DEB_BTS_EMAIL.
+
+
+
+New dict class
+--------------
+
+Rules for packaging ispell, aspell, myspell and wordlist dictionaries.
--- vrflash-0.24.orig/debian/vrflash.1
+++ vrflash-0.24/debian/vrflash.1
@@ -0,0 +1,215 @@
+.TH vrflash 1 "11 December 2002"
+.SH NAME
+vrflash \- install new software on an Agenda VR handheld computer
+.SH SYNOPSIS
+.LP
+.B vrflash
+.RB [ \-l ]
+.RB [ \-r ]
+.RB [ \-s
+.IR serialport ]
+.RB [ \-t
+.IR tempdir ]
+.RB [ \-C ]
+.RB [ \-D ]
+.RB [ \-R ]
+.RB [ \-X ]
+.I file
+.I offset
+.RB "..."
+.br
+.B vrflash
+.RB [ \-v ]
+.br
+.B vrflash
+.RB [ \-h ]
+.SH DESCRIPTION
+VRFlash is a utility for flashing software such as kernels and root
+images to the Agenda VR (a handheld computer that runs Linux).
+VRFlash communicates with the Agenda's boot monitor (PMON) over
+a serial line. It takes image you specified as the
+.I file
+argument and uploads it to the Agenda, where it is stored in
+dynamic RAM. When the upload is complete, VRFlash directs the
+PMON to store the image in flash memory at the specified
+.IR offset .
+.LP
+The
+.I offset
+argument can have the special values
+.RS
+.B kernel
+\- default kernel offset
+.br
+.B romdisk
+or
+.B rootdisk
+\- default root image offset
+.br
+.B pmon
+\- default boot loader offset
+.br
+.B cramfs
+\- default root image offset when using cramfs
+.br
+.RE
+or it can be specified as a
+hexadecimal offset starting with
+.BR 0x .
+.LP
+Multiple files and offsets can be specified in pairs.
+.B vrflash
+will upload each of them in the order they are given.
+.LP
+Flash procedure:
+.TP
+1.
+Make sure the Agenda has a fresh set of batteries. Flashing takes a long
+time and uses a lot of power.
+.TP
+2.
+Make a backup of the user information on the Agenda, if needed.
+.TP
+3.
+Connect the Agenda to your computer's serial port, using the QuickSync cable.
+.TP
+4.
+Start
+.B vrflash
+with the options you need.
+.TP
+5.
+Reset the Agenda by pressing the button at the back (below the battery case).
+.B vrflash
+will respond to the PMON's boot prompt and start the procedure.
+.SH OPTIONS
+.TP
+.B \-h
+Show usage information.
+.TP
+.B \-l
+Capture traffic on the serial port to
+.BR ./capture.log .
+.TP
+.B \-r
+Restart the Agenda after loading.
+.TP
+.BI "\-s " "serial port"
+The serial device to open. The default is
+.BR ttyS0 .
+The device must be in
+.BR /dev .
+.TP
+.BI "\-t " tempdir
+Use
+.I tempdir
+as the temporary directory for split files. The default is
+.BR /tmp .
+.TP
+.B \-v
+Show version and usage information.
+.TP
+.B \-C
+Option for experts to disable the kernel/romdisk size check.
+Normally
+.B vrflash
+refuses to upload a kernel or romdisk that is too large to fit in the
+space reserved for it in the default Agenda memory map. With the
+.B \-C
+option you can upload oversize images, which will probably not work
+unless you made special arrangements.
+.TP
+.B \-D
+Option for experts to disable the PMON overwrite check.
+Normally
+.B vrflash
+refuses to upload images that would overwrite the Agenda's boot monitor,
+because damage to the boot monitor could make further flashing impossible.
+You can use this option if you with to replace the boot monitor, but be
+aware that that has a significant chance of turning your Agenda into
+a paperweight.
+.TP
+.B \-R
+Restore defaults after flashing. This clears the user information
+area of the Agenda, and is often a necessary step before using a new
+kernel and root image. It erases all the user information such as
+contacts and to-do entries, so make sure you have a backup.
+.TP
+.B \-X
+Do not load xmodem-load.srec. Normally vrflash first uploads xmodem
+code to the Agenda (into RAM) to speed up the rest of the transfer.
+This step can be skipped if you know the code is already there from
+a previous vrflash command.
+.SH NOTES
+VRFlash expects the images to be in straight binary format. Sometimes
+images are distributed in SREC format, in which case you must first
+convert them with a command like:
+.br
+.BI "mipsel\-linux\-objcopy \-Isrec \-Obinary " file .srec " file"
+.LP
+Make sure the serial device is free for VRFlash's use. Minicom or
+pppd (or any other serial application) should not be running.
+.SH EXAMPLES
+Suppose you want to install a kernel image
+.RB ' vmlinux '
+and a root image
+.RB ' romdisk ',
+and your Agenda is connected to serial port
+.BR /dev/ttyS1 ,
+and you want to capture all the input and output to
+.BR ./capture.log ,
+and then you want to restart the Agenda with the new kernel and root image.
+This can be done with the
+.B vrflash
+command:
+.br
+.B "vrflash \-s ttyS1 \-l \-r ./vmlinux kernel ./romdisk romdisk"
+.SH TROUBLESHOOTING
+If you run into trouble, try some of the following things:
+.LP
+Check your command line. Especially check the offset you provided.
+The number of zeroes in the
+.I offset
+field is easy to get wrong.
+.LP
+Make sure that nothing else is running on the serial port. Common
+culprits include
+.B minicom
+and
+.BR pppd .
+.LP
+If your command is right, try running
+.B vrflash
+again. Sometimes the PMON prompt is left in such a state that VRFlash
+can't cope on startup. Running it a second time almost always fixes this.
+.LP
+Power off your Agenda, and use
+.B minicom
+to get to the PMON prompt. Then exit minicom and run your
+.B vrflash
+command.
+.LP
+Make sure you load xmodem-load.srec at least once after each reset of
+your Agenda. Do this by not using the
+.B \-X
+option.
+.LP
+Check the permissions on the serial port. You need read and write access.
+On Debian systems you can do this by adding yourself to the
+.B tty
+group in
+.BR /etc/group ,
+and then logging in again or running newgrp.
+.SH BUGS
+See /usr/share/doc/vrflash/troubleshooting.txt for instructions on
+reporting bugs in
+.BR vrflash .
+.SH AUTHOR
+The primary author is Jeff Carneal. See /usr/share/doc/vrflash/THANKS
+for others.
+.LP
+This manual page was provided by Richard Braakman <dark@xs4all.nl>,
+with text based on existing documentation.
+.SH "SEE ALSO"
+http://sourceforge.net/projects/agos for information about the Agenda tools,
+and /usr/share/doc/vrflash/*.txt for more information about VRFlash.
--- vrflash-0.24.orig/debian/changelog
+++ vrflash-0.24/debian/changelog
@@ -0,0 +1,87 @@
+vrflash (0.24-6) unstable; urgency=low
+
+ * Fix watch file to use qa.debian.org redirector. Bump to version 3.
+ * Packaging moved to collab-maint Git at Alioth. Update VCS-* hints.
+ * Add Homepage field to debian/control(.in).
+
+ -- Jonas Smedegaard <dr@jones.dk> Thu, 03 Jul 2008 09:15:12 +0200
+
+vrflash (0.24-5) unstable; urgency=low
+
+ * Update cdbs tweaks:
+ + Use official autotools-vars.mk (avoiding cross-compiling on same
+ host got fixed some years ago).
+ + Use patchsys-quilt.mk (not simple-patchsys.mk).
+ + Add local snippets upstream-tarball.mk, copyright-check.mk and
+ buildinfo.mk (and stop invoking dh-buildinfo manually). Document
+ the snippets in README.cdbs-tweaks in source package. Add
+ copyright-hints.
+ + Setup debian/control.in to us semi-auto-update feature. Declare
+ (and cleanup duplicates of) build-dependencies in debian/rules.
+ * Bump debhelper compatibility level to 6 (was 4).
+ * Depend on ${misc:Depends}.
+ * Preserve *.orig noise in upstream source to please tools like
+ autopkgtest (see bug#446290).
+ * Rewrite debian/copyright to use machine-readable format.
+ * Bump claimed policy compliance to standards-version 3.7.3.
+ * Semi-auto-update debian/control to update build-dependencies:
+ DEB_AUTO_UPDATE_DEBIAN_CONTROL=yes fakeroot debian/rules clean
+
+ -- Jonas Smedegaard <dr@jones.dk> Wed, 02 Jul 2008 20:52:37 +0200
+
+vrflash (0.24-4) unstable; urgency=low
+
+ * Adopting package (closes: Bug#171087).
+ * Switch to cdbs, debhelper and dh_buildinfo (fixes Bug#197115, but
+ keep it open until Richard Braakmans suggestion has been tried out).
+ * Hack Makefile.in to properly install (instead of doing it manually).
+ * Add build-dependencies.
+ * Add watch file (although the SF project seems dead :-( ).
+ * Standards-version 3.6.0.
+ * Still UNTESTED - I have an Agenda VR3 and intend to hack on it (so
+ want this package alive), but currently lack a serial adapter for my
+ Apple TiBook (which also means I can test the suggestion in
+ Bug#197115) to hook into it...
+
+ -- Jonas Smedegaard <dr@jones.dk> Fri, 25 Jul 2003 10:11:47 +0200
+
+vrflash (0.24-3) unstable; urgency=low
+
+ * Orphaned. I can't maintain it because I no longer have the hardware.
+ I was going to have it removed but an actual user asked me not to.
+ Upstream hasn't responded to patches in a couple of months.
+ * Include <string.h> in xmodem.c and progress.c, to bring a prototype
+ for memset() in scope.
+
+ -- Richard Braakman <dark@xs4all.nl> Thu, 12 Jun 2003 03:04:18 +0300
+
+vrflash (0.24-2) unstable; urgency=low
+
+ * UNTESTED because my Agenda VR3 is broken.
+ Still looking for a new maintainer.
+ * Rearranged the error checking in the read loop in etxack.c. The old
+ version didn't make sense. Closes: #177297.
+ * Removed $(STRIP) from LDFLAGS. Strip when installing into debian/tmp.
+
+ -- Richard Braakman <dark@xs4all.nl> Tue, 29 Apr 2003 11:43:36 +0300
+
+vrflash (0.24-1) unstable; urgency=low
+
+ * UNTESTED because my Agenda VR3 is broken.
+ * New upstream version, taken from http://sourceforge.net/projects/agos
+ because the original upstream (Agenda Computing, Inc) is gone.
+ Significant changes include:
+ - Support for sdram pmon
+ - Support for agendas with 16MB RAM.
+ * Drop handling of /usr/doc symlink.
+ * Standards-Version 3.5.8.
+ * debug -> noopt change: Build with debug support by default.
+
+ -- Richard Braakman <dark@xs4all.nl> Thu, 12 Dec 2002 06:01:32 +0200
+
+vrflash (0.20-1) unstable; urgency=low
+
+ * First packaging.
+ * Wrote manpage for vrflash.
+
+ -- Richard Braakman <dark@xs4all.nl> Sat, 20 Oct 2001 11:31:37 +0300
--- vrflash-0.24.orig/debian/watch
+++ vrflash-0.24/debian/watch
@@ -0,0 +1,4 @@
+# Run the "uscan" command to check for upstream updates and more.
+version=3
+# use qa.debian.org redirector; see man uscan
+http://sf.net/agos/vrflash-([\d+\.]+|\d+)\.tar\.gz
--- vrflash-0.24.orig/debian/cdbs/1/rules/upstream-tarball.mk
+++ vrflash-0.24/debian/cdbs/1/rules/upstream-tarball.mk
@@ -0,0 +1,139 @@
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2007-2008 Jonas Smedegaard <dr@jones.dk>
+# Description: Convenience rules for dealing with upstream tarballs
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+_cdbs_scripts_path ?= /usr/lib/cdbs
+_cdbs_rules_path ?= /usr/share/cdbs/1/rules
+_cdbs_class_path ?= /usr/share/cdbs/1/class
+
+ifndef _cdbs_rules_upstream_tarball
+_cdbs_rules_upstream_tarball := 1
+
+include $(_cdbs_rules_path)/buildvars.mk$(_cdbs_makefile_suffix)
+
+CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), cdbs (>= 0.4.39)
+
+# Prefix for upstream location of all upstream tarballs (mandatory!)
+#DEB_UPSTREAM_URL =
+
+DEB_UPSTREAM_PACKAGE = $(DEB_SOURCE_PACKAGE)
+DEB_UPSTREAM_TARBALL_VERSION = $(if $(strip $(DEB_UPSTREAM_REPACKAGE_EXCLUDE)),$(DEB_UPSTREAM_VERSION:$(DEB_UPSTREAM_REPACKAGE_DELIMITER)$(DEB_UPSTREAM_REPACKAGE_TAG)=),$(DEB_UPSTREAM_VERSION))
+DEB_UPSTREAM_TARBALL_EXTENSION = tar.gz
+# Checksum to ensure integrity of downloadeds using get-orig-source (optional)
+#DEB_UPSTREAM_TARBALL_MD5 =
+
+DEB_UPSTREAM_WORKDIR = ../tarballs
+
+# Perl regexp to change locally used string into that in upstream URL and srcdir
+#DEB_UPSTREAM_TARBALL_VERSION_MANGLE
+cdbs_upstream_tarball_version_mangled = $(if $(strip $(DEB_UPSTREAM_TARBALL_VERSION_MANGLE)),$(shell echo '$(DEB_UPSTREAM_TARBALL_VERSION)' | perl -pe '$(DEB_UPSTREAM_TARBALL_VERSION_MANGLE)'),$(DEB_UPSTREAM_TARBALL_VERSION))
+
+# Base filename (without extension) as used in upstream URL
+DEB_UPSTREAM_TARBALL_BASENAME = $(DEB_UPSTREAM_PACKAGE)-$(cdbs_upstream_tarball_version_mangled)
+
+# Base directory within tarball
+DEB_UPSTREAM_TARBALL_SRCDIR = $(DEB_UPSTREAM_PACKAGE)-$(cdbs_upstream_tarball_version_mangled)
+
+# Space-delimited list of directories and files to strip (optional)
+#DEB_UPSTREAM_REPACKAGE_EXCLUDE = CVS .cvsignore doc/rfc*.txt doc/draft*.txt
+DEB_UPSTREAM_REPACKAGE_TAG = dfsg
+DEB_UPSTREAM_REPACKAGE_DELIMITER = ~
+
+cdbs_upstream_tarball = $(DEB_UPSTREAM_TARBALL_BASENAME).$(DEB_UPSTREAM_TARBALL_EXTENSION)
+cdbs_upstream_local_tarball = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_TARBALL_VERSION).orig.$(if $(findstring $(DEB_UPSTREAM_TARBALL_EXTENSION),tgz),tar.gz,$(DEB_UPSTREAM_TARBALL_EXTENSION))
+cdbs_upstream_repackaged_basename = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_TARBALL_VERSION)$(DEB_UPSTREAM_REPACKAGE_DELIMITER)$(DEB_UPSTREAM_REPACKAGE_TAG).orig
+cdbs_upstream_uncompressed_tarball = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_TARBALL_VERSION).orig.tar
+
+# # These variables are deprecated
+_cdbs_deprecated_vars += DEB_UPSTREAM_TARBALL DEB_UPSTREAM_LOCAL_TARBALL DEB_UPSTREAM_REPACKAGE_TARBALL
+_cdbs_deprecated_vars += DEB_UPSTREAM_REPACKAGE_EXCLUDES
+DEB_UPSTREAM_REPACKAGE_EXCLUDE += $(DEB_UPSTREAM_REPACKAGE_EXCLUDES)
+
+print-version:
+ @@echo "Debian version: $(DEB_VERSION)"
+ @@echo "Upstream version: $(DEB_UPSTREAM_TARBALL_VERSION)"
+
+get-orig-source:
+ @@dh_testdir
+ @@mkdir -p "$(DEB_UPSTREAM_WORKDIR)"
+
+ @if [ ! -s "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ] ; then \
+ if [ -f "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ] ; then \
+ rm "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ; \
+ fi ; \
+ echo "Downloading $(cdbs_upstream_local_tarball) from $(DEB_UPSTREAM_URL)/$(cdbs_upstream_tarball) ..." ; \
+ wget -nv -T10 -t3 -O "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" "$(DEB_UPSTREAM_URL)/$(cdbs_upstream_tarball)" ; \
+ else \
+ echo "Upstream source tarball have been already downloaded: $(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ; \
+ fi
+
+ @md5current=`md5sum "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" | sed -e 's/ .*//'`; \
+ if [ -n "$(DEB_UPSTREAM_TARBALL_MD5)" ] ; then \
+ if [ "$$md5current" != "$(DEB_UPSTREAM_TARBALL_MD5)" ] ; then \
+ echo "Expecting upstream tarball md5sum $(DEB_UPSTREAM_TARBALL_MD5), but $$md5current found" ; \
+ echo "Upstream tarball md5sum is NOT trusted! Possible upstream tarball forge!" ; \
+ echo "Purging downloaded file. Try new download." ; \
+ rm -f "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ; \
+ false ; \
+ else \
+ echo "Upstream tarball is trusted!" ; \
+ fi; \
+ else \
+ echo "Upstream tarball NOT trusted (current md5sum is $$md5current)!" ; \
+ fi
+
+# TODO: Rewrite using make variables like cdbs_upstream_unpack_cmd and
+# DEB_UPSTREAM_SUPPORTED_COMPRESSIONS (recent dpkg supports bz2)
+ @untar="tar -x -C"; \
+ case "$(cdbs_upstream_local_tarball)" in \
+ *.tar.gz) unpack="gunzip -c";; \
+ *.tar.bz2) unpack="bunzip2 -c"; uncompress="bunzip2";; \
+ *.tar.Z) unpack="uncompress -c"; uncompress="uncompress";; \
+ *.zip) unpack="unzip -q"; uncompress="false"; untar="-d"; nopipe="true";; \
+ *.tar) unpack="cat"; uncompress="true";; \
+ *) echo "Unknown extension for upstream tarball $(cdbs_upstream_local_tarball)"; false;; \
+ esac && \
+ if [ -n "$(strip $(DEB_UPSTREAM_REPACKAGE_EXCLUDE))" ] || [ "$$uncompress" = "false" ]; then \
+ echo "Repackaging tarball ..." && \
+ mkdir -p "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" && \
+ if [ -n "$$nopipe" ]; then \
+ $$unpack "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" \
+ $$untar "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" $(patsubst %,--exclude='%',$(DEB_UPSTREAM_REPACKAGE_EXCLUDE)); \
+ else \
+ $$unpack "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" \
+ | $$untar "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" $(patsubst %,--exclude='%',$(DEB_UPSTREAM_REPACKAGE_EXCLUDE)); \
+ fi && \
+ if [ "$(DEB_UPSTREAM_TARBALL_SRCDIR)" != "$(cdbs_upstream_repackaged_basename)" ]; then \
+ mv -T "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)/$(DEB_UPSTREAM_TARBALL_SRCDIR)" "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)/$(cdbs_upstream_repackaged_basename)"; \
+ fi && \
+ if [ -n "$(strip $(DEB_UPSTREAM_REPACKAGE_EXCLUDE))" ]; then \
+ GZIP=-9 tar -b1 -czf "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_repackaged_basename).tar.gz" -C "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" "$(cdbs_upstream_repackaged_basename)"; \
+ else \
+ GZIP=-9 tar -b1 -czf "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_uncompressed_tarball).gz" -C "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" "$(cdbs_upstream_repackaged_basename)"; \
+ fi && \
+ echo "Cleaning up" && \
+ rm -rf "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)"; \
+ elif [ -n "$$uncompress" ]; then \
+ echo "Recompressing tarball ..." && \
+ $$uncompress "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)"; \
+ gzip -9 "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_uncompressed_tarball)"; \
+ fi
+
+DEB_PHONY_RULES += print-version get-orig-source
+
+endif
--- vrflash-0.24.orig/debian/cdbs/1/rules/copyright-check.mk
+++ vrflash-0.24/debian/cdbs/1/rules/copyright-check.mk
@@ -0,0 +1,93 @@
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2005-2008 Jonas Smedegaard <dr@jones.dk>
+# Description: Check for changes to copyright notices in source
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+_cdbs_scripts_path ?= /usr/lib/cdbs
+_cdbs_rules_path ?= /usr/share/cdbs/1/rules
+_cdbs_class_path ?= /usr/share/cdbs/1/class
+
+ifndef _cdbs_rules_copyright-check
+_cdbs_rules_copyright-check := 1
+
+include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
+
+CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), devscripts (>= 2.10.7)
+
+# Single regular expression for files to include or ignore
+DEB_COPYRIGHT_CHECK_REGEX = .*
+DEB_COPYRIGHT_CHECK_IGNORE_REGEX = ^(debian/.*|(.*/)?config\.(guess|sub|rpath)(\..*)?)$
+
+pre-build:: debian/stamp-copyright-check
+
+debian/stamp-copyright-check:
+ @echo 'Scanning upstream source for new/changed copyright notices (except debian subdir!)...'
+
+# Perl in shell in make requires extra care:
+# * Single-quoting ('...') protects against shell expansion
+# * Double-dollar ($$) expands to plain dollar ($) in make
+ licensecheck -c '$(DEB_COPYRIGHT_CHECK_REGEX)' -r --copyright -i '$(DEB_COPYRIGHT_CHECK_IGNORE_REGEX)' * \
+ | LC_ALL=C perl -e \
+ '$$n=0; while (<>) {'\
+ ' s/[^[:print:]]//g;'\
+ ' if (/^([^:\s][^:]+):[\s]+(\S.*?)\s*$$/) {'\
+ ' $$files[$$n]{name}=$$1;'\
+ ' $$files[$$n]{license}=$$2;'\
+ ' };'\
+ ' if (/^\s*\[Copyright:\s*(\S.*?)\s*\]/) {'\
+ ' $$files[$$n]{copyright}=$$1;'\
+ ' };'\
+ ' /^$$/ and $$n++;'\
+ '};'\
+ 'foreach $$file (@files) {'\
+ ' $$file->{license} =~ s/\s*\(with incorrect FSF address\)//;'\
+ ' $$file->{license} =~ s/\s+\(v([^)]+) or later\)/-$$1+/;'\
+ ' $$file->{copyright} =~ s/(?<=(\b\d{4}))(?{$$y=$$^N})\s*[,-]\s*((??{$$y+1}))\b/-$$2/g;'\
+ ' $$file->{copyright} =~ s/(?<=\b\d{4})\s*-\s*\d{4}(?=\s*-\s*(\d{4})\b)//g;'\
+ ' $$pattern = "$$file->{license} [$$file->{copyright}]";'\
+ ' push @{ $$patternfiles{"$$pattern"} }, $$file->{name};'\
+ '};'\
+ 'foreach $$pattern ( sort {'\
+ ' @{$$patternfiles{$$b}} <=> @{$$patternfiles{$$a}}'\
+ ' ||'\
+ ' $$a cmp $$b'\
+ ' } keys %patternfiles ) {'\
+ ' print "$$pattern: ", join("\n\t", sort @{ $$patternfiles{$$pattern} }), "\n";'\
+ '};'\
+ > debian/copyright_newhints
+ @patterncount="`cat debian/copyright_newhints | sed 's/^[^:]*://' | LANG=C sort -u | grep . -c -`"; \
+ echo "Found $$patterncount different copyright and licensing combinations."
+ @if [ ! -f debian/copyright_hints ]; then touch debian/copyright_hints; fi
+ @newstrings=`diff -u debian/copyright_hints debian/copyright_newhints | sed '1,2d' | egrep '^\+' - | sed 's/^\+//'`; \
+ if [ -n "$$newstrings" ]; then \
+ echo "WARNING: The following new or changed copyright notices discovered:"; \
+ echo; \
+ echo "$$newstrings"; \
+ echo; \
+ echo "To fix the situation please do the following:"; \
+ echo " 1) Investigate the above changes and update debian/copyright as needed"; \
+ echo " 2) Replace debian/copyright_hints with debian/copyright_newhints"; \
+ else \
+ echo 'No new copyright notices found - assuming no news is good news...'; \
+ rm -f debian/copyright_newhints; \
+ fi
+ touch $@
+
+clean::
+ rm -f debian/stamp-copyright-check
+
+endif
--- vrflash-0.24.orig/debian/cdbs/1/rules/buildinfo.mk
+++ vrflash-0.24/debian/cdbs/1/rules/buildinfo.mk
@@ -0,0 +1,40 @@
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2004-2006 Jonas Smedegaard <dr@jones.dk>
+# Description: Generate and include build information
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+_cdbs_scripts_path ?= /usr/lib/cdbs
+_cdbs_rules_path ?= /usr/share/cdbs/1/rules
+_cdbs_class_path ?= /usr/share/cdbs/1/class
+
+ifndef _cdbs_rules_buildinfo
+_cdbs_rules_buildinfo = 1
+
+include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
+
+CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), dh-buildinfo
+
+common-install-arch common-install-indep:: debian/stamp-buildinfo
+
+debian/stamp-buildinfo:
+ dh_buildinfo
+ touch debian/stamp-buildinfo
+
+clean::
+ rm -f debian/stamp-buildinfo
+
+endif
--- vrflash-0.24.orig/debian/patches/01_hav_error_checking_make_sense.diff
+++ vrflash-0.24/debian/patches/01_hav_error_checking_make_sense.diff
@@ -0,0 +1,36 @@
+--- vrflash-0.24.orig/etxack.c
++++ vrflash-0.24/etxack.c
+@@ -45,7 +45,12 @@
+
+ while(1) {
+ if((ret = read(fd, &c, 1)) != 1) {
+- vr_error("Error: ex_send read '0x%x' instead of ACK", c);
++ if(ret < 0 && errno == EAGAIN) {
++ continue;
++ }
++
++ vr_error("Error: ex_send unable to read from serial port");
++ return -1;
+ }
+ /*
+ * Mask out parity.
+@@ -58,17 +63,11 @@
+ break;
+ }
+
+- if(c == EOF) {
+- if(errno == EAGAIN) {
+- continue;
+- }
+-
+- vr_error("Error: ex_send unable to read from serial port");
+- return -1;
+- }
+
+ if(c == NAK) {
+ vr_error("Error: ex_send received NAK. Aborting");
++ } else {
++ vr_error("Error: ex_send read '0x%x' instead of ACK", c);
+ }
+ }
+ }
--- vrflash-0.24.orig/debian/patches/02_include_string.h.diff
+++ vrflash-0.24/debian/patches/02_include_string.h.diff
@@ -0,0 +1,20 @@
+--- vrflash-0.24.orig/progress.c
++++ vrflash-0.24/progress.c
+@@ -21,6 +21,7 @@
+ #include <stdio.h>
+ #include <sys/time.h>
+ #include <unistd.h>
++#include <string.h>
+ #include "progress.h"
+
+ PM pmeter;
+--- vrflash-0.24.orig/xmodem.c
++++ vrflash-0.24/xmodem.c
+@@ -25,6 +25,7 @@
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <signal.h>
++#include <string.h>
+ #include "xmodem.h"
+ #include "vrerror.h"
+ #include "progress.h"
--- vrflash-0.24.orig/debian/patches/03_install_into_DESTDIR.diff
+++ vrflash-0.24/debian/patches/03_install_into_DESTDIR.diff
@@ -0,0 +1,18 @@
+--- vrflash-0.24.orig/Makefile.in
++++ vrflash-0.24/Makefile.in
+@@ -45,9 +45,12 @@
+ %.o: %.c %.h config.h
+ $(CC) $(CFLAGS) $(DEFS) -c $< -o $@
+
+-install: all
+- $(INSTALL) -m 755 vrflash $(bindir)
+-
++install: all installdirs
++ $(INSTALL) -m 755 vrflash $(DESTDIR)$(bindir)
++
++installdirs:
++ $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir)
++
+ uninstall:
+ -rm -f $(bindir)/vrflash
+
--- vrflash-0.24.orig/debian/patches/series
+++ vrflash-0.24/debian/patches/series
@@ -0,0 +1,3 @@
+01_hav_error_checking_make_sense.diff
+02_include_string.h.diff
+03_install_into_DESTDIR.diff