Skip to content

Commit 986dc8c

Browse files
committed
Use apply_patches()
1 parent 16d098f commit 986dc8c

File tree

3 files changed

+253
-13
lines changed

3 files changed

+253
-13
lines changed

upstream_utils/update_mpack.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ def open_repo(self, *, err_msg_if_absent):
5959
exit(1)
6060
os.chdir(dest)
6161

62+
def apply_patches(self):
63+
if self.pre_patch_hook is not None:
64+
self.pre_patch_hook()
65+
66+
for f in self.patch_list:
67+
git_am(
68+
os.path.join(
69+
self.wpilib_root, f"upstream_utils/{self.name}_patches", f
70+
),
71+
**self.patch_options,
72+
)
73+
6274
def clone(self):
6375
self.open_repo(err_msg_if_absent=None)
6476

@@ -80,21 +92,9 @@ def main():
8092
mpack.clone()
8193

8294
wpilib_root = mpack.wpilib_root
83-
upstream_root = os.getcwd()
8495
wpiutil = os.path.join(wpilib_root, "wpiutil")
8596

86-
# Apply patches to upstream Git repo
87-
os.chdir(upstream_root)
88-
89-
for f in [
90-
"0001-Don-t-emit-inline-defs.patch",
91-
"0002-Update-amalgamation-script.patch",
92-
"0003-Use-namespace-for-C.patch",
93-
"0004-Group-doxygen-into-MPack-module.patch",
94-
]:
95-
git_am(
96-
os.path.join(wpilib_root, "upstream_utils/mpack_patches", f),
97-
)
97+
mpack.apply_patches()
9898

