Skip to content

Commit ac1425f

Browse files
authored
Adjust clean jobs for CDDL extracts (#1414)
The clean jobs did not expect multiple extracts per property and would happily have dropped CDDL extracts.
1 parent f91335b commit ac1425f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

tools/clean-abandoned-files.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ function checkDir(path, index) {
1515
const dir = fs.readdirSync(path);
1616
for (let filename of dir) {
1717
const subdir = path.split("/")[1];
18-
if (!index.results.find(spec => spec[subdir] === subdir + "/" + filename)) {
18+
const fullname = subdir + "/" + filename
19+
if (!index.results.find(spec =>
20+
spec[subdir] === fullname ||
21+
spec[subdir]?.find(extract => extract.file === fullname))) {
1922
fs.unlinkSync(path + "/" + filename);
2023
}
2124
}

tools/clean-dropped-specs-files.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ async function cleanExtractFolder(folder, crawlResults) {
2626
for (const filename of dir) {
2727
const specname = path.basename(filename, path.extname(filename));
2828
const spec = crawlResults
29-
.find(s => s.shortname === specname || s.series?.shortname === specname);
29+
.find(s => s.shortname === specname ||
30+
s.series?.shortname === specname ||
31+
// CDDL extracts may end with CDDL module name
32+
s.shortname.startsWith(specname + '-')
33+
);
3034
if (!spec) {
3135
const fileToDrop = path.join(folder, filename);
3236
await fs.unlink(fileToDrop);

0 commit comments

Comments
 (0)