Merge remote-tracking branch 'origin/master' into ghc-9.2

This commit is contained in:
Adam Bergmark 2021-12-29 00:27:18 +01:00
commit 6eb42b0d23
3 changed files with 263 additions and 264 deletions

View File

@ -488,6 +488,27 @@ commenter clear
Repeat the second command until no updates are made to build-constraints.yaml.
#### Checking for new releases
Run `stack update` before doing this.
`commenter outdated` looks through all bounds issues and library
compilation failures and compares the marked version with the latest hackage release. Example output is
```
Fin mismatch, manual: 0.2.8.0, hackage: 0.2.9.0
aeson mismatch, auto: 1.5.6.0, hackage: 2.0.2.0
```
where "manual" means the bound was added manually by a curator,
perhaps due to a compilation failure so we could try re-enabling the
package. "auto" means it's part of the sections generated by
`commenter`, to update that run the `Re-enabling` step as documented
above.
`outdated` only finds packages that are in the auto generated
sections, or that are of the form `- package < 0 # $version`.
#### Notes
* Please make sure to separate bounds issues from compilation failures/test run failures, as we cannot verify that a package builds or that tests pass without running the build!

File diff suppressed because it is too large Load Diff

View File

@ -23,29 +23,51 @@ pub fn add(lib: Vec<String>, test: Vec<String>, bench: Vec<String>) {
});
lines.sort();
lines
})
});
}
enum VersionTag {
Manual(String),
Auto(String),
}
impl VersionTag {
fn tag(&self) -> &'static str {
match self {
VersionTag::Manual(_) => "manual",
VersionTag::Auto(_) => "auto",
}
}
fn version(&self) -> &str {
match self {
VersionTag::Manual(s) => &s,
VersionTag::Auto(s) => &s,
}
}
}
pub fn outdated() {
let mut all = vec![];
handle(false, |_loc, lines| {
let mut all: Vec<String> = vec![];
let disabled = handle(false, |_loc, lines| {
all.extend(lines);
vec![]
});
let mut map = BTreeMap::new();
let mut map: BTreeMap<String, VersionTag> = BTreeMap::new();
for DisabledPackage { package, version } in disabled {
map.insert(package, VersionTag::Manual(version));
}
let mut support: BTreeMap<(String, String), BTreeSet<(String, String)>> = BTreeMap::new();
for v in all.into_iter() {
let caps = regex!("tried ([^ ]+)-([^,-]+),").captures(&v).unwrap();
let package = caps.get(1).unwrap().as_str().to_owned();
let version = caps.get(2).unwrap().as_str().to_owned();
map.insert(package.clone(), version.clone());
map.insert(package.clone(), VersionTag::Auto(version.clone()));
if let Some(caps) = regex!("does not support: ([^ ]+)-([^-]+)").captures(&v) {
let dep_package = caps.get(1).unwrap().as_str().to_owned();
let dep_version = caps.get(2).unwrap().as_str().to_owned();
let entry = support
.entry((dep_package, dep_version))
.or_default();
let entry = support.entry((dep_package, dep_version)).or_default();
entry.insert((package, version));
}
}
@ -54,41 +76,82 @@ pub fn outdated() {
let mut i = 0;
for (package, version) in map {
if is_boot(&package) {
continue;
}
if i % 100 == 0 {
println!("{:02}%", ((i as f64 / entries as f64) * 100.0).floor());
}
i += 1;
let latest = latest_version(&package);
if version != latest {
if version.version() != latest {
println!(
"{} mismatch, snapshot: {}, hackage: {}",
package, version, latest
"{} mismatch, {}: {}, hackage: {}",
package,
version.tag(),
version.version(),
latest
);
}
}
for ((package, version), dependents) in support {
if is_boot(&package) {
continue;
}
if i % 100 == 0 {
println!("{:02}%", ((i as f64 / entries as f64) * 100.0).floor());
}
i += 1;
let latest = latest_version(&package);
if version != latest {
let max = 3;
let dependents_stripped = dependents.len().checked_sub(max).unwrap_or(0);
let dependents = dependents
.into_iter()
.take(max)
.map(|(p, v)| format!("{}-{}", p, v))
.collect::<Vec<String>>()
.join(", ");
let dependents = if dependents_stripped > 0 {
format!("{} and {} more", dependents, dependents_stripped)
} else {
dependents
};
println!(
"{} mismatch, snapshot: {}, hackage: {}, dependents: {}",
package,
version,
latest,
dependents
.into_iter()
.map(|(p, v)| format!("{}-{}", p, v))
.collect::<Vec<String>>()
.join(", "),
package, version, latest, dependents,
);
}
}
}
fn is_boot(package: &str) -> bool {
[
"Cabal",
"base",
"bytestring",
"containers",
"containers",
"directory",
"filepath",
"deepseq",
"ghc",
"ghc-boot",
"ghc-boot-th",
"ghc-prim",
"integer-gmp",
"process",
"stm",
"template-haskell",
"text",
"time",
]
.contains(&package)
}
fn latest_version(pkg: &str) -> String {
String::from_utf8(
Command::new("latest-version")
@ -112,16 +175,36 @@ enum State {
Done,
}
fn handle<F>(write: bool, mut f: F)
struct DisabledPackage {
package: String,
version: String,
}
fn parse_disabled_package(s: &str) -> Option<DisabledPackage> {
if let Some(caps) = regex!(r#"- *([^ ]+) < *0 *# *([\d.]+)"#).captures(s) {
let package = caps.get(1).unwrap().as_str().to_owned();
let version = caps.get(2).unwrap().as_str().to_owned();
Some(DisabledPackage { package, version })
} else {
None
}
}
fn handle<F>(write: bool, mut f: F) -> Vec<DisabledPackage>
where
F: FnMut(Location, Vec<String>) -> Vec<String>,
{
let path = "build-constraints.yaml";
let mut new_lines: Vec<String> = vec![];
let mut disabled_packages: Vec<DisabledPackage> = vec![];
let mut state = State::LookingForLibBounds;
let mut buf = vec![];
for line in read_lines(path).map(|s| s.unwrap()) {
if let Some(disabled_package) = parse_disabled_package(&line) {
disabled_packages.push(disabled_package);
}
match state {
State::LookingForLibBounds => {
if line == r#" "Library and exe bounds failures":"# {
@ -189,6 +272,8 @@ where
}
file.flush().unwrap();
}
disabled_packages
}
enum Location {