From a0258d526ee5cffa2f117ff7babe3e228f8538c7 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Wed, 24 Nov 2004 10:00:20 +0000 Subject: It makes packages, sort of Author: jgg Date: 2001-04-06 05:30:09 GMT It makes packages, sort of --- configure.in | 1 + debian/changelog | 5 +++++ debian/control | 7 ++++++ debian/rules | 57 ++++++++++++++++++++++++++++++++++--------------- doc/makefile | 12 +++++++++++ python/apt_pkgmodule.cc | 41 ++++++++++++++++++++++++++++++++++- 6 files changed, 105 insertions(+), 18 deletions(-) create mode 100644 debian/changelog create mode 100644 doc/makefile diff --git a/configure.in b/configure.in index ba614013..e62985c2 100644 --- a/configure.in +++ b/configure.in @@ -14,6 +14,7 @@ libs: include: @echo \$(INCLUDEPY) EOF + AC_CACHE_CHECK("python libs", ac_cv_libs_python, [ac_cv_libs_python=`make -s -f pytest libs 2> /dev/null`]) AC_CACHE_CHECK("python include", ac_cv_include_python, [ac_cv_include_python=`make -s -f pytest include 2> /dev/null`]) AC_CHECK_HEADER(python$ac_cv_ver_python/Python.h, diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..58c7cba5 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +python-apt (0.5.4) unstable; urgency=low + + * Initial packaging + + -- Jason Gunthorpe Thu, 5 Apr 2001 23:22:29 -0600 diff --git a/debian/control b/debian/control index 7463bc9c..b355b7bb 100644 --- a/debian/control +++ b/debian/control @@ -1,3 +1,10 @@ +Source: python-apt +Section: devel +Priority: optional +Maintainer: APT Development Team +Standards-Version: 3.1.1 +Build-Depends: debhelper, libapt-pkg-dev + Package: python-apt Architecture: any Depends: ${shlibs:Depends} diff --git a/debian/rules b/debian/rules index a6919824..060656b6 100755 --- a/debian/rules +++ b/debian/rules @@ -1,23 +1,46 @@ +#!/usr/bin/make -f -python-apt: build debian/shlibs.local - dh_testdir -p$@ - dh_testroot -p$@ - dh_clean -p$@ -k - dh_installdirs -p$@ +BLD := $(PWD)/build +DHOPTS = -p$@ -Pdebian/$@ +PYTHONVER = 1.5 + +build: + # At the moment you must do alot of manual work to setup the + # build directory. It should be symlinked to a valid APT build + # dir, and the python variables re-inserted into the environment.mak + # Then make in doc and python. + echo "Must be prebuilt" +clean: + dh_testdir + dh_clean + +binary-indep: build + +binary-arch: build python-apt + +python-apt: build + cp build/../debian/shlibs.local debian/shlibs.local + dh_testdir $(DHOPTS) + dh_testroot $(DHOPTS) + dh_clean $(DHOPTS) -k + dh_installdirs $(DHOPTS) # install the modules cp $(BLD)/bin/apt_pkgmodule.so $(BLD)/bin/apt_instmodule.so debian/$@/usr/lib/python$(PYTHONVER)/site-packages/ - dh_installdocs -p$@ - dh_installexamples -p$@ $(BLD)/docs/examples/python/* - - dh_installchangelogs -p$@ - dh_strip -p$@ - dh_compress -p$@ - dh_fixperms -p$@ - dh_installdeb -p$@ - LD_LIBRARY_PATH=`pwd`/debian/tmp/usr/lib:`pwd`/debian/apt-utils/usr/lib dh_shlibdeps -p$@ - dh_gencontrol -p$@ - dh_md5sums -p$@ - dh_builddeb -p$@ + dh_installdocs $(DHOPTS) + dh_installexamples $(DHOPTS) $(BLD)/docs/examples/* + + dh_installchangelogs $(DHOPTS) + dh_strip $(DHOPTS) + dh_compress $(DHOPTS) + dh_fixperms $(DHOPTS) + dh_installdeb $(DHOPTS) + LD_LIBRARY_PATH=`pwd`/build/bin dh_shlibdeps $(DHOPTS) -- -Lbuild/../debian/shlibs.local + dh_gencontrol $(DHOPTS) + dh_md5sums $(DHOPTS) + dh_builddeb $(DHOPTS) + +binary: binary-indep binary-arch +.PHONY: binary binary-arch binary-indep clean checkroot diff --git a/doc/makefile b/doc/makefile new file mode 100644 index 00000000..5f8fc182 --- /dev/null +++ b/doc/makefile @@ -0,0 +1,12 @@ +# -*- make -*- +BASE=.. +SUBDIR=doc + +# Bring in the default rules +include ../buildlib/defaults.mak + +# Examples +SOURCE = examples/config.py examples/configisc.py examples/tagfile.py \ + examples/versiontest.py +TO = $(DOC) +include $(COPY_H) diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index d48eed0b..27ca20db 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt_pkgmodule.cc,v 1.2 2001/02/23 05:46:02 jgg Exp $ +// $Id: apt_pkgmodule.cc,v 1.3 2001/04/06 05:30:09 jgg Exp $ /* ###################################################################### apt_pkgmodule - Top level for the python module. Create the internal @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -195,6 +196,43 @@ static PyObject *md5sum(PyObject *Self,PyObject *Args) return CppPyString(Sum.Result().Value()); } + PyErr_SetString(PyExc_TypeError,"Only understand strings and files"); + return 0; +} + /*}}}*/ +// sha1sum - Compute the sha1sum of a file or string /*{{{*/ +// --------------------------------------------------------------------- +static char *doc_sha1sum = "sha1sum(String) -> String or sha1sum(File) -> String"; +static PyObject *sha1sum(PyObject *Self,PyObject *Args) +{ + PyObject *Obj; + if (PyArg_ParseTuple(Args,"O",&Obj) == 0) + return 0; + + // Digest of a string. + if (PyString_Check(Obj) != 0) + { + SHA1Summation Sum; + Sum.Add(PyString_AsString(Obj)); + return CppPyString(Sum.Result().Value()); + } + + // Digest of a file + if (PyFile_Check(Obj) != 0) + { + SHA1Summation Sum; + int Fd = fileno(PyFile_AsFile(Obj)); + struct stat St; + if (fstat(Fd,&St) != 0 || + Sum.AddFD(Fd,St.st_size) == false) + { + PyErr_SetFromErrno(PyExc_SystemError); + return 0; + } + + return CppPyString(Sum.Result().Value()); + } + PyErr_SetString(PyExc_TypeError,"Only understand strings and files"); return 0; } @@ -277,6 +315,7 @@ static PyMethodDef methods[] = // Stuff {"md5sum",md5sum,METH_VARARGS,doc_md5sum}, + {"sha1sum",sha1sum,METH_VARARGS,doc_sha1sum}, // Strings {"CheckDomainList",StrCheckDomainList,METH_VARARGS,"CheckDomainList(String,String) -> Bool"}, -- cgit v1.2.3