Bug 205583 - [NEW PORT] www/domoticz: Home Automation System
Summary: [NEW PORT] www/domoticz: Home Automation System
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitry Marakasov
URL:
Keywords: feature, needs-patch, needs-qa, patch
Depends on:
Blocks:
 
Reported: 2015-12-24 17:57 UTC by kiwi
Modified: 2016-01-26 15:19 UTC (History)
2 users (show)

See Also:


Attachments
www/domoticz port (38.81 KB, text/plain)
2015-12-24 17:57 UTC, kiwi
no flags Details
domotics-new.shar (42.89 KB, application/x-shar)
2016-01-13 16:47 UTC, kiwi
no flags Details
Fix the port. (42.89 KB, application/x-shar)
2016-01-19 15:00 UTC, kiwi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description kiwi 2015-12-24 17:57:16 UTC
Created attachment 164603 [details]
www/domoticz port

Here is a brand new port. 

Domoticz is a Home Automation System that lets you monitor and configure
various devices like: Lights, Switches, various sensors/meters like
Temperature, Rain, Wind, UV, Electra, Gas, Water and much more.
Notifications/Alerts can be sent to any mobile device

WWW: http://www.domoticz.com

Note that for the moment this port doesn't handle the OpenZWave part because I have some work to be done on the OpenZWave port that I have to finish.

