diff --git a/.gitignore b/.gitignore index 8999b7e..449ea13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ /target /debug.log /test.log + +# Debian build artifacts +debian/.debhelper/ +debian/cargo_home/ +debian/debhelper-build-stamp +debian/files +debian/xdebug-tui.substvars +debian/xdebug-tui/ diff --git a/README.md b/README.md index 8789490..9d5edbc 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,13 @@ Interactive [Xdebug](https://xdebug.org) step-debugging client for your terminal - Download the [latest release](https://github.com/dantleech/debug-tui/releases/latest). - Compile it yourself `cargo build`. +- Install the Debian package: `sudo dpkg -i xdebug-tui_*.deb` + +### Building the Debian package + +```bash +dpkg-buildpackage -us -uc -b +``` ## CLI options diff --git a/debian/Jenkinsfile b/debian/Jenkinsfile new file mode 100644 index 0000000..b7ebd1a --- /dev/null +++ b/debian/Jenkinsfile @@ -0,0 +1,162 @@ +#!groovy + +// Current version of this Pipeline https://github.com/VitexSoftware/BuildImages/blob/main/Test/Jenkinsfile-parael + +String[] distributions = [ +//'debian:bookworm', +'debian:trixie', +'debian:forky', +//'ubuntu:jammy', +//'ubuntu:noble' +] + +String vendor = 'vitexsoftware' +//String distroFamily = '' + +properties([ + copyArtifactPermission('*') +]) +node() { + ansiColor('xterm') { + stage('SCM Checkout') { + checkout scm + } + } +} + +def branches = [:] +distributions.each { distro -> + branches[distro] = { + def distroName = distro + println "Dist:" + distroName + + def dist = distroName.split(':') + def distroFamily = dist[0] + def distroCode = dist[1] + def buildImage = '' + def artifacts = [] + def buildVer = '' + + node { + ansiColor('xterm') { + stage('Checkout ' + distroName) { + checkout scm + def imageName = vendor + '/' + distro + buildImage = docker.image(imageName) + sh 'git checkout debian/changelog' + def version = sh ( + script: 'dpkg-parsechangelog --show-field Version', + returnStdout: true + ).trim() + buildVer = version + '.' + env.BUILD_NUMBER + '~' + distroCode + } + stage('Build ' + distroName) { + buildImage.inside { + // Set unique build directories for this parallel build to avoid conflicts + def uniqueBuildId = env.BUILD_NUMBER + '-' + distroCode + '-' + env.EXECUTOR_NUMBER + sh ''' + export DH_INTERNAL_BUILDDIR="/tmp/debhelper-build-''' + uniqueBuildId + '''" + export TMPDIR="/tmp/build-''' + uniqueBuildId + '''" + mkdir -p "$DH_INTERNAL_BUILDDIR" "$TMPDIR" + ''' + sh 'dch -b -v ' + buildVer + ' "' + env.BUILD_TAG + '"' + sh 'sudo apt-get update --allow-releaseinfo-change' + sh 'sudo chown jenkins:jenkins ..' + sh 'sudo rm -rf debian/$(dpkg-parsechangelog --show-field Source)/ debian/.debhelper/ debian/tmp/' + sh ''' + export DH_INTERNAL_BUILDDIR="/tmp/debhelper-build-''' + uniqueBuildId + '''" + export TMPDIR="/tmp/build-''' + uniqueBuildId + '''" + debuild-pbuilder -r"sudo -E" -i -us -uc -b + ''' + sh 'mkdir -p $WORKSPACE/dist/debian/ ; rm -rf $WORKSPACE/dist/debian/* ; for deb in $(cat debian/files | awk \'{print $1}\'); do mv "../$deb" $WORKSPACE/dist/debian/; done' + artifacts = sh ( + script: "cat debian/files | awk '{print \$1}'", + returnStdout: true + ).trim().split('\n') + } + } + + stage('Test ' + distroName) { + buildImage.inside { + def debconf_debug = 0 //Set to "5" or "developer" to debug debconf + sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz; cd $WORKSPACE' + sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' + sh 'sudo apt-get update --allow-releaseinfo-change' + sh 'echo "INSTALATION"' + + def installOrder = [ +// '', + ] + + def sorted_artifacts = artifacts.toList() + + // If installOrder is empty, install all produced packages + if (installOrder.isEmpty()) { + sorted_artifacts.each { deb_file -> + if (deb_file.endsWith('.deb')) { + def pkgName = deb_file.tokenize('/')[-1].replaceFirst(/_.*/, '') + sh 'echo -e "${GREEN} installing ' + pkgName + ' on `lsb_release -sc` ${ENDCOLOR} "' + sh 'sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install ' + pkgName + } + } + } else { + // Install packages in specified order + installOrder.each { pkgPrefix -> + def debFile = null + for (item in sorted_artifacts) { + def itemStr = item.toString() + if (itemStr.startsWith(pkgPrefix) && itemStr.endsWith('.deb')) { + debFile = itemStr + break + } + } + if (debFile) { + def pkgName = debFile.tokenize('/')[-1].replaceFirst(/_.*/, '') + sh 'echo -e "${GREEN} installing ' + pkgName + ' on `lsb_release -sc` ${ENDCOLOR} "' + sh 'sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install ' + pkgName + } + } + } + + } + stage('Archive artifacts ' + distroName ) { + // Only run if previous stages (Build and Test) succeeded + buildImage.inside { + // Archive all produced artifacts listed in debian/files + artifacts.each { deb_file -> + println "Archiving artifact: " + deb_file + archiveArtifacts artifacts: 'dist/debian/' + deb_file + } + + // Cleanup: remove any produced files named in debian/files + // Try both the dist location and any potential original locations referenced by debian/files + def uniqueBuildId = env.BUILD_NUMBER + '-' + distroCode + '-' + env.EXECUTOR_NUMBER + sh ''' + set -e + if [ -f debian/files ]; then + while read -r file _; do + [ -n "$file" ] || continue + rm -f "dist/debian/$file" || true + rm -f "../$file" || true + rm -f "$WORKSPACE/$file" || true + done < debian/files + fi + # Cleanup temporary build directories + rm -rf "/tmp/debhelper-build-''' + uniqueBuildId + '''" || true + rm -rf "/tmp/build-''' + uniqueBuildId + '''" || true + ''' + } + } + } + } + } +} +} + +parallel branches + +node { + stage('Publish to Aptly') { + publishDebToAptly() + } +} diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..0da572d --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +xdebug-tui (0.3.1) unstable; urgency=low + + * Initial release. + + -- Vítězslav Dvořák Thu, 26 Feb 2026 09:24:33 +0100 diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/debian/clean @@ -0,0 +1 @@ +target/ diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..baae4ec --- /dev/null +++ b/debian/control @@ -0,0 +1,29 @@ +Source: xdebug-tui +Section: devel +Priority: optional +Maintainer: Vítězslav Dvořák +Build-Depends: + debhelper-compat (= 13), + cargo, + rustc, + libstdc++-dev, + pkg-config, +Standards-Version: 4.7.0 +Homepage: https://github.com/dantleech/debug-tui +Rules-Requires-Root: no +Vcs-Git: https://github.com/Vitexus/xdebug-tui.git +Vcs-Browser: https://github.com/Vitexus/xdebug-tui + +Package: xdebug-tui +Architecture: any +Multi-Arch: foreign +Depends: + ${misc:Depends}, + ${shlibs:Depends}, +Description: Interactive Xdebug step-debugging client for the terminal + debug-tui is a terminal-based interactive step-debugging client for + PHP's Xdebug extension. It provides a TUI (Text User Interface) with + features including step-over/into/out navigation, history mode to + revisit previous steps, stack frame jumping, Vim-like motions, inline + variable values display, and process control for launching and + restarting debugged processes. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..60b630d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,32 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: debug-tui +Upstream-Contact: Daniel Leech +Source: https://github.com/dantleech/debug-tui +Comment: Upstream does not provide an explicit license file. + Please contact upstream to clarify the licensing terms. + +Files: * +Copyright: 2025 Daniel Leech +License: UNKNOWN + The upstream project does not include a license file. + This package is provided for local/private use only until + upstream clarifies the license. + +Files: debian/* +Copyright: 2026 Vítězslav Dvořák +License: GPL-3+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + . + This package 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 General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..e772481 --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +usr/bin diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..f079d8d --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,4 @@ +[DEFAULT] +debian-branch = main +upstream-tag = %(version)s +pristine-tar = False diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..033e86d --- /dev/null +++ b/debian/rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export CARGO_HOME = $(CURDIR)/debian/cargo_home + +%: + dh $@ + +override_dh_auto_build: + cargo build --release + +override_dh_auto_install: + install -D -m 755 target/release/debug-tui $(CURDIR)/debian/xdebug-tui/usr/bin/xdebug-tui + +override_dh_auto_test: + +override_dh_auto_clean: + cargo clean || true + rm -rf $(CARGO_HOME) diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..f3d706b --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,2 @@ +Test-Command: xdebug-tui --help +Restrictions: superficial diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..ce94258 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/dantleech/debug-tui/issues +Bug-Submit: https://github.com/dantleech/debug-tui/issues/new +Repository: https://github.com/dantleech/debug-tui.git +Repository-Browse: https://github.com/dantleech/debug-tui diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..b50036f --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=4 +opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/xdebug-tui-$1\.tar\.gz/ \ + https://github.com/dantleech/debug-tui/tags .*/archive/refs/tags/v?(\d[\d.]+)\.tar\.gz diff --git a/debian/xdebug-tui.install b/debian/xdebug-tui.install new file mode 100644 index 0000000..e69de29