Source: git Version: 1:1.7.8~rc0-1 Severity: wishlist Hi,
Trying to use git-remote-bzr apt-get install git bzr-fastimport git clone git://github.com/lelutin/git-remote-bzr.git PATH=$(pwd)/git-remote-bzr:$PATH git clone bzr::lp:ubuntu/bash produces Cloning into 'bash'... Traceback (most recent call last): File "/tmp/git-remote-bzr/git-remote-bzr", line 10, in <module> from git_remote_helpers.util import die, debug, warn ImportError: No module named git_remote_helpers.util Natural enough. Sverre Rabbelier's git-remote-hg wants that package, too. Here's a first attempt at packaging it. It would be nice to - include an upper bound on the Python version in the run-time Python dependency. Or even better, convince future Python versions to use the same (pure Python) modules instead of baking in a list of versions at build time. (I think python-support can do the latter, but python-support seems to be being phased out in favor of dh_python2.) - massage the git_remote_helpers/Makefile change into a form that can be applied upstream, and put the patch in debian/diff until then - get rid of most of the logic in postinst, assuming the Python policy can be clarified to allow that Filing now anyway so this is online somewhere and to get feedback early in case it is doing something crazy. --- After this patch, Gabriel Filion's git-remote-bzr gets much further, but it still doesn't actually work. Oh well. 04:20:07 Exported 81 revisions in 0:00:05 $ echo $? 141 $ ls -ld bash ls: cannot access bash: No such file or directory debian/control | 16 +++++++++ debian/python-git-remote-helpers.postinst | 33 ++++++++++++++++++ debian/python-git-remote-helpers.prerm | 3 ++ debian/rules | 52 ++++++++++++++++++++++++++++- git_remote_helpers/Makefile | 3 +- 5 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 debian/python-git-remote-helpers.postinst create mode 100644 debian/python-git-remote-helpers.prerm diff --git a/debian/control b/debian/control index 21b77456..d88bb4ce 100644 --- a/debian/control +++ b/debian/control @@ -7,6 +7,7 @@ Build-Depends: libz-dev, libcurl4-gnutls-dev | libcurl3-gnutls-dev, libexpat1-dev, subversion, libsvn-perl | libsvn-core-perl, tcl8.5, gettext, + python-all, cvs, cvsps, libdbd-sqlite3-perl, unzip, libio-pty-perl, dpkg-dev (>= 1.15.7~), @@ -101,6 +102,21 @@ Description: fast, scalable, distributed revision control system (documentation) . This package provides the documentation. +Package: python-git-remote-helpers +Section: python +Architecture: all +Depends: git (>> ${source:Upstream-Version}), git (<< ${source:Upstream-Version}-.), + ${python:Depends} +Provides: ${python:Provides} +Description: building blocks for tools to let Git access foreign repositories + Remote helpers are programs used by the Git version control system + when it needs to interact with repositories Git does not support + natively. This package provides a Python package called + "git_remote_helpers" containing the common basics needed to start + writing such helpers in Python. + . + git-remote-hg and git-remote-bzr use this. + Package: git-arch Architecture: all Depends: git (>> ${source:Upstream-Version}), git (<< ${source:Upstream-Version}-.), tla diff --git a/debian/python-git-remote-helpers.postinst b/debian/python-git-remote-helpers.postinst new file mode 100644 index 00000000..e4b7d586 --- /dev/null +++ b/debian/python-git-remote-helpers.postinst @@ -0,0 +1,33 @@ +#!/usr/bin/python +# This should be as simple as +# +# #!/bin/sh +# set -e +# pycompile -p python-git-remote-helpers +# +# but according to Python policy v0.9.4.1, section 2.6, we need to +# respect the byte-compile option in /etc/python/debian_config. Okay. + +import subprocess, sys, os +import ConfigParser +package = 'python-git-remote-helpers' +bc_commands = {'standard': ['pycompile'], 'optimize': ['pycompile', '-O']} + +def die(msg): + sys.exit('%s.postinst: %s' % (package, msg)) + +def bc_modes(): + config = ConfigParser.SafeConfigParser() + config.read('/etc/python/debian_config') + if not config.has_option('DEFAULT', 'byte-compile'): + return ['standard'] + bc = config.get('DEFAULT', 'byte-compile') + return [v.strip() for v in bc.split(',')] + +for opt in bc_modes(): + if opt not in bc_commands: + die('unknown byte-compilation mode "%s"' % opt) + try: + subprocess.check_call(bc_commands[opt] + ['-p', package]) + except Exception, e: + die("cannot compile bytecode: %s" % e) diff --git a/debian/python-git-remote-helpers.prerm b/debian/python-git-remote-helpers.prerm new file mode 100644 index 00000000..6614f115 --- /dev/null +++ b/debian/python-git-remote-helpers.prerm @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +pyclean -p python-git-remote-helpers diff --git a/debian/rules b/debian/rules index 4894bf89..df2a364d 100755 --- a/debian/rules +++ b/debian/rules @@ -12,7 +12,7 @@ TEST =test OPTS =NO_OPENSSL=1 prefix=/usr gitexecdir=/usr/lib/git-core \ mandir=/usr/share/man htmldir=/usr/share/doc/git/html \ INSTALLDIRS=vendor \ - NO_PYTHON=1 \ + PYTHON_PATH=/usr/bin/python \ USE_SRV_RR=1 \ THREADED_DELTA_SEARCH=1 \ NO_CROSS_DIRECTORY_HARDLINKS=1 NO_HARDLINKS=1 \ @@ -30,6 +30,7 @@ endif TMP =$(shell pwd)/tmp GIT =$(shell pwd)/debian/git +PYGIT =$(shell pwd)/debian/python-git-remote-helpers patch: deb-checkdir patch-stamp patch-stamp: @@ -71,8 +72,10 @@ clean: deb-checkdir rm -rf '$(GIT)' '$(GIT)'-doc '$(GIT)'-arch '$(GIT)'-cvs rm -rf '$(GIT)'-svn '$(GIT)'-email '$(GIT)'-el rm -rf '$(GIT)'-daemon-run '$(GIT)'-daemon-sysvinit '$(GIT)'-gui + rm -rf '$(PYGIT)' rm -rf '$(GIT)'k '$(GIT)'web '$(GIT)'-all '$(GIT)'-man '$(GIT)'-core rm -f debian/files debian/substvars changelog + rm -f debian/python-substvars+ debian/python-substvars install: install-arch install-indep install-arch: deb-checkdir deb-checkuid build-arch-stamp @@ -160,6 +163,49 @@ install-indep-real: build-arch-stamp build-indep-stamp rm -rf '$(GIT)'-doc install -d -m0755 '$(GIT)'-doc/usr/share/doc/git ln -s ../git-doc '$(GIT)'-doc/usr/share/doc/git/html + # python-git-remote-helpers + rm -rf '$(PYGIT)' + install -d -m0755 '$(PYGIT)'/usr/share/pyshared/git_remote_helpers/git + install -m0644 \ + '$(TMP)'/usr/lib/python*/*/git_remote_helpers/*.py \ + '$(PYGIT)'/usr/share/pyshared/git_remote_helpers/ + install -m0644 \ + '$(TMP)'/usr/lib/python*/*/git_remote_helpers/git/*.py \ + '$(PYGIT)'/usr/share/pyshared/git_remote_helpers/git/ + install -m0644 \ + '$(TMP)'/usr/lib/python*/*/git_remote_helpers-*.egg-info \ + '$(PYGIT)'/usr/share/pyshared/ + set -e; \ + vers=$$(pyversions -s); \ + for ver in $$vers; do \ + if test "$$ver" = python2.4 || test "$$ver" = python2.5; then \ + dst=/usr/lib/$$ver/site-packages; \ + else \ + dst=/usr/lib/$$ver/dist-packages; \ + fi; \ + relsrc=../../../share/pyshared; \ + find '$(PYGIT)'/usr/share/pyshared -type f | \ + while read f; do \ + path=$${f#'$(PYGIT)'/usr/share/pyshared/}; \ + basename=$${path##*/}; \ + dir=$${path%$$basename}; \ + cdup=$$(printf '%s\n' "$$dir" | sed -e 's,[^/][^/]*,..,g'); \ + install -d -m0755 '$(PYGIT)'"$$dst/$$dir"; \ + ln -s "$$cdup$$relsrc/$$path" \ + '$(PYGIT)'"$$dst/$$path"; \ + done; \ + done; \ + provides=; \ + for ver in $$vers; do \ + vernum=$${ver#python}; \ + provides="$$provides, python$$vernum-git-remote-helpers"; \ + done; \ + provides=$${provides#, }; \ + echo "python:Provides=$$provides" >debian/python-substvars+; \ + least=$$(printf '%s\n' $$vers | sort -V | head -1); \ + lver=$${least#python}; \ + echo "python:Depends=python (>= $$lver)" >>debian/python-substvars+ + mv debian/python-substvars+ debian/python-substvars # git-cvs, git-svn for i in cvs svn; do \ rm -rf '$(GIT)'-$$i && \ @@ -287,6 +333,7 @@ binary-arch: install-arch git.deb binary-indep: install-indep git-doc.deb git-arch.deb git-cvs.deb git-svn.deb \ git-daemon-run.deb git-daemon-sysvinit.deb \ git-email.deb git-gui.deb gitk.deb gitweb.deb \ + python-git-remote-helpers.deb \ git-all.deb git-el.deb git-man.deb git-core.deb-DEBIAN rm -f debian/substvars for i in -doc -arch -cvs -svn -daemon-run -daemon-sysvinit \ @@ -294,6 +341,9 @@ binary-indep: install-indep git-doc.deb git-arch.deb git-cvs.deb git-svn.deb \ dpkg-gencontrol -isp -pgit$$i -P'$(GIT)'$$i && \ dpkg -b '$(GIT)'$$i .. || exit 1; \ done + dpkg-gencontrol -isp -ppython-git-remote-helpers -P'$(PYGIT)' \ + -Tdebian/python-substvars + dpkg -b '$(PYGIT)' .. .PHONY: patch clean .PHONY: build build-arch build-indep diff --git a/git_remote_helpers/Makefile b/git_remote_helpers/Makefile index 74b05dc9..27e43b8e 100644 --- a/git_remote_helpers/Makefile +++ b/git_remote_helpers/Makefile @@ -29,7 +29,8 @@ all: $(pysetupfile) $(QUIET)$(PYTHON_PATH) $(pysetupfile) $(QUIETSETUP) build install: $(pysetupfile) - $(PYTHON_PATH) $(pysetupfile) install --prefix $(DESTDIR_SQ)$(prefix) + $(PYTHON_PATH) $(pysetupfile) install \ + --prefix $(DESTDIR_SQ)$(prefix) --install-layout deb instlibdir: $(pysetupfile) @echo "$(DESTDIR_SQ)$(prefix)/$(PYLIBDIR)" -- 1.7.8.rc1 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org