From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id mCshLzL/imaspgAAe85BDQ:P1 (envelope-from ) for ; Sun, 07 Jul 2024 20:48:58 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id mCshLzL/imaspgAAe85BDQ (envelope-from ) for ; Sun, 07 Jul 2024 22:48:50 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=autistici.org header.s=stigmate header.b=U5G1aS53; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1720384937; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=jqmJywMAmKIxz6GnC9iVndXewd7cWcvau4j9ZU9s/9w=; b=ZokfsIHF3FRoKhWxs1NbzESijwGHtiLT5EImmaWuDQ07G8juuYhfFmaCSHPmf1wr+O9wWC UhpodJ4q1HrkE+6Ujd3xVv6OXPc2ndAjaZzDzxZ6K4hCbKxAY1nE6UkuuafolcUGtkfA/q F+uERRmNnOv3JSnAYkpb3jHPRBQ6ST21NFlRgkpzFXTqInJ76/2/lOmX72QJQlp7boMMqC e4IJcYsRwTQeR1KNXu6a2SxEr40ndnRM6aEIXX+vfKAXRxX3//Z+DiiELFQDlxBuI2l0zw 3OrO9U70RiRdl0aSEndapYU0ipqVMVW/GVidZE3Sxg9y0/JEVT0KyYeWzFtygA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=autistici.org header.s=stigmate header.b=U5G1aS53; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1720384937; a=rsa-sha256; cv=none; b=kZPYC8PRTEY+xE+eSmiKAabgyd3X9DjNCq9joE8dNFoeHWgAyscSbWXh0qq9pYxDNogsmJ 79BIXs4Z8kKzlU9akqg5h95ba7hmWmqqg6O5TSkUHMAAM5NwHNk0w8hSSgusMA2nIm99o5 nMX9xqrNwFqqKYHuS/glwpBGIwSWydxG3K30G4trcFv1pyoQ8Wd8HSeRFqWMQoNNG0XVdt tDmYLzbQea7Xh8wr5siFpJ+Wp9ZcJAv7BOKzhEmUqr5XbZGTJIXg3Ms2s+0+WN1nKNt/Yr C+q7upYeQAloCZCPbr3FMSGUuGhGiuHm0iNconyTZjNWw6pYrwS5KWFeuhnpFg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 73ADC53882 for ; Sun, 7 Jul 2024 22:42:17 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQYi1-0007yq-Eu; Sun, 07 Jul 2024 16:42:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQYhq-0007yQ-HG for guix-patches@gnu.org; Sun, 07 Jul 2024 16:42:00 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQYhp-0007lP-IQ for guix-patches@gnu.org; Sun, 07 Jul 2024 16:41:58 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sQYht-0005Jg-V5 for guix-patches@gnu.org; Sun, 07 Jul 2024 16:42:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71639] [PATCHv2 0/5] Improve on restic-backup-service Resent-From: paul Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 07 Jul 2024 20:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71639 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Richard Sent Cc: 71639@debbugs.gnu.org Received: via spool by 71639-submit@debbugs.gnu.org id=B71639.172038487520377 (code B ref 71639); Sun, 07 Jul 2024 20:42:01 +0000 Received: (at 71639) by debbugs.gnu.org; 7 Jul 2024 20:41:15 +0000 Received: from localhost ([127.0.0.1]:49241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQYh8-0005IZ-Uq for submit@debbugs.gnu.org; Sun, 07 Jul 2024 16:41:15 -0400 Received: from confino.investici.org ([93.190.126.19]:54305) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQYh3-0005IN-7w for 71639@debbugs.gnu.org; Sun, 07 Jul 2024 16:41:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1720384856; bh=jqmJywMAmKIxz6GnC9iVndXewd7cWcvau4j9ZU9s/9w=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=U5G1aS53iJc2g4cd9JQQwm6jqVcgiggfcG8C+BaQ19Ower3VgYGl3V9NqRImUYmh2 oO3qYlUr51MrskmIrCL6uzG/fjbEebUC5JXT77iQZpUQpO1jE7blPzot2HgQRbvSBq aO8hcWyGsfCQDlRbiWNku06oT0DgFPYY9ikrVRBo= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4WHK0814Wsz113Q; Sun, 7 Jul 2024 20:40:56 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4WHK080TgBz113B; Sun, 7 Jul 2024 20:40:56 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------0AUI3b7ugkoDOwffHzMeGDkc" Message-ID: <18da4124-465c-fa58-6e8f-d9daf751443c@autistici.org> Date: Sun, 7 Jul 2024 22:40:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 References: <87ikxvvy0o.fsf@freakingpenguin.com> Content-Language: en-US In-Reply-To: <87ikxvvy0o.fsf@freakingpenguin.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: paul X-ACL-Warn: , paul via Guix-patches From: paul via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 73ADC53882 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -6.99 X-Spam-Score: -6.99 X-TUID: IRyc7MAScwlS This is a multi-part message in MIME format. --------------0AUI3b7ugkoDOwffHzMeGDkc Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Richard, On 6/27/24 05:56, Richard Sent wrote: > I'll take a look at it and see what the code looks like. It might be a > bit of effort to get that working cleanly while avoiding code dupe. For > instance, setting RESTIC_PASSWORD(_COMMAND) in both init and backup > program actions. Yes, 100% agree. What I would do is (and probably there is a better way): - rename restic-backup-job-program to restic-action-job-program or something similar. the procedure would be the same but it would take two additional arguments: an action-name argument or similar that would replace all instances of "backup" and I think this new procedure should not access the files field of the job record but it instead it would take an action-arguments argument which would replace #$@files with #$@action-arguments in the execlp call. This way, I hope, it could be general enough to support additional actions besides init in the future, such as purge or restore. - create a new restic-backup-job-program and a restic-init-job-program or similar procedures that would call the new generic restic-action-job-program - inside the restic-guix procedure I'd rename the programs list to backup-programs and I would create a similar list for the init action with #f placeholders for jobs that do not require initializing, and I would check the conditional inside the backup procedure something like: (define (get-program name programs) [...]) (define (init args) [...]) (define (backup args) (define name (third args)) (define backup-program (get-program name backup-programs)) (define init-program (get-program name init-programs)) (when init-program (init args)) (execlp backup-program backup-program)) this requires the init action not to exec the script resulting from the gexp but I can't think of a reason why it could be problematic right now so I guess it is ok. Please take all of the above as a proposal there are for sure things to make better. > Thanks for the feedback! Thank you very much for your work, giacomo --------------0AUI3b7ugkoDOwffHzMeGDkc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi Richard,

