Check-in [ed608e7fee]
Overview
Comment:Updated to keep track of the upstream OS name and CPU
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ed608e7feee93a51afa9dda429ad50d2c8654049
User & Date: rkeene on 2014-09-09 08:19:24
Other Links: manifest | tags
Context
2014-09-09
08:23
Added a default time to psuedo entries check-in: ef5acff5c9 user: rkeene tags: trunk
08:19
Updated to keep track of the upstream OS name and CPU check-in: ed608e7fee user: rkeene tags: trunk
08:12
Corrected site index generation check-in: cd7064a3fe user: rkeene tags: trunk
Changes

Modified appfs.c from [9a50e0345b] to [4cd4495e1d].

    54     54   struct appfs_package {
    55     55   	struct appfs_package *_next;
    56     56   	int counter;
    57     57   
    58     58   	char name[256];
    59     59   	char version[64];
    60     60   	char sha1[41];
           61  +	char os_str[64];
           62  +	char cpuArch_str[64];
    61     63   	appfs_os_t os;
    62     64   	appfs_cpuArch_t cpuArch;
    63     65   	int isLatest;
    64     66   };
    65     67   
    66     68   struct appfs_site {
    67     69   	struct appfs_site *_next;
................................................................................
   381    383   	obj = (void *) ckalloc(sizeof(*obj));
   382    384   
   383    385   	snprintf(obj->name, sizeof(obj->name), "%s", values[0]);
   384    386   	snprintf(obj->version, sizeof(obj->version), "%s", values[1]);
   385    387   	snprintf(obj->sha1, sizeof(obj->sha1), "%s", values[2]);
   386    388   	obj->os = appfs_convert_os_fromString(values[3]);
   387    389   	obj->cpuArch = appfs_convert_cpuArch_fromString(values[4]);
          390  +	snprintf(obj->os_str, sizeof(obj->os_str), "%s", values[3]);
          391  +	snprintf(obj->cpuArch_str, sizeof(obj->cpuArch_str), "%s", values[4]);
   388    392   	if (values[5][0] == '1') {
   389    393   		obj->isLatest = 1;
   390    394   	} else {
   391    395   		obj->isLatest = 0;
   392    396   	}
   393    397   
   394    398   	if (*head_p == NULL) {
................................................................................
   499    503   	char **retval = _retval;
   500    504   
   501    505   	*retval = strdup(values[0]);
   502    506   
   503    507   	return(0);
   504    508   }
   505    509   
   506         -static char *appfs_lookup_package_hash(const char *hostname, const char *package, appfs_os_t os, appfs_cpuArch_t cpuArch, const char *version) {
          510  +static char *appfs_lookup_package_hash(const char *hostname, const char *package, const char *os, const char *cpuArch, const char *version) {
   507    511   	char *sql;
   508    512   	char *retval = NULL;
   509    513   	int sqlite_ret;
   510    514   
   511    515   	appfs_update_index(hostname);
   512    516   
   513    517   	sql = sqlite3_mprintf("SELECT sha1 FROM packages WHERE hostname = %Q AND package = %Q AND os = %Q AND cpuArch = %Q AND version = %Q;",
   514    518   		hostname,
   515    519   		package,
   516         -		appfs_convert_os_toString(os),
   517         -		appfs_convert_cpuArch_toString(cpuArch),
          520  +		os,
          521  +		cpuArch,
   518    522   		version
   519    523   	);
   520    524   	if (sql == NULL) {
   521    525   		APPFS_DEBUG("Call to sqlite3_mprintf failed.");
   522    526   
   523    527   		return(NULL);
   524    528   	}
................................................................................
   747    751   			}
   748    752   
   749    753   			os_cpuArch_count++;
   750    754   
   751    755   			if (children) {
   752    756   				node = (void *) ckalloc(sizeof(*node));
   753    757   				node->_next = *children;
   754         -				snprintf(node->name, sizeof(node->name), "%s-%s", appfs_convert_os_toString(package->os), appfs_convert_cpuArch_toString(package->cpuArch));
          758  +				snprintf(node->name, sizeof(node->name), "%s-%s", package->os_str, package->cpuArch_str);
   755    759   				*children = node;
   756    760   			}
   757    761   		}
   758    762   
   759    763   		appfs_free_list_package(packages);
   760    764   
   761    765   		free(path_s);
................................................................................
   838    842   	}
   839    843   
   840    844   	/* Request for a file in a specific package */
   841    845   	APPFS_DEBUG("Requesting information for hostname = %s, package = %s, os = %s, cpuArch = %s, version = %s, path = %s", 
   842    846   		hostname, packagename, os, cpuArch, version, path
   843    847   	);
   844    848   
   845         -	package_hash = appfs_lookup_package_hash(hostname, packagename, os_val, cpuArch_val, version);
          849  +	package_hash = appfs_lookup_package_hash(hostname, packagename, os, cpuArch, version);
   846    850   	if (package_hash == NULL) {
   847    851   		free(path_s);
   848    852   
   849    853   		return(-ENOENT);
   850    854   	}
   851    855   
   852    856   	APPFS_DEBUG("  ... which hash a hash of %s", package_hash);