From: Phil <phil@beadling.co.uk>
To: guix-devel@gnu.org
Subject: Pinning package inputs using inferiors?
Date: Thu, 20 Oct 2022 22:37:21 +0100 [thread overview]
Message-ID: <87czam9nxq.fsf@beadling.co.uk> (raw)
Hi all,
A change in a package ("dependency" in the below example) in a channel I
own has caused a conflict in another package in the same channel that depends
on it ("test-package" in the below). Whilst fixing the "test-package"
package is the right solution, this is too complicated in do in the
short-term. I need to pin "dependency" to v1.0 in test-pacakge's
propagated-inputs. Simultaneously, other packages need the new update to
the "dependency" package to use this functionality to deliver new
functionality that can't wait.
This isn't a one-off situation; this happens frequently and I'm
interested in how other Guixers resolve this with as little friction to
users as possible?
One brainwave I had was to use inferiors - but this doesn't seem to
work. Continuing from the above example we could define access to a
historical v1.0 of the dependency package for the test-package like so:
(define dependency-inferior
;; An inferior containing dependency v1.0.
(inferior-for-channels dependency-channels))
If we do this then I can get the below manifest to work, just like the
example in the manual:
(packages->manifest
(list (specification->package "python") ;; useful for testing
;; Remove current dependency add old dependency
(package/inherit test-package
(propagated-inputs
(modify-inputs (package-propagated-inputs test-package)
(delete "dependency"))))
(car (lookup-inferior-packages dependency-inferior "dependency"
"1.0"))))
But this isn't a practical approach - knocking "dependency" out of
test-package's inputs means the unit tests would fail, so I would also
have to delete the check phase - I don't want to do this, it's too much
compromise.
Instead I was hoping to replace the dependency *inside* the package
definition with an inferior like this, so it's still available whilst
the inherited package is being built.
(packages->manifest
(list (specification->package "python") ;; useful for testing
;; Remove current dependency, add old dependency
(package/inherit test-package
(propagated-inputs
(modify-inputs (package-propagated-inputs test-package)
(replace "dependency" (car (lookup-inferior-packages dependency-inferior "dependency" "1.0"))))))))
When I try this, depending what operation I perform on the manifest, I
normally get some type mismatch telling me I've used a package-inferior
when Guile was expecting a package. Nothing works, alas.
Thus I'm assuming the two types are not completely substitutable, and
this won't work?
Given this, the workaround I am employing is to replace a single package
definition of "dependency" with locally scoped definitions for each
package that uses it. This is duplication feels suboptimal.
FWIW, a much more involved solution is to store the dependency package
inside test-package's project repo (rather than my channel), and then
automate copying this into the channel at build time. This is a cool
exercise, but means we are decentralizing the channel's package
definitions and co-locating them across many repos - which feels not in
the spirit of Guix, and more like how requirements.txt files are
co-located in (non-Guix) python projects.
My questions are:
1. Is my above use of inferiors always doomed, or something we code make
work with changes to Guix core?
2. Is there another way of handling the situation elegantly without
using inferiors or duplicating package definitions at module scope.
Any advice or comments gladly received!
Cheers,
Phil.
next reply other threads:[~2022-10-20 21:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 21:37 Phil [this message]
2022-10-21 9:36 ` Pinning package inputs using inferiors? zimoun
2022-10-21 21:08 ` Phil
2022-10-22 12:33 ` david larsson
2022-10-22 19:04 ` Efraim Flashner
2022-10-23 5:58 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2022-10-24 8:06 ` zimoun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87czam9nxq.fsf@beadling.co.uk \
--to=phil@beadling.co.uk \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).