@@ -301,9 +301,10 @@ sub get_debpkg_names {
301
301
# => web-browser-elinks
302
302
# browser-elinks
303
303
# elinks
304
+ # Also works for "original_name"=pkg:/web/browser/elinks:usr/bin/Elinks
304
305
my ($fmri ) = @_ ;
305
306
my @names = ();
306
- if ($fmri =~ m , ^(?:pkg:/)?([^@]+)(?:@ .+)?$ , ) {
307
+ if ($fmri =~ m , ^(?:pkg:/)?([^: @]+)(?:[:@] .+)?$ , ) {
307
308
my $pkg = $1 ;
308
309
my @parts = split /\//, $pkg ;
309
310
while (@parts ) {
@@ -315,6 +316,9 @@ sub get_debpkg_names {
315
316
fatal " Can't parse FMRI to get dpkg name: `$fmri '" ;
316
317
}
317
318
}
319
+ sub get_debpkg_name {
320
+ return (get_debpkg_names @_ )[0]
321
+ }
318
322
319
323
sub get_ips_version {
320
324
# pkg:/web/browser/[email protected] ,5.11-1.1
@@ -431,14 +435,13 @@ sub guess_required_deps {
431
435
my $debname = shift @provides ; # main name (web-browser-elinks)
432
436
my $debsection = get_pkg_section $debname ;
433
437
my $debpriority = exists $$manifest_data {' pkg.priority' } ? $$manifest_data {' pkg.priority' } : ' optional' ;
438
+ my @replaces = ();
434
439
435
440
foreach my $l (@{$$manifest_data {' legacy' }}) {
436
- push @provides , $$l {' pkg' };
441
+ push @provides , get_debpkg_name $$l {' pkg' };
437
442
}
438
- my $provides_str = join (' , ' , @provides );
439
443
my $pkgdir = " $DEBS_DIR /$debname " ;
440
444
blab " Main package name: $debname " ;
441
- blab " Other names: $provides_str " ;
442
445
443
446
my $ipsversion = get_ips_version $$manifest_data {' pkg.fmri' };
444
447
my $debversion = undef ;
@@ -462,6 +465,7 @@ sub guess_required_deps {
462
465
my $dir_name = " $pkgdir /$$dir {'path'}" ;
463
466
my_mkdir $dir_name , $$dir {' mode' };
464
467
my_chown $$dir {' owner' }, $$dir {' group' }, $dir_name ;
468
+ push @replaces , get_debpkg_name $$dir {original_name } if exists $$dir {original_name };
465
469
}
466
470
}
467
471
@@ -487,6 +491,7 @@ sub guess_required_deps {
487
491
my_chmod $$file {' mode' }, $dst ;
488
492
489
493
push @conffiles , $$file {' path' } if exists $$file {' preserve' };
494
+ push @replaces , get_debpkg_name $$file {original_name } if exists $$file {original_name };
490
495
}
491
496
}
492
497
@@ -528,11 +533,13 @@ sub guess_required_deps {
528
533
push @depends , @{guess_required_deps($pkgdir )};
529
534
530
535
uniq \@depends ;
531
- # When a program and a library are in the same package:
532
- @depends = grep { $_ ne $debname } @depends ;
536
+ uniq \ @replaces ;
537
+ uniq \ @provides ;
533
538
uniq \@predepends ;
534
539
uniq \@recommends ;
535
540
uniq \@conflicts ;
541
+ # When a program and a library are in the same package:
542
+ @depends = grep {$_ ne $debname } @depends ;
536
543
537
544
538
545
my $control = ' ' ;
@@ -544,17 +551,19 @@ sub guess_required_deps {
544
551
$control .= " Maintainer: $MAINTAINER \n " ;
545
552
$control .= " Architecture: $ARCH \n " ;
546
553
554
+
547
555
$control .= " Description: $$manifest_data {'pkg.summary'}\n " ;
548
556
$changes {' Description' } .= " \n $debname - $$manifest_data {'pkg.summary'}" ;
549
557
550
558
$control .= wrap(' ' , ' ' , $$manifest_data {' pkg.description' }) . " \n "
551
559
if exists $$manifest_data {' pkg.description' };
552
560
553
- $control .= " Provides: $provides_str \n " ;
561
+ $control .= ' Provides: ' . join ( ' , ' , @provides ) . " \n " if @provides ;
554
562
$control .= ' Depends: ' . join (' , ' , @depends ) . " \n " if @depends ;
555
563
$control .= ' Pre-Depends: ' . join (' , ' , @predepends ) . " \n " if @predepends ;
556
564
$control .= ' Recommends: ' . join (' , ' , @recommends ) . " \n " if @recommends ;
557
565
$control .= ' Conflicts: ' . join (' , ' , @conflicts ) . " \n " if @conflicts ;
566
+ $control .= ' Replaces: ' . join (' , ' , @replaces ) . " \n " if @replaces ;
558
567
$control .= " Installed-Size: $installed_size \n " ;
559
568
560
569
$control .= " Origin: $$manifest_data {'info.upstream_url'}\n "
@@ -571,7 +580,6 @@ sub guess_required_deps {
571
580
write_file " $pkgdir /DEBIAN/conffiles" , (join " \n " , @conffiles );
572
581
}
573
582
574
-
575
583
my $preinst = ' ' ;
576
584
my $postinst = ' ' ;
577
585
my $prerm = ' ' ;
0 commit comments