With tools like npm we can install a specific version
npm install foo#1.2.0
How do you install a specific version using spago install?
Firstly, that's not what spago install does. Instead of "adding a package to your project", spago install downloads all packages that are currently referenced in your spago.dhall file.
Secondly, the idea with Spago is that you don't choose a specific package version. Instead what you choose is a "snapshot", which is a collection of certain versions of all available packages that are guaranteed to compile and work together. This is a measure intended to prevent version conflicts and versioning hell (and this is similar to how Haskell stack works)
The snapshot is defined in your packages.dhall file, and then you specify the specific packages that you want to use in spago.dhall. The version for each package comes from the snapshot.
But if you really need to install a very specific version of a package, and you really know what you're doing, then you can modify the snapshot itself, which is described in packages.dhall.
By default your packages.dhall file might look something like this:
let upstream =
https://raw.githubusercontent.com/purescript/package-sets/psc-0.13.5-20200103/src/packages.dhall sha256:0a6051982fb4eedb72fbe5ca4282259719b7b9b525a4dda60367f98079132f30
let additions = {=}
let overrides = {=}
in upstream // additions // overrides
This is the default template that you get after running spago new.
In order to override the version for a specific package, add it to the overrides map like this:
let overrides =
{ foo =
upstream.foo // { version = "v1.2.0" }
}
And then run spago install. Spago should pull in version 1.2.0 of the foo package for you.
Related
I'm trying to add a library (a cmake project) to my Yocto project/image.
The package essentially consists of one static library (named hello.a) with some header files in C.
I wrote a recipe and could configure, compile, package it.
The packaging results are four files {hello-dbg, hello-dev, hello-src, hello-staticdev}.deb
So there is no hello.deb.
And that seems to be a problem preventing me to create image.
The following packages have unmet dependencies:
packagegroup-utils-extra : Depends: hello but it is not installable
E: Unable to correct problems, you have held broken packages.
When I try to add that by defining:
FILES_${PN} += "/usr/lib/hello.a"
bitbake does not allow adding static libraries to anything but staticdev -> so that does not work.
My question is then, as the title says, how to (force Yocto to) create ${PN}.deb file?
The empty packages (i.e. containing no files) are not created by default. If you want to override it, you can do it via the ALLOW_EMPTY variable for a package like this:
ALLOW_EMPTY:${PN} = "1"
You can also check the official documentation for ALLOW_EMPTY.
Just for clarification:
You can install the ${PN} package (it won't install any file on the target system).
As before, your static library will still be shipped in the ${PN}-staticdev package.
Here is a link to my package.
So after updating my Swift Package and its version tag,
I am getting the following errors when I try to update the package in my project that consumes the package.
Missing package product 'MyPackage1'
❕Package resolution errors must be fixed before building
https://github.com/ElevatedUnderdogs/PackageTest2.git
has no Package.swift manifest for version 1.0.1
1.0.0 is the original. 1.0.1 is my updated version.
Does this mean I need to create a new Package.swift for every single version? I don't even see a place in the Package.swift where I can signify the current version.
Things I've tried:
reseting the package cache in the consuming project.
"updating to latest package versions"
Deleting the Swift Package, and then trying to add it again. Before adding it completes, I get: "MyProject.git has no Package.swift manifest for version 1.0.1.
Package.swift is in the root directory.
In my case, the tag was updated on an incorrect remote branch which wasn't merged to yet, so the tag's corresponding commit didn't have the Package.swift file. It is a good practice to check the commit hash of the version you are trying to access to verify that it has the correct code.
I have one project I'd like to publish as packages targeting two Python versions (3.6 and 3.8).
What I understand:
How to install and activate different python versions using pyenv.
How to get poetry to create virtual environments that correspond to the chosen Python version.
How to setup pyproject.toml to specify the python version, manage dependencies, and publish a package using this configuration.
What I do not understand: how can I publish the same package for more than one Python version? I can't be the only one with this use-case right?
Does need two pyproject.toml files? (one for each python version and set of corresponding dependencies...)
Are there established ways of doing this with Poetry, or are other tools/workflows necessary?
Edit
Doing a bit more digging, I found this https://python-poetry.org/docs/versions/#multiple-constraints-dependencies which looks like it might be relevant.
Here's the example at the link above.
[tool.poetry.dependencies]
foo = [
{version = "<=1.9", python = "^2.7"},
{version = "^2.0", python = "^3.4"}
]
I've also found you can specify the Python version using poetry add like this...
poetry add cleo --python 3.6.10
Which adds dependencies in pyproject.toml like this...
cleo = {version = "^0.8.1", python = "3.6.10"}
Going to experiment and see if this works.
You probably need something like that in your pyproject.toml:
[tool.poetry.dependencies]
python = '3.6 || 3.8'
But I am not sure on the exact notation, it's a bit vague.
It seems to generate a setup.py with the following:
'>=3.6, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.7.*'
So that would include 3.9, 3.10, etc. and this is incorrect.
No. You don't need to create multiple pyproject.toml files or otherwise create separate workflows for each Python version you're targeting (for this specific situation targeting similar versions at least).
You can simply use dependency syntax to say you want to target >=3.6<4.0 like this...
[tool.poetry.dependencies]
python = '^3.6'
And then add dependencies similarly...
poetry add <dependency> python ^3.6
Which results in something like this...
[tool.poetry.dependencies]
python = '^3.6'
cleo = {version = "^0.8.1", python = "^3.6"}
pyyaml = {version = "^5.4.1", python = "^3.6"}
...
This worked, though I further went and made some of dependencies less specific to avoid incompatibilities on certain hosts.
pyyaml = {version = "^5.0", python = "^3.6"}
...
I want to be able to update my system by installing packages created by Yocto instead of installing the whole image created by it. The objective is to update some software without affecting the system configuration. However, I want to avoid updating a package without updating other runtime dependencies that changed to avoid leaving the system in an inconsistent state.
The approach that I'm following until now is to set version restrictions to package. Suppose I have a layer with recipes A.bb and B.bb that creates packages A and B. I'm using RDEPENDS on A.bb to set package B as a dependency of package A as follows:
RDEPENDS_${PN} = " B (= hard-coded-current-version)"
where hard-coded-current-version is something like 1.1-r1. However, what I want is something like:
RDEPENDS_${PN} = " B (= parametric-current-version)"
where parametric-current-version would be something like ${PE_B}.${PV_B}-${PR_B}.
How do I specify a version restriction of package A to be the current version of package B?
I am trying to install the MongoDB swift driver using the swift package driver. I followed their instructions and installed the mongo-c-driver using home-brew. I then created a new directory and within a new project using:
swift package init --type executable
I then added the dependencies to the Package.swift file.
When trying to run any command that summonsswift package resole in the directory, i get the following error:
error: the package PackageReference(identity: "mongo-swift-driver", name: nil, path: "https://github.com/mongodb/mongo-swift-driver.git", isLocal: false) # 0.0.2 contains revisioned dependencies:
PackageReference(identity: "swift-bson", name: nil, path: "https://github.com/mongodb/swift-bson", isLocal: false) # master
PackageReference(identity: "swift-mongoc", name: nil, path: "https://github.com/mongodb/swift-mongoc", isLocal: false) # master
I made sure that everything is up to date and that the first line of the Package.swift is // swift-tools-version:4.0
I would like to know what these revisioned dependencies are, as i have not found anything useful. And how this error can be resolved.
The Swift Evolution proposal that introduced the ability to specify branches instead of revisions in SPM packages (SE-0150 says this:
While this feature [specifying branches] is useful during development, a package's dependencies should be updated to point at versions instead of branches before that package is tagged for release. This is because a released package should provide a stable specification of its dependencies, and not break when a branch changes over time. To enforce this, it is an error if a package referenced by a version-based dependency specifies a branch in any of its dependencies.
It looks like the version 0.0.2 of the parent package that you're using did not follow the rule to switch to specific versions for its dependencies and SPM doesn't allow this.
If possible, you should try to use a newer version of the parent package that fixes this issue. If a newer version doesn't exist, you may have to override the dependency and fix it yourself (I believe you can use swift package edit to do that — or fork the dependency and point to your own repo, of course.)