From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: Automatically saving package sources Date: Sat, 3 Feb 2024 17:08:46 -0500 Message-ID: References: <87il367vvf.fsf@catern.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6198"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier To: sbaugh@catern.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Feb 03 23:09:37 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rWOCf-0001S1-Hz for ged-emacs-devel@m.gmane-mx.org; Sat, 03 Feb 2024 23:09:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rWOBw-00045b-Ew; Sat, 03 Feb 2024 17:08:52 -0500 Original-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 1rWOBv-00045R-2X for emacs-devel@gnu.org; Sat, 03 Feb 2024 17:08:51 -0500 Original-Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rWOBt-0005vX-Bz for emacs-devel@gnu.org; Sat, 03 Feb 2024 17:08:50 -0500 Original-Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40fb3b5893eso26518295e9.0 for ; Sat, 03 Feb 2024 14:08:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706998127; x=1707602927; darn=gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=pPONS9XDaHzB08ZGoIKazfhBY8YPTwOsAjQ10OOkMlc=; b=AnI7B9wfgdjdgLeUK+GBm5uEnAv/btri9jNIuHhG21wMT57Ex6E8WbJjNjopTmmg8A N/wHKHe4hLhSMdw0D3NYg2NiGGsu30io/xhx7T/A+CDQb/Jz35V7WUehpw8IRj2dBJFL ownl8zJPYh21zWdhv11xonpbgXJZqEfiVcFblweGhRacq1mH9X1cW72RozvHdi81UFWT zQsMQWBpDnYDap+E6uVge0e7Ih4I+kgft62P+zcT3GGV440FkDirqeM8EWLr7VI/EmzW m7oZ1LJVXI6r7TQzhy6XBUic0r8RrvJc1U+e28BSLIdSzWE8/PEv59ZYY1ta5VEfJF9t coug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706998127; x=1707602927; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pPONS9XDaHzB08ZGoIKazfhBY8YPTwOsAjQ10OOkMlc=; b=Mqu2unCO0/vVFYHhKnu5BFryemnKyfjqFTEl23NXtNxoOc8svoRFuKs2agjhfWPCs9 VVwiUn30QV+4clIU6zXpL5b1XBg7SQIFqI/ojbh/fTNNmPBVE1IaTyabv8e5NKgwBWmC OR0rAT2tF6nqEluT5C3DDzEMp/qBTo81IXg/RSXSjM7yUwI+bXEeU2AUVxr6QXaU3Thx 41pGYLRshimHypFgmr/2qsKdTBBfZki0hZyYSPwm7GsFdcsTpxi4lx9ugssCeyyQxfmv y4tpro2Dwa/ZESvHMDTH7NSUjXO4z4fh0rilVC93WeR5zxifmkp+nKahQ3Wk3D7CNubn Mj8Q== X-Gm-Message-State: AOJu0YxViy+dYH6xky78mJ2eVILwTTx3js+BGAC2ctSRpcPaVt4kCVfd aTlhLo5u1thaPZA/seUyf2fUZsHMNeQ2QfRgYrBqsEb9kUXhC0SIFsYNvwSQE9TsDjOOh14kqZs Ba6c0pBjM8QYi1qay3VYy59v71dg= X-Google-Smtp-Source: AGHT+IGYo58YL+7dsk+zdcQ/3BNpc0eGGo7k4eXaLG+g/GZxvR+/i1VvvG3xy2FYA1B1955dw243AXRegHDMIyY7QeY= X-Received: by 2002:adf:ce8c:0:b0:33a:eed5:7072 with SMTP id r12-20020adfce8c000000b0033aeed57072mr5074293wrn.71.1706998127344; Sat, 03 Feb 2024 14:08:47 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 3 Feb 2024 17:08:46 -0500 In-Reply-To: <87il367vvf.fsf@catern.com> Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=stefankangas@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315839 Archived-At: sbaugh@catern.com writes: > It is nice for installed ELPA packages to be reinstalled when Emacs is > upgraded or changed, since there can be changes to autoload generation, > the byte compiler, the native compiler, or other things which will > change the output from the package installation. Yup, this is a long-standing problem. I think there are some bugs in the bug tracker about it too. Maybe they can give some ideas. > Furthermore, it is nice (where possible) for this reinstallation to > happen with the same version of the package rather than by fetching the > latest version from ELPA. This minimizes the number of changes that > happen at once. > > However, right now there is no easy way to reinstall a package from the > same sources it was originally installed from, because those sources are > not saved separately from the package itself. They are all mixed > together in the installed package directory. This makes it impossible > to produce a "clean slate" environment for reinstalling the package, > which (since packages can create arbitrary files during > byte-compilation) means the package can't be reinstalled in a way that's > identical to its original installation. > > If package.el supported saving the package source separately, however, > it could simply reinstall from that. > > I would like to add an option package-save-sources which makes > package.el automatically save the package source for the currently > installed package version in a separate directory. Perhaps in > ~/.emacs.d/elpa-sources. > > When package-save-sources is enabled, then package-reinstall would > reinstall a package from the saved source rather than upgrading the > package. package-upgrade would delete the saved source and fetch a new > version. > > Does this seem like a reasonable feature to add? Yes, I think it could be useful. I'm copying in Stefan Monnier too. One complication that immediately comes to mind is how to find the sources of those packages from *Help*. I think it will expect to find them in ~/.emacs.d/elpa rather than ~/.emacs.d/elpa-sources if the package is loaded from there. Maybe some special handling is needed. Also, do we need to put it behind an option? I guess I don't understand the use-case for _not_ wanting this feature. > As an additional benefit, elpa-sources would be useful for reviewing > changes in the source when upgrading packages. It could be optionally > maintained as a VCS repository, with packages saved to a constant path > based on their name (e.g. elpa-sources/xref.el instead of > elpa-sources/xref-1.2.3/xref.el). Then a VCS could be used to review > the diff resulting from an upgrade. This would be useful for any user > who wants to scrutinize package code changes before installing them.