Check-in [95e17f4e3f]
Not logged in
Overview

SHA1 Hash:95e17f4e3f12b5a674e86dd827fc564bef6dc9da
Date: 2007-08-25 19:31:31
User: drh
Comment:Generate the "manifest.uuid" file containing the SHA1 hash of the "manifest" file whenever the manifest is generated. Makefiles can used the "manifest.uuid" to insert the version number into the executable.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/checkin.c from [dfe4f317d7] to [46f9764a21].

@@ -152,11 +152,11 @@
   chdir(g.zLocalRoot);
   blob_zero(&path);
   vfile_scan(0, &path);
   db_prepare(&q,
       "SELECT x FROM sfile"
-      " WHERE x NOT IN ('manifest','_FOSSIL_')"
+      " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_')"
       " ORDER BY 1");
   while( db_step(&q)==SQLITE_ROW ){
     printf("%s\n", db_column_text(&q, 0));
   }
   db_finalize(&q);
@@ -177,11 +177,11 @@
   chdir(g.zLocalRoot);
   blob_zero(&path);
   vfile_scan(0, &path);
   db_prepare(&q,
       "SELECT %Q || x FROM sfile"
-      " WHERE x NOT IN ('manifest','_FOSSIL_')"
+      " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_')"
       " ORDER BY 1", g.zLocalRoot);
   while( db_step(&q)==SQLITE_ROW ){
     unlink(db_column_text(&q, 0));
   }
   db_finalize(&q);

Modified src/checkout.c from [ded735af90] to [59343953ba].

@@ -97,17 +97,25 @@
 ** and store it in the root of the local check-out.
 */
 void manifest_to_disk(int vid){
   char *zManFile;
   Blob manifest;
+  Blob hash;
 
   blob_zero(&manifest);
   zManFile = mprintf("%smanifest", g.zLocalRoot);
   content_get(vid, &manifest);
   blob_write_to_file(&manifest, zManFile);
   free(zManFile);
+  blob_zero(&hash);
+  sha1sum_blob(&manifest, &hash);
   blob_reset(&manifest);
+  zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
+  blob_append(&hash, "\n", 1);
+  blob_write_to_file(&hash, zManFile);
+  free(zManFile);
+  blob_reset(&hash);
 }
 
 /*
 ** COMMAND: checkout
 **

Modified src/zip.c from [a664fdc0f6] to [a6ead783d2].

@@ -267,25 +267,30 @@
 ** If the RID object does not exist in the repository, then
 ** pZip is zeroed.
 */
 void zip_of_baseline(int rid, Blob *pZip){
   int i;
-  Blob mfile, file;
+  Blob mfile, file, hash;
   Manifest m;
 
   content_get(rid, &mfile);
   if( blob_size(&mfile)==0 ){
     blob_zero(pZip);
     return;
   }
   blob_zero(&file);
+  blob_zero(&hash);
   blob_copy(&file, &mfile);
   zip_open();
   if( manifest_parse(&m, &mfile) ){
     zip_set_timedate(m.rDate);
     zip_add_file("manifest", &file);
+    sha1sum_blob(&file, &hash);
     blob_reset(&file);
+    blob_append(&hash, "\n", 1);
+    zip_add_file("manifest.uuid", &hash);
+    blob_reset(&hash);
     for(i=0; i<m.nFile; i++){
       int fid = uuid_to_rid(m.aFile[i].zUuid, 0);
       if( fid ){
         content_get(fid, &file);
         zip_add_file(m.aFile[i].zName, &file);