Install KISS

Package System
Package Manager




Git (mirror)

wiki / kiss / style-guide                                         

Edited () at 2020-09-16 by James Davies


This document is a style guide which will double as documentation for a possible
package linter in the future. Every package in the Official Repositories and the
Community repository adheres to this style guide.

NOTE: Exceptions are made where it makes sense.


* Each package has a set maintainer stored via git commits. Use 'git log' or
  'kiss-maintainer pkg' to find the maintainer's contact information.

* Only the maintainer of a package has the ability to make changes to said
  package. Any pull requests by a non-maintainer for a package will be closed.

* If you would like to make a change to an existing package, contact the
  maintainer and they will do so on your behalf.

* If the maintainer leaves a package out of date and does not respond in a
  reasonable time frame, the package will be orphaned and up for grabs.

* If no one steps forward to adopt an orphaned package, it will be dropped from
  the repositories.



    Package is not suitable for inclusion in the Community repository. The same
    rules above may apply to other software at the discretion of the BDFL.

    Examples: dbus, systemd, polkit, gettext, intltool, pulseaudio, pipewire,
              pam, wayland, logind, ConsoleKit, libsn, electron and all
              Desktop Environments.


    No new packages shall use GTK2 as it will be removed once Firefox drops it
    as a dependency.


    No new packages shall use Python 2 as it will be removed once Firefox drops
    it as a dependency.


    Packages which are binaries should contain the suffix '-bin' to reflect
    this fact. Similarly, packages which pull from git should contain the
    suffix '-git'. The version of git packages should also be set to 'git'.



    This guide should be used alongside shellcheck and not in place of it.


    All shell code must pass the shellcheck linter. Any false-positives or
    intended behavior must have a rationale attached with the exclusion.

    # Disable warning as CFLAGS must work this way.
    # shellcheck disable=2086
    "${CC:-cc}" $CFLAGS ...


    Use 4 spaces for indentation.


    Lines should not exceed 80 characters in length.


    All packages must use the POSIX shell shebang with '-e' to exit on error.
    Additionally, '-ef' can be used if word-splitting is required.

    There must also be a blank line directly below the shebang.

    #!/bin/sh -e

    # Code starts here.


    All comments must start with a capital letter and use proper spelling,
    grammar and punctuation.

    # This is a comment.


    Leave comments to explain *why* the code is needed and not *what* it does.


    # Create a directory.
    mkdir -p "$1/usr/bin"


    # 'make install' doesn't create the directory.
    mkdir -p "$1/usr/bin"


    Avoid adding braces around variables if unneeded.

    Bad:  printf '%s\n' "${var}"
    Good: printf '%s\n' "$var"
    Good: printf '%s\n' "${var}.${var2}"


    Avoid quotes when unneeded.

    Bad:  [ "$var" = "test" ]
    Good: [ "$var" = test ]

    Bad:  install -Dm755 "file" "$1/usr/bin/file"
    Good: install -Dm755 file "$1/usr/bin/file"


    Quote entire strings instead of variables.

    Bad:  install -Dm644 cat "$1"/usr/bin/cat
    Good: install -Dm644 cat "$1/usr/bin/cat"


    Align arguments in blocks of command calls.


    install -D file.h "$1/usr/include/file.h"
    install -D libfile.so "$1/usr/lib/libfile.so"


    install -D file.h     "$1/usr/include/file.h"
    install -D libfile.so "$1/usr/lib/libfile.so"


    Use 'install' instead of ...


    mkdir -p "$1/usr/bin"
    cp ls "$1/usr/bin/"


    install -Dm755 ls "$1/usr/bin/ls"


    Prefer $CC to ...

    Bad:  gcc -o file file.c
    Good: "${CC:-cc}" -o file file.c


    Always use '-p' with 'mkdir'.



    Use the following style:

       ./configure \
           --prefix=/usr \

       make DESTDIR="$1" install


    Avoid running ./autogen.sh, autoreconf or similar tools prior to starting
    the build process. If there are no pre-generated configure or Makefiles, an
    alternate source must be sought.

    An exception can be made for packages in which no such source exists. If
    autogen.sh or autoreconf are required, prefer autoreconf.



    Use the following style:

       export DESTDIR="$1"

       meson \
           --prefix=/usr \
           -Dexample=false \
           . output

       ninja -C output
       ninja -C output install



    Use the following style:

       export DESTDIR="$1"

       cmake -B build \
           -DCMAKE_INSTALL_PREFIX=/usr \

       cmake --build   build
       cmake --install build



    Use one of the following style when applicable:

       make DESTDIR="$1" PREFIX=/usr install

       make PREFIX=/usr
       make DESTDIR="$1" install

       make PREFIX=/usr
       make DESTDIR="$1" PREFIX=/usr install

    For packages which require a few variables be set, prefer this style.

       make \
           PREFIX=/usr \
           SBINDIR=/usr/bin \

       make \
           DESTDIR="$1" \
           PREFIX=/usr \

    For packages which require the variables be set for all calls to make,
    prefer this style.

       mk() {
           make \
               PREFIX=/usr \
               DESTDIR="$1" \
               EXAMPLE=1 \

       mk install



    Use the following style:

       cargo build --release

       install -Dm755 target/release/rg "$1/usr/bin/rg"



    Use the following style:

       export GOPATH="$PWD/go"
       export GO111MODULE=on

       go build \
           -modcacherw \

       install -Dm755 lazygit "$1/usr/bin/lazygit"



    Use the following style:

       python setup.py build
       python setup.py install --prefix=/usr --root="$1"



    This dependency is unneeded and can be removed.


    This dependency is implicit. Some packages are assumed to always be
    available. This dependency can be removed.

    Examples: gcc, make, musl.


    This dependency needs 'make' as it is only required during build time.

    Common Examples: autoconf, automake, cmake, meson.


    This dependency doesn't need 'make' as it is required during runtime.


    The depends list must be sorted.


    The depends file is empty and should be removed.



    Use a HTTPS source if at all possible.


    Don't specify patches remotely. Store them as a part of the package's
    repository files.

    Good: patches/fix-build.patch


    Don't use a git repository in place of a release tarball unless it makes
    sense to do so.


    Drop www. and .git from all sources if possible.



    Version doesn't match upstream.


    Use 'git' in place of '9999'.


    Missing relative version number.

    Bad:  1.0.0
    Good: 1.0.0 1



    Use the following style:

         patch -p1 < patch.patch

         # If there is more than one patch.
         for patch in *.patch; do
             patch -p1 < "$patch"


    All patches should use the same strip amount. If this is not possible,
    modify the patches. Strip amount is controlled by the -p flag.


Dylan Araps (C) 2019-2020

Linux(R) is the registered trademark of Linus Torvalds in the U.S. and
other countries.