Merge lp://qastaging/~lool/snapcraft/mvn-plugin into lp://qastaging/~snappy-dev/snapcraft/core

Proposed by Loïc Minier
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 103
Merged at revision: 134
Proposed branch: lp://qastaging/~lool/snapcraft/mvn-plugin
Merge into: lp://qastaging/~snappy-dev/snapcraft/core
Diff against target: 5578 lines (+5500/-0)
15 files modified
examples/tomcat-maven-webapp/Makefile (+6/-0)
examples/tomcat-maven-webapp/meta/package.yaml (+12/-0)
examples/tomcat-maven-webapp/meta/readme.md (+3/-0)
examples/tomcat-maven-webapp/snapcraft.yaml (+11/-0)
examples/tomcat-maven-webapp/tomcat-conf/catalina.policy (+250/-0)
examples/tomcat-maven-webapp/tomcat-conf/catalina.properties (+145/-0)
examples/tomcat-maven-webapp/tomcat-conf/context.xml (+36/-0)
examples/tomcat-maven-webapp/tomcat-conf/logging.properties (+64/-0)
examples/tomcat-maven-webapp/tomcat-conf/server.xml (+142/-0)
examples/tomcat-maven-webapp/tomcat-conf/tomcat-users.xml (+39/-0)
examples/tomcat-maven-webapp/tomcat-conf/tomcat-users.xsd (+43/-0)
examples/tomcat-maven-webapp/tomcat-conf/web.xml (+4664/-0)
examples/tomcat-maven-webapp/wrapper (+23/-0)
plugins/maven-project.yaml (+11/-0)
snapcraft/plugins/maven_project.py (+51/-0)
To merge this branch: bzr merge lp://qastaging/~lool/snapcraft/mvn-plugin
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
Michael Terry (community) Needs Fixing
Review via email: mp+265117@code.qastaging.launchpad.net

Commit message

Add initial and trivial mvn plugin; runs "mvn package" and copies resulting *.jar and *.war files.

Description of the change

Add initial and trivial mvn plugin; runs "mvn package" and copies resulting *.jar and *.war files.

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

As discussed on IRC, I'd like to move the jar/war files out of the toplevel. Maybe under war/ and jar/ directories for now?

Also, I prefer to see this plugin renamed to maven-project.

Lastly, this needs a JRE bundled too (like a requires: jdk with a jdk plugin that lets you compile during build and puts a jre into the snap). I've got some code that looks at adding that (via simply using ubuntu archive version for now) along with an ant-project plugin. So that can be done separately, just to get this in if ya like. So not a blocker.

review: Needs Fixing
Revision history for this message
Michael Terry (mterry) wrote :

This now also needs merging with trunk (systemPackages -> build-tools) and now that jdk support is in trunk, maybe a "requires: [jdk]" line too.

Revision history for this message
Leo Arias (elopio) wrote :

A small comment for pep8 compliance.

Revision history for this message
Leo Arias (elopio) :
Revision history for this message
Loïc Minier (lool) wrote :

Ready for review; there's a permission issue I'm working around which makes things rather ugly; need to check with Jamie where this comes from

Revision history for this message
Michael Terry (mterry) wrote :

