Integrate PackageCore to generate packages

This commit is contained in:
Arun Prakash Jana 2017-09-01 22:16:14 +05:30
parent e2fae851c3
commit c88650832c
No known key found for this signature in database
GPG Key ID: A75979F35C080412
5 changed files with 78 additions and 148 deletions

View File

@ -1,5 +1,7 @@
language: c
sudo: required
services:
- docker
matrix:
include:
# Access more recent gcc and clang via a Trusty image
@ -13,48 +15,32 @@ matrix:
compiler: gcc
- os: osx
compiler: clang
- os: linux
dist: trusty
env: USE_DOCKER=1 OS_TYPE=centos OS_VERSION=7
- os: linux
dist: trusty
env: USE_DOCKER=1 OS_TYPE=fedora OS_VERSION=26
before_install:
- if [ "$USE_DOCKER" = "1" ]; then
sudo systemctl start docker.service;
sudo docker pull $OS_TYPE:$OS_VERSION;
fi
script:
- if [ "$USE_DOCKER" = "1" ]; then
./build-docker $OS_TYPE $OS_VERSION;
sudo chown -R $(id -un).$(id -gn) dist;
else
export CFLAGS=-Werror;
make clean;
make;
make clean;
make -f Makefile.native;
fi
export CFLAGS=-Werror;
make clean;
make;
make clean;
make -f Makefile.native;
after_success:
- if [ "$USE_DOCKER" = "1" ]; then
ls -l dist;
fi
before_deploy:
- unset CFLAGS
- sudo apt-get update -qy
- sudo apt-get install -qy python3 python3-pip
- python3 -m pip install packagecore
- packagecore -o dist/ "${TRAVIS_TAG#v}"
deploy:
skip_cleanup: true
provider: releases
api-key:
secure: bdw73zBeBEZtDZGEyFpAksnpwLHTBaC7VP1pONmnsXv4qmMcynASz0LfE4krEdAsRnvxQvqPZXviy/SZ3bmaLpVQmJIC1uRWIyOBE6K/7ddf+wfLy+1uO9EPd/zDF/D28Xy8QJLDGDZI08BY5Fist4XowyvtdW3GRwwDL7TwyZyigr0fkqLJwYcqCpojsHsjXjhkpGZqB5XRztaJ4kIEVz8du03ZU1l5kA9lI8Pdk9+mntOOt6emlaJl+Wr81QkwA8TvGPlZ1VP/+h9YCtlRy/4OuiU+bg5/Atxjh8M6rsq+WpZ3ZdYbR6x5vP78p9f6TsJa4ymGhhW6MhYrKPwdT4oITzZcOXJl6AEoIvrWHQWLY7K3WaEfRbT+DODnXks0ToFKls7wyWfi/AHI0ejeDD5Na5/XhY0jdVYOVvovoY2n8LBaqRTFJDYKoCbJ1S+6myUvvmFVwiZWcgOv9gVX1aaIl4wh+XuzUtPDJTcJtUOE8Q2MWl0bdYVtEkHVRznPXN5u3odrDaeTD3vo+pEaEpshLoSKhCyyWvslSzN7T98ez3aw3KFXoFhXPEg5MEJWy7u359MaVwJIsOGUDAFhy/Y7h83LjQYnu8cmX2wuVrQIRIlGVB0f10GYZzPffZz98I/T0xv75NzpyRs31/wMxvdXz35c8m/yTup4kAkG/1s=
file_glob: true
file:
- dist/*.deb
- dist/*.rpm
- dist/*
skip_cleanup: true
on:
condition: $USE_DOCKER = 1
repo: jarun/nnn
condition:
- "$TRAVIS_OS_NAME == linux"
- "$CC == gcc"
tags: true
tags: true
repo: jarun/nnn

View File

@ -1,42 +0,0 @@
#!/bin/bash
set -xe
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <OS_TYPE> <OS_VERSION>"
exit 1
fi
os_type="$1"
os_version="$2"
docker_args="-e OS_TYPE=$os_type -e OS_VERSION=$os_version -v $(pwd):/build:rw --rm=true"
case $os_type in
centos|fedora)
# check for correct package manager
if [[ $os_type == "fedora" ]]; then
YUM=dnf
else
YUM=yum
fi
# set up the docker image with a baseline
cat >Dockerfile <<EOF
FROM $os_type:$os_version
RUN mkdir /build
VOLUME /build
RUN $YUM -y install rpm-build gcc git make readline-devel ncurses-devel
EOF
sudo docker build -t nnn .
# do the build
sudo docker run $docker_args nnn /bin/bash -c "cd /build && ./redhat/build-rpm"
;;
*)
echo "$OS_TYPE $OS_VERSION not supported!"
exit 1
;;
esac
# vim: et:ai:ts=4:sw=4

59
packagecore.yaml Normal file
View File

@ -0,0 +1,59 @@
name: nnn
metadata:
maintainer: Arun Prakash Jana <engineerarun@gmail.com>
license: BSD 2-Clause
summary: The missing terminal file browser for X.
homepage: https://github.com/jarun/nnn
commands:
install:
- make PREFIX="/usr" install DESTDIR="${BP_DESTDIR}"
packages:
archlinux:
builddeps:
- make
deps:
- ncurses
- readline
fedora26:
builddeps:
- make
- ncurses-devel
- readline-devel
deps:
- ncurses
- readline
centos7.3:
builddeps:
- make
- ncurses-devel
- readline-devel
deps:
- ncurses
- readline
commands:
pre:
- yum install epel-release
ubuntu16.04:
builddeps:
- make
- libncursesw5-dev
- libreadline6-dev
deps:
- libncursesw5
- libreadline6
ubuntu17.10:
builddeps:
- make
- libncursesw5-dev
- libreadline6-dev
deps:
- libncursesw5
- libreadline6
debian9:
builddeps:
- make
- libncursesw5-dev
- libreadline-dev
deps:
- libncursesw5
- readline-common

View File

@ -1,25 +0,0 @@
#!/bin/bash
set -xe
# create the rpm tree
rpmdir=$(mktemp -d)
install -d -m0755 $rpmdir/{BUILD,BUILDROOT,RPMS/$(uname -m),SOURCES,SPECS,SRPMS}
# copy the sources into place
cp redhat/nnn.spec $rpmdir/SPECS/nnn.spec
vers=$(git describe --always | sed 's/^v//' | tr - .)
sed -i -e "s/Version:\s*\(\S\+\)/Version: $vers/" $rpmdir/SPECS/nnn.spec
git archive --prefix=nnn-$vers/ --format=tar.gz -o $rpmdir/SOURCES/nnn-$vers.tar.gz HEAD
# do the build
( cd $rpmdir/SPECS && rpmbuild --define="%_topdir $rpmdir" -ba nnn.spec )
# retreive the artifacts
mkdir -p dist
cp $rpmdir/{SRPMS,RPMS/*}/*.rpm dist/
# clean up
rm -rf $rpmdir
# vim: et:ai:ts=4:sw=4

View File

@ -1,48 +0,0 @@
%global debug_package %{nil}
Name: nnn
Version: 1.0
Release: 1%{?dist}
Summary: The missing terminal file browser for X
Group: Applications/Engineering
License: GPLv3
URL: https://github.com/jarun/nnn
Source0: %{name}-%{version}.tar.gz
BuildRequires: gcc binutils make gzip
BuildRequires: ncurses-devel readline-devel
%description
nnn is a fork of noice, a blazing-fast lightweight terminal file browser with easy keyboard shortcuts for navigation, opening files and running tasks. noice is developed considering terminal based systems. There is no config file and mime associations are hard-coded. However, the incredible user-friendliness and speed make it a perfect utility on modern distros.
nnn can use the default desktop opener at runtime. It also comes with nlay - a customizable bash script to handle media types. It adds new navigation options, enhanced DE integration, a disk usage analyzer mode, comprehensive file details and much more. Add to that a huge performance boost. For a detailed comparison, visit nnn vs. noice.
If you want to edit a file in vim with some soothing music in the background while referring to a spec in your GUI PDF viewer, nnn got it! All from the same terminal session. Follow the instructions in the quickstart section and see how nnn simplifies those long desktop sessions...
%prep
%setup -q
%build
make %{?_smp_mflags}
%install
%{__install} -m755 -d %{buildroot}%{_bindir}
%{__install} -m755 -d %{buildroot}%{_mandir}/man1
%{__install} -m755 nnn %{buildroot}%{_bindir}/nnn
%{__install} -m755 nlay %{buildroot}%{_bindir}/nlay
%{__install} -m644 nnn.1 %{buildroot}%{_mandir}/man1/nnn.1
%files
%{_bindir}/nnn
%{_bindir}/nlay
%{_mandir}/man1/nnn.1.gz
%doc README.md
%doc LICENSE
%doc CHANGELOG
%changelog
* Wed Apr 26 2017 Michael Fenn <michaelfenn87@gmail.com> - 1.0-1
- Initial RPM