Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opensnitch, opensnitch-ui: 1.3.6 > 1.4.3 #148612

Merged
merged 1 commit into from
Jan 1, 2022

Conversation

onny
Copy link
Contributor

@onny onny commented Dec 4, 2021

Motivation for this change

In this PR I would like to address following bug #148168 and continue the work of this PR #118329

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@onny onny marked this pull request as draft December 4, 2021 17:36
@onny onny changed the title [DRAFT] opensnitch-ui: 1.3.6 > 1.4.3 [DRAFT] opensnitch, opensnitch-ui: 1.3.6 > 1.4.3 Dec 4, 2021
@ofborg ofborg bot requested a review from raboof December 4, 2021 17:48
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Dec 4, 2021
@onny
Copy link
Contributor Author

onny commented Dec 9, 2021

Somehow running opensnitch-ui fails because it can't find ui_pb2.py in opensnitch python package.

$ opensnitch-ui
Traceback (most recent call last):
  File "/nix/store/qbqbsb1zbzbcrf421pdrby3qa7qj4rq5-opensnitch-ui-1.4.2/bin/.opensnitch-ui-wrapped", line 23, in <module>
    from opensnitch.service import UIService
  File "/nix/store/qbqbsb1zbzbcrf421pdrby3qa7qj4rq5-opensnitch-ui-1.4.2/lib/python3.9/site-packages/opensnitch/service.py", line 13, in <module>
    from opensnitch import ui_pb2
ImportError: cannot import name 'ui_pb2' from 'opensnitch' (/nix/store/qbqbsb1zbzbcrf421pdrby3qa7qj4rq5-opensnitch-ui-1.4.2/lib/python3.9/site-packages/opensnitch/__init__.py)

The file ui_pb2 is missing but don't know why:

ls /nix/store/qbqbsb1zbzbcrf421pdrby3qa7qj4rq5-opensnitch-ui-1.4.2/lib/python3.9/site-packages/opensnitch
config.py  customwidgets.py  database.py  desktop_parser.py  dialogs  __init__.py  nodes.py  __pycache__  res  service.py  utils.py  version.py

@raboof
Copy link
Member

raboof commented Dec 9, 2021

I think that's a file that should be generated, probably at build time. Perhaps it used to be checked into version control and is no longer, or perhaps the build procedures changed and you need to explicitly run the generator.

@raboof
Copy link
Member

raboof commented Dec 9, 2021

That might be what https://github.com/NixOS/nixpkgs/pull/118329/files#diff-dda7ca3a66bb296c05bcc933df2aae7a511f317b3252d3d5c9b0c986edea36b1R32 was for?

@onny
Copy link
Contributor Author

onny commented Dec 9, 2021

Good catch that worked!

@onny
Copy link
Contributor Author

onny commented Dec 9, 2021

Hm next issue I'll have to look into, building opensnitch daemon

[...]
Building subPackage .
go: inconsistent vendoring in /build/source/daemon:
        golang.org/x/net@v0.0.0-20190311183353-d8887717615a: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        golang.org/x/sys@v0.0.0-20190606203320-7fc4e5ec1444: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
        golang.org/x/net@v0.0.0-20191028085509-fe3aa8a45271: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
        golang.org/x/sys@v0.0.0-20191029155521-f43be2a4598c: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod

        To ignore the vendor directory, use -mod=readonly or -mod=mod.
        To sync the vendor directory, run:
                go mod vendor

@ofborg ofborg bot requested a review from kalbasit December 10, 2021 00:09
@onny onny changed the title [DRAFT] opensnitch, opensnitch-ui: 1.3.6 > 1.4.3 opensnitch, opensnitch-ui: 1.3.6 > 1.4.3 Dec 14, 2021
@onny onny marked this pull request as ready for review December 14, 2021 18:59
@onny
Copy link
Contributor Author

onny commented Dec 14, 2021

Fixed it, builds fine now. If everyone wonders on how to fix "inconsistent vendoring" with building go modules, here's what I did:

git clone https://github.com/evilsocket/opensnitch.git
cd opensnitch/daemon
nix-shell -p protobuf go-protobuf protoc-gen-go-grpc
make -C ../proto ../daemon/ui/protocol/ui.pb.go
go mod tidy
go mod vendor
go mod install -mod=vendor
git diff --patch go.mod > go-mod.patch

I used this patch file in the package script and it works now :)

@ofborg ofborg bot requested a review from raboof December 14, 2021 19:32
@SuperSandro2000 SuperSandro2000 merged commit 0cb120a into NixOS:master Jan 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants