summaryrefslogtreecommitdiff
path: root/src/apk.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2020-01-11 03:23:22 +0200
committerTimo Teräs <timo.teras@iki.fi>2020-01-11 11:20:45 +0200
commit6da3e8eb15c0456b9908bedfdeced2f3a550b58c (patch)
treebd6384ddf991a4ad9b33132691fc11ddb8498edb /src/apk.c
parent7ca0d146ecaf2f99781653d1203bd3db7afc85ba (diff)
downloadapk-tools-6da3e8eb15c0456b9908bedfdeced2f3a550b58c.tar.gz
apk-tools-6da3e8eb15c0456b9908bedfdeced2f3a550b58c.tar.bz2
apk-tools-6da3e8eb15c0456b9908bedfdeced2f3a550b58c.tar.xz
apk-tools-6da3e8eb15c0456b9908bedfdeced2f3a550b58c.zip
istream, archive, db: convert db and tar function to use istream
Diffstat (limited to 'src/apk.c')
-rw-r--r--src/apk.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/apk.c b/src/apk.c
index ec16d28..57ac46b 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -635,14 +635,9 @@ int main(int argc, char **argv)
apk_blob_pull_deps(&b, &db, &db.world);
}
if (test_installed_db != NULL) {
- struct apk_bstream *bs = apk_bstream_from_file(AT_FDCWD, test_installed_db);
- if (!IS_ERR_OR_NULL(bs)) {
- apk_db_index_read(&db, bs, -1);
- apk_bstream_close(bs);
- }
+ apk_db_index_read(&db, apk_istream_from_file(AT_FDCWD, test_installed_db), -1);
}
for (i = 0; i < test_repos->num; i++) {
- struct apk_bstream *bs;
apk_blob_t spec = APK_BLOB_STR(test_repos->item[i]), name, tag;
int repo_tag = 0, repo = APK_REPOSITORY_FIRST_CONFIGURED + i;
@@ -659,14 +654,11 @@ int main(int argc, char **argv)
name = spec;
}
- bs = apk_bstream_from_file(AT_FDCWD, name.ptr);
- if (IS_ERR_OR_NULL(bs)) {
+ if (apk_db_index_read(&db, apk_istream_from_file(AT_FDCWD, name.ptr), repo) != 0) {
apk_error("Failed to open repository: " BLOB_FMT, BLOB_PRINTF(name));
goto err;
}
- apk_db_index_read(&db, bs, repo);
- apk_bstream_close(bs);
if (repo != -2) {
if (!(apk_flags & APK_NO_NETWORK))
db.available_repos |= BIT(repo);