annotate recipes/wince/gnupg/base.py @ 557:9824e409388b

Refactor git branching If a checkout is already available and the branch is changed in the config git command would always fail because it doesn't know the branch to track. Therefore always check if the branch is locally available and if not checkout the remote branch
author Bjoern Ricks <bricks@intevation.de>
date Fri, 02 Sep 2011 08:45:28 +0000
parents e38976f77e26
children
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):
549
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
48 """ Returns a Git package Name """
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
49 date = run.capture_output(cmdexpand("/bin/sh -c \" git log --date=iso \
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
50 -n 1 | grep Date \
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
51 | awk \'{print $$2}\'\""),
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
52 cwd=directory)
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
53 time = run.capture_output(cmdexpand("/bin/sh -c \" git log --date=iso \
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
54 -n 1 | grep Date \
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
55 | awk \'{print $$3}\'\""),
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
56 cwd=directory)
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
57 date = date.replace('-','')
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
58 time = time.replace(':','')
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
59 return "%s~%s%s.git%s" % (self.orig_source_version(directory),
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
60 date[:8], time[:4], self.revision[:7])
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
61
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
62 def sign_package(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
63 return None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
64
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
65 def do_package(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
66 pkgbaseversion, pkgbasedir = self.export_sources()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
67
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
68 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
69 suppress_output=True)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
70 orig_version = self.orig_source_version(pkgbasedir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
71
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
72 # 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
73 # 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
74 # 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
75 # thus could not find the svn revision.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
76 treepkg.util.replace_in_file(os.path.join(pkgbasedir, "configure"),
549
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
77 re.escape(orig_version) + "-git0",
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
78 orig_version + "-git%s" % self.revision)
322
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 pkgbasename = self.pkg_basename + "_" + pkgbaseversion
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
81 origtargz = os.path.join(self.work_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
82 pkgbasename + ".orig.tar.gz")
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
83 self.create_tarball(origtargz, self.work_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
84 os.path.basename(pkgbasedir))
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
85
549
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
86 changemsg = ("Update to GIT rev. %s" % (self.revision,))
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
87 self.copy_debian_directory(pkgbasedir, pkgbaseversion,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
88 changemsg)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
89
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
90 self.create_source_package(pkgbasedir, origtargz)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
91 self.move_source_package(pkgbasename)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
92
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
93 class SmartSourcePackager(BaseSourcePackager):
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 """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
96
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
97 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
98 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
99 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
100 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
101 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
102 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
103 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
104 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
105 a script.
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
106 """
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 createtarball_script = """\
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
109 #! /bin/bash
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
110 set -e
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
111 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
112
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
113 # 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
114 # 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
115 # 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
116 # treepkg
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
117 workdir=/tmp/work
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
118 cp -a %(basedir)s $workdir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
119 cd $workdir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
120
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
121 export MINGWPATH=/opt/mingw32ce
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
122 export INCLUDE=$MINGWPATH/arm-mingw32ce/include:$MINGWPATH/include:\
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
123 /home/builder/wce-build/install/include:$INCLUDE
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
124 export LIB=$MINGWPATH/arm-mingw32ce/lib:$MINGWPATH/lib:\
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
125 /home/builder/wce-build/install/lib:$LIB
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
126 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
127 $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
128 export w32ce_root=/opt/mingw32ce
549
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
129 export w32root=/opt/mingw32ce
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
130
373
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
131 ./autogen.sh --build-w32ce
322
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 # 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
134 # the tarball
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
135 mv Makefile.am.orig Makefile.am
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
136
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
137 %(make_dist_command)s
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
138 mv *.tar.gz %(origtargz)s
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
139 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
140 def __init__(self, *args):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
141 super(SmartSourcePackager, self).__init__(*args)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
142 self.pkgbasename = None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
143 self.pkgbaseversion = None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
144 self.origtargz = None
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
145
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
146 def copy_workingcopy(self, dest):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
147 treepkg.util.copytree(self.track.checkout_dir, dest)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
148
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
149 def create_original_tarball(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
150 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
151 self.copy_workingcopy(copied_working_copy)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
152
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
153 self.pkgbaseversion = \
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
154 self.determine_package_version(copied_working_copy)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
155 self.pkgbasename = self.pkg_basename + "_" + self.pkgbaseversion
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
156 self.origtargz = os.path.join(self.work_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
157 self.pkgbasename + ".orig.tar.gz")
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
158
373
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
159 # 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
160 # 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
161 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
162 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
163 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
164 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
165 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
166 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
167
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
168 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
169 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
170 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
171 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
172 "configure"),
549
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
173 re.escape(orig_version) + "-git0",
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
174 orig_version + "-git%s" % self.revision)
373
c7d22fd36815 Base takes now the configuration options for Windows CE that are supplied
Andre Heinecke <aheinecke@intevation.de>
parents: 327
diff changeset
175
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
176 script = (self.createtarball_script
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
177 % dict(builddeps=" ".join(self.track.dependencies_required()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
178 | self.tarball_dependencies),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
179 basedir=copied_working_copy,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
180 origtargz=self.origtargz,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
181 make_dist_command=self.make_dist_command))
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
182 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
183 treepkg.util.writefile(script_name, script, 0755)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
184
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
185 treepkg.util.ensure_directory(self.src_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
186 treepkg.util.ensure_directory(self.log_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
187 self.track.builder.run_script([script_name],
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
188 logfile=os.path.join(self.log_dir,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
189 "tarball_log.txt"),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
190 bindmounts=[self.work_dir, self.src_dir])
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
191
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
192 def create_orig_dir(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
193 """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
194 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
195 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
196 treepkg.util.ensure_directory(unpack_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
197 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
198 unpack_dir=unpack_dir, origtargz=self.origtargz))
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
199 unpacked_files = treepkg.util.listdir_abs(unpack_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
200 if len(unpacked_files) != 1:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
201 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
202 origtargz)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
203 unpacked_dir = unpacked_files[0]
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 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
206 os.rename(unpacked_dir, orig_dir)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
207 return orig_dir
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
208
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
209 def do_package(self):
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
210 self.create_original_tarball()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
211 orig_dir = self.create_orig_dir()
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
212
549
e38976f77e26 Change the packaging rules to handle git sources
Andre Heinecke <aheinecke@intevation.de>
parents: 373
diff changeset
213 changemsg = ("Update to GIT rev. %s" % (self.revision,))
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
214 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
215
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
216 self.create_source_package(orig_dir, self.origtargz)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
217 self.move_source_package(self.pkgbasename)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
218
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
219
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
220 def define_gnupg_packager(pkg_basename,
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
221 tarball_dependencies=("autoconf", "automake",
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
222 "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
223 make_dist_command="make dist"):
322
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
224 """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
225 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
226 """
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
227 base_class = BaseSourcePackager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
228 class_attributes = dict(pkg_basename=pkg_basename)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
229 if tarball_dependencies is not None:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
230 base_class = SmartSourcePackager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
231 class_attributes["tarball_dependencies"] = set(tarball_dependencies)
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
232 if make_dist_command is not None:
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
233 base_class = SmartSourcePackager
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
234 class_attributes["make_dist_command"] = make_dist_command
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
235
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
236 caller_globals = inspect.currentframe().f_back.f_globals
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
237 caller_globals["SourcePackager"] = new.classobj("SourcePackager",
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
238 (base_class,),
278abafc2d86 Added recipes for GNUPG Windows CE crossbuilds
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
239 class_attributes)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)