Package: dpkg-cross
tag 514249 + patch
thanks
This was introduced in dpkg-cross package version 1.26 by Nikita
Youshchenko <yoush@debian.org>, cc'd (CVS version 1.15):
Wed Oct 26 19:51:56 2005 UTC (3 years, 3 months ago)
http://alioth.debian.org/plugins/scmcvs/cvsweb.php/dpkg-cross/dpkg-cross.diff?r1=1.14;r2=1.15;cvsroot=dpkg-cross
(when Nikita was still yoush-guest at Alioth) and has not been touched
since.
Nikita - can you shed some more light on this change and why it was
necessary?
I'd like to resolve this before dpkg-cross merges into dpkg as I'm not
sure the current behaviour would be acceptable for a component of
dpkg-dev, at least not with the current lack of explanation.
It appears that the code was initially meant to cover changes in the
internal layout of a -cross package but although dcvN implicitly
supported incrementing the number, it was never changed and the
subroutines are still hard-coded at dcv1.
Attached is a possible patch that reverts the dcv1 change whilst
retaining later changes.
$ cd /opt/working/dpkg-cross/test/
$ dpkg-cross -b /opt/working/dpkg-cross/test/libqof1_0.7.5-1_arm.deb
Building libqof1-arm-cross_0.7.5-1_all.deb
dpkg-deb: building package `libqof1-arm-cross' in `./libqof1-arm-cross_0.7.5-1_all.deb'.
$ cd /tmp/
$ ./dpkg-cross -b /opt/working/dpkg-cross/test/libqof1_0.7.5-1_arm.deb
Building libqof1-arm-cross_0.7.5-1_all.deb
dpkg-deb: building package `libqof1-arm-cross' in `./libqof1-arm-cross_0.7.5-1_all.deb'.
$ debdiff /opt/working/dpkg-cross/test/./libqof1-arm-cross_0.7.5-1_all.deb ./libqof1-arm-cross_0.7.5-1_all.deb
File lists identical (after any substitutions)
Control files: lines which differ (wdiff format)
------------------------------------------------
Depends: libc6-arm-cross (>= 2.7-1), [-libc6-arm-dcv1,-] libgda3-3-arm-cross, [-libgda3-3-arm-dcv1,-] libglib2.0-0-arm-cross (>= [-2.12.0), libglib2.0-0-arm-dcv1-] {+2.12.0)+}
[-Provides: libqof1-arm-dcv1-]
--
Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/
--- dpkg-cross.old
+++ dpkg-cross
@@ -1009,11 +1009,9 @@
}
# Rewrite dependency fields
- # Make 'provides' field to exist always to all $package-$arch-dslN provide
- $control{"provides"} = "" unless defined $control{"provides"};
for $field qw(depends conflicts provides replaces) {
next if not defined $control{$field};
- my $rewritten = rewrite_dependencies($control{"package"}, $field, $control{$field});
+ my $rewritten = rewrite_dependencies($control{$field});
if (length($rewritten) > 0) {
# Capitalize first letter of field name
print CONTROL ucfirst($field) . ": " . $rewritten . "\n";
@@ -1162,46 +1160,38 @@
return $? == 0;
}
-# Handling of dpkg-cross layout versions:
-# - package P-$arch-cross always provides P-$arch-dcvN, where N is the layout version
-# - if P provides Q, P-$arch-cross provides both Q-$arch-cross and Q-$arch-dcvN
-# - if P depends on Q, P-$arch-cross depends on Q-$arch-cross, Q-$arch-dcvN
-# - if P depends on Q (op ver), P-$arch-cross depends on Q-$arch-cross (op ver), Q-$arch-dcvN
-# - if P depends on Q | R, P-$arch-cross depends on Q-$arch-cross | R-$arch-cross, Q-$arch-dcvN | R-$arch-dcvN
-# - nothing layout-specific is in conflicts or replaces
-
sub rewrite_dependencies {
- my ($package, $field, $str) = @_;
- my @list = ();
-
- DEP: for my $dep (split( /\s*,\s*/, $str)) {
- my @l = (); # for -arch-cross
- my @l2 = (); # for -arch-dcvN
- # $alt is '|'-separated list of alternatives
- for my $alt (split( /\s*\|\s*/, $dep )) {
- # if any of alternatives is in removedeps, $dep should be completely skipped
- my $noopalt = $alt; $noopalt =~ s/ *\(.*//;
- foreach my $check (@removedeps)
- {
- next DEP if ($noopalt =~ /^$check$/);
- }
- # next DEP if grep { $_ eq $noopalt } @removedeps;
- # if $noopalt is in keepdeps, same unmodified alt should go both to @l and @l2
- if (grep { $_ eq $noopalt } @keepdeps) {
- push @l, $alt;
- push @l2, $alt;
- } else {
- my $tmp = $alt; $tmp =~ s/^([^ (]+)/$1-$arch-cross/; push @l, $tmp;
- push @l2, "$noopalt-$arch-dcv1";
- }
- }
- my $l = join(" | ", @l);
- my $l2 = join(" | ", @l2);
- push @list, $l if ($l);
- push @list, $l2 if ($l2 && (($field eq "depends") || ($field eq "provides")) && ($l ne $l2));
- }
- push @list, "$package-$arch-dcv1" if ($field eq "provides");
+ my $str = shift;
+
+ my @list = map( rewrite_alternatives($_), split( /\s*,\s*/, $str));
+ # remove empty elements
+ @list = map { $_ ? ( $_ ) : () } @list;
return join(", ", @list );
+}
+
+sub rewrite_alternatives {
+ my $str = shift;
+
+ my @list = map( rewrite_item($_), split( /\s*\|\s*/, $str ));
+ # if any of the alternatives became empty (because of @removedeps),
+ # the complete dependency should be removed
+ @list = ();
+ for my $item (split( /\s*\|\s*/, $str )) {
+ $item = rewrite_item($item);
+ return () if not $item;
+ push @list, $item
+ }
+ return join( " | ", @list );
+}
+
+sub rewrite_item {
+ my $str = shift;
+
+ $str =~ /^([^ (]+)/;
+ return () if grep { $_ eq $1 } @removedeps;
+ return $str if grep { $_ eq $1 } @keepdeps;
+ $str =~ s/^([^ (]+)/$1-$arch-cross/;
+ return $str;
}
sub check_exclude
Attachment:
pgp7NMOoNLOYV.pgp
Description: PGP signature