(This didn't work last time I tested it end to end. Lool said it was a known bug he was working on.)

Will set to WIP.

Revision history for this message
Michael Terry (mterry) wrote :

Lool says it's just the tomcat example that has problems, not the plugin itself.

Lool, can you maybe add a README then to that example, explaining how and why it won't work, so that we can set expectations and know how we would fix in future?

So I'll just review the new plugin:

+ if not self.run(['mkdir', '-p', wardir]):
+ return False

You do this a couple time. Plugins have access to self.makedirs(wardir) that does this nicely.

+ snapcraft.common.log('Could not find any built jar or war files for...
+ sys.exit(1)

Our logging support is in the middle of some refactoring by Leo, but the current way to do this is:

logger.error('Could not find any built jar or war files for part {}'.format(self.name))
snapcraft.common.fatal()

review: Needs Fixing
98. By Loïc Minier

Merge with lp:snapcraft trunk.

------------- This line and the following will be ignored --------------

removed:
  docs/flow.md
added:
  README.md
  docs/intro.md
  docs/your-first-snap.md
  examples/py2-project/
  examples/py2-project/Makefile
  examples/py2-project/meta/
  examples/py2-project/meta/package.yaml
  examples/py2-project/meta/readme.md
  examples/py2-project/sha3sum.py
  examples/py2-project/snapcraft.yaml
  examples/qmldemo/
  examples/qmldemo/demo.qml
  examples/qmldemo/meta/
  examples/qmldemo/meta/package.yaml
  examples/qmldemo/meta/readme.md
  examples/qmldemo/snapcraft.yaml
  integration-tests/data/assemble/binary1.after
  integration-tests/data/hg-branch/
  integration-tests/data/hg-branch/snapcraft.yaml
  integration-tests/data/hg-head/
  integration-tests/data/hg-head/snapcraft.yaml
  integration-tests/data/hg-tag/
  integration-tests/data/hg-tag/snapcraft.yaml
  integration-tests/data/simple-tar/evil-parent.tar.gz
  integration-tests/data/simple-tar/evil-slash.tar.gz
  integration-tests/data/simple-tar/nodir.tar.xz
  integration-tests/data/simple-tar/simple.tar.bz2
  plugins/python2-project.yaml
  plugins/python2.yaml
  plugins/qml.yaml
  snapcraft/log.py
  snapcraft/plugins/python2.py
  snapcraft/plugins/python2_project.py
  snapcraft/plugins/qml.py
  snapcraft/tests/test_common.py
  snapcraft/tests/test_log.py
  snapcraft/tests/test_ubuntu_plugin.py
renamed:
  README.md => HACKING.md
  plugins/go1.4-project.yaml => plugins/go-project.yaml
  plugins/go1.4.yaml => plugins/go.yaml
  snapcraft/plugins/go14.py => snapcraft/plugins/go.py
  snapcraft/plugins/go14_project.py => snapcraft/plugins/go_project.py
modified:
  debian/changelog
  debian/control
  examples/godd/snapcraft.yaml
  examples/gopaste/snapcraft.yaml
  examples/webcam-webui-snap/snapcraft.yaml
  examples/webcam-webui-snap/webcam-webui
  integration-tests/data/assemble/package.yaml.after
  integration-tests/data/assemble/snappy/package.yaml
  integration-tests/data/simple-tar/snapcraft.yaml
  integration-tests/units/jobs.pxu
  plugins/ubuntu.yaml
  snapcraft/__init__.py
  snapcraft/cmds.py
  snapcraft/common.py
  snapcraft/dirs.py
  snapcraft/main.py
  snapcraft/plugin.py
  snapcraft/plugins/ant_project.py
  snapcraft/plugins/copy.py
  snapcraft/plugins/jdk.py
  snapcraft/plugins/python3.py
  snapcraft/plugins/tests/test_ubuntu.py
  snapcraft/plugins/ubuntu.py
  snapcraft/tests/__init__.py
  snapcraft/tests/test_base_plugin.py
  snapcraft/tests/test_cmds.py
  snapcraft/tests/test_copy_plugin.py
  snapcraft/tests/test_plugin.py
  snapcraft/tests/test_yaml.py
  snapcraft/yaml.py
  plugins/go-project.yaml
  plugins/go.yaml
  snapcraft/plugins/go.py
  snapcraft/plugins/go_project.py
pending merges:
  Sergio Schvezov 2015-08-15 [merge] go as build-deps instead of plugged b...
    Sergio Schvezov 2015-08-14 go as build-deps instead of plugged
    Michael Terry 2015-08-14 [merge] Support the Go compiler on all arch...
    Michael Terry 2015-08-06 Update argument to ubuntu plugin
    Michael Terry 2015-08-06 [merge] Merge from trunk
    Michael Terry 2015-07-31 Allow failure on symlink creation
    Michael Terry 2015-07-31 Add missing return
    Michael Terry 2015-07-31 fix typo
    Michael Terry 2015-07-31 Support trusty layout of golang-go
    Michael Terry 2015-07-31 And rename files
    Michael Terry 2015-07-31 Use the Ubuntu package version of go, rathe...
    Simon Eisenmann 2015-08-10 [merge] Fix symlinks for directories as w...
    Simon Eisenmann 2015-08-06 Fix directory symlinks as well.
    Sergio Schvezov 2015-08-08 [merge] debian/control: adding devscripts...
    Sergio Schvezov 2015-08-07 debian/control: adding devscripts as a de...
    Sergio Schvezov 2015-08-06 [merge] Recommends defaulting to None whe...
    Sergio Schvezov 2015-08-05 Recommends defaulting to None when not pa...
    Sergio Schvezov 2015-08-06 [merge] Adding support for mercurial sour...
    Sergio Schvezov 2015-08-05 Adding a runtime dep for mercurial
    Sergio Schvezov 2015-08-05 doh data
    Sergio Schvezov 2015-08-05 Fixing pull/clone logic
    Sergio Schvezov 2015-08-05 Adding mercurial as a dep
    Sergio Schvezov 2015-08-05 Adding integration tests
    Sergio Schvezov 2015-08-05 Test for hg with tag and branch
    Sergio Schvezov 2015-08-05 pep8
    Sergio Schvezov 2015-08-05 Adding support for mercurial
    Michael Terry 2015-08-05 Tiny packaging fixes
    Ted Gould 2015-08-05 [merge] QML Plugin by ted approved by mterry
    Ted Gould 2015-08-05 [merge] Merge trunk (with adaptations)
    Ted Gould 2015-08-05 Drop the options statement
    Ted Gould 2015-08-05 All an implicit package by the name
    Ted Gould 2015-08-05 Use the 'or' syntax
    Ted Gould 2015-08-05 Switch to only allow 'packages'
    Ted Gould 2015-08-05 Drop our version of these commands to take the ...
    Ted Gould 2015-08-05 Removing old configuration key
    Ted Gould 2015-08-05 [merge] Merge trunk
    Ted Gould 2015-07-30 Put newlines at the end of our scripts
    Ted Gould 2015-07-30 Fill in the architecture if not defined
    Ted Gould 2015-07-30 Fix the architecture printouts
    Ted Gould 2015-07-30 Making a centralized command for putting the ar...
    Ted Gould 2015-07-30 Instead of detecting a list, add a packages key
    Ted Gould 2015-07-30 Using format for strings
    Ted Gould 2015-07-30 Only pass the file exists error
    Ted Gould 2015-07-30 [merge] Pull through wrapper path updates
    Ted Gould 2015-07-23 [merge] More wrapper path handling
    Ted Gould 2015-07-22 [merge] Taking the wrapper-path branch
    Ted Gould 2015-07-22 [merge] Merging trunk
    Ted Gould 2015-07-22 Adding in a QML example
    Ted Gould 2015-07-21 [merge] Updated focused assemble
    Ted Gould 2015-07-21 [merge] Merge updated copy plugin (with fixes)
    Ted Gould 2015-07-21 Changing comments for lint
    Ted Gould 2015-07-20 Make it so that we can grab directories if asked
    Ted Gould 2015-07-20 Fix up fonts
    Ted Gould 2015-07-20 [merge] Merge directed assemble
    Ted Gould 2015-07-17 Fix Qt integration to use the base qmlscene
    Ted Gould 2015-07-17 Fix typo in XDB_CONFIG_ROOT
    Ted Gould 2015-07-17 [merge] Merge in additional package changes
    John R. Lenton 2015-07-17 added a bunch of qml-module files
    Ted Gould 2015-07-17 Add XKB functionality
    Ted Gould 2015-07-16 Add all our environment variables
    Ted Gould 2015-07-16 Fix filter directories
    Ted Gould 2015-07-16 Let's not always grab recommends
    Ted Gould 2015-07-15 Change name to just qml
    Ted Gould 2015-07-15 [merge] Grab copy plugin
    Ted Gould 2015-07-15 [merge] Grabbing the assemble branch
    Ted Gould 2015-07-15 Removing the QML setting
    Ted Gould 2015-07-15 Switch to grabbing an instance of the Ubuntu pl...
    Ted Gould 2015-07-14 Better directories
    Ted Gould 2015-07-14 Adding a wrapper script for simple QML
    John R. Lenton 2015-07-14 first pass at simpleqml (no tests!!1!one!)
    Leo Arias 2015-08-05 [merge] Fixed the call to the log from the ubun...
    Leo Arias 2015-08-05 Fixed the call to the log from the ubuntu plugi...
    Leo Arias 2015-08-05 [merge] Refactored the plugin makedirs, with te...
    Leo Arias 2015-08-05 Fixed typo on the exist argument.
    Leo Arias 2015-08-04 Refactored the plugin makedirs, with tests.
    Daniel Holbach 2015-08-05 [merge] Rename docs/tutorial.md to be less...
    Daniel Holbach 2015-08-05 rename tutorial file to be less generic
    Daniel Holbach 2015-08-05 [merge] Small doc markup fixes. by dholbac...
    Daniel Holbach 2015-08-05 indicate what's a file and directory name
    Daniel Holbach 2015-08-05 indicate what's a file and directory name
    Daniel Holbach 2015-08-05 don't use “
    Daniel Holbach 2015-08-05 use real link
    Daniel Holbach 2015-08-05 — and ’ don't really work well
    Daniel Holbach 2015-08-05 [merge] Add some next steps. by dholbach a...
    Daniel Holbach 2015-08-05 add some next steps
    Michael Terry 2015-08-04 [merge] Add python2 and python2-project plu...
    Michael Terry 2015-08-04 Some fixes to match trunk
    Michael Terry 2015-08-04 [merge] Merge from trunk
    Michael Terry 2015-08-03 Update to use new trunk code
    Michael Terry 2015-08-03 [merge] Merge from trunk
    Michael Terry 2015-07-17 Add python2 project type
    Leo Arias 2015-08-04 [merge] Added unit tests for the base plugin.
    Leo Arias 2015-08-04 [merge] Merged with trunk.
    Leo Arias 2015-08-04 Added wget to the test deps.
    Leo Arias 2015-08-04 Added testscenarios to the debian deps.
    Leo Arias 2015-08-04 Added tests for makedirs.
    Leo Arias 2015-08-04 Added more scenarios for wrong type/branch/tag ...
    Leo Arias 2015-08-03 Added a test for passing a bzr branch.
    Leo Arias 2015-08-03 Added a test for getting an unrecognized source.
    Leo Arias 2015-08-03 Added a test for pull tarball.
    Leo Arias 2015-08-03 Added a test for the error when doing a git pul...
    Michael Terry 2015-08-04 [merge] Add intro and tutorial docs.
    Michael Terry 2015-07-31 [merge] Merge latest arch-fixes
    Michael Terry 2015-07-29 [merge] Merge from arch-fixes again
    Michael Terry 2015-07-29 [merge] Merge from arch-fixes
    Michael Terry 2015-07-29 Fix typo
    Michael Terry 2015-07-29 Remove installing/store bits for now
    Michael Terry 2015-07-28 Some wording changes
    Michael Terry 2015-07-28 [merge] Merge from arch-fixes
    Michael Terry 2015-07-28 [merge] Merge in arch-fixes
    Michael Terry 2015-07-28 fixups and expanded tutorial
    Michael Vogt 2015-07-24 expand why we need parts at all
    Michael Vogt 2015-07-24 Start work on the docs
    Michael Terry 2015-08-04 [merge] Include the multiarch triplet to LD...
    Michael Terry 2015-08-04 Also add ubuntu-snappy-cli as build-dep
    Michael Terry 2015-08-04 Depend on dpkg-dev for dpkg-architecture
    Michael Terry 2015-08-04 [merge] Merge from trunk
    Michael Terry 2015-08-03 Insert 'architecture' instead of 'architect...
    Michael Terry 2015-07-31 Address review comments
    Michael Terry 2015-07-31 Use BUILD_ARCH rather than TARGET_ARCH for ...
    Michael Terry 2015-07-29 Fix accidental space deletion
    Michael Terry 2015-07-29 [merge] Merge from trunk
    Michael Terry 2015-07-28 And test that we actually create the right ...
    Michael Terry 2015-07-28 Look in library-triplet locations and set a...
    Leo Arias 2015-08-03 [merge] Send error logs to stderr and message l...
    Leo Arias 2015-07-30 Added the test file.
    Leo Arias 2015-07-30 Send error logs to stderr and message logs to s...
    Ted Gould 2015-07-31 [merge] Allow exec lines that are in the path b...
    Ted Gould 2015-07-30 Make sure to flush the file before using it
    Ted Gould 2015-07-30 Switch to w+ to avoid bytes
    Ted Gould 2015-07-30 Fixing the expected test results for the new code
    Ted Gould 2015-07-30 Use Python logger
    Ted Gould 2015-07-30 Switch to using format based strings
    Ted Gould 2015-07-30 [merge] Update to trunk
    Ted Gould 2015-07-23 Attaching bug
    Ted Gould 2015-07-23 Formatting the string with bytes
    Ted Gould 2015-07-23 Test to make sure that it exists in the path.
    Ted Gould 2015-07-22 Leave relative wrappers untouched
    Colin Watson 2015-07-31 [merge] snapcraft uses sudo, so should depen...
    Colin Watson 2015-07-31 snapcraft uses sudo, so should depend on it.
    Leo Arias 2015-07-29 [merge] Use the format string in wrap_exe. by e...
    Leo Arias 2015-07-23 Use the format string in wrap_exe.
    Leo Arias 2015-07-29 [merge] Use the format string in plugin.py by e...
    Leo Arias 2015-07-29 [merge] Merged with trunk.
    Leo Arias 2015-07-24 Removed the !r as suggested by mterry
    Leo Arias 2015-07-23 Use the format method in load_plugin.
    Leo Arias 2015-07-23 Typo
    Leo Arias 2015-07-23 Prettify the code.
    Leo Arias 2015-07-23 Use the format string in plugin.py
    Leo Arias 2015-07-29 [merge] Cleanups to prepare for changing the fo...
    Leo Arias 2015-07-24 Fixed the imports.
    Leo Arias 2015-07-24 Moved the plugindir cleanup to the base test case.
    Leo Arias 2015-07-23 Add the missing file.
    Leo Arias 2015-07-23 Cleanups to prepare for changing the format str...
    Leo Arias 2015-07-29 [merge] Use the python logger. by elopio approv...
    Leo Arias 2015-07-28 Updated the cmd test.
    Leo Arias 2015-07-28 Revert to prints for now to keep the exact same...
    Leo Arias 2015-07-28 [merge] Merged with trunk.
    Leo Arias 2015-07-23 Log in bold
    Leo Arias 2015-07-23 Fixed the meta plainbox test.
    Leo Arias 2015-07-23 [merge] Merged with trunk.
    Leo Arias 2015-07-23 Added an error message to the exit code asserti...
    Leo Arias 2015-07-21 Updated the plainbox tests.
    Leo Arias 2015-07-21 Removed the call to getLogger.
    Leo Arias 2015-07-20 Changed the format to be more similar to the or...
    Leo Arias 2015-07-20 Prettify the init.
    Leo Arias 2015-07-20 Added the basic config.
    Leo Arias 2015-07-20 Use the python logger.
    Leo Arias 2015-07-20 Consistent use of quotes.
    Leo Arias 2015-07-20 Removed the rest of the old log usages.
    Leo Arias 2015-07-20 yaml uses logger.
    Leo Arias 2015-07-20 Configure the root logger.
    Leo Arias 2015-07-20 cmd now uses logger.
    Leo Arias 2015-07-20 Now notify_stage uses the log.
    Leo Arias 2015-07-20 check for collisions now uses the log.
    Leo Arias 2015-07-20 Init now uses the log.
    Leo Arias 2015-07-20 [merge] Merged with prerequisite.
    Loïc Minier 2015-07-24 [merge] Rework tarball unpack to use tarfile....
    Loïc Minier 2015-07-24 Strip dangerous prefixes from tar files (such...
    Loïc Minier 2015-07-24 Rework tarball unpack to use tarfile. New imp...
    Michael Terry 2015-07-24 cowboy fix for tests (run git config before...
    Michael Terry 2015-07-24 cowboy fix for tests (run bzr whoami before...
    Michael Terry 2015-07-24 cowboy fix for tests (run bzr whoami before...

99. By Loïc Minier

Use os.makedirs() instead or self.run('mkdir', '-p').

100. By Loïc Minier

Log with a logging.getLogger() logger rather than using snapcraft.common.log()
and die with snapcraft.common.fatal() rather than sys.exit(). Import
snapcraft.common.

101. By Loïc Minier

Fix makedirs calls not to fail on second run; these return False when the
directory already exists.

102. By Loïc Minier

Fix wrapper to call "catalina.sh run" directly; the startup.sh would call
"catalina.sh start" which fails at backgrounding java/tomcat in the systemd
environment for some reason.

Revision history for this message
Loïc Minier (lool) wrote :

Hi folks,

After merging with trunk, I've addressed comments from Mike about logging and makedirs and fixed the example to work out of the box; I've completed a successful build + install + run test.

Please review and merge :-)

Thanks,

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Just a minor nit, in some places you use lists with [] and in others with '-'

As in

build-depends: [maven]
requires:
    - jdk

This would look much nicer if it were like:

build-depends:
    - maven
requires:
    - jdk

The same applies to the example package yaml with architecture (and I'm not sure why you aren't using 'architectures').

review: Needs Fixing
103. By Loïc Minier

Use - indented lists in YAMLs.

Revision history for this message
Loïc Minier (lool) wrote :

Fixed; this was copied from other plugins/samples but I've only fixed this plugin for this mp.

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

There are some reviewer errors, I'll those separately.

Thanks for the contribution!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches