[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #31253 [Circumvention/Snowflake]: Add a webext packaging target to the build script
#31253: Add a webext packaging target to the build script
-------------------------------------+------------------------------
Reporter: arlolra | Owner: (none)
Type: defect | Status: needs_review
Priority: Medium | Milestone:
Component: Circumvention/Snowflake | Version:
Severity: Normal | Resolution:
Keywords: | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
-------------------------------------+------------------------------
Comment (by dcf):
{{{
+ execSync(`git clean -x -d -f .`);
}}}
`git clean` makes me nervous because it has the potential to delete work
in progress. Instead of archiving files directly in the working directory,
would it be possible to cpoy the files into a temporary directory, and
leave the working directory untouched? Something like this may be safer:
{{{
npm run webext
TMPDIR=$(mktemp -d webext.XXXXXXXX)
git archive HEAD ./webext | tar -C "$TMPDIR" -xf -
cp webext/snowflake.js "$TMPDIR/webext/"
rm -f webext.zip
(cd "$TMPDIR/webext" && zip -rX ../../webext.zip .)
}}}
You need to `rm -f webext.zip` first, because otherwise `zip` will modify
an existing file, potentially leaving garbage in it. The `-X` option to
`zip` omits filesystem metadata such as uid/gid. (You can inspect the
difference using `zipinfo -v webext.zip`.)
Here's potentially a better way to make source.zip, that only includes
versioned files without the need for `git clean`:
{{{
snowflake/proxy$ git archive -o source.zip HEAD .
}}}
What happens if one of the `execSync` calls fails? Does the whole `pack-
webext` task fail, or does it try to execute the remaining code?
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/31253#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs