[PATCH v8 0/3] maintenance: add support for systemd timers on Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I’ve just resumed working on my patchset to add support for systemd
timers on Linux for the `git maintenance start` command.

The patches are:

* cache.h: Introduce a generic "xdg_config_home_for(…)" function

  This patch introduces a function to compute configuration files
  paths inside $XDG_CONFIG_HOME.
  It is used in the latest patch of this series to compute systemd
  unit files location.

  This patch is unchanged compared to its previous version.

* maintenance: `git maintenance run` learned `--scheduler=<scheduler>`

  This patch adds a new parameter to the `git maintenance run` to let
  the user choose a scheduler.

  This patch contains the following changes compared to its previous
  version:

  * Remove some UTF-8 characters in a code comment and replace them by
    ASCII ones.

  * Leverage `string_list_split` in `get_schedule_cmd` to parse the
    comma-separated list of colon-separated pairs in
    GIT_TEST_MAINT_SCHEDULER environment variable.

* maintenance: add support for systemd timers on Linux

  This patch implements the support of systemd timers on top of
  crontab scheduler on Linux systems.

  This patch is unchanged compared to its previous version.


According to [1], there were 3 changes awaited in this v8:
* The two already mentionned above (utf-8 characters and
  `string_list_split` thing)
* An improvement around the #ifdef.

I must admit I haven’t touched anything around the #ifdef in this v8
because I’m not sure what to do. I’ve just asked for some more details
in [2].

[1] https://lore.kernel.org/git/4aed0293-6a48-d370-3b72-496b7c631cb5@xxxxxxxxx/
[2] https://lore.kernel.org/git/3218082.ccbTtk1zYS@xxxxxxxxxxxxxxxxxxx/


Best wishes,
Lénaïc.


Lénaïc Huard (3):
  cache.h: Introduce a generic "xdg_config_home_for(…)" function
  maintenance: `git maintenance run` learned `--scheduler=<scheduler>`
  maintenance: add support for systemd timers on Linux

 Documentation/git-maintenance.txt |  57 +++
 builtin/gc.c                      | 592 ++++++++++++++++++++++++++----
 cache.h                           |   7 +
 path.c                            |  13 +-
 t/t7900-maintenance.sh            | 110 +++++-
 5 files changed, 701 insertions(+), 78 deletions(-)

Diff-intervalle contre v7 :
1:  899b11ed5b = 1:  1639bd151c cache.h: Introduce a generic "xdg_config_home_for(…)" function
2:  f3e2f0256b ! 2:  ea5568269c maintenance: `git maintenance run` learned `--scheduler=<scheduler>`
    @@ builtin/gc.c: static const char *get_frequency(enum schedule_priority schedule)
     + *
     + * Ex.:
     + *   GIT_TEST_MAINT_SCHEDULER not set
    -+ *     ┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
    -+ *     ┃ Input ┃                     Output                      ┃
    -+ *     ┃ *cmd  ┃ return code │       *cmd        │ *is_available ┃
    -+ *     ┣━━━━━━━╋━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━┫
    -+ *     ┃ "foo" ┃    false    │ "foo" (unchanged) │  (unchanged)  ┃
    -+ *     ┗━━━━━━━┻━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
    ++ *     +-------+-------------------------------------------------+
    ++ *     | Input |                     Output                      |
    ++ *     | *cmd  | return code |       *cmd        | *is_available |
    ++ *     +-------+-------------+-------------------+---------------+
    ++ *     | "foo" |    false    | "foo" (unchanged) |  (unchanged)  |
    ++ *     +-------+-------------+-------------------+---------------+
     + *
     + *   GIT_TEST_MAINT_SCHEDULER set to “foo:./mock_foo.sh,bar:./mock_bar.sh”
    -+ *     ┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
    -+ *     ┃ Input ┃                     Output                      ┃
    -+ *     ┃ *cmd  ┃ return code │       *cmd        │ *is_available ┃
    -+ *     ┣━━━━━━━╋━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━┫
    -+ *     ┃ "foo" ┃    true     │  "./mock.foo.sh"  │     true      ┃
    -+ *     ┃ "qux" ┃    true     │ "qux" (unchanged) │     false     ┃
    -+ *     ┗━━━━━━━┻━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
    ++ *     +-------+-------------------------------------------------+
    ++ *     | Input |                     Output                      |
    ++ *     | *cmd  | return code |       *cmd        | *is_available |
    ++ *     +-------+-------------+-------------------+---------------+
    ++ *     | "foo" |    true     |  "./mock.foo.sh"  |     true      |
    ++ *     | "qux" |    true     | "qux" (unchanged) |     false     |
    ++ *     +-------+-------------+-------------------+---------------+
     + */
     +static int get_schedule_cmd(const char **cmd, int *is_available)
     +{
    -+	char *item;
     +	char *testing = xstrdup_or_null(getenv("GIT_TEST_MAINT_SCHEDULER"));
    ++	struct string_list_item *item;
    ++	struct string_list list = STRING_LIST_INIT_NODUP;
     +
     +	if (!testing)
     +		return 0;
    @@ builtin/gc.c: static const char *get_frequency(enum schedule_priority schedule)
     +	if (is_available)
     +		*is_available = 0;
     +
    -+	for (item = testing;;) {
    -+		char *sep;
    -+		char *end_item = strchr(item, ',');
    -+		if (end_item)
    -+			*end_item = '\0';
    ++	string_list_split_in_place(&list, testing, ',', -1);
    ++	for_each_string_list_item(item, &list) {
    ++		struct string_list pair = STRING_LIST_INIT_NODUP;
     +
    -+		sep = strchr(item, ':');
    -+		if (!sep)
    -+			die("GIT_TEST_MAINT_SCHEDULER unparseable: %s", testing);
    -+		*sep = '\0';
    ++		if (string_list_split_in_place(&pair, item->string, ':', 2) != 2)
    ++			continue;
     +
    -+		if (!strcmp(*cmd, item)) {
    -+			*cmd = sep + 1;
    ++		if (!strcmp(*cmd, pair.items[0].string)) {
    ++			*cmd = pair.items[1].string;
     +			if (is_available)
     +				*is_available = 1;
    ++			string_list_clear(&list, 0);
     +			UNLEAK(testing);
     +			return 1;
     +		}
    -+
    -+		if (!end_item)
    -+			break;
    -+		item = end_item + 1;
     +	}
     +
    ++	string_list_clear(&list, 0);
     +	free(testing);
     +	return 1;
     +}
3:  0ea5b2fc45 = 3:  faf56c078f maintenance: add support for systemd timers on Linux
-- 
2.33.0




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux