From 8ac7ef22fa39e168ad84c55c52ca446b08ff9281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Tue, 3 Dec 2024 11:42:24 +0100 Subject: [PATCH] update CONTRIBUTING --- CONTRIBUTING.md | 61 ++++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 44 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d4ab7e558..57f72edca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -110,15 +110,13 @@ make docker-build To run aptly commands in the development docker container, run: ``` -make docker-aptly +make docker-shell ``` Example: ``` -$ make docker-aptly -bash: cannot set terminal process group (16): Inappropriate ioctl for device -bash: no job control in this shell -aptly@b43e8473ef81:/app$ aptly version +$ make docker-shell +aptly@b43e8473ef81:/work/src$ aptly version aptly version: 1.5.0+189+g0fc90dff ``` @@ -152,41 +150,36 @@ Run `make help` for more information. This section describes local setup to start contributing to aptly. -#### Go & Python +#### Dependencies -You would need `Go` (latest version is recommended) and `Python` 3.9 (or newer, the CI currently tests against 3.11). +Building aptly required go version 1.22. -If you're new to Go, follow [getting started guide](https://golang.org/doc/install) to install it and perform -initial setup. With Go 1.8+, default `$GOPATH` is `$HOME/go`, so rest of this document assumes that. +On Debian bookworm with backports enabled go can be installed with: -Usually `$GOPATH/bin` is appended to your `$PATH` to make it easier to run built binaries, but you might choose -to prepend it or to skip this test if you're security conscious. + apt install -t bookworm-backports golang-go -#### Dependencies +#### Building -You would need some additional tools and Python virtual environment to run tests and checks, install them with: +Export GOPATH: - make prepare dev system/env + export GOPATH=~/go -This is usually one-time action. +To build aptly, run: -Aptly is using Go modules to manage dependencies, download modules using: + make build - make modules +To install aptly into `$GOPATH/bin`, run: -#### Building + make install -If you want to build aptly binary from your current source tree, run: +Add go binaries to your PATH if needed: - make install + export PATH=$PATH:$GOPATH/bin -This would build `aptly` in `$GOPATH/bin`, so depending on your `$PATH`, you should be able to run it immediately with: +Run aptly: aptly -Or, if it's not on your path: - - ~/go/bin/aptly #### Unit-tests @@ -244,26 +237,6 @@ There are some packages available under `system/files/` directory which are used this default location. You can run aptly under different user or by using non-default config location with non-default aptly root directory. -#### Style Checks - -Style checks could be run with: - - make check - -aptly is using [golangci-lint](https://github.com/golangci/golangci-lint) to run style checks on Go code. Configuration -for the linter could be found in [.golangci.yml](.golangci.yml) file. - -Python code (system tests) are linted with [flake8 tool](https://pypi.python.org/pypi/flake8). - -#### Vendored Code - -aptly is using Go vendoring for all the libraries aptly depends upon. `vendor/` directory is checked into the source -repository to avoid any problems if source repositories go away. Go build process will automatically prefer vendored -packages over packages in `$GOPATH`. - -If you want to update vendored dependencies or to introduce new dependency, use [dep tool](https://github.com/golang/dep). -Usually all you need is `dep ensure` or `dep ensure -update`. - ### man Page aptly is using combination of [Go templates](http://godoc.org/text/template) and automatically generated text to build `aptly.1` man page. If either source