summaryrefslogtreecommitdiff
path: root/repo-update
blob: 12c6d0c2929d2c95ab69174e4904db3dd78a8f4e (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
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
#!/bin/bash
# -*- coding: utf-8 -*-
source ~/.bashrc
source $(dirname $0)/config
source $(dirname $0)/local_config
source $(dirname $0)/libremessages

msg "Updating your-freedom"
$(dirname $0)/yf-update

msg "Global exclude-list"
# To not downgrade repos by accident
find ${repodir}/old/packages -name "*${PKGEXT}" \
    -fprintf ${rsync_not_needed}2 '%f\n'

for repo in ${ARCHREPOS[@]}; do
    msg "Syncing ${repo}"
    for arch in ${ARCHARCHES[@]} 'any'; do
	msg2 "${repo} ${arch}"
	# makes a file containing rsync output for filter.py
        plain "Checking packages..."
	${rsync_list_command} \
	    rsync://${mirror}/${mirrorpath}/${repo}/os/${arch}/ \
	    ${repodir}/staging/${repo}/ > ${rsout_file} 2&>/dev/null
	# reads blacklist and rsout_file and makes an rsync exclude-from
	# list
        plain "Excluding nonfree..."
	filter.py -r ${rsync_blacklist} -k ${blacklist} \
	    -f ${rsout_file}
	# list files in ${repodir}/${repo} and write their names on 
	# rsync_not_needed for using as an rsync exclude-from
        plain "Excluding our packages"
	find ${repodir}/${repo} -name "*${PKGEXT}" \
	    -fprintf ${rsync_not_needed} '%f\n'
	# Actual rsync command
        plain "Syncing..."
	${rsync_update_command} \
	    --exclude-from=${rsync_blacklist} \
	    --exclude-from=${rsync_not_needed} \
	    --exclude-from=${rsync_not_needed}2 \
	    rsync://${mirror}/${mirrorpath}/${repo}/os/${arch}/ \
	    ${repodir}/staging/${repo}/ 2&>/dev/null
    done
    for arch in ${ARCHARCHES[@]}; do
	msg2 "Making pending list for $repo $arch"
	# if there is a db in repo (db is created on rsync)
	if [ -r ${repodir}/staging/${repo}/os/${arch}/${repo}${DBEXT} ]; then
	    # clean_repo makes pending list with files on db and remove
	    # packages from db
	    $(dirname $0)/clean_repo.py -k ${blacklist} -w ${whitelist} \
		-p ${docs_dir}/pending-${repo}.txt \
		-b ${repodir}/staging/${repo}/${repo}${DBEXT} \
		-d ${repodir}/stagging/${repo}
	fi
    done
    # if some nonfree files got pass the filter this command delete them
    msg2 "Fallback cleaning repo"
    $(dirname $0)/clean_repo.py -k ${blacklist} -d ${repodir}/staging/${repo}
done

msg "Removing leftover files..."
find ${repodir}/staging/ -type f \! -name "*${PKGEXT}" -delete
# Staging should not have symbolic links
find ${repodir}/staging/ -type l -delete

$(dirname $0)/db-update
$(dirname $0)/db-check-nonfree