From 224e25eab55a73a80dc8b507c8ba07c3b0dec99c Mon Sep 17 00:00:00 2001 From: Jiangcuo Date: Wed, 5 Feb 2025 19:41:14 +0800 Subject: [PATCH] first init --- Makefile | 61 +++++++++++ debian/changelog | 5 + debian/control | 102 ++++++++++++++++++ debian/copyright | 69 ++++++++++++ debian/lintian-overrides | 4 + .../001-fix-autoclean-on-first-build.patch | 15 +++ .../002-fix-spdk_setup-rootdir-path.patch | 13 +++ debian/patches/series | 2 + debian/postinst | 21 ++++ debian/postrm | 16 +++ debian/pxvirt-spdk.links | 2 + debian/pxvirt-spdk.service | 15 +++ debian/rules | 76 +++++++++++++ src | 1 + 14 files changed, 402 insertions(+) create mode 100644 Makefile create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/lintian-overrides create mode 100644 debian/patches/001-fix-autoclean-on-first-build.patch create mode 100644 debian/patches/002-fix-spdk_setup-rootdir-path.patch create mode 100644 debian/patches/series create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100644 debian/pxvirt-spdk.links create mode 100644 debian/pxvirt-spdk.service create mode 100755 debian/rules create mode 160000 src diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b56efa9 --- /dev/null +++ b/Makefile @@ -0,0 +1,61 @@ +include /usr/share/dpkg/pkg-info.mk + + +export PVERELEASE = $(shell echo $(DEB_VERSION_UPSTREAM) | cut -d. -f1-2) +export VERSION = $(DEB_VERSION_UPSTREAM_REVISION) + +PACKAGE = pxvirt-spdk +SRCDIR := src +ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) + +BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM) + +DEB = $(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(ARCH).deb \ +python3-spdk_$(DEB_VERSION_UPSTREAM_REVISION)_$(ARCH).deb + + +DSC=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc +GITVERSION:=$(shell git rev-parse --short=16 HEAD) + +all: $(SUBDIRS) + set -e && for i in $(SUBDIRS); do $(MAKE) -C $$i; done + +.PHONY: submodule +submodule: +ifeq ($(shell test -f "$(SRCDIR)/configure" && echo 1 || echo 0), 0) + git submodule update --init --recursive +endif + +$(BUILDDIR): submodule + rm -rf $@ $@.tmp + mkdir $@.tmp + rsync -a debian $@.tmp + rsync -a src/* $@.tmp + echo "git clone https://gitea.lierfang.com/pxcloud/pxvirt\\ngit checkout $(GITVERSION)" > $@.tmp/debian/SOURCE + echo "REPOID_GENERATED=$(GITVERSION)" > $@.tmp/debian/rules.env + mv $@.tmp $@ + + +.PHONY: deb +deb: $(DEB) +$(DEB): $(BUILDDIR) + cd $(BUILDDIR); dpkg-buildpackage -b -us -uc + lintian $(DEB) + + +.PHONY: lintian +deb: $(DEB) + lintian $(DEB) + +.PHONY: distclean +distclean: clean + +.PHONY: clean +clean: + set -e && for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done + rm -f $(PACKAGE)*.tar* country.dat *.deb *.dsc *.build *.buildinfo *.changes + rm -rf dest $(PACKAGE)-[0-9]*/ + +.PHONY: dinstall +dinstall: $(DEB) + dpkg -i $(DEB) \ No newline at end of file diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..cb8795c --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +pxvirt-spdk (24.09) bookworm; urgency=medium + + * init + + -- Jiangcuo Mon, 03 Feb 2025 13:56:49 +0800 \ No newline at end of file diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..d088fb7 --- /dev/null +++ b/debian/control @@ -0,0 +1,102 @@ +Source: pxvirt-spdk +Section: admin +Priority: optional +Maintainer: Lierfang +Build-Depends: debhelper-compat (= 12), + cmake, + libaio-dev, + libcunit1-dev, + libcmocka-dev, + libdpdk-dev, + libjson-c-dev, + librdmacm-dev, + libnuma-dev, + libpmem-dev, + libpmemblk-dev, + libpmemobj-dev, + liburing-dev, + libfuse3-dev, + librados-dev, + librbd-dev, + libbfio-dev, + libkeyutils-dev, + libncurses5-dev, + libncursesw5-dev, + libssl-dev, + uuid-dev, + libiscsi-dev, + python3-dev, + pkg-config, + python3, + python3-pip, + python3-pkgconfig, + python3-pytest, + python3-magic, + python3-restructuredtext-lint, + python3-pyelftools, + python3-ijson, + python3-grpcio, + python3-yaml, + python3-jinja2, + python3-tabulate, + python3-configshell-fb, + python3-pexpect, + python3-paramiko, + python3-sphinx, + valgrind, + nasm, + build-essential, + g++, + quilt, + unzip, + patchelf, + meson, + libtool, + help2man, + systemtap-sdt-dev, + astyle, + lcov, + clang, + sg3-utils, + pciutils, + shellcheck, + abigail-tools, + bash-completion, + ruby-dev, + pycodestyle, + bundler, + rake, + libibverbs-dev, + librdmacm-dev, + doxygen, + mscgen, + graphviz, + libavahi-client-dev, + liblz4-dev, + python3:any +Standards-Version: 4.5.1 +Homepage: https://spdk.io + + +Package: pxvirt-spdk +Architecture: any +Depends: dbus, + python3:any, + python3-configshell-fb, + python3-pyparsing, + python3-grpcio, + python3-googleapi, + python3-ipy, + ${misc:Depends}, + ${shlibs:Depends}, +Description: SPDK for pxvirt + This package contains the spdk used by PXVIRT + +Package: python3-spdk +Architecture: any +Depends: pxvirt-spdk, + python3:any, + ${misc:Depends}, + ${shlibs:Depends}, +Description: SPDK for pxvirt + This package contains the spdk used by PXVIRT \ No newline at end of file diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..4bce308 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,69 @@ +Copyright (C) 2010-2025 Lierfang + +This software is written by Lierfang + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero 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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +------------- + +Ext JS - JavaScript Library +Copyright (c) 2006-2021, Sencha Inc. +All rights reserved. +licensing@sencha.com + +http://www.sencha.com/license + +Open Source License +---------------------------------------------------------------------------- +This version of Ext JS is licensed under the terms of the +Open Source GPL 3.0 license. + +http://www.gnu.org/licenses/gpl.html (/usr/share/common-licenses/GPL-3) + +There are several FLOSS exceptions available for use with this release for +open source applications that are distributed under a license other than GPL. + +* Open Source License Exception for Applications + + http://www.sencha.com/products/floss-exception.php + +* Open Source License Exception for Development + + http://www.sencha.com/products/ux-exception.php + +------------------------------ + +Bootstrap html framework: + +The MIT License (MIT) + +Copyright (c) 2011-2014 Twitter, Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/debian/lintian-overrides b/debian/lintian-overrides new file mode 100644 index 0000000..97c265c --- /dev/null +++ b/debian/lintian-overrides @@ -0,0 +1,4 @@ +python3-spdk: package-installs-python-pycache-dir [usr/lib/python3.11/dist-packages/spdk/__pycache__/] +python3-spdk: shell-script-fails-syntax-check [usr/share/spdk/scripts/env_dpdk/check_dpdk_pci_api.sh] +python3-spdk: shell-script-fails-syntax-check [usr/share/spdk/scripts/perf/pm/collect-cpu-temp] +python3-spdk: shell-script-fails-syntax-check [usr/share/spdk/scripts/rxe_cfg_small.sh] \ No newline at end of file diff --git a/debian/patches/001-fix-autoclean-on-first-build.patch b/debian/patches/001-fix-autoclean-on-first-build.patch new file mode 100644 index 0000000..d403bf7 --- /dev/null +++ b/debian/patches/001-fix-autoclean-on-first-build.patch @@ -0,0 +1,15 @@ +diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk +index 19f0192c2..9dcaac54d 100644 +--- a/mk/spdk.common.mk ++++ b/mk/spdk.common.mk +@@ -7,10 +7,6 @@ + # Copyright (c) 2022 Dell Inc, or its subsidiaries. + # + +-ifeq ($(wildcard $(SPDK_ROOT_DIR)/mk/config.mk),) +-$(error mk/config.mk: file not found. Please run configure before make) +-endif +- + include $(SPDK_ROOT_DIR)/mk/config.mk + -include $(SPDK_ROOT_DIR)/mk/cc.flags.mk + -include $(SPDK_ROOT_DIR)/mk/cc.mk diff --git a/debian/patches/002-fix-spdk_setup-rootdir-path.patch b/debian/patches/002-fix-spdk_setup-rootdir-path.patch new file mode 100644 index 0000000..8c92c19 --- /dev/null +++ b/debian/patches/002-fix-spdk_setup-rootdir-path.patch @@ -0,0 +1,13 @@ +diff --git a/scripts/setup.sh b/scripts/setup.sh +index 477be189d..0641182cd 100755 +--- a/scripts/setup.sh ++++ b/scripts/setup.sh +@@ -13,7 +13,7 @@ if [[ $os != Linux && $os != FreeBSD ]]; then + exit 1 + fi + +-rootdir=$(readlink -f $(dirname $0))/.. ++rootdir=$(dirname "$(realpath "$0")")/.. + source "$rootdir/scripts/common.sh" + + function usage() { diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..e58e0b9 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +001-fix-autoclean-on-first-build.patch +002-fix-spdk_setup-rootdir-path.patch diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..4db1785 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +case "$1" in + configure) + if [ ! -f "/etc/default/grub.d/spdk.cfg" ]; then + arch=$(uname -m) + if [ "$arch" = "x86_64" ];then + iommu="intel_iommu=on iommu=pt amd_iommu=on" + fi + echo "GRUB_CMDLINE_LINUX=\"hugepagesz=2M hugepages=1024 $iommu\"" >/etc/default/grub.d/spdk.cfg + update-grub + fi + ;; + +esac + +exit 0 \ No newline at end of file diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..7f2bc9e --- /dev/null +++ b/debian/postrm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +case "$1" in + remove) + if [ -f "/etc/default/grub.d/spdk.cfg" ]; then + rm /etc/default/grub.d/spdk.cfg + fi + ;; + +esac + +exit 0 \ No newline at end of file diff --git a/debian/pxvirt-spdk.links b/debian/pxvirt-spdk.links new file mode 100644 index 0000000..c81543e --- /dev/null +++ b/debian/pxvirt-spdk.links @@ -0,0 +1,2 @@ +usr/share/spdk/scripts/setup.sh usr/bin/spdk_setup +usr/include /usr/share/spdk/include \ No newline at end of file diff --git a/debian/pxvirt-spdk.service b/debian/pxvirt-spdk.service new file mode 100644 index 0000000..3575748 --- /dev/null +++ b/debian/pxvirt-spdk.service @@ -0,0 +1,15 @@ +[Unit] +Description=PXVirt SPDK Service +After=pvestatd.service +StartLimitBurst=10 +StartLimitIntervalSec=60 + +[Service] +Environment=HUGEMEM=1024 +ExecStart=/usr/bin/vhost -S /var/tmp -s $HUGEMEM -m 0x3 +Restart=on-failure +RestartSec=5 + + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..d052cc2 --- /dev/null +++ b/debian/rules @@ -0,0 +1,76 @@ +#!/usr/bin/make -f + +export DH_VERBOSE=1 + +export CONFIG_PREFIX=/usr +export PYDIST=$(shell python3 -c "import site; print(site.getsitepackages()[2])") + +%: + dh $@ --with quilt + +override_dh_auto_configure: + ./configure \ + --libdir=/usr/lib/"$(DEB_HOST_MULTIARCH)"/spdk \ + --prefix=/usr \ + --disable-examples \ + --disable-tests \ + --disable-unit-tests \ + --with-xnvme \ + --with-vhost \ + --with-virtio \ + --with-vbdev-compress \ + --with-rbd \ + --with-rdma \ + --with-iscsi-initiator \ + --with-uring \ + --with-fuse \ + --with-nvme-cuse \ + --with-raid5f \ + --with-crypto \ + --without-sma + +override_dh_auto_build: + dh_auto_build -- PREFIX=/usr + +override_dh_auto_install: + dh_auto_install -- DESTDIR=$(CURDIR)/debian/pxvirt-spdk + + # delete dpdk + rm -rf $(CURDIR)/debian/pxvirt-spdk/usr/bin/dpdk* + rm -rf $(CURDIR)/debian/pxvirt-spdk/usr/lib/dpdk + rm -rf $(CURDIR)/debian/pxvirt-spdk/usr/share/dpdk + rm -rf $(CURDIR)/debian/pxvirt-spdk/usr/share/docs/dpdk + + # delete static + find $(CURDIR)/debian/pxvirt-spdk/ -name "*.a" -exec rm {} \; + + # delete libisal-dev libdpdk-dev + find $(CURDIR)/debian/pxvirt-spdk/usr/include/ -name "rte*" -exec rm {} \; + find $(CURDIR)/debian/pxvirt-spdk/usr/include/ -name "librte*" -exec rm {} \; + find $(CURDIR)/debian/pxvirt-spdk/usr/lib/ -name "librte*" -exec rm {} \; + rm $(CURDIR)/debian/pxvirt-spdk/usr/lib/pkgconfig/libdpdk-libs.pc + rm $(CURDIR)/debian/pxvirt-spdk/usr/lib/pkgconfig/libdpdk.pc + rm $(CURDIR)/debian/pxvirt-spdk/usr/lib/pkgconfig/libisal.pc + rm $(CURDIR)/debian/pxvirt-spdk/usr/lib/pkgconfig/libisal_crypto.pc + + # install python + rm -rf $(CURDIR)/debian/pxvirt-spdk/usr/local + rm -rf $(CURDIR)/debian/python3-spdk/usr/local + mkdir $(CURDIR)/debian/python3-spdk/$(PYDIST) -p + cp -r $(CURDIR)/python/spdk $(CURDIR)/debian/python3-spdk/$(PYDIST) + + # install spdk scripts + mkdir $(CURDIR)/debian/python3-spdk/usr/share/spdk -p + cp -r $(CURDIR)/scripts $(CURDIR)/debian/python3-spdk/usr/share/spdk/ + + # install spdk_setup + install -Dm644 "scripts/bash-completion/spdk" $(CURDIR)/debian/pxvirt-spdk/usr/share/bash-completion/completions/spdk + install -Dm644 "LICENSE" $(CURDIR)/debian/pxvirt-spdk/usr/share/licenses/pxvirt-spdk/LICENSE + + + +override_dh_usrlocal: + +override_dh_dwz: + +override_dh_auto_clean: diff --git a/src b/src new file mode 160000 index 0000000..19524ad --- /dev/null +++ b/src @@ -0,0 +1 @@ +Subproject commit 19524ad45373e35d5fdc06f4e081444d87ceed80