From 7529e7f00f6b9142496a45bbf20bbe12070da27b Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Sun, 27 Dec 2020 14:32:53 +0100 Subject: [PATCH] Fix packaging scripts --- VERSION | 1 + debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 15 +++++++++++++++ debian/copyright | 25 +++++++++++++++++++++++++ debian/install | 2 ++ debian/rules | 17 +++++++++++++++++ debian/source/format | 1 + packaging_scripts/alien.sh | 30 ++++++++++++++++++++++++++++++ packaging_scripts/reprepro.sh | 15 +++++++++++++++ packaging_scripts/run.sh | 5 +++++ packaging_scripts/version.sh | 24 ++++++++++++++++++++++++ rpm/macros | 3 +++ rpm/swayswitch-TEMPLATE.spec | 24 ++++++++++++++++++++++++ swayswitch => src/swayswitch | 0 src/swayswitch.conf | 6 ++++++ 16 files changed, 174 insertions(+) create mode 100644 VERSION create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/install create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100755 packaging_scripts/alien.sh create mode 100755 packaging_scripts/reprepro.sh create mode 100755 packaging_scripts/run.sh create mode 100755 packaging_scripts/version.sh create mode 100644 rpm/macros create mode 100644 rpm/swayswitch-TEMPLATE.spec rename swayswitch => src/swayswitch (100%) create mode 100644 src/swayswitch.conf diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8acdd82 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.1 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..7aaaf8f --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +swayswitch (0.0.1) unstable; urgency=low + + * Initial Debian packaging. + + -- Micke Nordin Thu, 27 Dec 2020 13:53:37 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..e53e5bc --- /dev/null +++ b/debian/control @@ -0,0 +1,15 @@ +Source: swayswitch +Section: utils +Priority: optional +Maintainer: Micke Nordin +Build-Depends: debhelper (>=10) +Standards-Version: 4.0.0 +Homepage: https://github.com/mickenordin/swayswitch + +Package: swayswitch +Section: utils +Priority: optional +Architecture: all +Depends: python3-wxgtk4.0, sway +Essential: no +Description: SwaySwitch is a simple window switcher for Sway diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..10fb40a --- /dev/null +++ b/debian/copyright @@ -0,0 +1,25 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: swayswitch +Upstream-Contact: Micke Nordin +Source: https://github.com/mickenordin/swayswitch + +Files: * +Copyright: 2020 Micke Nordin +License: GPL-3+ + +License: GPL-3+ + Copyright (C) 2020 Micke Nordin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + On Debian systems, the full text of the GNU General Public + License version 3 can be found in the file + '/usr/share/common-licenses/GPL-3'. diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..109bb4e --- /dev/null +++ b/debian/install @@ -0,0 +1,2 @@ +src/swayswitch /usr/bin +src/swayswitch.conf /etc/sway/config.d diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..c68a294 --- /dev/null +++ b/debian/rules @@ -0,0 +1,17 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#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 $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..af745b3 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (git) diff --git a/packaging_scripts/alien.sh b/packaging_scripts/alien.sh new file mode 100755 index 0000000..104f8d1 --- /dev/null +++ b/packaging_scripts/alien.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# This is where I keep my sources +BASEDIR=~/sources +# Version of swayswitch +VERSION=$(cat ${BASEDIR}/swayswitch/VERSION) + +cd ${BASEDIR} + +# Import signing key +sudo rpm --import ${BASEDIR}/repo/PUBLIC.KEY + +# Convert deb to rpm +sudo alien -g -r ${BASEDIR}/swayswitch_${VERSION}_all.deb + +# Remove generated specfile +sudo rm ${BASEDIR}/swayswitch-${VERSION}/swayswitch-*.spec + +# Replace with our own +sed "s/##VERSION##/${VERSION}/" ${BASEDIR}/swayswitch/rpm/swayswitch-TEMPLATE.spec | sudo tee ${BASEDIR}/swayswitch-${VERSION}/swayswitch-${VERSION}.spec + +# Change to build dir +cd swayswitch-${VERSION} + +# Build rpm and put in repo +cp ${BASEDIR}/swayswitch/rpm/macros ~/.rpmmacros +sudo rpmbuild --buildroot=$(pwd) -bb swayswitch-${VERSION}.spec +sudo chown ${USER}:${USER} ${BASEDIR}/swayswitch-${VERSION}.noarch.rpm +rpm --addsign ${BASEDIR}/swayswitch-${VERSION}.noarch.rpm +cp ${BASEDIR}/swayswitch-${VERSION}.noarch.rpm ${BASEDIR}/repo/rpm/ +createrepo_c ${BASEDIR}/repo/rpm/ diff --git a/packaging_scripts/reprepro.sh b/packaging_scripts/reprepro.sh new file mode 100755 index 0000000..b5636f9 --- /dev/null +++ b/packaging_scripts/reprepro.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Where I keep the sources +BASEDIR=~/sources +# Version of swayswitch +VERSION=$(cat ${BASEDIR}/swayswitch/VERSION) + +# Change to source dir +cd ${BASEDIR}/swayswitch + +# Build deb +dpkg-buildpackage -us -uc + +# Add binary and source to repo +reprepro --basedir ${BASEDIR}/repo/debian includedeb unstable ${BASEDIR}/swayswitch_${VERSION}_all.deb +reprepro --basedir ${BASEDIR}/repo/debian -S utils --priority optional includedsc unstable ${BASEDIR}/swayswitch_${VERSION}.dsc diff --git a/packaging_scripts/run.sh b/packaging_scripts/run.sh new file mode 100755 index 0000000..3690c83 --- /dev/null +++ b/packaging_scripts/run.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +BASEDIR=~/sources +${BASEDIR}/swayswitch/packaging_scripts/version.sh +${BASEDIR}/swayswitch/packaging_scripts/reprepro.sh +${BASEDIR}/swayswitch/packaging_scripts/alien.sh diff --git a/packaging_scripts/version.sh b/packaging_scripts/version.sh new file mode 100755 index 0000000..e1b6886 --- /dev/null +++ b/packaging_scripts/version.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +BASEDIR=~/sources +version="${1}" +chlog_msg="${2}" +if [[ "x${version}" == "x" ]]; then + echo -n "Enter version (x.x.x): " + read version +fi +if [[ "x${chlog_msg}" == "x" ]]; then + echo -n "Enter changelog message: " + read chlog_msg +fi +# Code +echo ${version} > ${BASEDIR}/swayswitch/VERSION + +# Changelog +echo 'swayswitch ('${version}') unstable; urgency=low + + * '${chlog_msg}' + + -- Micke Nordin '$(LC_ALL=C date "+%a, %d %b %Y %T %z")' +'| wl-copy + +vim ${BASEDIR}/swayswitch/debian/changelog diff --git a/rpm/macros b/rpm/macros new file mode 100644 index 0000000..2aeb204 --- /dev/null +++ b/rpm/macros @@ -0,0 +1,3 @@ +%_gpg_name Mikael Nordin +%_gpg_path /home/micke/.gnupg +%__gpg /usr/bin/gpg diff --git a/rpm/swayswitch-TEMPLATE.spec b/rpm/swayswitch-TEMPLATE.spec new file mode 100644 index 0000000..6e77973 --- /dev/null +++ b/rpm/swayswitch-TEMPLATE.spec @@ -0,0 +1,24 @@ +Buildroot: /home/micke/sources/swayswitch-##VERSION## +Name: swayswitch +Version: ##VERSION## +Release: 1 +Requires: python3-wxpython4 +Summary: SwaySwitch is a simple window switcher for sway +License: GPLv3+ +Distribution: Fedora + +%define _binary_filedigest_algorithm 2 +%define _rpmdir ../ +%define _rpmfilename %%{NAME}-%%{VERSION}.noarch.rpm +%define _unpackaged_files_terminate_build 0 + +%description + +SwaySwitch is a simple window switcher for sway: + + +%files +"/usr/bin/swayswitch" +%dir "/usr/share/doc/swayswitch/" +"/usr/share/doc/swayswitch/changelog.gz" +"/usr/share/doc/swayswitch/copyright" diff --git a/swayswitch b/src/swayswitch similarity index 100% rename from swayswitch rename to src/swayswitch diff --git a/src/swayswitch.conf b/src/swayswitch.conf new file mode 100644 index 0000000..575ff3f --- /dev/null +++ b/src/swayswitch.conf @@ -0,0 +1,6 @@ +mode "switcher" { + # Remove normal bidnings and set a dummy variable so we do something + set $hello "hello" +} + +bindsym $mod+Tab exec /usr/bin/swayswitch, mode "switcher"