Esempio n. 1
0
    def setUp(self):
        super().setUp()

        self.rpm.add_installed_file(
            "/usr/bin/derp", rpmfluff.SourceFile("file", "a" * 5), mode="1757"
        )

        self.inspection = "permissions"
        self.label = "permissions"
        self.result = "OK"
Esempio n. 2
0
    def setUp(self):
        TestRPMs.setUp(self)

        self.rpm.add_installed_file(
            "/usr/share/data/invalid_tcsh.sh",
            rpmfluff.SourceFile("invalid_tcsh.sh", invalid_tcsh),
        )
        self.inspection = "shellsyntax"
        self.result = "BAD"
        self.waiver_auth = "Anyone"
Esempio n. 3
0
    def setUp(self):
        super().setUp(rebase=True)

        self.before_rpm.add_installed_file(
            "/opt/sfw/documentation/%s/README" % AFTER_NAME,
            rpmfluff.SourceFile("README", readme),
            isDoc=True,
        )

        self.after_rpm.add_installed_file(
            "/opt/sfw/documentation/%s/README" % AFTER_NAME,
            rpmfluff.SourceFile("README", readme_with_whitespace_changes),
            isDoc=True,
        )

        self.inspection = "doc"
        self.label = "doc"
        self.result = "INFO"
        self.waiver_auth = "Not Waivable"
Esempio n. 4
0
    def setUp(self):
        super().setUp()

        self.before_rpm.add_installed_file(
            "/etc/kernel.conf",
            rpmfluff.SourceFile("kernel.conf", kernel_conf),
            isConfig=True,
        )

        self.after_rpm.add_installed_file(
            "/etc/kernel.conf",
            rpmfluff.SourceFile("kernel.conf", kernel_conf),
            isConfig=False,
        )

        self.inspection = "config"
        self.label = "config"
        self.result = "VERIFY"
        self.waiver_auth = "Anyone"
Esempio n. 5
0
    def setUp(self):
        super().setUp(rebase=True)

        self.before_rpm.add_installed_file(
            "/etc/kernel.conf",
            rpmfluff.SourceFile("kernel.conf", kernel_conf),
            isConfig=False,
        )

        self.after_rpm.add_installed_file(
            "/etc/kernel.conf",
            rpmfluff.SourceFile("kernel.conf", kernel_conf),
            isConfig=True,
        )

        self.inspection = "config"
        self.label = "config"
        self.result = "INFO"
        self.waiver_auth = "Not Waivable"
Esempio n. 6
0
    def setUp(self):
        super().setUp()

        self.after_rpm.add_installed_file(
            "/usr/bin/mount", rpmfluff.SourceFile("file", "a" * 5), mode="4755"
        )

        self.inspection = "permissions"
        self.label = "permissions"
        self.result = "OK"
Esempio n. 7
0
    def setUp(self):
        super().setUp()

        self.before_rpm.add_installed_file(
            "/etc/kernel.conf",
            rpmfluff.SourceFile("kernel.conf", kernel_conf),
            isConfig=True,
        )

        self.after_rpm.add_installed_file(
            "/etc/kernel.conf",
            rpmfluff.SourceFile("kernel.conf",
                                kernel_conf_with_whitespace_changes),
            isConfig=True,
        )

        self.inspection = "config"
        self.result = "INFO"
        self.waiver_auth = "Not Waivable"
Esempio n. 8
0
    def setUp(self):
        super().setUp()

        self.after_rpm.add_installed_file("/usr/bin/derp",
                                          rpmfluff.SourceFile("file", "a" * 5),
                                          mode="1757")

        self.inspection = "permissions"
        self.result = "BAD"
        self.waiver_auth = "Security"
Esempio n. 9
0
    def setUp(self):
        super().setUp()

        # add the large patch
        self.after_rpm.add_patch(
            rpmfluff.SourceFile("some.patch", patch_file_threshold), False)

        self.inspection = "patches"
        self.result = "VERIFY"
        self.waiver_auth = "Anyone"
