re-applied changes to app-forensics/libvslvm

This commit is contained in:
Volker Wegert 2022-11-20 23:22:18 +01:00
parent 99e2331873
commit 941dc6fbe1
No known key found for this signature in database
GPG key ID: 1BCEC13D2F171EC4
5 changed files with 310 additions and 0 deletions

View file

@ -0,0 +1,2 @@
DIST libvslvm-experimental-20210807.tar.gz 1590906 BLAKE2B a7bbfa687ddce75fd2f34b368eb64647cf0a6bd49e6b6291a0b260541d845e27f37c08a3bed86cd28002c7bc54e6e4afefd2cd2e5aead6a8d3e1016f2d315381 SHA512 6d40242c5748efa684b9fa428077511b49eaee15c769f7c8259e09d498252f2967f2a70a6bc291e1ac213698b3bc9eefcb30ce7a8c868e071d63dd656aefefe4
DIST libvslvm-experimental-20221025.tar.gz 1629008 BLAKE2B 00dc4ac26f5b086c9f35c850ccce279b13e5b96a542ef27bcf55d43e9f269b74af2d27d1e5f7c1673554003a5a4dec89cf04f4c9b8db720e672ff3d57fae6188 SHA512 d8fded89d4f0fe522e19232ef90eb3df0ed39a1f99d4373cff13b713b9b27f78ec4bfecc32f823b878d6e6742bf735758334648096894b5966798135481e7b55

View file

@ -0,0 +1,157 @@
#!/usr/bin/env python
#
# Python-bindings handle type test script
#
# Copyright (C) 2014-2022, Joachim Metz <joachim.metz@gmail.com>
#
# Refer to AUTHORS for acknowledgements.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import argparse
import os
import sys
import unittest
import pyvslvm
class HandleTypeTests(unittest.TestCase):
"""Tests the handle type."""
def test_signal_abort(self):
"""Tests the signal_abort function."""
vslvm_handle = pyvslvm.handle()
vslvm_handle.signal_abort()
def test_open(self):
"""Tests the open function."""
test_source = unittest.source
if not test_source:
raise unittest.SkipTest("missing source")
vslvm_handle = pyvslvm.handle()
vslvm_handle.open(test_source)
with self.assertRaises(IOError):
vslvm_handle.open(test_source)
vslvm_handle.close()
with self.assertRaises(TypeError):
vslvm_handle.open(None)
with self.assertRaises(ValueError):
vslvm_handle.open(test_source, mode="w")
def test_open_file_object(self):
"""Tests the open_file_object function."""
test_source = unittest.source
if not test_source:
raise unittest.SkipTest("missing source")
if not os.path.isfile(test_source):
raise unittest.SkipTest("source not a regular file")
vslvm_handle = pyvslvm.handle()
with open(test_source, "rb") as file_object:
vslvm_handle.open_file_object(file_object)
with self.assertRaises(IOError):
vslvm_handle.open_file_object(file_object)
vslvm_handle.close()
with self.assertRaises(TypeError):
vslvm_handle.open_file_object(None)
with self.assertRaises(ValueError):
vslvm_handle.open_file_object(file_object, mode="w")
def test_close(self):
"""Tests the close function."""
test_source = unittest.source
if not test_source:
raise unittest.SkipTest("missing source")
vslvm_handle = pyvslvm.handle()
with self.assertRaises(IOError):
vslvm_handle.close()
def test_open_close(self):
"""Tests the open and close functions."""
test_source = unittest.source
if not test_source:
return
vslvm_handle = pyvslvm.handle()
# Test open and close.
vslvm_handle.open(test_source)
vslvm_handle.close()
# Test open and close a second time to validate clean up on close.
vslvm_handle.open(test_source)
vslvm_handle.close()
if os.path.isfile(test_source):
with open(test_source, "rb") as file_object:
# Test open_file_object and close.
vslvm_handle.open_file_object(file_object)
vslvm_handle.close()
# Test open_file_object and close a second time to validate clean up on close.
vslvm_handle.open_file_object(file_object)
vslvm_handle.close()
# Test open_file_object and close and dereferencing file_object.
vslvm_handle.open_file_object(file_object)
del file_object
vslvm_handle.close()
def test_get_volume_group(self):
"""Tests the get_volume_group function."""
test_source = unittest.source
if not test_source:
raise unittest.SkipTest("missing source")
vslvm_handle = pyvslvm.handle()
vslvm_handle.open(test_source)
volume_group = vslvm_handle.get_volume_group()
self.assertIsNotNone(volume_group)
vslvm_handle.close()
if __name__ == "__main__":
argument_parser = argparse.ArgumentParser()
argument_parser.add_argument(
"source", nargs="?", action="store", metavar="PATH",
default=None, help="path of the source file.")
options, unknown_options = argument_parser.parse_known_args()
unknown_options.insert(0, sys.argv[0])
setattr(unittest, "source", options.source)
unittest.main(argv=unknown_options, verbosity=2)

