- def shellquote_arg(s): '"' + shellquote_re.sub(r'\\\1', s) + '"
- def shellquote_cmdl(l): ' '.join(map(shellquote,l))
-
- if tb.ec_mode eq 'auxverb':
- tec_cmdl = tb.ec_cmdl
- elif tb.ec_mode eq 'shstring':
- tec_cmdl = shellquote_cmdl(tb.ec_cmdl)
- else:
- tb.bomb('print-execute-command unsupported mode %s'
- % tb.ec_mode)
-
- tb.ec_auxverbscript = TemporaryFile('auxverb')
- print >>open(tb.ec_auxverbscript.write(),'w'), '\n'.join([
- '#!/bin/sh',
- 'exec '.shellquote_cmdl(tec_cmdl).' "$@"'
- ]
+ def shellquote_arg(s): return '"' + shellquote_re.sub(r'\\\1', s) + '"'
+ def shellquote_cmdl(l): return ' '.join(map(shellquote_arg,l))
+
+ tb._debug('tb.ec_cmdl = %s' % (`tb.ec_cmdl`))
+
+ tb.ec_auxverbscript = TemporaryFile('satdep-auxverb')
+ print >>open(tb.ec_auxverbscript.write(),'w'), (
+'''#!/bin/sh
+set -ex
+echo >&2 ": $*"
+if [ $# = 2 ] && [ "x$1" = xdpkg-architecture ] && [ "x$2" = x-qDEB_HOST_ARCH ]; then
+ set -- dpkg --print-architecture
+fi
+if [ "x$1" = xsh ] && [ "x$2" = x-c ]; then
+ shift; shift
+ # what a horrible hack!
+fi
+exec '''+shellquote_cmdl(tb.ec_cmdl)+' "$*"'+"\n"
+ )
+ os.chmod(tb.ec_auxverbscript.write(), 0755)