Esempio n. 10
0
    def setUp(self):
        super().setUp()

        self.before_rpm.add_installed_file(
            "/opt/sfw/documentation/%s/README" % AFTER_NAME,
            rpmfluff.SourceFile("README", readme),
            isDoc=False,
        )

        self.after_rpm.add_installed_file(
            "/opt/sfw/documentation/%s/README" % AFTER_NAME,
            rpmfluff.SourceFile("README", readme),
            isDoc=True,
        )

        self.inspection = "doc"
        self.label = "doc"
        self.result = "VERIFY"
        self.waiver_auth = "Anyone"
Esempio n. 11
0
 def setUp(self):
     TestRPMs.setUp(self)
     self.rpm.add_installed_file(
         "/usr/share/data/invalid.xml",
         rpmfluff.SourceFile("invalid.xml", invalid_xml),
     )
     self.inspection = "xml"
     self.label = "xml-files"
     self.result = "VERIFY"
     self.waiver_auth = "Anyone"
Esempio n. 12
0
    def setUp(self):
        TestCompareKoji.setUp(self)

        # Adds /usr/bin/hello-world
        self.before_rpm.add_simple_compilation()
        self.after_rpm.add_simple_compilation()

        # Adds /usr/share/applications/hello-world.desktop
        self.before_rpm.add_installed_file(
            "/usr/share/applications/hello-world.desktop",
            rpmfluff.SourceFile('hello-world.desktop', good_desktop_file))
        self.after_rpm.add_installed_file(
            "/usr/share/applications/hello-world.desktop",
            rpmfluff.SourceFile('hello-world.desktop', good_desktop_file))

        self.inspection = 'desktop'
        self.label = 'desktop-entry-files'
        self.result = 'VERIFY'
        self.waiver_auth = 'Anyone'
Esempio n. 13
0
    def setUp(self):
        super().setUp(rebase=True)

        self.after_rpm.add_patch(rpmfluff.SourceFile("some.patch", patch_file),
                                 False)

        self.inspection = "patches"
        self.label = "patches"
        self.result = "INFO"
        self.waiver_auth = "Not Waivable"
Esempio n. 14
0
    def setUp(self):
        super().setUp()

        self.after_rpm.add_patch(rpmfluff.SourceFile("some.patch", patch_file),
                                 False)

        self.inspection = "patches"
        self.label = "patches"
        self.result = "VERIFY"
        self.waiver_auth = "Anyone"
Esempio n. 15
0
    def setUp(self):
        TestCompareKoji.setUp(self)

        # Adds /usr/bin/hello-world
        self.before_rpm.add_simple_compilation()
        self.after_rpm.add_simple_compilation()

        # Adds /usr/share/applications/hello-world.desktop
        self.before_rpm.add_installed_file(
            "/usr/share/applications/hello-world.desktop",
            rpmfluff.SourceFile("hello-world.desktop", good_desktop_file),
        )
        self.after_rpm.add_installed_file(
            "/usr/share/applications/hello-world.desktop",
            rpmfluff.SourceFile("hello-world.desktop", good_desktop_file),
        )

        self.inspection = "desktop"
        self.result = "VERIFY"
        self.waiver_auth = "Anyone"
Esempio n. 16
0
    def setUp(self):
        super().setUp()

        self.rpm.add_installed_file(
            "/usr/bin/trojan", rpmfluff.SourceFile("file", "a" * 5), mode="4755"
        )

        self.inspection = "permissions"
        self.label = "permissions"
        self.result = "BAD"
        self.waiver_auth = "Security"
Esempio n. 17
0
    def setUp(self):
        super().setUp()

        self.after_rpm.add_installed_file(
            "/usr/share/sealand-motto.txt",
            rpmfluff.SourceFile("sealand-motto.txt", sealand_motto),
        )

        self.inspection = "politics"
        self.result = "INFO"
        self.waiver_auth = "Not Waivable"
Esempio n. 18
0
    def setUp(self):
        super().setUp()

        self.after_rpm.add_installed_file(
            "/usr/share/most-of-sealand-is.txt",
            rpmfluff.SourceFile("most-of-sealand-is.txt", "water"),
        )

        self.inspection = "politics"
        self.result = "BAD"
        self.waiver_auth = "Not Waivable"
