-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive-reindex-files.sh
executable file
·82 lines (73 loc) · 3.02 KB
/
archive-reindex-files.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
#
# Copyright © 2003-2007 Guillem Jover <[email protected]>
# Copyright © 2015 Matthias Blümel <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Import library
. archive-lib.sh
#
# Main
#
echo_time "-> Regenerating file lists..."
for arch in $(get_archive_arches); do
echo_time " -> Regenerating file list.. [$arch]"
cat $cache_dir/changes_$arch.list | while read package suite section arch version path; do
archive_file=`changes_strip < $path`
basedir=$(poolize_package_name ${package} ${section})
files=`echo "$archive_file" | fetch_files`
filepaths=`echo "$files" | sed -e "s:^ *:$basedir/:"`
echo "$filepaths" | grep "_\($arch\|all\)\.deb" \
>> $cache_dir/dists/${suite}_${section}_$arch.list.new
echo "$filepaths" | grep "_\($arch\|all\)\.udeb" \
>> $cache_dir/dists/${suite}_${section}_$arch.di.list.new
done
done
echo_time '-> Merging mirrored files into suite file lists ...'
for listname in ${cache_dir}/dists/*-mirror*.list; do
suite=$(basename ${listname} .list | cut -d'_' -f 1)
section=$(basename ${listname} .list | cut -d'_' -f 2)
arch=$(basename ${listname} .list | cut -d'_' -f 3)
grep '\.deb$' $listname \
>> $cache_dir/dists/${suite%-mirror}_${section}_${arch}.list.new
grep '\.udeb$' $listname \
>> $cache_dir/dists/${suite%-mirror}_${section}_${arch}.di.list.new
done
echo_time '-> Merging arch:all files into suite file lists ...'
# FIXME: Hardcoded suite
for suite in $suite_list; do
for arch in $(filter_real_arches $(get_suite_arches $suite)); do
for section in ${section_list}; do
grep '\.deb$' $cache_dir/dists/${suite}_${section}_all.list.new \
>> $cache_dir/dists/${suite}_${section}_$arch.list.new
grep '\.udeb$' $cache_dir/dists/${suite}_${section}_all.list.new \
>> $cache_dir/dists/${suite}_${section}_$arch.di.list.new
done
done
done
echo_time "-> Moving new file lists into place..."
for suite in $suite_list; do
for arch in $(get_suite_arches $suite); do
for section in ${section_list}; do
touch $cache_dir/dists/${suite}_${section}_$arch.list.new
mv -f $cache_dir/dists/${suite}_${section}_$arch.list.new \
$cache_dir/dists/${suite}_${section}_$arch.list
touch $cache_dir/dists/${suite}_${section}_$arch.di.list.new
mv -f $cache_dir/dists/${suite}_${section}_$arch.di.list.new \
$cache_dir/dists/${suite}_${section}_$arch.di.list
done
done
done
echo_time "-> Done."