On 6/27/24 05:56, Richard Sent wrote:
I'll take a look at it and see what the code looks like. It might be a
bit of effort to get that working cleanly while avoiding code dupe. For
instance, setting RESTIC_PASSWORD(_COMMAND) in both init and backup
program actions.
Yes, 100% agree. What I would do is (and probably there is a better way):

- rename restic-backup-job-program to restic-action-job-program or something similar. the procedure would be the same but it would take two additional arguments: an action-name argument or similar that would replace all instances of "backup" and I think this new procedure should not access the files field of the job record but it instead it would take an action-arguments argument which would replace #$@files with #$@action-arguments in the execlp call. This way, I hope, it could be general enough to support additional actions besides init in the future, such as purge or restore.

- create a new restic-backup-job-program and a restic-init-job-program or similar procedures that would call the new generic restic-action-job-program

- inside the restic-guix procedure I'd rename the programs list to backup-programs and I would create a similar list for the init action with #f placeholders for jobs that do not require initializing, and I would check the conditional inside the backup procedure something like:
(define (get-program name programs)
  [...])

(define (init args)
 [...])

(define (backup args)
  (define name (third args))
  (define backup-program (get-program name backup-programs))
  (define init-program (get-program name init-programs))
  (when init-program
    (init args))
  (execlp backup-program backup-program))

this requires the init action not to exec the script resulting from the gexp but I can't think of a reason why it could be problematic right now so I guess it is ok.

Please take all of the above as a proposal there are for sure things to make better.

Thanks for the feedback!

Thank you very much for your work,

giacomo

--------------0AUI3b7ugkoDOwffHzMeGDkc--