Esempio n. 19
0
    def setUp(self):
        TestCompareKoji.setUp(self)

        # disable automatic man page compression in rpmbuild
        self.before_rpm.header += "%global __brp_compress /bin/true\n"
        self.after_rpm.header += "%global __brp_compress /bin/true\n"

        # add an uncompressed man page
        self.before_rpm.add_installed_file(
            "usr/local/share/man/man1/foo.1",
            rpmfluff.SourceFile("foo.1", sample_man_page),
        )
        self.after_rpm.add_installed_file(
            "usr/local/share/man/man1/foo.1",
            rpmfluff.SourceFile("foo.1", sample_man_page),
        )

        # the test
        self.inspection = "manpage"
        self.result = "VERIFY"
        self.waiver_auth = "Anyone"
Esempio n. 20
0
    def setUp(self):
        super().setUp()

        # two files with the same data, but compressed differently
        with open(datadir + "test1-low.gz", "rb") as f:
            before_src = f.read()

        with open(datadir + "test2-low.gz", "rb") as f:
            after_src = f.read()

        # create the test packages
        self.before_rpm.add_installed_file(
            "/usr/etc/firmware.gz",
            rpmfluff.SourceFile("firmware.gz", before_src))
        self.after_rpm.add_installed_file(
            "/usr/etc/firmware.gz",
            rpmfluff.SourceFile("firmware.gz", after_src))

        self.inspection = "changedfiles"
        self.result = "OK"
        self.waiver_auth = "Not Waivable"
Esempio n. 21
0
def test_conflict_is_ignored_if_not_installable_concurrently(
        request, dir_server):
    glib_26 = rpmfluff.SimpleRpmBuild('glib', '2.26', '1.el6', ['i686'])
    glib_26.add_devel_subpackage()
    glib_26.add_installed_file(
        installPath="usr/share/gtk-doc/html/gio/annotation-glossary.html",
        sourceFile=rpmfluff.SourceFile('annotation-glossary.html',
                                       'something\n'),
        subpackageSuffix='devel')
    glib_28 = rpmfluff.SimpleRpmBuild('glib', '2.28', '8.el6', ['i686'])
    glib_doc = glib_28.add_subpackage('doc')
    glib_doc.add_requires('glib = 2.28-8.el6')
    glib_28.add_installed_file(
        installPath="usr/share/gtk-doc/html/gio/annotation-glossary.html",
        sourceFile=rpmfluff.SourceFile('annotation-glossary.html',
                                       'some other content\n'),
        subpackageSuffix='doc')
    glib_28.make()

    repo = rpmfluff.YumRepoBuild((glib_26, ))
    repo.make('i686')
    dir_server.basepath = repo.repoDir

    def cleanUp():
        shutil.rmtree(repo.repoDir)
        shutil.rmtree(glib_28.get_base_dir())
        shutil.rmtree(glib_26.get_base_dir())

    request.addfinalizer(cleanUp)

    exitcode, out, err = run_rpmdeplint([
        'rpmdeplint', 'check-conflicts',
        '--repo=base,{}'.format(dir_server.url),
        glib_28.get_built_rpm('i686'),
        glib_28.get_built_rpm('i686', 'glib-doc')
    ])
    assert exitcode == 0
    assert err == ''
    assert out == ''
