--- ganeti-1.2.6.orig/debian/compat
+++ ganeti-1.2.6/debian/compat
@@ -0,0 +1 @@
+5
--- ganeti-1.2.6.orig/debian/rules
+++ ganeti-1.2.6/debian/rules
@@ -0,0 +1,28 @@
+#!/usr/bin/make -f
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
+include /usr/share/cdbs/1/class/autotools.mk
+include /usr/share/cdbs/1/class/makefile.mk
+
+# Add here any variable or target overrides you need.
+DEB_CONFIGURE_EXTRA_FLAGS = \
+  --prefix=/usr \
+  --localstatedir=/var \
+  --sysconfdir=/etc \
+  --with-export-dir=/var/lib/ganeti/export \
+  --with-iallocator-search-path=/usr/local/lib/ganeti/iallocators,/usr/lib/ganeti/iallocators \
+  --with-os-search-path=/srv/ganeti/os,/usr/local/lib/ganeti/os,/usr/lib/ganeti/os,/usr/share/ganeti/os
+
+#DEB_DH_INSTALLINIT_ARGS = --no-start
+
+clean::
+	rm -f debian/ganeti.init
+	rm -f debian/ganeti.cron.d
+
+build/ganeti::
+	cp doc/examples/ganeti.cron debian/ganeti.cron.d
+	cp doc/examples/ganeti.initd debian/ganeti.init
+
+install/ganeti::
+	dh_pysupport -pganeti
+	install -m 0755 doc/examples/dumb-allocator debian/ganeti/usr/lib/ganeti/iallocators/dumb
--- ganeti-1.2.6.orig/debian/watch
+++ ganeti-1.2.6/debian/watch
@@ -0,0 +1,6 @@
+# format version number, currently 3; this line is compulsory!
+version=3
+
+# code.google.com/p/$project/downloads/list has links to $project.googlecode.com/files/
+http://code.google.com/p/ganeti/downloads/list \
+    http://ganeti.googlecode.com/files/ganeti-(\d+\.\d+[\d.]*)\.tar\.gz
--- ganeti-1.2.6.orig/debian/ganeti.examples
+++ ganeti-1.2.6/debian/ganeti.examples
@@ -0,0 +1 @@
+doc/examples/batcher-instances.json
--- ganeti-1.2.6.orig/debian/changelog
+++ ganeti-1.2.6/debian/changelog
@@ -0,0 +1,116 @@
+ganeti (1.2.6-3) unstable; urgency=low
+
+  * Cherry-pick commit 2461 from upstream, fixing (yet again, hopefully 
+    for the last time) compatibility with twisted 8.1 (Closes: #510965)
+  * Fix the watch regexp to ignore non-stable releases
+
+ -- Iustin Pop <iusty@k1024.org>  Tue, 10 Feb 2009 20:02:46 +0100
+
+ganeti (1.2.6-2) unstable; urgency=low
+
+  * Update recommends for the current packages in unstable and
+    testing (Closes: #474452)
+
+ -- Iustin Pop <iusty@k1024.org>  Wed, 10 Dec 2008 09:47:27 +0100
+
+ganeti (1.2.6-1) unstable; urgency=low
+
+  * New upstream release (bugfixes and a couple of small new features)
+  * Include the batcher example file
+
+ -- Iustin Pop <iusty@k1024.org>  Wed, 08 Oct 2008 08:52:59 +0200
+
+ganeti (1.2.5-1) unstable; urgency=low
+
+  * New upstream release, fixing compatibility with the current versions of
+    twisted (Closes: #487752)
+  * Fix watch file (was picking up other archives too)
+  * Fix some lintian warnings about debian/copyright
+  * Remove dependency on fping (new upstream removes all uses of fping)
+  * Add DM-Upload-Allowed: yes to the control file
+  * Add a recommend on ganeti-instance-deboostrap, now that it is packaged
+
+ -- Iustin Pop <iusty@k1024.org>  Wed, 23 Jul 2008 09:24:07 +0200
+
+ganeti (1.2.4-2) unstable; urgency=low
+
+  * Check new policy and bump up standards version
+  * Depend on python-openssl rather than python-pyopenssl
+
+ -- Guido Trotter <ultrotter@debian.org>  Sun, 15 Jun 2008 09:05:37 +0100
+
+ganeti (1.2.4-1) unstable; urgency=low
+
+  * New upstream release
+  * Change the default iallocator search path to support 'local' allocators
+  * Ship the 'dumb' instance allocator
+  * Call dh_pysupport in 'install' rather than 'binary-install'
+  * Remove 'cronjob-check-executable.patch' included upstream
+
+ -- Guido Trotter <ultrotter@debian.org>  Sat, 14 Jun 2008 15:57:27 +0100
+
+ganeti (1.2.3-2) unstable; urgency=low
+
+  * Fix 'crontab should check for executable presence' (Closes: #466611)
+
+ -- Iustin Pop <iusty@k1024.org>  Fri, 22 Feb 2008 08:25:44 +0100
+
+ganeti (1.2.3-1) unstable; urgency=low
+
+  * New upstream version
+
+ -- Guido Trotter <ultrotter@debian.org>  Wed, 20 Feb 2008 12:56:08 +0000
+
+ganeti (1.2.2-2) unstable; urgency=medium
+
+  * Move mdadm from depends to recommends: it's only useful with drbd0.7
+  * Actually install example cron job as /etc/cron.d/ganeti
+    The example cron job was copied to the wrong place and thus ignored.
+  * Urgency medium because it was important for the cronjob to be there.
+
+ -- Guido Trotter <ultrotter@debian.org>  Wed, 13 Feb 2008 18:06:57 +0000
+
+ganeti (1.2.2-1) unstable; urgency=low
+
+  [ Iustin Pop ]
+  * Switch python modules from hand-crafted to pysupport
+  * Add the Vcs-Svn and Vcs-Browser control fields
+  * Remove the no-start of the daemon(s) on upgrades since we need to restart
+    if the source code has changed; the daemons will not do anything if the
+    node is not joined to a cluster
+  * Extend the OS search path with /usr/share/ganeti/os in order to accommodate
+    arch all OS packages
+
+  [ Guido Trotter ]
+  * New upstream version
+  * Add the option of drbd8-module-source to suggests
+  * Make drbd8 the first choice in recommends/suggests
+  * Add the Homepage control field
+
+  [ Leonardo Rodrigues de Mello ]
+  * Fix dependency on SimpleJSON
+
+ -- Guido Trotter <ultrotter@debian.org>  Wed, 30 Jan 2008 15:21:13 +0100
+
+ganeti (1.2.0-1) unstable; urgency=low
+
+  [ Guido Trotter ]
+  * New upstream release
+  * Remove manpage patch, which has been included upstream
+  * Bump up Standards Version (no changes needed)
+
+  [ Leonardo Rodrigues de Mello ]
+  * Fix dependency on xen-linux-system to allow the amd64 version.
+
+ -- Guido Trotter <ultrotter@debian.org>  Thu, 06 Dec 2007 13:34:17 +0000
+
+ganeti (1.2~b3-1) unstable; urgency=low
+
+  * Initial Release (closes: #440359)
+  * Start off from leonardo's experimental packages
+  * Change maintainer to the Debian Ganeti Team
+  * Use ganeti's native cron and init.d files for debian
+  * Make os and export paths FHS compliant
+  * ganeti is arch: all, not any
+
+ -- Guido Trotter <ultrotter@debian.org>  Wed, 28 Nov 2007 14:33:07 +0000
--- ganeti-1.2.6.orig/debian/copyright
+++ ganeti-1.2.6/debian/copyright
@@ -0,0 +1,34 @@
+This package was debianized by Leonardo Rodrigues de Mello <l@lmello.eu.org> on
+Thu, 30 Aug 2007 10:38:20 -0300.
+
+It was then taken over for official Debian maintenance by the Debian
+Ganeti Team.
+
+It was downloaded from http://code.google.com/p/ganeti/
+
+Upstream Authors: iustinp, ultrotter, schreiberal, amishchenko,
+roman.marxer, imsnah, vylavera
+
+Copyright:  Copyright (C) 2006, 2007, 2008 Google Inc.
+
+License: GPL
+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 of the License, 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 Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in `/usr/share/common-licenses/GPL-2'.
+
+The Debian packaging is (C) 2007, Debian Ganeti Team
+<pkg-ganeti@lists.alioth.debian.org> and is licensed under the GPL, see
+`/usr/share/common-licenses/GPL'.
--- ganeti-1.2.6.orig/debian/docs
+++ ganeti-1.2.6/debian/docs
@@ -0,0 +1 @@
+README
--- ganeti-1.2.6.orig/debian/pyversions
+++ ganeti-1.2.6/debian/pyversions
@@ -0,0 +1 @@
+2.4-
--- ganeti-1.2.6.orig/debian/ganeti.dirs
+++ ganeti-1.2.6/debian/ganeti.dirs
@@ -0,0 +1,2 @@
+etc/ganeti
+usr/lib/ganeti/iallocators
--- ganeti-1.2.6.orig/debian/control
+++ ganeti-1.2.6/debian/control
@@ -0,0 +1,32 @@
+Source: ganeti
+Section: admin
+Priority: extra
+Maintainer: Debian Ganeti Team <pkg-ganeti-devel@lists.alioth.debian.org>
+Uploaders: Guido Trotter <ultrotter@debian.org>, Iustin Pop <iusty@k1024.org>, Leonardo Rodrigues de Mello <l@lmello.eu.org>
+Build-Depends: cdbs (>= 0.4.49), debhelper (>= 5), docbook-utils, python-simplejson, python-pyparsing, python-openssl, python-twisted-core, patchutils, python-support (>= 0.6)
+Standards-Version: 3.8.0.1
+Vcs-Svn: http://ganeti.googlecode.com/svn/trunk/ganeti/
+Vcs-Browser: http://ganeti.googlecode.com/svn/trunk/ganeti/
+Homepage: http://code.google.com/p/ganeti/
+DM-Upload-Allowed: yes
+
+Package: ganeti
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, lvm2, ssh, bridge-utils, iproute, iputils-arping, openssl, python-simplejson, python-pyparsing, python-openssl, python-twisted-core
+Recommends: drbd8-utils (>= 8.0.7) | drbd0.7-utils, mdadm, xen-linux-system-2.6.26-1-xen-amd64 | xen-linux-system-2.6.26-1-xen-686, ganeti-instance-debootstrap
+Suggests: drbd8-module-source (>= 8.0.7) | drbd0.7-module-source
+Provides: ${python:Provides}
+Description: Cluster-based virtualization management software
+ Ganeti is a virtual server cluster management software tool built on top
+ of the Xen virtual machine monitor and other Open Source software. After
+ setting it up it will provide you with an automated environment to
+ manage highly available virtual machine instances.
+ .
+ It has been designed to facilitate cluster management of virtual servers
+ and to provide fast and simple recovery after physical failures using
+ commodity hardware.
+ .
+ It will take care of operations such as redundant disk creation and
+ management, operating system installation  (in cooperation with OS-specific
+ install scripts), startup, shutdown, failover of instances between physical
+ systems.
--- ganeti-1.2.6.orig/debian/patches/00-fix-twisted-waker-fds.patch
+++ ganeti-1.2.6/debian/patches/00-fix-twisted-waker-fds.patch
@@ -0,0 +1,56 @@
+commit 2bdcf7290c87ff18eb4f5ce3955bc0a610a9e3c8
+Author: Iustin Pop <iustinp@gmail.com>
+Date:   Tue Feb 10 13:04:55 2009 +0000
+
+    Workaround twisted 8.x pipe-based waker
+    
+    Twisted 8.x uses a waker objects for inter-thread signalling and the on
+    POSIX platforms the waker uses pipes for communication, which should not
+    be closed.
+    
+    For some reasons, sometime the waker deals with its pipes being closed,
+    while at other times it doesn't. As such, we workaround it by skipping
+    the waker file descriptors in the utils.Daemonize function. This is
+    fragile and will break if Twisted changes internals, but it's a simple
+    workaround for now.
+    
+    The patch also adds an assert in Daemonize() so that “standard” file
+    descriptors (0, 1, 2) are not marked to be kept open.
+    
+    Reviewed-by: imsnah
+    
+    git-svn-id: https://ganeti.googlecode.com/svn/branches/ganeti/ganeti-1.2@2461 a6b21a0d-9e31-0410-a73f-d369b950c04d
+
+diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded
+index 58c3804..892db24 100755
+--- a/daemons/ganeti-noded
++++ b/daemons/ganeti-noded
+@@ -618,8 +618,15 @@ def main():
+       sys.exit(5)
+ 
+   # become a daemon
++  noclose_fds = []
++  if hasattr(reactor, 'waker'):
++    # twisted with waker object which has extra fds in use
++    for attr in ('i', 'o'):
++      val = getattr(reactor.waker, attr, None)
++      if isinstance(val, int):
++        noclose_fds.append(val)
+   if options.fork:
+-    utils.Daemonize(logfile=constants.LOG_NODESERVER)
++    utils.Daemonize(logfile=constants.LOG_NODESERVER, noclose_fds=noclose_fds)
+ 
+   logger.SetupLogging(twisted_workaround=True, debug=options.debug,
+                       program="ganeti-noded")
+diff --git a/lib/utils.py b/lib/utils.py
+index 083fd2d..f6c00ee 100644
+--- a/lib/utils.py
++++ b/lib/utils.py
+@@ -1160,6 +1160,7 @@ def Daemonize(logfile, noclose_fds=None):
+   # Iterate through and close all file descriptors.
+   for fd in range(0, maxfd):
+     if noclose_fds and fd in noclose_fds:
++      assert fd > 2, "Cannot keep open standard fd %d" % fd
+       continue
+     try:
+       os.close(fd)
