rev 13483 - in branches/kde4.2/packages/pkg-kde-tools/trunk: . debian symbolshelper symbolshelper/Debian/PkgKde/SymHelper
Modestas Vainius
modax-guest at alioth.debian.org
Fri Jan 23 23:53:47 UTC 2009
Author: modax-guest
Date: 2009-01-23 23:53:47 +0000 (Fri, 23 Jan 2009)
New Revision: 13483
Added:
branches/kde4.2/packages/pkg-kde-tools/trunk/dh_sameversiondep
Modified:
branches/kde4.2/packages/pkg-kde-tools/trunk/Makefile
branches/kde4.2/packages/pkg-kde-tools/trunk/debian/changelog
branches/kde4.2/packages/pkg-kde-tools/trunk/debian/control
branches/kde4.2/packages/pkg-kde-tools/trunk/debian/copyright
branches/kde4.2/packages/pkg-kde-tools/trunk/debian/rules
branches/kde4.2/packages/pkg-kde-tools/trunk/symbolshelper/Debian/PkgKde/SymHelper/Handlers.pm
branches/kde4.2/packages/pkg-kde-tools/trunk/symbolshelper/pkgkde-symbolshelper
Log:
* pkgkde-symbolshelper: add support for resorting symbol files (useful after
manual editing).
* pkgkde-symbolshelper create: add support for adding arch specific symbols
to the symbol template.
* Add dh_sameversiondep from official KDE packaging:
- make pkg-kde-tools suggest debhelper v7;
- add POD help and generate manual page from it;
- add support for the external reference package.
Modified: branches/kde4.2/packages/pkg-kde-tools/trunk/Makefile
===================================================================
--- branches/kde4.2/packages/pkg-kde-tools/trunk/Makefile 2009-01-23 21:29:42 UTC (rev 13482)
+++ branches/kde4.2/packages/pkg-kde-tools/trunk/Makefile 2009-01-23 23:53:47 UTC (rev 13483)
@@ -1,8 +1,18 @@
PERLLIBDIR := $(shell perl -MConfig -e 'print $$Config{vendorlib}')
SYMBOLSHELPER_DIR := symbolshelper
+BINDIR := $(DESTDIR)/usr/bin
+MANDIR := $(DESTDIR)/usr/share/man
+
install:
- install -d $(DESTDIR)/usr/bin
+ install -d $(BINDIR) $(MANDIR)
+
+ # symbolshelper
cd $(SYMBOLSHELPER_DIR) && find Debian -type f -name "*.pm" -exec \
install -D -m 0644 {} $(DESTDIR)/$(PERLLIBDIR)/{} \;
install -m 0755 $(SYMBOLSHELPER_DIR)/pkgkde-symbolshelper $(DESTDIR)/usr/bin
+
+ # dh_sameversiondep
+ install -d $(MANDIR)/man1
+ pod2man dh_sameversiondep > $(MANDIR)/man1/dh_sameversiondep.1
+ install -m 0755 dh_sameversiondep $(BINDIR)
Modified: branches/kde4.2/packages/pkg-kde-tools/trunk/debian/changelog
===================================================================
--- branches/kde4.2/packages/pkg-kde-tools/trunk/debian/changelog 2009-01-23 21:29:42 UTC (rev 13482)
+++ branches/kde4.2/packages/pkg-kde-tools/trunk/debian/changelog 2009-01-23 23:53:47 UTC (rev 13483)
@@ -1,8 +1,15 @@
-pkg-kde-tools (0.3.2~pre1) UNRELEASED; urgency=low
+pkg-kde-tools (0.4.0~pre1) UNRELEASED; urgency=low
- * Add support for resorting symbol files (useful after manual editing).
+ * pkgkde-symbolshelper: add support for resorting symbol files (useful after
+ manual editing).
+ * pkgkde-symbolshelper create: add support for adding arch specific symbols
+ to the symbol template.
+ * Add dh_sameversiondep from official KDE packaging:
+ - make pkg-kde-tools suggest debhelper v7;
+ - add POD help and generate manual page from it;
+ - add support for the external reference package.
- -- Modestas Vainius <modestas at vainius.eu> Wed, 14 Jan 2009 15:29:21 +0200
+ -- Modestas Vainius <modestas at vainius.eu> Sat, 24 Jan 2009 01:26:33 +0200
pkg-kde-tools (0.3.1) experimental; urgency=low
Modified: branches/kde4.2/packages/pkg-kde-tools/trunk/debian/control
===================================================================
--- branches/kde4.2/packages/pkg-kde-tools/trunk/debian/control 2009-01-23 21:29:42 UTC (rev 13482)
+++ branches/kde4.2/packages/pkg-kde-tools/trunk/debian/control 2009-01-23 23:53:47 UTC (rev 13483)
@@ -10,7 +10,7 @@
Package: pkg-kde-tools
Architecture: all
Depends: ${perl:Depends}
-Suggests: debhelper, cdbs
+Suggests: debhelper (>= 7), cdbs
Description: common makesnippets and build scripts for KDE4 related packages
This package contains makefiles setting the default build arguments for KDE4
packages.
Modified: branches/kde4.2/packages/pkg-kde-tools/trunk/debian/copyright
===================================================================
--- branches/kde4.2/packages/pkg-kde-tools/trunk/debian/copyright 2009-01-23 21:29:42 UTC (rev 13482)
+++ branches/kde4.2/packages/pkg-kde-tools/trunk/debian/copyright 2009-01-23 23:53:47 UTC (rev 13483)
@@ -19,41 +19,43 @@
License (unless stated otherwise in the following paragraphs):
- This package is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ | This package is free software; you can redistribute it and/or modify
+ | it under the terms of the GNU General Public License as published by
+ | the Free Software Foundation; either version 2 of the License, or
+ | (at your option) any later version.
+ |
+ | This package is distributed in the hope that it will be useful,
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ | GNU General Public License for more details.
+ |
+ | You should have received a copy of the GNU General Public License
+ | along with this package; if not, write to the Free Software
+ | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- This package is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this package; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL-2'.
-The license and copyright for the software under "symbolshelper"
-directory are:
+The follwing license and copyright applies to the contents of:
- Copyright (C) 2008 Modestas Vainius <modestas at vainius.eu>
+ - "symbolshelper" directory;
+ - dh_sameversiondep script.
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ | Copyright (C) 2008 Modestas Vainius <modestas at vainius.eu>
+ |
+ | This program is free software: you can redistribute it and/or modify
+ | it under the terms of the GNU General Public License as published by
+ | the Free Software Foundation, either version 3 of the License, or
+ | (at your option) any later version.
+ |
+ | This program is distributed in the hope that it will be useful,
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ | GNU General Public License for more details.
+ |
+ | You should have received a copy of the GNU General Public License
+ | along with this program. If not, see <http://www.gnu.org/licenses/>
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>
-
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL-3'.
Modified: branches/kde4.2/packages/pkg-kde-tools/trunk/debian/rules
===================================================================
--- branches/kde4.2/packages/pkg-kde-tools/trunk/debian/rules 2009-01-23 21:29:42 UTC (rev 13482)
+++ branches/kde4.2/packages/pkg-kde-tools/trunk/debian/rules 2009-01-23 23:53:47 UTC (rev 13483)
@@ -18,6 +18,7 @@
dh_installdocs
dh_installexamples
dh_install
+ dh_installman
dh_link
dh_perl
dh_strip
Added: branches/kde4.2/packages/pkg-kde-tools/trunk/dh_sameversiondep
===================================================================
--- branches/kde4.2/packages/pkg-kde-tools/trunk/dh_sameversiondep (rev 0)
+++ branches/kde4.2/packages/pkg-kde-tools/trunk/dh_sameversiondep 2009-01-23 23:53:47 UTC (rev 13483)
@@ -0,0 +1,444 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_sameversiondep - generate versioned dependency based on the versioned
+dependencies of the reference package.
+
+=head1 SYNOPSIS
+
+B<dh_sameversiondep> [S<I<debhelper options>>]
+
+=head1 DESCRIPTION
+
+B<dh_sameversiondep> is a helper tool which is able to generate a dependency
+that is versioned the same way as a dependency (coming from the same source) of
+another reference package is versionized. B<dh_sameversiondep> scans
+debian/control for the specially formatted substvar (see L</sameVersionDep
+substvar SPECIFICATION> section below), determines its value and writes it to
+F<debian/package.substvars> file.
+
+The most common use case for B<dh_sameversiondep> tool is to keep your
+I<liba-dev> package dependency on the external I<libb-dev> package as tight as
+your I<liba> package depends on the respective external I<libb> package (see
+L</EXAMPLE> section for more information about this use case).
+
+B<dh_sameversiondep> works as follows:
+
+=over 4
+
+=item *
+
+Searches for the B<sameVersionDep> substvar in the Depends, Recommends,
+Suggests, Enhances and Pre-Depends fields of the requested packages. When one
+is found, it is parsed and the I<dependency package> name, I<reference package>
+name and I<dependency type> (either Depends or Recommends etc.) are determined.
+
+=item *
+
+All dependencies of the requested I<type> are collected for the I<dependency
+package> based on the I<dpkg-query --status> output.
+
+=item *
+
+All dependencies of the requested I<type> are collected for the I<reference
+package> either from F<debian/control> (substvars are expanded) or from
+I<dpkg-query --status> output if the package was not found in
+F<debian/control>.
+
+=item *
+
+Both collections are intersected leaving only common packages in both
+collections.
+
+=item *
+
+Common package list is filtered by leaving only those which come from the same
+source as I<dependency package>.
+
+=item *
+
+Whatever packages are left (most likely only one), their names are replaced
+with I<dependency package> name preserving all versioning information. This
+result is written to F<debian/package.substvars> file as a value of the
+B<sameVersionDep> substvar being processed.
+
+=back
+
+B<dh_sameversiondep> is very strict about errors. If either I<dependency
+package> or the I<reference package> cannot be found or the resulting
+dependency set is empty, it will fail with an error.
+
+B<dh_sameversiondep> MUST be run before L<dh_gencontrol>. However, it is
+recommended to run B<dh_sameversiondep> after L<dh_shlibdeps>.
+
+=head1 sameVersionDep substvar SPECIFICATION
+
+B<sameVersionDep> substvar can appear in either Depends, Recommends, Suggests,
+Enhances or Pre-Depends field of any binary package. The field, which the
+substvar appears in, becomes the default I<dependency type> for that substvar.
+B<sameVersionDep> should be formatted as follows (everything is case sensitive):
+
+${B<sameVersionDep>:I<dependency package>[[:I<reference package>]-I<dependency
+type>]}
+
+=over 4
+
+=item I<dependency package> (mandatory)
+
+The name of the package which you want to add as a dependency.
+
+=item I<reference package> (optional)
+
+The name of the package which dependencies are to be intersected with the
+dependencies of the I<dependency package>. Defaults to the first package in
+debian/control if ommited.
+
+=item I<dependency type> (optional)
+
+Can be either Depends, Recommends, Suggests, Enhances or Pre-Depends. Defaults
+to the name of the field which the substvar was found in. Specifies which type
+of dependencies to consider when analyzing I<dependency package> and
+I<reference package>.
+
+=back
+
+=head1 EXAMPLE
+
+Assume we have the following in F<debian/control>:
+
+ Package: liba
+ Depends: libc (>= 0.1), depa, depb, depc
+
+ Package: libb
+ Depends: libd (>= 0.2), depd, depe, depf
+
+ Package: libab-dev
+ Depends: ${sameVersionDep:libc-dev}, ${sameVersionDep:libd-dev:libb}
+
+Assumming that libc and libc-dev (both from the same source), as well as libd
+and libd-dev (both from the same source) are installed, the value of
+C<sameVersionDep:libc-dev> will be I<< libc-dev (>= 0.1) >> and the value of
+C<sameVersionDep:libd-dev:libb> will be I<< libd-dev (>= 0.2) >>.
+
+C<sameVersionDep:libc-dev> could also be written as
+C<sameVersionDep:libc-dev:liba-Depends> and C<sameVersionDep:libd-dev:libb> as
+C<sameVersionDep:libd-dev:libb-Depends> but it is not necessary because
+defaults are sufficient.
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Modestas Vainius <modestas at vainius.eu>
+
+=cut
+
+use strict;
+use warnings;
+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 extract_deps {
+ my ($val, $deppkg) = @_;
+
+ # 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::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;
+ return extract_deps($val, $deppkg);
+}
+
+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);
+
+ 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;
+
+ # Scan package default to MAINPACKAGE.
+ my $refpkg = $2;
+ $refpkg = $dh{MAINPACKAGE} unless defined $refpkg;
+
+ my $deptype = $3;
+ $deptype = $fieldname unless defined $deptype;
+
+ # Initialize some dep2add and scanpkg data.
+ # scanpkg might also come from external source. Use dpkg-query
+ # to get its dpkg status then.
+ my $refpkg_status;
+ my $dep2add_status;
+ my $vars;
+ if ($control->get_pkg_by_name($refpkg)) {
+ if (!exists $shlibsvars{$refpkg}) {
+ my $refpkg_substvars = sprintf("debian/%ssubstvars", pkgext($refpkg));
+ $shlibsvars{$refpkg} = new Shlibsvars($refpkg, $control, $refpkg_substvars);
+ }
+ $vars = $shlibsvars{$refpkg};
+
+ $dep2add_status = get_package_dpkg_status( [ $dep2add ], [ "Source", "Version", $deptype ] );
+ } else {
+ my $status = get_package_dpkg_status( [ $refpkg, $dep2add ], [ "Source", "Version", $deptype ] );
+ error("Cannot continue because the scan package $refpkg could not be found in debian/control or dpkg status")
+ unless (exists $status->{$refpkg});
+ error("Cannot continue because package $refpkg has no $deptype field to scan")
+ unless (exists $status->{$refpkg}{$deptype});
+ $refpkg_status = $status->{$refpkg};
+
+ $dep2add_status = $status; # see code below
+ }
+
+ ##### Process and verify dep2add status #####
+ error("Cannot continue because package $dep2add could not be found in dpkg status")
+ unless (exists $dep2add_status->{$dep2add});
+ $dep2add_status = $dep2add_status->{$dep2add};
+
+ # If the source is named the same as the binary package, there
+ # will be no Source field. Use package name as Source then.
+ $dep2add_status->{Source} = $dep2add
+ unless ($dep2add_status->{Source});
+
+ # 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 @scanpkg_deps;
+ if ($vars) {
+ @scanpkg_deps = $vars->get_dep_package_names($deptype);
+ } else {
+ @scanpkg_deps = extract_package_names($refpkg_status->{$deptype});
+ }
+ error("Cannot continue because package $refpkg has no $deptype field to scan")
+ unless (@scanpkg_deps);
+
+ # Intersect both _deps arrays to find common dependencies
+ my @commondeps;
+ {
+ my %_map;
+ map { $_map{$_} = 1; } @scanpkg_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" ]);
+
+ # Check if all packages were found
+ for my $dep (@commondeps) {
+ error("Package $dep was not found in the dpkg status. Internal error")
+ unless exists $depstatus->{$pkg};
+ }
+
+ # Filter commondeps
+ @commondeps = ();
+ while (my ($pkg, $status) = each(%$depstatus)) {
+ # If the source is named the same as the binary package, there
+ # will be no Source field. Use package name as Source then.
+ $status->{Source} = $pkg unless ($status->{Source});
+
+ 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 {
+ my $refpkg_deptypeval = ($vars) ? $vars->get_fieldval($deptype) :
+ $refpkg_status->{$deptype};
+ for my $deppkg (@commondeps) {
+ my @full_dep_spec = extract_deps($refpkg_deptypeval, $deppkg);
+ map s/\b\Q$deppkg\E\b/$dep2add/g, @full_dep_spec;
+ push @fulldeps, @full_dep_spec;
+ }
+
+ # 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
Property changes on: branches/kde4.2/packages/pkg-kde-tools/trunk/dh_sameversiondep
___________________________________________________________________
Name: svn:executable
+ *
Modified: branches/kde4.2/packages/pkg-kde-tools/trunk/symbolshelper/Debian/PkgKde/SymHelper/Handlers.pm
===================================================================
--- branches/kde4.2/packages/pkg-kde-tools/trunk/symbolshelper/Debian/PkgKde/SymHelper/Handlers.pm 2009-01-23 21:29:42 UTC (rev 13482)
+++ branches/kde4.2/packages/pkg-kde-tools/trunk/symbolshelper/Debian/PkgKde/SymHelper/Handlers.pm 2009-01-23 23:53:47 UTC (rev 13483)
@@ -191,7 +191,12 @@
sub create_template {
my $self = shift;
+ my %opts = @_;
+ # opts:
+ # deprecate_incomplete - add symbols from incomplete groups
+ # as deprecated.
+
return undef unless (exists $self->{symfiles});
my $symfiles = $self->{symfiles};
@@ -220,7 +225,7 @@
" " . $symbols{$s}{$g}{arches}{$arch1}->get_symbol() . "\n" .
" " . $n->{name});
# Ban group
- $symbols{$s}{$g}{banned} = 1;
+ $symbols{$s}{$g}{banned} = "ambiguous";
}
} else {
$symbols{$s}{$g}{arches}{$arch1} = new Debian::PkgKde::SymHelper::Symbol($n->{name}, $arch1);
@@ -239,15 +244,18 @@
$arch_ok{$arch} = $arch_ok_i;
}
+ my %other_groups;
while (my ($soname, $groups) = each(%symbols)) {
+ $other_groups{$soname} = [];
while (my ($name, $group) = each(%$groups)) {
# Check if the group is not banned
next if exists $group->{banned};
# Check if the group is complete
my $count = scalar(keys(%{$group->{arches}}));
+ my $sym_arch = $main_arch;
if ($count < $arch_count) {
- $group->{banned} = 1;
+ $group->{banned} = "incomplete";
# Additional vtables are usual on armel
next if ($count == 1 && exists $group->{arches}{armel} && $group->{arches}{armel}->is_vtt());
@@ -262,16 +270,27 @@
info(" $arch") if (defined $arch_ok{$arch} && $arch_ok{$arch} != $arch_ok_i);
}
info("\n");
- next;
+
+ if (defined $opts{deprecate_incomplete}) {
+ info(" - including this symbol in the template anyway\n");
+ delete $group->{banned};
+ $group->{deprecate} = "PRIVATE: ARCH: " . join(" ", sort(keys %{$group->{arches}}));
+ # Determine symbol arch, prefer main_arch though
+ if (!exists $group->{arches}{$main_arch}) {
+ $sym_arch = (keys %{$group->{arches}})[0];
+ }
+ } else {
+ next;
+ }
}
# Main symbol
- my $symname = $group->{arches}{$main_arch}->get_symbol();
+ my $symname = $group->{arches}{$sym_arch}->get_symbol();
my $main_symbol;
if (exists $symbol2symfile->{objects}{$soname}{syms}{$symname}{__symbol2__}) {
$main_symbol = $symbol2symfile->{objects}{$soname}{syms}{$symname}{__symbol2__};
} else {
- $main_symbol = new Debian::PkgKde::SymHelper::Symbol2($symname, $main_arch);
+ $main_symbol = new Debian::PkgKde::SymHelper::Symbol2($symname, $sym_arch);
}
foreach my $handler (@{$self->{multiple_subst}}) {
if ($handler->detect($main_symbol, $group->{arches})) {
@@ -282,20 +301,27 @@
}
}
$group->{template} = $main_symbol;
+ if ($main_arch ne $sym_arch) {
+ push @{$other_groups{$soname}}, $group;
+ }
}
}
# Finally, integrate our template into $main_arch symfile
my $main_symfile = $symfiles->{$main_arch};
- while (my ($soname, $sonameobj) = each(%{$symfiles->{$main_arch}{objects}})) {
+ while (my ($soname, $sonameobj) = each(%{$main_symfile->{objects}})) {
my @syms = keys(%{$sonameobj->{syms}});
for my $sym (@syms) {
my $g = $self->get_group_name($sym, $main_arch);
my $symbol2;
+ my $deprecate;
if (exists $symbols{$soname}{$g}) {
my $group = $symbols{$soname}{$g};
if (!exists $group->{banned}) {
$symbol2 = $group->{template};
+ } elsif (exists $group->{deprecate}) {
+ $symbol2 = $group->{template};
+ $deprecate = $group->{deprecate};
}
} elsif (exists $sonameobj->{syms}{$sym}{__symbol2__}) {
$symbol2 = $sonameobj->{syms}{$sym}{__symbol2__};
@@ -305,8 +331,11 @@
if (defined $symbol2) {
# Rename symbol
my $info = $sonameobj->{syms}{$sym};
+ if (defined $deprecate) {
+ $info->{deprecated} = $deprecate;
+ }
+ delete $sonameobj->{syms}{$sym};
$sonameobj->{syms}{$symbol2->get_symbol2()} = $info;
- delete $sonameobj->{syms}{$sym};
} elsif (exists $sonameobj->{syms}{$sym}) {
delete $sonameobj->{syms}{$sym}
unless ($sonameobj->{syms}{$sym}{deprecated});
@@ -314,6 +343,22 @@
}
}
+ # Add symbols from "other groups" (they are new in main_symfile)
+ while (my ($soname, $groups) = each(%other_groups)) {
+ for my $group (@$groups) {
+ my $symbol2 = $group->{template};
+
+ if (defined $symbol2) {
+ # Add symbol
+ my $info = $symfiles->{$symbol2->get_arch()}{objects}{$soname}{syms}{$symbol2->get_symbol()};
+ if ($group->{deprecate}) {
+ $info->{deprecated} = $group->{deprecate};
+ }
+ $main_symfile->{objects}{$soname}{syms}{$symbol2->get_symbol2()} = $info;
+ }
+ }
+ }
+
return $main_symfile;
}
Modified: branches/kde4.2/packages/pkg-kde-tools/trunk/symbolshelper/pkgkde-symbolshelper
===================================================================
--- branches/kde4.2/packages/pkg-kde-tools/trunk/symbolshelper/pkgkde-symbolshelper 2009-01-23 21:29:42 UTC (rev 13482)
+++ branches/kde4.2/packages/pkg-kde-tools/trunk/symbolshelper/pkgkde-symbolshelper 2009-01-23 23:53:47 UTC (rev 13483)
@@ -152,9 +152,11 @@
############### Subcommands ####################
sub subcommand_create {
my $opt_dir;
+ my $opt_deprecate_incomplete;
my %opts = (
get_common_options("oav"),
"directory|d=s" => \$opt_dir,
+ "with-incomplete|wi!" => \$opt_deprecate_incomplete,
);
if (GetOptions(%opts)) {
check_mandatory_options("",
@@ -184,7 +186,9 @@
if (scalar(keys %files) == 1) {
$template = $handlers->create_template_standalone();
} else {
- $template = $handlers->create_template();
+ $template = $handlers->create_template(
+ "deprecate_incomplete" => $opt_deprecate_incomplete,
+ );
}
$template->handle_min_version($opt_version, 1);
return out_symfile($template);
More information about the pkg-kde-commits
mailing list