Puppet Class: package_builder

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

Summary

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

Overview

Class package_builder

Examples:

include package_builder
class {'package_builder':
  extra_packages => {'buster' =>['eatmydata'] },
}

Parameters:

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

    the base path to use

  • extra_packages (Hash[Debian::Codename, Array[String]]) (defaults to: {})

    A hash of extrabackes to add to the base image i.e. distro => [packages]}



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
# File 'modules/package_builder/manifests/init.pp', line 12

class package_builder(
    Stdlib::Unixpath                      $basepath       = '/var/cache/pbuilder',
    Hash[Debian::Codename, Array[String]] $extra_packages = {}
) {
    class { 'package_builder::hooks':
        basepath => $basepath,
    }
    class { 'package_builder::environments':
        basepath       => $basepath,
        extra_packages => $extra_packages,
    }

    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",
        ignore_errors => true,
        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",
        ignore_errors => true,
        interval      => {
            'start'    => 'OnCalendar',
            'interval' => '*-*-* 03:00:00',  # Every day at 3:00
        },
    }

    ensure_packages([
        'apache2-dev',
        'build-essential',
        'cdbs',
        'cowbuilder',
        'debhelper',
        'debian-archive-keyring',
        'debian-keyring',
        'devscripts',
        'dh-autoreconf',
        'dh-exec',
        'dh-golang',
        'dh-make',
        'dh-make-golang',
        'dh-php',
        'dh-python',
        'dh-sysuser',
        'equivs',
        'fakeroot',
        'gem2deb',
        'git-buildpackage',
        'gnome-pkg-tools',
        'gobject-introspection',
        'gradle',
        'ivy-debian-helper',
        'javahelper',
        'kernel-wedge',
        'libdistro-info-perl',
        'lintian',
        'maven-debian-helper',
        'maven-repo-helper',
        'openstack-pkg-tools',
        'patchutils',
        'php-dev',
        'piuparts',
        'pkg-kde-tools',
        'pkg-php-tools',
        'postgresql-server-dev-all',
        'python3-pbr',
        'python3-pytest-runner',
        'python3-setuptools',
        'python3-setuptools-scm',
        'quilt',
        'scons',
        'sphinx-common',
        'subversion',
        'unzip',
        'wdiff',
        'zip',
    ])

    if !debian::codename::ge('bookworm') {
        ensure_packages(['python-all'])
    }

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

    if debian::codename::ge('bullseye') {
        ensure_packages(['node-babel7', 'pkg-js-tools'])
    }

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

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

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

    # Ship an apt configuration to integrate deb-src entries for older distros
    # simplifies fetching the source for older distros by using
    # "apt-get source foo=VERSION" on the package build host
    ['buster', 'bookworm'].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',
        }

        $security_repo = ($dist == 'buster').bool2str("${dist}/updates", "${dist}-security")
        apt::repository{"${dist}-security_source_only":
            uri        => 'http://security.debian.org/debian-security',
            dist       => $security_repo,
            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 => file,
        owner  => 'root',
        group  => 'root',
        mode   => '0444',
        source => 'puppet:///modules/package_builder/lintianrc',
    }

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