build-deb.sh: Allow building source packages, pass options#178
Open
sjlongland wants to merge 2 commits intorscada:masterfrom
Open
build-deb.sh: Allow building source packages, pass options#178sjlongland wants to merge 2 commits intorscada:masterfrom
sjlongland wants to merge 2 commits intorscada:masterfrom
Conversation
Allow end users to build source packages, sign packages with their own GnuPG key, and perform other interactions with `dpkg-buildpackage`.
fredrik-sk
suggested changes
Jul 20, 2020
| @@ -1,17 +1,38 @@ | |||
| # ------------------------------------------------------------------------------ | |||
Contributor
There was a problem hiding this comment.
I ran shell check on this script and got this output:
$ shellcheck build-deb.sh
In build-deb.sh line 1:
# ------------------------------------------------------------------------------
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
In build-deb.sh line 62:
debuild -i ${BUILD_OPTS} "$@"
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
debuild -i "${BUILD_OPTS}" "$@"
For more information:
https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
Personally, I belive that the current line 62 is correct, it may conatin several comman line options.
Author
There was a problem hiding this comment.
Yeah, I think double-quoting that will do more harm than good. I see what they're getting at but in this case we want the arguments in the variable to be split apart and interpreted separately.
Comment on lines
+17
to
+27
| case "$1" in | ||
| --build-source-pkg) | ||
| BUILD_SOURCE=1 | ||
| ;; | ||
| --skip-binary) | ||
| BUILD_BINARY=0 | ||
| ;; | ||
| --sign-key|-l) | ||
| SIGN_KEY=$2 | ||
| shift | ||
| ;; |
Contributor
There was a problem hiding this comment.
This block (lines 17-27) would accept misspelled and random flags.
./build-deb --foo --bar -mokey 7 --skip-binary --hello --
No online help/usage.
```
RC=0 stuartl@rikishi ~/vrt/projects/metermaster/libs/libmbus $ ./build-deb.sh --foo --bar -mokey 7 --skip-binary --hello --
Usage: ./build-deb.sh [--build-source-pkg] [--skip-binary]
[{--sign-key|-l} <GPG KEY ID>]
[-- <dpkg-buildpackage options>]
Unrecognised argument --foo
RC=1 stuartl@rikishi ~/vrt/projects/metermaster/libs/libmbus $ ./build-deb.sh -h
Usage: ./build-deb.sh [--build-source-pkg] [--skip-binary]
[{--sign-key|-l} <GPG KEY ID>]
[-- <dpkg-buildpackage options>]
RC=0 stuartl@rikishi ~/vrt/projects/metermaster/libs/libmbus $ ./build-deb.sh -?
Usage: ./build-deb.sh [--build-source-pkg] [--skip-binary]
[{--sign-key|-l} <GPG KEY ID>]
[-- <dpkg-buildpackage options>]
RC=0 stuartl@rikishi ~/vrt/projects/metermaster/libs/libmbus $ ./build-deb.sh --help
Usage: ./build-deb.sh [--build-source-pkg] [--skip-binary]
[{--sign-key|-l} <GPG KEY ID>]
[-- <dpkg-buildpackage options>]
```
5679638 to
2bf18df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow end users to build source packages, sign packages with their own
GnuPG key, and perform other interactions with
dpkg-buildpackage.The new build script works well for unsigned binaries, but users might want source packages (since then re-building is simple), or might require package signing. This caters for those use cases.