SI454P2VFO6Y6RO2NIOH6ZROURP3OTB2BBXH2F36KJT6YML6YBIAC
/*
let x = elpe
.deb_client
.command("noble", "qemu-utils", "usr/bin/qemu-nbd")
.await
.output()
.await
.unwrap();
panic!("x = {:?}", x);
*/
/// This locks a store path in order to avoid races to write to
/// the same store path.
///
/// For performance and portability reasons, this is implemented
/// using in-memory Mutexes rather than using filesystem
/// locks. This process is the only one allowed to write to the
/// store anyway.
/// A dependency, which is either a "simple" dependency, or a list of
/// alternatives.
#[derive(Debug, Clone)]
pub enum OwnedDep {
Simple(OwnedSimpleDep),
Alternatives { alt: Vec<OwnedSimpleDep> },
}
/// A single dependency.
#[derive(Debug, Clone)]
pub struct OwnedSimpleDep {
pub name: String,
pub any: bool,
pub constraints: Vec<(String, OwnedVersion)>,
}
impl<'a> From<SimpleDep<'a>> for OwnedSimpleDep {
fn from(e: SimpleDep<'a>) -> Self {
OwnedSimpleDep {
name: e.name.to_string(),
any: e.any,
constraints: e.constraints.iter().map(|(a, b)| (a.into(), b.into())).collect(),
}
}
}
*/
#[derive(Debug, Clone)]
pub struct OwnedUpstream(String);
impl<'a> PartialOrd for Upstream<'a> {
/// Following the algorithm described here:
/// https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
fn partial_cmp(&self, b: &Upstream<'a>) -> Option<std::cmp::Ordering> {
fn split_initial(s: &str) -> (&str, &str, &str) {
// Find `u`, the first digit, and `v > u`, the first non-digit after `u`.
let mut u = s.len();
let mut v = s.len();
for (n, &b) in s.as_bytes().iter().enumerate() {
if u == s.len() {
if b >= b'0' && b <= b'9' {
u = n
}
} else if b < b'0' || b > b'9' {
v = n;
break;
}
}
let (ab, c) = s.split_at(v);
let (a, b) = ab.split_at(u);
(a, b, c)
}
let mut a = self.0;
let mut b = b.0;
use std::cmp::Ordering;
loop {
let (a0, a1, a_) = split_initial(a);
let (b0, b1, b_) = split_initial(b);
// Compare a0 / b0 using the modified ASCII ordering described in the Debian manual.
let mut a0i = a0.as_bytes().iter();
let mut b0i = b0.as_bytes().iter();
loop {
match (a0i.next(), b0i.next()) {
(None, None) => break,
(Some(c), Some(d)) if c == d => continue,
(Some(b'~'), _) => return Some(Ordering::Less),
(_, Some(b'~')) => return Some(Ordering::Greater),
(Some(c), Some(d)) if c.is_ascii_alphabetic() && !d.is_ascii_alphabetic() => {
return Some(Ordering::Less);
}
(Some(c), Some(d)) if d.is_ascii_alphabetic() && !c.is_ascii_alphabetic() => {
return Some(Ordering::Greater);
}
(c, d) => return Some(c.cmp(&d)),
}
}
// If we haven't returned, a0 == b0. Compare the digits part.
let a1 = if a1.is_empty() {
0
} else {
a1.parse::<u64>().unwrap()
};
let b1 = if b1.is_empty() {
0
} else {
b1.parse::<u64>().unwrap()
};
let cmp1 = a1.cmp(&b1);
if let Ordering::Equal = cmp1 {
a = a_;
b = b_;
} else {
return Some(cmp1);
}
}
}
}
impl<'a> Ord for Upstream<'a> {
fn cmp(&self, b: &Upstream<'a>) -> std::cmp::Ordering {
self.partial_cmp(b).unwrap()
}
}
#[test]
fn test_upstream_ordering() {
let mut x = [
Upstream("~~"),
Upstream("~~a"),
Upstream("~"),
Upstream(""),
Upstream("a"),
];
let y = x.clone();
x.sort();
assert_eq!(x, y,);
}
/// Given a range of bytes `a` (inclusive) to `b` (exclusive)
/// inside the file, as well as a middle point, find the stanza
/// containing byte number `m1` in the file.
///
/// This assums a..b is large enough to contain the entire stanza
/// around m1.
let luau = stdenv.mkDerivation rec {
pname = "luau";
version = "0.621";
src = fetchFromGitHub {
owner = "luau-lang";
repo = "luau";
rev = version;
hash = "sha256-bkuYYGYcnMwQDK81ZH+74hA4XaQfVFMWvAKpy+ODCak=";
};
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = lib.optionals stdenv.cc.isClang [ llvmPackages.libunwind ];
installPhase = ''
runHook preInstall
install -Dm755 -t $out/bin luau
install -Dm755 -t $out/bin luau-analyze
install -Dm755 -t $out/bin luau-compile
install -Dm755 -t $out/lib lib*
runHook postInstall
'';
# doCheck = true;
# checkPhase = ''
# runHook preCheck
# ./Luau.UnitTest
# ./Luau.Conformance
# runHook postCheck
# '';
# passthru.updateScript = gitUpdater { };
meta = with lib; {
description = "Fast, small, safe, gradually typed embeddable scripting language derived from Lua";
homepage = "https://luau-lang.org/";
changelog = "https://github.com/luau-lang/luau/releases/tag/${version}";
license = licenses.mit;
platforms = platforms.all;
maintainers = [ ];
mainProgram = "luau";
};
};
# grpc-async = ocamlPackages.buildDunePackage rec {
# pname = "gprc-async";
# version = "0.2.0";
# src = builtins.fetchurl {
# url = "https://github.com/emilpriver/jsoo-code-mirror/archive/refs/tags/v0.0.1.tar.gz";
# sha256 = "sha256:0rby6kd9973icp72fj8i07awibamwsi3afy71dhrbq771dgz16cq";
# };
# propagatedBuildInputs = with pkgs; [
# ocamlPackages.brr
# ocamlPackages.js_of_ocaml
# ];
# };
gluten-async = ocamlPackages.buildDunePackage rec {
let gluten-async = ocamlPackages.buildDunePackage rec {
name = "toml_datetime"
version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.22.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"toml_write",
"winnow",
]
[[package]]
name = "toml_write"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
[[package]]