Esempio n. 22
0
    def setUp(self):
        TestCompareKoji.setUp(self)

        installPath = "usr/lib/libfoo.so"

        # Can't use rpmfluff here because it always adds -fPIC
        self.before_rpm.add_source(
            rpmfluff.SourceFile("simple.c", rpmfluff.simple_library_source)
        )
        self.before_rpm.section_build += (
            "gcc -m32 -fPIC -shared -Wl,-z,noexecstack -o libsimple.so simple.c\n"
        )
        self.before_rpm.create_parent_dirs(installPath)
        self.before_rpm.section_install += (
            "cp libsimple.so $RPM_BUILD_ROOT/%s\n" % installPath
        )
        sub = self.before_rpm.get_subpackage(None)
        sub.section_files += "/%s\n" % installPath
        self.before_rpm.add_payload_check(installPath, None)

        self.after_rpm.add_source(
            rpmfluff.SourceFile("simple.c", rpmfluff.simple_library_source)
        )
        self.after_rpm.section_build += (
            "gcc -m32 -fno-pic -shared -Wl,-z,noexecstack -o libsimple.so simple.c\n"
        )
        self.after_rpm.create_parent_dirs(installPath)
        self.after_rpm.section_install += (
            "cp libsimple.so $RPM_BUILD_ROOT/%s\n" % installPath
        )
        sub = self.after_rpm.get_subpackage(None)
        sub.section_files += "/%s\n" % installPath
        self.after_rpm.add_payload_check(installPath, None)

        self.inspection = "elf"
        self.label = "elf-object-properties"
        self.waiver_auth = "Security"
        self.result = "BAD"
Esempio n. 23
0
    def setUp(self):
        TestCompareKoji.setUp(self)

        # add files and symlinks
        self.before_rpm.add_installed_file(installPath='usr/bin/rpminspect',
                                           sourceFile=rpmfluff.SourceFile(
                                               'rpminspect', ri_bytes),
                                           mode="0755")
        self.before_rpm.add_installed_file(
            installPath='usr/bin/anotherrpminspect',
            sourceFile=rpmfluff.SourceFile('rpminspect', ri_bytes),
            mode="0755")
        self.after_rpm.add_installed_file(installPath='usr/bin/rpminspect',
                                          sourceFile=rpmfluff.SourceFile(
                                              'rpminspect', ri_bytes),
                                          mode="0755")
        self.after_rpm.add_installed_symlink('usr/bin/anotherrpminspect',
                                             'rpminspect')

        self.inspection = 'symlinks'
        self.label = 'symlinks'
        self.result = 'VERIFY'
        self.waiver_auth = 'Anyone'
Esempio n. 24
0
    def setUp(self):
        super().setUp()

        # rpmbuild will usually catch malformed patches, but only if
        # they are applied in the spec file.  rpminspect will catch
        # malformed patches that are defined but not used.  The second
        # parameter of add_patch() is a boolean indicating whether or
        # not to apply the patch in the spec file, so disable that for
        # this test to see if rpminspect works.
        self.rpm.add_patch(rpmfluff.SourceFile("some.patch", "Qx"), False)

        self.inspection = "patches"
        self.result = "BAD"
        self.waiver_auth = "Anyone"
Esempio n. 25
0
    def setUp(self):
        TestKoji.setUp(self)

        # add file and symlink
        self.rpm.add_installed_file(
            installPath="usr/bin/rpminspect",
            sourceFile=rpmfluff.SourceFile("rpminspect", ri_bytes),
            mode="0755",
        )
        self.rpm.add_installed_symlink("usr/sbin/rpminspect", "/usr/bin/rpminspect")

        self.inspection = "symlinks"
        self.result = "OK"
        self.waiver_auth = "Not Waivable"
Esempio n. 26
0
def test_obeys_xml_base_when_downloading_packages(request, tmpdir, dir_server):
    p2 = rpmfluff.SimpleRpmBuild('b', '0.1', '1', ['x86_64'])
    p2.add_installed_file(installPath='usr/share/thing',
                          sourceFile=rpmfluff.SourceFile(
                              'thing', 'same content\n'))
    p2.make()

    # Set up a repo at http://$dirserver/therepo/ pointing at packages stored
    # in http://$dirserver/thepackages/ using xml:base.
    dir_server.basepath = tmpdir.strpath
    shutil.copy(p2.get_built_rpm('x86_64'),
                tmpdir.mkdir('thepackages').strpath)
    subprocess.check_output([
        'createrepo_c', '--baseurl={}/thepackages'.format(dir_server.url),
        '--outputdir=.', '../thepackages'
    ],
                            stderr=subprocess.STDOUT,
                            cwd=tmpdir.mkdir('therepo').strpath)

    p1 = rpmfluff.SimpleRpmBuild('a', '0.1', '1', ['x86_64'])
    p1.add_installed_file(installPath='usr/share/thing',
                          sourceFile=rpmfluff.SourceFile(
                              'thing', 'same content\n'))
    p1.make()

    def cleanUp():
        shutil.rmtree(p2.get_base_dir())
        shutil.rmtree(p1.get_base_dir())

    request.addfinalizer(cleanUp)

    exitcode, out, err = run_rpmdeplint([
        'rpmdeplint', 'check-conflicts',
        '--repo=base,{}/therepo'.format(dir_server.url),
        p1.get_built_rpm('x86_64')
    ])
    assert exitcode == 0
