Skip to content

Commit 0cd9f2e

Browse files
committed
Merge branch 'devel'
2 parents 710d999 + dfbac23 commit 0cd9f2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3101
-1531
lines changed

CMakeLists.txt

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ set(CMAKE_MACOSX_RPATH TRUE)
1010

1111
# set version
1212
set(LIBYANG_MAJOR_VERSION 0)
13-
set(LIBYANG_MINOR_VERSION 12)
14-
set(LIBYANG_MICRO_VERSION 203)
13+
set(LIBYANG_MINOR_VERSION 13)
14+
set(LIBYANG_MICRO_VERSION 42)
1515
set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION})
1616
set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION})
1717
configure_file(${PROJECT_SOURCE_DIR}/src/libyang.h.in ${PROJECT_SOURCE_DIR}/src/libyang.h)
@@ -167,6 +167,9 @@ set(lintsrc
167167
tools/lint/completion.c
168168
linenoise/linenoise.c)
169169

170+
set(resrc
171+
tools/re/main.c)
172+
170173
set(yang2yinsrc
171174
tools/yang2yin/main.c)
172175

@@ -178,18 +181,6 @@ set(headers
178181
src/xml.h
179182
src/dict.h)
180183

181-
# create static libyang library
182-
if(STATIC)
183-
add_library(yang_static STATIC ${libsrc})
184-
set_target_properties(yang_static PROPERTIES OUTPUT_NAME yang)
185-
set_target_properties(yang_static PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
186-
target_link_libraries(yang_static m)
187-
target_link_libraries(yang_static ${CMAKE_DL_LIBS})
188-
target_link_libraries(yang_static ${CMAKE_THREAD_LIBS_INIT})
189-
target_link_libraries(yang_static ${PCRE_LIBRARIES})
190-
install(TARGETS yang_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
191-
endif(STATIC)
192-
193184
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
194185
add_library(yangobj OBJECT ${libsrc})
195186
add_library(yang SHARED $<TARGET_OBJECTS:yangobj>)
@@ -257,6 +248,11 @@ target_link_libraries(yanglint yang)
257248
install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR})
258249
install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
259250

251+
#yangre
252+
add_executable(yangre ${resrc})
253+
target_link_libraries(yangre yang)
254+
install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR})
255+
260256
# yang2yin
261257
add_executable(yang2yin ${yang2yinsrc})
262258

CODINGSTYLE renamed to CONTRIBUTING.md

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,63 @@
1-
# libyang Coding Style
1+
# Contributing to libyang
22

