mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Fix --completion-* args to work from AppImage (fixes #285)
This commit is contained in:
parent
7bd38a3eb3
commit
ed62be888c
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,3 +26,4 @@ manual/print.xsl
|
||||
qpdf/build/
|
||||
zlib-flate/build/
|
||||
fuzz/qpdf_fuzzer_seed_corpus/
|
||||
distribution/
|
||||
|
@ -1,5 +1,8 @@
|
||||
2019-06-22 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* It now works to run --completion-bash and --completion-zsh when
|
||||
qpdf is started from an AppImage.
|
||||
|
||||
* Provided a more useful error message when Windows can't get
|
||||
security context. Thanks to user zdenop for supplying some code.
|
||||
Fixes #286.
|
||||
|
@ -264,15 +264,11 @@ zip -r qpdf-external-libs-src.zip external-libs
|
||||
When releasing on sourceforge, `external-libs` distributions go in
|
||||
`external-libs/yyyymmdd`, and qpdf distributions go in `qpdf/vvv`.
|
||||
|
||||
For local iteration on the AppImage generation, follow the release
|
||||
procedures for building the AppImage, but instead of passing git clone
|
||||
options to the docker command, copy qpdf to /tmp/build. You can also
|
||||
pass -e SKIP_TESTS=1 to docker to skip the test suite, useful for
|
||||
rapid iteration. Set up /tmp/build as in the release process.
|
||||
|
||||
cp -a $PWD /tmp/build
|
||||
docker run --privileged -ti --rm -e SKIP_TESTS=1 -v /tmp/build:/tmp/build qpdfbuild
|
||||
|
||||
For local iteration on the AppImage generation, it works to just
|
||||
./azure-pipelines/build-appimage and get the resulting AppImage from
|
||||
the distribution directory. You can also pass -e SKIP_TESTS=1
|
||||
build-appimage, which passes it along to to docker, to skip the test
|
||||
suite, which useful for rapid iteration.
|
||||
|
||||
GENERAL BUILD STUFF
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Any extra args are passed to the docker run command before the
|
||||
# invocation of qpdfbuild. This is useful for iterating locally as
|
||||
# described in README-maintainer.
|
||||
#
|
||||
set -ex
|
||||
cd appimage
|
||||
docker build -t qpdfbuild .
|
||||
@ -6,7 +11,9 @@ rm -rf build
|
||||
mkdir build
|
||||
cd ..
|
||||
git clone .git appimage/build/qpdf
|
||||
docker run --privileged --rm -v $PWD/appimage/build:/tmp/build qpdfbuild
|
||||
docker run --privileged --rm \
|
||||
-v $PWD/appimage/build:/tmp/build ${1+"$@"} qpdfbuild
|
||||
rm -rf distribution
|
||||
mkdir distribution
|
||||
cp -p appimage/build/qpdf/appimage/build/qpdf*AppImage* distribution
|
||||
for i in distribution/*; do
|
||||
|
@ -4337,6 +4337,13 @@ print "\n";
|
||||
with exit code 3 instead of 2.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The <option>--completion-bash</option> and
|
||||
<option>--completion-zsh</option> options now work properly
|
||||
when qpdf is invoked as an AppImage.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
17
qpdf/qpdf.cc
17
qpdf/qpdf.cc
@ -1471,10 +1471,23 @@ ArgParser::argHelp()
|
||||
void
|
||||
ArgParser::argCompletionBash()
|
||||
{
|
||||
std::string progname = argv[0];
|
||||
// Detect if we're in an AppImage and adjust
|
||||
std::string appdir;
|
||||
std::string appimage;
|
||||
if (QUtil::get_env("APPDIR", &appdir) &&
|
||||
QUtil::get_env("APPIMAGE", &appimage))
|
||||
{
|
||||
if ((appdir.length() < strlen(argv[0])) &&
|
||||
(strncmp(appdir.c_str(), argv[0], appdir.length()) == 0))
|
||||
{
|
||||
progname = appimage;
|
||||
}
|
||||
}
|
||||
std::cout << "complete -o bashdefault -o default -o nospace"
|
||||
<< " -C " << argv[0] << " " << whoami << std::endl;
|
||||
<< " -C " << progname << " " << whoami << std::endl;
|
||||
// Put output before error so calling from zsh works properly
|
||||
std::string path = argv[0];
|
||||
std::string path = progname;
|
||||
size_t slash = path.find('/');
|
||||
if ((slash != 0) && (slash != std::string::npos))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user