Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I declare a dependency that can be fulfilled by one of many differently named packages?

In a Raku distribution how do I depend on either Foo::Bar or Foo::Baz without requiring both?

like image 562
ugexe Avatar asked Dec 01 '20 17:12

ugexe


People also ask

How NuGet resolve package dependencies?

When the NuGet restore process runs prior to a build, it resolves dependencies first in memory, then writes the resulting graph to a file called project. assets. json . It also writes the resolved dependencies to a lock file named packages.

How do I check deb package dependencies?

If you have downloaded a DEB package on your system and want to know which dependencies will be installed along with the package, you can use the -I (capitalized i, not lowercase L) or --info flag with the command.

What is a dependency in R?

Dependencies are invitations for other people to break your package. — Josh Ulrich, private communication. Welcome to the seventeenth post in the relentlessly random R ravings series of posts, or R4 for short. Dependencies. A truly loaded topic.


1 Answers

You can use "any": [$dependency-spec1, $dependency-spec2]. This could look like one of the following (depending on if you use a plain string dependency or a hash):

"depends" : {
    "runtime" : {
        "any" : [
            "Foo::Bar",
            "Foo::Baz"
        ]
    }
}
"depends" : {
    "runtime" : {
        "any" : [
            {
                "name" : "Foo::Bar"
            },
            {
                "name" : "Foo::Baz"
            }
        ]
    }
}

This isn't constrained to raku dependencies either. For instance to declare a dependency on either curl or wget one can do:

"depends" : {
    "runtime" : {
        "any" : [
            "curl:from<bin>",
            "wget:from<bin>"
        ]
    }
}

which would cause zef install $whatever to inform the user of the missing programs if none are found.

like image 87
ugexe Avatar answered Sep 21 '22 21:09

ugexe