3-
This file describes the coding style used in most C files in the libyang
4-
library.
3+
First of all, thanks for thinking about contribution to libyang! Not all of us
4+
are C guru, but believe that helping us with docs, tests, helping other users to
5+
solve their issues / answer ther questions or even letting us to know via
6+
[issue tracker](https://github.com/CESNET/libyang/issues) that something
7+
can be done in a better or just different way is really appreciated.
58

6-
## Basics
9+
If you are willing to contribute, you will definitely have to build and install
10+
libyang first. To do it, please check dependencies and follow build and install
11+
instructions provided in [README](README.md).
712

8-
- Use space instead of tabs for indentations.
13+
If you have something what you believe should be part of the libyang repository,
14+
add it via [Github Pull Request mechanism](https://help.github.com/articles/about-pull-requests/).
15+
Remember to explain what you wish to add and why. The best approach is to start
16+
with creating an issue and discuss possible approaches there. Pull requests can be
17+
then connected with such issues.
918

10-
- There is no strict limit for the line length, However, try to keep lines in a
11-
reasonable length (120 characters).
19+
## Branches
1220

13-
- Avoid trailing spaces on lines.
21+
There are 2 main branches in libyang project. The default branch is named `master`. It is the
22+
most stable and tested code which you get by default when cloning the Git repository. The
23+
`devel` branch introduces new features, API changes or even bugfixes in case `master` and
24+
`devel` differs significantly at that moment and the fix affects the changed code. There are
25+
some more branches for work-in-progress features and special `coverity` branch for submitting
26+
code for the [analysis in the Coverity tool](https://scan.coverity.com/projects/5259) usign
27+
[Travis CI build](https://travis-ci.org/CESNET/libyang/branches).
1428

15-
- Put one blank line between function definitions.
29+
When you create pull request, think carefully about the branch where the patch belongs to.
30+
In most cases (if not all), it is the `devel` branch.
31+
32+
## Issue Ticketing
33+
34+
All the communication with the developers is done via [issue tracker](https://github.com/CESNET/libyang/issues).
35+
You can send us an email, but in case you will ask a question we would think that someone else
36+
could ask in future, our answer will be just **use the issue tracker**. Private emails are not visible
37+
for others and we don't want to answer the same questions.
38+
39+
So when you are goingto submit a new issue, **please:**
40+
* check that the issue you are having is not already solved in the devel branch,
41+
* go through the present issues (in case of question, it can be already a closed issue) in the tracker,
42+
* give it as descriptive title as possible,
43+
* separate topics - solving multiple issues in one ticket hides the issues from others,
44+
* provide as much relevant information as possible (versions, logs, input data, etc.).
1645

46+
## libyang Coding Style
47+
48+
When you are going to contribute C code, please follow these coding style guidelines.
49+
50+
### Basics
51+
52+
- Use space instead of tabs for indentations.
53+
- There is no strict limit for the line length, However, try to keep lines in a
54+
reasonable length (120 characters).
55+
- Avoid trailing spaces on lines.
56+
- Put one blank line between function definitions.
1757
- Don't mix declarations and code within a block. Similarly, don't use
1858
declarations in iteration statements.
1959

20-
## Naming
60+
### Naming
2161

2262
Use underscores to separate words in an identifier: `multi_word_name`.
2363

@@ -27,7 +67,7 @@ members of enumerations.
2767
Do not use names that begin with `_`. If you need a name for "internal use
2868
only", use `__` as a suffix instead of a prefix.
2969

30-
## Comments
70+
### Comments
3171

3272
Avoid `//` comments. Use `/* ... */` comments, write block comments with the
3373
leading asterisk on each line. You may put the `/*` and `*/` on the same line as
@@ -39,7 +79,7 @@ comment text if you prefer.
3979
*/
4080
```
4181

42-
## Functions
82+
### Functions
4383

4484
Put the return type, function name, and the braces that surround the function's
4585
code on separate lines, all starting in column 0.
@@ -80,15 +120,15 @@ and ignore a null pointer argument. Code that calls such a function (including
80120
the C standard library function `free()`) should omit a null-pointer check. We
81121
find that this usually makes code easier to read.
82122

83-
### Function Prototypes
123+
#### Function Prototypes
84124

85125
Put the return type and function name on the same line in a function prototype:
86126

87127
```c
88128
static const struct int foo(int arg);
89129
```
90130
91-
## Statements
131+
### Statements
92132
93133
- Indent each level of code with 4 spaces.
94134
- Put single space between `if`, `while`, `for`, etc. statements and the
@@ -121,7 +161,7 @@ default:
121161
- Do not put gratuitous parentheses around the expression in a return statement,
122162
that is, write `return 0;` and not `return(0);`
123163

124-
## Types
164+
### Types
125165

126166
Use typedefs sparingly. Code is clearer if the actual type is visible at the
127167
point of declaration. Do not, in general, declare a typedef for a struct, union,
@@ -135,7 +175,7 @@ integer types. Use the `PRId<N>`, `PRIu<N>`, and `PRIx<N>` macros from
135175
Pointer declarators bind to the variable name, not the type name. Write
136176
`int *x`, not `int* x` and definitely not `int * x`.
137177

138-
## Expresions
178+
### Expresions
139179

140180
Put one space on each side of infix binary and ternary operators:
141181

packages/debian.control.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Architecture: any
1313
Description: Libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
1414

1515
Package: @PACKAGE_NAME@-dev
16-
Depends: libpcre3-dev, libyang (=@LIBYANG_VERSION@)
16+
Depends: libpcre3-dev, @PACKAGE_NAME@ (=@LIBYANG_VERSION@)
1717
Section: libdevel
1818
Architecture: any
1919
Description: Headers of libyang library.
2020

2121
Package: @PACKAGE_NAME@-dbg
22-
Depends: libyang (=@LIBYANG_VERSION@)
22+
Depends: @PACKAGE_NAME@ (=@LIBYANG_VERSION@)
2323
Section: debug
2424
Architecture: any
2525
Description: Debug symbols of libyang library.

packages/debian.libyang.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ usr/lib/*/libyang.so.*
22
usr/lib/*/libyang/nacm.so
33
usr/lib/*/libyang/metadata.so
44
usr/bin/yanglint
5+
usr/bin/yangre
56
usr/share/man/man1/yanglint.1

packages/libyang.spec.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ make DESTDIR=%{buildroot} install
4848
%files
4949
%defattr(-,root,root)
5050
%{_bindir}/yanglint
51+
%{_bindir}/yangre
5152
%{_datadir}/man/man1/yanglint.1.gz
5253
%{_libdir}/libyang.so.*
5354
%{_libdir}/libyang/nacm.so

packages/local-deb.sh.in

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
#!/usr/bin/env bash
22

3+
LOCAL_LC_TIME=$LC_TIME
4+
export LC_TIME="en_US.UTF-8"
35
mkdir -p debian/source
46
mkdir -p debs
57
cp build-packages/debian.rules debian/rules
68
cp build-packages/debian.control debian/control
79
echo '9' >debian/compat
810
echo '3.0 (quilt)' >debian/source/format
911
cp "@PROJECT_SOURCE_DIR@/LICENSE" debian/copyright
10-
cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang.install" debian/libyang.install
11-
cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang-dev.install" debian/libyang-dev.install
12+
cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang.install" debian/@PACKAGE_NAME@.install
13+
cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang-dev.install" debian/@PACKAGE_NAME@-dev.install
1214
echo -e "@PACKAGE_NAME@ (@LIBYANG_VERSION@) stable; urgency=low\n" >debian/changelog
1315
git log -10 --pretty=format:' * %s (%aN)%n' 2>/dev/null >>debian/changelog || echo -e " * unknown changes \n" >>debian/changelog
1416
git log -1 --pretty=format:'%n -- %aN <%aE> %aD%n' >>debian/changelog 2>/dev/null || echo " -- ${USER} <${USER}@`hostname`> `date -R`" >>debian/changelog
1517
debuild --no-lintian -i -b -us -uc
1618
mv ../*.deb debs
19+
export LC_TIME=$LOCAL_LC_TIME

packages/local-rpm.sh.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
LOCAL_LC_TIME=$LC_TIME
4+
export LC_TIME="en_US.UTF-8"
35
cd "@PROJECT_SOURCE_DIR@" && tar --exclude="@EXCLUDE_BUILD_DIR@" --exclude=./.git* -zcvf "@PROJECT_BINARY_DIR@/@[email protected]" . --transform 's/./libyang-@GIT_BRANCH@/'
46
cd @PROJECT_BINARY_DIR@
57
mkdir -p rpms/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}
@@ -9,3 +11,4 @@ git log -1 --date=format:'%a %b %d %Y' --pretty=format:"* %ad %aN <%aE>" 2>/dev
911
echo " @LIBYANG_VERSION@" >>rpms/SPECS/libyang.spec
1012
git log -10 --pretty=format:"- %s (%aN)" >>rpms/SPECS/libyang.spec 2>/dev/null || echo "- unknown changes" >>rpms/SPECS/libyang.spec
1113
rpmbuild --ba rpms/SPECS/libyang.spec --define "%_topdir @PROJECT_BINARY_DIR@/rpms"
14+
export LC_TIME=$LOCAL_LC_TIME

0 commit comments

Comments
 (0)