chiark / gitweb /
autopkgtests: break out t-822-field
[dgit.git] / tests / lib
index 2842b92..b80989d 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -188,16 +188,23 @@ t-pushed-good () {
        git verify-tag `t-v-tag`
 }
 
-t-ref-dsc-dgit () {
-       local dsc=${p}_${v}.dsc
-       local val=`perl -e '
+t-822-field () {
+       local file=$1
+       local field=$2
+       perl -e '
                use Dpkg::Control::Hash;
                my $h = new Dpkg::Control::Hash allow_pgp=>1;
-               $h->parse(\*STDIN,"dsc");
-               my $ref = $h->{"Dgit"},"\n";
-               die unless $ref =~ m/^\w+\b/;
-               print $ref,"\n";
-       ' <$tmp/incoming/$dsc`
+               $h->parse(\*STDIN,"'"$file"'");
+               my $val = $h->{"'$field'"},"\n";
+               die "'"$file $field"'" unless defined $val;
+               print $val,"\n";
+       ' <$file
+}
+
+t-ref-dsc-dgit () {
+       local dsc=${p}_${v}.dsc
+       local val=`t-822-field $tmp/incoming/$dsc Dgit`
+       perl -e '$_=shift @ARGV; die "$dsc Dgit $_ ?" unless m/^\w+\b/;' "$val"
        t-ref-same-val $dsc "$val"
 }