[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#511680: soprano: Please package version 2.1.64



tags 511680 + patch
thanks

On Tue, Jan 13, 2009 at 01:23:23PM +0100, Olivier Berger wrote:
> 
> Version 2.1.64 seems is packaged for Ubuntu.
> 
> Please port that packaging to Debian.
> 

I made some quick and dirty changes to make it build on my Lenny system (with a mix of unstable packages).

Here's the resulting interdiff -z soprano_2.1.64+dfsg.1-0ubuntu1.diff.gz soprano_2.1.64+dfsg.1-1.diff.gz

Hope this helps,

diff -u soprano-2.1.64+dfsg.1/debian/rules soprano-2.1.64+dfsg.1/debian/rules
--- soprano-2.1.64+dfsg.1/debian/rules
+++ soprano-2.1.64+dfsg.1/debian/rules
@@ -2,10 +2,12 @@
 
 DEB_DH_MAKESHLIBS_ARGS_libsoprano4 = -V'libsoprano4 (>= 2.1.64)'
 
-include /usr/share/cdbs/1/class/kde4.mk
+#include /usr/share/cdbs/1/class/kde4.mk
+include debian/cdbs/kde.mk
 
 build/libsoprano-doc::
-	cp /usr/share/qt4/doc/html/qt.tags $(DEB_BUILDDIR)/qt.tags
+	#cp /usr/share/qt4/doc/html/qt.tags $(DEB_BUILDDIR)/qt.tags
+	cp qt4.tag $(DEB_BUILDDIR)/qt4.tag
 	cd $(DEB_BUILDDIR) && $(MAKE) apidox
 
 install/libsoprano-doc::
diff -u soprano-2.1.64+dfsg.1/debian/changelog soprano-2.1.64+dfsg.1/debian/changelog
--- soprano-2.1.64+dfsg.1/debian/changelog
+++ soprano-2.1.64+dfsg.1/debian/changelog
@@ -1,3 +1,9 @@
+soprano (2.1.64+dfsg.1-1) UNRELEASED; urgency=low
+
+  * Debian version
+
+ -- Olivier Berger <olivier.berger@it-sudparis.eu>  Tue, 13 Jan 2009 13:02:25 +0100
+
 soprano (2.1.64+dfsg.1-0ubuntu1) jaunty; urgency=low
 
   * New upstream release
diff -u soprano-2.1.64+dfsg.1/debian/control soprano-2.1.64+dfsg.1/debian/control
--- soprano-2.1.64+dfsg.1/debian/control
+++ soprano-2.1.64+dfsg.1/debian/control
@@ -5,7 +5,7 @@
 XSBC-Original-Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
 Uploaders: Sune Vuorela <debian@pusling.com>, Ana Beatriz Guerrero Lopez <ana@debian.org>, Armin Berres <trigger+debian@space-based.de>, Fathi Boudra <fabo@debian.org>, Matthew Rosewarne <mrosewarne@inoutbox.com>
 Build-Depends: cdbs (>= 0.4.52), debhelper (>= 5), cmake (>=2.6.0~), quilt,
- libclucene-dev, libqt4-dev (>= 4.4.3-1ubuntu4), librdf0-dev, doxygen,
+ libclucene-dev, libqt4-dev (>= 4.4.3), librdf0-dev, doxygen,
  graphviz, kdesdk-scripts
 Standards-Version: 3.8.0
 Homepage: http://soprano.sourceforge.net
only in patch2:
unchanged:
--- soprano-2.1.64+dfsg.1.orig/debian/cdbs/kde.mk
+++ soprano-2.1.64+dfsg.1/debian/cdbs/kde.mk
@@ -0,0 +1,73 @@
+include /usr/share/cdbs/1/class/cmake.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/patchsys-quilt.mk
+include /usr/share/cdbs/1/rules/utils.mk
+
+# Include default KDE 4 cmake configuration variables
+include debian/cdbs/variables.mk
+# Pass standard KDE 4 flags to cmake via appropriate CDBS variable
+# (DEB_CMAKE_EXTRA_FLAGS)
+DEB_CMAKE_EXTRA_FLAGS += $(DEB_CMAKE_KDE4_FLAGS) $(DEB_CMAKE_CUSTOM_FLAGS)
+
+DEB_COMPRESS_EXCLUDE = .dcl .docbook -license .tag .sty .el
+
+#DEB_CMAKE_PREFIX = /usr/lib/kde4
+DEB_DH_INSTALL_SOURCEDIR = debian/tmp
+#DEB_DH_SHLIBDEPS_ARGS = -l/usr/lib/kde4/lib/
+DEB_KDE_ENABLE_FINAL ?=
+#DEB_MAKE_ENVVARS += XDG_CONFIG_DIRS=/etc/xdg XDG_DATA_DIRS=/usr/share
+#DEB_STRIP_EXCLUDE = so
+
+common-build-arch:: debian/stamp-man-pages
+debian/stamp-man-pages:
+	if ! test -d debian/man/out; then mkdir -p debian/man/out; fi
+	for f in $$(find debian/man -name '*.sgml'); do \
+		docbook-to-man $$f > debian/man/out/`basename $$f .sgml`.1; \
+	done
+	for f in $$(find debian/man -name '*.man'); do \
+		soelim -I debian/man $$f \
+		> debian/man/out/`basename $$f .man`.`head -n1 $$f | awk '{print $$NF}'`; \
+	done
+	touch debian/stamp-man-pages
+
+clean::
+ifndef THIS_SHOULD_GO_TO_UNSTABLE
+	#guard against experimental uploads to unstable
+	dpkg-parsechangelog | grep ^Distribution | grep -q 'experimental\|UNRELEASED'
+endif
+	rm -rf debian/man/out
+	-rmdir debian/man
+	rm -f debian/stamp-man-pages
+	rm -f CMakeCache.txt
+
+
+$(patsubst %,binary-install/%,$(DEB_PACKAGES)) :: binary-install/%:
+	if test -x /usr/bin/dh_desktop; then dh_desktop -p$(cdbs_curpkg) $(DEB_DH_DESKTOP_ARGS); fi
+	if test -e debian/$(cdbs_curpkg).lintian; then \
+		install -p -D -m644 debian/$(cdbs_curpkg).lintian \
+			debian/$(cdbs_curpkg)/usr/share/lintian/overrides/$(cdbs_curpkg); \
+	fi
+	if test -e debian/$(cdbs_curpkg).presubj; then \
+		install -p -D -m644 debian/$(cdbs_curpkg).presubj \
+			debian/$(cdbs_curpkg)/usr/share/bug/$(cdbs_curpkg)/presubj; \
+	fi
+
+binary-install/$(DEB_SOURCE_PACKAGE)-doc-html::
+	set -e; \
+	for doc in `cd $(DEB_DESTDIR)/usr/share/doc/kde/HTML/en; find . -name index.docbook`; do \
+		pkg=$${doc%/index.docbook}; pkg=$${pkg#./}; \
+		echo Building $$pkg HTML docs...; \
+		mkdir -p $(CURDIR)/debian/$(DEB_SOURCE_PACKAGE)-doc-html/usr/share/doc/kde/HTML/en/$$pkg; \
+		cd $(CURDIR)/debian/$(DEB_SOURCE_PACKAGE)-doc-html/usr/share/doc/kde/HTML/en/$$pkg; \
+		meinproc4 $(DEB_DESTDIR)/usr/share/doc/kde/HTML/en/$$pkg/index.docbook; \
+	done
+	for pkg in $(DOC_HTML_PRUNE) ; do \
+		rm -rf debian/$(DEB_SOURCE_PACKAGE)-doc-html/usr/share/doc/kde/HTML/en/$$pkg; \
+	done
+
+
+# Process "sameVersionDep:" substvars
+DH_SAMEVERSIONDEPS=debian/cdbs/dh_sameversiondeps
+common-binary-predeb-arch common-binary-predeb-indep::
+	@if [ ! -x "$(DH_SAMEVERSIONDEPS)" ]; then chmod a+x "$(DH_SAMEVERSIONDEPS)"; fi
+	$(DH_SAMEVERSIONDEPS) $(if $(filter common-binary-predeb-arch,$@),-a,-i)
only in patch2:
unchanged:
--- soprano-2.1.64+dfsg.1.orig/debian/cdbs/dh_sameversiondeps
+++ soprano-2.1.64+dfsg.1/debian/cdbs/dh_sameversiondeps
@@ -0,0 +1,257 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Dpkg::Control;
+use Dpkg::Substvars;
+use Dpkg::ErrorHandling;
+use File::Copy;
+
+use Debian::Debhelper::Dh_Lib;
+
+my $namespace = "sameVersionDep";
+my @fields = qw(Depends Recommends Suggests Enhances Pre-Depends);
+my $re_fields = join("|", @fields);
+my $re_pkgname = qr/[a-z0-9][a-z0-9+.-]*/;
+my $re_oursubstvar = qr/\$\{($namespace:(.*?))\}/;
+my $re_splitsubstvar = qr/^($re_pkgname)(?::($re_pkgname))?(?:-($re_fields))?$/;
+
+# Global substvars file
+my $g_substvars = new Dpkg::Substvars;
+$g_substvars->parse("debian/substvars") if (-r "debian/substvars");
+
+sub extract_package_names {
+    my $val = shift;
+    $val =~ s/\([^)]+\)//g;
+    $val =~ s/^\s+//;
+    $val =~ s/\s+$//;
+    return split(/\s*,\s*/, $val);
+}
+
+sub Shlibsvars::new {
+    my ($cls, $package, $control, $substvars_file) = @_;
+    my $self = bless ( {
+        "package" => $package,
+        "control" => $control,
+        "file" => $substvars_file,
+        }, $cls);
+    $self->{substvars} = new Dpkg::Substvars;
+    if (-r $self->{file}) {
+        $self->{substvars}->parse($self->{file});
+    }
+    return $self;
+}
+
+sub Shlibsvars::get_fieldval {
+    my ($self, $field) = @_;
+
+    my $pkg = $self->{control}->get_pkg_by_name($self->{package});
+    return undef if (!defined $pkg || !exists $pkg->{$field});
+
+    # Turn of warnings for substvars runs
+    my $save_quiet = $Dpkg::ErrorHandling::quiet_warnings;
+    $Dpkg::ErrorHandling::quiet_warnings = 1;
+
+    my $val = $pkg->{$field};
+    $val = $self->{substvars}->substvars($val);
+    $val = $g_substvars->substvars($val);
+
+    $Dpkg::ErrorHandling::quiet_warnings = $save_quiet;
+    return $val;
+}
+
+sub Shlibsvars::extract_deps {
+    my ($self, $field, $deppkg) = @_;
+
+    my $val = $self->get_fieldval($field);
+    return undef() unless defined $val;
+
+    # Extract dependency fields we need
+    my @matched_deps;
+    for my $dep (split(/\s*,\s*/, $val)) {
+        if ($dep =~ /^\Q$deppkg\E(?:$|[\W])/) {
+            push @matched_deps, $dep;
+        }
+    }
+    return @matched_deps;
+}
+
+sub Shlibsvars::get_dep_package_names {
+    my ($self, $field) = @_;
+
+    my $val = $self->get_fieldval($field);
+    return undef() unless defined $val;
+    return extract_package_names($val);
+}
+
+sub get_package_dpkg_status {
+    my $binpkgs = shift;
+    my $fields = shift;
+    $fields = [ "Source", "Version" ] unless defined $fields;
+    my $regexp_fields = join("|", @$fields);
+    my %status;
+
+    my $pid = open(DPKG, "-|");
+    error("cannot fork for dpkg-query --status") unless defined($pid);
+    if (!$pid) {
+        # Child process running dpkg --search and discarding errors
+        close STDERR;
+        open STDERR, ">", "/dev/null";
+        $ENV{LC_ALL} = "C";
+        exec("dpkg-query", "--status", "--", @$binpkgs) or error("cannot exec dpkg-query");
+    }
+    my $curpkg;
+    while (defined($_ = <DPKG>)) {
+        if (m/^Package:\s*(.*)$/) {
+            $curpkg = $1;
+            $status{$curpkg} = {};
+        } elsif (defined($curpkg)) {
+            if (m/^($regexp_fields):\s*(.*)$/) {
+                my $field = $1;
+                error("Dublicate field $field for the $curpkg package in the dpkg status file")
+                    if (exists $status{$curpkg}{$field});
+                $status{$curpkg}{$field} = $2;
+            }
+        } else {
+            error("Missing Package entry at $.");
+        }
+    }
+    close(DPKG);
+
+    # Check if all packages were processed
+    for my $pkg (@$binpkgs) {
+        error("Package $pkg was not found in the dpkg status") unless exists $status{$pkg};
+    }
+    return \%status;
+}
+
+sub write_substvar($$$$) {
+    my ($pkgname, $varname, $value, $substvars) = @_;
+    my @contents;
+    my $varset = 0;
+
+    my $file = (-r $substvars) ? $substvars : "debian/substvars";
+    if (-r $file) {
+        open(FILE, "<$file") or die "Unable to open substvars file '$file' for reading\n";
+        while (<FILE>) {
+            if (!$varset && /^\s*\Q$varname=\E/) {
+                push @contents, "$varname=$value\n";
+                $varset = 1;
+            } else {
+                push @contents, $_;
+            }
+        }
+        close(FILE);
+    } else {
+        # Fallback to default
+        $file = $substvars;
+    }
+
+    open(FILE, ">$file.tmp") or die "Unable to open substvars file '$file.tmp' for writing\n";
+    for (@contents) {
+        print FILE $_;
+    }
+    if (!$varset) {
+        print FILE "$varname=$value", "\n";
+    }
+    close(FILE);
+
+    File::Copy::move("$file.tmp", "$file");
+}
+
+init();
+
+my $control = new Dpkg::Control;
+my %shlibsvars;
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+    my $pkg_substvars = sprintf("debian/%ssubstvars", pkgext($package));
+    my $pkg = $control->get_pkg_by_name($package);
+
+    for my $fieldname (@fields) {
+        if (exists $pkg->{$fieldname}) {
+            my $fieldval = $pkg->{$fieldname};
+            my $pkgname = $pkg->{Package};
+
+            while ($fieldval =~ m/\G.*?$re_oursubstvar/gs) {
+                my $varname = $1;
+                my $varparams = $2;
+                if ($varparams =~ m/$re_splitsubstvar/) {
+                    my $dep2add = $1;
+                    my $scanpkg = $2;
+                    $scanpkg = $dh{MAINPACKAGE} unless defined $scanpkg;
+                    my $deptype = $3;
+                    $deptype = $fieldname unless defined $deptype;
+
+                    if (!exists $shlibsvars{$scanpkg}) {
+                        my $scan_substvars = sprintf("debian/%ssubstvars", pkgext($scanpkg));
+                        $shlibsvars{$scanpkg} = new Shlibsvars($scanpkg, $control, $scan_substvars);
+                    }
+
+                    # Get dpkg status information about dep2add package
+                    my $dep2add_status = get_package_dpkg_status( [ $dep2add ], [ "Source", "Version", $deptype ] );
+                    $dep2add_status = $dep2add_status->{$dep2add};
+
+                    # Check validility of dep2add status
+                    error("Could not retreive source package name for $dep2add package. Is it installed?")
+                        unless exists $dep2add_status->{Source} && exists $dep2add_status->{Version};
+                    error("Package $dep2add has no $deptype field. This configuration is unsupported. ")
+                        unless exists $dep2add_status->{$deptype};
+                    my @dep2add_deps = extract_package_names($dep2add_status->{$deptype});
+
+                    # Get deptype packages of scanpkg
+                    my $vars = $shlibsvars{$scanpkg};
+                    my @scan_deps = $vars->get_dep_package_names($deptype);
+
+                    # Intersect both _deps arrays to find common dependencies
+                    my @commondeps;
+                    {
+                        my %_map;
+                        map { $_map{$_} = 1; } @scan_deps;
+                        map { push @commondeps, $_ if exists $_map{$_} } @dep2add_deps;
+                    }
+
+                    # Get status information about common packages. They need to come from the
+                    # same source package as dep2add package and their versions should match
+                    my $depstatus = get_package_dpkg_status(\@commondeps, [ "Source", "Version" ]);
+                    @commondeps = ();
+                    while (my ($pkg, $status) = each(%$depstatus)) {
+                        push @commondeps, $pkg
+                            if (exists $status->{Source} && exists $status->{Version} &&
+                                ($status->{Source} eq $dep2add_status->{Source}) && 
+                                ($status->{Version} eq $dep2add_status->{Version}));
+                    }
+                    
+                    # Ideally we should have got the list down to one. if not, combine
+                    # version relationships
+                    my @fulldeps;
+                    if (!@commondeps) {
+                        error("$0: no same version dependencies for '$varname' found (at $fieldname of the $package package)");
+                    } else {
+                        for my $deppkg (@commondeps) {
+                            my @deps = $vars->extract_deps($deptype, $deppkg);
+                            map s/\b\Q$deppkg\E\b/$dep2add/g, @deps;
+                            push @fulldeps, @deps;
+                        }
+
+                        # Drop dupes
+                        @fulldeps = sort @fulldeps;
+                        my @uniqdeps;
+                        my $_prevdep;
+                        for my $dep (@fulldeps) {
+                            my $tmp = "$dep";
+                            $tmp =~ s/\s//g;
+                            push @uniqdeps, $dep if (!defined $_prevdep || $_prevdep ne $tmp);
+                            $_prevdep = $tmp;
+                        }
+                        # Write substvar for the package
+                        write_substvar($pkgname, $varname, join(", ", @uniqdeps), $pkg_substvars);
+                    }
+                } else {
+                    error("Invalid '$namespace' substvar syntax: $varparams");
+                }
+            }
+        }
+    }
+}
+
+exit 0
only in patch2:
unchanged:
--- soprano-2.1.64+dfsg.1.orig/debian/cdbs/variables.mk
+++ soprano-2.1.64+dfsg.1/debian/cdbs/variables.mk
@@ -0,0 +1,49 @@
+# KDE 4 global configuration file installation directory
+DEB_CONFIG_INSTALL_DIR ?= /usr/share/kde4/config
+
+# Standard Debian KDE 4 cmake flags
+DEB_CMAKE_KDE4_FLAGS += \
+        -DCMAKE_BUILD_TYPE=Debian \
+        -DKDE4_ENABLE_FINAL=$(KDE4-ENABLE-FINAL) \
+        -DKDE4_BUILD_TESTS=false \
+        -DKDE_DISTRIBUTION_TEXT="Debian packages" \
+        -DKDE_DEFAULT_HOME=.kde4 \
+        -DCMAKE_SKIP_RPATH=true \
+        -DKDE4_USE_ALWAYS_FULL_RPATH=false \
+        -DCONFIG_INSTALL_DIR=$(DEB_CONFIG_INSTALL_DIR) \
+        -DDATA_INSTALL_DIR=/usr/share/kde4/apps \
+        -DHTML_INSTALL_DIR=/usr/share/doc/kde4/HTML \
+        -DKCFG_INSTALL_DIR=/usr/share/kde4/config.kcfg \
+        -DLIB_INSTALL_DIR=/usr/lib \
+        -DSYSCONF_INSTALL_DIR=/etc
+
+# Support building with enable final (disabled by default)
+DEB_KDE_ENABLE_FINAL ?=
+KDE4-ENABLE-FINAL := false
+ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+    treat_me_gently_arches := arm m68k alpha ppc64 armel armeb
+    DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
+    ifeq (,$(filter $(DEB_HOST_ARCH_CPU),$(treat_me_gently_arches)))
+        KDE4-ENABLE-FINAL := $(if $(DEB_KDE_ENABLE_FINAL),true,false)
+    endif
+endif
+
+#### Default additional (custom) cmake flags ####
+DEB_CMAKE_CUSTOM_FLAGS ?=
+
+# Set the one below to something else than 'yes' to disable linking 
+# with --as-needed (on by default)
+DEB_KDE_LINK_WITH_AS_NEEDED ?= yes
+ifneq (,$(findstring yes, $(DEB_KDE_LINK_WITH_AS_NEEDED)))
+    ifeq (,$(findstring no-as-needed, $(DEB_BUILD_OPTIONS)))
+        DEB_KDE_LINK_WITH_AS_NEEDED := yes
+        DEB_CMAKE_CUSTOM_FLAGS += \
+            -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--no-undefined -Wl,--as-needed" \
+            -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined -Wl,--as-needed" \
+            -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined -Wl,--as-needed"
+    else
+        DEB_KDE_LINK_WITH_AS_NEEDED := no
+    endif
+else
+    DEB_KDE_LINK_WITH_AS_NEEDED := no
+endif

Reply to: