Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Initial version of release packaging using COPR/PPA
Browse files Browse the repository at this point in the history
This is based on similar changes made for ponyc. See:
ponylang/ponyc#2726

This commit has the initial version of release packaging using
Fedora COPR and Ubuntu Launchpad PPA services.

The biggest limitation is that for Fedora COPR, the API tokens
expire every 180 days and need to be regenerated and updated
manually. This is annoying but not especially hard to do.

The current implementation only kicks off builds on COPR/PPA
for releases. The current implementation relies on downloading
the "official" snapshot tar.gz from github for the release
that matches the value in the VERSION file:
https://github.com/ponylang/pony-stable/archive/${VERSION}.tar.gz

This is to ensure we're always using the right source code
for a particular release.

In theory, it should be relatively easy/painless to expand
support to be able to do nightly snapshot builds. This url
would be the main thing that needs to change along with
deciding which version number to assign for a nightly
build.

The currently supported architecture is x86_64.

The currently supported distributions are:

* CentOS 7
* Fedora 26
* Fedora 27
* Fedora 28
* Fedora Rawhide
* OpenSuSE Leap 15 (default llvm; not 3.9)
* OpenSuse Tumbleweed (default llvm; not 3.9)
* Ubuntu Trusty (stdlib regex tests are disabled)
* Ubuntu Xenial
* Ubuntu Artful
* Ubuntu Bionic
* Ubuntu Cosmic

Fedora COPR also supports the Mageia distribution along with the
i386/i586/ppc64le architectures. ARM architecture support is in
the works and should become available in the near future.

Future work could include expanding support for additional
architectures, additional distributions, and/or nightly snapshot
builds. The support for additional architectures and additional
distributions would be dependent on similar work being completed
for ponyc first.
  • Loading branch information
dipinhora committed Jun 1, 2018
1 parent 7f65665 commit 0148bda
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 6 deletions.
1 change: 1 addition & 0 deletions .packaging/deb/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
16 changes: 16 additions & 0 deletions .packaging/deb/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Source: pony-stable
Maintainer: Pony Core Team <buildbot@pony.groups.io>
Build-Depends: debhelper (>= 9.0.0), ponyc
Priority: optional
Standards-Version: 3.9.7
Section: devel

Package: pony-stable
Priority: optional
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: pony language dependency manager
Dependency manager for the pony programming language.
https://github.com/ponylang/pony-stable
Pony is an open-source, actor-model, capabilities-secure, high performance programming language
http://www.ponylang.org
43 changes: 43 additions & 0 deletions .packaging/deb/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DH_VERBOSE = 1


# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
DEB_DISTRIBUTION = $(call dpkg_late_eval,DEB_DISTRIBUTION,dpkg-parsechangelog -SDistribution)

MAKE_OPTIONS := prefix=/usr

ifeq ($(DEB_HOST_ARCH),amd64)
MAKE_OPTIONS += arch=x86-64
endif

%:
dh $@

override_dh_auto_build:
env
uname -m
dh_auto_build -- $(MAKE_OPTIONS)

override_dh_auto_install:
dh_auto_install -- $(MAKE_OPTIONS)

override_dh_auto_test:
dh_auto_test -- $(MAKE_OPTIONS)

# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

1 change: 1 addition & 0 deletions .packaging/deb/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
46 changes: 46 additions & 0 deletions .packaging/rpm/pony-stable.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
%global pony_stable_version %(ls %{_sourcedir} | egrep -o '[0-9]+\.[0-9]+\.[0-9]+' || cat ../../VERSION)
%global release_version 1

%ifarch x86_64
%global arch_build_args arch=x86-64
%endif

Name: pony-stable
Version: %{pony_stable_version}
Release: %{release_version}%{?dist}
Packager: Pony Core Team <buildbot@pony.groups.io>
Summary: Dependency manager for the pony programming language.
# For a breakdown of the licensing, see PACKAGE-LICENSING
License: BSD
URL: https://github.com/ponylang/pony-stable
Source0: https://github.com/ponylang/pony-stable/archive/%{version}.tar.gz
BuildRequires: ponyc
BuildRequires: make

%description
Dependency manager for the pony programming language.
https://github.com/ponylang/pony-stable

Pony is an open-source, actor-model, capabilities-secure, high performance programming language
http://www.ponylang.org

%global debug_package %{nil}

%prep
%setup

%build
make %{?arch_build_args} prefix=%{_prefix} %{?_smp_mflags} test

%install
make install %{?arch_build_args} prefix=%{_prefix} DESTDIR=$RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%files
%{_prefix}/bin/stable

%changelog
* Fri Jun 1 2018 Dipin Hora <dipin@wallaroolabs.com> 0.1.2-1
- Initial version of spec file
Binary file added .securefiles.tar.enc
Binary file not shown.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ branches:

sudo: required

# NOTE: This holds fedora COPR API related variables. Unfortunately, the values expire every 180 days.
# As a result, we have to remember to visit https://copr.fedorainfracloud.org/api/ and generate a new token
# and then run the following to update variables and replace the "secure" value.
# travis encrypt COPR_LOGIN=VALUE COPR_TOKEN=VALUE --org -r ponylang/pony-stable
env:
global:
secure: "tJ3Q2y22jftE5nsEJJUx/XzvdsoSM8v2Lsw/4EtpTDGhX751n5NlUwlnCkJaoStfivksBh83WEvIypU3a/BKzror3KV1WpcSdHHJiJ8/eQxHBD9+Gx59yHSTxwDr6XdHA6pCmbtX4KxJiFUKYtvPnync9ZDHmH7e3ocmmmyqVnEM0I+N8M4cRD7Fv0Gsj2DQEWBOj8fRK/EIUoAi/+roay20K251rkD9EycclQmUfh76n7AQwlHXkk86z1pdNvI91JcY8wWx/U7KPeKpVX+HE98CBX6UdYkwMYYMzZj+KtMpXzekuSgRmt7FvQrtc1zo9DkPBjHx0IViMkfGXrJVgBODP4T7XlZxGoIMSx2FReaAh/VBuQrguu4rNYz9NzTejwd730vySKz0ZOv6pvRJr8lNIbmFF82oEDVWRvwFr5Z5Wl/a2pFCVdjnTIXZKhJD3yysWnbVsIMlFW1zTMpT2L7B+bfG0+EsCsSYXCpA3jL+2oJafR9DRMhDV1kIr+hFH0TF58Pe2wadPcLn6lnCIfvctbPknmuYe0nk+B8hcVHSqmkAhZmIUK4I8u7b/cWeOBHnWjwP1CFdVz2eXgf1A4tZP1VOt3VLohpOCzFk64CT7dwah0acuuOWUnGVzkQTpy25khM0fr+v6jL8xkUHgoBvt7g5KG5ifdie1HHxcWw="

matrix:
include:
- os: linux
Expand Down
5 changes: 2 additions & 3 deletions .travis_install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ set -o nounset

install_ponyc(){
echo -e "\033[0;32mInstalling latest ponyc release\033[0m"
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "D401AB61 DBE1D0A2"
echo "deb https://dl.bintray.com/pony-language/ponyc-debian pony-language main" | sudo tee -a /etc/apt/sources.list
sudo add-apt-repository ppa:ponylang/ponylang -y
sudo apt-get update
sudo apt-get -V install ponyc
sudo apt-get -V install ponyc -y
}

install_ponyc
67 changes: 66 additions & 1 deletion .travis_script.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,70 @@
set -o errexit
set -o nounset

build_and_submit_deb_src(){
deb_distro=$1
rm -f debian/changelog
dch --package pony-stable -v "${package_version}-0ppa1~${deb_distro}" -D "${deb_distro}" --controlmaint --create "Release ${package_version}"
debuild -S
dput custom-ppa "../pony-stable_${package_version}-0ppa1~${deb_distro}_source.changes"
}

pony-stable-kickoff-copr-ppa(){
package_version=$(cat VERSION)

echo "Install debuild, dch, dput..."
sudo apt-get install -y devscripts build-essential lintian debhelper python-paramiko

echo "Decrypting and Importing gpg keys..."
# Disable shellcheck error SC2154 for uninitialized variables as these get set by travis-ci for us.
# See the following for error details: https://github.com/koalaman/shellcheck/wiki/SC2154
# shellcheck disable=SC2154
openssl aes-256-cbc -K "$encrypted_8da6a6ec0f12_key" -iv "$encrypted_8da6a6ec0f12_iv" -in .securefiles.tar.enc -out .securefiles.tar -d
tar -xvf .securefiles.tar
gpg --import ponylang-secret-gpg.key
gpg --import-ownertrust ponylang-ownertrust-gpg.txt
mv sshkey ~/sshkey
sudo chmod 600 ~/sshkey

echo "Kicking off pony-stable packaging for PPA..."
wget "https://github.com/ponylang/pony-stable/archive/${package_version}.tar.gz" -O "pony-stable_${package_version}.orig.tar.gz"
tar -xvzf "pony-stable_${package_version}.orig.tar.gz"
pushd "pony-stable-${package_version}"
cp -r .packaging/deb debian
cp LICENSE debian/copyright

# ssh stuff for launchpad as a workaround for https://github.com/travis-ci/travis-ci/issues/9391
{
echo "[custom-ppa]"
echo "fqdn = ppa.launchpad.net"
echo "method = sftp"
echo "incoming = ~ponylang/ubuntu/ponylang/"
echo "login = ponylang"
echo "allow_unsigned_uploads = 0"
} >> ~/.dput.cf

mkdir -p ~/.ssh
{
echo "Host ppa.launchpad.net"
echo " StrictHostKeyChecking no"
echo " IdentityFile ~/sshkey"
} >> ~/.ssh/config
sudo chmod 400 ~/.ssh/config

build_and_submit_deb_src xenial
build_and_submit_deb_src artful
build_and_submit_deb_src bionic
build_and_submit_deb_src cosmic
build_and_submit_deb_src trusty

# COPR for fedora/centos/suse
echo "Kicking off pony-stable packaging for COPR..."
docker run -it --rm -e COPR_LOGIN="${COPR_LOGIN}" -e COPR_USERNAME=ponylang -e COPR_TOKEN="${COPR_TOKEN}" -e COPR_COPR_URL=https://copr.fedorainfracloud.org mgruener/copr-cli buildscm --clone-url https://github.com/ponylang/pony-stable --commit "${package_version}" --subdir /.packaging/rpm/ --spec pony-stable.spec --type git --nowait ponylang

# restore original working directory
popd
}

pony-stable-build-packages(){
echo "Installing ruby, rpm, and fpm..."
rvm use 2.2.3 --default
Expand All @@ -14,11 +78,12 @@ pony-stable-build-packages(){
# used to disambiguate packages with the same version).
PACKAGE_ITERATION="${TRAVIS_BUILD_NUMBER}.$(git rev-parse --short --verify 'HEAD^{commit}')"

echo "Building ponyc packages for deployment..."
echo "Building pony-stable packages for deployment..."
make arch=x86-64 package_name="pony-stable" package_base_version="$(cat VERSION)" package_iteration="${PACKAGE_ITERATION}" deploy
}

if [[ "$TRAVIS_BRANCH" == "release" && "$TRAVIS_PULL_REQUEST" == "false" ]]
then
pony-stable-kickoff-copr-ppa
pony-stable-build-packages
fi
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ $(binary): $(GEN_FILES) $(SOURCE_FILES) | $(BUILD_DIR)
${PONYC} $(arch_arg) $(SRC_DIR) -o ${BUILD_DIR}

install: $(binary)
mkdir -p $(prefix)/bin
cp $^ $(prefix)/bin
mkdir -p $(DESTDIR)$(prefix)/bin
cp $^ $(DESTDIR)$(prefix)/bin

test: $(binary)

Expand Down

0 comments on commit 0148bda

Please sign in to comment.