diff --git a/0001-systemctl-let-list-units-unit-files-honour-type.patch b/0001-systemctl-let-list-units-unit-files-honour-type.patch new file mode 100644 index 0000000..1548d84 --- /dev/null +++ b/0001-systemctl-let-list-units-unit-files-honour-type.patch @@ -0,0 +1,94 @@ +Based on 6c71341aeecc3d092ed90f66e1b2c481b8e260ff Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Wed, 29 Oct 2014 22:46:30 -0400 +Subject: [PATCH] systemctl: let list-{units,unit-files } honour --type + +The docs don't clarify what is expected, but I don't see any reason +why --type should be ignored. + +Also restucture the compund conditions into separate clauses for +easier reading. +--- + src/systemctl/systemctl.c | 48 ++++++++++++++++++++++++++++++++++----------- + 1 file changed, 37 insertions(+), 11 deletions(-) + +--- src/systemctl/systemctl.c ++++ src/systemctl/systemctl.c 2014-11-18 00:00:00.000000000 +0000 +@@ -305,21 +305,37 @@ static int compare_unit_info(const void + } + + static bool output_show_unit(const UnitInfo *u, char **patterns) { +- const char *dot; +- + if (!strv_isempty(patterns)) { + char **pattern; + + STRV_FOREACH(pattern, patterns) + if (fnmatch(*pattern, u->id, FNM_NOESCAPE) == 0) +- return true; ++ goto next; + return false; + } + +- return (!arg_types || ((dot = strrchr(u->id, '.')) && +- strv_find(arg_types, dot+1))) && +- (arg_all || !(streq(u->active_state, "inactive") +- || u->following[0]) || u->job_id > 0); ++next: ++ if (arg_types) { ++ const char *dot; ++ ++ dot = strrchr(u->id, '.'); ++ if (!dot) ++ return false; ++ ++ if (!strv_find(arg_types, dot+1)) ++ return false; ++ } ++ ++ if (arg_all) ++ return true; ++ ++ if (u->job_id > 0) ++ return true; ++ ++ if (streq(u->active_state, "inactive") || u->following[0]) ++ return false; ++ ++ return true; + } + + static void output_units_list(const UnitInfo *unit_infos, unsigned c) { +@@ -1019,18 +1035,28 @@ static int compare_unit_file_list(const + } + + static bool output_show_unit_file(const UnitFileList *u, char **patterns) { +- const char *dot; +- + if (!strv_isempty(patterns)) { + char **pattern; + + STRV_FOREACH(pattern, patterns) + if (fnmatch(*pattern, basename(u->path), FNM_NOESCAPE) == 0) +- return true; ++ goto next; + return false; + } + +- return !arg_types || ((dot = strrchr(u->path, '.')) && strv_find(arg_types, dot+1)); ++next: ++ if (!strv_isempty(arg_types)) { ++ const char *dot; ++ ++ dot = strrchr(u->path, '.'); ++ if (!dot) ++ return false; ++ ++ if (!strv_find(arg_types, dot+1)) ++ return false; ++ } ++ ++ return true; + } + + static void output_unit_file_list(const UnitFileList *units, unsigned c) { diff --git a/0002-systemctl-obey-state-in-list-unit-files.patch b/0002-systemctl-obey-state-in-list-unit-files.patch new file mode 100644 index 0000000..aaa1cbf --- /dev/null +++ b/0002-systemctl-obey-state-in-list-unit-files.patch @@ -0,0 +1,28 @@ +From fec1530e6b5b8d6dc352c7338010357126e84621 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Wed, 29 Oct 2014 22:51:00 -0400 +Subject: [PATCH] systemctl: obey --state in list-unit-files + +--- + src/systemctl/systemctl.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c +index b71040b..8481a9b 100644 +--- src/systemctl/systemctl.c ++++ src/systemctl/systemctl.c +@@ -1268,6 +1268,11 @@ next: + return false; + } + ++ if (!strv_isempty(arg_states)) { ++ if (!strv_find(arg_states, unit_file_state_to_string(u->state))) ++ return false; ++ } ++ + return true; + } + +-- +1.7.9.2 + diff --git a/systemd-mini.changes b/systemd-mini.changes index 6ffd663..3c7abde 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Nov 18 10:26:08 UTC 2014 - werner@suse.de + +- Add upstream patches + 0001-systemctl-let-list-units-unit-files-honour-type.patch + 0002-systemctl-obey-state-in-list-unit-files.patch + which allows to use --type in the systemctl command list-units + and list-unit-files. + ------------------------------------------------------------------- Tue Nov 18 10:10:28 UTC 2014 - werner@suse.de diff --git a/systemd-mini.spec b/systemd-mini.spec index 2079a8c..9d30a8e 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -1037,6 +1037,10 @@ Patch503: 0003-utf8-when-looking-at-the-next-unichar-honour-the-siz.patch Patch504: 0001-keymap-Add-support-for-IBM-ThinkPad-X41-Tablet.patch # PATCH-FIX-UPSTREAM added at 2014/11/18 Patch505: 0002-keymap-Fix-special-keys-on-ThinkPad-X60-X61-Tablet.patch +# PATCH-FIX-UPSTREAM added at 2014/11/18 +Patch506: 0001-systemctl-let-list-units-unit-files-honour-type.patch +# PATCH-FIX-UPSTREAM added at 2014/11/18 +Patch507: 0002-systemctl-obey-state-in-list-unit-files.patch # UDEV PATCHES # ============ @@ -1903,6 +1907,8 @@ cp %{SOURCE7} m4/ %patch503 -p0 %patch504 -p0 %patch505 -p0 +%patch506 -p0 +%patch507 -p0 # udev patches %patch1001 -p1 diff --git a/systemd.changes b/systemd.changes index 6ffd663..3c7abde 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Nov 18 10:26:08 UTC 2014 - werner@suse.de + +- Add upstream patches + 0001-systemctl-let-list-units-unit-files-honour-type.patch + 0002-systemctl-obey-state-in-list-unit-files.patch + which allows to use --type in the systemctl command list-units + and list-unit-files. + ------------------------------------------------------------------- Tue Nov 18 10:10:28 UTC 2014 - werner@suse.de diff --git a/systemd.spec b/systemd.spec index 937cd8c..878004a 100644 --- a/systemd.spec +++ b/systemd.spec @@ -1032,6 +1032,10 @@ Patch503: 0003-utf8-when-looking-at-the-next-unichar-honour-the-siz.patch Patch504: 0001-keymap-Add-support-for-IBM-ThinkPad-X41-Tablet.patch # PATCH-FIX-UPSTREAM added at 2014/11/18 Patch505: 0002-keymap-Fix-special-keys-on-ThinkPad-X60-X61-Tablet.patch +# PATCH-FIX-UPSTREAM added at 2014/11/18 +Patch506: 0001-systemctl-let-list-units-unit-files-honour-type.patch +# PATCH-FIX-UPSTREAM added at 2014/11/18 +Patch507: 0002-systemctl-obey-state-in-list-unit-files.patch # UDEV PATCHES # ============ @@ -1898,6 +1902,8 @@ cp %{SOURCE7} m4/ %patch503 -p0 %patch504 -p0 %patch505 -p0 +%patch506 -p0 +%patch507 -p0 # udev patches %patch1001 -p1