Skip to content

Commit a858612

Browse files
committed
open-pr: special-case OpenSSH's version strings
The release announcments use a different version string than the file name; Let's automagically transform the former into the latter. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 3b65b81 commit a858612

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

update-scripts/version/openssh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env node
2+
3+
// The `openssh` version looks like this: 9.1p1. But the website calls it 9.1_P1.
4+
// Let's auto-translate that.
5+
6+
(async () => {
7+
const version = process.argv[2].replace(/_P/, 'p')
8+
9+
const fs = require('fs')
10+
const lines = fs.readFileSync('PKGBUILD').toString('utf-8').split(/\r?\n/)
11+
lines.forEach((line, i) => {
12+
if ((match = line.match(/^(\s*pkgver=)\S+/))) {
13+
lines[i] = `${match[1]}${version}`
14+
} else if ((match = line.match(/^(\s*pkgrel=)\S+/))) {
15+
lines[i] = `${match[1]}1`
16+
}
17+
})
18+
fs.writeFileSync('PKGBUILD', lines.join('\n'))
19+
})().catch(console.log)

0 commit comments

Comments
 (0)