Skip to content

DevConf2020 Workshop

lachmanfrantisek edited this page Jan 25, 2020 · 14 revisions

Workshop

Prerequisities

Choice of the project

Installation of the app

  1. https://github.com/apps/packit-as-a-service
  2. -> install / configure
  3. choose the repo(s)

Whitelist

Packit configuration

Examples:

  • dummy package:
specfile_path: hello.spec
upstream_package_name: hello
downstream_package_name: hello
jobs:
- job: copr_build
  trigger: pull_request
  metadata:
    targets:
    - fedora-30-x86_64
    - fedora-31-x86_64
    - fedora-rawhide-x86_64

- job: tests
  trigger: pull_request
  metadata:
    targets:
    - fedora-30-x86_64
    - fedora-31-x86_64
    - fedora-rawhide-x86_64
- job: propose_downstream
  trigger: release
  metadata:
    dist-git-branch: fedora-all
  • Simple python package:
specfile_path: python-ogr.spec
upstream_package_name: ogr
downstream_package_name: python-ogr
upstream_project_url: https://github.com/packit-service/ogr

# the version is different than with basic git describe
create_tarball_command: ["python3", "setup.py", "sdist", "--dist-dir", "."]
current_version_command: ["python3", "setup.py", "--version"]

jobs:
- job: sync_from_downstream
  trigger: commit

- job: propose_downstream
  trigger: release
  metadata:
    dist-git-branch: fedora-all

- job: copr_build
  trigger: pull_request
  metadata:
    targets: fedora-all

- job: tests
  trigger: pull_request
  metadata:
    targets: fedora-all
  • Python package using setuptools-scm for versioning
specfile_path: packit.spec
synced_files:
  - packit.spec
  - .packit.yaml
  - src: fedora-tests/
    dest: tests/
# packit was already taken on PyPI
upstream_package_name: packitos
downstream_package_name: packit
upstream_project_url: https://github.com/packit-service/packit

actions:
  create-archive:
  - "python3 setup.py sdist --dist-dir ."
  - "sh -c 'echo packitos-$(python3 setup.py --version).tar.gz'"
  get-current-version:
  - "python3 setup.py --version"


jobs:
- job: propose_downstream
  trigger: release
  metadata:
    dist-git-branch: fedora-all
- job: sync_from_downstream
  trigger: commit
- job: copr_build
  trigger: pull_request
  metadata:
    targets:
    - fedora-all
- job: tests
  trigger: pull_request
  metadata:
    targets:
    - fedora-stable # on rawhide we have problems with the new marshmallow

Local SRPM

$ packit srpm --help
Usage: packit srpm [OPTIONS] [PATH_OR_URL]

  Create new SRPM (.src.rpm file) using content of the upstream repository.

  PATH_OR_URL argument is a local path or a URL to the upstream git
  repository, it defaults to the current working directory

Options:
  --output FILE        Write the SRPM to FILE instead of current dir.
  --remote TEXT        Name of the remote to discover upstream project URL, If
                       this is not specified, default to origin.
  --upstream-ref TEXT  Git ref of the last upstream commit in the current
                       branch from which packit should generate patches (this
                       option implies the repository is source-git).
  -h, --help           Show this message and exit.
$ packit srpm https://github.com/packit-service/ogr
Packit 0.8.1.dev36+g5856e95 is being used.
Input is a URL to a git repo: https://github.com/packit-service/ogr
Input directory is an upstream repository.
SRPM is /tmp/python-ogr-0.9.1.dev20+g8f89fe2-1.fc31.src.rpm
SRPM: /tmp/python-ogr-0.9.1.dev20+g8f89fe2-1.fc31.src.rpm
$ packit srpm https://src.fedoraproject.org/rpms/python-ogr
Packit 0.8.1.dev36+g5856e95 is being used.
Input is a URL to a git repo: https://src.fedoraproject.org/rpms/python-ogr
Input directory is a downstream repository.
SRPM is /tmp/python-ogr-0.9.1.dev20+g8f89fe2-1.fc31.src.rpm
SRPM: /tmp/python-ogr-0.9.1.dev20+g8f89fe2-1.fc31.src.rpm
Clone this wiki locally