Want to install something from a debian / apt package but prebuilt packages don't exist?
Build your own, the easy (and lazy) way!
Run (/d is a directory):
$ lzdeb build /d
Collect the resulting debian package file in your working directory.
$ lzdeb build /d
...
$ ls *.deb
/d/config.yml
- (optional)
/d/build
/d/install
- (optional)
/d/validate
Create a debian package for the silver searcher.
builder:
image: ubuntu:16.04
bootstrap_cmds:
- apt update
- apt install -y git
validator:
image: ubuntu:18.04
bootstrap_cmds:
- apt update
source:
type: git
url: https://github.com/ggreer/the_silver_searcher.git
ref: 2.2.0
pull_submodules: yes
deb_info:
pkgname: silversearcher-ag
pkgversion: 2.2.0
pkgrelease: 1
pkglicense: Apache 2.0
pkggroup: main
maintainer: [email protected]
description: "A code-searching tool similar to ack, but faster. http://geoff.greer.fm/ag/"
requires:
- liblzma-dev>=5.1.1
- libpcre3-dev>=2:8.38
- zlib1g-dev>=1:1.2.8
builder
defines the docker container within which the deb package is built.
validator
defines the docker container within which the built deb is validated (install the package, may be some test commands)
source
defines where to get the source code to be built.
deb_info
defines debian package metadata to be used when creating the debian package.
Install build tools and required libraries. Build (compile) the code.
#!/usr/bin/env bash
set -e
apt-get update
apt-get install -y \
automake \
pkg-config \
libpcre3-dev \
zlib1g-dev \
liblzma-dev
cd the_silver_searcher*/
./build.sh
Perform a "make install". A debian package is built automatically based on filesystem changes.
#!/usr/bin/env bash
set -e
cd the_silver_searcher*/
make install
Try installing the built debian package. Verify program runs.
#!/usr/bin/env bash
set -e
apt install -y ./*.deb
ag -h
$ lzdeb build example/silversearcher-ag
... spin up build container
...
... build script gets run
...
... install script gets run (deb package file created)
...
... validate script gets run (deb package file gets installed in fresh container)
...
$ ls *.deb
silversearcher-ag_2.2.0-1_amd64.deb
$ pip3 install lzdeb
Tested on MacOS. Probably works on Linux as well.
There are many!
We will populate this section with the most important ones, as users report them.
- Fork the repo.
- In a virtualenv:
pip3 install -r requirements.txt
pip3 install -r .circleci/test_requirements
- Hack Away!
- Testing:
- New unit tests to go in
test/
- If you have CircleCI access, make sure the
test_all
workflow passes. - Otherwise, you could run tests locally (see
.circleci/config.yml
):- unit tests:
py.test --cov=lzdeb test/
- lint:
pylint -E lzdeb test
- pep8:
pycodestyle lzdeb test
- type hint checking:
mypy lzdeb test
- unit tests:
- New unit tests to go in