chiark / gitweb /
Infra: in dgit-repos-server, produce less verbose message when policy hook rejects
[dgit.git] / Debian / Dgit / Policy / Debian.pm
1 # -*- perl -*-
2
3 package Debian::Dgit::Policy::Debian;
4
5 use strict;
6 use warnings;
7
8 use POSIX;
9
10 BEGIN {
11     use Exporter   ();
12     our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
13
14     $VERSION     = 1.00;
15     @ISA         = qw(Exporter);
16     @EXPORT      = qw(poldb_path poldb_setup $poldbh);
17     %EXPORT_TAGS = ( );
18     @EXPORT_OK   = qw();
19 }
20
21 our @EXPORT_OK;
22
23 our $poldbh;
24
25 sub poldb_path ($) {
26     my ($repos) = @_;
27     return "$repos/policy.sqlite3";
28 }
29
30 sub poldb_setup ($) {
31     my ($policydb) = @_;
32
33     $poldbh ||= DBI->connect("dbi:SQLite:$policydb",'','', {
34         RaiseError=>1, PrintError=>1, AutoCommit=>0
35                            });
36     $poldbh->do("PRAGMA foreign_keys = ON");
37 }
38
39 1;