]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blame - wwwbin/archive-dupe-cleanup.sh
Some more pythonic optimizations
[projects/pld-ftp-admin.git] / wwwbin / archive-dupe-cleanup.sh
CommitLineData
66639772
ER
1#!/bin/sh
2set -e
3
4archive_tree=.archive/PLD
5other_tree=$1
6ftp_dir=~ftp/pld/dists/th
7
8die() {
9 echo >&2 "$*"
10 exit 1
11}
12
13
14test -n "$other_tree" || die 'specify other tree, ex: 2015/PLD'
15
16archive_dir=$ftp_dir/$archive_tree/SRPMS/.metadata
17other_dir=$ftp_dir/$other_tree/SRPMS/.metadata
18
19test -d "$archive_dir" || die '$archive_dir not a dir'
20test -d "$other_dir" || die '$other_dir not a dir'
21
22match_pkgs() {
23 for f in $archive_dir/*.info; do
24 fn=${f##*/}
25 if [ -f "$other_dir/$fn" ]; then
26 echo $fn
27 fi
28 done
29}
30
31remove_pkgs=$(match_pkgs)
32test -n "$remove_pkgs" || die "nothing matched"
33c=$(echo "$remove_pkgs" | wc -l)
34echo >&2 "$c packages to remove from $archive_dir. ctrl-c to abort"
35read a
36
37echo >&2 pfa-rmpkg $archive_tree $remove_pkgs
38pfa-rmpkg $archive_tree $remove_pkgs
This page took 0.175481 seconds and 4 git commands to generate.