Commit 94e25d0c authored by Anton Midyukov's avatar Anton Midyukov

bin/check-pkg-list: fix for use with mkimage-profiles

parent 29349c9a
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# which are definitely absent; the build might still bail out # which are definitely absent; the build might still bail out
# but at least 80% of failures can be predicted early now # but at least 80% of failures can be predicted early now
# #
# usage: check-pkg-list [-n pkgnames] pkglist ... # usage: check-pkg-list [-n pkgnames] [--aptbox $PATH/to/aptbox] pkglist ...
# (pkgnames file should contain `apt-cache pkgnames`) # (pkgnames file should contain `apt-cache pkgnames`)
# NB: -n pkgnames MUST go first, if given # NB: -n pkgnames MUST go first, if given
...@@ -20,24 +20,9 @@ exit_handler() { ...@@ -20,24 +20,9 @@ exit_handler() {
exit $rc exit $rc
} }
# find the most recent apt.conf in workdirs
apt_conf() {
debug "looking for workdirs with aptboxes..."
find -maxdepth 3 -name .work \
| while read dir; do
file="$dir/aptbox/etc/apt/apt.conf"
[ -f "$file" ] && echo "$file"
done \
| xargs -r ls -t -- \
| head -1
}
# figure out apt.conf from recent aptbox or fallback to system one # figure out apt.conf from recent aptbox or fallback to system one
# TODO: would be nice to cache the dump inside aptbox
dump_pkgnames() { dump_pkgnames() {
conf="`apt_conf`" ${APTBOX:+$APTBOX/}apt-cache pkgnames | sort -u > "$favaillist"
debug "autodetected apt.conf: ${conf:-<system>}, dumping pkgnames"
apt-cache ${conf:+-c $conf} pkgnames | sort > "$favaillist"
} }
check_pkglist() { check_pkglist() {
...@@ -60,7 +45,7 @@ check_pkglist() { ...@@ -60,7 +45,7 @@ check_pkglist() {
# return unavailable packages # return unavailable packages
debug "unavailable packagenames, if any:" debug "unavailable packagenames, if any:"
comm -23 "$fpkgnames" "$ftemp" comm -23 "$fpkgnames" "$favaillist"
# return unavailable wildcards # return unavailable wildcards
debug "unavailable wildcards, if any:" debug "unavailable wildcards, if any:"
...@@ -81,15 +66,28 @@ fpkgnames="`mktemp $TEMP/pkgchecker.names.XXXXX`" ...@@ -81,15 +66,28 @@ fpkgnames="`mktemp $TEMP/pkgchecker.names.XXXXX`"
fpkgwildcards="`mktemp $TEMP/pkgchecker.wildcards.XXXXX`" fpkgwildcards="`mktemp $TEMP/pkgchecker.wildcards.XXXXX`"
ftemp="`mktemp $TEMP/pkgchecker.XXXXX`" ftemp="`mktemp $TEMP/pkgchecker.XXXXX`"
# make sure pkgnames dump is handy # check args
case "$1" in while :; do
"-n"|"--pkgnames") case "$1" in
[ -f "$2" ] && { # make sure pkgnames dump is handy
sort "$2" > "$favaillist" "-n"|"--pkgnames")
shift; shift [ -f "$2" ] && {
} || error "-n needs valid pkgnames filename" sort "$2" > "$favaillist"
;; shift; shift
esac } || error "-n needs valid pkgnames filename"
;;
# PATH to aptbox
"--aptbox")
[ -d "$2" ] && {
APTBOX="$2"
shift; shift
} || error "--aptbox needs valid directory"
;;
*)
break
;;
esac
done
[ -s "$favaillist" ] || dump_pkgnames [ -s "$favaillist" ] || dump_pkgnames
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment