diff --git a/omnibus/config/patches/rpm/rpmdb-no-create.patch b/omnibus/config/patches/rpm/rpmdb-no-create.patch new file mode 100644 index 00000000000000..5837316ef9589d --- /dev/null +++ b/omnibus/config/patches/rpm/rpmdb-no-create.patch @@ -0,0 +1,25 @@ +--- a/lib/rpmdb.c ++++ b/lib/rpmdb.c +@@ -463,6 +463,11 @@ static int openDatabase(const char * prefix, + if (db == NULL) + return 1; + ++ /* Don't create db if it doesn't exist already */ ++ struct stat st; ++ if (stat(rpmdbHome(db), &st) < 0) ++ return 1; ++ + /* Try to ensure db home exists, error out if we can't even create */ + rc = rpmioMkpath(rpmdbHome(db), 0755, getuid(), getgid()); + if (rc == 0) { +--- a/lib/rpmts.c ++++ b/lib/rpmts.c +@@ -104,7 +104,7 @@ int rpmtsOpenDB(rpmts ts, int dbmode) + rc = rpmdbOpen(ts->rootDir, &ts->rdb, ts->dbmode, 0644); + if (rc) { + char * dn = rpmGetPath(ts->rootDir, "%{_dbpath}", NULL); +- rpmlog(RPMLOG_ERR, _("cannot open Packages database in %s\n"), dn); ++ rpmlog(RPMLOG_DEBUG, _("cannot open Packages database in %s\n"), dn); + free(dn); + } + return rc; diff --git a/omnibus/config/software/rpm.rb b/omnibus/config/software/rpm.rb index cc0057d57a043f..00da9c9147e09b 100644 --- a/omnibus/config/software/rpm.rb +++ b/omnibus/config/software/rpm.rb @@ -49,6 +49,7 @@ env["CFLAGS"] << " -fPIC" patch source: "0001-Include-fcntl.patch", env: env # fix build + patch source: "rpmdb-no-create.patch", env: env # don't create db if it doesn't exist already update_config_guess