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

Homebrew packaging #18

Open
eunos-1128 opened this issue Mar 1, 2025 · 20 comments
Open

Homebrew packaging #18

eunos-1128 opened this issue Mar 1, 2025 · 20 comments

Comments

@eunos-1128
Copy link

eunos-1128 commented Mar 1, 2025

Hi,

Thank you for developing this wonderful software.

I am now putting out a PR for homebrew formulas so that I can install lazyjournal with homebrew.

The reviewer asked me to include the following in the test section. Is there a function or option or something that can fulfill that requirement when this program is run?

Homebrew/homebrew-core#209356 (comment)

If the formula is for a GUI program, try to find some function that runs as command-line only, like a format conversion, reading or displaying a config file, etc.

Best,

@Lifailon
Copy link
Owner

Lifailon commented Mar 2, 2025

@eunos-1128 thank you for the opportunity to contribute, it is very valuable! Can you clarify what exactly is required to pass?

If the formula is for a GUI program, try to find some function that runs as command-line only, like a format conversion, reading or displaying a config file, etc.

For all functions not related to the GUI (TUI), separate tests have already been implemented, for example, for loading all files (function loadFiles) and reading all files (function loadFileLogs) one test is used - TestUnixFiles in the file main_test.go.

go test -v --run TestUnixFiles

Similarly for other logs in Linux and Windows systems. Will this information be enough?

@eunos-1128
Copy link
Author

eunos-1128 commented Mar 3, 2025

@Lifailon

Thank you.

Since the test is to verify that the executable binary works after it has been built, a command that can test the functional requirements when run with lazyjournal is preferred.

Is there a command in the lazyjournal CLI that will show a log or something of the TUI functions?

@Lifailon
Copy link
Owner

Lifailon commented Mar 3, 2025

A very strange requirement, because it is extra code when tests are used for such purposes... This is a TUI application and the console output mode is not provided, I have not seen other TUI applications that use this.

I can do this in one parameter option (for example, --homebrew, where one function will be executed with the output of the result to the console), the question is whether this will be enough to pass, can you clarify exactly?

@eunos-1128
Copy link
Author

eunos-1128 commented Mar 3, 2025

I am checking with a PR reviewer to see if just testing lazyjournal --version is sufficient.

Just to add, the lazydocker PR was merged with just the lazydocker --version test.

@eunos-1128
Copy link
Author

eunos-1128 commented Mar 3, 2025

@Lifailon

Is it possible to implement the --config option like lazydocker?
(it prints the current default config)

This was used for testing in the recent versions of lazydocker's PRs on Homebrew.

@Lifailon
Copy link
Owner

Lifailon commented Mar 3, 2025

As I can see (looking at the example from lazydocker), it outputs the user config in yaml format, currently lazyjournal does not provide config, but I can extract the basic information that is collected from the system while it is running and assemble it into one config also in yaml format (but it will not be a config that can be modified like in lazydocker).

For example:

containerizationSystemInstalled:
  - name: docker
  installed: true
  version: 26.1.3
  - name: podman
  ...

@eunos-1128 what do you think?

@eunos-1128
Copy link
Author

eunos-1128 commented Mar 3, 2025

@Lifailon

I believe aggregating the installation status and version information of containerization systems (such as Docker and Podman) into a YAML format will be beneficial for audit and operations management, and also meet homebrew test requirements.

As you say it isn't kind of configurable stuff, so --config might not be appropriate...

How about --system-info or --audit (IMO)?

@Lifailon
Copy link
Owner

Lifailon commented Mar 3, 2025

As you say it isn't kind of configurable stuff, so --config might not be appropriate...

How about --system-info or --audit (IMO)?

I agree that it would be better to choose another option name, and --audit is suitable. I will need a few days to prepare a detailed status.

@eunos-1128
Copy link
Author

@Lifailon

Thanks to another kind Github user who added the following code to the PR, it looks like the PR will be merged without brew --audit.

    require "pty"
    PTY.spawn bin/"lazyjournal" do |_r, _w, pid|

@Lifailon
Copy link
Owner

Lifailon commented Mar 6, 2025

Thanks to another kind Github user who added the following code to the PR, it looks like the PR will be merged without brew --audit.

require "pty"
PTY.spawn bin/"lazyjournal" do |_r, _w, pid|

That's great! Anyway, I've already started making this parameter, and it really could be useful, and I'll finish it tomorrow.

@Lifailon
Copy link
Owner

Lifailon commented Mar 6, 2025

@eunos-1128 once everything is done, I will ask you to add information on installing via brew to the README file (following the example of installing from AUR) via Pull Requests. After that, you will be added to the list of contributors of the lazyjournal project.

@eunos-1128
Copy link
Author

eunos-1128 commented Mar 6, 2025

@Lifailon

I understand. Thank you!

For now I'm also adding lazyjournal to conda-forge for installing the package with conda(win/mac/linux).

conda-forge/staged-recipes#29324 (comment)

I'll make PRs for homebrew and conda packaging later on.

