Skip to content

Commit

Permalink
Build RPM packages + clean up Debian package dependencies + exclude t…
Browse files Browse the repository at this point in the history
…ests from sdist tarball (#71) + drop support for make
  • Loading branch information
PawelLipski committed Jan 12, 2020
1 parent f70a6cf commit e09248a
Show file tree
Hide file tree
Showing 19 changed files with 112 additions and 55 deletions.
20 changes: 8 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
git-machete

*.pyc
*.swp
.idea/

.tox/
*.egg-info/
.eggs/
.stestr/

build/
dist/
AUTHORS
ChangeLog

.idea/
build/
dist/
*.egg-info/
.eggs/
.python-version
*.pyc
.tox/
.stestr/
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,19 @@ deploy:
python: 3.6
tags: true

- provider: releases # Github
- provider: script # RPM (actually build only, no deployment - will be deployed to the Github release)
skip_cleanup: true
script: bash ci/rpm/travis-deploy.sh
on:
python: 3.6
tags: true

- provider: releases # Github (rpm files must be in dist/ first)
skip_cleanup: true
token:
secure: arhgNhJMfVq8xaa5xMswvjkgfgE8dDJ6BM0X+HI28m7BrwjxaVyr5Ct1qIohEQSZOpihwHzFLLwzSICc5sR6H8Ai4yYcm/sLGOAHyp4p1HeAXPqbtyUtn3rbcjsKXSfwjntkGommC6sYoY5GZhJy2qcRQIADjRMPQWRURY5/6KBBY05scL2vVpQw2NHp2pNCiMSDhokFsN3mv1PX15QDJdKFuIrD61cD15ljkwol7OJ+wKzGozyJB6GHkWi7WsGXsgdzjruHY7tcqPEksa+sWxxGGMmLQ7gVruVUlguunACjh0xlZvMBDKWEeffvRy9JSkAKVccTtaiZw9beoCaihZOVys/Bw4Znv3e+UpkOOrBwMFOdjc1R/Kz1/aewuYFckKhP/opdkpOj3T0VIckmK4s/vWYWhHLRiAHE4gb47UxYIKHGqPfs9XMyZryRF6iaTm3LKtTb+ufM0OQEKtWR0MBBRmpqapx74Jd6tuf7n4KbsS4ZuVeb27+OBhfogpYdfGW2KxzwCOwYl+iGCsNkPyMUOmqo8MfFvwEsHU7SnZ1G2tcSoptT8+Bj8n2lKB7sf/llywUJxKKG9kpK9Y9Tc6yvtgjj4ewjsjgaGCksS5jVPk223WEHu/iX4FK4Ftms9cXWLbQpMKW4dACyAEu8ONIRw+TXvUFA2J3wWsOiQNk=
file_glob: true
file: dist/git-machete-*.noarch.rpm
on:
python: 3.6
tags: true
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
include LICENSE

# Needed for the Homebrew formula to install the completion scripts correctly
recursive-include completion *
21 changes: 0 additions & 21 deletions Makefile

This file was deleted.

19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ sudo apt-get update
sudo apt-get install -y python3-git-machete
```

### Using rpm (Fedora/RHEL/CentOS/openSUSE...)

Download the rpm package from the [latest release](https://github.com/VirtusLab/git-machete/releases/latest)
and install either by opening it in your desktop environment or with `rpm -i git-machete-*.noarch.rpm`.

### Using AUR (Arch Linux)

Install the AUR package [git-machete](https://aur.archlinux.org/packages/git-machete) using an AUR helper of your preference.
Expand All @@ -63,29 +68,19 @@ nix-env -i git-machete
You need to have Python and `pip` installed from system packages.

```shell script
sudo -H pip install --system git-machete
sudo -H pip install git-machete
```

### Using pip without sudo (user-wide install)

You need to have Python and `pip` installed from system packages.

```shell script
pip install git-machete
pip install --user git-machete
```

Please verify that your `PATH` variable has `${HOME}/.local/bin/` included.

### Using make with sudo (deprecated)

Run the following commands to install git machete:

```shell script
git clone --depth=1 https://github.com/VirtusLab/git-machete.git
cd git-machete
sudo make install
```


## Quick start

Expand Down
7 changes: 7 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release notes

## New in git-machete 2.12.10

- added: RPM package build
- fixed: Debian package no longer depends on `python3-pkg-resources`
- fixed: tests are no longer included in sdist tarball
- removed: support for building with make

## New in git-machete 2.12.9

- fixed: missing Debian build dependency on `git`
Expand Down
2 changes: 1 addition & 1 deletion ci/apt-ppa/.env-sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Can be used by docker-compose for building the `ppa-upload` image locally
# Can be used by docker-compose for building the `virtuslab/git-machete-ci-apt-ppa-upload` image locally
USER_ID=1000
GROUP_ID=1000
2 changes: 1 addition & 1 deletion ci/apt-ppa/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
ppa-upload:
image: virtuslab/git-machete-ci-ppa-upload:${DOCKER_TAG:-latest}
image: virtuslab/git-machete-ci-apt-ppa-upload:${DOCKER_TAG:-latest}
build:
context: .
dockerfile: upload.Dockerfile
Expand Down
3 changes: 3 additions & 0 deletions ci/rpm/.env-sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Can be used by docker-compose for building the `virtuslab/git-machete-ci-rpm` image locally
USER_ID=1000
GROUP_ID=1000
1 change: 1 addition & 0 deletions ci/rpm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
16 changes: 16 additions & 0 deletions ci/rpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM fedora:31

RUN dnf install -y python rpm-build

ARG user_id
ARG group_id
RUN "[" ${user_id:-0} -ne 0 ] \
&& [ ${group_id:-0} -ne 0 ] \
&& groupadd -g ${group_id} ci-user \
&& useradd -l -u ${user_id} -g ci-user ci-user \
&& install -d -m 0755 -o ci-user -g ci-user /home/ci-user
USER ci-user
COPY --chown=ci-user:ci-user entrypoint.sh /home/ci-user/
RUN chmod +x ~/entrypoint.sh
CMD ["/home/ci-user/entrypoint.sh"]
WORKDIR /home/ci-user/git-machete
8 changes: 8 additions & 0 deletions ci/rpm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Builing the RPM locally

```shell script
cd ci/rpm
cp .env-sample .env # and optionally edit if needed to match your current user's UID/GID
docker-compose up --build rpm
# the artifacts will be located in dist/ folder in top-level project directory
```
10 changes: 10 additions & 0 deletions ci/rpm/build-context/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

{ [[ -f setup.py ]] && grep -q "name='git-machete'" setup.py; } || {
echo "Error: the repository should be mounted as a volume under $(pwd)"
exit 1
}

set -x

python setup.py bdist_rpm
12 changes: 12 additions & 0 deletions ci/rpm/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'
services:
rpm:
image: virtuslab/git-machete-ci-rpm:${DOCKER_TAG:-latest}
build:
context: build-context
dockerfile: ${PWD}/Dockerfile
args:
- user_id=${USER_ID:-0}
- group_id=${GROUP_ID:-0}
volumes:
- ${PWD}/../..:/home/ci-user/git-machete
16 changes: 16 additions & 0 deletions ci/rpm/travis-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -e -o pipefail -u -x

DOCKER_TAG=$(git rev-parse HEAD:ci/rpm/)
export DOCKER_TAG
cd ci/rpm/

# If the image corresponding to the current state of ci/rpm/ is missing, build it and push to Docker Hub.
docker-compose pull rpm || {
docker-compose build --build-arg user_id="$(id -u)" --build-arg group_id="$(id -g)" rpm
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker-compose push rpm
}

docker-compose up --exit-code-from=rpm rpm
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ X-Python3-Version: >= 3.6
Package: python3-git-machete
Architecture: any
Description: Probably the sharpest git repository organizer & rebase workflow automation tool you've ever seen
Depends: ${python3:Depends}, python3-pkg-resources
Depends: ${python3:Depends}
4 changes: 4 additions & 0 deletions git-machete
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python

from git_machete import cmd
cmd.main()
2 changes: 1 addition & 1 deletion git_machete/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.12.9'
__version__ = '2.12.10'
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from git_machete import __version__
from os import path
from setuptools import find_packages, setup
from setuptools import setup

this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md')) as f:
Expand All @@ -19,10 +19,8 @@
url='https://github.com/VirtusLab/git-machete/',
license='MIT',
keywords='git',
packages=find_packages(),
entry_points=dict(
console_scripts=['git-machete=git_machete.cmd:main']
),
packages=['git_machete'],
scripts=['git-machete'],
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2',
Expand Down

0 comments on commit e09248a

Please sign in to comment.