diff options
author | P. J. McDermott <pjm@nac.net> | 2013-07-16 18:02:57 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-07-16 18:02:57 (EDT) |
commit | d96921bb4baf800a4dc75674a76fb94f02a0730a (patch) | |
tree | 16ae175bd6c68a3426b918aa9af45a558cf80168 | |
parent | 96f892944debd70176d162c25b830e0a0c36138c (diff) |
generate-index: Implement.
-rw-r--r-- | lib/cmd/generate-index.sh | 35 | ||||
-rw-r--r-- | lib/cmd/include.sh | 5 | ||||
-rw-r--r-- | locale/en_US/pro_archman.sh | 1 |
3 files changed, 37 insertions, 4 deletions
diff --git a/lib/cmd/generate-index.sh b/lib/cmd/generate-index.sh index 88ef95b..1b9798d 100644 --- a/lib/cmd/generate-index.sh +++ b/lib/cmd/generate-index.sh @@ -23,5 +23,38 @@ use output cmd_generate_index_main() { - printf 'Not implemented\n' + local comp= + local dist= + local plat= + local arch= + local feed= + + if [ ${#} -eq 0 ]; then + for comp in "${archive}/dists/"*/; do + for dist in "${comp}/"*/; do + for plat in "${dist}/"*/; do + for arch in "${plat}/"*/; do + feed="${plat#${archive}/dists/}" + cmd_generate_index "${feed}" + done + done + done + done + else + for feed in "${@}"; do + cmd_generate_index "${feed}" + done + fi +} + +cmd_generate_index() +{ + local feed="${1}" + + info "$(get_msg 'cmd_generate_index_generating')" "${feed}" + + cat "${archive}/dists/${feed}.db/"*.control \ + >"${archive}/dists/${feed}/Packages~" + mv "${archive}/dists/${feed}/Packages~" \ + "${archive}/dists/${feed}/Packages" } diff --git a/lib/cmd/include.sh b/lib/cmd/include.sh index b84a4e7..33eb5e9 100644 --- a/lib/cmd/include.sh +++ b/lib/cmd/include.sh @@ -39,9 +39,8 @@ cmd_include_main() cmd_include "${changes}" done - for feed in "${cmd_include_feeds}"; do - # TODO: Remove ":" when cmd_generate_index is implemented. - : cmd_generate_index "${feed}" + for feed in ${cmd_include_feeds}; do + cmd_generate_index "${feed}" done } diff --git a/locale/en_US/pro_archman.sh b/locale/en_US/pro_archman.sh index 0b57e35..6cff826 100644 --- a/locale/en_US/pro_archman.sh +++ b/locale/en_US/pro_archman.sh @@ -30,6 +30,7 @@ msg_pro_archman_cmd_include_including='Including %s (%s) into %s...' # lib/cmd/generate-index.sh msg_pro_archman_cmd_generate_index_summary='generate package indices' msg_pro_archman_cmd_generate_index_usage='[<feed> ...]' +msg_pro_archman_cmd_generate_index_generating='Generating index for feed "%s"...' # lib/control.sh msg_pro_archman_control_empty_line='empty line' |