annotate recipes/wince/gnupg/base.py @ 542:dc17b62d3cdd

contrib: Added copy-latest-pkgs.py to copy/hardlink latest packages from the mill to the next higher attention level.
author Sascha Teichmann <teichmann@intevation.de>
date Tue, 11 Jan 2011 17:20:02 +0000
parents c7d22fd36815
children e38976f77e26
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 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
99
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
100 # 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
101 # 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
102 # 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
103 # treepkg
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
104 workdir=/tmp/work
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
105 cp -a %(basedir)s $workdir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
106 cd $workdir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
107
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
108 export MINGWPATH=/opt/mingw32ce
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
109 export INCLUDE=$MINGWPATH/arm-mingw32ce/include:$MINGWPATH/include:\
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
110 /home/builder/wce-build/install/include:$INCLUDE
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
111 export LIB=$MINGWPATH/arm-mingw32ce/lib:$MINGWPATH/lib:\
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
112 /home/builder/wce-build/install/lib:$LIB
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
113 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
114 $MINGWPATH/libexec/gcc/arm-mingw32ce/4.4.0:
373
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
115 export w32ce_root=/opt/mingw32ce
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
116
373
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
117 ./autogen.sh --build-w32ce
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
118
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
119 # 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
120 # the tarball
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
121 mv Makefile.am.orig Makefile.am
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
122
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
123 %(make_dist_command)s
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
124 mv *.tar.gz %(origtargz)s
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
125 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
126 def __init__(self, *args):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
127 super(SmartSourcePackager, self).__init__(*args)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
128 self.pkgbasename = None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
129 self.pkgbaseversion = None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
130 self.origtargz = None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
131
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
132 def copy_workingcopy(self, dest):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
133 treepkg.util.copytree(self.track.checkout_dir, dest)
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 def create_original_tarball(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
136 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
137 self.copy_workingcopy(copied_working_copy)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
138
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
139 self.pkgbaseversion = \
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
140 self.determine_package_version(copied_working_copy)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
141 self.pkgbasename = self.pkg_basename + "_" + self.pkgbaseversion
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
142 self.origtargz = os.path.join(self.work_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
143 self.pkgbasename + ".orig.tar.gz")
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
144
373
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
145 # tweak automake settings so that make dist produces a tar.gz not
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
146 # a tar.bz2
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
147 run.call(cmdexpand("/bin/sh -c \"cp Makefile.am Makefile.am.orig\""),
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
148 cwd=copied_working_copy,suppress_output=True)
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
149 run.call(cmdexpand("/bin/sh -c \"sed -e '/AUTOMAKE_OPTIONS/ \
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
150 s/[a-zA-Z0-9-]*dist[a-zA-Z0-9-]*//g' \
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
151 Makefile.am.orig > Makefile.am\""), cwd=copied_working_copy,
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
152 suppress_output=True)
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
153
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
154 run.call(cmdexpand("/bin/sh autogen.sh"), cwd=copied_working_copy,
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
155 suppress_output=True)
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
156 orig_version = self.orig_source_version(copied_working_copy)
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
157 treepkg.util.replace_in_file(os.path.join(copied_working_copy,
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
158 "configure"),
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
159 re.escape(orig_version) + "-svn0",
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
160 orig_version + "-svn%s" % self.revision)
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
161
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
162 script = (self.createtarball_script
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
163 % dict(builddeps=" ".join(self.track.dependencies_required()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
164 | self.tarball_dependencies),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
165 basedir=copied_working_copy,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
166 origtargz=self.origtargz,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
167 make_dist_command=self.make_dist_command))
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
168 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
169 treepkg.util.writefile(script_name, script, 0755)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
170
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
171 treepkg.util.ensure_directory(self.src_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
172 treepkg.util.ensure_directory(self.log_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
173 self.track.builder.run_script([script_name],
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
174 logfile=os.path.join(self.log_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
175 "tarball_log.txt"),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
176 bindmounts=[self.work_dir, self.src_dir])
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
177
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
178 def create_orig_dir(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
179 """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
180 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
181 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
182 treepkg.util.ensure_directory(unpack_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
183 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
184 unpack_dir=unpack_dir, origtargz=self.origtargz))
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
185 unpacked_files = treepkg.util.listdir_abs(unpack_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
186 if len(unpacked_files) != 1:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
187 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
188 origtargz)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
189 unpacked_dir = unpacked_files[0]
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
190
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
191 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
192 os.rename(unpacked_dir, orig_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
193 return orig_dir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
194
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
195 def do_package(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
196 self.create_original_tarball()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
197 orig_dir = self.create_orig_dir()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
198
327
f5282057838a Revisions are now handled as strings
Andre Heinecke <aheinecke@intevation.de>
parents: 322
diff changeset
199 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
200 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
201
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
202 self.create_source_package(orig_dir, self.origtargz)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
203 self.move_source_package(self.pkgbasename)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
204
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
205
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
206 def define_gnupg_packager(pkg_basename,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
207 tarball_dependencies=("autoconf", "automake",
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
208 "texinfo", "subversion"),
373
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
209 make_dist_command="make dist"):
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
210 """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
211 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
212 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
213 base_class = BaseSourcePackager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
214 class_attributes = dict(pkg_basename=pkg_basename)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
215 if tarball_dependencies is not None:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
216 base_class = SmartSourcePackager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
217 class_attributes["tarball_dependencies"] = set(tarball_dependencies)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
218 if make_dist_command is not None:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
219 base_class = SmartSourcePackager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
220 class_attributes["make_dist_command"] = make_dist_command
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
221
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
222 caller_globals = inspect.currentframe().f_back.f_globals
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
223 caller_globals["SourcePackager"] = new.classobj("SourcePackager",
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
224 (base_class,),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
225 class_attributes)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)