]> pd.if.org Git - zpackage/commitdiff
add dependencies to package hash
authorNathan Wagner <nw@hydaspes.if.org>
Fri, 22 Feb 2019 22:54:54 +0000 (22:54 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Fri, 22 Feb 2019 22:54:54 +0000 (22:54 +0000)
lib/integ.c

index 57e7d87936bfd29417587248c9acb01f674ef352..13a2505bf53b7bf5b1454392c0885a8c279777d7 100644 (file)
@@ -148,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);
@@ -165,6 +166,14 @@ int zpm_package_hash(struct zpm *zpm, char *pkgid, char *hash) {
        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]);
@@ -172,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) {