From b263b7924c9600bfeb71a284ba6cf07fd0383929 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 16 Jul 2013 10:29:51 -0400 Subject: include: Properly parse 1.0-format changes files. --- (limited to 'lib') diff --git a/lib/cmd/include.sh b/lib/cmd/include.sh index 4730255..8bf808e 100644 --- a/lib/cmd/include.sh +++ b/lib/cmd/include.sh @@ -19,24 +19,48 @@ use control -CMD_INCLUDE_CHANGES_FIELDS='Package Source Version Architecture Platform -Distribution Maintainer Changed-By Date Changes Filename' +CMD_INCLUDE_CHANGES_FIELDS='Format Source Binary Version Architecture Platform +Distribution Maintainer Changed-By Date Description Changes Files' -cmd_include_package= +cmd_include_source= +cmd_include_version= cmd_include_distribution= -cmd_include_filename= +cmd_include_files= cmd_include_main() { - local changes + local changes= + local size= + local file= + local pkg= + local binver= + local arch= + local plat= for changes in "${@}"; do parse_control "${changes}" cmd_include_changes_field \ "${CMD_INCLUDE_CHANGES_FIELDS}" '' done - printf 'Including %s into %s: %s\n' "${cmd_include_package}" \ - "${cmd_include_distribution}" "${cmd_include_filename}" + printf 'Including %s (%s) into %s:\n' "${cmd_include_source}" \ + "${cmd_include_version}" "${cmd_include_distribution}" + + while read -r size file; do + if [ "x$(echo ${file})" = 'x' ]; then + continue + fi + IFS='_' read -r pkg binver arch plat <<-EOF + ${file%.opk} + EOF + printf ' %s:\n' "${file}" + printf ' Package: %s\n' "${pkg}" + printf ' Version: %s\n' "${binver}" + printf ' Architecture: %s\n' "${arch}" + printf ' Platform: %s\n' "${plat}" + printf ' Size: %s\n' "${size}" + done <<-EOF + ${cmd_include_files} + EOF } cmd_include_changes_field() @@ -45,14 +69,17 @@ cmd_include_changes_field() local value="${2}" case "${name}" in - 'Package') - cmd_include_package="${value}" + 'Source') + cmd_include_source="${value}" + ;; + 'Version') + cmd_include_version="${value}" ;; 'Distribution') cmd_include_distribution="${value}" ;; - 'Filename') - cmd_include_filename="${value}" + 'Files') + cmd_include_files="${value}" ;; esac } -- cgit v0.9.1