Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 1a048a9

Browse files
Remove package-lock.json files (#543)
- Fixed bug in chaincode packaging that deadlocked tests. - Fixed bug in scenario tests that incorrectly identified whether chaincode was already deployed. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
1 parent 82199a8 commit 1a048a9

File tree

16 files changed

+97
-22009
lines changed

16 files changed

+97
-22009
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ tmp
1616
.nyc_output/*
1717
*.csv
1818
*.heapsnapshot
19+
package-lock.json
1920

2021
#test files
2122
test/typescript/**/*.js

fabric-ca-client/package-lock.json

Lines changed: 0 additions & 3588 deletions
This file was deleted.

fabric-ca-client/package.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,12 @@
2020
},
2121
"types": "./types/index.d.ts",
2222
"dependencies": {
23-
"grpc": "1.24.3",
23+
"grpc": "1.24.11",
2424
"lodash.clone": "4.5.0",
2525
"jsrsasign": "^8.0.20",
2626
"url": "^0.11.0",
27-
"util": "^0.10.3",
2827
"winston": "^2.4.0"
2928
},
30-
"devDependencies": {
31-
"chai": "^4.1.2",
32-
"chai-as-promised": "^7.1.1",
33-
"mocha": "^7.1.2",
34-
"nyc": "^15.1.0",
35-
"rewire": "^4.0.1",
36-
"sinon": "^6.3.5"
37-
},
3829
"license": "Apache-2.0",
3930
"licenses": [
4031
{

fabric-client/lib/packager/BasePackager.js

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -129,32 +129,27 @@ const BasePackager = class {
129129
* @param desc
130130
* @returns {Promise}
131131
*/
132-
packEntry (pack, desc) {
132+
async packEntry (pack, desc) {
133+
const content = await fs.promises.readFile(desc.fqp);
134+
135+
// Use a deterministic "zero-time" for all date fields
136+
const zeroTime = new Date(0);
137+
const header = {
138+
name: desc.name,
139+
size: content.size,
140+
mode: 0o100644,
141+
atime: zeroTime,
142+
mtime: zeroTime,
143+
ctime: zeroTime
144+
};
145+
133146
return new Promise((resolve, reject) => {
134-
// Use a synchronous read to reduce non-determinism
135-
const content = fs.readFileSync(desc.fqp);
136-
if (!content) {
137-
reject(new Error('failed to read ' + desc.fqp));
138-
} else {
139-
// Use a deterministic "zero-time" for all date fields
140-
const zeroTime = new Date(0);
141-
const header = {
142-
name: desc.name,
143-
size: content.size,
144-
mode: 0o100644,
145-
atime: zeroTime,
146-
mtime: zeroTime,
147-
ctime: zeroTime
148-
};
149-
150-
pack.entry(header, content, (err) => {
151-
if (err) {
152-
reject(err);
153-
} else {
154-
resolve(true);
155-
}
156-
});
157-
}
147+
pack.entry(header, content, (err) => {
148+
if (err) {
149+
return reject(err);
150+
}
151+
resolve(true);
152+
});
158153
});
159154
}
160155

@@ -166,11 +161,14 @@ const BasePackager = class {
166161
* @returns {Promise}
167162
*/
168163
generateTarGz (descriptors, dest) {
164+
logger.debug('generateTarGz ::', descriptors);
165+
169166
return new Promise((resolve, reject) => {
170167
const pack = tar.pack();
171168
// Setup the pipeline to compress on the fly and resolve/reject the promise
172169
pack.pipe(zlib.createGzip()).pipe(dest)
173170
.on('finish', () => {
171+
logger.debug('generateTarGz - finish pipe');
174172
resolve(true);
175173
})
176174
.on('error', (err) => {
@@ -180,18 +178,19 @@ const BasePackager = class {
180178
// Iterate through each descriptor in the order it was provided and resolve
181179
// the entry asynchronously. We will gather results below before
182180
// finalizing the tarball
183-
const tasks = [];
181+
let tasks = Promise.resolve();
184182
for (const desc of descriptors) {
185-
const task = this.packEntry(pack, desc);
186-
tasks.push(task);
183+
tasks = tasks.then(() => this.packEntry(pack, desc));
187184
}
188185

189186
// Block here until all entries have been gathered, and then finalize the
190187
// tarball. This should result in a flush of the entire pipeline before
191188
// resolving the top-level promise.
192-
Promise.all(tasks).then(() => {
189+
tasks.then(() => {
190+
logger.debug('generateTarGz - finalize pack');
193191
pack.finalize();
194192
}).catch((err) => {
193+
logger.error('generateTarGz - packEntry failed ::', err);
195194
reject(err);
196195
});
197196
});

0 commit comments

Comments
 (0)