11package slicer_test
22
33import (
4+ "archive/tar"
45 "bytes"
56 "fmt"
67 "io"
@@ -26,6 +27,33 @@ type slicerTest struct {
2627 error string
2728}
2829
30+ var packageEntries = map [string ][]testutil.TarEntry {
31+ "copyright-symlink-libssl3" : {
32+ {Header : tar.Header {Name : "./" }},
33+ {Header : tar.Header {Name : "./usr/" }},
34+ {Header : tar.Header {Name : "./usr/lib/" }},
35+ {Header : tar.Header {Name : "./usr/lib/x86_64-linux-gnu/" }},
36+ {Header : tar.Header {Name : "./usr/lib/x86_64-linux-gnu/libssl.so.3" , Mode : 00755 }},
37+ {Header : tar.Header {Name : "./usr/share/" }},
38+ {Header : tar.Header {Name : "./usr/share/doc/" }},
39+ {Header : tar.Header {Name : "./usr/share/doc/copyright-symlink-libssl3/" }},
40+ {Header : tar.Header {Name : "./usr/share/doc/copyright-symlink-libssl3/copyright" }},
41+ },
42+ "copyright-symlink-openssl" : {
43+ {Header : tar.Header {Name : "./" }},
44+ {Header : tar.Header {Name : "./etc/" }},
45+ {Header : tar.Header {Name : "./etc/ssl/" }},
46+ {Header : tar.Header {Name : "./etc/ssl/openssl.cnf" }},
47+ {Header : tar.Header {Name : "./usr/" }},
48+ {Header : tar.Header {Name : "./usr/bin/" }},
49+ {Header : tar.Header {Name : "./usr/bin/openssl" , Mode : 00755 }},
50+ {Header : tar.Header {Name : "./usr/share/" }},
51+ {Header : tar.Header {Name : "./usr/share/doc/" }},
52+ {Header : tar.Header {Name : "./usr/share/doc/copyright-symlink-openssl/" }},
53+ {Header : tar.Header {Name : "./usr/share/doc/copyright-symlink-openssl/copyright" , Linkname : "../libssl3/copyright" }},
54+ },
55+ }
56+
2957// filesystem entries of copyright file from base-files package that will be
3058// automatically injected into every slice
3159var copyrightEntries = map [string ]string {
@@ -400,6 +428,31 @@ var slicerTests = []slicerTest{{
400428 ` ,
401429 },
402430 error : `slice base-files_myslice: cannot read file which is not selected: /etc` ,
431+ }, {
432+ summary : "Duplicate copyright symlink is ignored" ,
433+ slices : []setup.SliceKey {{"copyright-symlink-openssl" , "bins" }},
434+ release : map [string ]string {
435+ "slices/mydir/copyright-symlink-libssl3.yaml" : `
436+ package: copyright-symlink-libssl3
437+ slices:
438+ libs:
439+ contents:
440+ /usr/lib/x86_64-linux-gnu/libssl.so.3:
441+ ` ,
442+ "slices/mydir/copyright-symlink-openssl.yaml" : `
443+ package: copyright-symlink-openssl
444+ slices:
445+ bins:
446+ essential:
447+ - copyright-symlink-libssl3_libs
448+ - copyright-symlink-openssl_config
449+ contents:
450+ /usr/bin/openssl:
451+ config:
452+ contents:
453+ /etc/ssl/openssl.cnf:
454+ ` ,
455+ },
403456}}
404457
405458const defaultChiselYaml = `
@@ -454,12 +507,18 @@ func (s *S) TestRun(c *C) {
454507 selection , err := setup .Select (release , test .slices )
455508 c .Assert (err , IsNil )
456509
510+ pkgs := map [string ][]byte {
511+ "base-files" : testutil .PackageData ["base-files" ],
512+ }
513+ for name , entries := range packageEntries {
514+ deb , err := testutil .MakeDeb (entries )
515+ c .Assert (err , IsNil )
516+ pkgs [name ] = deb
517+ }
457518 archives := map [string ]archive.Archive {
458519 "ubuntu" : & testArchive {
459520 arch : test .arch ,
460- pkgs : map [string ][]byte {
461- "base-files" : testutil .PackageData ["base-files" ],
462- },
521+ pkgs : pkgs ,
463522 },
464523 }
465524
0 commit comments