Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Use the check-in time as the timestamp for zlib compression on tarballs, os that every tarball for the same check-in is identical. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3e141b792c689c08baffdaac4f62a6fa |
User & Date: | drh 2011-09-28 11:35:17.233 |
References
2011-09-28
| ||
12:09 | merged in trunk [3e141b792c]. ... (check-in: 033e2eb1 user: stephan tags: json) | |
Context
2011-09-29
| ||
11:05 | Cache "manifest" setting in fossil_reserved_name() instead of reading it from the database on every call. This speeds up adding many files. ... (check-in: a369dc77 user: dmitry tags: trunk) | |
2011-09-28
| ||
12:09 | merged in trunk [3e141b792c]. ... (check-in: 033e2eb1 user: stephan tags: json) | |
11:35 | Use the check-in time as the timestamp for zlib compression on tarballs, os that every tarball for the same check-in is identical. ... (check-in: 3e141b79 user: drh tags: trunk) | |
2011-09-27
| ||
19:28 | Call file_wd_isdir() in file_mkdir(). ... (check-in: 13120e96 user: dmitry tags: trunk) | |
Changes
Changes to src/gzip.c.
︙ | ︙ | |||
45 46 47 48 49 50 51 | z[2] = (v>>16) & 0xff; z[3] = (v>>24) & 0xff; } /* ** Begin constructing a gzip file. */ | | < > | > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | z[2] = (v>>16) & 0xff; z[3] = (v>>24) & 0xff; } /* ** Begin constructing a gzip file. */ void gzip_begin(sqlite3_int64 now){ char aHdr[10]; assert( gzip.eState==0 ); blob_zero(&gzip.out); aHdr[0] = 0x1f; aHdr[1] = 0x8b; aHdr[2] = 8; aHdr[3] = 0; if( now==0 ){ now = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0"); } put32(&aHdr[4], now&0xffffffff); aHdr[8] = 2; aHdr[9] = 255; blob_append(&gzip.out, aHdr, 10); gzip.iCRC = 0; gzip.eState = 1; } |
︙ | ︙ | |||
123 124 125 126 127 128 129 | ** Compress a file using gzip. */ void test_gzip_cmd(void){ Blob b; char *zOut; if( g.argc!=3 ) usage("FILENAME"); sqlite3_open(":memory:", &g.db); | | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | ** Compress a file using gzip. */ void test_gzip_cmd(void){ Blob b; char *zOut; if( g.argc!=3 ) usage("FILENAME"); sqlite3_open(":memory:", &g.db); gzip_begin(0); blob_read_from_file(&b, g.argv[2]); zOut = mprintf("%s.gz", g.argv[2]); gzip_step(blob_buffer(&b), blob_size(&b)); blob_reset(&b); gzip_finish(&b); blob_write_to_file(&b, zOut); blob_reset(&b); fossil_free(zOut); } |
Changes to src/tar.c.
︙ | ︙ | |||
42 43 44 45 46 47 48 | /* ** Begin the process of generating a tarball. ** ** Initialize the GZIP compressor and the table of directory names. */ | | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | /* ** Begin the process of generating a tarball. ** ** Initialize the GZIP compressor and the table of directory names. */ static void tar_begin(sqlite3_int64 mTime){ assert( tball.aHdr==0 ); tball.aHdr = fossil_malloc(512+512); memset(tball.aHdr, 0, 512+512); tball.zSpaces = (char*)&tball.aHdr[512]; /* zPrevDir init */ tball.zPrevDir = NULL; tball.nPrevDirAlloc = 0; /* scratch buffer init */ blob_zero(&tball.pax); memcpy(&tball.aHdr[108], "0000000", 8); /* Owner ID */ memcpy(&tball.aHdr[116], "0000000", 8); /* Group ID */ memcpy(&tball.aHdr[257], "ustar\00000", 8); /* POSIX.1 format */ memcpy(&tball.aHdr[265], "nobody", 7); /* Owner name */ memcpy(&tball.aHdr[297], "nobody", 7); /* Group name */ gzip_begin(mTime); db_multi_exec( "CREATE TEMP TABLE dir(name UNIQUE);" ); } /* |
︙ | ︙ | |||
425 426 427 428 429 430 431 | int i; Blob zip; Blob file; if( g.argc<3 ){ usage("ARCHIVE FILE...."); } sqlite3_open(":memory:", &g.db); | | | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | int i; Blob zip; Blob file; if( g.argc<3 ){ usage("ARCHIVE FILE...."); } sqlite3_open(":memory:", &g.db); tar_begin(0); for(i=3; i<g.argc; i++){ blob_zero(&file); blob_read_from_file(&file, g.argv[i]); tar_add_file(g.argv[i], &file, file_wd_perm(g.argv[i]), file_wd_mtime(g.argv[i])); blob_reset(&file); } |
︙ | ︙ | |||
471 472 473 474 475 476 477 | content_get(rid, &mfile); if( blob_size(&mfile)==0 ){ blob_zero(pTar); return; } blob_zero(&hash); blob_zero(&filename); | < > | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | content_get(rid, &mfile); if( blob_size(&mfile)==0 ){ blob_zero(pTar); return; } blob_zero(&hash); blob_zero(&filename); if( zDir && zDir[0] ){ blob_appendf(&filename, "%s/", zDir); } nPrefix = blob_size(&filename); pManifest = manifest_get(rid, CFTYPE_MANIFEST); if( pManifest ){ mTime = (pManifest->rDate - 2440587.5)*86400.0; tar_begin(mTime); if( db_get_boolean("manifest", 0) ){ blob_append(&filename, "manifest", -1); zName = blob_str(&filename); tar_add_file(zName, &mfile, 0, mTime); sha1sum_blob(&mfile, &hash); blob_reset(&mfile); blob_append(&hash, "\n", 1); |
︙ | ︙ | |||
511 512 513 514 515 516 517 518 519 520 521 522 523 524 | } } }else{ sha1sum_blob(&mfile, &hash); blob_append(&filename, blob_str(&hash), 16); zName = blob_str(&filename); mTime = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0;"); tar_add_file(zName, &mfile, 0, mTime); } manifest_destroy(pManifest); blob_reset(&mfile); blob_reset(&filename); tar_finish(pTar); } | > | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | } } }else{ sha1sum_blob(&mfile, &hash); blob_append(&filename, blob_str(&hash), 16); zName = blob_str(&filename); mTime = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0;"); tar_begin(mTime); tar_add_file(zName, &mfile, 0, mTime); } manifest_destroy(pManifest); blob_reset(&mfile); blob_reset(&filename); tar_finish(pTar); } |
︙ | ︙ |