chiark / gitweb /
Arrange to pass --debug-quick-random to gpg-agent.
[dgit.git] / tests / lib-import-chk
1
2 t-import-chk1 () {
3         p=$1
4         v=$2
5
6         t-archive $p $v
7 }
8 t-import-chk2() {
9         t-git-none
10         rm -rf $p
11         t-dgit --no-rm-on-error clone $p
12
13         # And now we make an update using the same orig tarball, and
14         # check that the orig import is stable.
15
16         cd $p
17
18         git branch first-import
19
20         m='Commit for import check'
21         echo "$m" >>import-check
22
23         v=${v%-*}-99
24         dch -v $v -D unstable -m "$m"
25
26         git add import-check debian/changelog
27         git commit -m "$m"
28
29         t-dgit -wgf quilt-fixup
30         t-dgit -wgf build-source
31
32         # The resulting .dsc does not have a Dgit line (because dgit push
33         # puts that in).  So we just shove it in the archive now
34
35         ln ../${p}_${v}.* $tmp/mirror/pool/main/
36         t-archive-query
37
38         t-dgit fetch
39
40         git branch first-2nd-import remotes/dgit/dgit/sid
41
42         t-git-next-date
43
44         git update-ref refs/remotes/dgit/dgit/sid first-import
45
46         t-dgit fetch
47
48         t-refs-same-start
49         t-ref-same refs/remotes/dgit/dgit/sid
50         t-ref-same refs/heads/first-2nd-import
51
52         for orig in ../${p}_${v%-*}.orig*.tar.*; do
53                 tar -atf $orig | LC_ALL=C sort >../files.o
54                 pfx=$(perl <../files.o -ne '
55                         while (<>) {
56                                 m#^([^/]+/)# or exit 0;
57                                 $x //= $1;
58                                 $x eq $1 or exit 0;
59                         }
60                         print "$x\n";
61                 ')
62                 perl -i~ -pe '
63                         s#^\Q'"$pfx"'\E##;
64                         $_="" if m/^$/ || m#/$# || m#^\.git/#;
65                 ' ../files.o
66                 orig=${orig#../}
67                 pat="^Import ${orig//./\\.}\$"
68                 t-refs-same-start
69                 for start in first-import first-2nd-import; do
70                         git log --pretty='tformat:%H' --grep "$pat" $start \
71                                 >../t.imp
72                         test $(wc -l <../t.imp) = 1
73                         imp=$(cat ../t.imp)
74                         t-ref-same-val "$orig $start" "$imp"
75                 done
76                 git ls-tree -r --name-only "$t_ref_val:" \
77                         | sort >../files.g
78                 diff ../files.{o,g}
79         done
80         cd ..
81 }
82
83 t-import-chk() { t-import-chk1 "$@"; t-import-chk2; }
84