Esempio n. 27
0
    def setUp(self):
        TestCompareKoji.setUp(self)

        # add file and symlink
        self.after_rpm.add_installed_file(installPath='usr/bin/rpminspect',
                                          sourceFile=rpmfluff.SourceFile(
                                              'rpminspect', ri_bytes),
                                          mode="0755")
        self.after_rpm.add_installed_symlink('usr/sbin/rpminspect',
                                             '/usr/bin/rpminspect')

        self.inspection = 'symlinks'
        self.label = 'symlinks'
        self.result = 'OK'
        self.waiver_auth = 'Not Waivable'
Esempio n. 28
0
    def setUp(self):
        TestCompareRPMs.setUp(self)

        # add file and symlink
        self.after_rpm.add_installed_file(installPath='usr/bin/rpminspect',
                                          sourceFile=rpmfluff.SourceFile(
                                              'rpminspect', ri_bytes),
                                          mode="0755")
        self.after_rpm.add_installed_symlink('usr/bin/anotherrpminspect',
                                             'originalrpminspect')

        self.inspection = 'symlinks'
        self.label = 'symlinks'
        self.result = 'INFO'
        self.waiver_auth = 'Anyone'
Esempio n. 29
0
    def setUp(self):
        TestCompareKoji.setUp(self)

        # add files and symlinks
        self.before_rpm.add_installed_file(
            installPath="usr/bin/rpminspect",
            sourceFile=rpmfluff.SourceFile("rpminspect", ri_bytes),
            mode="0755",
        )
        self.before_rpm.add_installed_file(
            installPath="usr/bin/anotherrpminspect",
            sourceFile=rpmfluff.SourceFile("rpminspect", ri_bytes),
            mode="0755",
        )
        self.after_rpm.add_installed_file(
            installPath="usr/bin/rpminspect",
            sourceFile=rpmfluff.SourceFile("rpminspect", ri_bytes),
            mode="0755",
        )
        self.after_rpm.add_installed_symlink("usr/bin/anotherrpminspect", "rpminspect")

        self.inspection = "symlinks"
        self.result = "VERIFY"
        self.waiver_auth = "Anyone"
Esempio n. 30
0
    def setUp(self):
        TestCompareKoji.setUp(self)

        # Adds /usr/bin/hello-world
        self.before_rpm.add_simple_compilation()
        self.after_rpm.add_simple_compilation()

        # Adds /usr/share/applications/hello-world.desktop
        self.before_rpm.add_installed_file(
            "/usr/share/applications/hello-world.desktop",
            rpmfluff.SourceFile("hello-world.desktop", good_desktop_file),
        )
        self.after_rpm.add_installed_file(
            "/usr/share/applications/hello-world.desktop",
            rpmfluff.SourceFile("hello-world.desktop", good_desktop_file),
        )

        # Adds /usr/share/icons/hello-world.png to a subpackage
        self.before_rpm.add_subpackage("icons")
        self.before_rpm.add_installed_file(
            "/usr/share/icons/hello-world.png",
            rpmfluff.GeneratedSourceFile("hello-world.png",
                                         rpmfluff.make_png()),
            subpackageSuffix="icons",
        )

        self.after_rpm.add_subpackage("icons")
        self.after_rpm.add_installed_file(
            "/usr/share/icons/hello-world.png",
            rpmfluff.GeneratedSourceFile("hello-world.png",
                                         rpmfluff.make_png()),
            subpackageSuffix="icons",
        )

        self.inspection = "desktop"
        self.result = "OK"