Bug 241655 - net-mgmt/semaphore: Incomplete file list and wrong search path
Summary: net-mgmt/semaphore: Incomplete file list and wrong search path
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Vinícius Zavam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-02 00:21 UTC by marek
Modified: 2019-11-08 12:27 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (egypcio)


Attachments
241655.diff (1.90 KB, patch)
2019-11-06 17:16 UTC, Vinícius Zavam
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description marek 2019-11-02 00:21:22 UTC
The latest version of the port has missed some files for work properly. For example, first run of semaphore wants to create database from sql files:

# semaphore
Using config file: /usr/local/etc/semaphore/config.json
Semaphore 2.5.1
Port :3000
MySQL semaphore@127.0.0.1:3306 semaphore
Tmp Path (projects home) /tmp/semaphore
Checking DB migrations
Creating migrations table
Executing migration v0.0.0 (at 2019-11-01 21:19:23.778424681 +0100 CET m=+0.224762334)...
panic: stat /wrkdirs/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/db/migrations/v0.0.0.sql: no such file or directory

goroutine 1 [running]:
github.com/ansible-semaphore/semaphore/db.(*Version).GetSQL(0xc000069840, 0xc00012e350, 0xa, 0xaa7cb5, 0x4, 0xc00012e350)
        /wrkdirs/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/db/version.go:60 +0x176
github.com/ansible-semaphore/semaphore/db.(*Version).Run(0xc000069840, 0xc000010000, 0x0)
        /wrkdirs/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/db/migrations.go:49 +0x272
github.com/ansible-semaphore/semaphore/db.MigrateAll(0xc000113e18, 0x0)
        /wrkdirs/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/db/migrations.go:118 +0x13b
main.main()
        /wrkdirs/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/cli/main.go:51 +0x406

The binary expects to exist in the location started by /wrkdirs/... 

The similar issue is when the semaphore wants to serve web content (output from truss):

fstatat(AT_FDCWD,"/wrkdirs/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/web/public/html/index.html",0xc0002d2038,0x0) ERR#2 'No such file or directory'
Comment 1 marek 2019-11-02 00:22:41 UTC
The list of installed files from the package:

# pkg info -l semaphore
semaphore-2.5.1:
        /usr/local/bin/semaphore
        /usr/local/etc/rc.d/semaphore
        /usr/local/etc/semaphore/semaphore_config.json.sample
        /usr/local/share/licenses/semaphore-2.5.1/LICENSE
        /usr/local/share/licenses/semaphore-2.5.1/MIT
        /usr/local/share/licenses/semaphore-2.5.1/catalog.mk
Comment 2 Vinícius Zavam freebsd_committer 2019-11-06 16:39:35 UTC
ACK; thanks for reporting it. already part of my 'TODO' since r516887
Comment 3 Vinícius Zavam freebsd_committer 2019-11-06 17:16:27 UTC
Created attachment 208916 [details]
241655.diff

could please try this one, passing the .sql file you need (that should correspond to your previous semaphore version)?

quick fix solution so far.
Comment 4 marek 2019-11-08 12:26:15 UTC
(In reply to Vinícius Zavam from comment #3)

i!

I made a clean jail for tests. This patch add only db files to package, but the semaphore still expects these files in /usr/ports tree instead of /usr/local:

root@semtest:/usr/local/etc/semaphore # semaphore 
Using config file: /usr/local/etc/semaphore/config.json
Semaphore 2.5.1
Port :3000
MySQL semaphore@127.0.0.1:3306 sem_db
Tmp Path (projects home) /tmp/semaphore
Checking DB migrations
Executing migration v0.0.0 (at 2019-11-08 13:16:09.513075602 +0100 CET m=+0.028127598)...
panic: stat /usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/db/migrations/v0.0.0.sql: no such file or directory

goroutine 1 [running]:
github.com/ansible-semaphore/semaphore/db.(*Version).GetSQL(0xc0000cb7c0, 0xc0000ab1d0, 0xa, 0xaa7cb5, 0x4, 0xc0000ab1d0)
	/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/db/version.go:60 +0x176
github.com/ansible-semaphore/semaphore/db.(*Version).Run(0xc0000cb7c0, 0xc0000b0000, 0x0)
	/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/db/migrations.go:49 +0x272
github.com/ansible-semaphore/semaphore/db.MigrateAll(0xc00012fe18, 0x0)
	/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/db/migrations.go:118 +0x13b
main.main()
	/usr/ports/net-mgmt/semaphore/work/src/github.com/ansible-semaphore/semaphore/cli/main.go:51 +0x406
root@semtest:/usr/local/etc/semaphore # pkg info -l semaphore
semaphore-2.5.1_1:
	/usr/local/bin/semaphore
	/usr/local/etc/rc.d/semaphore
	/usr/local/etc/semaphore/semaphore_config.json.sample
	/usr/local/share/licenses/semaphore-2.5.1_1/LICENSE
	/usr/local/share/licenses/semaphore-2.5.1_1/MIT
	/usr/local/share/licenses/semaphore-2.5.1_1/catalog.mk
	/usr/local/share/semaphore/v0.0.0.sql
	/usr/local/share/semaphore/v0.1.0.sql
	/usr/local/share/semaphore/v1.0.0.sql
	/usr/local/share/semaphore/v1.1.0.sql
	/usr/local/share/semaphore/v1.2.0.sql
	/usr/local/share/semaphore/v1.3.0.sql
	/usr/local/share/semaphore/v1.4.0.sql
	/usr/local/share/semaphore/v1.5.0.sql
	/usr/local/share/semaphore/v1.6.0.sql
	/usr/local/share/semaphore/v1.7.0.sql
	/usr/local/share/semaphore/v1.8.0.sql
	/usr/local/share/semaphore/v1.9.0.sql
	/usr/local/share/semaphore/v2.2.1.sql
	/usr/local/share/semaphore/v2.3.0.sql
	/usr/local/share/semaphore/v2.3.1.sql
	/usr/local/share/semaphore/v2.3.2.sql
	/usr/local/share/semaphore/v2.4.0.sql
	/usr/local/share/semaphore/v2.5.0.sql
Comment 5 marek 2019-11-08 12:27:59 UTC
There is another interesting thing in the semaphore binary from Github releases:
https://github.com/ansible-semaphore/semaphore/releases/download/v2.5.1/semaphore_2.5.1_freebsd_amd64.tar.gz

This is standalone binary that don't need SQL files and works. I suspect that these files are included in the whole binary, but I have no knowledge about building go binaries.