From 2a1d36cd43e3719b34843316e4afd823eb9761d5 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 12 Jun 2024 23:43:28 +0800 Subject: [PATCH 01/23] add deb pack stub --- tests/plugins/pack/xmake.lua | 2 +- xmake/plugins/pack/deb/main.lua | 53 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 xmake/plugins/pack/deb/main.lua diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua index 437ae8a3714..e5a83d8f1cd 100644 --- a/tests/plugins/pack/xmake.lua +++ b/tests/plugins/pack/xmake.lua @@ -19,7 +19,7 @@ target("foo") add_packages("zlib") xpack("test") - set_formats("nsis", "srpm", "rpm", "zip", "targz", "srczip", "srctargz", "runself", "wix") + set_formats("nsis", "srpm", "rpm", "deb", "zip", "targz", "srczip", "srctargz", "runself", "wix") set_title("hello") set_author("ruki") set_description("A test installer.") diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua new file mode 100644 index 00000000000..b2629ef0417 --- /dev/null +++ b/xmake/plugins/pack/deb/main.lua @@ -0,0 +1,53 @@ +--!A cross-platform build utility based on Lua +-- +-- 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. +-- +-- Copyright (C) 2015-present, TBOOX Open Source Group. +-- +-- @author ruki +-- @file main.lua +-- + +-- imports +import("core.base.option") +import("core.base.semver") +import("core.base.hashset") +import("lib.detect.find_tool") +import("lib.detect.find_file") +import("utils.archive") +import(".batchcmds") + +-- get the debuild +function _get_debuild() + local debuild = find_tool("debuild", {force = true}) + assert(debuild, "debuild not found!") + return debuild +end + +-- pack deb package +function _pack_deb(debuild, package) +end + +function main(package) + if not is_host("linux") then + return + end + + cprint("packing %s", package:outputfile()) + + -- get debuild + local debuild = _get_debuild() + + -- pack deb package + _pack_deb(debuild.program, package) +end From 598d43eaadf88c5813454e3e79c8e1d56117360a Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 13 Jun 2024 22:42:41 +0800 Subject: [PATCH 02/23] add debian template --- xmake/plugins/pack/xpack.lua | 22 +- xmake/scripts/xpack/deb/debian/README.Debian | 6 + xmake/scripts/xpack/deb/debian/README.source | 10 + xmake/scripts/xpack/deb/debian/changelog | 5 + xmake/scripts/xpack/deb/debian/control | 16 + xmake/scripts/xpack/deb/debian/copyright | 38 +++ xmake/scripts/xpack/deb/debian/manpage.1.ex | 56 ++++ xmake/scripts/xpack/deb/debian/manpage.md.ex | 126 ++++++++ .../scripts/xpack/deb/debian/manpage.sgml.ex | 154 +++++++++ xmake/scripts/xpack/deb/debian/manpage.xml.ex | 291 ++++++++++++++++++ xmake/scripts/xpack/deb/debian/postinst.ex | 39 +++ xmake/scripts/xpack/deb/debian/postrm.ex | 37 +++ xmake/scripts/xpack/deb/debian/preinst.ex | 35 +++ xmake/scripts/xpack/deb/debian/prerm.ex | 38 +++ xmake/scripts/xpack/deb/debian/rules | 25 ++ .../scripts/xpack/deb/debian/salsa-ci.yml.ex | 11 + xmake/scripts/xpack/deb/debian/source/format | 1 + xmake/scripts/xpack/deb/debian/watch.ex | 38 +++ .../scripts/xpack/deb/debian/xmake-docs.docs | 2 + .../scripts/xpack/deb/debian/xmake.cron.d.ex | 4 + .../xpack/deb/debian/xmake.doc-base.ex | 20 ++ 21 files changed, 965 insertions(+), 9 deletions(-) create mode 100644 xmake/scripts/xpack/deb/debian/README.Debian create mode 100644 xmake/scripts/xpack/deb/debian/README.source create mode 100644 xmake/scripts/xpack/deb/debian/changelog create mode 100644 xmake/scripts/xpack/deb/debian/control create mode 100644 xmake/scripts/xpack/deb/debian/copyright create mode 100644 xmake/scripts/xpack/deb/debian/manpage.1.ex create mode 100644 xmake/scripts/xpack/deb/debian/manpage.md.ex create mode 100644 xmake/scripts/xpack/deb/debian/manpage.sgml.ex create mode 100644 xmake/scripts/xpack/deb/debian/manpage.xml.ex create mode 100644 xmake/scripts/xpack/deb/debian/postinst.ex create mode 100644 xmake/scripts/xpack/deb/debian/postrm.ex create mode 100644 xmake/scripts/xpack/deb/debian/preinst.ex create mode 100644 xmake/scripts/xpack/deb/debian/prerm.ex create mode 100755 xmake/scripts/xpack/deb/debian/rules create mode 100644 xmake/scripts/xpack/deb/debian/salsa-ci.yml.ex create mode 100644 xmake/scripts/xpack/deb/debian/source/format create mode 100644 xmake/scripts/xpack/deb/debian/watch.ex create mode 100644 xmake/scripts/xpack/deb/debian/xmake-docs.docs create mode 100644 xmake/scripts/xpack/deb/debian/xmake.cron.d.ex create mode 100644 xmake/scripts/xpack/deb/debian/xmake.doc-base.ex diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index 8af36cdd900..ccf76ebf55c 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -321,15 +321,19 @@ end -- get the specfile path function xpack:specfile() - local extensions = { - wix = ".wxs", - nsis = ".nsi", - srpm = ".spec", - rpm = ".spec", - runself = ".lsm" - } - local extension = extensions[self:format()] or ".spec" - return self:get("specfile") or path.join(self:buildir(), self:basename() .. extension) + local specfile = self:get("specfile") + if not specfile then + local extensions = { + wix = ".wxs", + nsis = ".nsi", + srpm = ".spec", + rpm = ".spec", + runself = ".lsm" + } + local extension = extensions[self:format()] or ".spec" + specfile = path.join(self:buildir(), self:basename() .. extension) + end + return specfile end -- get the extension diff --git a/xmake/scripts/xpack/deb/debian/README.Debian b/xmake/scripts/xpack/deb/debian/README.Debian new file mode 100644 index 00000000000..63e5e1fff4c --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/README.Debian @@ -0,0 +1,6 @@ +xmake for Debian +--------------- + + + + -- unknown Thu, 13 Jun 2024 01:47:13 +0000 diff --git a/xmake/scripts/xpack/deb/debian/README.source b/xmake/scripts/xpack/deb/debian/README.source new file mode 100644 index 00000000000..73bb89bfef3 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/README.source @@ -0,0 +1,10 @@ +xmake for Debian +--------------- + + + + + + -- unknown Thu, 13 Jun 2024 01:47:13 +0000 + diff --git a/xmake/scripts/xpack/deb/debian/changelog b/xmake/scripts/xpack/deb/debian/changelog new file mode 100644 index 00000000000..e63b001fdd5 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/changelog @@ -0,0 +1,5 @@ +xmake (2.1-1) UNRELEASED; urgency=medium + + * Initial release (Closes: #nnnn) + + -- unknown Thu, 13 Jun 2024 01:47:13 +0000 diff --git a/xmake/scripts/xpack/deb/debian/control b/xmake/scripts/xpack/deb/debian/control new file mode 100644 index 00000000000..37845914b0c --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/control @@ -0,0 +1,16 @@ +Source: xmake +Section: unknown +Priority: optional +Maintainer: unknown +Build-Depends: debhelper-compat (= 13) +Standards-Version: 4.6.0 +Homepage: +#Vcs-Browser: https://salsa.debian.org/debian/xmake +#Vcs-Git: https://salsa.debian.org/debian/xmake.git +Rules-Requires-Root: no + +Package: xmake +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: + diff --git a/xmake/scripts/xpack/deb/debian/copyright b/xmake/scripts/xpack/deb/debian/copyright new file mode 100644 index 00000000000..67aff91791e --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/copyright @@ -0,0 +1,38 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: xmake +Upstream-Contact: +Source: + +Files: * +Copyright: + +License: Apache-2.0 + +Files: debian/* +Copyright: 2024 unknown +License: Apache-2.0 + +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 + . + https://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 version 2.0 license + can be found in "/usr/share/common-licenses/Apache-2.0". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid picking licenses with terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. +# +# If you need, there are some extra license texts available in two places: +# /usr/share/debhelper/dh_make/licenses/ +# /usr/share/common-licenses/ diff --git a/xmake/scripts/xpack/deb/debian/manpage.1.ex b/xmake/scripts/xpack/deb/debian/manpage.1.ex new file mode 100644 index 00000000000..e917987a254 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/manpage.1.ex @@ -0,0 +1,56 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" (C) Copyright 2024 unknown , +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH Xmake SECTION "June 13 2024" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +xmake \- program to do something +.SH SYNOPSIS +.B xmake +.RI [ options ] " files" ... +.br +.B bar +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B xmake +and +.B bar +commands. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBxmake\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. diff --git a/xmake/scripts/xpack/deb/debian/manpage.md.ex b/xmake/scripts/xpack/deb/debian/manpage.md.ex new file mode 100644 index 00000000000..daab8891fab --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/manpage.md.ex @@ -0,0 +1,126 @@ +% xmake(SECTION) | User Commands +% +% "June 13 2024" + +[comment]: # The lines above form a Pandoc metadata block. They must be +[comment]: # the first ones in the file. +[comment]: # See https://pandoc.org/MANUAL.html#metadata-blocks for details. + +[comment]: # pandoc -s -f markdown -t man package.md -o package.1 +[comment]: # +[comment]: # A manual page package.1 will be generated. You may view the +[comment]: # manual page with: nroff -man package.1 | less. A typical entry +[comment]: # in a Makefile or Makefile.am is: +[comment]: # +[comment]: # package.1: package.md +[comment]: # pandoc --standalone --from=markdown --to=man $< --output=$@ +[comment]: # +[comment]: # The pandoc binary is found in the pandoc package. Please remember +[comment]: # that if you create the nroff version in one of the debian/rules +[comment]: # file targets, such as build, you will need to include pandoc in +[comment]: # your Build-Depends control field. + +[comment]: # Remove the lines starting with `[comment]:' in this file in order +[comment]: # to avoid warning messages from pandoc. + +# NAME + +xmake - program to do something + +# SYNOPSIS + +**xmake** **-e** _this_ [**\-\-example=that**] [{**-e** | **\-\-example**} _this_] + [{**-e** | **\-\-example**} {_this_ | _that_}] + +**xmake** [{**-h** | *\-\-help**} | {**-v** | **\-\-version**}] + +# DESCRIPTION + +This manual page documents briefly the **xmake** and **bar** commands. + +This manual page was written for the Debian distribution because the +original program does not have a manual page. Instead, it has documentation +in the GNU info(1) format; see below. + +**xmake** is a program that... + +# OPTIONS + +The program follows the usual GNU command line syntax, with long options +starting with two dashes (`-'). A summary of options is included below. For +a complete description, see the **info**(1) files. + +**-e** _this_, **\-\-example=**_that_ +: Does this and that. + +**-h**, **\-\-help** +: Show summary of options. + +**-v**, **\-\-version** +: Show version of program. + +# FILES + +/etc/foo.conf +: The system-wide configuration file to control the behaviour of + xmake. See **foo.conf**(5) for further details. + +${HOME}/.foo.conf +: The per-user configuration file to control the behaviour of + xmake. See **foo.conf**(5) for further details. + +# ENVIRONMENT + +**FOO_CONF** +: If used, the defined file is used as configuration file (see also + the section called “FILES”). + +# DIAGNOSTICS + +The following diagnostics may be issued on stderr: + +Bad configuration file. Exiting. +: The configuration file seems to contain a broken configuration + line. Use the **\-\-verbose** option, to get more info. + +**xmake** provides some return codes, that can be used in scripts: + + Code Diagnostic + 0 Program exited successfully. + 1 The configuration file seems to be broken. + +# BUGS + +The program is currently limited to only work with the foobar library. + +The upstream BTS can be found at http://bugzilla.foo.tld. + +# SEE ALSO + +**bar**(1), **baz**(1), **foo.conf**(5) + +The programs are documented fully by The Rise and Fall of a Fooish Bar +available via the **info**(1) system. + +# AUTHOR + +unknown +: Wrote this manpage for the Debian system. + +# COPYRIGHT + +Copyright © 2007 unknown + +This manual page was written for the Debian system (and may be used by +others). + +Permission is granted to copy, distribute and/or modify this document under +the terms of the GNU General Public License, Version 2 or (at your option) +any later version published by the Free Software Foundation. + +On Debian systems, the complete text of the GNU General Public License +can be found in /usr/share/common-licenses/GPL. + +[comment]: # Local Variables: +[comment]: # mode: markdown +[comment]: # End: diff --git a/xmake/scripts/xpack/deb/debian/manpage.sgml.ex b/xmake/scripts/xpack/deb/debian/manpage.sgml.ex new file mode 100644 index 00000000000..6415ba5e4f5 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/manpage.sgml.ex @@ -0,0 +1,154 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + FIRSTNAME"> + SURNAME"> + + June 13 2024"> + + SECTION"> + waruqi@gmail.com"> + + Xmake"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2003 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + program to do something + + + + &dhpackage; + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; and bar + commands. + + This manual page was written for the &debian; distribution + because the original program does not have a manual page. + Instead, it has documentation in the &gnu; + Info format; see below. + + &dhpackage; is a program that... + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files. + + + + + + + + Show summary of options. + + + + + + + + Show version of program. + + + + + + SEE ALSO + + bar (1), baz (1). + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + Info system. + + + AUTHOR + + This manual page was written by &dhusername; &dhemail; for + the &debian; system (and may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; General Public License, Version 2 any + later version published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + +
+ + diff --git a/xmake/scripts/xpack/deb/debian/manpage.xml.ex b/xmake/scripts/xpack/deb/debian/manpage.xml.ex new file mode 100644 index 00000000000..8c5acfd8bb1 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/manpage.xml.ex @@ -0,0 +1,291 @@ + +.
will be generated. You may view the +manual page with: nroff -man .
| less'. A typical entry +in a Makefile or Makefile.am is: + +DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl +XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0" + +manpage.1: manpage.xml + $(XP) $(DB2MAN) $< + +The xsltproc binary is found in the xsltproc package. The XSL files are in +docbook-xsl. A description of the parameters you can use can be found in the +docbook-xsl-doc-* packages. Please remember that if you create the nroff +version in one of the debian/rules file targets (such as build), you will need +to include xsltproc and docbook-xsl in your Build-Depends control field. +Alternatively use the xmlto command/package. That will also automatically +pull in xsltproc and docbook-xsl. + +Notes for using docbook2x: docbook2x-man does not automatically create the +AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as + ... . + +To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections +read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be +found in the docbook-xsl-doc-html package. + +Validation can be done using: `xmllint -''-noout -''-valid manpage.xml` + +General documentation about man-pages and man-page-formatting: +man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + +--> + + + + + + + + + + + + + +]> + + + + &dhtitle; + &dhpackage; + + + &dhfirstname; + &dhsurname; + Wrote this manpage for the Debian system. +
+ &dhemail; +
+
+
+ + 2007 + &dhusername; + + + This manual page was written for the Debian system + (and may be used by others). + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License, + Version 2 or (at your option) any later version published by + the Free Software Foundation. + On Debian systems, the complete text of the GNU General Public + License can be found in + /usr/share/common-licenses/GPL. + +
+ + &dhucpackage; + &dhsection; + + + &dhpackage; + program to do something + + + + &dhpackage; + + + + + + + + + this + + + + + + + + this + that + + + + + &dhpackage; + + + + + + + + + + + + + + + + + + + DESCRIPTION + This manual page documents briefly the + &dhpackage; and bar + commands. + This manual page was written for the Debian distribution + because the original program does not have a manual page. + Instead, it has documentation in the GNU + info + 1 + format; see below. + &dhpackage; is a program that... + + + OPTIONS + The program follows the usual GNU command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + + info + 1 + files. + + + + + + + Does this and that. + + + + + + + Show summary of options. + + + + + + + Show version of program. + + + + + + FILES + + + /etc/foo.conf + + The system-wide configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + ${HOME}/.foo.conf + + The per-user configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + + + ENVIRONMENT + + + FOO_CONF + + If used, the defined file is used as configuration + file (see also ). + + + + + + DIAGNOSTICS + The following diagnostics may be issued + on stderr: + + + Bad configuration file. Exiting. + + The configuration file seems to contain a broken configuration + line. Use the option, to get more info. + + + + + &dhpackage; provides some return codes, that can + be used in scripts: + + Code + Diagnostic + + 0 + Program exited successfully. + + + 1 + The configuration file seems to be broken. + + + + + + BUGS + The program is currently limited to only work + with the foobar library. + The upstreams BTS can be found + at . + + + SEE ALSO + + + bar + 1 + , + baz + 1 + , + foo.conf + 5 + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + info + 1 + system. + +
+ diff --git a/xmake/scripts/xpack/deb/debian/postinst.ex b/xmake/scripts/xpack/deb/debian/postinst.ex new file mode 100644 index 00000000000..fc0e76bfdd2 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/postinst.ex @@ -0,0 +1,39 @@ +#!/bin/sh +# postinst script for xmake +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/xmake/scripts/xpack/deb/debian/postrm.ex b/xmake/scripts/xpack/deb/debian/postrm.ex new file mode 100644 index 00000000000..f8e19bae98a --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/postrm.ex @@ -0,0 +1,37 @@ +#!/bin/sh +# postrm script for xmake +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/xmake/scripts/xpack/deb/debian/preinst.ex b/xmake/scripts/xpack/deb/debian/preinst.ex new file mode 100644 index 00000000000..2809c5af4e3 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/preinst.ex @@ -0,0 +1,35 @@ +#!/bin/sh +# preinst script for xmake +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/xmake/scripts/xpack/deb/debian/prerm.ex b/xmake/scripts/xpack/deb/debian/prerm.ex new file mode 100644 index 00000000000..da70686aa3d --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/prerm.ex @@ -0,0 +1,38 @@ +#!/bin/sh +# prerm script for xmake +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/xmake/scripts/xpack/deb/debian/rules b/xmake/scripts/xpack/deb/debian/rules new file mode 100755 index 00000000000..59ea751e676 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/rules @@ -0,0 +1,25 @@ +#!/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 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/xmake/scripts/xpack/deb/debian/salsa-ci.yml.ex b/xmake/scripts/xpack/deb/debian/salsa-ci.yml.ex new file mode 100644 index 00000000000..a6fb8bdad17 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/salsa-ci.yml.ex @@ -0,0 +1,11 @@ +# For more information on what jobs are run see: +# https://salsa.debian.org/salsa-ci-team/pipeline +# +# To enable the jobs, go to your repository (at salsa.debian.org) +# and click over Settings > CI/CD > Expand (in General pipelines). +# In "CI/CD configuration file" write debian/salsa-ci.yml and click +# in "Save Changes". The CI tests will run after the next commit. +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff --git a/xmake/scripts/xpack/deb/debian/source/format b/xmake/scripts/xpack/deb/debian/source/format new file mode 100644 index 00000000000..163aaf8d82b --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/xmake/scripts/xpack/deb/debian/watch.ex b/xmake/scripts/xpack/deb/debian/watch.ex new file mode 100644 index 00000000000..399b9614145 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/watch.ex @@ -0,0 +1,38 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 4 file +version=4 + +# PGP signature mangle, so foo.tar.gz has foo.tar.gz.sig +#opts="pgpsigurlmangle=s%$%.sig%" + +# HTTP site (basic) +#http://example.com/downloads.html \ +# files/xmake-([\d\.]+)\.tar\.gz debian uupdate + +# Uncomment to examine an FTP server +#ftp://ftp.example.com/pub/xmake-(.*)\.tar\.gz debian uupdate + +# SourceForge hosted projects +# http://sf.net/xmake/ xmake-(.*)\.tar\.gz debian uupdate + +# GitHub hosted projects +#opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%-$1.tar.gz%" \ +# https://github.com//xmake/tags \ +# (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate + +# PyPI +# https://pypi.debian.net/xmake/xmake-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) + +# Direct Git +# opts="mode=git" http://git.example.com/xmake.git \ +# refs/tags/v([\d\.]+) debian uupdate + + + + +# Uncomment to find new files on GooglePages +# http://example.googlepages.com/foo.html xmake-(.*)\.tar\.gz diff --git a/xmake/scripts/xpack/deb/debian/xmake-docs.docs b/xmake/scripts/xpack/deb/debian/xmake-docs.docs new file mode 100644 index 00000000000..7319041140c --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/xmake-docs.docs @@ -0,0 +1,2 @@ +README.source +README.Debian diff --git a/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex b/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex new file mode 100644 index 00000000000..dde8dd44311 --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the xmake package +# +0 4 * * * root [ -x /usr/bin/xmake_maintenance ] && /usr/bin/xmake_maintenance diff --git a/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex b/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex new file mode 100644 index 00000000000..43f406e63cf --- /dev/null +++ b/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex @@ -0,0 +1,20 @@ +Document: xmake +Title: Debian xmake Manual +Author: +Abstract: This manual describes what xmake is + and how it can be used to + manage online manuals on Debian systems. +Section: unknown + +Format: debiandoc-sgml +Files: /usr/share/doc/xmake/xmake.sgml.gz + +Format: postscript +Files: /usr/share/doc/xmake/xmake.ps.gz + +Format: text +Files: /usr/share/doc/xmake/xmake.text.gz + +Format: HTML +Index: /usr/share/doc/xmake/html/index.html +Files: /usr/share/doc/xmake/html/*.html From eaa2d3484fe75d1c7ca228fa94091936dddaffd6 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 13 Jun 2024 22:43:51 +0800 Subject: [PATCH 03/23] improve specfile for pack --- xmake/plugins/pack/nsis/main.lua | 4 ++-- xmake/plugins/pack/runself/main.lua | 4 ++-- xmake/plugins/pack/srpm/main.lua | 4 ++-- xmake/plugins/pack/wix/main.lua | 4 ++-- xmake/plugins/pack/xpack.lua | 17 ----------------- 5 files changed, 8 insertions(+), 25 deletions(-) diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua index b8f6d4dc494..c24c718feff 100644 --- a/xmake/plugins/pack/nsis/main.lua +++ b/xmake/plugins/pack/nsis/main.lua @@ -250,9 +250,9 @@ end function _pack_nsis(makensis, package) -- install the initial specfile - local specfile = package:specfile() + local specfile = path.join(package:buildir(), package:basename() .. ".nsi") if not os.isfile(specfile) then - local specfile_template = path.join(os.programdir(), "scripts", "xpack", "nsis", "makensis.nsi") + local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "nsis", "makensis.nsi") os.cp(specfile_template, specfile) end diff --git a/xmake/plugins/pack/runself/main.lua b/xmake/plugins/pack/runself/main.lua index 8f25c3e80b7..eb5c01fb1eb 100644 --- a/xmake/plugins/pack/runself/main.lua +++ b/xmake/plugins/pack/runself/main.lua @@ -108,9 +108,9 @@ end function _pack_runself(makeself, package) -- install the initial specfile - local specfile = package:specfile() + local specfile = path.join(package:buildir(), package:basename() .. ".lsm") if not os.isfile(specfile) then - local specfile_template = path.join(os.programdir(), "scripts", "xpack", "runself", "makeself.lsm") + local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "runself", "makeself.lsm") os.cp(specfile_template, specfile) end diff --git a/xmake/plugins/pack/srpm/main.lua b/xmake/plugins/pack/srpm/main.lua index b6b5467c8dd..e8630ba58c0 100644 --- a/xmake/plugins/pack/srpm/main.lua +++ b/xmake/plugins/pack/srpm/main.lua @@ -202,9 +202,9 @@ function _pack_srpm(rpmbuild, package) end -- install the initial specfile - local specfile = package:specfile() + local specfile = path.join(package:buildir(), package:basename() .. ".spec") if not os.isfile(specfile) then - local specfile_template = path.join(os.programdir(), "scripts", "xpack", "srpm", "srpm.spec") + local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "srpm", "srpm.spec") os.cp(specfile_template, specfile) end diff --git a/xmake/plugins/pack/wix/main.lua b/xmake/plugins/pack/wix/main.lua index 95b6a4a7f62..a99ecdb6e1d 100644 --- a/xmake/plugins/pack/wix/main.lua +++ b/xmake/plugins/pack/wix/main.lua @@ -258,9 +258,9 @@ end function _pack_wix(wix, package) -- install the initial specfile - local specfile = package:specfile() + local specfile = path.join(package:buildir(), package:basename() .. ".wxs") if not os.isfile(specfile) then - local specfile_template = path.join(os.programdir(), "scripts", "xpack", "wix", "msi.wxs") + local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "wix", "msi.wxs") os.cp(specfile_template, specfile) end diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index ccf76ebf55c..6d82536d4b3 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -319,23 +319,6 @@ function xpack:specvars() return specvars end --- get the specfile path -function xpack:specfile() - local specfile = self:get("specfile") - if not specfile then - local extensions = { - wix = ".wxs", - nsis = ".nsi", - srpm = ".spec", - rpm = ".spec", - runself = ".lsm" - } - local extension = extensions[self:format()] or ".spec" - specfile = path.join(self:buildir(), self:basename() .. extension) - end - return specfile -end - -- get the extension function xpack:extension() local extension = self:get("extension") From 32aff4807758e70de86bd0c41486a7493dcebb10 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 13 Jun 2024 22:44:51 +0800 Subject: [PATCH 04/23] init deb spec --- xmake/plugins/pack/deb/main.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index b2629ef0417..d64204ae6ae 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -36,6 +36,14 @@ end -- pack deb package function _pack_deb(debuild, package) + + -- install the initial specfile + local specfile = path.join(package:buildir(), "debian") + if not os.isdir(specfile) then + local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "deb", "debian") + os.cp(specfile_template, specfile) + end + end function main(package) From 392fd0ef66219987f39548716176472fff3e78ad Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 13 Jun 2024 22:46:47 +0800 Subject: [PATCH 05/23] archive deb --- xmake/plugins/pack/deb/main.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index d64204ae6ae..2b69a553b9d 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -34,6 +34,11 @@ function _get_debuild() return debuild end +-- get archive file +function _get_archivefile(package) + return path.absolute(path.join(package:buildir(), package:basename() .. ".tar.gz")) +end + -- pack deb package function _pack_deb(debuild, package) @@ -44,6 +49,29 @@ function _pack_deb(debuild, package) os.cp(specfile_template, specfile) end + -- archive source files + local srcfiles, dstfiles = package:sourcefiles() + for idx, srcfile in ipairs(srcfiles) do + os.vcp(srcfile, dstfiles[idx]) + end + for _, component in table.orderpairs(package:components()) do + if component:get("default") ~= false then + local srcfiles, dstfiles = component:sourcefiles() + for idx, srcfile in ipairs(srcfiles) do + os.vcp(srcfile, dstfiles[idx]) + end + end + end + + -- archive install files + local rootdir = package:source_rootdir() + local oldir = os.cd(rootdir) + local archivefiles = os.files("**") + os.cd(oldir) + local archivefile = _get_archivefile(package) + os.tryrm(archivefile) + archive.archive(archivefile, archivefiles, {curdir = rootdir, compress = "best"}) + end function main(package) From 5aeea631bbea850ee6c90b8fa43a76976872de14 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 13 Jun 2024 23:57:05 +0800 Subject: [PATCH 06/23] build deb package --- xmake/plugins/pack/deb/main.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 2b69a553b9d..4dcb049b3aa 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -72,6 +72,8 @@ function _pack_deb(debuild, package) os.tryrm(archivefile) archive.archive(archivefile, archivefiles, {curdir = rootdir, compress = "best"}) + -- build package, TODO modify key + os.vrunv(debuild, {"-S", "-k02713554FA2CE4AADA20AB23167A22F22C0C68C9"}, {curdir = package:buildir()}) end function main(package) From 3b8e94caf543e97492c08120c041b351e8ee9de5 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 00:44:24 +0800 Subject: [PATCH 07/23] fix debian dir --- xmake/plugins/pack/deb/main.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 4dcb049b3aa..7bd0c68ce82 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -36,14 +36,16 @@ end -- get archive file function _get_archivefile(package) - return path.absolute(path.join(package:buildir(), package:basename() .. ".tar.gz")) + return path.absolute(path.join(package:buildir(), package:basename() .. ".orig.tar.gz")) end -- pack deb package function _pack_deb(debuild, package) + local buildir = package:buildir() + local workdir = path.join(buildir, "working") -- install the initial specfile - local specfile = path.join(package:buildir(), "debian") + local specfile = path.join(workdir, "debian") if not os.isdir(specfile) then local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "deb", "debian") os.cp(specfile_template, specfile) @@ -73,7 +75,7 @@ function _pack_deb(debuild, package) archive.archive(archivefile, archivefiles, {curdir = rootdir, compress = "best"}) -- build package, TODO modify key - os.vrunv(debuild, {"-S", "-k02713554FA2CE4AADA20AB23167A22F22C0C68C9"}, {curdir = package:buildir()}) + os.vrunv(debuild, {"-S", "-k02713554FA2CE4AADA20AB23167A22F22C0C68C9"}, {curdir = workdir}) end function main(package) From ff6a2cbe45b52d618e8f2a71f4579d43a980accb Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 00:48:53 +0800 Subject: [PATCH 08/23] replace some specfiles for deb --- xmake/plugins/pack/deb/main.lua | 38 ++++++++++++++++++++---- xmake/scripts/xpack/deb/debian/changelog | 2 +- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 7bd0c68ce82..8a470af33ab 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -36,7 +36,13 @@ end -- get archive file function _get_archivefile(package) - return path.absolute(path.join(package:buildir(), package:basename() .. ".orig.tar.gz")) + return path.absolute(path.join(package:buildir(), package:name() .. "_" .. package:version() .. ".orig.tar.gz")) +end + +-- get specvars +function _get_specvars(package) + local specvars = table.clone(package:specvars()) + return specvars end -- pack deb package @@ -44,11 +50,31 @@ function _pack_deb(debuild, package) local buildir = package:buildir() local workdir = path.join(buildir, "working") - -- install the initial specfile - local specfile = path.join(workdir, "debian") - if not os.isdir(specfile) then - local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "deb", "debian") - os.cp(specfile_template, specfile) + -- install the initial debian directory + local debiandir = path.join(workdir, "debian") + if not os.isdir(debiandir) then + local debiandir_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "deb", "debian") + os.cp(debiandir_template, debiandir) + end + + -- replace variables in specfile + local specvars = _get_specvars(package) + local pattern = package:extraconf("specfile", "pattern") or "%${([^\n]-)}" + for _, specfile in ipairs(os.files(path.join(debiandir, "**"))) do + io.gsub(specfile, "(" .. pattern .. ")", function(_, name) + name = name:trim() + local value = specvars[name] + if type(value) == "function" then + value = value() + end + if value ~= nil then + dprint("[%s]: > replace %s -> %s", path.filename(specfile), name, value) + end + if type(value) == "table" then + dprint("invalid variable value", value) + end + return value + end) end -- archive source files diff --git a/xmake/scripts/xpack/deb/debian/changelog b/xmake/scripts/xpack/deb/debian/changelog index e63b001fdd5..e34fb09b7de 100644 --- a/xmake/scripts/xpack/deb/debian/changelog +++ b/xmake/scripts/xpack/deb/debian/changelog @@ -1,4 +1,4 @@ -xmake (2.1-1) UNRELEASED; urgency=medium +${PACKAGE_NAME} (${PACKAGE_VERSION}-1) UNRELEASED; urgency=medium * Initial release (Closes: #nnnn) From 44daa72100eff20fca36cefe898c86306e5651de Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 22:39:06 +0800 Subject: [PATCH 09/23] improve debian copyright --- core/xpack.lua | 4 +- tests/plugins/pack/xmake.lua | 2 +- xmake/plugins/pack/deb/main.lua | 7 ++++ xmake/scripts/xpack/deb/debian/README.Debian | 2 +- xmake/scripts/xpack/deb/debian/README.source | 2 +- xmake/scripts/xpack/deb/debian/changelog | 2 +- xmake/scripts/xpack/deb/debian/control | 12 +++--- xmake/scripts/xpack/deb/debian/copyright | 38 +++---------------- xmake/scripts/xpack/deb/debian/manpage.1.ex | 10 ++--- xmake/scripts/xpack/deb/debian/manpage.md.ex | 18 ++++----- .../scripts/xpack/deb/debian/manpage.sgml.ex | 4 +- xmake/scripts/xpack/deb/debian/manpage.xml.ex | 6 +-- xmake/scripts/xpack/deb/debian/postinst.ex | 2 +- xmake/scripts/xpack/deb/debian/postrm.ex | 2 +- xmake/scripts/xpack/deb/debian/preinst.ex | 2 +- xmake/scripts/xpack/deb/debian/prerm.ex | 2 +- xmake/scripts/xpack/deb/debian/watch.ex | 14 +++---- .../scripts/xpack/deb/debian/xmake.cron.d.ex | 4 +- .../xpack/deb/debian/xmake.doc-base.ex | 18 ++++----- 19 files changed, 65 insertions(+), 86 deletions(-) diff --git a/core/xpack.lua b/core/xpack.lua index 1a204e6b63f..ebe89b4550d 100644 --- a/core/xpack.lua +++ b/core/xpack.lua @@ -3,7 +3,7 @@ xpack("xmake") set_title("Xmake build utility ($(arch))") set_description("A cross-platform build utility based on Lua.") set_copyright("Copyright (C) 2015-present, TBOOX Open Source Group") - set_author("waruqi@gmail.com") + set_author("ruki ") set_licensefile("../LICENSE.md") set_formats("nsis", "wix", "zip") add_targets("demo") @@ -81,7 +81,7 @@ xpack("xmakesrc") set_title("Xmake build utility ($(arch))") set_description("A cross-platform build utility based on Lua.") set_copyright("Copyright (C) 2015-present, TBOOX Open Source Group") - set_author("waruqi@gmail.com") + set_author("ruki ") set_formats("srczip", "srctargz", "runself", "srpm") set_basename("xmake-v$(version)") set_prefixdir("xmake-$(version)") diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua index e5a83d8f1cd..638b6208d25 100644 --- a/tests/plugins/pack/xmake.lua +++ b/tests/plugins/pack/xmake.lua @@ -21,7 +21,7 @@ target("foo") xpack("test") set_formats("nsis", "srpm", "rpm", "deb", "zip", "targz", "srczip", "srctargz", "runself", "wix") set_title("hello") - set_author("ruki") + set_author("ruki ") set_description("A test installer.") set_homepage("https://xmake.io") set_license("Apache-2.0") diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 8a470af33ab..91aa55add1c 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -42,6 +42,13 @@ end -- get specvars function _get_specvars(package) local specvars = table.clone(package:specvars()) + local datestr = os.iorunv("date", {"-u", "+%a, %d %b %Y %H:%M:%S +0000"}, {envs = {LC_TIME = "en_US"}}) + if datestr then + datestr = datestr:trim() + end + specvars.PACKAGE_DATE = datestr or "" + local author = package:get("author") or "unknown " + specvars.PACKAGE_COPYRIGHT = os.date("%Y") .. " " .. author return specvars end diff --git a/xmake/scripts/xpack/deb/debian/README.Debian b/xmake/scripts/xpack/deb/debian/README.Debian index 63e5e1fff4c..a2a9606141b 100644 --- a/xmake/scripts/xpack/deb/debian/README.Debian +++ b/xmake/scripts/xpack/deb/debian/README.Debian @@ -1,4 +1,4 @@ -xmake for Debian +${PACKAGE_NAME} for Debian --------------- diff --git a/xmake/scripts/xpack/deb/debian/README.source b/xmake/scripts/xpack/deb/debian/README.source index 73bb89bfef3..69506a7dd33 100644 --- a/xmake/scripts/xpack/deb/debian/README.source +++ b/xmake/scripts/xpack/deb/debian/README.source @@ -1,4 +1,4 @@ -xmake for Debian +${PACKAGE_NAME} for Debian --------------- - -- unknown Thu, 13 Jun 2024 01:47:13 +0000 + -- ${PACKAGE_MAINTAINER} ${PACKAGE_DATE} diff --git a/xmake/scripts/xpack/deb/debian/control b/xmake/scripts/xpack/deb/debian/control index 37845914b0c..1443bb33ed8 100644 --- a/xmake/scripts/xpack/deb/debian/control +++ b/xmake/scripts/xpack/deb/debian/control @@ -1,16 +1,16 @@ -Source: xmake +Source: ${PACKAGE_NAME} Section: unknown Priority: optional -Maintainer: unknown +Maintainer: ${PACKAGE_MAINTAINER} Build-Depends: debhelper-compat (= 13) Standards-Version: 4.6.0 -Homepage: +Homepage: ${PACKAGE_HOMEPAGE} #Vcs-Browser: https://salsa.debian.org/debian/xmake #Vcs-Git: https://salsa.debian.org/debian/xmake.git Rules-Requires-Root: no -Package: xmake +Package: ${PACKAGE_NAME} Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Description: - +Description: ${PACKAGE_TITLE} + ${PACKAGE_DESCRIPTION} diff --git a/xmake/scripts/xpack/deb/debian/copyright b/xmake/scripts/xpack/deb/debian/copyright index 67aff91791e..0056dbd39ed 100644 --- a/xmake/scripts/xpack/deb/debian/copyright +++ b/xmake/scripts/xpack/deb/debian/copyright @@ -1,38 +1,10 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: xmake -Upstream-Contact: -Source: +Upstream-Name: ${PACKAGE_NAME} +Upstream-Contact: ${PACKAGE_AUTHOR} +Source: ${PACKAGE_HOMEPAGE} Files: * -Copyright: - -License: Apache-2.0 - -Files: debian/* -Copyright: 2024 unknown -License: Apache-2.0 - -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 - . - https://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. +Copyright: ${PACKAGE_COPYRIGHT} +License: ${PACKAGE_LICENSE} . - On Debian systems, the complete text of the Apache version 2.0 license - can be found in "/usr/share/common-licenses/Apache-2.0". -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. -# Please avoid picking licenses with terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# -# If you need, there are some extra license texts available in two places: -# /usr/share/debhelper/dh_make/licenses/ -# /usr/share/common-licenses/ diff --git a/xmake/scripts/xpack/deb/debian/manpage.1.ex b/xmake/scripts/xpack/deb/debian/manpage.1.ex index e917987a254..e67d3f418ca 100644 --- a/xmake/scripts/xpack/deb/debian/manpage.1.ex +++ b/xmake/scripts/xpack/deb/debian/manpage.1.ex @@ -4,7 +4,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH Xmake SECTION "June 13 2024" +.TH ${PACKAGE_NAME} SECTION "June 13 2024" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -18,16 +18,16 @@ .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME -xmake \- program to do something +${PACKAGE_NAME} \- program to do something .SH SYNOPSIS -.B xmake +.B ${PACKAGE_NAME} .RI [ options ] " files" ... .br .B bar .RI [ options ] " files" ... .SH DESCRIPTION This manual page documents briefly the -.B xmake +.B ${PACKAGE_NAME} and .B bar commands. @@ -35,7 +35,7 @@ commands. .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. -\fBxmake\fP is a program that... +\fB${PACKAGE_NAME}\fP is a program that... .SH OPTIONS These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). diff --git a/xmake/scripts/xpack/deb/debian/manpage.md.ex b/xmake/scripts/xpack/deb/debian/manpage.md.ex index daab8891fab..532df2807fe 100644 --- a/xmake/scripts/xpack/deb/debian/manpage.md.ex +++ b/xmake/scripts/xpack/deb/debian/manpage.md.ex @@ -1,4 +1,4 @@ -% xmake(SECTION) | User Commands +% ${PACKAGE_NAME}(SECTION) | User Commands % % "June 13 2024" @@ -25,24 +25,24 @@ # NAME -xmake - program to do something +${PACKAGE_NAME} - program to do something # SYNOPSIS -**xmake** **-e** _this_ [**\-\-example=that**] [{**-e** | **\-\-example**} _this_] +**${PACKAGE_NAME}** **-e** _this_ [**\-\-example=that**] [{**-e** | **\-\-example**} _this_] [{**-e** | **\-\-example**} {_this_ | _that_}] -**xmake** [{**-h** | *\-\-help**} | {**-v** | **\-\-version**}] +**${PACKAGE_NAME}** [{**-h** | *\-\-help**} | {**-v** | **\-\-version**}] # DESCRIPTION -This manual page documents briefly the **xmake** and **bar** commands. +This manual page documents briefly the **${PACKAGE_NAME}** and **bar** commands. This manual page was written for the Debian distribution because the original program does not have a manual page. Instead, it has documentation in the GNU info(1) format; see below. -**xmake** is a program that... +**${PACKAGE_NAME}** is a program that... # OPTIONS @@ -63,11 +63,11 @@ a complete description, see the **info**(1) files. /etc/foo.conf : The system-wide configuration file to control the behaviour of - xmake. See **foo.conf**(5) for further details. + ${PACKAGE_NAME}. See **foo.conf**(5) for further details. ${HOME}/.foo.conf : The per-user configuration file to control the behaviour of - xmake. See **foo.conf**(5) for further details. + ${PACKAGE_NAME}. See **foo.conf**(5) for further details. # ENVIRONMENT @@ -83,7 +83,7 @@ Bad configuration file. Exiting. : The configuration file seems to contain a broken configuration line. Use the **\-\-verbose** option, to get more info. -**xmake** provides some return codes, that can be used in scripts: +**${PACKAGE_NAME}** provides some return codes, that can be used in scripts: Code Diagnostic 0 Program exited successfully. diff --git a/xmake/scripts/xpack/deb/debian/manpage.sgml.ex b/xmake/scripts/xpack/deb/debian/manpage.sgml.ex index 6415ba5e4f5..6433238782b 100644 --- a/xmake/scripts/xpack/deb/debian/manpage.sgml.ex +++ b/xmake/scripts/xpack/deb/debian/manpage.sgml.ex @@ -26,8 +26,8 @@ manpage.1: manpage.sgml SECTION"> waruqi@gmail.com"> - Xmake"> - + ${PACKAGE_NAME}"> + Debian"> GNU"> diff --git a/xmake/scripts/xpack/deb/debian/manpage.xml.ex b/xmake/scripts/xpack/deb/debian/manpage.xml.ex index 8c5acfd8bb1..a1ea2e9516e 100644 --- a/xmake/scripts/xpack/deb/debian/manpage.xml.ex +++ b/xmake/scripts/xpack/deb/debian/manpage.xml.ex @@ -56,9 +56,9 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ - - - + + + ]> diff --git a/xmake/scripts/xpack/deb/debian/postinst.ex b/xmake/scripts/xpack/deb/debian/postinst.ex index fc0e76bfdd2..76881577718 100644 --- a/xmake/scripts/xpack/deb/debian/postinst.ex +++ b/xmake/scripts/xpack/deb/debian/postinst.ex @@ -1,5 +1,5 @@ #!/bin/sh -# postinst script for xmake +# postinst script for ${PACKAGE_NAME} # # see: dh_installdeb(1) diff --git a/xmake/scripts/xpack/deb/debian/postrm.ex b/xmake/scripts/xpack/deb/debian/postrm.ex index f8e19bae98a..9f6a219b7e6 100644 --- a/xmake/scripts/xpack/deb/debian/postrm.ex +++ b/xmake/scripts/xpack/deb/debian/postrm.ex @@ -1,5 +1,5 @@ #!/bin/sh -# postrm script for xmake +# postrm script for ${PACKAGE_NAME} # # see: dh_installdeb(1) diff --git a/xmake/scripts/xpack/deb/debian/preinst.ex b/xmake/scripts/xpack/deb/debian/preinst.ex index 2809c5af4e3..bc61d7f9d65 100644 --- a/xmake/scripts/xpack/deb/debian/preinst.ex +++ b/xmake/scripts/xpack/deb/debian/preinst.ex @@ -1,5 +1,5 @@ #!/bin/sh -# preinst script for xmake +# preinst script for ${PACKAGE_NAME} # # see: dh_installdeb(1) diff --git a/xmake/scripts/xpack/deb/debian/prerm.ex b/xmake/scripts/xpack/deb/debian/prerm.ex index da70686aa3d..4b920862b23 100644 --- a/xmake/scripts/xpack/deb/debian/prerm.ex +++ b/xmake/scripts/xpack/deb/debian/prerm.ex @@ -1,5 +1,5 @@ #!/bin/sh -# prerm script for xmake +# prerm script for ${PACKAGE_NAME} # # see: dh_installdeb(1) diff --git a/xmake/scripts/xpack/deb/debian/watch.ex b/xmake/scripts/xpack/deb/debian/watch.ex index 399b9614145..71247936b82 100644 --- a/xmake/scripts/xpack/deb/debian/watch.ex +++ b/xmake/scripts/xpack/deb/debian/watch.ex @@ -11,28 +11,28 @@ version=4 # HTTP site (basic) #http://example.com/downloads.html \ -# files/xmake-([\d\.]+)\.tar\.gz debian uupdate +# files/${PACKAGE_NAME}-([\d\.]+)\.tar\.gz debian uupdate # Uncomment to examine an FTP server -#ftp://ftp.example.com/pub/xmake-(.*)\.tar\.gz debian uupdate +#ftp://ftp.example.com/pub/${PACKAGE_NAME}-(.*)\.tar\.gz debian uupdate # SourceForge hosted projects -# http://sf.net/xmake/ xmake-(.*)\.tar\.gz debian uupdate +# http://sf.net/${PACKAGE_NAME}/ ${PACKAGE_NAME}-(.*)\.tar\.gz debian uupdate # GitHub hosted projects #opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%-$1.tar.gz%" \ -# https://github.com//xmake/tags \ +# https://github.com//${PACKAGE_NAME}/tags \ # (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate # PyPI -# https://pypi.debian.net/xmake/xmake-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) +# https://pypi.debian.net/${PACKAGE_NAME}/${PACKAGE_NAME}-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) # Direct Git -# opts="mode=git" http://git.example.com/xmake.git \ +# opts="mode=git" http://git.example.com/${PACKAGE_NAME}.git \ # refs/tags/v([\d\.]+) debian uupdate # Uncomment to find new files on GooglePages -# http://example.googlepages.com/foo.html xmake-(.*)\.tar\.gz +# http://example.googlepages.com/foo.html ${PACKAGE_NAME}-(.*)\.tar\.gz diff --git a/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex b/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex index dde8dd44311..9861593f34f 100644 --- a/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex +++ b/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex @@ -1,4 +1,4 @@ # -# Regular cron jobs for the xmake package +# Regular cron jobs for the ${PACKAGE_NAME} package # -0 4 * * * root [ -x /usr/bin/xmake_maintenance ] && /usr/bin/xmake_maintenance +0 4 * * * root [ -x /usr/bin/${PACKAGE_NAME}_maintenance ] && /usr/bin/${PACKAGE_NAME}_maintenance diff --git a/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex b/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex index 43f406e63cf..1dda4d3da6f 100644 --- a/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex +++ b/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex @@ -1,20 +1,20 @@ -Document: xmake -Title: Debian xmake Manual -Author: -Abstract: This manual describes what xmake is +Document: ${PACKAGE_NAME} +Title: Debian ${PACKAGE_NAME} Manual +Author: ${PACKAGE_AUTHOR} +Abstract: This manual describes what ${PACKAGE_NAME} is and how it can be used to manage online manuals on Debian systems. Section: unknown Format: debiandoc-sgml -Files: /usr/share/doc/xmake/xmake.sgml.gz +Files: /usr/share/doc/${PACKAGE_NAME}/${PACKAGE_NAME}.sgml.gz Format: postscript -Files: /usr/share/doc/xmake/xmake.ps.gz +Files: /usr/share/doc/${PACKAGE_NAME}/${PACKAGE_NAME}.ps.gz Format: text -Files: /usr/share/doc/xmake/xmake.text.gz +Files: /usr/share/doc/${PACKAGE_NAME}/${PACKAGE_NAME}.text.gz Format: HTML -Index: /usr/share/doc/xmake/html/index.html -Files: /usr/share/doc/xmake/html/*.html +Index: /usr/share/doc/${PACKAGE_NAME}/html/index.html +Files: /usr/share/doc/${PACKAGE_NAME}/html/*.html From cb30008bdc595a2a67b33ce01e8d0e5cb3ab1d29 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 22:39:42 +0800 Subject: [PATCH 10/23] remove unused debian files --- xmake/scripts/xpack/deb/debian/manpage.1.ex | 56 ---- xmake/scripts/xpack/deb/debian/manpage.md.ex | 126 -------- .../scripts/xpack/deb/debian/manpage.sgml.ex | 154 --------- xmake/scripts/xpack/deb/debian/manpage.xml.ex | 291 ------------------ .../scripts/xpack/deb/debian/salsa-ci.yml.ex | 11 - .../scripts/xpack/deb/debian/xmake-docs.docs | 2 - .../scripts/xpack/deb/debian/xmake.cron.d.ex | 4 - .../xpack/deb/debian/xmake.doc-base.ex | 20 -- 8 files changed, 664 deletions(-) delete mode 100644 xmake/scripts/xpack/deb/debian/manpage.1.ex delete mode 100644 xmake/scripts/xpack/deb/debian/manpage.md.ex delete mode 100644 xmake/scripts/xpack/deb/debian/manpage.sgml.ex delete mode 100644 xmake/scripts/xpack/deb/debian/manpage.xml.ex delete mode 100644 xmake/scripts/xpack/deb/debian/salsa-ci.yml.ex delete mode 100644 xmake/scripts/xpack/deb/debian/xmake-docs.docs delete mode 100644 xmake/scripts/xpack/deb/debian/xmake.cron.d.ex delete mode 100644 xmake/scripts/xpack/deb/debian/xmake.doc-base.ex diff --git a/xmake/scripts/xpack/deb/debian/manpage.1.ex b/xmake/scripts/xpack/deb/debian/manpage.1.ex deleted file mode 100644 index e67d3f418ca..00000000000 --- a/xmake/scripts/xpack/deb/debian/manpage.1.ex +++ /dev/null @@ -1,56 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" (C) Copyright 2024 unknown , -.\" -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH ${PACKAGE_NAME} SECTION "June 13 2024" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -${PACKAGE_NAME} \- program to do something -.SH SYNOPSIS -.B ${PACKAGE_NAME} -.RI [ options ] " files" ... -.br -.B bar -.RI [ options ] " files" ... -.SH DESCRIPTION -This manual page documents briefly the -.B ${PACKAGE_NAME} -and -.B bar -commands. -.PP -.\" TeX users may be more comfortable with the \fB\fP and -.\" \fI\fP escape sequences to invode bold face and italics, -.\" respectively. -\fB${PACKAGE_NAME}\fP is a program that... -.SH OPTIONS -These programs follow the usual GNU command line syntax, with long -options starting with two dashes (`-'). -A summary of options is included below. -For a complete description, see the Info files. -.TP -.B \-h, \-\-help -Show summary of options. -.TP -.B \-v, \-\-version -Show version of program. -.SH SEE ALSO -.BR bar (1), -.BR baz (1). -.br -The programs are documented fully by -.IR "The Rise and Fall of a Fooish Bar" , -available via the Info system. diff --git a/xmake/scripts/xpack/deb/debian/manpage.md.ex b/xmake/scripts/xpack/deb/debian/manpage.md.ex deleted file mode 100644 index 532df2807fe..00000000000 --- a/xmake/scripts/xpack/deb/debian/manpage.md.ex +++ /dev/null @@ -1,126 +0,0 @@ -% ${PACKAGE_NAME}(SECTION) | User Commands -% -% "June 13 2024" - -[comment]: # The lines above form a Pandoc metadata block. They must be -[comment]: # the first ones in the file. -[comment]: # See https://pandoc.org/MANUAL.html#metadata-blocks for details. - -[comment]: # pandoc -s -f markdown -t man package.md -o package.1 -[comment]: # -[comment]: # A manual page package.1 will be generated. You may view the -[comment]: # manual page with: nroff -man package.1 | less. A typical entry -[comment]: # in a Makefile or Makefile.am is: -[comment]: # -[comment]: # package.1: package.md -[comment]: # pandoc --standalone --from=markdown --to=man $< --output=$@ -[comment]: # -[comment]: # The pandoc binary is found in the pandoc package. Please remember -[comment]: # that if you create the nroff version in one of the debian/rules -[comment]: # file targets, such as build, you will need to include pandoc in -[comment]: # your Build-Depends control field. - -[comment]: # Remove the lines starting with `[comment]:' in this file in order -[comment]: # to avoid warning messages from pandoc. - -# NAME - -${PACKAGE_NAME} - program to do something - -# SYNOPSIS - -**${PACKAGE_NAME}** **-e** _this_ [**\-\-example=that**] [{**-e** | **\-\-example**} _this_] - [{**-e** | **\-\-example**} {_this_ | _that_}] - -**${PACKAGE_NAME}** [{**-h** | *\-\-help**} | {**-v** | **\-\-version**}] - -# DESCRIPTION - -This manual page documents briefly the **${PACKAGE_NAME}** and **bar** commands. - -This manual page was written for the Debian distribution because the -original program does not have a manual page. Instead, it has documentation -in the GNU info(1) format; see below. - -**${PACKAGE_NAME}** is a program that... - -# OPTIONS - -The program follows the usual GNU command line syntax, with long options -starting with two dashes (`-'). A summary of options is included below. For -a complete description, see the **info**(1) files. - -**-e** _this_, **\-\-example=**_that_ -: Does this and that. - -**-h**, **\-\-help** -: Show summary of options. - -**-v**, **\-\-version** -: Show version of program. - -# FILES - -/etc/foo.conf -: The system-wide configuration file to control the behaviour of - ${PACKAGE_NAME}. See **foo.conf**(5) for further details. - -${HOME}/.foo.conf -: The per-user configuration file to control the behaviour of - ${PACKAGE_NAME}. See **foo.conf**(5) for further details. - -# ENVIRONMENT - -**FOO_CONF** -: If used, the defined file is used as configuration file (see also - the section called “FILES”). - -# DIAGNOSTICS - -The following diagnostics may be issued on stderr: - -Bad configuration file. Exiting. -: The configuration file seems to contain a broken configuration - line. Use the **\-\-verbose** option, to get more info. - -**${PACKAGE_NAME}** provides some return codes, that can be used in scripts: - - Code Diagnostic - 0 Program exited successfully. - 1 The configuration file seems to be broken. - -# BUGS - -The program is currently limited to only work with the foobar library. - -The upstream BTS can be found at http://bugzilla.foo.tld. - -# SEE ALSO - -**bar**(1), **baz**(1), **foo.conf**(5) - -The programs are documented fully by The Rise and Fall of a Fooish Bar -available via the **info**(1) system. - -# AUTHOR - -unknown -: Wrote this manpage for the Debian system. - -# COPYRIGHT - -Copyright © 2007 unknown - -This manual page was written for the Debian system (and may be used by -others). - -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 or (at your option) -any later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public License -can be found in /usr/share/common-licenses/GPL. - -[comment]: # Local Variables: -[comment]: # mode: markdown -[comment]: # End: diff --git a/xmake/scripts/xpack/deb/debian/manpage.sgml.ex b/xmake/scripts/xpack/deb/debian/manpage.sgml.ex deleted file mode 100644 index 6433238782b..00000000000 --- a/xmake/scripts/xpack/deb/debian/manpage.sgml.ex +++ /dev/null @@ -1,154 +0,0 @@ - manpage.1'. You may view - the manual page with: `docbook-to-man manpage.sgml | nroff -man | - less'. A typical entry in a Makefile or Makefile.am is: - -manpage.1: manpage.sgml - docbook-to-man $< > $@ - - - The docbook-to-man binary is found in the docbook-to-man package. - Please remember that if you create the nroff version in one of the - debian/rules file targets (such as build), you will need to include - docbook-to-man in your Build-Depends control field. - - --> - - - FIRSTNAME"> - SURNAME"> - - June 13 2024"> - - SECTION"> - waruqi@gmail.com"> - - ${PACKAGE_NAME}"> - - - Debian"> - GNU"> - GPL"> -]> - - - -
- &dhemail; -
- - &dhfirstname; - &dhsurname; - - - 2003 - &dhusername; - - &dhdate; -
- - &dhucpackage; - - &dhsection; - - - &dhpackage; - - program to do something - - - - &dhpackage; - - - - - - - - DESCRIPTION - - This manual page documents briefly the - &dhpackage; and bar - commands. - - This manual page was written for the &debian; distribution - because the original program does not have a manual page. - Instead, it has documentation in the &gnu; - Info format; see below. - - &dhpackage; is a program that... - - - - OPTIONS - - These programs follow the usual &gnu; command line syntax, - with long options starting with two dashes (`-'). A summary of - options is included below. For a complete description, see the - Info files. - - - - - - - - Show summary of options. - - - - - - - - Show version of program. - - - - - - SEE ALSO - - bar (1), baz (1). - - The programs are documented fully by The Rise and - Fall of a Fooish Bar available via the - Info system. - - - AUTHOR - - This manual page was written by &dhusername; &dhemail; for - the &debian; system (and may be used by others). Permission is - granted to copy, distribute and/or modify this document under - the terms of the &gnu; General Public License, Version 2 any - later version published by the Free Software Foundation. - - - On Debian systems, the complete text of the GNU General Public - License can be found in /usr/share/common-licenses/GPL. - - - -
- - diff --git a/xmake/scripts/xpack/deb/debian/manpage.xml.ex b/xmake/scripts/xpack/deb/debian/manpage.xml.ex deleted file mode 100644 index a1ea2e9516e..00000000000 --- a/xmake/scripts/xpack/deb/debian/manpage.xml.ex +++ /dev/null @@ -1,291 +0,0 @@ - -.
will be generated. You may view the -manual page with: nroff -man .
| less'. A typical entry -in a Makefile or Makefile.am is: - -DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl -XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0" - -manpage.1: manpage.xml - $(XP) $(DB2MAN) $< - -The xsltproc binary is found in the xsltproc package. The XSL files are in -docbook-xsl. A description of the parameters you can use can be found in the -docbook-xsl-doc-* packages. Please remember that if you create the nroff -version in one of the debian/rules file targets (such as build), you will need -to include xsltproc and docbook-xsl in your Build-Depends control field. -Alternatively use the xmlto command/package. That will also automatically -pull in xsltproc and docbook-xsl. - -Notes for using docbook2x: docbook2x-man does not automatically create the -AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as - ... . - -To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections -read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be -found in the docbook-xsl-doc-html package. - -Validation can be done using: `xmllint -''-noout -''-valid manpage.xml` - -General documentation about man-pages and man-page-formatting: -man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ - ---> - - - - - - - - - - - - - -]> - - - - &dhtitle; - &dhpackage; - - - &dhfirstname; - &dhsurname; - Wrote this manpage for the Debian system. -
- &dhemail; -
-
-
- - 2007 - &dhusername; - - - This manual page was written for the Debian system - (and may be used by others). - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU General Public License, - Version 2 or (at your option) any later version published by - the Free Software Foundation. - On Debian systems, the complete text of the GNU General Public - License can be found in - /usr/share/common-licenses/GPL. - -
- - &dhucpackage; - &dhsection; - - - &dhpackage; - program to do something - - - - &dhpackage; - - - - - - - - - this - - - - - - - - this - that - - - - - &dhpackage; - - - - - - - - - - - - - - - - - - - DESCRIPTION - This manual page documents briefly the - &dhpackage; and bar - commands. - This manual page was written for the Debian distribution - because the original program does not have a manual page. - Instead, it has documentation in the GNU - info - 1 - format; see below. - &dhpackage; is a program that... - - - OPTIONS - The program follows the usual GNU command line syntax, - with long options starting with two dashes (`-'). A summary of - options is included below. For a complete description, see the - - info - 1 - files. - - - - - - - Does this and that. - - - - - - - Show summary of options. - - - - - - - Show version of program. - - - - - - FILES - - - /etc/foo.conf - - The system-wide configuration file to control the - behaviour of &dhpackage;. See - - foo.conf - 5 - for further details. - - - - ${HOME}/.foo.conf - - The per-user configuration file to control the - behaviour of &dhpackage;. See - - foo.conf - 5 - for further details. - - - - - - ENVIRONMENT - - - FOO_CONF - - If used, the defined file is used as configuration - file (see also ). - - - - - - DIAGNOSTICS - The following diagnostics may be issued - on stderr: - - - Bad configuration file. Exiting. - - The configuration file seems to contain a broken configuration - line. Use the option, to get more info. - - - - - &dhpackage; provides some return codes, that can - be used in scripts: - - Code - Diagnostic - - 0 - Program exited successfully. - - - 1 - The configuration file seems to be broken. - - - - - - BUGS - The program is currently limited to only work - with the foobar library. - The upstreams BTS can be found - at . - - - SEE ALSO - - - bar - 1 - , - baz - 1 - , - foo.conf - 5 - - The programs are documented fully by The Rise and - Fall of a Fooish Bar available via the - info - 1 - system. - -
- diff --git a/xmake/scripts/xpack/deb/debian/salsa-ci.yml.ex b/xmake/scripts/xpack/deb/debian/salsa-ci.yml.ex deleted file mode 100644 index a6fb8bdad17..00000000000 --- a/xmake/scripts/xpack/deb/debian/salsa-ci.yml.ex +++ /dev/null @@ -1,11 +0,0 @@ -# For more information on what jobs are run see: -# https://salsa.debian.org/salsa-ci-team/pipeline -# -# To enable the jobs, go to your repository (at salsa.debian.org) -# and click over Settings > CI/CD > Expand (in General pipelines). -# In "CI/CD configuration file" write debian/salsa-ci.yml and click -# in "Save Changes". The CI tests will run after the next commit. ---- -include: - - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml - - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff --git a/xmake/scripts/xpack/deb/debian/xmake-docs.docs b/xmake/scripts/xpack/deb/debian/xmake-docs.docs deleted file mode 100644 index 7319041140c..00000000000 --- a/xmake/scripts/xpack/deb/debian/xmake-docs.docs +++ /dev/null @@ -1,2 +0,0 @@ -README.source -README.Debian diff --git a/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex b/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex deleted file mode 100644 index 9861593f34f..00000000000 --- a/xmake/scripts/xpack/deb/debian/xmake.cron.d.ex +++ /dev/null @@ -1,4 +0,0 @@ -# -# Regular cron jobs for the ${PACKAGE_NAME} package -# -0 4 * * * root [ -x /usr/bin/${PACKAGE_NAME}_maintenance ] && /usr/bin/${PACKAGE_NAME}_maintenance diff --git a/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex b/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex deleted file mode 100644 index 1dda4d3da6f..00000000000 --- a/xmake/scripts/xpack/deb/debian/xmake.doc-base.ex +++ /dev/null @@ -1,20 +0,0 @@ -Document: ${PACKAGE_NAME} -Title: Debian ${PACKAGE_NAME} Manual -Author: ${PACKAGE_AUTHOR} -Abstract: This manual describes what ${PACKAGE_NAME} is - and how it can be used to - manage online manuals on Debian systems. -Section: unknown - -Format: debiandoc-sgml -Files: /usr/share/doc/${PACKAGE_NAME}/${PACKAGE_NAME}.sgml.gz - -Format: postscript -Files: /usr/share/doc/${PACKAGE_NAME}/${PACKAGE_NAME}.ps.gz - -Format: text -Files: /usr/share/doc/${PACKAGE_NAME}/${PACKAGE_NAME}.text.gz - -Format: HTML -Index: /usr/share/doc/${PACKAGE_NAME}/html/index.html -Files: /usr/share/doc/${PACKAGE_NAME}/html/*.html From c997b30ff40becdf6219e19e7273c10a16764f23 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 22:40:28 +0800 Subject: [PATCH 11/23] remove unused debian files --- xmake/scripts/xpack/deb/debian/README.Debian | 2 +- xmake/scripts/xpack/deb/debian/README.source | 10 ----- xmake/scripts/xpack/deb/debian/postinst.ex | 39 -------------------- xmake/scripts/xpack/deb/debian/postrm.ex | 37 ------------------- xmake/scripts/xpack/deb/debian/preinst.ex | 35 ------------------ xmake/scripts/xpack/deb/debian/prerm.ex | 38 ------------------- xmake/scripts/xpack/deb/debian/watch.ex | 38 ------------------- 7 files changed, 1 insertion(+), 198 deletions(-) delete mode 100644 xmake/scripts/xpack/deb/debian/README.source delete mode 100644 xmake/scripts/xpack/deb/debian/postinst.ex delete mode 100644 xmake/scripts/xpack/deb/debian/postrm.ex delete mode 100644 xmake/scripts/xpack/deb/debian/preinst.ex delete mode 100644 xmake/scripts/xpack/deb/debian/prerm.ex delete mode 100644 xmake/scripts/xpack/deb/debian/watch.ex diff --git a/xmake/scripts/xpack/deb/debian/README.Debian b/xmake/scripts/xpack/deb/debian/README.Debian index a2a9606141b..39c70ba801c 100644 --- a/xmake/scripts/xpack/deb/debian/README.Debian +++ b/xmake/scripts/xpack/deb/debian/README.Debian @@ -3,4 +3,4 @@ ${PACKAGE_NAME} for Debian - -- unknown Thu, 13 Jun 2024 01:47:13 +0000 + -- ${PACKAGE_MAINTAINER} ${PACKAGE_DATE} diff --git a/xmake/scripts/xpack/deb/debian/README.source b/xmake/scripts/xpack/deb/debian/README.source deleted file mode 100644 index 69506a7dd33..00000000000 --- a/xmake/scripts/xpack/deb/debian/README.source +++ /dev/null @@ -1,10 +0,0 @@ -${PACKAGE_NAME} for Debian ---------------- - - - - - - -- unknown Thu, 13 Jun 2024 01:47:13 +0000 - diff --git a/xmake/scripts/xpack/deb/debian/postinst.ex b/xmake/scripts/xpack/deb/debian/postinst.ex deleted file mode 100644 index 76881577718..00000000000 --- a/xmake/scripts/xpack/deb/debian/postinst.ex +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# postinst script for ${PACKAGE_NAME} -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/xmake/scripts/xpack/deb/debian/postrm.ex b/xmake/scripts/xpack/deb/debian/postrm.ex deleted file mode 100644 index 9f6a219b7e6..00000000000 --- a/xmake/scripts/xpack/deb/debian/postrm.ex +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# postrm script for ${PACKAGE_NAME} -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `purge' -# * `upgrade' -# * `failed-upgrade' -# * `abort-install' -# * `abort-install' -# * `abort-upgrade' -# * `disappear' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/xmake/scripts/xpack/deb/debian/preinst.ex b/xmake/scripts/xpack/deb/debian/preinst.ex deleted file mode 100644 index bc61d7f9d65..00000000000 --- a/xmake/scripts/xpack/deb/debian/preinst.ex +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# preinst script for ${PACKAGE_NAME} -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `install' -# * `install' -# * `upgrade' -# * `abort-upgrade' -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - install|upgrade) - ;; - - abort-upgrade) - ;; - - *) - echo "preinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/xmake/scripts/xpack/deb/debian/prerm.ex b/xmake/scripts/xpack/deb/debian/prerm.ex deleted file mode 100644 index 4b920862b23..00000000000 --- a/xmake/scripts/xpack/deb/debian/prerm.ex +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# prerm script for ${PACKAGE_NAME} -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `upgrade' -# * `failed-upgrade' -# * `remove' `in-favour' -# * `deconfigure' `in-favour' -# `removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - remove|upgrade|deconfigure) - ;; - - failed-upgrade) - ;; - - *) - echo "prerm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/xmake/scripts/xpack/deb/debian/watch.ex b/xmake/scripts/xpack/deb/debian/watch.ex deleted file mode 100644 index 71247936b82..00000000000 --- a/xmake/scripts/xpack/deb/debian/watch.ex +++ /dev/null @@ -1,38 +0,0 @@ -# Example watch control file for uscan -# Rename this file to "watch" and then you can run the "uscan" command -# to check for upstream updates and more. -# See uscan(1) for format - -# Compulsory line, this is a version 4 file -version=4 - -# PGP signature mangle, so foo.tar.gz has foo.tar.gz.sig -#opts="pgpsigurlmangle=s%$%.sig%" - -# HTTP site (basic) -#http://example.com/downloads.html \ -# files/${PACKAGE_NAME}-([\d\.]+)\.tar\.gz debian uupdate - -# Uncomment to examine an FTP server -#ftp://ftp.example.com/pub/${PACKAGE_NAME}-(.*)\.tar\.gz debian uupdate - -# SourceForge hosted projects -# http://sf.net/${PACKAGE_NAME}/ ${PACKAGE_NAME}-(.*)\.tar\.gz debian uupdate - -# GitHub hosted projects -#opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%-$1.tar.gz%" \ -# https://github.com//${PACKAGE_NAME}/tags \ -# (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate - -# PyPI -# https://pypi.debian.net/${PACKAGE_NAME}/${PACKAGE_NAME}-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) - -# Direct Git -# opts="mode=git" http://git.example.com/${PACKAGE_NAME}.git \ -# refs/tags/v([\d\.]+) debian uupdate - - - - -# Uncomment to find new files on GooglePages -# http://example.googlepages.com/foo.html ${PACKAGE_NAME}-(.*)\.tar\.gz From 8c65293ec7f60a3f6e72247b079c2dd458b72461 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 22:43:19 +0800 Subject: [PATCH 12/23] add install/build cmds --- xmake/plugins/pack/deb/main.lua | 115 +++++++++++++++++++++++++ xmake/scripts/xpack/deb/debian/control | 4 +- xmake/scripts/xpack/deb/debian/rules | 60 +++++++++---- 3 files changed, 162 insertions(+), 17 deletions(-) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 91aa55add1c..bf28be243f7 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -39,6 +39,74 @@ function _get_archivefile(package) return path.absolute(path.join(package:buildir(), package:name() .. "_" .. package:version() .. ".orig.tar.gz")) end +-- translate the file path +function _translate_filepath(package, filepath) + return filepath:replace(package:install_rootdir(), "%{buildroot}/%{_exec_prefix}", {plain = true}) +end + +-- get install command +function _get_customcmd(package, installcmds, cmd) + local opt = cmd.opt or {} + local kind = cmd.kind + if kind == "cp" then + local srcfiles = os.files(cmd.srcpath) + for _, srcfile in ipairs(srcfiles) do + -- the destination is directory? append the filename + local dstfile = _translate_filepath(package, cmd.dstpath) + if #srcfiles > 1 or path.islastsep(dstfile) then + if opt.rootdir then + dstfile = path.join(dstfile, path.relative(srcfile, opt.rootdir)) + else + dstfile = path.join(dstfile, path.filename(srcfile)) + end + end + table.insert(installcmds, string.format("install -Dpm0644 \"%s\" \"%s\"", srcfile, dstfile)) + end + elseif kind == "rm" then + local filepath = _translate_filepath(package, cmd.filepath) + table.insert(installcmds, string.format("rm -f \"%s\"", filepath)) + elseif kind == "rmdir" then + local dir = _translate_filepath(package, cmd.dir) + table.insert(installcmds, string.format("rm -rf \"%s\"", dir)) + elseif kind == "mv" then + local srcpath = _translate_filepath(package, cmd.srcpath) + local dstpath = _translate_filepath(package, cmd.dstpath) + table.insert(installcmds, string.format("mv \"%s\" \"%s\"", srcfile, dstfile)) + elseif kind == "cd" then + local dir = _translate_filepath(package, cmd.dir) + table.insert(installcmds, string.format("cd \"%s\"", dir)) + elseif kind == "mkdir" then + local dir = _translate_filepath(package, cmd.dir) + table.insert(installcmds, string.format("mkdir -p \"%s\"", dir)) + elseif cmd.program then + local argv = {} + for _, arg in ipairs(cmd.argv) do + if path.instance_of(arg) then + arg = arg:clone():set(_translate_filepath(package, arg:rawstr())):str() + elseif path.is_absolute(arg) then + arg = _translate_filepath(package, arg) + end + table.insert(argv, arg) + end + table.insert(installcmds, string.format("%s", os.args(table.join(cmd.program, argv)))) + end +end + +-- get build commands +function _get_buildcmds(package, buildcmds, cmds) + for _, cmd in ipairs(cmds) do + _get_customcmd(package, buildcmds, cmd) + end +end + +-- get install commands +function _get_installcmds(package, installcmds, cmds) + for _, cmd in ipairs(cmds) do + _get_customcmd(package, installcmds, cmd) + end +end + + -- get specvars function _get_specvars(package) local specvars = table.clone(package:specvars()) @@ -49,6 +117,53 @@ function _get_specvars(package) specvars.PACKAGE_DATE = datestr or "" local author = package:get("author") or "unknown " specvars.PACKAGE_COPYRIGHT = os.date("%Y") .. " " .. author + specvars.PACKAGE_INSTALLCMDS = function () + local prefixdir = package:get("prefixdir") + package:set("prefixdir", nil) + local installcmds = {} + _get_installcmds(package, installcmds, batchcmds.get_installcmds(package):cmds()) + for _, component in table.orderpairs(package:components()) do + if component:get("default") ~= false then + _get_installcmds(package, installcmds, batchcmds.get_installcmds(component):cmds()) + end + end + package:set("prefixdir", prefixdir) + return table.concat(installcmds, "\n") + end + specvars.PACKAGE_BUILDCMDS = function () + local buildcmds = {} + _get_buildcmds(package, buildcmds, batchcmds.get_buildcmds(package):cmds()) + return table.concat(buildcmds, "\n") + end + specvars.PACKAGE_BUILDREQUIRES = function () + local requires = {} + local buildrequires = package:get("buildrequires") + if buildrequires then + for _, buildrequire in ipairs(buildrequires) do + table.insert(requires, " " .. buildrequire .. ",") + end + else + local programs = hashset.new() + for _, cmd in ipairs(batchcmds.get_buildcmds(package):cmds()) do + local program = cmd.program + if program then + programs:insert(program) + end + end + local map = { + xmake = "xmake", + cmake = "cmake", + make = "make" + } + for _, program in programs:keys() do + local requirename = map[program] + if requirename then + table.insert(requires, " " .. requirename .. ",") + end + end + end + return table.concat(requires, "\n") + end return specvars end diff --git a/xmake/scripts/xpack/deb/debian/control b/xmake/scripts/xpack/deb/debian/control index 1443bb33ed8..2d54d9fd6ee 100644 --- a/xmake/scripts/xpack/deb/debian/control +++ b/xmake/scripts/xpack/deb/debian/control @@ -1,8 +1,10 @@ Source: ${PACKAGE_NAME} -Section: unknown +Section: devel Priority: optional Maintainer: ${PACKAGE_MAINTAINER} Build-Depends: debhelper-compat (= 13) +Build-Depends-Arch: + ${PACKAGE_BUILDREQUIRES} Standards-Version: 4.6.0 Homepage: ${PACKAGE_HOMEPAGE} #Vcs-Browser: https://salsa.debian.org/debian/xmake diff --git a/xmake/scripts/xpack/deb/debian/rules b/xmake/scripts/xpack/deb/debian/rules index 59ea751e676..595df8ca475 100755 --- a/xmake/scripts/xpack/deb/debian/rules +++ b/xmake/scripts/xpack/deb/debian/rules @@ -1,25 +1,53 @@ #!/usr/bin/make -f -# See debhelper(7) (uncomment to enable) -# output every command that modifies files on the build system. + #export DH_VERBOSE = 1 +configure: configure-stamp +configure-stamp: + dh_testdir + touch configure-stamp -# see FEATURE AREAS in dpkg-buildflags(1) -#export DEB_BUILD_MAINT_OPTIONS = hardening=+all +build: build-stamp +build-stamp: configure-stamp + dh_testdir + ${PACKAGE_BUILDCMDS} + touch $@ -# 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 +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + dh_clean +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + ${PACKAGE_INSTALLCMDS} -%: - dh $@ +distclean: clean +uninstall: + ${PACKAGE_UNINSTALLCMDS} -# dh_make generated override targets -# This is example for Cmake (See https://bugs.debian.org/641051 ) -#override_dh_auto_configure: -# dh_auto_configure -- \ -# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) +binary-indep: build install +# We have nothing to do by default. +# # Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install uninstall configure From 2896c4ca3ac7010f8c0c63e8fd3b09721b118b64 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 22:48:50 +0800 Subject: [PATCH 13/23] fix install cmds --- xmake/plugins/pack/deb/main.lua | 6 +++--- xmake/scripts/xpack/deb/debian/rules | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index bf28be243f7..0eba9becb5a 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -41,7 +41,7 @@ end -- translate the file path function _translate_filepath(package, filepath) - return filepath:replace(package:install_rootdir(), "%{buildroot}/%{_exec_prefix}", {plain = true}) + return filepath:replace(package:install_rootdir(), "/usr", {plain = true}) end -- get install command @@ -128,12 +128,12 @@ function _get_specvars(package) end end package:set("prefixdir", prefixdir) - return table.concat(installcmds, "\n") + return table.concat(installcmds, "\n\t") end specvars.PACKAGE_BUILDCMDS = function () local buildcmds = {} _get_buildcmds(package, buildcmds, batchcmds.get_buildcmds(package):cmds()) - return table.concat(buildcmds, "\n") + return table.concat(buildcmds, "\n\t") end specvars.PACKAGE_BUILDREQUIRES = function () local requires = {} diff --git a/xmake/scripts/xpack/deb/debian/rules b/xmake/scripts/xpack/deb/debian/rules index 595df8ca475..0fe50f5c8c0 100755 --- a/xmake/scripts/xpack/deb/debian/rules +++ b/xmake/scripts/xpack/deb/debian/rules @@ -7,6 +7,12 @@ configure-stamp: dh_testdir touch configure-stamp +build-arch: + # pass + +build-indep: + # pass + build: build-stamp build-stamp: configure-stamp dh_testdir @@ -22,7 +28,6 @@ clean: install: build dh_testdir dh_testroot - dh_clean -k dh_installdirs ${PACKAGE_INSTALLCMDS} From 78500d686de1ff75688d76be648cf90d6f238166 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 22:51:22 +0800 Subject: [PATCH 14/23] improve build requires --- xmake/plugins/pack/deb/main.lua | 8 ++++---- xmake/scripts/xpack/deb/debian/control | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 0eba9becb5a..1ea95d5d4eb 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -140,7 +140,7 @@ function _get_specvars(package) local buildrequires = package:get("buildrequires") if buildrequires then for _, buildrequire in ipairs(buildrequires) do - table.insert(requires, " " .. buildrequire .. ",") + table.insert(requires, buildrequire) end else local programs = hashset.new() @@ -158,11 +158,11 @@ function _get_specvars(package) for _, program in programs:keys() do local requirename = map[program] if requirename then - table.insert(requires, " " .. requirename .. ",") + table.insert(requires, requirename) end end end - return table.concat(requires, "\n") + return table.concat(requires, ", ") end return specvars end @@ -223,7 +223,7 @@ function _pack_deb(debuild, package) archive.archive(archivefile, archivefiles, {curdir = rootdir, compress = "best"}) -- build package, TODO modify key - os.vrunv(debuild, {"-S", "-k02713554FA2CE4AADA20AB23167A22F22C0C68C9"}, {curdir = workdir}) + os.vrunv(debuild, {"-us", "-uc"}, {curdir = workdir}) end function main(package) diff --git a/xmake/scripts/xpack/deb/debian/control b/xmake/scripts/xpack/deb/debian/control index 2d54d9fd6ee..ec17558dc1c 100644 --- a/xmake/scripts/xpack/deb/debian/control +++ b/xmake/scripts/xpack/deb/debian/control @@ -3,8 +3,7 @@ Section: devel Priority: optional Maintainer: ${PACKAGE_MAINTAINER} Build-Depends: debhelper-compat (= 13) -Build-Depends-Arch: - ${PACKAGE_BUILDREQUIRES} +Build-Depends-Arch: ${PACKAGE_BUILDREQUIRES} Standards-Version: 4.6.0 Homepage: ${PACKAGE_HOMEPAGE} #Vcs-Browser: https://salsa.debian.org/debian/xmake From 84c21fc27d66fee32d6ab5744c63835505fc0ca1 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 22:57:43 +0800 Subject: [PATCH 15/23] remove comment --- xmake/scripts/xpack/deb/debian/control | 2 -- 1 file changed, 2 deletions(-) diff --git a/xmake/scripts/xpack/deb/debian/control b/xmake/scripts/xpack/deb/debian/control index ec17558dc1c..13e634b131a 100644 --- a/xmake/scripts/xpack/deb/debian/control +++ b/xmake/scripts/xpack/deb/debian/control @@ -6,8 +6,6 @@ Build-Depends: debhelper-compat (= 13) Build-Depends-Arch: ${PACKAGE_BUILDREQUIRES} Standards-Version: 4.6.0 Homepage: ${PACKAGE_HOMEPAGE} -#Vcs-Browser: https://salsa.debian.org/debian/xmake -#Vcs-Git: https://salsa.debian.org/debian/xmake.git Rules-Requires-Root: no Package: ${PACKAGE_NAME} From be13dea48369944fe9e47d40824bff0c62e09977 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 23:00:51 +0800 Subject: [PATCH 16/23] improve xmake batchcmd --- xmake/plugins/pack/batchcmds.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/plugins/pack/batchcmds.lua b/xmake/plugins/pack/batchcmds.lua index 3d9229ccefa..8091134b2b5 100644 --- a/xmake/plugins/pack/batchcmds.lua +++ b/xmake/plugins/pack/batchcmds.lua @@ -186,13 +186,13 @@ end -- on install source target command function _on_target_installcmd_source(target, batchcmds_, opt) local package = opt.package - batchcmds_:vrunv("xmake", {"install", "-o", path(package:install_rootdir()), target:name()}) + batchcmds_:vrunv("xmake", {"install", "-P", ".", "-y", "-o", path(package:install_rootdir()), target:name()}) end -- on build target command function _on_target_buildcmd(target, batchcmds_, opt) local package = opt.package - batchcmds_:vrunv("xmake", {"build", "-y", target:name()}) + batchcmds_:vrunv("xmake", {"build", "-P", ".", "-y", target:name()}) end -- on install target command From 52c27245a11bdc8063090345b2432497b5b84148 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 14 Jun 2024 23:20:49 +0800 Subject: [PATCH 17/23] fix prefix --- xmake/plugins/pack/deb/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 1ea95d5d4eb..3fd3907a25b 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -41,7 +41,7 @@ end -- translate the file path function _translate_filepath(package, filepath) - return filepath:replace(package:install_rootdir(), "/usr", {plain = true}) + return filepath:replace(package:install_rootdir(), "debian/usr", {plain = true}) end -- get install command From a71bfc26daf8a5f609c8653134ad8124f3870ab0 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 15 Jun 2024 00:37:48 +0800 Subject: [PATCH 18/23] fix source dir --- xmake/plugins/pack/deb/main.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 3fd3907a25b..43f30f4542b 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -36,7 +36,7 @@ end -- get archive file function _get_archivefile(package) - return path.absolute(path.join(package:buildir(), package:name() .. "_" .. package:version() .. ".orig.tar.gz")) + return path.absolute(path.join(path.directory(package:sourcedir()), package:name() .. "_" .. package:version() .. ".orig.tar.gz")) end -- translate the file path @@ -169,11 +169,10 @@ end -- pack deb package function _pack_deb(debuild, package) - local buildir = package:buildir() - local workdir = path.join(buildir, "working") -- install the initial debian directory - local debiandir = path.join(workdir, "debian") + local sourcedir = package:sourcedir() + local debiandir = path.join(sourcedir, "debian") if not os.isdir(debiandir) then local debiandir_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "deb", "debian") os.cp(debiandir_template, debiandir) @@ -215,15 +214,15 @@ function _pack_deb(debuild, package) -- archive install files local rootdir = package:source_rootdir() - local oldir = os.cd(rootdir) + local oldir = os.cd(sourcedir) local archivefiles = os.files("**") os.cd(oldir) local archivefile = _get_archivefile(package) os.tryrm(archivefile) archive.archive(archivefile, archivefiles, {curdir = rootdir, compress = "best"}) - -- build package, TODO modify key - os.vrunv(debuild, {"-us", "-uc"}, {curdir = workdir}) + -- build package + os.vrunv(debuild, {"-us", "-uc"}, {curdir = sourcedir}) end function main(package) From 6cf3886bd1c113d3189d075cc936fd609e284680 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 15 Jun 2024 00:43:18 +0800 Subject: [PATCH 19/23] add output kind for xpack --- tests/plugins/pack/xmake.lua | 2 +- xmake/plugins/pack/deb/main.lua | 3 +++ xmake/plugins/pack/xpack.lua | 30 +++++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua index 638b6208d25..cf07d8ca619 100644 --- a/tests/plugins/pack/xmake.lua +++ b/tests/plugins/pack/xmake.lua @@ -34,7 +34,7 @@ xpack("test") add_components("LongPath") on_load(function (package) - if package:from_source() then + if package:with_source() then package:set("basename", "test-$(plat)-src-v$(version)") else package:set("basename", "test-$(plat)-$(arch)-v$(version)") diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 43f30f4542b..4dc23bc11da 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -223,6 +223,9 @@ function _pack_deb(debuild, package) -- build package os.vrunv(debuild, {"-us", "-uc"}, {curdir = sourcedir}) + + -- copy deb file + os.vcp(path.join(path.directory(sourcedir), "*.deb"), package:outputfile()) end function main(package) diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index 6d82536d4b3..89ee5a54bd6 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -206,6 +206,24 @@ function xpack:inputkind() return inputkind end +-- get the output kind +function xpack:outputkind() + local outputkinds = { + wix = "binary", + nsis = "binary", + zip = "binary", + targz = "binary", + srczip = "source", + srctargz = "source", + runself = "source", + deb = "binary", + srpm = "source", + rpm = "binary" + } + local outputkind = outputkinds[self:format()] or "binary" + return outputkind +end + -- pack from source files? function xpack:from_source() return self:inputkind() == "source" @@ -216,6 +234,16 @@ function xpack:from_binary() return self:inputkind() == "binary" end +-- pack with source files? +function xpack:with_source() + return self:outputkind() == "source" +end + +-- pack with binary files? +function xpack:with_binary() + return self:outputkind() == "binary" +end + -- get the build directory function xpack:buildir() return path.join(config.buildir(), ".xpack", self:name()) @@ -235,7 +263,7 @@ function xpack:basename() local basename = option.get("basename") or self:get("basename") if basename == nil then basename = self:name() - if self:from_source() then + if self:with_source() then basename = basename .. "-src" end local version = self:version() From d60c319880c73efb7b5d8e363bd122f6cc1ddc1a Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 15 Jun 2024 00:47:45 +0800 Subject: [PATCH 20/23] fix prefix --- xmake/plugins/pack/deb/main.lua | 2 +- xmake/scripts/xpack/deb/debian/rules | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 4dc23bc11da..4e7bed7c49c 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -41,7 +41,7 @@ end -- translate the file path function _translate_filepath(package, filepath) - return filepath:replace(package:install_rootdir(), "debian/usr", {plain = true}) + return filepath:replace(package:install_rootdir(), "$(PREFIX)", {plain = true}) end -- get install command diff --git a/xmake/scripts/xpack/deb/debian/rules b/xmake/scripts/xpack/deb/debian/rules index 0fe50f5c8c0..50b1f377a75 100755 --- a/xmake/scripts/xpack/deb/debian/rules +++ b/xmake/scripts/xpack/deb/debian/rules @@ -2,6 +2,8 @@ #export DH_VERBOSE = 1 +PREFIX=$(CURDIR)/debian/${PACKAGE_NAME}/usr + configure: configure-stamp configure-stamp: dh_testdir From 7d0b596dec5177ec3702457bda64560cf65739ac Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 15 Jun 2024 00:49:22 +0800 Subject: [PATCH 21/23] add deb to xmake src --- core/xpack.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/xpack.lua b/core/xpack.lua index ebe89b4550d..e7c3bb3c47c 100644 --- a/core/xpack.lua +++ b/core/xpack.lua @@ -82,7 +82,7 @@ xpack("xmakesrc") set_description("A cross-platform build utility based on Lua.") set_copyright("Copyright (C) 2015-present, TBOOX Open Source Group") set_author("ruki ") - set_formats("srczip", "srctargz", "runself", "srpm") + set_formats("srczip", "srctargz", "runself", "srpm", "deb") set_basename("xmake-v$(version)") set_prefixdir("xmake-$(version)") set_license("Apache-2.0") From 9899ce267b0728176efec6d588cb158aa0d4f668 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 15 Jun 2024 00:54:38 +0800 Subject: [PATCH 22/23] fix archive --- core/xpack.lua | 4 ++-- xmake/plugins/pack/deb/main.lua | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/core/xpack.lua b/core/xpack.lua index e7c3bb3c47c..e4999775ad1 100644 --- a/core/xpack.lua +++ b/core/xpack.lua @@ -115,7 +115,7 @@ xpack("xmakesrc") on_buildcmd(function (package, batchcmds) local format = package:format() - if format == "srpm" then + if format == "srpm" or format == "deb" then batchcmds:runv("./configure") batchcmds:runv("make") end @@ -125,7 +125,7 @@ xpack("xmakesrc") local format = package:format() if format == "runself" then batchcmds:runv("./scripts/get.sh", {"__local__"}) - elseif format == "srpm" then + elseif format == "srpm" or format == "deb" then batchcmds:runv("make", {"install", path(package:install_rootdir(), function (p) return "PREFIX=" .. p end)}) end end) diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index 4e7bed7c49c..680531ff62e 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -106,6 +106,12 @@ function _get_installcmds(package, installcmds, cmds) end end +-- get uninstall commands +function _get_uninstallcmds(package, uninstallcmds, cmds) + for _, cmd in ipairs(cmds) do + _get_customcmd(package, uninstallcmds, cmd) + end +end -- get specvars function _get_specvars(package) @@ -130,6 +136,16 @@ function _get_specvars(package) package:set("prefixdir", prefixdir) return table.concat(installcmds, "\n\t") end + specvars.PACKAGE_UNINSTALLCMDS = function () + local uninstallcmds = {} + _get_uninstallcmds(package, uninstallcmds, batchcmds.get_uninstallcmds(package):cmds()) + for _, component in table.orderpairs(package:components()) do + if component:get("default") ~= false then + _get_uninstallcmds(package, uninstallcmds, batchcmds.get_uninstallcmds(component):cmds()) + end + end + return table.concat(uninstallcmds, "\n\t") + end specvars.PACKAGE_BUILDCMDS = function () local buildcmds = {} _get_buildcmds(package, buildcmds, batchcmds.get_buildcmds(package):cmds()) @@ -214,7 +230,7 @@ function _pack_deb(debuild, package) -- archive install files local rootdir = package:source_rootdir() - local oldir = os.cd(sourcedir) + local oldir = os.cd(rootdir) local archivefiles = os.files("**") os.cd(oldir) local archivefile = _get_archivefile(package) From 1a60da326ee9217d17a27798bb479c72d3072d77 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 15 Jun 2024 00:56:13 +0800 Subject: [PATCH 23/23] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bbf331d05d..41f3ed7dcef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### New features * [#4637](https://github.com/xmake-io/xmake/issues/4637): Add mix generator for xpack +* [#5107](https://github.com/xmake-io/xmake/issues/5107): Add deb generator for xpack * [#5148](https://github.com/xmake-io/xmake/issues/5148): Add on_source in package ### Changes @@ -1828,6 +1829,7 @@ ### 新特性 * [#4637](https://github.com/xmake-io/xmake/issues/4637): 为 xpack 添加 mix 支持 +* [#5107](https://github.com/xmake-io/xmake/issues/5107): 为 xpack 添加 deb 支持 * [#5148](https://github.com/xmake-io/xmake/issues/5148): 为包添加 on_source 配置域 ### 改进