Thanks to bapt for his marvelous help :)
Comment 1 Dmitry Marakasov freebsd_committer 2015-12-29 13:45:54 UTC
- I think it's preferred to have separate user/group for dedicated service when possible instead of just using www:www. You can add a new user/group to UIDs/GIDs
- The database should be stored in /var/db/domoticz
- I'm not a rc script pro, but the guess is that it won't be able to create a pidfile from non-root, so you may need a subdirectory under /var/run with corresponding owner. Also, rc system should be taught of pidfile, as in pidfile=/var/run/....pid
- Please use USES=lua:52 instead of LIB_DEPENDS
- Likewise, USE_SQLITE=yes
- Likewise, USES=execinfo
- CMAKE_BUILD_TYPE is not needed
Comment 2 kiwi 2016-01-13 16:46:15 UTC
(In reply to Dmitry Marakasov from comment #1)

Hi Dmitry,

Uploaded in domoticz-new.shar the new port with your suggested modifications.

I still use www:www as user, but this is maybe not necessary (some stuff may need root access. I let the responsability of the port user to change user and group if nessary in the rc.conf file, that's why it is customisable on the rc file).

Also I move the database into /var/db/domoticz (customizable on the rc file), and added the pidfile into /var/run/domoticz (customizable too in the rc file).

Please tell me if it ok on your side.

Kind regards and happy new year.
Comment 3 kiwi 2016-01-13 16:47:17 UTC
Created attachment 165512 [details]
domotics-new.shar

domotics-new.shar new port with improoments suggested.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-13 16:51:57 UTC
"Domoticz is a" should be removed from the COMMENT

Can you confirm this passes QA (portlint, poudriere) please? :)
Comment 5 kiwi 2016-01-13 16:57:10 UTC
(In reply to Kubilay Kocak from comment #4)
Hi,

Portlint passes with some warnings :
WARN: Makefile: [27]: the options to USES are not sorted.  Please consider sorting them.
WARN: /usr/ports/www/domoticz/files/patch-CMakeLists.txt: patch was not generated using ``make makepatch''.  It is recommended to use ``make makepatch'' when you need to [re-]generate a patch to ensure proper patch format.
WARN: /usr/ports/www/domoticz/files/patch-getgit.cmake: patch was not generated using ``make makepatch''.  It is recommended to use ``make makepatch'' when you need to [re-]generate a patch to ensure proper patch format.
0 fatal errors and 3 warnings found.

I can resent the port with COMMENT updated and USES shorted.

About poudriere, I don't have one at home. :/
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-13 17:00:43 UTC
@Kiwi,

You can regenerate the patches with `make makepatch clean` (after `make patch`)

In the absence of poudriere, you can use the following command:

make clean stage && make check-plist && make stage-qa && make package
Comment 7 kiwi 2016-01-13 17:15:10 UTC
(In reply to Kubilay Kocak from comment #6)

About patches I don't want because I make a post patch (since the maintainer of domoticz wants to use git to get the release version I have to make by hand).

So I rather not remake patches on each bumping version of domoticz :)

The make clean stage && make check-plist && make stage-qa && make package
returns:
(...)
====> Compressing man pages (compress-man)
===> Staging rc.d startup script(s)
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
===> Checking for items in pkg-plist which are not in STAGEDIR
===> No pkg-plist issues found (check-plist)
====> Running Q/A tests (stage-qa)
/!\ To run stage-qa automatically add DEVELOPER=yes to your environment /!\
===>  Building package for domoticz-2.4165

So it seems to pass the poudriere part.

Regards
Comment 8 Dmitry Marakasov freebsd_committer 2016-01-15 13:43:32 UTC
I still insist on using dedicated user and group instead of www:www. Using www:www is insecure, and ports should be secure by default.
Comment 9 Dmitry Marakasov freebsd_committer 2016-01-15 13:55:13 UTC
- Also, vardirs should be created by the port, not rc.script. As in

Makefile:
post-install:
    ${MKDIR} ${STAGEDIR}/var/db/domoticz ${STAGEDIR}/var/run/domoticz

pkg-plist:
@dir(domoticz,domoticz) /var/db/domoticz
@dir(domoticz,domoticz) /var/run/domoticz

- USE_SQLITE=yes was deprecated by USES=sqlite couple of days ago, so plaese use the latter
- You don't need GH_ACCOUNT for it's the same as portname

Otherwise, looks good to me.
Comment 10 Dmitry Marakasov freebsd_committer 2016-01-15 17:23:21 UTC
Also doesn't build on 9.x:

[ 13%] Building CXX object CMakeFiles/domoticz.dir/main/stdafx.cpp.o
[ 13%] Building CXX object CMakeFiles/domoticz.dir/main/CmdLine.cpp.o
/usr/local/libexec/ccache/c++   -DNS_ENABLE_SSL -DWITH_EXTERNAL_LUA -DWITH_EXTERNAL_SQLITE -DWITH_LIBUSB -DWITH_TELLDUSCORE -I/usr/local/include/lua52 -I/usr/local/include -I/wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing   -include stdafx.h -Winvalid-pch -o CMakeFiles/domoticz.dir/main/CmdLine.cpp.o -c /wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main/CmdLine.cpp
[ 13%] Building CXX object CMakeFiles/domoticz.dir/main/Camera.cpp.o
/usr/local/libexec/ccache/c++   -DNS_ENABLE_SSL -DWITH_EXTERNAL_LUA -DWITH_EXTERNAL_SQLITE -DWITH_LIBUSB -DWITH_TELLDUSCORE -I/usr/local/include/lua52 -I/usr/local/include -I/wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing   -include stdafx.h -Winvalid-pch -o CMakeFiles/domoticz.dir/main/Camera.cpp.o -c /wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main/Camera.cpp
/usr/local/libexec/ccache/c++   -DNS_ENABLE_SSL -DWITH_EXTERNAL_LUA -DWITH_EXTERNAL_SQLITE -DWITH_LIBUSB -DWITH_TELLDUSCORE -I/usr/local/include/lua52 -I/usr/local/include -I/wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing   -include stdafx.h -Winvalid-pch -o CMakeFiles/domoticz.dir/main/stdafx.cpp.o -c /wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main/stdafx.cpp
[ 14%] Building CXX object CMakeFiles/domoticz.dir/main/domoticz.cpp.o
/usr/local/libexec/ccache/c++   -DNS_ENABLE_SSL -DWITH_EXTERNAL_LUA -DWITH_EXTERNAL_SQLITE -DWITH_LIBUSB -DWITH_TELLDUSCORE -I/usr/local/include/lua52 -I/usr/local/include -I/wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing   -include stdafx.h -Winvalid-pch -o CMakeFiles/domoticz.dir/main/domoticz.cpp.o -c /wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main/domoticz.cpp
[ 15%] Building CXX object CMakeFiles/domoticz.dir/main/EventSystem.cpp.o
[ 15%] Building CXX object CMakeFiles/domoticz.dir/main/Helper.cpp.o
/usr/local/libexec/ccache/c++   -DNS_ENABLE_SSL -DWITH_EXTERNAL_LUA -DWITH_EXTERNAL_SQLITE -DWITH_LIBUSB -DWITH_TELLDUSCORE -I/usr/local/include/lua52 -I/usr/local/include -I/wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing   -include stdafx.h -Winvalid-pch -o CMakeFiles/domoticz.dir/main/EventSystem.cpp.o -c /wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main/EventSystem.cpp
/usr/local/libexec/ccache/c++   -DNS_ENABLE_SSL -DWITH_EXTERNAL_LUA -DWITH_EXTERNAL_SQLITE -DWITH_LIBUSB -DWITH_TELLDUSCORE -I/usr/local/include/lua52 -I/usr/local/include -I/wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing   -include stdafx.h -Winvalid-pch -o CMakeFiles/domoticz.dir/main/Helper.cpp.o -c /wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main/Helper.cpp
[ 16%] Building CXX object CMakeFiles/domoticz.dir/main/localtime_r.cpp.o
[ 16%] Building CXX object CMakeFiles/domoticz.dir/main/Logger.cpp.o
/usr/local/libexec/ccache/c++   -DNS_ENABLE_SSL -DWITH_EXTERNAL_LUA -DWITH_EXTERNAL_SQLITE -DWITH_LIBUSB -DWITH_TELLDUSCORE -I/usr/local/include/lua52 -I/usr/local/include -I/wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing   -include stdafx.h -Winvalid-pch -o CMakeFiles/domoticz.dir/main/localtime_r.cpp.o -c /wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main/localtime_r.cpp
/usr/local/libexec/ccache/c++   -DNS_ENABLE_SSL -DWITH_EXTERNAL_LUA -DWITH_EXTERNAL_SQLITE -DWITH_LIBUSB -DWITH_TELLDUSCORE -I/usr/local/include/lua52 -I/usr/local/include -I/wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing   -include stdafx.h -Winvalid-pch -o CMakeFiles/domoticz.dir/main/Logger.cpp.o -c /wrkdirs/usr/ports/www/domoticz/work/domoticz-66a2e8e/main/Logger.cpp
<command-line>:0: fatal error: had to relocate PCH
compilation terminated.
<command-line>:0: fatal error: had to relocate PCH
compilation terminated.
*** [CMakeFiles/domoticz.dir/main/CmdLine.cpp.o] Error code 1
*** [CMakeFiles/domoticz.dir/main/Camera.cpp.o] Error code 1
<command-line>:0: fatal error: had to relocate PCH
compilation terminated.
<command-line>:0: fatal error: had to relocate PCH
compilation terminated.
*** [CMakeFiles/domoticz.dir/main/EventSystem.cpp.o] Error code 1
*** [CMakeFiles/domoticz.dir/main/stdafx.cpp.o] Error code 1
<command-line>:0: fatal error: had to relocate PCH
compilation terminated.
*** [CMakeFiles/domoticz.dir/main/Helper.cpp.o] Error code 1
<command-line>:0: fatal error: had to relocate PCH
compilation terminated.
<command-line>:0: fatal error: had to relocate PCH
compilation terminated.
*** [CMakeFiles/domoticz.dir/main/Logger.cpp.o] Error code 1
*** [CMakeFiles/domoticz.dir/main/domoticz.cpp.o] Error code 1
<command-line>:0: fatal error: had to relocate PCH
compilation terminated.
*** [CMakeFiles/domoticz.dir/main/localtime_r.cpp.o] Error code 1
8 errors
*** [CMakeFiles/domoticz.dir/all] Error code 2
1 error
*** [all] Error code 2
1 error
===> Compilation failed unexpectedly.
Comment 11 kiwi 2016-01-19 15:00:49 UTC
Created attachment 165824 [details]
Fix the port.

New port that :
- fix the USES=sqlite
- create /var/db/domoticz and /var/run/domoticz using the port not the rc file
- uses domoticz:domoticz. On my machine I have taken uid:gid 847, but feel free to use any uid:gid

I am not able to fix the build under FreeBSD 9, seems a bug related of the compiler itself. 

Can we make this buildable on FreeBSD 10+ ?

Regards
Comment 12 commit-hook freebsd_committer 2016-01-26 15:15:21 UTC
A commit references this bug:

Author: amdmi3
Date: Tue Jan 26 15:15:16 UTC 2016
New revision: 407276
URL: https://svnweb.freebsd.org/changeset/ports/407276

Log:
  Domoticz is a Home Automation System that lets you monitor and configure
  various devices like: Lights, Switches, various sensors/meters like
  Temperature, Rain, Wind, UV, Electra, Gas, Water and much more.
  Notifications/Alerts can be sent to any mobile device

  WWW: http://www.domoticz.com/

  PR:		205583
  Submitted by:	kiwi@oav.net

Changes:
  head/GIDs
  head/UIDs
  head/www/Makefile
  head/www/domoticz/
  head/www/domoticz/Makefile
  head/www/domoticz/distinfo
  head/www/domoticz/files/
  head/www/domoticz/files/domoticz.in
  head/www/domoticz/files/patch-CMakeLists.txt
  head/www/domoticz/files/patch-getgit.cmake
  head/www/domoticz/pkg-descr
  head/www/domoticz/pkg-plist
Comment 13 Dmitry Marakasov freebsd_committer 2016-01-26 15:19:04 UTC
> Can we make this buildable on FreeBSD 10+ ?

Instead I've fixed it by disabling precompiled headers.