@Lifailon
Copy link
Owner

Lifailon commented Mar 6, 2025

@eunos-1128 i also have a question for you, can you leave your contact information (telegram/discord/email)?

@eunos-1128
Copy link
Author

eunos-1128 commented Mar 6, 2025

@Lifailon

One below is my email address but I don't look at it much because there are too many spam mails.
[email protected]

I often check X, so it's good for you to send DMs to me.
https://x.com/eunos1128

Otherwise, I use Github everyday for work, so please mention me on any issue.

@Lifailon
Copy link
Owner

Lifailon commented Mar 6, 2025

@eunos-1128 you will be able to check the results yourself from the source code?

Here are the audit results:

Linux

sudo go run main.go -a

system:
  os: linux
  arch: amd64
systemd:
  journald:
  - installed: true
    journals:
    - name: Unit list
      count: 572
    - name: System journals
      count: 31917
    - name: User journals
      count: 9795
    - name: Kernel boot
      count: 3
fileSystem:
  username: root
  files:
  - name: System var logs
    path: /var/log/
    count: 50
  - name: Optional package logs
    path: /opt/
    count: 1
  - name: Users home logs
    path: /home/
    count: 79
  - name: Process descriptor logs
    path: descriptor
    count: 27
containerization:
  system:
  - name: docker
    installed: true
    version: 26.1.3, build 26.1.3-0ubuntu1~24.04.1
    containers: 17
  - name: podman
    installed: false
  - name: kubernetes
    installed: false

macOS

system:
  os: darwin
  arch: amd64
systemd:
  journald:
  - installed: false
fileSystem:
  username: root
  files:
  - name: System var logs
    path: /var/log/
    count: 104
  - name: Optional package logs
    path: /opt/
    count: 33
  - name: Users home logs
    path: /home/
    count: 85
  - name: Process descriptor logs
    path: descriptor
    count: 26
containerization:
  system:
  - name: docker
    installed: false
  - name: podman
    installed: false
  - name: kubernetes
    installed: false

Windows

system:
  os: windows
  arch: amd64
winEvent:
  logs:
  - count: 149
fileSystem:
  systemDisk: C
  username: Lifailon
  files:
  - path: "C:/ProgramData"
    count: 53
  - path: "C:/Program Files"
    count: 80
  - path: "C:/Program Files (x86)"
    count: 102
  - path: "C:/Users/Lifailon/AppData/Roaming"
    count: 1244
  - path: "C:/Users/Lifailon/AppData/Local"
    count: 2522
containerization:
  system:
  - name: docker
    installed: true
    version: 27.2.0, build 3ab4256
    containers: 2
  - name: podman
    installed: true
    version: 5.3.2
    containers: 0
  - name: kubernetes
    installed: true
    version: v1.30.2
    pods: 0

@eunos-1128
Copy link
Author

@Lifailon OK, I will give it a try.

@Lifailon
Copy link
Owner

Lifailon commented Mar 6, 2025

All output is dynamic and depends on the system you are using.

@eunos-1128 can you clarify if this is enough?

I need to add a new flag to unit testing (to check it) and also add macOS testing to CI Actions before new release, this will also take some time.

@eunos-1128
Copy link
Author

eunos-1128 commented Mar 6, 2025

@Lifailon

I ran the command you suggested on my MacBook(x86_64).

system:
  os: darwin
  arch: amd64
systemd:
  journald:
  - installed: false
fileSystem:
  username: root
  files:
  - name: System var logs
    path: /var/log/
    count: 81
  - name: Optional package logs
    path: /opt/
    count: 7
  - name: Users home logs
    path: /home/
    count: 382
  - name: Process descriptor logs
    path: descriptor
    count: 261
containerization:
  system:
  - name: docker
    installed: true
    version: 24.0.2, build cb74dfc
    containers: 0
  - name: podman
    installed: false
  - name: kubernetes
    installed: true
    version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.9", GitCommit:"a1a87a0a2bcd605820920c6b0e618a8ab7d117d4", GitTreeState:"clean", BuildDate:"2023-04-12T12:16:51Z", GoVersion:"go1.19.8", Compiler:"gc", Platform:"darwin/amd64"}
    pods: 0

What number is “count”?
Does the value refer to the number of files in the target log of lazyjournal?

Also, I felt it would be nice to have the date and time of the run.

@Lifailon
Copy link
Owner

Lifailon commented Mar 6, 2025

In your example, the number of logs that will be displayed on the first tab of 4 in the file system logs window is 81.
When using the flag, the main functions that are used in the interface are called, but only for counting the number, i.e. count for files.

@eunos-1128 should the word count be replaced with number? And maybe there are other comments?

  - name: System var logs
    path: /var/log/
    count: 81

Also, I felt it would be nice to have the date and time of the run.

Specify the current time in the system or the time spent performing the audit? Or both?

@eunos-1128
Copy link
Author

@Lifailon

I think count is ok.

Specify the current time in the system or the time spent performing the audit? Or both?

I meant by the current time in the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants