From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id DE4121FF172
	for <inbox@lore.proxmox.com>; Wed, 16 Apr 2025 14:47:51 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 4DE46365AA;
	Wed, 16 Apr 2025 14:47:45 +0200 (CEST)
From: Max Carrara <m.carrara@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed, 16 Apr 2025 14:47:35 +0200
Message-Id: <20250416124735.320256-3-m.carrara@proxmox.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250416124735.320256-1-m.carrara@proxmox.com>
References: <20250416124735.320256-1-m.carrara@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.028 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 KAM_SHORT               0.001 Use of a URL Shortener for very short URL
 PROLO_LEO1                0.1 Meta Catches all Leo drug variations so far
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH v1 pve-storage 2/2] example: sshfs plugin:
 package SSHFSPlugin.pm
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Package the new SSHFS plugin separately from the libpve-storage-perl
source. This avoids mixing up the example packaging code with the
pre-existing one.

Note that the Makefile this commit adds currently isn't being called
by the top-level one in the repository root.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
---
Changes rfc-v1 --> v1:
  * none

 example/sshfs-plugin/Makefile             | 71 +++++++++++++++++++++++
 example/sshfs-plugin/debian/changelog     |  5 ++
 example/sshfs-plugin/debian/control       | 22 +++++++
 example/sshfs-plugin/debian/copyright     | 21 +++++++
 example/sshfs-plugin/debian/rules         | 26 +++++++++
 example/sshfs-plugin/debian/source/format |  1 +
 example/sshfs-plugin/debian/triggers      |  1 +
 7 files changed, 147 insertions(+)
 create mode 100644 example/sshfs-plugin/Makefile
 create mode 100644 example/sshfs-plugin/debian/changelog
 create mode 100644 example/sshfs-plugin/debian/control
 create mode 100644 example/sshfs-plugin/debian/copyright
 create mode 100755 example/sshfs-plugin/debian/rules
 create mode 100644 example/sshfs-plugin/debian/source/format
 create mode 100644 example/sshfs-plugin/debian/triggers