9999
# Delete old install
100100
for d in [

wpiutil/src/main/native/thirdparty/mpack/include/wpi/mpack.h

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@
4545
*/
4646

4747
/* mpack/mpack-platform.h.h */
48+
/*
49+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
50+
*
51+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
52+
* this software and associated documentation files (the "Software"), to deal in
53+
* the Software without restriction, including without limitation the rights to
54+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
55+
* the Software, and to permit persons to whom the Software is furnished to do so,
56+
* subject to the following conditions:
57+
*
58+
* The above copyright notice and this permission notice shall be included in all
59+
* copies or substantial portions of the Software.
60+
*
61+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
63+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
64+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
65+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
66+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67+
*/
4868

4969
/**
5070
* @file
@@ -1864,6 +1884,26 @@ MPACK_SILENCE_WARNINGS_END
18641884
#endif
18651885

18661886
/* mpack/mpack-common.h.h */
1887+
/*
1888+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
1889+
*
1890+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
1891+
* this software and associated documentation files (the "Software"), to deal in
1892+
* the Software without restriction, including without limitation the rights to
1893+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1894+
* the Software, and to permit persons to whom the Software is furnished to do so,
1895+
* subject to the following conditions:
1896+
*
1897+
* The above copyright notice and this permission notice shall be included in all
1898+
* copies or substantial portions of the Software.
1899+
*
1900+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1901+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1902+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1903+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1904+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1905+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1906+
*/
18671907

18681908
/**
18691909
* @file
@@ -3041,6 +3081,26 @@ MPACK_SILENCE_WARNINGS_END
30413081

30423082

30433083
/* mpack/mpack-writer.h.h */
3084+
/*
3085+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
3086+
*
3087+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
3088+
* this software and associated documentation files (the "Software"), to deal in
3089+
* the Software without restriction, including without limitation the rights to
3090+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
3091+
* the Software, and to permit persons to whom the Software is furnished to do so,
3092+
* subject to the following conditions:
3093+
*
3094+
* The above copyright notice and this permission notice shall be included in all
3095+
* copies or substantial portions of the Software.
3096+
*
3097+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3098+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
3099+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
3100+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
3101+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
3102+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3103+
*/
30443104

30453105
/**
30463106
* @file
@@ -4343,6 +4403,26 @@ MPACK_SILENCE_WARNINGS_END
43434403
#endif
43444404

43454405
/* mpack/mpack-reader.h.h */
4406+
/*
4407+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
4408+
*
4409+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
4410+
* this software and associated documentation files (the "Software"), to deal in
4411+
* the Software without restriction, including without limitation the rights to
4412+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
4413+
* the Software, and to permit persons to whom the Software is furnished to do so,
4414+
* subject to the following conditions:
4415+
*
4416+
* The above copyright notice and this permission notice shall be included in all
4417+
* copies or substantial portions of the Software.
4418+
*
4419+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4420+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
4421+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
4422+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
4423+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
4424+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4425+
*/
43464426

43474427
/**
43484428
* @file
@@ -5290,6 +5370,26 @@ MPACK_SILENCE_WARNINGS_END
52905370

52915371

52925372
/* mpack/mpack-expect.h.h */
5373+
/*
5374+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
5375+
*
5376+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
5377+
* this software and associated documentation files (the "Software"), to deal in
5378+
* the Software without restriction, including without limitation the rights to
5379+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
5380+
* the Software, and to permit persons to whom the Software is furnished to do so,
5381+
* subject to the following conditions:
5382+
*
5383+
* The above copyright notice and this permission notice shall be included in all
5384+
* copies or substantial portions of the Software.
5385+
*
5386+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5387+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
5388+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
5389+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
5390+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
5391+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5392+
*/
52935393

52945394
/**
52955395
* @file
@@ -6762,6 +6862,26 @@ MPACK_SILENCE_WARNINGS_END
67626862

67636863

67646864
/* mpack/mpack-node.h.h */
6865+
/*
6866+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
6867+
*
6868+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6869+
* this software and associated documentation files (the "Software"), to deal in
6870+
* the Software without restriction, including without limitation the rights to
6871+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
6872+
* the Software, and to permit persons to whom the Software is furnished to do so,
6873+
* subject to the following conditions:
6874+
*
6875+
* The above copyright notice and this permission notice shall be included in all
6876+
* copies or substantial portions of the Software.
6877+
*
6878+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6879+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
6880+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
6881+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
6882+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
6883+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6884+
*/
67656885

67666886
/**
67676887
* @file

wpiutil/src/main/native/thirdparty/mpack/src/mpack.cpp

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@
3636

3737

3838
/* mpack/mpack-platform.c.c */
39+
/*
40+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
41+
*
42+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
43+
* this software and associated documentation files (the "Software"), to deal in
44+
* the Software without restriction, including without limitation the rights to
45+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
46+
* the Software, and to permit persons to whom the Software is furnished to do so,
47+
* subject to the following conditions:
48+
*
49+
* The above copyright notice and this permission notice shall be included in all
50+
* copies or substantial portions of the Software.
51+
*
52+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
54+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
55+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
56+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
57+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
58+
*/
3959

4060

4161
// We define MPACK_EMIT_INLINE_DEFS and include mpack.h to emit
@@ -241,6 +261,26 @@ void* mpack_realloc(void* old_ptr, size_t used_size, size_t new_size) {
241261
MPACK_SILENCE_WARNINGS_END
242262

243263
/* mpack/mpack-common.c.c */
264+
/*
265+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
266+
*
267+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
268+
* this software and associated documentation files (the "Software"), to deal in
269+
* the Software without restriction, including without limitation the rights to
270+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
271+
* the Software, and to permit persons to whom the Software is furnished to do so,
272+
* subject to the following conditions:
273+
*
274+
* The above copyright notice and this permission notice shall be included in all
275+
* copies or substantial portions of the Software.
276+
*
277+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
278+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
279+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
280+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
281+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
282+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
283+
*/
244284

245285
#define MPACK_INTERNAL 1
246286

@@ -976,6 +1016,26 @@ void mpack_print_file_callback(void* context, const char* data, size_t count) {
9761016
MPACK_SILENCE_WARNINGS_END
9771017

9781018
/* mpack/mpack-writer.c.c */
1019+
/*
1020+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
1021+
*
1022+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
1023+
* this software and associated documentation files (the "Software"), to deal in
1024+
* the Software without restriction, including without limitation the rights to
1025+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1026+
* the Software, and to permit persons to whom the Software is furnished to do so,
1027+
* subject to the following conditions:
1028+
*
1029+
* The above copyright notice and this permission notice shall be included in all
1030+
* copies or substantial portions of the Software.
1031+
*
1032+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1033+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1034+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1035+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1036+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1037+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1038+
*/
9791039

9801040
#define MPACK_INTERNAL 1
9811041

@@ -2790,6 +2850,26 @@ void mpack_complete_array(mpack_writer_t* writer) {
27902850
MPACK_SILENCE_WARNINGS_END
27912851

27922852
/* mpack/mpack-reader.c.c */
2853+
/*
2854+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
2855+
*
2856+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
2857+
* this software and associated documentation files (the "Software"), to deal in
2858+
* the Software without restriction, including without limitation the rights to
2859+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
2860+
* the Software, and to permit persons to whom the Software is furnished to do so,
2861+
* subject to the following conditions:
2862+
*
2863+
* The above copyright notice and this permission notice shall be included in all
2864+
* copies or substantial portions of the Software.
2865+
*
2866+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2867+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
2868+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
2869+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2870+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2871+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2872+
*/
27932873

27942874
#define MPACK_INTERNAL 1
27952875

@@ -4061,6 +4141,26 @@ void mpack_print_stdfile_to_callback(FILE* file, mpack_print_callback_t callback
40614141
MPACK_SILENCE_WARNINGS_END
40624142

40634143
/* mpack/mpack-expect.c.c */
4144+
/*
4145+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
4146+
*
4147+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
4148+
* this software and associated documentation files (the "Software"), to deal in
4149+
* the Software without restriction, including without limitation the rights to
4150+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
4151+
* the Software, and to permit persons to whom the Software is furnished to do so,
4152+
* subject to the following conditions:
4153+
*
4154+
* The above copyright notice and this permission notice shall be included in all
4155+
* copies or substantial portions of the Software.
4156+
*
4157+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4158+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
4159+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
4160+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
4161+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
4162+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4163+
*/
40644164

40654165
#define MPACK_INTERNAL 1
40664166

@@ -4928,6 +5028,26 @@ size_t mpack_expect_key_cstr(mpack_reader_t* reader, const char* keys[], bool fo
49285028
MPACK_SILENCE_WARNINGS_END
49295029

49305030
/* mpack/mpack-node.c.c */
5031+
/*
5032+
* Copyright (c) 2015-2021 Nicholas Fraser and the MPack authors
5033+
*
5034+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
5035+
* this software and associated documentation files (the "Software"), to deal in
5036+
* the Software without restriction, including without limitation the rights to
5037+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
5038+
* the Software, and to permit persons to whom the Software is furnished to do so,
5039+
* subject to the following conditions:
5040+
*
5041+
* The above copyright notice and this permission notice shall be included in all
5042+
* copies or substantial portions of the Software.
5043+
*
5044+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5045+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
5046+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
5047+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
5048+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
5049+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5050+
*/
49315051

49325052
#define MPACK_INTERNAL 1
49335053

0 commit comments

Comments
 (0)