From 14f9184629bcde865e22de943a88ea77d0cfa6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Thu, 4 Jan 2024 15:48:38 +0800 Subject: [PATCH 1/5] Initial native packaging for btop --- debian/btop.install | 7 +++ debian/changelog | 5 ++ debian/control | 21 ++++++++ debian/copyright | 101 +++++++++++++++++++++++++++++++++++++++ debian/gbp.conf | 10 ++++ debian/install | 3 ++ debian/rules | 36 ++++++++++++++ debian/salsa-ci.yml | 4 ++ debian/source/format | 1 + debian/tests/control | 9 ++++ debian/upstream/metadata | 13 +++++ 11 files changed, 210 insertions(+) create mode 100644 debian/btop.install create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/gbp.conf create mode 100644 debian/install create mode 100755 debian/rules create mode 100644 debian/salsa-ci.yml create mode 100644 debian/source/format create mode 100644 debian/tests/control create mode 100644 debian/upstream/metadata diff --git a/debian/btop.install b/debian/btop.install new file mode 100644 index 0000000..664ede4 --- /dev/null +++ b/debian/btop.install @@ -0,0 +1,7 @@ +usr/bin/btop +usr/share/applications/btop.desktop +usr/share/btop/themes/* +usr/share/doc/btop/README.md +usr/share/icons/hicolor/48x48/apps/btop.png +usr/share/icons/hicolor/scalable/apps/btop.svg +usr/share/man/man1/btop.1 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..7cb0b43 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +btop (1.2.13) UNRELEASED; urgency=low + + * Initial release for native upstream builds. + + -- Otto Kekäläinen Thu, 04 Jan 2024 14:26:24 +0000 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..f208a3a --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: btop +Section: utils +Priority: optional +Maintainer: Otto Kekäläinen +Build-Depends: debhelper-compat (= 13), + libfmt-dev, + lowdown +Standards-Version: 4.6.2 +Homepage: https://github.com/aristocratos/btop +Rules-Requires-Root: no +Vcs-Git: https://github.com/aristocratos/btop.git +Vcs-Browser: https://github.com/aristocratos/btop + +Package: btop +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends} +Description: Modern and colorful command line resource monitor that shows usage and stats + Resource monitor that shows usage and stats for processor, memory, disks, + network and processes. This C++ version is continuation of bashtop and bpytop. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..b3b8667 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,101 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: btop +Upstream-Contact: Jakob P. Liljenberg +Source: https://github.com/aristocratos/btop + +# This is a autogenerated template for debian/copyright. +# +# Edit this according to the "Machine-readable debian/copyright file" as +# http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ . +# +# Generate updated license templates with the "debmake -cc" to STDOUT +# and merge them into debian/copyright as needed. + +Files: .editorconfig + .github/* + CHANGELOG.md + CMakeLists.txt + CODE_OF_CONDUCT.md + CONTRIBUTING.md + debian/* + Img/* + Makefile + manpage.md + README.md + btop.desktop + cmake/* + snap/snapcraft.yaml + themes/* + src/*.cpp + src/*.hpp +Copyright: 2021-2024 Jakob P. Liljenberg + 2024 Otto Kekäläinen +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian systems, the complete text of the Apache License Version 2.0 + can be found in `/usr/share/common-licenses/Apache-2.0'. + +Files: src/openbsd/* +Copyright: 2019-2021 Brian Callahan +License: ISC + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: include/fmt/* +Copyright: 2012-2018 Victor Zverovich +License: Expat with embedded exception + 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. + . + --- Optional exception to the license --- + . + As an exception, if, as a result of your compiling your source code, portions + of this Software are embedded into a machine-executable object form of such + source code, you may redistribute such embedded portions in such object form + without including the above copyright and permission notices. + +Files: include/widechar_width.hpp +Copyright: 2018-2023 Cory Doras +License: CC0-1.0 + widecharwidth and its output files are released into the public domain. They + may be used for any purpose without requiring attribution, or under the CC0 + license if public domain is not available. + . + On Debian systems, the complete text of the Apache License Version 2.0 + can be found in `/usr/share/common-licenses/CC0-1.0'. diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..e8aa581 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,10 @@ +[DEFAULT] +# Ignore requirement to use branch name 'debian/latest' to make it easier for +# contributors to work with feature and bugfix branches +ignore-branch = True + +# Always use pristine tar +pristine-tar = True + +# Always sign tags +sign-tags = True diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..bd1c067 --- /dev/null +++ b/debian/install @@ -0,0 +1,3 @@ +# The build puts all files directly into debiam/btop/usr.. so there is nothing +# for dh_install to do, thus just keep this file empty. +# https://manpages.debian.org/unstable/debhelper/dh_install.1.en.html diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..d660ddb --- /dev/null +++ b/debian/rules @@ -0,0 +1,36 @@ +#!/usr/bin/make -f + +# See FEATURE AREAS/ENVIRONMENT in dpkg-buildflags(1) +# Apply all hardening options +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +# Package maintainers to append CFLAGS +export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# Package maintainers to append LDFLAGS +export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 + +# According to Debian Policy version 4.2.0 builds should be as verbose as +# possible unless 'terse' is specifically passed. +ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) + export DH_VERBOSE = 1 + # See btop Makefile + export VERBOSE = true + export QUIET = false +endif + +# Override default /usr/local with proper system path +export PREFIX := /usr + +# Use system libfmt-dev provided library +# @TODO: Does not seem to take effect as local include/fmt is found first +export CXXFLAGS=-I/usr/include/fmt + +# From Debhelper 15 onwards this will be automatic, but until then +# dh_auto_install defaults in a single package build in installing everything to +# debian/btop which is undesired in this case, as we want to control the files +# to be installed via btop.install +override_dh_auto_install: + dh_auto_install --destdir=debian/tmp/ + +# main packaging script based on post dh7 syntax +%: + dh $@ diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml new file mode 100644 index 0000000..a89c19c --- /dev/null +++ b/debian/salsa-ci.yml @@ -0,0 +1,4 @@ +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml + 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..f61fd44 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,9 @@ +# +# DEP-8: autopkgtest - automatic as-installed package testing +# Please check * https://dep-team.pages.debian.net/deps/dep8/ +# * /usr/share/doc/autopkgtest +# +# !!! Please make sure to edit this to a valid test, otherwise build will fails +# +#Tests: testcode.sh +#Restrictions: allow-stderr, breaks-testbed, needs-internet, needs-root diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..25a2f5a --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,13 @@ +# +# DEP-12: Per-package machine-readable metadata about Upstream +# Please check * https://dep-team.pages.debian.net/deps/dep12/ +# * https://wiki.debian.org/UpstreamMetadata +# +Bug-Database: https://github.com/aristocratos/btop/issues +Bug-Submit: https://github.com/aristocratos/btop/issues/new +Donation: https://github.com/sponsors/aristocratos +Repository: https://github.com/aristocratos/btop +Repository-Browse: https://github.com/aristocratos/btop +Reference: + Author: Jakob P. Liljenberg + Year: 2022 From c7f97b0c1bc73934a269fb356e49e44c467c3f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Sat, 13 Jan 2024 17:43:59 -0800 Subject: [PATCH 2/5] Install README in its own subdirectory According to the Linux Standard Base (LSB), README files should be installed in the /usr/share/doc directory. By convention however the README files should not go there 'bare', but in a subdirectory for each program. Install to $(PREFIX)/share/doc/btop/README.md to comply with this. To ensure the 'themes' is copied as a full directory and not individual files, create the /usr/share/btop in a separate step as the doc installation step no longer does it. --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e489164..6581705 100644 --- a/Makefile +++ b/Makefile @@ -305,10 +305,11 @@ install: @mkdir -p $(DESTDIR)$(PREFIX)/bin @cp -p $(TARGETDIR)/btop $(DESTDIR)$(PREFIX)/bin/btop @chmod 755 $(DESTDIR)$(PREFIX)/bin/btop - @printf "\033[1;92mInstalling doc to: \033[1;97m$(DESTDIR)$(PREFIX)/share/btop\n" - @mkdir -p $(DESTDIR)$(PREFIX)/share/btop - @cp -p README.md $(DESTDIR)$(PREFIX)/share/btop + @printf "\033[1;92mInstalling doc to: \033[1;97m$(DESTDIR)$(PREFIX)/share/doc/btop\n" + @mkdir -p $(DESTDIR)$(PREFIX)/share/doc/btop + @cp -p README.md $(DESTDIR)$(PREFIX)/share/doc/btop @printf "\033[1;92mInstalling themes to: \033[1;97m$(DESTDIR)$(PREFIX)/share/btop/themes\033[0m\n" + @mkdir -p $(DESTDIR)$(PREFIX)/share/btop @cp -pr themes $(DESTDIR)$(PREFIX)/share/btop @printf "\033[1;92mInstalling desktop entry to: \033[1;97m$(DESTDIR)$(PREFIX)/share/applications/btop.desktop\n" @mkdir -p $(DESTDIR)$(PREFIX)/share/applications/ From 0b2597c501dcff9224b281e0340bc72b136f27d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Sat, 13 Jan 2024 22:31:56 -0800 Subject: [PATCH 3/5] Use shebang Makefile explicitly a Makefile --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 6581705..103c413 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +#!/usr/bin/make -f +# #* Btop++ makefile v1.6 BANNER = \n \033[38;5;196m██████\033[38;5;240m╗ \033[38;5;196m████████\033[38;5;240m╗ \033[38;5;196m██████\033[38;5;240m╗ \033[38;5;196m██████\033[38;5;240m╗\n \033[38;5;160m██\033[38;5;239m╔══\033[38;5;160m██\033[38;5;239m╗╚══\033[38;5;160m██\033[38;5;239m╔══╝\033[38;5;160m██\033[38;5;239m╔═══\033[38;5;160m██\033[38;5;239m╗\033[38;5;160m██\033[38;5;239m╔══\033[38;5;160m██\033[38;5;239m╗ \033[38;5;160m██\033[38;5;239m╗ \033[38;5;160m██\033[38;5;239m╗\n \033[38;5;124m██████\033[38;5;238m╔╝ \033[38;5;124m██\033[38;5;238m║ \033[38;5;124m██\033[38;5;238m║ \033[38;5;124m██\033[38;5;238m║\033[38;5;124m██████\033[38;5;238m╔╝ \033[38;5;124m██████\033[38;5;238m╗\033[38;5;124m██████\033[38;5;238m╗\n \033[38;5;88m██\033[38;5;237m╔══\033[38;5;88m██\033[38;5;237m╗ \033[38;5;88m██\033[38;5;237m║ \033[38;5;88m██\033[38;5;237m║ \033[38;5;88m██\033[38;5;237m║\033[38;5;88m██\033[38;5;237m╔═══╝ ╚═\033[38;5;88m██\033[38;5;237m╔═╝╚═\033[38;5;88m██\033[38;5;237m╔═╝\n \033[38;5;52m██████\033[38;5;236m╔╝ \033[38;5;52m██\033[38;5;236m║ ╚\033[38;5;52m██████\033[38;5;236m╔╝\033[38;5;52m██\033[38;5;236m║ ╚═╝ ╚═╝\n \033[38;5;235m╚═════╝ ╚═╝ ╚═════╝ ╚═╝ \033[1;3;38;5;240mMakefile v1.6\033[0m From 52ff63d2d20f050ea814d43de3bcaed466ce2e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Sat, 13 Jan 2024 22:36:12 -0800 Subject: [PATCH 4/5] WIP: Automatic version number --- debian/changelog | 2 +- debian/rules | 13 +++++++++++++ debian/substvars | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 debian/substvars diff --git a/debian/changelog b/debian/changelog index 7cb0b43..5c35c3a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -btop (1.2.13) UNRELEASED; urgency=low +btop (1.x.y) UNRELEASED; urgency=low * Initial release for native upstream builds. diff --git a/debian/rules b/debian/rules index d660ddb..ea73ef5 100755 --- a/debian/rules +++ b/debian/rules @@ -24,6 +24,19 @@ export PREFIX := /usr # @TODO: Does not seem to take effect as local include/fmt is found first export CXXFLAGS=-I/usr/include/fmt +# Automatic version from sources +VERSION := $(shell head -n100 src/btop.cpp 2>/dev/null | grep "Version =" | cut -f2 -d"\"") + +# This will affect the built .deb package but modifying debian/changelog during +# build is too late for many tools and e.g. the .changes files will be using the +# original version +override_dh_auto_clean: + # Too complex, depends on devscripts + #dch --force-bad-version --newversion $(VERSION) "Automatic build" + # Simple sed on changelog (extra substvars does not seem to have effect) + sed "s/1.x.y/$(VERSION)/" -i debian/changelog debian/substvars + dh_auto_clean + # From Debhelper 15 onwards this will be automatic, but until then # dh_auto_install defaults in a single package build in installing everything to # debian/btop which is undesired in this case, as we want to control the files diff --git a/debian/substvars b/debian/substvars new file mode 100644 index 0000000..7deaab0 --- /dev/null +++ b/debian/substvars @@ -0,0 +1 @@ +source:Version=1.x.y From 7d55a983be2c7299bf1e8cf470df844f8de0c213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Sat, 13 Jan 2024 23:01:37 -0800 Subject: [PATCH 5/5] WIP: Temporary manual 1.3.0 version --- debian/changelog | 2 +- debian/rules | 13 ------------- debian/substvars | 1 - 3 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 debian/substvars diff --git a/debian/changelog b/debian/changelog index 5c35c3a..522ee24 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -btop (1.x.y) UNRELEASED; urgency=low +btop (1.3.0) UNRELEASED; urgency=low * Initial release for native upstream builds. diff --git a/debian/rules b/debian/rules index ea73ef5..d660ddb 100755 --- a/debian/rules +++ b/debian/rules @@ -24,19 +24,6 @@ export PREFIX := /usr # @TODO: Does not seem to take effect as local include/fmt is found first export CXXFLAGS=-I/usr/include/fmt -# Automatic version from sources -VERSION := $(shell head -n100 src/btop.cpp 2>/dev/null | grep "Version =" | cut -f2 -d"\"") - -# This will affect the built .deb package but modifying debian/changelog during -# build is too late for many tools and e.g. the .changes files will be using the -# original version -override_dh_auto_clean: - # Too complex, depends on devscripts - #dch --force-bad-version --newversion $(VERSION) "Automatic build" - # Simple sed on changelog (extra substvars does not seem to have effect) - sed "s/1.x.y/$(VERSION)/" -i debian/changelog debian/substvars - dh_auto_clean - # From Debhelper 15 onwards this will be automatic, but until then # dh_auto_install defaults in a single package build in installing everything to # debian/btop which is undesired in this case, as we want to control the files diff --git a/debian/substvars b/debian/substvars deleted file mode 100644 index 7deaab0..0000000 --- a/debian/substvars +++ /dev/null @@ -1 +0,0 @@ -source:Version=1.x.y