Skip to content

Commit

Permalink
db format 13, pkgbase actually stored
Browse files Browse the repository at this point in the history
  • Loading branch information
Blub committed Oct 25, 2015
1 parent ba261d8 commit 95b7582
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2015-10-25 Blub

* DB version 13: store pkgbase
* print pkgbase with -Iv

2015-10-25 Blub (0.1.9)

* released
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2015-XX-YY Release 0.1.10
- DB version 13: store pkgbase
- print pkgbase with -Iv

2015-10-25 Release 0.1.9
- new filter: -fcontains
- DB version 12: storing makedepends, new dependency list format: a tuple
Expand Down
11 changes: 11 additions & 0 deletions db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ DB::DB(const Config& optconfig)
contains_check_depends_ = false;
contains_groups_ = false;
contains_filelists_ = false;
contains_pkgbase_ = false;
strict_linking_ = false;
}

Expand Down Expand Up @@ -80,6 +81,12 @@ bool DB::WipePackages() {
return false;
objects_.clear();
packages_.clear();
contains_package_depends_ = false;
contains_make_depends_ = false;
contains_check_depends_ = false;
contains_groups_ = false;
contains_filelists_ = false;
contains_pkgbase_ = false;
return true;
}

Expand Down Expand Up @@ -230,6 +237,8 @@ bool DB::InstallPackage(Package* &&pkg) {
contains_groups_ = true;
if (pkg->filelist_.size())
contains_filelists_ = true;
if (!pkg->pkgbase_.empty())
contains_pkgbase_ = true;

const StringList *libpaths = GetPackageLibPath(pkg);

Expand Down Expand Up @@ -789,6 +798,8 @@ void DB::ShowPackages(bool filter_broken,
else
printf(" -> %s - %s\n", pkg->name_.c_str(), pkg->version_.c_str());
if (config_.verbosity_ >= 1) {
if (!pkg->pkgbase_.empty())
printf(" package base: %s\n", pkg->pkgbase_.c_str());
for (auto &grp : pkg->groups_)
printf(" is in group: %s\n", grp.c_str());
ShowDependList(" depends on: %s%s\n", pkg->depends_);
Expand Down
1 change: 1 addition & 0 deletions db.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct DB {
bool contains_check_depends_;
bool contains_groups_;
bool contains_filelists_;
bool contains_pkgbase_;
// }

DB() = delete;
Expand Down
10 changes: 8 additions & 2 deletions db_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace pkgdepdb {

// version
uint16_t DB::CURRENT = 12;
uint16_t DB::CURRENT = 13;

// magic header
static const char
Expand Down Expand Up @@ -493,6 +493,8 @@ static bool write_pkg(SerialOut &out, Package *pkg,
// Now serialize the actual package data:
out <= pkg->name_
<= pkg->version_;
if (hdrver >= 13)
out <= pkg->pkgbase_;
if (!write_objlist(out, pkg->objects_))
return false;

Expand Down Expand Up @@ -576,6 +578,8 @@ static bool read_pkg(SerialIn &in, Package *&pkg,
// Now serialize the actual package data:
in >= pkg->name_
>= pkg->version_;
if (hdrver >= 13)
in >= pkg->pkgbase_;
if (!read_objlist(in, pkg->objects_, config))
return false;
for (auto &o : pkg->objects_)
Expand Down Expand Up @@ -661,7 +665,9 @@ static bool db_store(DB *db, const string& filename) {
hdr.flags |= DBFlags::FileLists;

// Figure out which database format version this will be
if (db->contains_check_depends_)
if (db->contains_pkgbase_)
hdr.version = 13;
else if (db->contains_check_depends_)
hdr.version = 12;
else if (db->contains_make_depends_)
hdr.version = 10;
Expand Down
4 changes: 4 additions & 0 deletions db_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ void DB::ShowPackages_json(bool filter_broken,
printf(",\n\t\t\t\"version\": ");
json_quote(stdout, pkg->version_);
if (config_.verbosity_ >= 1) {
if (!pkg->pkgbase_.empty()) {
printf(",\n\t\t\t\"pkgbase\": ");
json_quote(stdout, pkg->pkgbase_);
}
if (!pkg->groups_.empty()) {
printf(",\n\t\t\t\"groups\": [");
const char *sep = "\n\t\t\t\t";
Expand Down
5 changes: 3 additions & 2 deletions package.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ struct Package {
StringList filelist_;

// DB version 11:
string description_;
string pkgbase_;
string description_; // not stored
string pkgbase_; // DB version 13
// not stored:
std::map<string,vec<string>>
info_; // generic info - everything not caught above

Expand Down

0 comments on commit 95b7582

Please sign in to comment.