@@ -19,7 +19,7 @@ file_to_package() {
1919 # `dpkg-query --search $file-pattern` outputs lines with the format: "$package: $file-path"
2020 # where $file-path belongs to $package
2121 # https://manpages.debian.org/jessie/dpkg/dpkg-query.1.en.html
22- dpkg-query --search " $( realpath " ${1} " ) " | cut -d' :' -f1
22+ ( dpkg-query --search " $( realpath " ${1} " ) " || true) | cut -d' :' -f1
2323}
2424
2525# package_to_copyright gives the path to the copyright file for the package $1
@@ -37,10 +37,13 @@ stage_file() {
3737 fi
3838 # get the package so we can stage package metadata as well
3939 package=" $( file_to_package " ${1} " ) "
40- # stage the copyright for the file
41- cp -a --parents " $( package_to_copyright " ${package} " ) " " ${2} "
42- # stage the package status mimicking bazel
43- # https://github.com/bazelbuild/rules_docker/commit/f5432b813e0a11491cf2bf83ff1a923706b36420
44- # instead of parsing the control file, we can just get the actual package status with dpkg
45- dpkg -s " ${package} " > " ${2} /var/lib/dpkg/status.d/${package} "
40+
41+ if [[ " $package " != " " ]]; then
42+ # stage the copyright for the file
43+ cp -a --parents " $( package_to_copyright " ${package} " ) " " ${2} "
44+ # stage the package status mimicking bazel
45+ # https://github.com/bazelbuild/rules_docker/commit/f5432b813e0a11491cf2bf83ff1a923706b36420
46+ # instead of parsing the control file, we can just get the actual package status with dpkg
47+ dpkg -s " ${package} " > " ${2} /var/lib/dpkg/status.d/${package} "
48+ fi
4649}
0 commit comments