示例#1
0
    def test_run_or_fail_when_fails_raises_system_exit(self, subprocess_mock):
        subprocess_mock.call.return_value = 1
        with self.assertRaises(SystemExit) as cm:
            Util.run_or_fail(["a", "b", "c"], "2")

        self.assertEqual(cm.exception.code,
                         'Exit 1: Command "a b c" failed.\n')
示例#2
0
    def build(self):
        self._prepare_rpm_build_dir()

        build_flags = self._build_rpm_build_flags()
        spec_file_path = os.path.join(self.rpm_build_dir, "SPECS",
                                      self.name + ".spec")

        command_str = "rpmbuild -bb %s %s" % (spec_file_path, build_flags)
        cmd = ['/bin/bash', '-c', command_str]
        Util.run_or_fail(cmd, cwd=self.rpm_build_dir)
示例#3
0
    def generate_changelog(self):
        new_version = f'{self.gpdb_upstream_version}-{self.debian_revision}'
        cmd = [
            'dch', '--create', '--package', self.package_name, '--newversion',
            new_version, self.release_message
        ]
        Util.run_or_fail(cmd, cwd=self.source_dir)

        cmd = ['dch', '--release', 'ignored message']
        Util.run_or_fail(cmd, cwd=self.source_dir)
示例#4
0
    def test_extract_gpdb_version(self):
        temp_dir = tempfile.mkdtemp()
        os.chdir(temp_dir)
        bin_gpdb_path = 'bin_gpdb.tar.gz'
        git_info_path = 'git-info.json'
        with open(git_info_path, "w") as git_info:
            git_info.write('{"root":{"version":"a-real-sha"}}')
        with tarfile.open(bin_gpdb_path, "w:gz") as tar:
            tar.add(git_info_path, arcname="./etc/git-info.json")

        self.assertEqual(Util.extract_gpdb_version(bin_gpdb_path),
                         "a-real-sha")
        shutil.rmtree(temp_dir)
示例#5
0
 def _rules(self):
     return Util.strip_margin('''#!/usr/bin/make -f
           |
           |include /usr/share/dpkg/default.mk
           |
           |%:
           |	dh $@ --parallel
           |
           |# debian policy is to not use /usr/local
           |# dh_usrlocal does some funny stuff; override to do nothing
           |override_dh_usrlocal:
           |
           |# skip scanning for shlibdeps?
           |override_dh_shlibdeps:
           |
           |# skip removing debug output
           |override_dh_strip:
           |''')
示例#6
0
 def _control(self):
     return Util.strip_margin(
         f'''Source: {self.package_name}
            |Maintainer: Pivotal Greenplum Release Engineering <*****@*****.**>
            |Section: database
            |Build-Depends: debhelper (>= 9)
            |
            |Package: {self.package_name}
            |Architecture: amd64
            |Depends: libapr1,
            |    libaprutil1,
            |    bash,
            |    bzip2,
            |    krb5-multidev,
            |    libcurl3-gnutls,
            |    libcurl4,
            |    libevent-2.1-6,
            |    libreadline7,
            |    libxml2,
            |    libyaml-0-2,
            |    zlib1g,
            |    libldap-2.4-2,
            |    openssh-client,
            |    openssh-server,
            |    openssl,
            |    perl,
            |    rsync,
            |    sed,
            |    tar,
            |    zip,
            |    net-tools,
            |    less,
            |    iproute2
            |Description: Greenplum Database
            |  Greenplum Database is an advanced, fully featured, open source data platform.
            |  It provides powerful and rapid analytics on petabyte scale data volumes.
            |  Uniquely geared toward big data analytics, Greenplum Database is powered by
            |  the world's most advanced cost-based query optimizer delivering high
            |  analytical query performance on large data volumes.The Greenplum Database®
            |  project is released under the Apache 2 license.  We want to thank all our
            |  current community contributors and all who are interested in new
            |  contributions.  For the Greenplum Database community, no contribution is too
            |  small, we encourage all types of contributions.
            |''')
示例#7
0
 def publish(self):
     cmd = ['dput', self.ppa_repo, self.source_package.changes()]
     Util.run_or_fail(cmd)
示例#8
0
 def build_source(self):
     # -S should be equivalent to the long option `--build=source` but it is not
     # -sa forces the inclusion of the original source (no long-opt)
     cmd = ['debuild', '-S', '-sa']
     Util.run_or_fail(cmd, cwd=self.source_package.dir())
示例#9
0
 def build_binary(self):
     cmd = ['debuild', '--unsigned-changes', '--unsigned-source', '--build=binary']
     Util.run_or_fail(cmd, cwd=self.source_package.dir())
示例#10
0
 def test_run_or_fail_when_successful_works(self, subprocess_mock):
     subprocess_mock.call.return_value = 0
     Util.run_or_fail("test-cmd", "test-cwd")
     subprocess_mock.call.assert_called_with("test-cmd", cwd="test-cwd")
示例#11
0
 def test_strip_margin_removes_multiline_tabs(self):
     self.assertEqual(
         Util.strip_margin(f'''A
            |B
            |C'''), "A\nB\nC")
示例#12
0
 def test_strip_margin_removes_tabs(self):
     self.assertEqual(Util.strip_margin("\n\t\t\t|"), "\n")
示例#13
0
 def test_strip_margin_noop_on_empty_string(self):
     self.assertEqual(Util.strip_margin(''), '')
示例#14
0
 def gpdb_version_short(self):
     if self._gpdb_version_short is None:
         self._gpdb_version_short = Util.extract_gpdb_version(
             self.bin_gpdb_path)
     return self._gpdb_version_short