X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=lib%2Finteg.c;h=13a2505bf53b7bf5b1454392c0885a8c279777d7;hb=160587258d4032ba91ad2bc135ae611236b61f49;hp=6abfcf340cff7087ea82a75c9e83cffd215fa130;hpb=62b81a9629f5a80a4cf9d8fae6f778e2b857c2a6;p=zpackage diff --git a/lib/integ.c b/lib/integ.c index 6abfcf3..13a2505 100644 --- a/lib/integ.c +++ b/lib/integ.c @@ -127,6 +127,10 @@ static void hash_query(struct zpm *zpm, const char *zSql, struct sha256_state *h hash_byte(h, 'B'); hash_int(h, bytes); break; + default: + hash_byte(h, 'U'); + continue; + break; } sha256_process(h, data, bytes); } @@ -144,9 +148,10 @@ int zpm_package_hash(struct zpm *zpm, char *pkgid, char *hash) { return 0; } - sha256_init(&d); /* find package */ + sha256_init(&d); + sql = sqlite3_mprintf("select package,version,release,description,architecture,url,licenses,packager,build_time from packages_pkgid where pkgid = %Q", pkgid); hash_query(zpm, sql, &d); @@ -155,12 +160,20 @@ int zpm_package_hash(struct zpm *zpm, char *pkgid, char *hash) { /* hash package files */ sql = sqlite3_mprintf("select path, mode, username, groupname, configuration, " - "filetype, target, devmajor, devminor, mtime, hash " + "filetype, target, device, mtime, hash " "from packagefiles_pkgid where pkgid = %Q order by path", pkgid); hash_query(zpm, sql, &d); sqlite3_free(sql); + /* package dependencies */ + sql = sqlite3_mprintf("dselect requires from packagedeps" + " where printf('%%q-%%q-%%d',package,version,release) = %Q" + "order by requires", + pkgid); + hash_query(zpm, sql, &d); + sqlite3_free(sql); + sha256_done(&d, tmp); for (i=0; i<32; i++) { sprintf(hash+i*2, "%02x", (unsigned)tmp[i]); @@ -168,7 +181,6 @@ int zpm_package_hash(struct zpm *zpm, char *pkgid, char *hash) { hash[64] = 0; return 1; - } int zpm_package_sethash(struct zpm *zpm, char *pkgid, char *hash) {