View file

@ -0,0 +1,70 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..11} )
inherit autotools python-single-r1
DESCRIPTION="Library and tools to access the Linux Logical Volume Manager (LVM) format"
HOMEPAGE="https://github.com/libyal/libvslvm"
SRC_URI="https://github.com/libyal/libvslvm/releases/download/${PV}/${PN}-experimental-${PV}.tar.gz"
LICENSE="LGPL-3"
SLOT="0"
KEYWORDS="amd64 ~arm64 x86"
IUSE="nls unicode python +fuse +threads debug"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
"
DEPEND="
nls? (
virtual/libiconv
virtual/libintl
)
python? ( dev-lang/python:* )
app-forensics/libbfio[nls=,unicode=,threads=]
dev-libs/libcdata[nls=]
dev-libs/libcerror[nls=]
dev-libs/libcfile[nls=,unicode=]
dev-libs/libclocale[nls=,unicode=]
dev-libs/libcnotify[nls=]
dev-libs/libcpath[nls=,unicode=]
dev-libs/libcsplit[nls=,unicode=]
dev-libs/libcthreads[nls=]
dev-libs/libfcache[nls=]
dev-libs/libfdata[nls=]
dev-libs/libfvalue[nls=]
dev-libs/libuna[nls=,unicode=]
"
RDEPEND="
${DEPEND}
python? ( ${PYTHON_DEPS} )
fuse? ( sys-fs/fuse )
"
src_prepare() {
# workaround for missing files in distribution package, see https://github.com/libyal/libvslvm/issues/12
# should not be required any more in releases after 20221025
cp "${FILESDIR}/2022-11-pyvslvm_test_handle.py" "${WORKDIR}/${P}/tests/pyvslvm_test_handle.py"
eautoreconf
eapply_user
}
src_configure() {
econf \
$(use_enable nls) \
$(use_with nls libiconv-prefix) \
$(use_with nls libintl-prefix) \
$(use_enable unicode wide-character-type) \
$(use_enable debug verbose-output ) \
$(use_enable debug debug-output ) \
$(use_enable threads multi-threading-support) \
$(use_enable python) \
$(use_enable python python3) \
$(use_with fuse libfuse) \
}

View file

@ -0,0 +1,70 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..11} )
inherit autotools python-single-r1
DESCRIPTION="Library and tools to access the Linux Logical Volume Manager (LVM) format"
HOMEPAGE="https://github.com/libyal/libvslvm"
SRC_URI="https://github.com/libyal/libvslvm/releases/download/${PV}/${PN}-experimental-${PV}.tar.gz"
LICENSE="LGPL-3"
SLOT="0"
KEYWORDS="amd64 ~arm64 x86"
IUSE="nls unicode python +fuse +threads debug"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
"
DEPEND="
nls? (
virtual/libiconv
virtual/libintl
)
python? ( dev-lang/python:* )
app-forensics/libbfio[nls=,unicode=,threads=]
dev-libs/libcdata[nls=]
dev-libs/libcerror[nls=]
dev-libs/libcfile[nls=,unicode=]
dev-libs/libclocale[nls=,unicode=]
dev-libs/libcnotify[nls=]
dev-libs/libcpath[nls=,unicode=]
dev-libs/libcsplit[nls=,unicode=]
dev-libs/libcthreads[nls=]
dev-libs/libfcache[nls=]
dev-libs/libfdata[nls=]
dev-libs/libfvalue[nls=]
dev-libs/libuna[nls=,unicode=]
"
RDEPEND="
${DEPEND}
python? ( ${PYTHON_DEPS} )
fuse? ( sys-fs/fuse )
"
src_prepare() {
# workaround for missing files in distribution package, see https://github.com/libyal/libvslvm/issues/12
# should not be required any more in releases after 20221025
cp "${FILESDIR}/2022-11-pyvslvm_test_handle.py" "${WORKDIR}/${P}/tests/pyvslvm_test_handle.py"
eautoreconf
eapply_user
}
src_configure() {
econf \
$(use_enable nls) \
$(use_with nls libiconv-prefix) \
$(use_with nls libintl-prefix) \
$(use_enable unicode wide-character-type) \
$(use_enable debug verbose-output ) \
$(use_enable debug debug-output ) \
$(use_enable threads multi-threading-support) \
$(use_enable python) \
$(use_enable python python3) \
$(use_with fuse libfuse) \
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>unknown@pentoo.ch</email>
<name>Author Unknown</name>
</maintainer>
<use>
<flag name="fuse">Enable FUSE support</flag>
</use>
</pkgmetadata>