- if (ref $dh{DEBUGPACKAGES} && grep { $_ eq $package } @{$dh{DEBUGPACKAGES}}) {
- $keep_debug=1;
- $debugtmp=tmpdir($package."-dbg");
+ if (! compat(4)) {
+ if (ref $dh{DEBUGPACKAGES}) {
+ $keep_debug=1;
+ # Note that it's only an array for the v4 stuff;
+ # for v5 only one value is used.
+ my $debugpackage=@{$dh{DEBUGPACKAGES}}[0];
+ if (! grep { $_ eq $debugpackage } getpackages()) {
+ error("debug package $debugpackage is not listed in the control file");
+ }
+ $debugtmp=tmpdir($debugpackage);
+ }
+ }
+ else {
+ if (ref $dh{DEBUGPACKAGES} && grep { $_ eq $package } @{$dh{DEBUGPACKAGES}}) {
+ $keep_debug=1;
+ $debugtmp=tmpdir($package."-dbg");
+ }