USAGE.md 4.0 KB

Using makefilet's most common features

The makefilet make modules should be configured with the following steps:

  1. make sure that makefilet is available (see the integration instructions for different approaches)
  2. store the current release in a file called ./VERSION (resp.: $(CURRENT_VERSION_FILE)): shell echo "1.0" > VERSION
  3. create ./.bumpversion.cfg with a content similar to the following:

    [bumpversion:file:VERSION]
    
    [bumpversion:file:foo/__init__.py]
    search = ^VERSION = "{current_version}"
    
  4. optional: create a "help" target and describe project-specific targets

    help:
        @echo "Useful targets for FOO:"
        @echo "    bar      prepare the fun"
        @echo "    baz      enjoy the result"
        @echo
    
  5. for python packages: you may want to override the directory containing your setup.py (defaults to "."):

    DIR_PYTHON_SETUP = foo/bar
    

    BEWARE: this variable needs to be set before the include statement for makefilet.

  6. some repositories require git submodules for their deb packaging:

    DEBIAN_PACKAGE_SUBMODULE_DIRECTORIES = submodule1/foo submodule2/bar
    

    You may also define a prep-source:: make target (mind the double colon) to run some actions prior to the creation of the source archive

  7. for repositories creating additional deb packages directly from pypi (via pypi2deb):

    PYPI2DEB_PACKAGES = marshmallow spidev
    

    BEWARE: this variable needs to be set before the include statement for makefilet.

    Pybuild-related environment variables for a specific package foo can be defined as follows:

    $(PYPI2DEB_BUILD_STAMP_PREFIX)-foo: export PYBUILD_DISABLE=test
    
  8. specify the project's name:

    PROJECT_NAME = foo
    

Common targets to be overwritten

makefilet adds the following implicit dependencies:

  • clean
  • dist
  • install
  • lint
  • report
  • test

These targets depend on related targets within the specific sub modules (if applicable).

Feel free to define these targets in your own Makefile, if you need additional custom operations.

Specific sub-targets implemented by the various modules

The following targets are implemented:

  • dist-deb-packages-directory: create the deb packages and store the resulting package files (with the version string and architecture stripped from the filename) in the directory DIR_DEBIAN_SIMPLIFIED_PACKAGE_FILES. This includes deb package files created via dist-deb and dist-pypi2deb.
  • dist-deb: create the deb packages and store them in DIR_DEBIAN_BUILD
  • init-deb: create an example deb packaging in the 'debian/' directory (via dh_make)
  • lint-deb: run lintian for a deb package
  • upload-deb: upload the deb packages to the internal repository
  • dist-pypi2deb: create deb packages via pypi2deb directly from the Python package index
  • upload-pypi2deb: upload the packages created via pypi2deb to the internal repository
  • dist-python: build a python module via setup.py
  • lint-python: check python code via flake8
  • upload-python: upload the python module to the internal pypi repository
  • test-python: run flake8
  • virtualenv-update: create a virtual environment and install packages based on requirements.txt (VIRTUALENV_REQUIREMENTS_FILE)
  • release-(major|minor|patch): increment version number and commit this change
  • release-undo: revert the last commit, if it was a release (see above)
  • release-push: push the changes (commits and tags) after a release
  • release-tar: create a release archive
  • release-tar-sign: sign a release archive

Variables

The following variables are initialized with sane defaults:

  • RM
  • PYTHON_BIN
  • PYPI2DEB_PYTHON_PREFIX (default: "python3", may also be "python")
  • BUILD_ID (based on the git commit hash)
  • DIR_BUILD
  • DIR_DIST
  • DESTDIR

Functions

The following functions can be called via $(call FOO,bar,baz):

  • get_current_version