From 4418d1d91f2100fdca2d3d819a2f05c8cf7fda4e Mon Sep 17 00:00:00 2001 From: Simon Struck Date: Wed, 28 Sep 2022 15:46:10 +0200 Subject: [PATCH 01/15] Re-add missing environment variables --- src/login.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/login.c b/src/login.c index 7788d499..80c54a80 100644 --- a/src/login.c +++ b/src/login.c @@ -618,8 +618,11 @@ void auth( char vt[5]; snprintf(vt, 5, "vt%d", config.tty); - // set env + // set env (this clears the environment) env_init(pwd); + // Re-add XDG environment variables from lines 508,509 + env_xdg_session(desktop->display_server[desktop->cur]); + env_xdg(tty_id, desktop->list_simple[desktop->cur]); if (dgn_catch()) { From ea48915f9ddd58d31e0cad9e8d35a761f60bc40d Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Thu, 29 Sep 2022 09:49:04 +0200 Subject: [PATCH 02/15] Initialized to use tito. --- .tito/packages/.readme | 3 +++ .tito/tito.props | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 .tito/packages/.readme create mode 100644 .tito/tito.props diff --git a/.tito/packages/.readme b/.tito/packages/.readme new file mode 100644 index 00000000..b9411e2d --- /dev/null +++ b/.tito/packages/.readme @@ -0,0 +1,3 @@ +the .tito/packages directory contains metadata files +named after their packages. Each file has the latest tagged +version and the project's relative directory. diff --git a/.tito/tito.props b/.tito/tito.props new file mode 100644 index 00000000..eab3f190 --- /dev/null +++ b/.tito/tito.props @@ -0,0 +1,5 @@ +[buildconfig] +builder = tito.builder.Builder +tagger = tito.tagger.VersionTagger +changelog_do_not_remove_cherrypick = 0 +changelog_format = %s (%ae) From 1463c34a65e99042cc486d7445bc815a363882aa Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Thu, 29 Sep 2022 10:18:11 +0200 Subject: [PATCH 03/15] Added initial specfile --- .tito/tito.props | 2 +- ly.spec | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 ly.spec diff --git a/.tito/tito.props b/.tito/tito.props index eab3f190..4bf4ae5c 100644 --- a/.tito/tito.props +++ b/.tito/tito.props @@ -1,5 +1,5 @@ [buildconfig] -builder = tito.builder.Builder +builder = tito.builder.SubmoduleAwareBuilder tagger = tito.tagger.VersionTagger changelog_do_not_remove_cherrypick = 0 changelog_format = %s (%ae) diff --git a/ly.spec b/ly.spec new file mode 100644 index 00000000..35b76dd7 --- /dev/null +++ b/ly.spec @@ -0,0 +1,41 @@ +Name: ly +Version: 0.5.3 +Release: 1%{?dist} +Summary: a TUI display manager + +License: WTFPL +URL: https://github.com/fairyglade/ly +Source0: %{name}-%{version}.tar.gz + +BuildRequires: make automake +BuildRequires: gcc gcc-c++ +BuildRequires: kernel-devel pam-devel +BuildRequires: libxcb-devel + +%description +Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD. + +%prep +%autosetup + + +%build +%configure +%make_build + + +%install +%make_install systemd + + +%check + + +%files +%license license.md +%doc + + +%changelog +* Thu Sep 29 2022 Jerzy Drozdz - 0.5.3-1 +- Initial build From e7418e6d7a063e18976a04932397e7962647bd0b Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Thu, 29 Sep 2022 10:26:38 +0200 Subject: [PATCH 04/15] Changed to default Builder --- .tito/tito.props | 2 +- ly.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.tito/tito.props b/.tito/tito.props index 4bf4ae5c..eab3f190 100644 --- a/.tito/tito.props +++ b/.tito/tito.props @@ -1,5 +1,5 @@ [buildconfig] -builder = tito.builder.SubmoduleAwareBuilder +builder = tito.builder.Builder tagger = tito.tagger.VersionTagger changelog_do_not_remove_cherrypick = 0 changelog_format = %s (%ae) diff --git a/ly.spec b/ly.spec index 35b76dd7..a1fcbaf9 100644 --- a/ly.spec +++ b/ly.spec @@ -4,7 +4,7 @@ Release: 1%{?dist} Summary: a TUI display manager License: WTFPL -URL: https://github.com/fairyglade/ly +URL: https://github.com/fairyglade/ly.git Source0: %{name}-%{version}.tar.gz BuildRequires: make automake From d78dc2f8dc67f457681cbf7b4e969da93f95c4e7 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Thu, 29 Sep 2022 11:35:32 +0200 Subject: [PATCH 05/15] removed configure macro --- ly.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/ly.spec b/ly.spec index a1fcbaf9..980aa9fb 100644 --- a/ly.spec +++ b/ly.spec @@ -20,7 +20,6 @@ Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD. %build -%configure %make_build From b184f6d578d21f87c940b68f75d5d57c7bc8aaa0 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Thu, 29 Sep 2022 15:42:40 +0200 Subject: [PATCH 06/15] Fixed install call --- .tito/tito.props | 2 +- ly.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.tito/tito.props b/.tito/tito.props index eab3f190..4bf4ae5c 100644 --- a/.tito/tito.props +++ b/.tito/tito.props @@ -1,5 +1,5 @@ [buildconfig] -builder = tito.builder.Builder +builder = tito.builder.SubmoduleAwareBuilder tagger = tito.tagger.VersionTagger changelog_do_not_remove_cherrypick = 0 changelog_format = %s (%ae) diff --git a/ly.spec b/ly.spec index 980aa9fb..f8ee1b74 100644 --- a/ly.spec +++ b/ly.spec @@ -24,7 +24,7 @@ Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD. %install -%make_install systemd +%make_install installsystemd %check From 361e01e6e44a5866201da1f3d53969cc3b83b231 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Thu, 29 Sep 2022 15:52:09 +0200 Subject: [PATCH 07/15] Added files --- ly.spec | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ly.spec b/ly.spec index f8ee1b74..0298e22b 100644 --- a/ly.spec +++ b/ly.spec @@ -12,6 +12,8 @@ BuildRequires: gcc gcc-c++ BuildRequires: kernel-devel pam-devel BuildRequires: libxcb-devel +%systemd_requires + %description Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD. @@ -32,8 +34,18 @@ Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD. %files %license license.md -%doc +%doc readme.md +%{_sysconfdir}/ly +%{_sysconfdir}/pam.d/* +%{_unitdir}/* +%{_bindir}/* + + +%post +%systemd_post %{name}.service +%preun +%systemd_preun %{name}.service %changelog * Thu Sep 29 2022 Jerzy Drozdz - 0.5.3-1 From 8c7b8cf8d72b2dc15fad016f9b98fed8c68f282f Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Thu, 29 Sep 2022 16:08:08 +0200 Subject: [PATCH 08/15] Added patched SubmoduleAwareBuilder --- .tito/custom/fixed_submodule_aware_builder.py | 115 ++++++++++++++++++ .tito/tito.props | 3 +- 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 .tito/custom/fixed_submodule_aware_builder.py diff --git a/.tito/custom/fixed_submodule_aware_builder.py b/.tito/custom/fixed_submodule_aware_builder.py new file mode 100644 index 00000000..9e5bea46 --- /dev/null +++ b/.tito/custom/fixed_submodule_aware_builder.py @@ -0,0 +1,115 @@ +import os + +from tito.builder import SubmoduleAwareBuilder as BuggySubmoduleAwareBuilder +from tito.common import ( + chdir, + debug, + run_command, + create_tgz, + get_commit_timestamp, +) +from tito.tar import TarFixer + + +class SubmoduleAwareBuilder(BuggySubmoduleAwareBuilder): + def run_git_archive(self, relative_git_dir, prefix, commit, dest_tar, subdir=None): + # command to generate a git-archive + git_archive_cmd = "git archive --format=tar --prefix=%s/ %s:%s --output=%s" % ( + prefix, + commit, + relative_git_dir, + dest_tar, + ) + + if subdir is None: + return run_command(git_archive_cmd) + + with chdir(subdir): + run_command(git_archive_cmd) + + # Run git-archive separately if --debug was specified. + # This allows us to detect failure early. + # On git < 1.7.4-rc0, `git archive ... commit:./` fails! + debug( + "git-archive fails if relative dir is not in git tree", + "%s > /dev/null" % git_archive_cmd, + ) + + def create_tgz(self, git_root, prefix, commit, relative_dir, dest_tgz): + """ + Create a .tar.gz from a projects source in git. + And include submodules + """ + + git_root_abspath = os.path.abspath(git_root) + gitmodules_path = os.path.join(git_root_abspath, ".gitmodules") + + # if .gitmodules does not exist, just call the existing create_tgz function + # as there is nothing to see here. + if not os.path.exists(gitmodules_path): + return create_tgz(git_root, prefix, commit, relative_dir, dest_tgz) + + os.chdir(git_root_abspath) + timestamp = get_commit_timestamp(commit) + + # Accommodate standalone projects with specfile in root of git repo: + relative_git_dir = "%s" % relative_dir + if relative_git_dir in ["/", "./"]: + relative_git_dir = "" + + basename = os.path.splitext(dest_tgz)[0] + initial_tar = "%s.initial" % basename + + # We need to tar up the following: + # 1. the current repo + self.run_git_archive(relative_git_dir, prefix, commit, initial_tar, None) + + # 2. all of the submodules + # then combine those into a single archive. + submodules_cmd = "git submodule--helper list" + submodules_output = run_command(submodules_cmd) + + # split submodules output on newline + # then on tab, and the directory is the last entry + submodules_list = [ + line.split("\t")[-1] for line in submodules_output.split("\n") + ] + + submodule_tar_files = [] + # We ignore the hash in the sub modules list as we'll have to get the correct one + # from the commit id in commit + for submodule in submodules_list: + # to find the submodule shars: + # git rev-parse :./ + rev_parse_cmd = "git rev-parse %s:./%s" % (commit, submodule) + submodule_commit = run_command(rev_parse_cmd) + submodule_tar_file = "%s.%s" % (initial_tar, submodule.replace("/", "_")) + # prefix should be / + submodule_prefix = "%s/%s" % (prefix, submodule) + + self.run_git_archive( + relative_git_dir, + submodule_prefix, + submodule_commit, + submodule_tar_file, + submodule, + ) + submodule_tar_files.append(submodule_tar_file) + + # we need to append all of the submodule tar files onto the initial + # Tar can concatenate only 2 archives at a time + for tar_file in submodule_tar_files: + run_command("tar -Af %s %s" % (initial_tar, tar_file)) + + fixed_tar = "%s.tar" % basename + fixed_tar_fh = open(fixed_tar, "wb") + try: + tarfixer = TarFixer( + open(initial_tar, "rb"), fixed_tar_fh, timestamp, commit + ) + tarfixer.fix() + finally: + fixed_tar_fh.close() + + # It's a pity we can't use Python's gzip, but it doesn't offer an equivalent of -n + return run_command("gzip -n -c < %s > %s" % (fixed_tar, dest_tgz)) diff --git a/.tito/tito.props b/.tito/tito.props index 4bf4ae5c..39c84b0c 100644 --- a/.tito/tito.props +++ b/.tito/tito.props @@ -1,5 +1,6 @@ [buildconfig] -builder = tito.builder.SubmoduleAwareBuilder +builder = fixed_submodule_aware_builder.SubmoduleAwareBuilder tagger = tito.tagger.VersionTagger changelog_do_not_remove_cherrypick = 0 changelog_format = %s (%ae) +lib_dir = .tito/custom From c781e6cdf0cab07452bb323bc95f7aa49d615543 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Fri, 30 Sep 2022 11:43:44 +0200 Subject: [PATCH 09/15] Added missing dependency --- ly.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/ly.spec b/ly.spec index 0298e22b..8038717d 100644 --- a/ly.spec +++ b/ly.spec @@ -11,6 +11,7 @@ BuildRequires: make automake BuildRequires: gcc gcc-c++ BuildRequires: kernel-devel pam-devel BuildRequires: libxcb-devel +BuildRequires: systemd-rpm-macros %systemd_requires From b5f821078eb5997d8e79c8c9ce4c2f773f4235b6 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Fri, 30 Sep 2022 16:51:10 +0200 Subject: [PATCH 10/15] Added SELinux settings --- ly.spec | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/ly.spec b/ly.spec index 8038717d..ac64cf67 100644 --- a/ly.spec +++ b/ly.spec @@ -1,6 +1,6 @@ Name: ly Version: 0.5.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: a TUI display manager License: WTFPL @@ -12,7 +12,10 @@ BuildRequires: gcc gcc-c++ BuildRequires: kernel-devel pam-devel BuildRequires: libxcb-devel BuildRequires: systemd-rpm-macros +BuildRequires: gawk +Requires(post): policycoreutils-python-utils +Requires(postun): policycoreutils-python-utils %systemd_requires %description @@ -24,11 +27,13 @@ Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD. %build %make_build +mv -f res/config.ini config.ini_orig +awk '{print}/#save_file/{print "save_file = %{_sharedstatedir}/%{name}/save"}' config.ini_orig > res/config.ini %install %make_install installsystemd - +install -m 755 -d %{buildroot}%{_sharedstatedir}/%{name} %check @@ -36,18 +41,33 @@ Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD. %files %license license.md %doc readme.md -%{_sysconfdir}/ly -%{_sysconfdir}/pam.d/* +%config(noreplace) %{_sysconfdir}/ly +%config %{_sysconfdir}/pam.d/* %{_unitdir}/* %{_bindir}/* +%{_sharedstatedir}/%{name} %post %systemd_post %{name}.service +semanage fcontext --add --ftype f --type xdm_exec_t '%{_bindir}/ly' 2>/dev/null || : +semanage fcontext --add --ftype a --type xdm_var_lib_t '%{_sharedstatedir}/%{name}' 2>/dev/null || : +restorecon -R %{_bindir}/ly %{_sharedstatedir}/%{name} || : %preun %systemd_preun %{name}.service +%postun +if [ $1 -eq 0];then +semanage fcontext --delete --type xdm_exe_t '%{_bindir}/ly' 2>/dev/null || : +semanage fcontext --delete --type xdm_var_lib_t '%{_sharedstatedir}/%{name}' 2>/dev/null || : +fi + %changelog +* Fri Sep 30 2022 Jerzy Drozdz - 0.5.3-2 +- Added setting SELinux contexts +- Added configuration option for state files +- Configuration directory and pam service set to \%config + * Thu Sep 29 2022 Jerzy Drozdz - 0.5.3-1 - Initial build From f8fa0abffa08ad9ffe17792ea72a4c5ed1a2e540 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Fri, 30 Sep 2022 22:09:24 +0200 Subject: [PATCH 11/15] Added setting wayland_specifier --- ly.spec | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ly.spec b/ly.spec index ac64cf67..c8b5dc32 100644 --- a/ly.spec +++ b/ly.spec @@ -1,6 +1,6 @@ Name: ly Version: 0.5.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: a TUI display manager License: WTFPL @@ -28,7 +28,10 @@ Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD. %build %make_build mv -f res/config.ini config.ini_orig -awk '{print}/#save_file/{print "save_file = %{_sharedstatedir}/%{name}/save"}' config.ini_orig > res/config.ini +awk '{print} +/#save_file/{print "save_file = %{_sharedstatedir}/%{name}/save"} +/#wayland_specifier/{print "wayland_specifier = true"} +' config.ini_orig > res/config.ini %install @@ -58,12 +61,15 @@ restorecon -R %{_bindir}/ly %{_sharedstatedir}/%{name} || : %systemd_preun %{name}.service %postun -if [ $1 -eq 0];then +if [ $1 -eq 0 ];then semanage fcontext --delete --type xdm_exe_t '%{_bindir}/ly' 2>/dev/null || : semanage fcontext --delete --type xdm_var_lib_t '%{_sharedstatedir}/%{name}' 2>/dev/null || : fi %changelog +* Fri Sep 30 2022 Jerzy Drozdz - 0.5.3-3 +- Added wayland_specifier = true + * Fri Sep 30 2022 Jerzy Drozdz - 0.5.3-2 - Added setting SELinux contexts - Added configuration option for state files From ec8f130a55f278812f001246bd2da3e6223e4c19 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Mon, 3 Oct 2022 10:13:40 +0200 Subject: [PATCH 12/15] Fixed cleaning fcontext rules --- ly.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ly.spec b/ly.spec index c8b5dc32..edaabc52 100644 --- a/ly.spec +++ b/ly.spec @@ -1,6 +1,6 @@ Name: ly Version: 0.5.3 -Release: 3%{?dist} +Release: 4%{?dist} Summary: a TUI display manager License: WTFPL @@ -62,11 +62,14 @@ restorecon -R %{_bindir}/ly %{_sharedstatedir}/%{name} || : %postun if [ $1 -eq 0 ];then -semanage fcontext --delete --type xdm_exe_t '%{_bindir}/ly' 2>/dev/null || : -semanage fcontext --delete --type xdm_var_lib_t '%{_sharedstatedir}/%{name}' 2>/dev/null || : +semanage fcontext --delete --ftype f --type xdm_exe_t '%{_bindir}/ly' 2>/dev/null || : +semanage fcontext --delete --ftype a --type xdm_var_lib_t '%{_sharedstatedir}/%{name}' 2>/dev/null || : fi %changelog +* Sun Oct 02 2022 Jerzy Drozdz - 0.5.3-4 +- Fixed postun script + * Fri Sep 30 2022 Jerzy Drozdz - 0.5.3-3 - Added wayland_specifier = true From 390932401901f8af1a5a315fe8806aeeb7cd7cf9 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Tue, 4 Oct 2022 17:25:26 +0200 Subject: [PATCH 13/15] Added package definition --- .gitignore | 1 + .tito/packages/ly | 1 + .tito/tito.props | 1 + 3 files changed, 3 insertions(+) create mode 100644 .tito/packages/ly diff --git a/.gitignore b/.gitignore index 65ddc507..fc946e73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin obj valgrind.log +__pycache__ diff --git a/.tito/packages/ly b/.tito/packages/ly new file mode 100644 index 00000000..525e8e9e --- /dev/null +++ b/.tito/packages/ly @@ -0,0 +1 @@ +0.5.3 ./ diff --git a/.tito/tito.props b/.tito/tito.props index 39c84b0c..48895626 100644 --- a/.tito/tito.props +++ b/.tito/tito.props @@ -4,3 +4,4 @@ tagger = tito.tagger.VersionTagger changelog_do_not_remove_cherrypick = 0 changelog_format = %s (%ae) lib_dir = .tito/custom +tag_format = "v{version}" From 5b8e147ac45e0a5985f3623f5f5f2187478646e8 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Wed, 5 Oct 2022 10:15:20 +0200 Subject: [PATCH 14/15] Update changelog --- ly.spec | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ly.spec b/ly.spec index edaabc52..d10beb5b 100644 --- a/ly.spec +++ b/ly.spec @@ -1,6 +1,6 @@ Name: ly Version: 0.5.3 -Release: 4%{?dist} +Release: 5%{?dist} Summary: a TUI display manager License: WTFPL @@ -67,16 +67,19 @@ semanage fcontext --delete --ftype a --type xdm_var_lib_t '%{_sharedstatedir}/%{ fi %changelog -* Sun Oct 02 2022 Jerzy Drozdz - 0.5.3-4 +* Wed Oct 05 2022 Jerzy Drożdż - 0.5.3-5 +- Added patches from PR #446 + +* Sun Oct 02 2022 Jerzy Drożdż - 0.5.3-4 - Fixed postun script -* Fri Sep 30 2022 Jerzy Drozdz - 0.5.3-3 +* Fri Sep 30 2022 Jerzy Drożdż - 0.5.3-3 - Added wayland_specifier = true -* Fri Sep 30 2022 Jerzy Drozdz - 0.5.3-2 +* Fri Sep 30 2022 Jerzy Drożdż - 0.5.3-2 - Added setting SELinux contexts - Added configuration option for state files - Configuration directory and pam service set to \%config -* Thu Sep 29 2022 Jerzy Drozdz - 0.5.3-1 +* Thu Sep 29 2022 Jerzy Drożdż - 0.5.3-1 - Initial build From 3ec60eaaee3513b68158836103f94620e53d5aa3 Mon Sep 17 00:00:00 2001 From: Jerzy Drozdz Date: Wed, 5 Oct 2022 10:30:14 +0200 Subject: [PATCH 15/15] Fixed fcontext rule --- ly.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ly.spec b/ly.spec index d10beb5b..7747ff74 100644 --- a/ly.spec +++ b/ly.spec @@ -54,7 +54,7 @@ install -m 755 -d %{buildroot}%{_sharedstatedir}/%{name} %post %systemd_post %{name}.service semanage fcontext --add --ftype f --type xdm_exec_t '%{_bindir}/ly' 2>/dev/null || : -semanage fcontext --add --ftype a --type xdm_var_lib_t '%{_sharedstatedir}/%{name}' 2>/dev/null || : +semanage fcontext --add --ftype a --type xdm_var_lib_t '%{_sharedstatedir}/%{name}(/.*)?' 2>/dev/null || : restorecon -R %{_bindir}/ly %{_sharedstatedir}/%{name} || : %preun @@ -63,7 +63,7 @@ restorecon -R %{_bindir}/ly %{_sharedstatedir}/%{name} || : %postun if [ $1 -eq 0 ];then semanage fcontext --delete --ftype f --type xdm_exe_t '%{_bindir}/ly' 2>/dev/null || : -semanage fcontext --delete --ftype a --type xdm_var_lib_t '%{_sharedstatedir}/%{name}' 2>/dev/null || : +semanage fcontext --delete --ftype a --type xdm_var_lib_t '%{_sharedstatedir}/%{name}(/.*)?' 2>/dev/null || : fi %changelog