diff options
author | P. J. McDermott <pjm@nac.net> | 2013-07-16 10:29:51 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-07-16 10:29:51 (EDT) |
commit | b263b7924c9600bfeb71a284ba6cf07fd0383929 (patch) | |
tree | ced2d92bce1aa7c50cba903d8b8892db3377d5e0 | |
parent | e8e7840e41680aca9f78166dd2a0463555d6d2ee (diff) |
include: Properly parse 1.0-format changes files.
-rw-r--r-- | lib/cmd/include.sh | 49 |
1 files changed, 38 insertions, 11 deletions
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 } |