]> git.donarmstrong.com Git - neurodebian.git/blob - tools/nd_rebuildarchive
Also for stats report which repo and which job number use our setup
[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
74
75 exit 0
76
77 # Then following steps were done manually ATM and here kept as notes
78 # but version checking should altogether go into nd_backportdsc I guess
79 # or at least in the logic above
80
81 # upload all not yet uploaded
82 for f in *~nd*.changes; do uf=${f//.changes/.neurodn.upload}; [ -e $uf ] && continue;  debsign $f; dput neurodn $f; done 
83
84 # on the neuro.debian.net side
85 # filtered out incoming from pkgs with versions in official distribution
86 for c in *changes; do pkg_ver=`grep '\.deb$' $c | head -1  | sed -e 's,.* \([^_]*\)_\(.*\)_.*,\1 \2,g'`;  echo $pkg_ver; done | uniq | while read p v; do  uver=$(whohas -D Ubuntu --strict $p | grep "/$dist/" | awk '{print $3;}');  dpkg --compare-versions $v lt "$uver" && echo $c $p $v $uver; done 2>&1 | tee up-to-date-list.txt
87
88 # and moved corresponding changelogs away
89 mv `awk '{print $1,$2;}' up-to-date-list.txt | while read p v; do grep -l "${p}_${v}" *changes; done | sort | uniq` NOT_UPLOADED/
90
91 # processed the incoming
92 /home/neurodebian/reprepro/nd_processincoming.sh
93
94 # locally now updated the cows
95 sudo nd_updatedist nd+ubuntu $dist
96
97 # And build which previously failed, most probably due to unsatisfied dependencies
98 # and possibly failure with outdated versions of 3rd party modules
99 #grep -v OLD summary.build | grep FAILED | sed -e 's,_\(i386\|amd64\).build.*,,g' | sort | uniq | while read p; do sudo nd_build nd+ubuntu precise $p.dsc; done
100 grep -v -e OLD -e networkx summary.build | grep FAILED  | sed -e 's,_\(i386\|amd64\).build.*,,g' | sort | uniq | while read p; do sudo nd_build nd+ubuntu $dist $p.dsc; done