annotate recipes/wince/gnupg/base.py @ 330:24db9223488b

Test updated to reflect that rules_rev is now also handled as string
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 17 Mar 2010 14:37:30 +0000
parents f5282057838a
children c7d22fd36815
rev   line source
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
1 # Copyright (C) 2007, 2008, 2010 by Intevation GmbH
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
2 # Authors:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
3 # Bernhard Herzog <bh@intevation.de>
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
4 # Modified for CE Andre Heinecke <aheinecke@intevation.de>
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
5 #
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9 """Base classes for all gnupg for Windows CE packagers"""
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
11 import os
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
12 import re
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
13 import inspect
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
14 import new
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
15
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
16 import treepkg.util
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
17 import treepkg.packager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
18 import treepkg.run as run
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
19 from treepkg.cmdexpand import cmdexpand
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
20
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
21
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
22 class BaseSourcePackager(treepkg.packager.SourcePackager):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
23
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
24 def orig_source_version(self, directory):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
25 """Determines the version from the configure.ac file in directory"""
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
26 filename = os.path.join(directory, "configure.ac")
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
27 for line in open(filename):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
28
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
29 # Matches lines like
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
30 # m4_define(my_version, [1.1.7])
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
31 # used by most of the gnupg packages
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
32 match = re.match(r"m4_define\(\[?my_version\]?, \[([^]]+)\]\)",
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
33 line)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
34 if match:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
35 return match.group(1)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
36
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
37 # Matches lines like.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
38 # AC_INIT(pinentry, 0.7.6-cvs, [gnupg-devel@gnupg.org])
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
39 # pinentry is the GnuPG package that actually needs this
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
40 match = re.match(r"AC_INIT\([a-zA-Z_]+, ([0-9.]+)", line)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
41 if match:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
42 return match.group(1)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
43
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
44 raise RuntimeError("Could not determine the version number from %s"
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
45 % filename)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
46
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
47 def determine_package_version(self, directory):
327
f5282057838a Revisions are now handled as strings
Andre Heinecke <aheinecke@intevation.de>
parents: 322
diff changeset
48 return "%s-svn%s" % (self.orig_source_version(directory), self.revision)
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
49 def sign_package(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
50 return None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
51
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
52 def do_package(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
53 pkgbaseversion, pkgbasedir = self.export_sources()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
54
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
55 run.call(cmdexpand("/bin/sh autogen.sh"), cwd=pkgbasedir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
56 suppress_output=True)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
57 orig_version = self.orig_source_version(pkgbasedir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
58
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
59 # patch the version number in the newly generated configure
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
60 # file. autogen.sh normally determines it from svn, but here it
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
61 # ran on a copy that did not include the .svn subdirectories and
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
62 # thus could not find the svn revision.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
63 treepkg.util.replace_in_file(os.path.join(pkgbasedir, "configure"),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
64 re.escape(orig_version) + "-svn0",
327
f5282057838a Revisions are now handled as strings
Andre Heinecke <aheinecke@intevation.de>
parents: 322
diff changeset
65 orig_version + "-svn%s" % self.revision)
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
66
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
67 pkgbasename = self.pkg_basename + "_" + pkgbaseversion
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
68 origtargz = os.path.join(self.work_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
69 pkgbasename + ".orig.tar.gz")
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
70 self.create_tarball(origtargz, self.work_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
71 os.path.basename(pkgbasedir))
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
72
327
f5282057838a Revisions are now handled as strings
Andre Heinecke <aheinecke@intevation.de>
parents: 322
diff changeset
73 changemsg = ("Update to SVN rev. %s" % (self.revision,))
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
74 self.copy_debian_directory(pkgbasedir, pkgbaseversion,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
75 changemsg)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
76
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
77 self.create_source_package(pkgbasedir, origtargz)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
78 self.move_source_package(pkgbasename)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
79
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
80 class SmartSourcePackager(BaseSourcePackager):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
81
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
82 """SourcePackager that uses pbuilder to create the source tarball.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
83
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
84 We try to create source tarballs that are as close to the tarballs
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
85 created by the upstream maintainers as possible. For the gnupg
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
86 software this means we need to run 'make dist' in a configured SVN
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
87 working copy with some additional software installed like autoconf
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
88 and texinfo. We want to avoid running code from a working copy
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
89 outside of the pbuilder environment and having to install recipe
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
90 specific additional software packages in the treepkg host system.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
91 Therefore we create the source tarball using 'pbuilder execute' with
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
92 a script.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
93 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
94
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
95 createtarball_script = """\
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
96 #! /bin/bash
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
97 set -e
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
98
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
99 apt-get --assume-yes --force-yes install %(builddeps)s
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
100
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
101 # copy the source tree to a directory that's under pbuilder control so
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
102 # that it gets removed along with the build environment. Otherwise we
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
103 # end up with a directory containing files that cannot be removed by
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
104 # treepkg
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
105 workdir=/tmp/work
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
106 cp -a %(basedir)s $workdir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
107 cd $workdir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
108
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
109 # tweak autoconf settings so that make dist produces a tar.gz, not a
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
110 # tar.bz2. Removing all options whose names contain 'dist' should
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
111 # achieve that.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
112 cp Makefile.am Makefile.am.orig
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
113 sed -e '/AUTOMAKE_OPTIONS/ s/[a-zA-Z0-9-]*dist[a-zA-Z0-9-]*//g' \
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
114 Makefile.am.orig > Makefile.am
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
115
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
116 export MINGWPATH=/opt/mingw32ce
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
117 export INCLUDE=$MINGWPATH/arm-mingw32ce/include:$MINGWPATH/include:\
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
118 /home/builder/wce-build/install/include:$INCLUDE
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
119 export LIB=$MINGWPATH/arm-mingw32ce/lib:$MINGWPATH/lib:\
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
120 /home/builder/wce-build/install/lib:$LIB
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
121 export PATH=:$PATH:$MINGWPATH/bin:$MINGWPATH/arm-mingw32ce/bin:\
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
122 $MINGWPATH/libexec/gcc/arm-mingw32ce/4.4.0:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
123
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
124 ./autogen.sh
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
125 ./configure --enable-maintainer-mode --host=arm-mingw32ce
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
126
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
127 # revert autoconf changes, so that the original Makefile.am ends up in
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
128 # the tarball
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
129 mv Makefile.am.orig Makefile.am
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
130
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
131 %(make_dist_command)s
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
132
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
133 mv *.tar.gz %(origtargz)s
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
134 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
135
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
136 make_dist_command = "make dist"
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
137
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
138 def __init__(self, *args):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
139 super(SmartSourcePackager, self).__init__(*args)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
140 self.pkgbasename = None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
141 self.pkgbaseversion = None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
142 self.origtargz = None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
143
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
144 def copy_workingcopy(self, dest):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
145 treepkg.util.copytree(self.track.checkout_dir, dest)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
146
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
147 def create_original_tarball(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
148 copied_working_copy = os.path.join(self.work_dir, "copied_working_copy")
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
149 self.copy_workingcopy(copied_working_copy)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
150
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
151 self.pkgbaseversion = \
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
152 self.determine_package_version(copied_working_copy)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
153 self.pkgbasename = self.pkg_basename + "_" + self.pkgbaseversion
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
154 self.origtargz = os.path.join(self.work_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
155 self.pkgbasename + ".orig.tar.gz")
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
156
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
157 script = (self.createtarball_script
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
158 % dict(builddeps=" ".join(self.track.dependencies_required()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
159 | self.tarball_dependencies),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
160 basedir=copied_working_copy,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
161 origtargz=self.origtargz,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
162 make_dist_command=self.make_dist_command))
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
163 script_name = os.path.join(self.work_dir, "createtarball")
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
164 treepkg.util.writefile(script_name, script, 0755)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
165
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
166 treepkg.util.ensure_directory(self.src_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
167 treepkg.util.ensure_directory(self.log_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
168 self.track.builder.run_script([script_name],
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
169 logfile=os.path.join(self.log_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
170 "tarball_log.txt"),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
171 bindmounts=[self.work_dir, self.src_dir])
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
172
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
173 def create_orig_dir(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
174 """Unpacks the tarball created by create_original_tarball into work_dir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
175 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
176 unpack_dir = os.path.join(self.work_dir, "unpack")
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
177 treepkg.util.ensure_directory(unpack_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
178 run.call(cmdexpand("tar xzf $origtargz -C $unpack_dir",
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
179 unpack_dir=unpack_dir, origtargz=self.origtargz))
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
180 unpacked_files = treepkg.util.listdir_abs(unpack_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
181 if len(unpacked_files) != 1:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
182 raise RuntimeError("%s should have extracted to a single directory",
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
183 origtargz)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
184 unpacked_dir = unpacked_files[0]
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
185
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
186 orig_dir = os.path.join(self.work_dir, os.path.basename(unpacked_dir))
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
187 os.rename(unpacked_dir, orig_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
188 return orig_dir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
189
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
190 def do_package(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
191 self.create_original_tarball()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
192 orig_dir = self.create_orig_dir()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
193
327
f5282057838a Revisions are now handled as strings
Andre Heinecke <aheinecke@intevation.de>
parents: 322
diff changeset
194 changemsg = ("Update to SVN rev. %s" % (self.revision,))
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
195 self.copy_debian_directory(orig_dir, self.pkgbaseversion, changemsg)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
196
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
197 self.create_source_package(orig_dir, self.origtargz)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
198 self.move_source_package(self.pkgbasename)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
199
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
200
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
201 def define_gnupg_packager(pkg_basename,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
202 tarball_dependencies=("autoconf", "automake",
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
203 "texinfo", "subversion"),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
204 make_dist_command=None):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
205 """Create a SourcePackager for a GnuPG package in the caller's globals().
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
206 This is a helper function for the modules in the recipe.gnupg package.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
207 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
208 base_class = BaseSourcePackager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
209 class_attributes = dict(pkg_basename=pkg_basename)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
210 if tarball_dependencies is not None:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
211 base_class = SmartSourcePackager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
212 class_attributes["tarball_dependencies"] = set(tarball_dependencies)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
213 if make_dist_command is not None:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
214 base_class = SmartSourcePackager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
215 class_attributes["make_dist_command"] = make_dist_command
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
216
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
217 caller_globals = inspect.currentframe().f_back.f_globals
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
218 caller_globals["SourcePackager"] = new.classobj("SourcePackager",
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
219 (base_class,),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
220 class_attributes)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)