+sub select_tagformat () {
+ # sets $tagformatfn
+ return if $tagformatfn && !$tagformat;
+ die 'bug' if $tagformatfn && $tagformat;
+ # ... $tagformat assigned after previous select_tagformat
+
+ my (@supported) = split /\,/, access_cfg('dgit-tag-format');
+ printdebug "select_tagformat supported @supported\n";
+
+ $tagformat //= [ $supported[0], "distro access configuration", 0 ];
+ printdebug "select_tagformat specified @$tagformat\n";
+
+ my ($fmt,$why,$override) = @$tagformat;
+
+ fail "target distro supports tag formats @supported".
+ " but have to use $fmt ($why)"
+ unless $override
+ or grep { $_ eq $fmt } @supported;
+
+ $tagformat = undef;
+ $tagformatfn = ${*::}{"debiantag_$fmt"};
+
+ fail "trying to use unknown tag format \`$fmt' ($why) !"
+ unless $tagformatfn;
+}
+