Puppet Class: package_builder

Defined in:
modules/package_builder/manifests/init.pp

Overview

Class package_builder Packaging environment building class

Actions:

Installs Debian package creation/building tools and creates environments to
help with easy package building.

Usage:

include package_builder

Parameters:

  • basepath (Stdlib::Unixpath) (defaults to: '/var/cache/pbuilder')


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'modules/package_builder/manifests/init.pp', line 10

class package_builder(
    Stdlib::Unixpath $basepath='/var/cache/pbuilder',
) {
    class { '::package_builder::hooks':
        basepath => $basepath,
    }
    class { '::package_builder::environments':
        basepath => $basepath,
    }
    systemd::timer::job { 'package_builder_Clean_up_build_directory':
        ensure      => present,
        user        => 'root',
        description => 'Delete builds older the 2 weeks',
        command     => "/usr/bin/find ${basepath}/build -type f -daystart -mtime +14 -delete",
        interval    => {
            'start'    => 'OnCalendar',
            'interval' => '*-*-* 02:00:00',  # Every day at 2:00
        }
    }
    systemd::timer::job { 'package_builder_Clean_up_result_directory':
        ensure      => present,
        user        => 'root',
        description => 'Delete results older the 6 months',
        command     => "/usr/bin/find ${basepath}/result -type f -daystart -mtime +180 -delete",
        interval    => {
            'start'    => 'OnCalendar',
            'interval' => '*-*-* 03:00:00',  # Every day at 3:00
        }
    }
    if os_version('debian == jessie') {
        $php_dev='php5-dev'
        $dh_php='dh-php5'
    } else {
        $php_dev='php-dev'
        $dh_php='dh-php'
    }

    if os_version('debian >= stretch') {
        require_package([
            'dh-make-golang',
            'dh-sysuser'
        ])
    }

    # Install lintian from backports to make sure it checks the latest version
    # of the Debian Policy
    apt::pin { 'lintian':
        pin      => "release a=${::lsbdistcodename}-backports",
        package  => 'lintian',
        priority => '1001',
        before   => Package['lintian'],
    }

    package { 'lintian':
        ensure => present,
    }

    require_package([
        'cowbuilder',
        'build-essential',
        'fakeroot',
        'debhelper',
        'cdbs',
        'devscripts',
        'patchutils',
        'debian-keyring',
        'dh-make',
        'dh-autoreconf',
        'dh-golang',
        'dh-systemd',
        'openstack-pkg-tools',
        'git-buildpackage',
        'equivs',
        'quilt',
        'wdiff',
        'zip',
        'unzip',
        'debian-archive-keyring',
        'gnome-pkg-tools',
        'gobject-introspection',
        'libdistro-info-perl',
        'maven-repo-helper',
        'gradle',
        'pkg-php-tools',
        'kernel-wedge',
        'javahelper',
        'pkg-kde-tools',
        'subversion',
        'sphinx-common',
        'scons',
        'apache2-dev',
        'ivy-debian-helper',
        'maven-debian-helper',
        'haveged',
        'ubuntu-archive-keyring',
        'dh-python',
        'python3-setuptools',
        'dh-exec',
        'python3-setuptools-scm',
        $php_dev,
        $dh_php,
    ])

    file { '/etc/pbuilderrc':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('package_builder/pbuilderrc.erb'),
    }

    file { '/usr/share/lintian/profiles/wikimedia':
        ensure  => directory,
        owner   => 'root',
        group   => 'root',
        require => Package['lintian'],
    }

    file { '/usr/share/lintian/profiles/wikimedia/main.profile':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        source  => 'puppet:///modules/package_builder/wikimedia.profile',
        require => File['/usr/share/lintian/profiles/wikimedia'],
    }

    file { '/usr/share/lintian/vendors/wikimedia':
        ensure  => directory,
        owner   => 'root',
        group   => 'root',
        recurse => remote,
        source  => 'puppet:///modules/package_builder/lintian-wikimedia',
        require => Package['lintian'],
    }

    # Ship an apt configuration to integrate deb-src entries for jessie and
    # stretch, simplifies fetching the source for older distros by using
    # "apt-get source foo=VERSION" on the package build host
    ['jessie', 'stretch'].each |String $dist| {
        apt::repository{"${dist}-wikimedia_source_only":
            uri        => 'http://apt.wikimedia.org/wikimedia',
            dist       => "${dist}-wikimedia",
            bin        => false,
            components => 'main',
        }
        apt::repository{"${dist}_source_only":
            uri        => 'http://mirrors.wikimedia.org/debian/',
            dist       => $dist,
            bin        => false,
            components => 'main non-free contrib',
        }
        apt::repository{"${dist}-security_source_only":
            uri        => 'http://security.debian.org/debian-security',
            dist       => "${dist}/update",
            bin        => false,
            components => 'main non-free contrib',
        }
    }
    # Ship an apt configuration to integrate deb-src entries for unstable,
    # simplifies fetching the source by using"apt-get source foo=VERSION"
    apt::repository{'unstable_source_only':
        uri        => 'http://mirrors.wikimedia.org/debian',
        dist       => 'unstable',
        bin        => false,
        components => 'main non-free contrib',
    }

    file { '/etc/lintianrc':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        source  => 'puppet:///modules/package_builder/lintianrc',
        require => Package['lintian'],
    }

    # Dependency info
    Package['cowbuilder'] -> File['/etc/pbuilderrc']
    Package['cowbuilder'] -> Class['package_builder::environments']
    Package['cowbuilder'] -> Class['package_builder::hooks']
}