diff --git a/example/sshfs-plugin/Makefile b/example/sshfs-plugin/Makefile
new file mode 100644
index 0000000..cbd0691
--- /dev/null
+++ b/example/sshfs-plugin/Makefile
@@ -0,0 +1,71 @@
+# Makes useful Debian-specific variables available
+include /usr/share/dpkg/default.mk
+
+# --- Useful variables for convenience
+
+# Note that variables can be overridden, e.g. `make install DESTDIR='./foo'`
+DESTDIR=
+PACKAGE=pve-storage-sshfs-plugin
+
+BINDIR=${DESTDIR}/usr/bin
+PERLLIBDIR=${DESTDIR}/usr/share/perl5
+MAN1DIR=${DESTDIR}/usr/share/man/man1
+MAN8DIR=${DESTDIR}/usr/share/man/man8
+CRONDAILYDIR=${DESTDIR}/etc/cron.daily
+INITDBINDIR=${DESTDIR}/etc/init.d
+SERVICEDIR=${DESTDIR}/lib/systemd/system
+BASHCOMPLDIR=${DESTDIR}/usr/share/bash-completion/completions/
+ZSHCOMPLDIR=${DESTDIR}/usr/share/zsh/vendor-completions/
+HARADIR=${DESTDIR}/usr/share/cluster
+DOCDIR=${DESTDIR}/usr/share/doc/${PACKAGE}
+PODDIR=${DESTDIR}/usr/share/doc/${PACKAGE}/pod
+USRSHARE=${DESTDIR}/usr/share/${PACKAGE}
+
+# Directory where our custom plugin has to go
+PLUGINDIR=${PERLLIBDIR}/PVE/Storage/Custom
+
+export VERSION = $(DEB_VERSION_UPSTREAM_REVISION)
+
+BUILDDIR = $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
+
+DSC=$(PACKAGE)_$(DEB_VERSION).dsc
+DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+
+# --- Targets
+
+$(BUILDDIR):
+	rm -rf $@ $@.tmp
+	mkdir $@.tmp
+	rsync -a * $@.tmp
+	# You can add additional commands instead of this comment if you need to
+	# e.g. create additional files inside the build directory etc.
+	mv $@.tmp $@
+
+# Creates a .deb package for installation
+.PHONY: deb
+deb: $(DEB)
+$(DEB): $(BUILDDIR)
+	cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
+	lintian $(DEB)
+
+# Creates a .dsc (Debian source) package
+.PHONY: dsc
+dsc:
+	rm -rf $(BUILDDIR) $(DSC)
+	$(MAKE) $(DSC)
+	lintian $(DSC)
+
+$(DSC): $(BUILDDIR)
+	cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
+
+# Target used to place files and directories at expected locations, with expected permissions
+.PHONY: install
+install:
+	install -D -m 0644 lib/PVE/Storage/Custom/SSHFSPlugin.pm $(PLUGINDIR)/SSHFSPlugin.pm
+
+# Used to clean up your builds
+.PHONY: clean
+clean:
+	rm -f $(PACKAGE)*.tar* *.deb *.dsc *.build *.buildinfo *.changes
+	rm -rf dest $(PACKAGE)-[0-9]*/
+
diff --git a/example/sshfs-plugin/debian/changelog b/example/sshfs-plugin/debian/changelog
new file mode 100644
index 0000000..7372095
--- /dev/null
+++ b/example/sshfs-plugin/debian/changelog
@@ -0,0 +1,5 @@
+pve-storage-sshfs-plugin (1.0.0) UNRELEASED; urgency=medium
+
+  * Initial release.
+
+ -- Proxmox Support Team <support@proxmox.com>  Wed, 09 Apr 2025 16:13:26 +0200
diff --git a/example/sshfs-plugin/debian/control b/example/sshfs-plugin/debian/control
new file mode 100644
index 0000000..5732cd6
--- /dev/null
+++ b/example/sshfs-plugin/debian/control
@@ -0,0 +1,22 @@
+Source: pve-storage-sshfs-plugin
+Section: perl
+Priority: optional
+Maintainer: Proxmox Support Team <support@proxmox.com>
+Rules-Requires-Root: no
+Build-Depends:
+ debhelper-compat (= 13),
+ libpve-storage-perl (>= 8.3.3),
+ lintian,
+ perl,
+ rsync,
+Standards-Version: 4.6.2
+
+Package: pve-storage-sshfs-plugin
+Architecture: any
+Depends:
+ ${misc:Depends},
+ ${perl:Depends},
+ libpve-storage-perl (>= 8.3.3),
+ sshfs (>= 3.7.3),
+Description: SSHFS storage plugin for Proxmox Virtual Environment.
+ Used to demonstrate plugin development.
diff --git a/example/sshfs-plugin/debian/copyright b/example/sshfs-plugin/debian/copyright
new file mode 100644
index 0000000..c26ed02
--- /dev/null
+++ b/example/sshfs-plugin/debian/copyright
@@ -0,0 +1,21 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Source: https://git.proxmox.com/?p=pve-storage.git
+
+Files:
+ *
+Copyright:
+ 2025 Proxmox Server Solutions GmbH <support@proxmox.com>
+License: AGPL-3.0+
+ 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 <http://www.gnu.org/licenses/>.
+
diff --git a/example/sshfs-plugin/debian/rules b/example/sshfs-plugin/debian/rules
new file mode 100755
index 0000000..f1d1d25
--- /dev/null
+++ b/example/sshfs-plugin/debian/rules
@@ -0,0 +1,26 @@
+#!/usr/bin/make -f
+
+# See debhelper(7) (uncomment to enable).
+# Output every command that modifies files on the build system.
+#export DH_VERBOSE = 1
+
+
+# See FEATURE AREAS in dpkg-buildflags(1).
+#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+# See ENVIRONMENT in dpkg-buildflags(1).
+# Package maintainers to append CFLAGS.
+#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
+# Package maintainers to append LDFLAGS.
+#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+
+
+%:
+	dh $@
+
+
+# dh_make generated override targets.
+# This is an example for Cmake (see <https://bugs.debian.org/641051>).
+#override_dh_auto_configure:
+#	dh_auto_configure -- \
+#	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
diff --git a/example/sshfs-plugin/debian/source/format b/example/sshfs-plugin/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/example/sshfs-plugin/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/example/sshfs-plugin/debian/triggers b/example/sshfs-plugin/debian/triggers
new file mode 100644
index 0000000..59dd688
--- /dev/null
+++ b/example/sshfs-plugin/debian/triggers
@@ -0,0 +1 @@
+activate-noawait pve-api-updates
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel