From 6249a27ea72b83726975bfa6771b226f325c1a95 Mon Sep 17 00:00:00 2001 From: nima Date: Fri, 19 Dec 2008 04:07:06 +0000 Subject: Further work in enforcing the Debian policy in package based on advice from `POX' and the documentation. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@119 abc39116-655e-4be6-ad55-d661dc543056 --- BUILD.Linux/dmidecode.spec | 47 ++++++++++++++----------- Makefile | 74 +++++++++++++++++++++++++++++++++++++++ debian/changelog | 2 +- debian/control | 12 +++---- debian/dirs | 0 debian/install | 0 debian/python-dmidecode.substvars | 3 ++ debian/rules | 8 ++--- dmidecode.makefile | 73 -------------------------------------- 9 files changed, 115 insertions(+), 104 deletions(-) create mode 100644 Makefile delete mode 100644 debian/dirs delete mode 100644 debian/install delete mode 100644 dmidecode.makefile diff --git a/BUILD.Linux/dmidecode.spec b/BUILD.Linux/dmidecode.spec index 2474e61..54c0458 100644 --- a/BUILD.Linux/dmidecode.spec +++ b/BUILD.Linux/dmidecode.spec @@ -1,37 +1,44 @@ -%define shortname dmidecode -%define name python-dmidecode -%define version 0.1 -%define unmangled_version 0.1 -%define release 1 - -Summary: Python wrapper around dmidecode -Name: %{name} -Version: %{version} -Release: %{release}.%{dist} +%define is_not_debian %(test -e /etc/debian_version && echo 1 || echo 0) + +Summary: Python extension module for dmidecode. +Name: python-dmidecode +Version: 2.10 +Release: 0%?{dist} Requires: redhat-lsb -Source: %{shortname}-%{unmangled_version}.tar.gz +Source: %{name}-%{version}.tar.gz License: GNU GPL v3 -Group: Development/Libraries -BuildRoot: %{_tmppath}/%{shortname}-buildroot +Group: System Environment/Libraries +BuildRoot: %{_tmppath}/%{name}-buildroot Prefix: %{_prefix} Vendor: Autonomy -BuildRequires: python-devel +%{?!is_not_debian:BuildRequires: python-devel} Url: http://projects.autonomy.net.au/dmidecode/ %description -The python module for dmidecode, written in C. + The Desktop Management Interface provides a standardized description of + a computer's hardware, including characteristics such as BIOS serial + number and hardware connectors. + + python-dmidecode provides an interface to the DMI data available from + the BIOS. It is intended to be used as a back-end tool by other + hardware detection programs implemented in python. %prep -%setup -n %{shortname}-%{unmangled_version} -python setup.py clean +%setup -q -n %{name}-%{version} +python src/setup.py clean %build -python setup.py build +python src/setup.py build %install -python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_OBJECTS +python src/setup.py install --root=%{buildroot} --record=INSTALLED_OBJECTS %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %files -f INSTALLED_OBJECTS + +%changelog +* Fri Dec 19 2008 Nima Talebi - 2.10-0 +- Initial release + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6c1a572 --- /dev/null +++ b/Makefile @@ -0,0 +1,74 @@ +#. +#. DMI Decode Python Module +#. +#. (C) 2008 Nima Talebi +#. +#. Licensed under the GNU Public License v3 +#. + +PY := $(shell python -V 2>&1 |sed -e 's/.\(ython\) \(2\.[0-9]\)\..*/p\1\2/') +PY_VER := $(subst python,,$(PY)) + +CC := gcc +RM := rm -f +SRC_D := src +OBJ_D := lib +CFLAGS = -g -D_XOPEN_SOURCE=600 +CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align +CFLAGS += -Wwrite-strings -Wmissing-prototypes -Winline -Wundef #-Wcast-qual +CFLAGS += -pthread -fno-strict-aliasing -DNDEBUG -fPIC +CFLAGS += -I/usr/include/$(PY) +CFLAGS += -O3 +#CFLAGS += -DNDEBUG +#CFLAGS += -DBIGENDIAN +#CFLAGS += -DALIGNMENT_WORKAROUND +#LDFLAGS = -lefence +LDFLAGS = +SOFLAGS = -pthread -shared -L/home/nima/dev-room/projects/dmidecode -lutil +SO = build/lib.linux-$(shell uname -m)-$(PY_VER)/dmidecode.so + +#. Search +vpath %.o $(OBJ_D) +vpath %.c $(SRC_D) +vpath %.h $(SRC_D) +vpath % $(OBJ_D) + +############################################################################### +build: dmidecode.so +dmidecode.so: $(SO) + cp $< $(PY)-$@ + +$(SO): + $(PY) src/setup.py build + +############################################################################### +libdmidecode.so: dmihelper.o util.o dmioem.o dmidecode.o dmidecodemodule.o + $(CC) $(LDFLAGS) $(SOFLAGS) $^ -o $@ + +$(OBJ_D)/dmidecodemodule.o: dmidecodemodule.c + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJ_D)/dmidecode.o: dmidecode.c version.h types.h util.h config.h dmidecode.h dmioem.h + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJ_D)/dmihelper.o: dmihelper.c dmihelper.h + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJ_D)/util.o: util.c types.h util.h config.h + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJ_D)/dmioem.o: dmioem.c types.h dmidecode.h dmioem.h + $(CC) $(CFLAGS) -c -o $@ $< + + + +############################################################################### +uninstall: + rm -f $(SO) + +clean : + $(PY) src/setup.py clean + -$(RM) *.so lib/*.o core + -rm -rf build + +.PHONY: install clean uninstall module build diff --git a/debian/changelog b/debian/changelog index e8b3ad2..d75e6f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -dmidecode (0.1-1) unstable; urgency=low +python-dmidecode (2.10-1) unstable; urgency=low * Initial release (Closes: #nnnn) diff --git a/debian/control b/debian/control index e443346..f0fcb19 100644 --- a/debian/control +++ b/debian/control @@ -1,14 +1,14 @@ -Source: dmidecode +Source: python-dmidecode +XS-Python-Version: (>= 2.3) Section: utils Priority: optional -Maintainer: Nima Talebi +Maintainer: Nima Talebi Build-Depends: debhelper (>= 5), python-all-dev (>= 2.3.5-11), python-central (>= 0.6) -Standards-Version: 3.7.2 -XB-Python-Version: ${python:Versions} -XS-Python-Version: current +Standards-Version: 3.8.0 Package: python-dmidecode -Architecture: i386 +XB-Python-Version: ${python:Versions} +Architecture: any Provides: ${python:Provides} Depends: ${python:Depends}, ${shlibs:Depends} Description: Python extension module for dmidecode. diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index e69de29..0000000 diff --git a/debian/install b/debian/install deleted file mode 100644 index e69de29..0000000 diff --git a/debian/python-dmidecode.substvars b/debian/python-dmidecode.substvars index 36e5a58..e3510f6 100644 --- a/debian/python-dmidecode.substvars +++ b/debian/python-dmidecode.substvars @@ -1 +1,4 @@ +python:Versions=2.4, 2.5 +python:Provides=python2.4-dmidecode, python2.5-dmidecode +python:Depends=python-central (>= 0.6.7), python (<< 2.6), python (>= 2.4) shlibs:Depends=libc6 (>= 2.7-1) diff --git a/debian/rules b/debian/rules index 98488c4..40f5a22 100755 --- a/debian/rules +++ b/debian/rules @@ -11,8 +11,8 @@ PYVERS = python2.4 python2.5 build: build-stamp build-stamp: $(PYVERS:%=build-ext-%) dh_testdir - #docbook-to-man debian/dmidecode.sgml > dmidecode.1 - #$(MAKE) -f dmidecode.makefile + #docbook-to-man debian/python-dmidecode.sgml > python-dmidecode.1 + #$(MAKE) -f Makefile touch $@ build-ext-%: $(subst $(PYDEF),python,$*) src/setup.py build @@ -24,7 +24,7 @@ install: install-stamp dh_testdir dh_testroot dh_installdirs - #$(MAKE) DESTDIR=$(CURDIR)/debian/dmidecode install + #$(MAKE) DESTDIR=$(CURDIR)/debian/python-dmidecode install install-stamp: build-stamp $(PYVERS:%=install-ext-%) install-ext-%: $(subst $(PYDEF),python,$*) src/setup.py install --root $(CURDIR)/debian/python-dmidecode @@ -37,7 +37,7 @@ clean: dh_testroot -rm -f build-stamp configure-stamp -rm -rf $(CURDIR)/debian/python-dmidecode - -$(MAKE) -f dmidecode.makefile clean + -$(MAKE) -f Makefile clean dh_clean diff --git a/dmidecode.makefile b/dmidecode.makefile deleted file mode 100644 index f4c9645..0000000 --- a/dmidecode.makefile +++ /dev/null @@ -1,73 +0,0 @@ -#. -#. DMI Decode Python Module -#. -#. (C) 2008 Nima Talebi -#. -#. Licensed under the GNU Public License v3 -#. - -PY := $(shell python -V 2>&1 |sed -e 's/.\(ython\) \(2\.[0-9]\)\..*/p\1\2/') -PY_VER = $(shell python -c 'import sys;print(sys.version[0:3])') -CC := gcc -RM := rm -f -SRC_D := src -OBJ_D := lib -CFLAGS = -g -D_XOPEN_SOURCE=600 -CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -CFLAGS += -Wwrite-strings -Wmissing-prototypes -Winline -Wundef #-Wcast-qual -CFLAGS += -pthread -fno-strict-aliasing -DNDEBUG -fPIC -CFLAGS += -I/usr/include/$(PY) -CFLAGS += -O3 -#CFLAGS += -DNDEBUG -#CFLAGS += -DBIGENDIAN -#CFLAGS += -DALIGNMENT_WORKAROUND -#LDFLAGS = -lefence -LDFLAGS = -SOFLAGS = -pthread -shared -L/home/nima/dev-room/projects/dmidecode -lutil -SO = build/lib.linux-$(shell uname -m)-$(PY_VER)/dmidecode.so - -#. Search -vpath %.o $(OBJ_D) -vpath %.c $(SRC_D) -vpath %.h $(SRC_D) -vpath % $(OBJ_D) - -############################################################################### -build: dmidecode.so -dmidecode.so: $(SO) - cp $< . - -$(SO): - $(PY) src/setup.py build - -############################################################################### -libdmidecode.so: dmihelper.o util.o dmioem.o dmidecode.o dmidecodemodule.o - $(CC) $(LDFLAGS) $(SOFLAGS) $^ -o $@ - -$(OBJ_D)/dmidecodemodule.o: dmidecodemodule.c - $(CC) $(CFLAGS) -c -o $@ $< - -$(OBJ_D)/dmidecode.o: dmidecode.c version.h types.h util.h config.h dmidecode.h dmioem.h - $(CC) $(CFLAGS) -c -o $@ $< - -$(OBJ_D)/dmihelper.o: dmihelper.c dmihelper.h - $(CC) $(CFLAGS) -c -o $@ $< - -$(OBJ_D)/util.o: util.c types.h util.h config.h - $(CC) $(CFLAGS) -c -o $@ $< - -$(OBJ_D)/dmioem.o: dmioem.c types.h dmidecode.h dmioem.h - $(CC) $(CFLAGS) -c -o $@ $< - - - -############################################################################### -uninstall: - rm -f $(SO) - -clean : - $(PY) src/setup.py clean - -$(RM) *.so lib/*.o core - -rm -rf build - -.PHONY: install clean uninstall module build -- cgit