commit d579913375581591151896819c31d4473b01bd44 Author: ytshih Date: Tue Feb 11 16:05:27 2025 +0800 Patch from source diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..6cc9777 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,20 @@ +pkgbase = python-rtslib-fb + pkgdesc = free branch version of the LIO target API + pkgver = 2.1.76 + pkgrel = 1 + url = https://github.com/open-iscsi/rtslib-fb + arch = any + license = Apache + makedepends = python-setuptools + makedepends = python-pyudev + depends = python + depends = python-six + depends = python-pyudev + conflicts = python2-rtslib + conflicts = targetcli-fb<=2.1.fb31 + source = https://github.com/open-iscsi/rtslib-fb/archive/v2.1.76.tar.gz + source = target.service + sha512sums = 50bc9f4ebff71cc87fd62036ff9d929fb1e5989be6251b1111904e76a7c026215692dc8930b90552a4ff850c6252338e420fe710993b8c8a0c737b65590a520d + sha512sums = 3c634f1c466d0a8c3dd2b57a230438aaeeb0e66324863a2ded57dd69a2ca5946f83c4ab511766f510f3e63b43aedcf7e368bcf5bc325ee69c016bb0bb2612de5 + +pkgname = python-rtslib-fb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd9b4a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.tar.gz +*.tar.xz +*.tgz +*.rpm +*.zip +*.bz2 +src/ +pkg/ diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..2ff9c52 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,47 @@ +# Maintainer: Rigo Reddig +pkgname='python-rtslib-fb' +_pkgname=rtslib-fb +pkgver=2.2.0 +pkgrel=1 +pkgdesc="Free branch version of the LIO target API" +arch=('any') +url="https://github.com/open-iscsi/$_pkgname" +license=('Apache') +depends=('python' 'python-six' 'python-pyudev') +conflicts=('python2-rtslib' 'targetcli-fb<=2.1.fb31') +makedepends=('python-setuptools' 'python-pyudev') +source=( + "https://github.com/open-iscsi/$_pkgname/archive/v${pkgver}.tar.gz" + target.service + fix_open_context.patch +) +sha512sums=('8a321be004fabdd4abb479a1900bc27103000ea15712cbcc855fdaa762dca1658e1f3528e1e1976a56a99e57a60c0d69e3bdede5323a2f1a3a6bf419a5ddc6d4' + '3c634f1c466d0a8c3dd2b57a230438aaeeb0e66324863a2ded57dd69a2ca5946f83c4ab511766f510f3e63b43aedcf7e368bcf5bc325ee69c016bb0bb2612de5' + '312e380deb60f082238389bcd455309283935d039e2d1404be25f12546ebaaf46d8e2d0dcaa05ecab4f97014c40dfb351ba082e07c6e8a2ee20004dd149d6431') + +prepare() { + cd "$srcdir/$_pkgname-$pkgver" + patch -Np1 -i "$srcdir/fix_open_context.patch" +} + +build() { + cd "$srcdir/$_pkgname-$pkgver" + SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver python -m build --wheel --no-isolation +} + +package() { + cd "$srcdir/$_pkgname-$pkgver" + python -m installer --destdir="$pkgdir" dist/*.whl + install -Dm644 doc/targetctl.8 "$pkgdir/usr/share/man/man8/targetctl.8" + install -Dm644 doc/saveconfig.json.5 "$pkgdir/usr/share/man/man5/saveconfig.json.5" + + install -dm755 "$pkgdir/etc/target/backup" + install -Dm644 "$srcdir/target.service" "$pkgdir/usr/lib/systemd/system/target.service" + + # Install targetctl script to /usr/bin + install -Dm755 scripts/targetctl "$pkgdir/usr/bin/targetctl" + + # Create symlink for rtslib_fb to rtslib + #install -dm755 "$pkgdir/usr/lib/python3.13/site-packages/rtslib" + ln -s ./rtslib "$pkgdir/usr/lib/python3.13/site-packages/rtslib_fb" +} diff --git a/fix_open_context.patch b/fix_open_context.patch new file mode 100644 index 0000000..5d3376d --- /dev/null +++ b/fix_open_context.patch @@ -0,0 +1,11 @@ +--- rtslib-fb-2.2.0/rtslib/root.py.orig 2025-01-17 21:43:22.992672648 +0200 ++++ rtslib-fb-2.2.0/rtslib/root.py 2025-01-17 21:53:20.492076362 +0200 +@@ -487,7 +487,7 @@ + if not restore_file: + restore_file = default_save_file + +- with Path(restore_file).open as f: ++ with Path(restore_file).open() as f: + config = json.loads(f.read()) + return self.restore(config, target, storage_object, + clear_existing=clear_existing, diff --git a/python-rtslib-fb-2.2.0-1-any.pkg.tar.zst b/python-rtslib-fb-2.2.0-1-any.pkg.tar.zst new file mode 100644 index 0000000..3916f44 Binary files /dev/null and b/python-rtslib-fb-2.2.0-1-any.pkg.tar.zst differ diff --git a/target.service b/target.service new file mode 100644 index 0000000..400284e --- /dev/null +++ b/target.service @@ -0,0 +1,14 @@ +[Unit] +Description=Restore LIO kernel target configuration +Requires=sys-kernel-config.mount +After=sys-kernel-config.mount network.target local-fs.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/targetctl restore +ExecStop=/usr/bin/targetctl clear +SyslogIdentifier=target + +[Install] +WantedBy=multi-user.target