From 1cc7d8d271db444172cbcc140909f4f4e01d932b Mon Sep 17 00:00:00 2001 From: Bruno Pagani Date: Tue, 20 Jun 2017 23:59:10 +0200 Subject: [PATCH] Add Arch Linux to CI --- .travis.yml | 2 ++ contrib/PKGBUILD | 39 ++++++++++++++++++++++++++++ contrib/README.md | 17 ++++++++++-- contrib/ci/Dockerfile-arch | 38 +++++++++++++++++++++++++++ contrib/ci/build_and_install_pkgs.sh | 18 +++++++++++++ 5 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 contrib/PKGBUILD create mode 100644 contrib/ci/Dockerfile-arch create mode 100755 contrib/ci/build_and_install_pkgs.sh diff --git a/.travis.yml b/.travis.yml index 6eece4f5c..eb50c2b14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,9 @@ services: before_script: - docker build -t fwupd-fedora-25 -f contrib/ci/Dockerfile-fedora-25 . - docker build -t fwupd-debian-experimental -f contrib/ci/Dockerfile-debian-experimental . + - docker build -t fwupd-arch -f contrib/ci/Dockerfile-arch . script: - docker run -e CI=true -t -v `pwd`:/build fwupd-fedora-25 ./contrib/ci/build_and_install_rpms.sh - docker run -e CI=true -t -v `pwd`:/build fwupd-debian-experimental ./contrib/ci/build_and_install_debs.sh + - docker run -e CI=true -t -v `pwd`:/build fwupd-arch ./contrib/ci/build_and_install_pkgs.sh diff --git a/contrib/PKGBUILD b/contrib/PKGBUILD new file mode 100644 index 000000000..3f3542ec4 --- /dev/null +++ b/contrib/PKGBUILD @@ -0,0 +1,39 @@ +# Maintainer: Bruno Pagani (a.k.a. ArchangeGabriel) +# Contributor: Mirco Tischler + +pkgname=fwupd +pkgver=0.9.4.r53.ge90542f +pkgrel=1 +pkgdesc='A simple daemon to allow session software to update firmware' +arch=('i686' 'x86_64') +url='https://github.com/hughsie/fwupd' +license=('GPL2') +depends=('appstream-glib' 'fwupdate' 'colord') +makedepends=('meson' 'valgrind' 'docbook-utils' 'docbook-sgml' 'perl-sgmls' + 'gobject-introspection' 'gtk-doc' 'python-pillow' 'python-cairo' + 'ttf-dejavu' 'adobe-source-han-sans-cn-fonts' 'python-gobject' 'git') + +pkgver() { + cd ${pkgname} + git describe | sed 's/-/.r/;s/-/./' +} + +build() { + cd ${pkgname} + meson --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --libexecdir=/usr/lib \ + --buildtype=plain \ + ../build + + ninja -v -C ../build +} + +check() { + ninja -C build test +} + +package() { + DESTDIR="${pkgdir}" ninja -C build install +} diff --git a/contrib/README.md b/contrib/README.md index 8492f124f..3623c02cf 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -1,7 +1,7 @@ Distribution packages ===================== -The relevant packaging necessary to generate *RPM* and *DEB* distribution packages is contained here. -It is used regularly for continuous integration using [Travis CI](http://travis-ci.org). The generated packages can be used on a distribution such as Fedora, Debian or Ubuntu. +The relevant packaging necessary to generate *RPM*, *DEB* and *PKG* distribution packages is contained here. +It is used regularly for continuous integration using [Travis CI](http://travis-ci.org). The generated packages can be used on a distribution such as Fedora, Debian, Ubuntu or Arch Linux. The build can be performed using Linux containers with [Docker](www.docker.com). @@ -35,6 +35,19 @@ DEBs will be made available in your working directory when complete. To use the packages, you may need to enable the experimental repository for dependency resolution. Additional information is available here: https://wiki.debian.org/DebianExperimental +## PKG packages +A Dockerfile is available for Arch Linux. + +To prepare the Docker container run this command: + +`docker build -t fwupd-arch -f contrib/ci/Dockerfile-arch .` + +To build the PKGs run this command (from the root of your git checkout): + +```docker run -t -v `pwd`:/build fwupd-arch ./contrib/ci/build_and_install_pkgs.sh``` + +PKGs will be made available in your working directory when complete. + ## Additional packages Submissions for generating additional packages for other distribution mechanisms are also welcome. All builds should occur in Docker containers. diff --git a/contrib/ci/Dockerfile-arch b/contrib/ci/Dockerfile-arch new file mode 100644 index 000000000..f381e344a --- /dev/null +++ b/contrib/ci/Dockerfile-arch @@ -0,0 +1,38 @@ +FROM archlinux/base +# set the locale +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 +# keep the package DB +RUN rm /usr/share/libalpm/hooks/package-cleanup.hook +# update the image, install devel packages +RUN pacman -Syu --noconfirm +RUN pacman -S --noconfirm base-devel +# runtime deps +RUN pacman -S --noconfirm \ + appstream-glib \ + colord \ + fwupdate +# buildtime deps +RUN pacman -S --noconfirm \ + adobe-source-han-sans-cn-fonts \ + docbook-utils \ + docbook-sgml \ + gobject-introspection \ + gtk-doc \ + meson \ + perl-sgmls \ + python-cairo \ + python-gobject \ + python-pillow \ + ttf-dejavu \ + valgrind +# CI dep +RUN pacman -S --noconfirm git +# add an user to build the package with +RUN useradd -s /bin/bash build +RUN echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers +# prepare the build environment +RUN mkdir /build +RUN chown build /build +USER build +WORKDIR /build diff --git a/contrib/ci/build_and_install_pkgs.sh b/contrib/ci/build_and_install_pkgs.sh new file mode 100755 index 000000000..03ce71105 --- /dev/null +++ b/contrib/ci/build_and_install_pkgs.sh @@ -0,0 +1,18 @@ +#!/bin/bash -e + +# prepare the build tree +rm -rf build +mkdir build && pushd build +cp ../contrib/PKGBUILD . +mkdir -p src/fwupd && pushd src/fwupd +ln -s ../../../* . +ln -s ../../../.git . +popd + +# build the package and install it +makepkg -ei --noconfirm + +# move the package to working dir +cp *.pkg.tar.xz ../ + +# no testing here because gnome-desktop-testing isn’t available in Arch