summaryrefslogtreecommitdiff
path: root/wwwbin/archive-dupe-cleanup.sh
blob: e00ad7a0e2f88da6f69d6eaec85ac54587e34285 (plain)
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
#!/bin/sh
set -e

archive_tree=.archive/PLD
other_tree=$1
ftp_dir=~ftp/pld/dists/th

die() {
	echo >&2 "$*"
	exit 1
}


test -n "$other_tree" || die 'specify other tree, ex: 2015/PLD'

archive_dir=$ftp_dir/$archive_tree/SRPMS/.metadata
other_dir=$ftp_dir/$other_tree/SRPMS/.metadata

test -d "$archive_dir" || die '$archive_dir not a dir'
test -d "$other_dir" || die '$other_dir not a dir'

match_pkgs() {
	for f in $archive_dir/*.info; do
		fn=${f##*/}
		if [ -f "$other_dir/$fn" ]; then
			echo $fn
		fi
	done
}

remove_pkgs=$(match_pkgs)
test -n "$remove_pkgs" || die "nothing matched"
c=$(echo "$remove_pkgs" | wc -l)
echo >&2 "$c packages to remove from $archive_dir. ctrl-c to abort"
read a

echo >&2 pfa-rmpkg $archive_tree $remove_pkgs
pfa-rmpkg $archive_tree $remove_pkgs