From 7923b14f33e3090f2824ee9b1b3d93208c113454 Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Tue, 15 Jul 2025 18:01:24 -0400 Subject: [PATCH 01/10] Rpm defined macros (#12) * Experimentally offer a spec file for RPM building. * Updated BuildRequires * Update build requirement package name * Change setup and whitespace * Try changing module search * Debug logging * Try prepending path * Debug * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Try switching to newer repo * Update nmsg-relay.spec * Go back to old protobuf * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Update nmsg-relay.spec * Try the new macros version * Update nmsg-relay.spec --------- Co-authored-by: Allan LeSage --- go.mod | 2 +- go.sum | 47 +------------------- nmsg-relay.spec | 115 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 47 deletions(-) create mode 100644 nmsg-relay.spec diff --git a/go.mod b/go.mod index c4e8a21..7aadd3f 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.18 require ( github.com/farsightsec/go-config v0.0.0-20230417163249-516d934c7368 github.com/farsightsec/go-nmsg v0.2.1-0.20230602194809-0d1f0f63e5e3 + github.com/farsightsec/go-nmsg_sie v0.1.2-0.20230608154303-b9c61e682d7e github.com/farsightsec/sielink v0.1.1 github.com/golang/protobuf v1.5.0 gopkg.in/yaml.v2 v2.4.0 @@ -12,7 +13,6 @@ require ( require ( github.com/dnstap/golang-dnstap v0.4.0 // indirect - github.com/farsightsec/go-nmsg_sie v0.1.2-0.20230608154303-b9c61e682d7e // indirect github.com/farsightsec/golang-framestream v0.3.0 // indirect github.com/miekg/dns v1.1.31 // indirect golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect diff --git a/go.sum b/go.sum index 72f1a0f..fbc157d 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,5 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/dnstap/golang-dnstap v0.4.0 h1:KRHBoURygdGtBjDI2w4HifJfMAhhOqDuktAokaSa234= github.com/dnstap/golang-dnstap v0.4.0/go.mod h1:FqsSdH58NAmkAvKcpyxht7i4FoBjKu8E4JUPt8ipSUs= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/farsightsec/go-config v0.0.0-20230417163249-516d934c7368 h1:CuaWxFONeVsOKCq11ODbWRJjQfMlUHSHHWz1niQP+po= github.com/farsightsec/go-config v0.0.0-20230417163249-516d934c7368/go.mod h1:DqkG9OTHBNHR/kuETvIzR2Ys0jJeTu/bgaFYXQtvCvE= github.com/farsightsec/go-nmsg v0.2.1-0.20230602194809-0d1f0f63e5e3 h1:zXALcWo8Siqd43EwqL1Q4LP0wpY1cTTqgxrL+K7w+cg= @@ -16,83 +10,46 @@ github.com/farsightsec/golang-framestream v0.3.0 h1:/spFQHucTle/ZIPkYqrfshQqPe2V github.com/farsightsec/golang-framestream v0.3.0/go.mod h1:eNde4IQyEiA5br02AouhEHCu3p3UzrCdFR4LuQHklMI= github.com/farsightsec/sielink v0.1.1 h1:eRh9/jDTyfF3YksJx5/GvbU3+oXI8JDosswfQemV4dg= github.com/farsightsec/sielink v0.1.1/go.mod h1:PtR+AqhrW7ZC7GPJgZUrbGcaYSY4lpa6ZnZ0tcWsE5U= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/miekg/dns v1.1.31 h1:sJFOl9BgwbYAWOGEwr61FU28pqsBNdpRBnhGXtO06Oo= github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= @@ -100,5 +57,3 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/nmsg-relay.spec b/nmsg-relay.spec new file mode 100644 index 0000000..55cae0b --- /dev/null +++ b/nmsg-relay.spec @@ -0,0 +1,115 @@ +# Define backup go macros +%if %{rhel} == 8 +%global gopkg %package -n %{goname}-devel \ +Summary: %{summary} \ +BuildArch: noarch \ +%description -n %{goname}-devel \ +%{common_description} +%global goprep(A) %setup -q +%global generate_buildrequires echo "Need more specific macro on rhel8" +%global gopkginstall for file in $(find . -iname "*.go" \! -iname "*_test.go" \! -iname "main.go" ) ; do \ + echo "%%dir %%{gopath}/src/%%{goipath}/$(dirname $file)" >> devel.file-list ;\ + install -d -p %{buildroot}/%{gopath}/src/%{goipath}/$(dirname $file) ;\ + cp -pav $file %{buildroot}/%{gopath}/src/%{goipath}/$file ;\ + echo "%%{gopath}/src/%%{goipath}/$file" >> devel.file-list ;\ +done ;\ +sort -u -o devel.file-list devel.file-list +%global gopkgfiles %files -n %{goname}-devel -f devel.file-list +%global gocheck echo "skipping gocheck on rhel8" +# Specific BuildRequires macro +%global go_generate_buildrequires BuildRequires: BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} \ +BuildRequires: golang-github-dnstap-devel \ +BuildRequires: golang-github-farsightsec-config-devel \ +BuildRequires: golang-github-farsightsec-framestream-devel \ +BuildRequires: golang-github-farsightsec-nmsg-sie-devel \ +BuildRequires: golang-github-farsightsec-nmsg-devel \ +BuildRequires: golang-github-farsightsec-sielink-devel \ +BuildRequires: golang-github-miekg-dns-devel \ +BuildRequires: golang-github-protobuf-devel \ +BuildRequires: golang-google-protobuf-devel \ +BuildRequires: golang-gopkg-yaml-2-devel \ +BuildRequires: golang-x-net-devel \ +BuildRequires: golang-x-sys-devel +%endif + +%global debug_package %{nil} +%define _build_id_links none +# https://github.com/farsightsec/nmsg-relay +%global goipath github.com/farsightsec/nmsg-relay +%global common_description %{expand: +%{summary} + +A lightweight client which reads NMSG input from a datagram socket and submits it to the SIE.} + +Name: nmsg-relay +Version: 0.2.0 +Release: 1%{?dist} +Summary: SIE uploader for NMSG data +%gometa +License: MPLv2.0 +#URL: https://%{provider_prefix} +#Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz +URL: %{gourl} +Source0: %{gosource} + +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +BuildRequires: golang-github-dnstap-devel +BuildRequires: golang-github-farsightsec-config-devel +BuildRequires: golang-github-farsightsec-framestream-devel +BuildRequires: golang-github-farsightsec-nmsg-sie-devel +BuildRequires: golang-github-farsightsec-nmsg-devel +BuildRequires: golang-github-farsightsec-sielink-devel +BuildRequires: golang-github-miekg-dns-devel +BuildRequires: golang-github-protobuf-devel +BuildRequires: golang-google-protobuf-devel +BuildRequires: golang-gopkg-yaml-2-devel +BuildRequires: golang-x-net-devel +BuildRequires: golang-x-sys-devel + +%description + +%{summary} + +A lightweight client which reads NMSG input from a datagram socket and submits it to the SIE. + +%gopkg + +%prep +%goprep -A +%autopatch -p1 + +%build +mkdir -p /builddir/go/src/github.com/farsightsec +ln -s $PWD /builddir/go/src/github.com/farsightsec/nmsg-relay + +%{!?_licensedir:%global license %doc} + +# We don't want to download new modules, but we want ones that BuildRequires packages provide +export GO111MODULE=off +export GOPATH=/usr/share/gocode:/builddir/go +go build + +%install +install -d -p %{buildroot}%{_bindir} +install %{name}-%{version} %{buildroot}/%{_bindir}/nmsg-relay +install -d -p %{buildroot}%{_mandir}/man1 +install nmsg-relay.1 %{buildroot}%{_mandir}/man1/ +%gopkginstall + + +%if %{with check} +%check +%gocheck +%endif + +#define license tag if not already defined +%{!?_licensedir:%global license %doc} + +%files +%license LICENSE +%doc README.md COPYRIGHT +%{_bindir}/nmsg-relay +%_mandir/man1/* +%gopkgfiles + +%changelog From e87f73b55b2f988b93e8adce0b358d10fde93060 Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Tue, 15 Jul 2025 18:05:03 -0400 Subject: [PATCH 02/10] Clean up debug tests --- nmsg-relay.spec | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/nmsg-relay.spec b/nmsg-relay.spec index 55cae0b..8c18fa0 100644 --- a/nmsg-relay.spec +++ b/nmsg-relay.spec @@ -47,30 +47,13 @@ Release: 1%{?dist} Summary: SIE uploader for NMSG data %gometa License: MPLv2.0 -#URL: https://%{provider_prefix} -#Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz URL: %{gourl} Source0: %{gosource} -BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} -BuildRequires: golang-github-dnstap-devel -BuildRequires: golang-github-farsightsec-config-devel -BuildRequires: golang-github-farsightsec-framestream-devel -BuildRequires: golang-github-farsightsec-nmsg-sie-devel -BuildRequires: golang-github-farsightsec-nmsg-devel -BuildRequires: golang-github-farsightsec-sielink-devel -BuildRequires: golang-github-miekg-dns-devel -BuildRequires: golang-github-protobuf-devel -BuildRequires: golang-google-protobuf-devel -BuildRequires: golang-gopkg-yaml-2-devel -BuildRequires: golang-x-net-devel -BuildRequires: golang-x-sys-devel +%go_generate_buildrequires %description - -%{summary} - -A lightweight client which reads NMSG input from a datagram socket and submits it to the SIE. +%{common_description} %gopkg From 3d2e623a84db8e991a7b61efdeff1984ec20d5fa Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Tue, 15 Jul 2025 18:15:25 -0400 Subject: [PATCH 03/10] Fix typo in macro --- nmsg-relay.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nmsg-relay.spec b/nmsg-relay.spec index 8c18fa0..e4200ef 100644 --- a/nmsg-relay.spec +++ b/nmsg-relay.spec @@ -17,7 +17,7 @@ sort -u -o devel.file-list devel.file-list %global gopkgfiles %files -n %{goname}-devel -f devel.file-list %global gocheck echo "skipping gocheck on rhel8" # Specific BuildRequires macro -%global go_generate_buildrequires BuildRequires: BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} \ +%global go_generate_buildrequires BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} \ BuildRequires: golang-github-dnstap-devel \ BuildRequires: golang-github-farsightsec-config-devel \ BuildRequires: golang-github-farsightsec-framestream-devel \ From f88beeaaaf851872fb8068f35da15fb2a8799498 Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Wed, 16 Jul 2025 12:46:21 -0400 Subject: [PATCH 04/10] Need section tag to put macro in --- nmsg-relay.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/nmsg-relay.spec b/nmsg-relay.spec index e4200ef..82e36c8 100644 --- a/nmsg-relay.spec +++ b/nmsg-relay.spec @@ -50,6 +50,7 @@ License: MPLv2.0 URL: %{gourl} Source0: %{gosource} +%generate_buildrequires %go_generate_buildrequires %description From 5e81bd7a9a1e8a23e94459dbaea335dd446d9d4f Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Wed, 16 Jul 2025 13:30:00 -0400 Subject: [PATCH 05/10] Try after prep? Probably not --- nmsg-relay.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nmsg-relay.spec b/nmsg-relay.spec index 82e36c8..9bc26c5 100644 --- a/nmsg-relay.spec +++ b/nmsg-relay.spec @@ -50,9 +50,6 @@ License: MPLv2.0 URL: %{gourl} Source0: %{gosource} -%generate_buildrequires -%go_generate_buildrequires - %description %{common_description} @@ -62,6 +59,9 @@ Source0: %{gosource} %goprep -A %autopatch -p1 +%generate_buildrequires +%go_generate_buildrequires + %build mkdir -p /builddir/go/src/github.com/farsightsec ln -s $PWD /builddir/go/src/github.com/farsightsec/nmsg-relay From b9b1271831f321f5d3b2873be64e4fcd585bfa78 Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Wed, 16 Jul 2025 13:55:49 -0400 Subject: [PATCH 06/10] Try other preparation to get dynamic BuildRequires --- nmsg-relay.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nmsg-relay.spec b/nmsg-relay.spec index 9bc26c5..56444fc 100644 --- a/nmsg-relay.spec +++ b/nmsg-relay.spec @@ -55,13 +55,17 @@ Source0: %{gosource} %gopkg -%prep +%generate_buildrequires %goprep -A %autopatch -p1 - -%generate_buildrequires +mkdir -p /builddir/go/src/github.com/farsightsec +ln -s $PWD /builddir/go/src/github.com/farsightsec/nmsg-relay %go_generate_buildrequires +%prep +%goprep -A +%autopatch -p1 + %build mkdir -p /builddir/go/src/github.com/farsightsec ln -s $PWD /builddir/go/src/github.com/farsightsec/nmsg-relay From 322566f353a84a218e204f28b0d461cb810d34d1 Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Wed, 16 Jul 2025 14:31:27 -0400 Subject: [PATCH 07/10] Update nmsg-relay.spec --- nmsg-relay.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/nmsg-relay.spec b/nmsg-relay.spec index 56444fc..22ee2ae 100644 --- a/nmsg-relay.spec +++ b/nmsg-relay.spec @@ -56,7 +56,6 @@ Source0: %{gosource} %gopkg %generate_buildrequires -%goprep -A %autopatch -p1 mkdir -p /builddir/go/src/github.com/farsightsec ln -s $PWD /builddir/go/src/github.com/farsightsec/nmsg-relay From 1a201a17e4c09dc4f1bb36cb4a3377904b5c4a77 Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:03:06 -0400 Subject: [PATCH 08/10] Just define BuildRequires, no dynamic --- nmsg-relay.spec | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/nmsg-relay.spec b/nmsg-relay.spec index 22ee2ae..37dac62 100644 --- a/nmsg-relay.spec +++ b/nmsg-relay.spec @@ -6,7 +6,6 @@ BuildArch: noarch \ %description -n %{goname}-devel \ %{common_description} %global goprep(A) %setup -q -%global generate_buildrequires echo "Need more specific macro on rhel8" %global gopkginstall for file in $(find . -iname "*.go" \! -iname "*_test.go" \! -iname "main.go" ) ; do \ echo "%%dir %%{gopath}/src/%%{goipath}/$(dirname $file)" >> devel.file-list ;\ install -d -p %{buildroot}/%{gopath}/src/%{goipath}/$(dirname $file) ;\ @@ -16,21 +15,6 @@ done ;\ sort -u -o devel.file-list devel.file-list %global gopkgfiles %files -n %{goname}-devel -f devel.file-list %global gocheck echo "skipping gocheck on rhel8" -# Specific BuildRequires macro -%global go_generate_buildrequires BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} \ -BuildRequires: golang-github-dnstap-devel \ -BuildRequires: golang-github-farsightsec-config-devel \ -BuildRequires: golang-github-farsightsec-framestream-devel \ -BuildRequires: golang-github-farsightsec-nmsg-sie-devel \ -BuildRequires: golang-github-farsightsec-nmsg-devel \ -BuildRequires: golang-github-farsightsec-sielink-devel \ -BuildRequires: golang-github-miekg-dns-devel \ -BuildRequires: golang-github-protobuf-devel \ -BuildRequires: golang-google-protobuf-devel \ -BuildRequires: golang-gopkg-yaml-2-devel \ -BuildRequires: golang-x-net-devel \ -BuildRequires: golang-x-sys-devel -%endif %global debug_package %{nil} %define _build_id_links none @@ -50,17 +34,25 @@ License: MPLv2.0 URL: %{gourl} Source0: %{gosource} +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +BuildRequires: golang-github-dnstap-devel +BuildRequires: golang-github-farsightsec-config-devel +BuildRequires: golang-github-farsightsec-framestream-devel +BuildRequires: golang-github-farsightsec-nmsg-sie-devel +BuildRequires: golang-github-farsightsec-nmsg-devel +BuildRequires: golang-github-farsightsec-sielink-devel +BuildRequires: golang-github-miekg-dns-devel +BuildRequires: golang-github-protobuf-devel +BuildRequires: golang-google-protobuf-devel +BuildRequires: golang-gopkg-yaml-2-devel +BuildRequires: golang-x-net-devel +BuildRequires: golang-x-sys-devel + %description %{common_description} %gopkg -%generate_buildrequires -%autopatch -p1 -mkdir -p /builddir/go/src/github.com/farsightsec -ln -s $PWD /builddir/go/src/github.com/farsightsec/nmsg-relay -%go_generate_buildrequires - %prep %goprep -A %autopatch -p1 From aed31228088d20059922ffe2e1177b63bb7fbf13 Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:19:48 -0400 Subject: [PATCH 09/10] Fix unclosed if --- nmsg-relay.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/nmsg-relay.spec b/nmsg-relay.spec index 37dac62..88b8722 100644 --- a/nmsg-relay.spec +++ b/nmsg-relay.spec @@ -15,6 +15,7 @@ done ;\ sort -u -o devel.file-list devel.file-list %global gopkgfiles %files -n %{goname}-devel -f devel.file-list %global gocheck echo "skipping gocheck on rhel8" +%endif %global debug_package %{nil} %define _build_id_links none From 1692d74060fe615655d1cc95fcfd8b0a5c8d884b Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Wed, 16 Jul 2025 16:12:41 -0400 Subject: [PATCH 10/10] Removed extra whitespace --- nmsg-relay.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/nmsg-relay.spec b/nmsg-relay.spec index 88b8722..2a22bcc 100644 --- a/nmsg-relay.spec +++ b/nmsg-relay.spec @@ -76,7 +76,6 @@ install -d -p %{buildroot}%{_mandir}/man1 install nmsg-relay.1 %{buildroot}%{_mandir}/man1/ %gopkginstall - %if %{with check} %check %gocheck