forked from wolfi-dev/os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
json-c.yaml
94 lines (80 loc) · 2.14 KB
/
json-c.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package:
name: json-c
version: "0.18"
epoch: 1
description: A JSON implementation in C
copyright:
- license: MIT
environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- cmake
- doxygen
- openssf-compiler-options
- samurai
pipeline:
- uses: fetch
with:
expected-sha256: 876ab046479166b869afc6896d288183bbc0e5843f141200c677b3e8dfb11724
uri: https://s3.amazonaws.com/json-c_releases/releases/json-c-${{package.version}}.tar.gz
- uses: cmake/configure
- uses: cmake/build
- uses: cmake/install
- uses: strip
subpackages:
- name: json-c-dev
pipeline:
- uses: split/dev
dependencies:
runtime:
- json-c
description: json-c dev
test:
pipeline:
- uses: test/pkgconf
- name: json-c-doc
pipeline:
- uses: split/manpages
- runs: |
mkdir -p "${{targets.subpkgdir}}"/usr/share/doc/json-c
mv doc/html "${{targets.subpkgdir}}"/usr/share/doc/json-c
description: json-c doc
update:
enabled: true
release-monitor:
identifier: 1477
test:
environment:
contents:
packages:
- build-base
- gcc
- json-c-dev
pipeline:
- name: "Verify library presence"
runs: |
test -f /usr/lib/libjson-c.so
- name: "Basic JSON parsing test"
runs: |
cat > test.c << 'EOF'
#include <json-c/json.h>
#include <stdio.h>
#include <string.h>
int main() {
const char *input = "{\"name\":\"test\", \"value\":42}";
struct json_object *obj = json_tokener_parse(input);
if (!obj) return 1;
struct json_object *name, *value;
if (!json_object_object_get_ex(obj, "name", &name)) return 1;
if (!json_object_object_get_ex(obj, "value", &value)) return 1;
if (strcmp(json_object_get_string(name), "test") != 0) return 1;
if (json_object_get_int(value) != 42) return 1;
json_object_put(obj);
return 0;
}
EOF
gcc -Wall -Wextra test.c -ljson-c -o test_json
./test_json