pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Create influxdb package
On 1/13/19 10:53 PM, Jonathan Perkin wrote:
> * On 2019-01-13 at 21:47 GMT, Attila Fülöp wrote:
>
>> On 1/13/19 10:10 PM, Jonathan Perkin wrote:
>>> * On 2019-01-13 at 20:12 GMT, Attila Fülöp wrote:
>>>
>>>> after getting influxdb to build on SmartOS, I'm planning to create a
>>>> package for it. I know that Jonathan worked on influxdb too, so i
>>>> figure I should ask him first.
>>>>
>>>> @jperkin: How far did you get with the package? Is it OK if I continue
>>>> your work?
>>>>
>>>> I also wonder where to put it, pkgsrc-joyent or pkgsrc-wip. Since it
>>>> should work on linux and darwin as well (not tested) I guess the wip
>>>> repo would be the proper place, right?
>>>
>>> My initial WIP was here:
>>>
>>> https://github.com/joyent/pkgsrc/commit/dc13448b9448dc4d895b1f29fa4a08f4f4c6ab52
>>
>> Sorry, I missed that, obviously looked in the wrong place. I'll have a
>> look later and give you feedback.
My approach is different, I'm using the v1.7.2 tag and the `build.py`
script inside the top level directory. It depends on python2.7, bzr and
npm. I can prepare a PR against your branch if you'd like, or you can
apply the attached patch to a v1.7.2 checkout and build using `build.py`.
>>> I have some updates to this that I will try to push in the next couple
>>> of days. Note that this also introduces the go-dep infrastructure
>>> that I'd like a final ok from others on after my latest changes.
>>
>> Well, go-dep is superseded by go modules integrated into go 1.11. Looks
>> like many go packages are transitioning to go modules. The next version
>> of influxdb (2.8) will require a go module build. For me influxdb 1.7.2
>> build cleanly as a go module, so I think go modules should be preferred
>> over dep, giving the additional benefit of avoiding an external
>> dependency (but requiring at least go 1.11).
>
> Ok, I know nothing about Go, so it would be interesting to know how
> this avoids the dependency problems, specifically ensuring that all
> dependencies are downloaded before the build begins.
Basically `go build` takes care of that, it tracks, downloads and builds
all dependencies as part of the build process. Go packages are linked
statically, so once the binary is build we are set.
>>> Does influxdb have a release that includes the illumos fix yet?
>>
>> Influxdb was fine, the problem was with pkg/term for which i got a patch
>> merged a couple of days ago. https://github.com/pkg/term/pull/41
>
> Yes, but the version of pkg/term that it depended on (or a dependency
> depended on, I don't remember) was older.
It is the latter, github.com/c-bata/go-prompt pulls it in.
A `dep ensure -update github.com/pkg/term` inside the influxdb folder
will do the trick by updating `Gopkg.lock`. In this case you can also
edit `Gopkg.lock` and fix the revision.
With go modules (2.8) you would run `go get -u github.com/pkg/term`
before building influxdb or edit `go.mod`
>>> Once we have it working there's no reason we shouldn't push it
>>> straight into pkgsrc rather than joyent or wip.
>>
>> Ak OK, I thought the workflow recommends to create new packages in wip
>> first.
>
> The only reason things go into wip is if people want to share packages
> that aren't yet ready for pkgsrc, e.g. if they want to collaborate
> without sending patches around, or if they are worked on by a member
> of the community who doesn't have commit access to pkgsrc and they use
> wip in order for it to be easily verified and imported.
I see, good to know, thanks.
Attila
diff --git a/Gopkg.lock b/Gopkg.lock
index aeb7a48e9..e7e92e0cf 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -310,12 +310,12 @@
version = "v0.2.0"
[[projects]]
- branch = "master"
digest = "1:c42fb0b13261a9bcd08451ee1859e61bea33aa6743916a2e3fb61f33ff6b25c7"
name = "github.com/google/go-github"
packages = ["github"]
pruneopts = "UT"
revision = "dd29b543e14c33e6373773f2c5ea008b29aeac95"
+ version = "v17.0.0"
[[projects]]
digest = "1:a63cff6b5d8b95638bfe300385d93b2a6d9d687734b863da8e09dc834510a690"
@@ -713,7 +713,7 @@
name = "github.com/pkg/term"
packages = ["termios"]
pruneopts = "UT"
- revision = "bffc007b7fd5a70e20e28f5b7649bb84671ef436"
+ revision = "aa71e9d9e942418fbb97d80895dcea70efed297c"
[[projects]]
digest = "1:70f78dea42b8c0ff38ecf5487eaa79006fa2193fc804fc7c1d7222745d9e2522"
diff --git a/build.py b/build.py
index 3f41b0e12..6f5adcdae 100755
--- a/build.py
+++ b/build.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.7 -u
+#!/opt/local/bin/python2.7 -u
import sys
import os
@@ -18,13 +18,13 @@ import argparse
# Packaging variables
PACKAGE_NAME = "influxdb"
-INSTALL_ROOT_DIR = "/usr/bin"
+INSTALL_ROOT_DIR = "/opt/local/bin"
LOG_DIR = "/var/log/influxdb"
DATA_DIR = "/var/lib/influxdb"
-SCRIPT_DIR = "/usr/lib/influxdb/scripts"
-CONFIG_DIR = "/etc/influxdb"
+SCRIPT_DIR = "/opt/local/lib/influxdb/scripts"
+CONFIG_DIR = "/opt/local/etc/influxdb"
LOGROTATE_DIR = "/etc/logrotate.d"
-MAN_DIR = "/usr/share/man"
+MAN_DIR = "/opt/local/man"
INIT_SCRIPT = "scripts/init.sh"
SYSTEMD_SCRIPT = "scripts/influxdb.service"
@@ -90,13 +90,15 @@ targets = {
supported_builds = {
'darwin': [ "amd64" ],
'windows': [ "amd64" ],
- 'linux': [ "amd64", "i386", "armhf", "arm64", "armel", "static_i386", "static_amd64" ]
+ 'linux': [ "amd64", "i386", "armhf", "arm64", "armel", "static_i386", "static_amd64" ],
+ 'solaris': [ "amd64" ]
}
supported_packages = {
"darwin": [ "tar" ],
"linux": [ "deb", "rpm", "tar" ],
"windows": [ "zip" ],
+ 'solaris': [ "tar" ]
}
################
@@ -162,13 +164,17 @@ def go_get(branch, update=False, no_uncommitted=False):
if local_changes() and no_uncommitted:
logging.error("There are uncommitted changes in the current directory.")
return False
- if not check_path_for("dep"):
- logging.info("Downloading `dep`...")
- get_command = "go get github.com/golang/dep/cmd/dep"
- run(get_command)
- logging.info("Retrieving dependencies with `dep`...")
- sys.stdout.flush()
- run("{}/bin/dep ensure -v -vendor-only".format(os.environ.get("GOPATH")))
+ if os.environ.get("GO111MODULE", "off") != "on":
+ if not check_path_for("dep"):
+ logging.info("Downloading `dep`...")
+ get_command = "go get github.com/golang/dep/cmd/dep"
+ run(get_command)
+ logging.info("Retrieving dependencies with `dep`...")
+ sys.stdout.flush()
+ run("{}/bin/dep ensure -v -vendor-only".format(os.environ.get("GOPATH")))
+ else:
+ logging.info("Refreshing module cache...")
+ run("go mod download") # or vendor?
return True
def run_tests(race, parallel, timeout, no_vet, junit=False):
@@ -339,6 +345,8 @@ def get_system_arch():
arch = os.uname()[4]
if arch == "x86_64":
arch = "amd64"
+ elif arch == "i86pc":
+ arch = "amd64"
elif arch == "386":
arch = "i386"
elif arch == "aarch64":
@@ -353,6 +361,8 @@ def get_system_platform():
"""
if sys.platform.startswith("linux"):
return "linux"
+ elif sys.platform == "sunos5":
+ return "solaris"
else:
return sys.platform
@@ -384,9 +394,10 @@ def check_environ(build_dir = None):
for v in [ "GOPATH", "GOBIN", "GOROOT" ]:
logging.debug("Using '{}' for {}".format(os.environ.get(v), v))
- cwd = os.getcwd()
- if build_dir is None and os.environ.get("GOPATH") and os.environ.get("GOPATH") not in cwd:
- logging.warn("Your current directory is not under your GOPATH. This may lead to build failures.")
+ if os.environ.get("GO111MODULE") != "on":
+ cwd = os.getcwd()
+ if build_dir is None and os.environ.get("GOPATH") and os.environ.get("GOPATH") not in cwd:
+ logging.warn("Your current directory is not under your GOPATH. This may lead to build failures.")
return True
def check_prereqs():
@@ -537,7 +548,7 @@ def build(version=None,
build_command += "-race "
if len(tags) > 0:
build_command += "-tags {} ".format(','.join(tags))
- if "1.4" in get_go_version():
+ if get_go_version() == "1.4" or get_go_version().startswith("1.4."):
if static:
build_command += "-ldflags=\"-s -X main.version {} -X main.branch {} -X main.commit {}\" ".format(version,
get_current_branch(),
Home |
Main Index |
Thread Index |
Old Index