Change-Id: I483c6524373a4e30bcbdeb33a12de7db63971a1b
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/4658
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Xiaolin Li <xiaolinl@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Summary: The Berkley DB database library for C |
2 | 2 |
Name: libdb |
3 | 3 |
Version: 5.3.28 |
4 |
-Release: 2%{?dist} |
|
4 |
+Release: 3%{?dist} |
|
5 | 5 |
License: BSD and LGPLv2 and Sleepycat |
6 | 6 |
URL: https://oss.oracle.com/berkeley-db.html |
7 | 7 |
Source0: http://download.oracle.com/berkeley-db/db-%{version}.tar.gz |
... | ... |
@@ -13,6 +13,12 @@ Obsoletes: db |
13 | 13 |
%description |
14 | 14 |
The Berkeley DB package contains libraries used by many other applications for database related functions. |
15 | 15 |
|
16 |
+%package utils |
|
17 |
+Summary: Header and development files |
|
18 |
+Requires: %{name} = %{version} |
|
19 |
+%description utils |
|
20 |
+db dump utility |
|
21 |
+ |
|
16 | 22 |
%package devel |
17 | 23 |
Summary: Header and development files |
18 | 24 |
Requires: %{name} = %{version} |
... | ... |
@@ -56,6 +62,10 @@ rm -rf %{buildroot} |
56 | 56 |
%{_libdir}/*.so |
57 | 57 |
%{_datadir}/licenses/* |
58 | 58 |
|
59 |
+%files utils |
|
60 |
+%defattr(-,root,root) |
|
61 |
+%{_bindir}/db_dump |
|
62 |
+ |
|
59 | 63 |
%files docs |
60 | 64 |
%defattr(-,root,root) |
61 | 65 |
%{_docdir}/%{name}-%{version}/* |
... | ... |
@@ -66,6 +76,8 @@ rm -rf %{buildroot} |
66 | 66 |
%{_includedir}/* |
67 | 67 |
|
68 | 68 |
%changelog |
69 |
+* Wed Jan 17 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 5.3.28-3 |
|
70 |
+- add libdb-utils for db_dump |
|
69 | 71 |
* Tue Nov 14 2017 Alexey Makhalov <amakhalov@vmware.com> 5.3.28-2 |
70 | 72 |
- Aarch64 support |
71 | 73 |
* Thu Oct 27 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 5.3.28-1 |
... | ... |
@@ -89,7 +89,7 @@ rm -rf $RPM_BUILD_ROOT |
89 | 89 |
* Thu Nov 24 2016 Alexey Makhalov <amakhalov@vmware.com> 2015.1-4 |
90 | 90 |
- BuildRequired attr-devel. |
91 | 91 |
* Thu Nov 17 2016 Alexey Makhalov <amakhalov@vmware.com> 2015.1-3 |
92 |
-- Use %setup instead of %autosetup |
|
92 |
+- Use setup instead of autosetup |
|
93 | 93 |
* Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2015.1-2 |
94 | 94 |
- GA - Bump release of all rpms |
95 | 95 |
* Mon Nov 24 2014 Divya Thaluru <dthaluru@vmware.com> 2014.2-1 |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Summary: Simple package manager built on top of hawkey and librepo |
2 | 2 |
Name: libhif |
3 | 3 |
Version: 0.2.3 |
4 |
-Release: 1%{?dist} |
|
4 |
+Release: 2%{?dist} |
|
5 | 5 |
License: LGPLv2+ |
6 | 6 |
URL: https://github.com/hughsie/libhif |
7 | 7 |
Source0: http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.xz |
... | ... |
@@ -23,6 +23,7 @@ BuildRequires: python2-libs |
23 | 23 |
BuildRequires: python2 |
24 | 24 |
BuildRequires: gobject-introspection-python |
25 | 25 |
BuildRequires: openssl-devel |
26 |
+BuildRequires: lmdb-devel |
|
26 | 27 |
|
27 | 28 |
Requires: openssl |
28 | 29 |
Requires: librepo |
... | ... |
@@ -83,6 +84,8 @@ make check |
83 | 83 |
%{_datadir}/gir-1.0/*.gir |
84 | 84 |
|
85 | 85 |
%changelog |
86 |
+* Sun Mar 04 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 0.2.3-2 |
|
87 |
+- added build requires lmdb-devel |
|
86 | 88 |
* Thu Aug 19 2017 Chang Lee <changlee@vmware.com> 0.2.3-1 |
87 | 89 |
- Updated to 0.2.3 |
88 | 90 |
- Disabled GLib-GObject-CRITICAL tests due to Segmentation fault in all tests |
89 | 91 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,490 @@ |
0 |
+diff --git a/CMakeLists.txt b/CMakeLists.txt |
|
1 |
+index 605ab76..7fad325 100644 |
|
2 |
+--- a/CMakeLists.txt |
|
3 |
+@@ -12,6 +12,7 @@ OPTION (ENABLE_TCL "Build the Tcl bindings?" OFF) |
|
4 |
+ |
|
5 |
+ OPTION (USE_VENDORDIRS "Install the bindings in vendor directories?" OFF) |
|
6 |
+ |
|
7 |
++OPTION (ENABLE_RPMDB_LMDB "Build with rpm db as lmdb?" OFF) |
|
8 |
+ OPTION (ENABLE_RPMDB "Build with rpm database support?" OFF) |
|
9 |
+ OPTION (ENABLE_RPMPKG "Build with rpm package support?" OFF) |
|
10 |
+ OPTION (ENABLE_PUBKEY "Build with pubkey support?" OFF) |
|
11 |
+@@ -83,6 +84,17 @@ INCLUDE (${CMAKE_SOURCE_DIR}/VERSION.cmake) |
|
12 |
+ |
|
13 |
+ SET (have_system x) |
|
14 |
+ |
|
15 |
++IF (PHOTON) |
|
16 |
++MESSAGE(STATUS "Building for Photon") |
|
17 |
++ADD_DEFINITIONS (-DPHOTON) |
|
18 |
++SET (RPM5 ON) |
|
19 |
++SET (ENABLE_RPMDB ON) |
|
20 |
++SET (ENABLE_RPMMD ON) |
|
21 |
++SET (ENABLE_RPMDB_LMDB ON) |
|
22 |
++SET (ENABLE_COMPLEX_DEPS ON) |
|
23 |
++SET (have_system ${have_system}x) |
|
24 |
++ENDIF (PHOTON) |
|
25 |
++ |
|
26 |
+ IF (FEDORA) |
|
27 |
+ MESSAGE(STATUS "Building for Fedora") |
|
28 |
+ ADD_DEFINITIONS (-DFEDORA) |
|
29 |
+@@ -220,17 +232,25 @@ IF (ENABLE_RPMDB) |
|
30 |
+ ENDIF (RPMMISC_LIBRARY) |
|
31 |
+ ENDIF (RPM5) |
|
32 |
+ |
|
33 |
+- # check if rpm contains a bundled berkeley db |
|
34 |
+- CHECK_INCLUDE_FILE(rpm/db.h HAVE_RPM_DB_H) |
|
35 |
+- IF (NOT HAVE_RPM_DB_H) |
|
36 |
+- FIND_LIBRARY (DB_LIBRARY NAMES db) |
|
37 |
++ IF (NOT ENABLE_RPMDB_LMDB) |
|
38 |
++ # check if rpm contains a bundled berkeley db |
|
39 |
++ CHECK_INCLUDE_FILE(rpm/db.h HAVE_RPM_DB_H) |
|
40 |
++ IF (NOT HAVE_RPM_DB_H) |
|
41 |
++ FIND_LIBRARY (DB_LIBRARY NAMES db) |
|
42 |
++ IF (DB_LIBRARY) |
|
43 |
++ SET (RPMDB_LIBRARY ${DB_LIBRARY} ${RPMDB_LIBRARY}) |
|
44 |
++ ENDIF (DB_LIBRARY) |
|
45 |
++ IF (DB_INCLUDE_DIR) |
|
46 |
++ INCLUDE_DIRECTORIES (${DB_INCLUDE_DIR}) |
|
47 |
++ ENDIF (DB_INCLUDE_DIR) |
|
48 |
++ ENDIF (NOT HAVE_RPM_DB_H) |
|
49 |
++ ELSE (NOT ENABLE_RPMDB_LMDB) |
|
50 |
++ FIND_LIBRARY (DB_LIBRARY NAMES lmdb) |
|
51 |
+ IF (DB_LIBRARY) |
|
52 |
+ SET (RPMDB_LIBRARY ${DB_LIBRARY} ${RPMDB_LIBRARY}) |
|
53 |
+ ENDIF (DB_LIBRARY) |
|
54 |
+- IF (DB_INCLUDE_DIR) |
|
55 |
+- INCLUDE_DIRECTORIES (${DB_INCLUDE_DIR}) |
|
56 |
+- ENDIF (DB_INCLUDE_DIR) |
|
57 |
+- ENDIF (NOT HAVE_RPM_DB_H) |
|
58 |
++ ENDIF (NOT ENABLE_RPMDB_LMDB) |
|
59 |
++ |
|
60 |
+ INCLUDE (CheckLibraryExists) |
|
61 |
+ CHECK_LIBRARY_EXISTS(rpmio pgpDigGetParams "" HAVE_PGPDIGGETPARAMS) |
|
62 |
+ ENDIF (ENABLE_RPMDB) |
|
63 |
+diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt |
|
64 |
+index 703796c..d56184f 100644 |
|
65 |
+--- a/examples/CMakeLists.txt |
|
66 |
+@@ -1,5 +1,5 @@ |
|
67 |
+-IF (SUSE OR FEDORA OR DEBIAN OR MANDRIVA OR MAGEIA) |
|
68 |
++IF (PHOTON OR SUSE OR FEDORA OR DEBIAN OR MANDRIVA OR MAGEIA) |
|
69 |
+ |
|
70 |
+ ADD_SUBDIRECTORY (solv) |
|
71 |
+ |
|
72 |
+-ENDIF (SUSE OR FEDORA OR DEBIAN OR MANDRIVA OR MAGEIA) |
|
73 |
++ENDIF (PHOTON OR SUSE OR FEDORA OR DEBIAN OR MANDRIVA OR MAGEIA) |
|
74 |
+diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt |
|
75 |
+index b8917a2..5d75c3f 100644 |
|
76 |
+--- a/ext/CMakeLists.txt |
|
77 |
+@@ -11,6 +11,13 @@ IF (ENABLE_RPMDB OR ENABLE_RPMPKG) |
|
78 |
+ pool_fileconflicts.h repo_rpmdb.h) |
|
79 |
+ ENDIF (ENABLE_RPMDB OR ENABLE_RPMPKG) |
|
80 |
+ |
|
81 |
++IF (ENABLE_RPMDB_LMDB) |
|
82 |
++ SET (libsolvext_SRCS ${libsolvext_SRCS} |
|
83 |
++ db_lmdb.c) |
|
84 |
++ SET (libsolvext_HEADERS ${libsolvext_HEADERS} |
|
85 |
++ db_lmdb.h) |
|
86 |
++ENDIF (ENABLE_RPMDB_LMDB) |
|
87 |
++ |
|
88 |
+ IF (ENABLE_PUBKEY) |
|
89 |
+ SET (libsolvext_SRCS ${libsolvext_SRCS} |
|
90 |
+ repo_pubkey.c) |
|
91 |
+diff --git a/ext/db_lmdb.c b/ext/db_lmdb.c |
|
92 |
+new file mode 100644 |
|
93 |
+index 0000000..c3941b0 |
|
94 |
+--- /dev/null |
|
95 |
+@@ -0,0 +1,258 @@ |
|
96 |
++/* |
|
97 |
++ * Copyright (c) 2007-2012, Novell Inc. |
|
98 |
++ * |
|
99 |
++ * This program is licensed under the BSD license, read LICENSE.BSD |
|
100 |
++ * for further information |
|
101 |
++ */ |
|
102 |
++ |
|
103 |
++/* |
|
104 |
++ * db_lmdb |
|
105 |
++ * |
|
106 |
++ * bridge for db to lmdb calls |
|
107 |
++ * |
|
108 |
++ */ |
|
109 |
++ |
|
110 |
++#include <sys/types.h> |
|
111 |
++#include <sys/stat.h> |
|
112 |
++#include <limits.h> |
|
113 |
++#include <fcntl.h> |
|
114 |
++#include <stdio.h> |
|
115 |
++#include <stdlib.h> |
|
116 |
++#include <string.h> |
|
117 |
++#include <unistd.h> |
|
118 |
++#include <assert.h> |
|
119 |
++#include <stdint.h> |
|
120 |
++#include <errno.h> |
|
121 |
++ |
|
122 |
++#include "db_lmdb.h" |
|
123 |
++#include "util.h" |
|
124 |
++ |
|
125 |
++int db_env_open(struct _DB_ENV_ *dbenv, const char *dbpath, u_int32_t flags, int naccess) |
|
126 |
++{ |
|
127 |
++ int err = 0; |
|
128 |
++ |
|
129 |
++ err = mdb_env_open(dbenv->env, dbpath, 0, naccess); |
|
130 |
++ bail_on_error(err); |
|
131 |
++ |
|
132 |
++error: |
|
133 |
++ return err; |
|
134 |
++} |
|
135 |
++ |
|
136 |
++int db_env_close(struct _DB_ENV_ *dbenv, u_int32_t flags) |
|
137 |
++{ |
|
138 |
++ int err = 0; |
|
139 |
++ |
|
140 |
++ if(dbenv && dbenv->env) |
|
141 |
++ mdb_env_close(dbenv->env); |
|
142 |
++ |
|
143 |
++ return err; |
|
144 |
++} |
|
145 |
++ |
|
146 |
++int db_env_get_open_flags(struct _DB_ENV_ *dbenv, u_int32_t *flags) |
|
147 |
++{ |
|
148 |
++ *flags = 0; |
|
149 |
++ return 0; |
|
150 |
++} |
|
151 |
++ |
|
152 |
++int db_env_create (DB_ENV **dbenvp, u_int32_t flags) |
|
153 |
++{ |
|
154 |
++ DB_ENV *dbenv = NULL; |
|
155 |
++ MDB_env *mdbenv = NULL; |
|
156 |
++ int err = 0; |
|
157 |
++ |
|
158 |
++ dbenv = solv_malloc(sizeof(DB_ENV)); |
|
159 |
++ if(!dbenv) |
|
160 |
++ err = ENOMEM; |
|
161 |
++ bail_on_error(err); |
|
162 |
++ |
|
163 |
++ err = mdb_env_create(&mdbenv); |
|
164 |
++ bail_on_error(err); |
|
165 |
++ |
|
166 |
++ err = mdb_env_set_maxreaders(mdbenv, 16); |
|
167 |
++ bail_on_error(err); |
|
168 |
++ |
|
169 |
++ err = mdb_env_set_maxdbs(mdbenv, 32); |
|
170 |
++ bail_on_error(err); |
|
171 |
++ |
|
172 |
++ err = mdb_env_set_mapsize(mdbenv, 50*1024*1024); |
|
173 |
++ bail_on_error(err); |
|
174 |
++ |
|
175 |
++ dbenv->env = mdbenv; |
|
176 |
++ dbenv->open = db_env_open; |
|
177 |
++ dbenv->close = db_env_close; |
|
178 |
++ dbenv->get_open_flags = db_env_get_open_flags; |
|
179 |
++ |
|
180 |
++ *dbenvp = dbenv; |
|
181 |
++cleanup: |
|
182 |
++ return err; |
|
183 |
++ |
|
184 |
++error: |
|
185 |
++ if(mdbenv) |
|
186 |
++ mdb_env_close(mdbenv); |
|
187 |
++ solv_free(dbenv); |
|
188 |
++ goto cleanup; |
|
189 |
++} |
|
190 |
++ |
|
191 |
++//db |
|
192 |
++int db_close(struct _DB_ *db, u_int32_t flags) |
|
193 |
++{ |
|
194 |
++ return 0; |
|
195 |
++} |
|
196 |
++ |
|
197 |
++int dbc_close(struct _DBC_ *dbc) |
|
198 |
++{ |
|
199 |
++/* |
|
200 |
++ if(dbc->txn) |
|
201 |
++ { |
|
202 |
++ if(dbc->txn->txn) |
|
203 |
++ mdb_txn_abort(dbc->txn->txn); |
|
204 |
++ dbc->txn->txn = NULL; |
|
205 |
++ solv_free(dbc->txn); |
|
206 |
++ } |
|
207 |
++ dbc->txn = NULL; |
|
208 |
++*/ |
|
209 |
++ return 0; |
|
210 |
++} |
|
211 |
++ |
|
212 |
++int dbc_c_close(struct _DBC_ *dbc) |
|
213 |
++{ |
|
214 |
++ if(dbc->cursor) |
|
215 |
++ mdb_cursor_close(dbc->cursor); |
|
216 |
++ dbc->cursor = NULL; |
|
217 |
++ return 0; |
|
218 |
++} |
|
219 |
++ |
|
220 |
++int dbc_c_get(struct _DBC_ *dbc, struct _DBT_ *key, struct _DBT_ *value, u_int32_t flags) |
|
221 |
++{ |
|
222 |
++ int err = 0; |
|
223 |
++ u_int32_t flagsin = flags == DB_SET ? MDB_SET : MDB_NEXT; |
|
224 |
++ MDB_val mkey, mval; |
|
225 |
++ |
|
226 |
++ if(flagsin == MDB_SET) |
|
227 |
++ { |
|
228 |
++ mkey.mv_size = key->size; |
|
229 |
++ mkey.mv_data = key->data; |
|
230 |
++ } |
|
231 |
++ |
|
232 |
++ err = mdb_cursor_get(dbc->cursor, &mkey, &mval, flagsin); |
|
233 |
++ bail_on_error(err); |
|
234 |
++ |
|
235 |
++ if(flagsin == MDB_NEXT) |
|
236 |
++ { |
|
237 |
++ key->size = mkey.mv_size; |
|
238 |
++ key->data = mkey.mv_data; |
|
239 |
++ } |
|
240 |
++ value->size = mval.mv_size; |
|
241 |
++ value->data = mval.mv_data; |
|
242 |
++ |
|
243 |
++cleanup: |
|
244 |
++ return err; |
|
245 |
++error: |
|
246 |
++ goto cleanup; |
|
247 |
++} |
|
248 |
++ |
|
249 |
++int db_cursor(struct _DB_ *db, struct _DB_TXN_ *txn, |
|
250 |
++ struct _DBC_ **dbcp, u_int32_t flags) |
|
251 |
++{ |
|
252 |
++ int err = 0; |
|
253 |
++ DBC *dbc = NULL; |
|
254 |
++ |
|
255 |
++ DB_TXN *txncurrent = txn ? txn : db->txn; |
|
256 |
++ |
|
257 |
++ if(!txncurrent || !txncurrent->txn) |
|
258 |
++ err = EINVAL; |
|
259 |
++ bail_on_error(err); |
|
260 |
++ |
|
261 |
++ dbc = solv_malloc(sizeof(DBC)); |
|
262 |
++ if(!dbc) |
|
263 |
++ err = ENOMEM; |
|
264 |
++ bail_on_error(err); |
|
265 |
++ |
|
266 |
++ err = mdb_cursor_open(txncurrent->txn, db->db, &dbc->cursor); |
|
267 |
++ bail_on_error(err); |
|
268 |
++ |
|
269 |
++ dbc->close = dbc_close; |
|
270 |
++ dbc->c_close = dbc_c_close; |
|
271 |
++ dbc->c_get = dbc_c_get; |
|
272 |
++ |
|
273 |
++ *dbcp = dbc; |
|
274 |
++cleanup: |
|
275 |
++ return err; |
|
276 |
++error: |
|
277 |
++ solv_free(dbc); |
|
278 |
++ goto cleanup; |
|
279 |
++} |
|
280 |
++ |
|
281 |
++int db_get(struct _DB_ *db, struct _DB_TXN_ *txn, |
|
282 |
++ struct _DBT_ *key, struct _DBT_ *value, u_int32_t flags) |
|
283 |
++{ |
|
284 |
++ return 0; |
|
285 |
++} |
|
286 |
++ |
|
287 |
++int db_open(struct _DB_ *db, struct _DB_TXN_ *txn, |
|
288 |
++ const char *file, const char *database, |
|
289 |
++ DBTYPE dbtype, u_int32_t flags, int mode) |
|
290 |
++{ |
|
291 |
++ int err = 0; |
|
292 |
++ DB_TXN *txnp = NULL; |
|
293 |
++ MDB_dbi dbi = -1; |
|
294 |
++ DB_TXN *txncurrent = txn; |
|
295 |
++ |
|
296 |
++ if(!txn) |
|
297 |
++ { |
|
298 |
++ u_int32_t txnflags = flags & DB_RDONLY ? MDB_RDONLY : 0; |
|
299 |
++ txnp = solv_malloc(sizeof(DB_TXN)); |
|
300 |
++ if(!txnp) |
|
301 |
++ err = ENOMEM; |
|
302 |
++ bail_on_error(err); |
|
303 |
++ |
|
304 |
++ err = mdb_txn_begin(db->env, NULL, txnflags, &txnp->txn); |
|
305 |
++ bail_on_error(err); |
|
306 |
++ |
|
307 |
++ txncurrent = txnp; |
|
308 |
++ } |
|
309 |
++ |
|
310 |
++ err = mdb_dbi_open(txncurrent->txn, file, 0, &dbi); |
|
311 |
++ bail_on_error(err); |
|
312 |
++ |
|
313 |
++ db->txn = txnp; |
|
314 |
++ db->db = dbi; |
|
315 |
++ |
|
316 |
++cleanup: |
|
317 |
++ return err; |
|
318 |
++error: |
|
319 |
++ solv_free(txnp); |
|
320 |
++ goto cleanup; |
|
321 |
++} |
|
322 |
++ |
|
323 |
++int db_get_byteswapped(struct _DB_ *db, int *byteswapped) |
|
324 |
++{ |
|
325 |
++ *byteswapped = 0; |
|
326 |
++ return 0; |
|
327 |
++} |
|
328 |
++ |
|
329 |
++int db_create (DB **db, DB_ENV *dbenv, u_int32_t flags) |
|
330 |
++{ |
|
331 |
++ int err = 0; |
|
332 |
++ DB *dbp = NULL; |
|
333 |
++ |
|
334 |
++ dbp = solv_malloc(sizeof(DB)); |
|
335 |
++ if(!dbp) |
|
336 |
++ err = ENOMEM; |
|
337 |
++ bail_on_error(err); |
|
338 |
++ |
|
339 |
++ |
|
340 |
++ dbp->env = dbenv->env; |
|
341 |
++ dbp->close = db_close; |
|
342 |
++ dbp->cursor = db_cursor; |
|
343 |
++ dbp->get = db_get; |
|
344 |
++ dbp->get_byteswapped = db_get_byteswapped; |
|
345 |
++ dbp->open = db_open; |
|
346 |
++ *db = dbp; |
|
347 |
++ |
|
348 |
++cleanup: |
|
349 |
++ return err; |
|
350 |
++error: |
|
351 |
++ solv_free(dbp); |
|
352 |
++ goto cleanup; |
|
353 |
++} |
|
354 |
+diff --git a/ext/db_lmdb.h b/ext/db_lmdb.h |
|
355 |
+new file mode 100644 |
|
356 |
+index 0000000..4eb197d |
|
357 |
+--- /dev/null |
|
358 |
+@@ -0,0 +1,83 @@ |
|
359 |
++/* |
|
360 |
++ * Copyright (c) 2007-2008, Novell Inc. |
|
361 |
++ * |
|
362 |
++ * This program is licensed under the BSD license, read LICENSE.BSD |
|
363 |
++ * for further information |
|
364 |
++ */ |
|
365 |
++ |
|
366 |
++#ifndef RPM_LMDB_H |
|
367 |
++#define RPM_LMDB_H |
|
368 |
++ |
|
369 |
++#include <lmdb.h> |
|
370 |
++ |
|
371 |
++typedef enum |
|
372 |
++{ |
|
373 |
++ DB_UNKNOWN=5 |
|
374 |
++} DBTYPE; |
|
375 |
++ |
|
376 |
++typedef struct _DB_ENV_ |
|
377 |
++{ |
|
378 |
++ MDB_env *env; |
|
379 |
++ int (*get_open_flags) (struct _DB_ENV_ *, u_int32_t *); |
|
380 |
++ int (*open) (struct _DB_ENV_ *, const char *, u_int32_t, int); |
|
381 |
++ int (*close) (struct _DB_ENV_ *, u_int32_t); |
|
382 |
++}DB_ENV; |
|
383 |
++ |
|
384 |
++typedef struct _DB_TXN_ |
|
385 |
++{ |
|
386 |
++ MDB_txn *txn; |
|
387 |
++}DB_TXN; |
|
388 |
++ |
|
389 |
++typedef struct _DBT_ |
|
390 |
++{ |
|
391 |
++ void *data; |
|
392 |
++ u_int32_t size; |
|
393 |
++}DBT; |
|
394 |
++ |
|
395 |
++typedef struct _DBC_ |
|
396 |
++{ |
|
397 |
++ MDB_cursor *cursor; |
|
398 |
++ int (*close) (struct _DBC_ *); |
|
399 |
++ int (*c_close) (struct _DBC_ *); |
|
400 |
++ int (*c_get) (struct _DBC_ *, struct _DBT_ *, struct _DBT_ *, u_int32_t); |
|
401 |
++}DBC; |
|
402 |
++ |
|
403 |
++typedef struct _DB_ |
|
404 |
++{ |
|
405 |
++ DB_TXN *txn; |
|
406 |
++ MDB_dbi db; |
|
407 |
++ MDB_env *env; |
|
408 |
++ int (*close) (struct _DB_ *, u_int32_t); |
|
409 |
++ int (*cursor)(struct _DB_ *, struct _DB_TXN_ *, struct _DBC_ **, u_int32_t); |
|
410 |
++ int (*get) (struct _DB_ *, struct _DB_TXN_ *, struct _DBT_ *, struct _DBT_ *, u_int32_t); |
|
411 |
++ int (*get_byteswapped) (struct _DB_ *, int *); |
|
412 |
++ int (*open) (struct _DB_ *, |
|
413 |
++ struct _DB_TXN_ *, |
|
414 |
++ const char *, |
|
415 |
++ const char *, |
|
416 |
++ DBTYPE, |
|
417 |
++ u_int32_t, |
|
418 |
++ int); |
|
419 |
++}DB; |
|
420 |
++ |
|
421 |
++//definitions from db.h |
|
422 |
++#define DB_CREATE 0x00000001 |
|
423 |
++#define DB_INIT_CDB 0x00000080 |
|
424 |
++#define DB_INIT_MPOOL 0x00000400 |
|
425 |
++#define DB_PRIVATE 0x00010000 |
|
426 |
++#define DB_RDONLY 0x00000400 |
|
427 |
++ |
|
428 |
++#define DB_NEXT 16 |
|
429 |
++#define DB_SET 26 |
|
430 |
++ |
|
431 |
++int db_env_create (DB_ENV **, u_int32_t); |
|
432 |
++int db_create (DB **, DB_ENV *, u_int32_t); |
|
433 |
++ |
|
434 |
++#define bail_on_error(nerror) \ |
|
435 |
++ do { \ |
|
436 |
++ if (nerror) \ |
|
437 |
++ { \ |
|
438 |
++ goto error; \ |
|
439 |
++ } \ |
|
440 |
++ } while(0) |
|
441 |
++#endif//RPM_LMDB_H |
|
442 |
+diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c |
|
443 |
+index fe05bec..9f4ad31 100644 |
|
444 |
+--- a/ext/repo_rpmdb.c |
|
445 |
+@@ -25,6 +25,7 @@ |
|
446 |
+ #include <errno.h> |
|
447 |
+ |
|
448 |
+ #ifdef ENABLE_RPMDB |
|
449 |
++#define ENABLE_RPMDB_LMDB |
|
450 |
+ |
|
451 |
+ #include <rpm/rpmio.h> |
|
452 |
+ #include <rpm/rpmpgp.h> |
|
453 |
+@@ -37,7 +38,11 @@ |
|
454 |
+ # if defined(SUSE) || defined(HAVE_RPM_DB_H) |
|
455 |
+ # include <rpm/db.h> |
|
456 |
+ # else |
|
457 |
+-# include <db.h> |
|
458 |
++# ifdef ENABLE_RPMDB_LMDB |
|
459 |
++# include "db_lmdb.h" |
|
460 |
++# else |
|
461 |
++# include <db.h> |
|
462 |
++# endif |
|
463 |
+ # endif |
|
464 |
+ #endif |
|
465 |
+ |
|
466 |
+@@ -1515,7 +1520,7 @@ count_headers(struct rpmdbstate *state) |
|
467 |
+ DBT dbkey; |
|
468 |
+ DBT dbdata; |
|
469 |
+ |
|
470 |
+- snprintf(dbpath, PATH_MAX, "%s%s/Name", state->rootdir ? state->rootdir : "", state->is_ostree ? "/usr/share/rpm" : "/var/lib/rpm"); |
|
471 |
++ snprintf(dbpath, PATH_MAX, "%s%s/data.mdb", state->rootdir ? state->rootdir : "", state->is_ostree ? "/usr/share/rpm" : "/var/lib/rpm"); |
|
472 |
+ if (stat(dbpath, &statbuf)) |
|
473 |
+ return 0; |
|
474 |
+ memset(&dbkey, 0, sizeof(dbkey)); |
|
475 |
+@@ -1841,7 +1846,7 @@ repo_add_rpmdb(Repo *repo, Repo *ref, int flags) |
|
476 |
+ } |
|
477 |
+ |
|
478 |
+ /* XXX: should get ro lock of Packages database! */ |
|
479 |
+- snprintf(dbpath, PATH_MAX, "%s%s/Packages", state.rootdir ? state.rootdir : "", state.is_ostree ? "/usr/share/rpm" : "/var/lib/rpm"); |
|
480 |
++ snprintf(dbpath, PATH_MAX, "%s%s/data.mdb", state.rootdir ? state.rootdir : "", state.is_ostree ? "/usr/share/rpm" : "/var/lib/rpm"); |
|
481 |
+ if (stat(dbpath, &packagesstat)) |
|
482 |
+ { |
|
483 |
+ pool_error(pool, -1, "%s: %s", dbpath, strerror(errno)); |
... | ... |
@@ -6,14 +6,14 @@ License: BSD |
6 | 6 |
URL: https://github.com/openSUSE/libsolv |
7 | 7 |
Source0: https://github.com/openSUSE/libsolv/archive/%{name}-%{version}.tar.gz |
8 | 8 |
%define sha1 libsolv=7699af00e648bf3e631246559c48ceb7f3f544b9 |
9 |
+Patch0: libsolv-lmdb.patch |
|
9 | 10 |
Group: Development/Tools |
10 | 11 |
Vendor: VMware, Inc. |
11 | 12 |
Distribution: Photon |
12 |
-Requires: libdb |
|
13 |
+Requires: lmdb |
|
13 | 14 |
Requires: expat-libs |
14 |
-BuildRequires: libdb-devel |
|
15 |
+BuildRequires: lmdb-devel |
|
15 | 16 |
BuildRequires: cmake |
16 |
-BuildRequires: rpm-devel |
|
17 | 17 |
BuildRequires: expat-devel |
18 | 18 |
Provides: pkgconfig(libsolv) |
19 | 19 |
%description |
... | ... |
@@ -30,16 +30,19 @@ for developing applications that use libsolv. |
30 | 30 |
|
31 | 31 |
%prep |
32 | 32 |
%setup -q |
33 |
+%patch0 -p1 |
|
34 |
+ |
|
33 | 35 |
%build |
34 | 36 |
cmake \ |
35 | 37 |
-DCMAKE_INSTALL_PREFIX=%{_prefix} \ |
36 |
- -DRPM5=ON \ |
|
37 |
- -DENABLE_RPMDB=ON \ |
|
38 |
- -DENABLE_COMPLEX_DEPS=ON |
|
38 |
+ -DPHOTON=ON |
|
39 | 39 |
make %{?_smp_mflags} |
40 |
+ |
|
40 | 41 |
%install |
41 | 42 |
make DESTDIR=%{buildroot} install |
42 | 43 |
find %{buildroot} -name '*.la' -delete |
44 |
+#cp ext/repo_*.h %{buildroot}%{_includedir}/solv |
|
45 |
+ |
|
43 | 46 |
|
44 | 47 |
%check |
45 | 48 |
make %{?_smp_mflags} test |
46 | 49 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,10 @@ |
0 |
+prefix=/usr |
|
1 |
+exec_prefix=${prefix} |
|
2 |
+libdir=${exec_prefix}/lib |
|
3 |
+includedir=${prefix}/include |
|
4 |
+ |
|
5 |
+Name: lmdb |
|
6 |
+Description: Lightning memory-mapped database manager |
|
7 |
+Version: 0.9.21 |
|
8 |
+Libs: -L${libdir} -llmdb |
|
9 |
+Cflags: -I${includedir} |
0 | 10 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,70 @@ |
0 |
+Summary: Lightning memory-mapped database manager |
|
1 |
+Name: lmdb |
|
2 |
+Version: 0.9.21 |
|
3 |
+Release: 1%{?dist} |
|
4 |
+Group: System/Libraries |
|
5 |
+Vendor: VMware, Inc. |
|
6 |
+License: OpenLDAP |
|
7 |
+URL: https://github.com/LMDB/lmdb |
|
8 |
+Source0: https://github.com/LMDB/lmdb/archive/LMDB_%{version}.tar.gz |
|
9 |
+%define sha1 LMDB=54d10ee9afaba8db75c8c73832da10b0a47e5807 |
|
10 |
+Source1: %{name}.pc |
|
11 |
+Distribution: Photon |
|
12 |
+ |
|
13 |
+%description |
|
14 |
+Lightning memory-mapped database manager |
|
15 |
+ |
|
16 |
+%package devel |
|
17 |
+Summary: Development files for lmdb |
|
18 |
+Group: Development/Libraries |
|
19 |
+Requires: lmdb = %{version}-%{release} |
|
20 |
+ |
|
21 |
+%description devel |
|
22 |
+Development files for lmdb |
|
23 |
+ |
|
24 |
+%prep |
|
25 |
+%setup -qn lmdb-LMDB_%{version} |
|
26 |
+ |
|
27 |
+%build |
|
28 |
+cd libraries/liblmdb |
|
29 |
+make |
|
30 |
+ |
|
31 |
+%install |
|
32 |
+%define relpath %{_builddir}/%{buildsubdir}/libraries/liblmdb |
|
33 |
+mkdir -p %{buildroot}%{_libdir} |
|
34 |
+mkdir -p %{buildroot}%{_libdir}/pkgconfig |
|
35 |
+mkdir -p %{buildroot}%{_bindir} |
|
36 |
+mkdir -p %{buildroot}%{_includedir} |
|
37 |
+mkdir -p %{buildroot}%{_docdir}/%{name}-%{version} |
|
38 |
+ |
|
39 |
+install -m0755 %{relpath}/liblmdb.so %{buildroot}%{_libdir} |
|
40 |
+install -m0755 %{SOURCE1} %{buildroot}%{_libdir}/pkgconfig |
|
41 |
+install -m0755 %{relpath}/mdb_copy %{buildroot}%{_bindir} |
|
42 |
+install -m0755 %{relpath}/mdb_dump %{buildroot}%{_bindir} |
|
43 |
+install -m0755 %{relpath}/mdb_load %{buildroot}%{_bindir} |
|
44 |
+install -m0755 %{relpath}/mdb_stat %{buildroot}%{_bindir} |
|
45 |
+install -m0644 %{relpath}/lmdb.h %{buildroot}%{_includedir} |
|
46 |
+install -m0644 %{relpath}/{CHANGES,LICENSE,intro.doc} %{buildroot}%{_docdir}/%{name}-%{version} |
|
47 |
+ |
|
48 |
+%post |
|
49 |
+ |
|
50 |
+ /sbin/ldconfig |
|
51 |
+ |
|
52 |
+ # First argument is 1 => New Installation |
|
53 |
+ # First argument is 2 => Upgrade |
|
54 |
+ |
|
55 |
+%clean |
|
56 |
+rm -rf %{buildroot}/* |
|
57 |
+ |
|
58 |
+%files |
|
59 |
+%{_docdir}/* |
|
60 |
+%{_libdir}/*.so |
|
61 |
+%{_bindir}/* |
|
62 |
+ |
|
63 |
+%files devel |
|
64 |
+%{_includedir}/* |
|
65 |
+%{_libdir}/pkgconfig/%{name}.pc |
|
66 |
+ |
|
67 |
+%changelog |
|
68 |
+* Wed Dec 13 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 0.9.21-1 |
|
69 |
+- Initial |
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
Summary: Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6. |
3 | 3 |
Name: net-snmp |
4 | 4 |
Version: 5.7.3 |
5 |
-Release: 7%{?dist} |
|
5 |
+Release: 8%{?dist} |
|
6 | 6 |
License: BSD (like) |
7 | 7 |
URL: http://net-snmp.sourceforge.net/ |
8 | 8 |
Group: Productivity/Networking/Other |
... | ... |
@@ -48,7 +48,8 @@ The net-snmp-devel package contains headers and libraries for building SNMP appl |
48 | 48 |
--with-systemd \ |
49 | 49 |
--disable-static \ |
50 | 50 |
--with-x=no \ |
51 |
- --enable-as-needed |
|
51 |
+ --enable-as-needed \ |
|
52 |
+ --without-rpm |
|
52 | 53 |
make |
53 | 54 |
|
54 | 55 |
%install |
... | ... |
@@ -96,6 +97,8 @@ rm -rf %{buildroot}/* |
96 | 96 |
%exclude /usr/lib/perl5/5.22.1/x86_64-linux-thread-multi/perllocal.pod |
97 | 97 |
|
98 | 98 |
%changelog |
99 |
+* Wed Jan 31 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 5.7.3-8 |
|
100 |
+- build without rpm support |
|
99 | 101 |
* Mon Jul 24 2017 Dheeraj Shetty <dheerajs@vmware.com> 5.7.3-7 |
100 | 102 |
- Make service file a different source |
101 | 103 |
* Tue Apr 04 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 5.7.3-6 |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Summary: Open Source Security Compliance Solution |
2 | 2 |
Name: openscap |
3 | 3 |
Version: 1.2.14 |
4 |
-Release: 3%{?dist} |
|
4 |
+Release: 4%{?dist} |
|
5 | 5 |
License: GPL2+ |
6 | 6 |
URL: https://www.open-scap.org |
7 | 7 |
Source0: https://github.com/OpenSCAP/openscap/releases/download/%{version}/openscap-%{version}.tar.gz |
... | ... |
@@ -20,6 +20,7 @@ BuildRequires: bzip2-devel |
20 | 20 |
BuildRequires: curl-devel |
21 | 21 |
BuildRequires: popt-devel |
22 | 22 |
BuildRequires: python2-devel |
23 |
+BuildRequires: lmdb-devel |
|
23 | 24 |
Requires: curl |
24 | 25 |
Requires: popt |
25 | 26 |
%description |
... | ... |
@@ -95,6 +96,8 @@ find %{buildroot} -name '*.la' -delete |
95 | 95 |
%{_libdir}/python2.7/* |
96 | 96 |
|
97 | 97 |
%changelog |
98 |
+* Sun Mar 04 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.2.14-4 |
|
99 |
+- added build requires lmdb-devel |
|
98 | 100 |
* Thu Aug 10 2017 Rongrong Qiu <rqiu@vmware.com> 1.2.14-3 |
99 | 101 |
- Disable make check which need per-XML-XPATH for bug 1900358 |
100 | 102 |
* Fri May 5 2017 Alexey Makhalov <amakhalov@vmware.com> 1.2.14-2 |
... | ... |
@@ -148,7 +148,7 @@ rm -rf %{buildroot} |
148 | 148 |
* Fri Nov 18 2016 Anish Swaminathan <anishs@vmware.com> 2015.7-8 |
149 | 149 |
- Change systemd dependency |
150 | 150 |
* Thu Nov 17 2016 Alexey Makhalov <amakhalov@vmware.com> 2015.7-7 |
151 |
-- Use %setup instead of %autosetup |
|
151 |
+- Use setup instead of autosetup |
|
152 | 152 |
* Fri Oct 07 2016 ChangLee <changlee@vmware.com> 2015.7-6 |
153 | 153 |
- Modified %check |
154 | 154 |
* Thu May 26 2016 Divya Thaluru <dthaluru@vmware.com> 2015.7-5 |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Summary: Commit RPMs to an OSTree repository |
2 | 2 |
Name: rpm-ostree |
3 | 3 |
Version: 2017.4 |
4 |
-Release: 7%{?dist} |
|
4 |
+Release: 8%{?dist} |
|
5 | 5 |
Source0: rpm-ostree-%{version}.tar.gz |
6 | 6 |
%define sha1 rpm-ostree=d34882a455afbf0b57617c0962725276967e838a |
7 | 7 |
Source1: libglnx-0c52d85.tar.gz |
... | ... |
@@ -52,6 +52,7 @@ BuildRequires: photon-release |
52 | 52 |
BuildRequires: photon-repos |
53 | 53 |
BuildRequires: bubblewrap |
54 | 54 |
BuildRequires: dbus |
55 |
+BuildRequires: lmdb-devel |
|
55 | 56 |
|
56 | 57 |
Requires: libcap |
57 | 58 |
Requires: librepo |
... | ... |
@@ -128,6 +129,8 @@ make check |
128 | 128 |
%{_bindir}/rpm-ostree-host/function.inc |
129 | 129 |
|
130 | 130 |
%changelog |
131 |
+* Sun Mar 04 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2017.4-8 |
|
132 |
+- added build requires lmdb-devel |
|
131 | 133 |
* Tue Oct 03 2017 Dheeraj Shetty <dheerajs@vmware.com> 2017.4-7 |
132 | 134 |
- Remove hardcoded /dev/loop0 |
133 | 135 |
* Tue Sep 26 2017 Dheeraj Shetty <dheerajs@vmware.com> 2017.4-6 |
134 | 136 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,124 @@ |
0 |
+#!/bin/sh |
|
1 |
+ |
|
2 |
+#please see https://github.com/rpm-software-management/rpm/issues/281 |
|
3 |
+#uses code from bdbexport.sh and lmdbimport.sh posted in the discussion. |
|
4 |
+ |
|
5 |
+#Use: tool to convert bdb to lmdb and replace existing bdb. |
|
6 |
+ |
|
7 |
+#running rpm --rebuilddb is recommended after conversion |
|
8 |
+#for scenarios like docker, photon-micro etc |
|
9 |
+#rpm might not be installed as just rpm-libs is enough. |
|
10 |
+#a warning is issued in this case. |
|
11 |
+ |
|
12 |
+#not designed to run multiple times without doing manual |
|
13 |
+#maintenance in between (move backup folders etc) |
|
14 |
+ |
|
15 |
+LMDB=/var/lib/rpmdb-lmdb |
|
16 |
+BDB=/var/lib/rpm |
|
17 |
+DUMPDIR=DUMP |
|
18 |
+ |
|
19 |
+#bdb database file names |
|
20 |
+TAGS=" |
|
21 |
+Packages |
|
22 |
+Name |
|
23 |
+Basenames |
|
24 |
+Group |
|
25 |
+Requirename |
|
26 |
+Providename |
|
27 |
+Conflictname |
|
28 |
+Obsoletename |
|
29 |
+Triggername |
|
30 |
+Dirnames |
|
31 |
+Installtid |
|
32 |
+Sigmd5 |
|
33 |
+Sha1header |
|
34 |
+Filetriggername |
|
35 |
+Transfiletriggername |
|
36 |
+Recommendname |
|
37 |
+Suggestname |
|
38 |
+Supplementname |
|
39 |
+Enhancename |
|
40 |
+" |
|
41 |
+ |
|
42 |
+#backup existing bdb to /var/lib/rpm-bdb-backup |
|
43 |
+function backup_and_replace_rpmdb() { |
|
44 |
+ echo "backed up existing bdb to $BDB-bdb-backup" |
|
45 |
+ mv $BDB $BDB-bdb-backup |
|
46 |
+ mv $LMDB $BDB |
|
47 |
+ if [ -x /usr/bin/rpm ]; then |
|
48 |
+ rpm --rebuilddb |
|
49 |
+ else |
|
50 |
+ echo 'rpm binary not found. not running rebuilddb. please install rpm and run rpm --rebuilddb.' |
|
51 |
+ fi |
|
52 |
+} |
|
53 |
+ |
|
54 |
+function export_from_bdb() { |
|
55 |
+ |
|
56 |
+ rm -rf $DUMPDIR |
|
57 |
+ mkdir -p $DUMPDIR |
|
58 |
+ |
|
59 |
+ # --- export all the databases |
|
60 |
+ for TAG in $TAGS; do |
|
61 |
+ echo "-- $TAG --" |
|
62 |
+ [ -f $BDB/$TAG ] || continue |
|
63 |
+ # --- change from hash -> btree, including swabbing integer keys |
|
64 |
+ db_dump $BDB/$TAG | \ |
|
65 |
+ sed -e's,^type=hash,type=btree,' -e'/^h_nelem=/d' -e'/^db_pagesize=/d' \ |
|
66 |
+ -e's,^ \(..\)\(..\)\(..\)\(..\)$, \4\3\2\1,' \ |
|
67 |
+ > $DUMPDIR/$TAG.btree |
|
68 |
+ done |
|
69 |
+} |
|
70 |
+ |
|
71 |
+function import_to_lmdb() { |
|
72 |
+ rm -rf $LMDB |
|
73 |
+ mkdir -p $LMDB |
|
74 |
+ |
|
75 |
+ # --- initialize the lmdb parameters (mapsize MUST be sufficiently large) |
|
76 |
+ cat << EOF | mdb_load $LMDB |
|
77 |
+VERSION=3 |
|
78 |
+format=bytevalue |
|
79 |
+type=btree |
|
80 |
+mapsize=1048576000 |
|
81 |
+maxreaders=64 |
|
82 |
+HEADER=END |
|
83 |
+DATA=END |
|
84 |
+EOF |
|
85 |
+ |
|
86 |
+ # --- import the rpmdb dumps, creating empty indices (unused on RHEL7) as needed |
|
87 |
+ for TAG in $TAGS; do |
|
88 |
+ echo "-- $TAG --" |
|
89 |
+ case $TAG in |
|
90 |
+ Enhance*|Filetrigger*|Recommend*|Suggest*|Supplement*|Transfiletrigge*) |
|
91 |
+ mdb_load -s $TAG -T $LMDB < /dev/null |
|
92 |
+ ;; |
|
93 |
+ *) |
|
94 |
+ mdb_load -f $DUMPDIR/$TAG.btree -s $TAG $LMDB |
|
95 |
+ ;; |
|
96 |
+ esac |
|
97 |
+ done |
|
98 |
+ |
|
99 |
+ mdb_stat -a $LMDB |
|
100 |
+} |
|
101 |
+ |
|
102 |
+function make_lmdb_from_bdb() { |
|
103 |
+ export_from_bdb |
|
104 |
+ import_to_lmdb |
|
105 |
+} |
|
106 |
+ |
|
107 |
+#check and convert |
|
108 |
+function check_and_convert() { |
|
109 |
+ if [ ! -x /usr/bin/db_dump ]; then |
|
110 |
+ echo 'libdb-utils is required to do bdb export. please install libdb-utils and try again.' |
|
111 |
+ return 1 |
|
112 |
+ fi |
|
113 |
+ echo 'checking if rpmdb needs conversion' |
|
114 |
+ if [ -f $BDB/Packages ]; then |
|
115 |
+ echo 'making lmdb from mdb' |
|
116 |
+ make_lmdb_from_bdb |
|
117 |
+ echo 'backing up and replacing bdb with lmdb' |
|
118 |
+ backup_and_replace_rpmdb |
|
119 |
+ fi |
|
120 |
+} |
|
121 |
+ |
|
122 |
+#convert if required. |
|
123 |
+check_and_convert |
0 | 124 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,108 @@ |
0 |
+diff --git a/autogen.sh b/autogen.sh.1 |
|
1 |
+index f7ea2cf..efabeef 100755 |
|
2 |
+--- a/autogen.sh |
|
3 |
+@@ -4,7 +4,7 @@ export CPPFLAGS |
|
4 |
+ export CFLAGS |
|
5 |
+ export LDFLAGS |
|
6 |
+ |
|
7 |
+-autoreconf -i |
|
8 |
++autoreconf -mif |
|
9 |
+ |
|
10 |
+ case "$1" in |
|
11 |
+ "--noconfigure") |
|
12 |
+diff --git a/configure.ac b/configure.ac.1 |
|
13 |
+index 373d694..b562e94 100644 |
|
14 |
+--- a/configure.ac |
|
15 |
+@@ -509,6 +509,19 @@ AM_CONDITIONAL(LIBDW,[test "$WITH_LIBDW" = yes]) |
|
16 |
+ AM_CONDITIONAL(HAVE_LIBDW_STRTAB,[test "$HAVE_LIBDW_STRTAB" = yes]) |
|
17 |
+ |
|
18 |
+ #================= |
|
19 |
++# control bdb defaulting |
|
20 |
++AC_ARG_ENABLE([bdb], |
|
21 |
++ [AS_HELP_STRING([--enable-bdb=@<:@yes/no@:>@] |
|
22 |
++, |
|
23 |
++ [build with default bdb rpm database format support (default=yes)])], |
|
24 |
++ [enable_bdb="$enableval"], |
|
25 |
++ [enable_bdb=yes]) |
|
26 |
++ |
|
27 |
++AS_IF([test "$enable_bdb" = "yes"], [ |
|
28 |
++ |
|
29 |
++ AC_DEFINE([ENABLE_BDB], [], [engage bdb code paths]) |
|
30 |
++ |
|
31 |
++#================= |
|
32 |
+ # Process --with/without-external-db |
|
33 |
+ AC_ARG_WITH(external_db, [AS_HELP_STRING([--with-external-db],[build against an external Berkeley db])], |
|
34 |
+ [case "$with_external_db" in |
|
35 |
+@@ -566,6 +579,8 @@ no|maybe ) |
|
36 |
+ esac |
|
37 |
+ |
|
38 |
+ AC_SUBST([WITH_DB_LIB]) |
|
39 |
++]) |
|
40 |
++AM_CONDITIONAL([BDB], [test "$enable_bdb" = yes]) |
|
41 |
+ |
|
42 |
+ #================= |
|
43 |
+ # Process --enable-ndb |
|
44 |
+diff --git a/lib/Makefile.am b/lib/Makefile.am.1 |
|
45 |
+index baf3238..8ab4f1e 100644 |
|
46 |
+--- a/lib/Makefile.am |
|
47 |
+@@ -24,7 +24,7 @@ EXTRA_PROGRAMS = |
|
48 |
+ |
|
49 |
+ usrlib_LTLIBRARIES = librpm.la |
|
50 |
+ librpm_la_SOURCES = \ |
|
51 |
+- backend/db3.c backend/dbi.c backend/dbi.h \ |
|
52 |
++ backend/dbi.c backend/dbi.h \ |
|
53 |
+ backend/dbiset.c backend/dbiset.h \ |
|
54 |
+ headerutil.c header.c headerfmt.c header_internal.h \ |
|
55 |
+ rpmdb.c rpmdb_internal.h \ |
|
56 |
+@@ -59,11 +59,15 @@ librpm_la_LIBADD += @LUA_LIBS@ |
|
57 |
+ librpm_la_SOURCES += rpmliblua.c rpmliblua.h |
|
58 |
+ endif |
|
59 |
+ |
|
60 |
++if BDB |
|
61 |
++librpm_la_SOURCES += \ |
|
62 |
++ backend/db3.c |
|
63 |
+ if WITH_INTERNAL_DB |
|
64 |
+ librpm_la_LIBADD += $(libdb_la) |
|
65 |
+ else |
|
66 |
+ librpm_la_LIBADD += @WITH_DB_LIB@ |
|
67 |
+ endif |
|
68 |
++endif |
|
69 |
+ |
|
70 |
+ if NDB |
|
71 |
+ librpm_la_SOURCES += \ |
|
72 |
+diff --git a/lib/backend/dbi.c b/lib/backend/dbi.c.1 |
|
73 |
+index e99a5f2..d212881 100644 |
|
74 |
+--- a/lib/backend/dbi.c |
|
75 |
+@@ -50,11 +50,13 @@ dbDetectBackend(rpmdb rdb) |
|
76 |
+ } else |
|
77 |
+ #endif |
|
78 |
+ { |
|
79 |
++#ifdef ENABLE_BDB |
|
80 |
+ rdb->db_ops = &db3_dbops; |
|
81 |
+ if (*db_backend == '\0') { |
|
82 |
+ free(db_backend); |
|
83 |
+ db_backend = xstrdup("bdb"); |
|
84 |
+ } |
|
85 |
++#endif |
|
86 |
+ } |
|
87 |
+ |
|
88 |
+ #if defined(WITH_LMDB) |
|
89 |
+@@ -75,12 +77,14 @@ dbDetectBackend(rpmdb rdb) |
|
90 |
+ free(path); |
|
91 |
+ #endif |
|
92 |
+ |
|
93 |
++#ifdef ENABLE_BDB |
|
94 |
+ path = rstrscat(NULL, dbhome, "/Packages", NULL); |
|
95 |
+ if (access(path, F_OK) == 0 && rdb->db_ops != &db3_dbops) { |
|
96 |
+ rdb->db_ops = &db3_dbops; |
|
97 |
+ rpmlog(RPMLOG_WARNING, _("Found BDB Packages database while attempting %s backend: using bdb backend.\n"), db_backend); |
|
98 |
+ } |
|
99 |
+ free(path); |
|
100 |
++#endif |
|
101 |
+ |
|
102 |
+ if (db_backend) |
|
103 |
+ free(db_backend); |
... | ... |
@@ -3,27 +3,26 @@ |
3 | 3 |
|
4 | 4 |
Summary: Package manager |
5 | 5 |
Name: rpm |
6 |
-Version: 4.13.0.1 |
|
7 |
-Release: 7%{?dist} |
|
6 |
+Version: 4.14.0 |
|
7 |
+Release: 1%{?dist} |
|
8 | 8 |
License: GPLv2+ |
9 | 9 |
URL: http://rpm.org |
10 | 10 |
Group: Applications/System |
11 | 11 |
Vendor: VMware, Inc. |
12 | 12 |
Distribution: Photon |
13 |
-Source0: https://github.com/rpm-software-management/rpm/archive/%{name}-%{version}-release.tar.gz |
|
14 |
-%define sha1 rpm=2119489397d7e4da19320ef9330ab717ac05587d |
|
13 |
+Source0: https://github.com/rpm-software-management/rpm/archive/%{name}-%{version}.tar.bz2 |
|
14 |
+%define sha1 rpm=b15344d67b1bf4b15498efa3667f2ad5de40623f |
|
15 | 15 |
Source1: macros |
16 | 16 |
Source2: brp-strip-debug-symbols |
17 | 17 |
Source3: brp-strip-unneeded |
18 |
-Patch0: find-debuginfo-do-not-generate-non-existing-build-id.patch |
|
19 |
-Patch1: find-debuginfo-do-not-generate-dir-entries.patch |
|
20 |
-Patch2: rpm-CVE-2017-7501.patch |
|
18 |
+Source4: convert_bdb_to_lmdb.sh |
|
19 |
+Patch0: find-debuginfo-do-not-generate-dir-entries.patch |
|
20 |
+Patch1: rpm-use-lmdb.patch |
|
21 | 21 |
Requires: bash |
22 |
-Requires: libdb |
|
23 | 22 |
Requires: rpm-libs = %{version}-%{release} |
24 | 23 |
Requires: libarchive |
25 | 24 |
BuildRequires: libarchive-devel |
26 |
-BuildRequires: libdb-devel |
|
25 |
+BuildRequires: lmdb-devel |
|
27 | 26 |
BuildRequires: popt-devel |
28 | 27 |
BuildRequires: nss-devel |
29 | 28 |
BuildRequires: elfutils-devel |
... | ... |
@@ -38,6 +37,7 @@ RPM package manager |
38 | 38 |
Summary: Libraries and header files for rpm |
39 | 39 |
Provides: pkgconfig(rpm) |
40 | 40 |
Requires: %{name} = %{version}-%{release} |
41 |
+Requires: lmdb-devel |
|
41 | 42 |
%description devel |
42 | 43 |
Static libraries and header files for the support library for rpm |
43 | 44 |
|
... | ... |
@@ -51,6 +51,7 @@ Requires: zlib |
51 | 51 |
Requires: bzip2-libs |
52 | 52 |
Requires: elfutils-libelf |
53 | 53 |
Requires: xz-libs |
54 |
+Requires: lmdb |
|
54 | 55 |
%description libs |
55 | 56 |
Shared libraries librpm and librpmio |
56 | 57 |
|
... | ... |
@@ -85,17 +86,25 @@ Requires: python3 |
85 | 85 |
%description -n python3-rpm |
86 | 86 |
Python3 rpm. |
87 | 87 |
|
88 |
+%package convert-db |
|
89 |
+Summary: Tools to convert bdb to lmdb |
|
90 |
+Group: Applications/Utilities |
|
91 |
+Requires: libdb-utils |
|
92 |
+Requires: lmdb |
|
93 |
+%description convert-db |
|
94 |
+Tools to convert existing rpm db from bdb to lmdb. |
|
95 |
+ |
|
88 | 96 |
%prep |
89 |
-%setup -n rpm-%{name}-%{version}-release |
|
97 |
+%setup -n %{name}-%{version} |
|
90 | 98 |
%patch0 -p1 |
91 | 99 |
%patch1 -p1 |
92 |
-%patch2 -p1 |
|
93 | 100 |
|
94 | 101 |
%build |
95 | 102 |
sed -i '/define _GNU_SOURCE/a #include "../config.h"' tools/sepdebugcrcfix.c |
96 | 103 |
# pass -L opts to gcc as well to prioritize it over standard libs |
97 | 104 |
sed -i 's/-Wl,-L//g' python/setup.py.in |
98 | 105 |
sed -i 's/extra_link_args/library_dirs/g' python/setup.py.in |
106 |
+sed -i 's/_db_backend\s*bdb/_db_backend lmdb/' macros.in |
|
99 | 107 |
|
100 | 108 |
./autogen.sh --noconfigure |
101 | 109 |
./configure \ |
... | ... |
@@ -120,7 +129,8 @@ sed -i 's/extra_link_args/library_dirs/g' python/setup.py.in |
120 | 120 |
--with-cap \ |
121 | 121 |
--without-lua \ |
122 | 122 |
--disable-silent-rules \ |
123 |
- --with-external-db |
|
123 |
+ --disable-bdb \ |
|
124 |
+ --enable-lmdb |
|
124 | 125 |
make %{?_smp_mflags} |
125 | 126 |
|
126 | 127 |
pushd python |
... | ... |
@@ -140,6 +150,7 @@ install -dm 755 %{buildroot}%{_sysconfdir}/rpm |
140 | 140 |
install -vm644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/ |
141 | 141 |
install -vm755 %{SOURCE2} %{buildroot}%{_libdir}/rpm/ |
142 | 142 |
install -vm755 %{SOURCE3} %{buildroot}%{_libdir}/rpm/ |
143 |
+install -vm744 %{SOURCE4} %{buildroot}%{_bindir} |
|
143 | 144 |
|
144 | 145 |
pushd python |
145 | 146 |
python2 setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot} |
... | ... |
@@ -154,7 +165,7 @@ rm -rf %{buildroot} |
154 | 154 |
|
155 | 155 |
%files |
156 | 156 |
%defattr(-,root,root) |
157 |
-/bin/rpm |
|
157 |
+%{_bindir}/rpm |
|
158 | 158 |
%{_bindir}/gendiff |
159 | 159 |
%{_bindir}/rpm2archive |
160 | 160 |
%{_bindir}/rpm2cpio |
... | ... |
@@ -232,12 +243,15 @@ rm -rf %{buildroot} |
232 | 232 |
|
233 | 233 |
%{_libdir}/rpm/pythondeps.sh |
234 | 234 |
%{_libdir}/rpm/rpmdeps |
235 |
+%{_libdir}/rpm/pythondistdeps.py |
|
235 | 236 |
|
236 | 237 |
%{_mandir}/man1/gendiff.1* |
237 | 238 |
%{_mandir}/man8/rpmbuild.8* |
238 | 239 |
%{_mandir}/man8/rpmdeps.8* |
239 | 240 |
%{_mandir}/man8/rpmspec.8* |
240 | 241 |
%{_mandir}/man8/rpmsign.8.gz |
242 |
+%{_mandir}/man8/rpm-misc.8.gz |
|
243 |
+%{_mandir}/man8/rpm-plugin-systemd-inhibit.8.gz |
|
241 | 244 |
|
242 | 245 |
%files devel |
243 | 246 |
%defattr(-,root,root) |
... | ... |
@@ -259,9 +273,13 @@ rm -rf %{buildroot} |
259 | 259 |
%defattr(-,root,root) |
260 | 260 |
%{python3_sitelib}/* |
261 | 261 |
|
262 |
+%files convert-db |
|
263 |
+%defattr(-,root,root) |
|
264 |
+%{_bindir}/convert_bdb_to_lmdb.sh |
|
265 |
+ |
|
262 | 266 |
%changelog |
263 |
-* Thu Dec 21 2017 Xiaolin Li <xiaolinl@vmware.com> 4.13.0.1-7 |
|
264 |
-- Fix CVE-2017-7501 |
|
267 |
+* Fri Dec 15 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 4.14.0-1 |
|
268 |
+- Update to 4.14.0, remove bdb dependences and use lmdb. |
|
265 | 269 |
* Wed Oct 04 2017 Alexey Makhalov <amakhalov@vmware.com> 4.13.0.1-6 |
266 | 270 |
- make python{,3}-rpm depend on current version of librpm |
267 | 271 |
* Wed Jun 28 2017 Xiaolin Li <xiaolinl@vmware.com> 4.13.0.1-5 |
... | ... |
@@ -692,3 +692,11 @@ class PackageUtils(object): |
692 | 692 |
# self.logger.error("Building rpm failed for " + specFile) |
693 | 693 |
# raise Exception("RPM Build failed") |
694 | 694 |
return listRPMFiles, listSRPMFiles |
695 |
+ |
|
696 |
+ #run db conversion. needs to be run in chroot. |
|
697 |
+ #its important to do this after rpm operations from |
|
698 |
+ #outside chroot is done. |
|
699 |
+ def ensureLMDBForRPMDB(self, chrootID, logFile): |
|
700 |
+ convertCmd= "convert_bdb_to_lmdb.sh" |
|
701 |
+ chrootCmd=self.runInChrootCommand+" "+chrootID |
|
702 |
+ CommandUtils().runCommandInShell(convertCmd, logFile, chrootCmd) |
... | ... |
@@ -160,6 +160,11 @@ class ToolChainUtils(object): |
160 | 160 |
print(constants.perPackageToolChain[packageName]) |
161 | 161 |
self.installCustomToolChainRPMS(chrootID, constants.perPackageToolChain[packageName], |
162 | 162 |
packageName) |
163 |
+ #convert rpm db to lmdb (if required) |
|
164 |
+ convertLogFile = self.logPath+"/rpmdbconvert.log" |
|
165 |
+ pkgUtilsConvert=PackageUtils(self.logName,self.logPath) |
|
166 |
+ pkgUtilsConvert.ensureLMDBForRPMDB(chrootID, convertLogFile) |
|
167 |
+ |
|
163 | 168 |
|
164 | 169 |
def installCustomToolChainRPMS(self, chrootID, listOfToolChainPkgs, packageName): |
165 | 170 |
self.logger.info("Installing package specific tool chain RPMs for " + packageName + |
... | ... |
@@ -111,11 +111,11 @@ class constants(object): |
111 | 111 |
"openssl", |
112 | 112 |
"openssl-devel", |
113 | 113 |
"python2", |
114 |
- "libdb", |
|
115 | 114 |
"rpm", |
116 | 115 |
"groff", |
117 | 116 |
"man-pages", |
118 |
- "cpio"] |
|
117 |
+ "cpio", |
|
118 |
+ "lmdb"] |
|
119 | 119 |
|
120 | 120 |
# List or RPMS that will be installed in a chroot prior to build each |
121 | 121 |
# package. This list should be ordered by install order. On a stage1 |
... | ... |
@@ -214,10 +214,13 @@ class constants(object): |
214 | 214 |
"rpm-build", |
215 | 215 |
"rpm-devel", |
216 | 216 |
"rpm-libs", |
217 |
+ "rpm-convert-db", |
|
217 | 218 |
"groff", |
218 | 219 |
"man-pages", |
219 | 220 |
"cpio", |
220 |
- "go"] |
|
221 |
+ "go", |
|
222 |
+ "lmdb", |
|
223 |
+ "libdb-utils"] |
|
221 | 224 |
|
222 | 225 |
perPackageToolChain = dict.fromkeys( |
223 | 226 |
["openjdk8", |
... | ... |
@@ -3,8 +3,8 @@ noarch/man-pages-3.59-1.ph1.noarch.rpm |
3 | 3 |
noarch/apache-maven-3.3.9-4.ph1.noarch.rpm |
4 | 4 |
x86_64/python2-devel-2.7.11-1.ph1.x86_64.rpm |
5 | 5 |
x86_64/nspr-4.11-1.ph1.x86_64.rpm |
6 |
-x86_64/rpm-4.13.0.1-5.ph2.x86_64.rpm |
|
7 |
-x86_64/rpm-libs-4.13.0.1-5.ph2.x86_64.rpm |
|
6 |
+x86_64/rpm-4.14.0-1.ph2.x86_64.rpm |
|
7 |
+x86_64/rpm-libs-4.14.0-1.ph2.x86_64.rpm |
|
8 | 8 |
x86_64/binutils-devel-2.25.1-1.ph1.x86_64.rpm |
9 | 9 |
x86_64/nss-3.21-1.ph1.x86_64.rpm |
10 | 10 |
x86_64/mpfr-devel-3.1.3-1.ph1.x86_64.rpm |
... | ... |
@@ -21,10 +21,10 @@ x86_64/readline-7.0-1.ph1.x86_64.rpm |
21 | 21 |
x86_64/gettext-0.19.5.1-1.ph1.x86_64.rpm |
22 | 22 |
x86_64/perl-5.22.1-2.ph1.x86_64.rpm |
23 | 23 |
x86_64/man-db-2.7.5-1.ph1.x86_64.rpm |
24 |
-x86_64/elfutils-libelf-0.165-1.ph1.x86_64.rpm |
|
24 |
+x86_64/elfutils-libelf-0.169-2.ph2.x86_64.rpm |
|
25 | 25 |
x86_64/gdbm-1.11-1.ph1.x86_64.rpm |
26 | 26 |
x86_64/autoconf-2.69-3.ph1.x86_64.rpm |
27 |
-x86_64/rpm-devel-4.13.0.1-5.ph2.x86_64.rpm |
|
27 |
+x86_64/rpm-devel-4.14.0-1.ph2.x86_64.rpm |
|
28 | 28 |
x86_64/file-5.24-1.ph1.x86_64.rpm |
29 | 29 |
x86_64/mpfr-3.1.3-1.ph1.x86_64.rpm |
30 | 30 |
x86_64/zlib-devel-1.2.8-2.ph1.x86_64.rpm |
... | ... |
@@ -32,7 +32,7 @@ x86_64/libgcc-devel-5.3.0-1.ph1.x86_64.rpm |
32 | 32 |
x86_64/bison-3.0.4-1.ph1.x86_64.rpm |
33 | 33 |
x86_64/lua-5.3.2-1.ph1.x86_64.rpm |
34 | 34 |
x86_64/util-linux-2.27.1-1.ph1.x86_64.rpm |
35 |
-x86_64/rpm-build-4.13.0.1-5.ph2.x86_64.rpm |
|
35 |
+x86_64/rpm-build-4.14.0-1.ph2.x86_64.rpm |
|
36 | 36 |
x86_64/procps-ng-3.3.11-1.ph1.x86_64.rpm |
37 | 37 |
x86_64/coreutils-8.24-1.ph1.x86_64.rpm |
38 | 38 |
x86_64/util-linux-devel-2.27.1-1.ph1.x86_64.rpm |
... | ... |
@@ -51,14 +51,14 @@ x86_64/sqlite-autoconf-3.11.0-1.ph1.x86_64.rpm |
51 | 51 |
x86_64/flex-2.5.39-1.ph1.x86_64.rpm |
52 | 52 |
x86_64/libstdc++-devel-5.3.0-1.ph1.x86_64.rpm |
53 | 53 |
x86_64/openssl-1.0.2g-1.ph1.x86_64.rpm |
54 |
-x86_64/elfutils-0.165-1.ph1.x86_64.rpm |
|
54 |
+x86_64/elfutils-0.169-2.ph2.x86_64.rpm |
|
55 | 55 |
x86_64/expat-2.1.0-1.ph1.x86_64.rpm |
56 | 56 |
x86_64/popt-1.16-1.ph1.x86_64.rpm |
57 | 57 |
x86_64/mpc-1.0.3-1.ph1.x86_64.rpm |
58 | 58 |
x86_64/bzip2-1.0.6-4.ph1.x86_64.rpm |
59 | 59 |
x86_64/glibc-2.22-3.ph1.x86_64.rpm |
60 | 60 |
x86_64/python2-2.7.11-1.ph1.x86_64.rpm |
61 |
-x86_64/elfutils-devel-0.165-1.ph1.x86_64.rpm |
|
61 |
+x86_64/elfutils-devel-0.169-2.ph2.x86_64.rpm |
|
62 | 62 |
x86_64/patch-2.7.5-1.ph1.x86_64.rpm |
63 | 63 |
x86_64/xz-5.2.2-1.ph1.x86_64.rpm |
64 | 64 |
x86_64/binutils-2.25.1-1.ph1.x86_64.rpm |
... | ... |
@@ -66,7 +66,7 @@ x86_64/libgomp-devel-5.3.0-1.ph1.x86_64.rpm |
66 | 66 |
x86_64/bzip2-devel-1.0.6-4.ph1.x86_64.rpm |
67 | 67 |
x86_64/libgcc-5.3.0-1.ph1.x86_64.rpm |
68 | 68 |
x86_64/gzip-1.6-1.ph1.x86_64.rpm |
69 |
-x86_64/elfutils-libelf-devel-0.165-1.ph1.x86_64.rpm |
|
69 |
+x86_64/elfutils-libelf-devel-0.169-2.ph2.x86_64.rpm |
|
70 | 70 |
x86_64/openssl-devel-1.0.2g-1.ph1.x86_64.rpm |
71 | 71 |
x86_64/pkg-config-0.28-1.ph1.x86_64.rpm |
72 | 72 |
x86_64/popt-devel-1.16-1.ph1.x86_64.rpm |
... | ... |
@@ -85,3 +85,7 @@ x86_64/go-1.4.2-5.ph1.x86_64.rpm |
85 | 85 |
x86_64/filesystem-1.0-7.ph1.x86_64.rpm |
86 | 86 |
x86_64/libdb-5.3.28-1.ph2dev.x86_64.rpm |
87 | 87 |
x86_64/libdb-devel-5.3.28-1.ph2dev.x86_64.rpm |
88 |
+x86_64/libdb-utils-5.3.28-3.ph2.x86_64.rpm |
|
89 |
+x86_64/rpm-convert-db-4.14.0-1.ph2.x86_64.rpm |
|
90 |
+x86_64/lmdb-0.9.21-1.ph2.x86_64.rpm |
|
91 |
+x86_64/lmdb-devel-0.9.21-1.ph2.x86_64.rpm |