From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d21iM-0004EW-87 for guix-patches@gnu.org; Sat, 22 Apr 2017 16:33:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d21iI-0005xF-8l for guix-patches@gnu.org; Sat, 22 Apr 2017 16:33:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:36564) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d21iI-0005xB-5A for guix-patches@gnu.org; Sat, 22 Apr 2017 16:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d21iI-0002Bu-08 for guix-patches@gnu.org; Sat, 22 Apr 2017 16:33:02 -0400 Subject: bug#26544: [PATCH v4 06/10] scripts: Make boot-parameters label include generation number and time. Resent-Message-ID: Date: Sat, 22 Apr 2017 22:32:42 +0200 From: Danny Milosavljevic Message-ID: <20170422223242.03d6039e@scratchpost.org> In-Reply-To: <20170421123714.2395-7-dannym@scratchpost.org> References: <86h91ikw4m.fsf@gmail.com> <20170421123714.2395-1-dannym@scratchpost.org> <20170421123714.2395-7-dannym@scratchpost.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26544@debbugs.gnu.org On Fri, 21 Apr 2017 14:37:10 +0200 Danny Milosavljevic wrote: > (define (system->boot-parameters system number time) > (unless-file-not-found > - (let* ((params (read-boot-parameters-file system))) > - params))) > + (let* ((params (read-boot-parameters-file system)) > + (label (boot-parameters-label params))) > + (boot-parameters > + (inherit params) > + (label (string-append label " (#" > + (number->string number) ", " > + (seconds->string time) ")")))))) Every time I see that I wonder whether I don't make some other part (like read-boot-parameters-file or something) to do the label extension. In theory that would be nicer than fixing it up later - I do the latter here. And on first sight, one might be able to do that for the old generations (because the timestr in the label is just the mtime of the system directory). But the label should also contain the generation number - which is currently usually being extracted by the procedure "generation-numbers" for an entire profile (but the caller of system also is able to override the generation numbers of profile-boot-parameters and profile-grub-entries - not sure why); I don't find generation-numbers exactly straightforward - I'd rather not mess with it. Also, the caller zips the result together with SYSTEMS somehow and it would be easy for me to mess up the association. Therefore, I opted for this version - which is a lot less risky. If someone is more familiar with generation-numbers and knows why it's possible to override the generation numbers (usually by a one-element list), please feel free to post a patch that integrates this part into read-boot-parameters-file later. Note: The current generation doesn't need its label extended.