summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. 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)
commitd96921bb4baf800a4dc75674a76fb94f02a0730a (patch)
tree16ae175bd6c68a3426b918aa9af45a558cf80168 /lib
parent96f892944debd70176d162c25b830e0a0c36138c (diff)
generate-index: Implement.
Diffstat (limited to 'lib')
-rw-r--r--lib/cmd/generate-index.sh35
-rw-r--r--lib/cmd/include.sh5
2 files changed, 36 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
}