Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation with warning about overriding default tar options. #889

Merged
merged 1 commit into from
Oct 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/sphinx/formats/universal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ If you want to force local for the `tgz` output add this line:
universalArchiveOptions in (Universal, packageZipTarball) := Seq("--force-local", "-pcvf")

This will set the cli options for the `packageZipTarball` task in the `Universal` plugin to use the options ``--force-local`` and ``pcvf``.
Be aware that the above line will overwrite the default options. You may want to prepend your options, doing something like:

.. code-block:: scala

universalArchiveOptions in (Universal, packageZipTarball) :=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying this. It would be nicer add this as a second example as this is more a sbt operator confusion then a native-packager documentation issue. The := operator overrides an existing setting whereas += / ++= appends something to an existing setting that is a Seq. So you change the example to

// override settings
universalArchiveOptions in (Universal, packageZipTarball) := Seq("--force-local", "-pvcf")
// addditional settings
universalArchiveOptions in (Universal, packageZipTarball) ++= Seq("--exclude", "*~"

Copy link
Contributor Author

@mackler mackler Oct 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the second one work? I am under the impression that extra options to tar need to be prepended rather than appended, because the default switches include -f which must be followed by the tar-file name. But I believe the appended options will be placed between the -f switch and the tar-file name. Am I wrong about that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. Not sure. In your description you overrode the complete settings

universalArchiveOptions in (Universal, packageZipTarball) := Seq("--exclude", "*~")

which caused an error. Can you try if appending works as well? I guess since these are all options the order shouldn't matter.

Copy link
Contributor Author

@mackler mackler Oct 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the append as

universalArchiveOptions in (Universal, packageZipTarball) ++= Seq("--exclude", "*~")

and the resulting output included:

Running with tar -pcvf --exclude *~ /tmp/sbt_72102b69/myApp-0.1.tar myApp-0.1
tar: *~: Cannot stat: No such file or directory
tar: /tmp/sbt_72102b69/myApp-0.1.tar: Cannot stat: No such file or directory

and then later:

gzip: can't stat: /tmp/sbt_72102b69/myApp-0.1.tar: No such file or directory
java.lang.RuntimeException: Error gziping /tmp/sbt_72102b69/myApp-0.1.tar. Exit code: 1
[error] (server/universal:packageZipTarball) Error gziping /tmp/sbt_72102b69/myApp-0.1.tar. Exit code: 1

Correct me if I'm wrong, but it looks like the generated command told tar to name the tar-file --exclude, and that (nonexistent) files named *~ and /tmp/sbt_72102b69/myApp-0.1.tar are to be included in the archive.

Again, the default options seem to depend on nothing coming between the -f switch and the tar-file name, which is what appending--but not prepending--custom options to the defaults does.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Thanks for checking all this, currently I don't have much time, even for the small things.

(Seq("--exclude", "*~") ++ (universalArchiveOptions in (Universal, packageZipTarball)).value)

Currently, these task can be customized:

Expand Down