File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -141,10 +141,16 @@ jobs:
141
141
shell : bash
142
142
run : |
143
143
cd "/usr/src/$REPO/$PACKAGE_TO_UPGRADE" &&
144
- sed -i \
145
- -e "s/^\\(pkgver=\\).*/\\1$UPGRADE_TO_VERSION/" \
146
- -e 's/^pkgrel=.*/pkgrel=1/' \
147
- PKGBUILD &&
144
+ update_script="$GITHUB_WORKSPACE/version/checksums/$PACKAGE_TO_UPGRADE"
145
+ if test -f "$update_script"
146
+ then
147
+ $update_script "$UPGRADE_TO_VERSION"
148
+ else
149
+ sed -i \
150
+ -e "s/^\\(pkgver=\\).*/\\1$UPGRADE_TO_VERSION/" \
151
+ -e 's/^pkgrel=.*/pkgrel=1/' \
152
+ PKGBUILD
153
+ fi &&
148
154
git update-index -q --refresh &&
149
155
if git diff-files --exit-code
150
156
then
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ // The `PKGBUILD` file of `bash` is sligtly different from most other packages
4
+ // as it sets pkgver through a _basever part and a _patchlevel part.
5
+
6
+ // Therefore we need to be a bit more careful when updating than just replacing
7
+ // the value of pkgver.
8
+
9
+ ( async ( ) => {
10
+ const version = process . argv [ 2 ]
11
+
12
+ let [ , basever , patchlevel ] = version . match ( / ^ ( \d + \. \d + ) \. ( \d + ) / )
13
+ let match
14
+
15
+ const fs = require ( 'fs' )
16
+ const lines = fs . readFileSync ( 'PKGBUILD' ) . toString ( 'utf-8' ) . split ( / \r ? \n / )
17
+ lines . forEach ( ( line , i ) => {
18
+ if ( ( match = line . match ( / ^ ( \s * _ b a s e v e r = ) \S + / ) ) ) {
19
+ lines [ i ] = `${ match [ 1 ] } ${ basever } `
20
+ } else if ( ( match = line . match ( / ^ ( \s * _ p a t c h l e v e l = ) \S + \s ( .* ) / ) ) ) {
21
+ lines [ i ] = `${ match [ 1 ] } ${ patchlevel . toString ( ) . padStart ( 3 , "0" ) } ${ match [ 2 ] } `
22
+ } else if ( ( match = line . match ( / ^ ( \s * p k g r e l = ) \S + / ) ) ) {
23
+ lines [ i ] = `${ match [ 1 ] } ${ 1 } `
24
+ }
25
+ } )
26
+ fs . writeFileSync ( 'PKGBUILD' , lines . join ( '\n' ) )
27
+ } ) ( ) . catch ( console . log )
You can’t perform that action at this time.
0 commit comments