]> git.donarmstrong.com Git - neurodebian.git/blob - tools/nd_rebuildarchive
Merge branch 'master' of git://git.debian.org/pkg-exppsy/neurodebian
[neurodebian.git] / tools / nd_rebuildarchive
1 #!/bin/bash
2
3 if [ -z "$1" ]; then
4 cat << EOT
5 Script to re-build entire archive from one release for another.
6
7 Often usecase -- rebuilding for a new Ubuntu brew every 6 months.
8
9 Synopsis
10 --------
11
12   nd_rebuildarchive old_release new_release
13
14 e.g.
15   
16   nd_rebuildarchive natty oneiric
17
18 EOT
19 exit 1  
20 fi
21
22 set -eu
23
24 old_dist=$1
25 dist=$2
26
27 # some NeuroDebian variables hardcoded in for now
28 repo_server=neuro.debian.net
29 repo_user=neurodebian
30 repo_toppath=www
31 repo_urlpath=debian
32 repo_distspath=$repo_toppath/$repo_urlpath/dists
33
34 family=nd+ubuntu
35
36 list_file="$old_dist-$dist.list"
37 summary_file="$old_dist-$dist.summary"
38
39 [ -e "$list_file" ] || \
40     ssh -l $repo_user $repo_server cat $repo_distspath/$old_dist/*/source/Sources.gz \
41     | zgrep -e '^\(Package\|Directory\| [a-z0-9]\{32\} [0-9]* \S*.dsc$\)' \
42     | sed -e 's,.* \([^ ][^ ]*\)$,\1,g' | tr '\n' ' '| sed -e 's,\.dsc,.dsc\n,g' \
43     > "$list_file"
44    
45 CMD=
46 #echo
47 dist_id=$(nd_querycfg "release backport ids" "$dist")
48 cat $list_file \
49 | while read name topdir dscfile; do
50     echo "I: Forwardporting for $dist_id $dscfile"
51
52     [ -e $dscfile ]  \
53         || dget -d http://$repo_server/$repo_urlpath/$topdir/$dscfile || { 
54         echo -e "E: $dscfile\t\tFAILED to fetch" >> $summary_file
55         continue
56     }
57
58     
59     bpdscfile=$(/home/neurodebian/neurodebian/tools/backport-dsc \
60         --target-distribution "$dist" \
61         --no-maintainer-update \
62         --version-prefix "+" \
63         --version-suffix "$dist_id" \
64         "$dscfile" | tail -n1 | sed -e 's/^.* //g')
65
66     echo " I: Building backported dscfile: $bpdscfile"
67
68     $CMD sudo nd_build $family $dist $bpdscfile && {
69         echo -e "I: $bpdscfile\t\tOk" >> $summary_file
70     } || {
71         echo -e "E: $bpdscfile\t\tFAILED to build" >> $summary_file
72     }
73 done