Skip to content

Commit

Permalink
Merge pull request #2261 from mmcgr/repo
Browse files Browse the repository at this point in the history
Add release debs/rpms to souffle-lang.github.io/ppa
  • Loading branch information
b-scholz committed Apr 14, 2022
2 parents 3eb8e19 + 7a15b74 commit 8fbd7c6
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 21 deletions.
1 change: 1 addition & 0 deletions .github/images/arch-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM archlinux:latest
RUN pacman -Syu --noconfirm

RUN pacman -Sy --noconfirm \
python \
git \
base-devel \
cmake \
Expand Down
2 changes: 1 addition & 1 deletion .github/images/arch-linux/PKGBUILD.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ makedepends=('git' 'cmake>=3.15' 'bison>=3.0.4' 'flex' 'libffi' 'ncurses' 'zlib'
optdepends=('bash-completion')
provides=('souffle')
conflicts=('souffle-git')
source=(souffle-${RELEASE_TAG}.tar.gz::https://github.com/souffle-lang/souffle/archive/${RELEASE_TAG}.tar.gz)
source=(souffle-${RELEASE_TAG}.tar.gz::https://github.com/${REPO_OWNER}/souffle/archive/${RELEASE_TAG}.tar.gz)
md5sums=('SKIP')

build() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM centos:8
FROM oraclelinux:8

WORKDIR /souffle

# https://pagure.io/epel/issue/89
RUN yum -y install dnf-plugins-core
RUN dnf config-manager --set-enabled powertools
RUN dnf config-manager --set-enabled ol8_codeready_builder
# Install souffle build dependencies
RUN dnf -y install \
autoconf \
Expand Down
11 changes: 11 additions & 0 deletions .github/scripts/apt-ftparchive.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
APT::FTPArchive::Release {
Origin "Souffle Repository";
Label "Souffle";
Suite "stable";
Codename "stable";
Version "1.0";
Architectures "amd64 arm64";
Components "main";
Description "Translator of declarative Datalog programs into the C++ language."
};

13 changes: 13 additions & 0 deletions .github/scripts/config_gpg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

if [ "$GPG_SIGNING_KEY" = "" ]; then
echo "ERROR: No GPG_SIGNING_KEY defined"
exit 200
fi

mkdir -p ~/.gnupg/
echo "${GPG_SIGNING_KEY}" > ~/.gnupg/private.key
gpg --import ~/.gnupg/private.key

git config --global user.email "36495947+souffle-lang-bot@users.noreply.github.com"
git config --global user.name "souffle-lang-bot"
81 changes: 81 additions & 0 deletions .github/scripts/updatePPA.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/sh

BASEDIR=$(pwd)

DEBPATH=$BASEDIR/downloads

# Get current tag
SOUFFLE_TAG=$(git describe --tags)

# Create a temp directory to work out of
TMPDIR=$(mktemp -d)
cd $TMPDIR

# clone the ppa repo and move into it
git clone "https://x-access-token:$API_TOKEN_GITHUB@github.com/$GITHUB_REPOSITORY_OWNER/ppa"

#DEB files
cd ppa/ubuntu/
PPADIR=$(pwd)

mkdir -p pool/stable
cp $DEBPATH/*/*deb pool/stable/


STABLEDIST=${PPADIR}/dists/stable/

mkdir -p $STABLEDIST/main/binary-amd64

# Make package file for all packages
apt-ftparchive packages -c $BASEDIR/.github/scripts/apt-ftparchive.conf pool/ | tee dists/stable/main/binary-amd64/Packages | gzip > dists/stable/main/binary-amd64/Packages.gz
# Make Release file
apt-ftparchive release -c $BASEDIR/.github/scripts/apt-ftparchive.conf dists/stable/ > dists/stable/Release

gpg -u A319AEAB83D9859296F41980194B22AF03FAC2DD -abs > ${STABLEDIST}Release.gpg < ${STABLEDIST}Release
gpg -u A319AEAB83D9859296F41980194B22AF03FAC2DD -abs --clearsign > ${STABLEDIST}InRelease < ${STABLEDIST}Release

git add pool dists
git commit -m "Added deb files for $SOUFFLE_TAG"

#RPM files
## install repo handlers
sudo apt-get update
sudo apt-get install createrepo rpm

## Set up rpm signing with gpg
echo "%_gpg_name Bot\n%__gpg_sign_cmd %{__gpg} gpg --force-v3-sigs --batch --verbose --no-armor --no-secmem-warning -u \"%{_gpg_name}\" -sbo %{__signature_filename} --digest-algo sha256 %{__plaintext_filename}'" > ~/.rpmmacros

## Fedora
mkdir -p $TMPDIR/ppa/fedora/34/x86_64
cd $TMPDIR/ppa/fedora

for i in $DEBPATH/*fedora-34*/*rpm
do
rpm --addsign $i
done

cp $DEBPATH/*fedora-34*/*rpm 34/x86_64/

createrepo 34/x86_64

git add .
git commit -m "Added fedora rpm files for $SOUFFLE_TAG"

## oraclelinux
mkdir -p $TMPDIR/ppa/ol/8/x86_64
cd $TMPDIR/ppa/ol

for i in $DEBPATH/*oracle*8*/*rpm
do
rpm --addsign $i
done

cp $DEBPATH/*oracle*8*/*rpm 8/x86_64/

createrepo 8/x86_64

git add .
git commit -m "Added oraclelinux rpm files for $SOUFFLE_TAG"


git push
46 changes: 33 additions & 13 deletions .github/workflows/create-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ jobs:
- release: ubuntu-2004
extension: ".deb"
OS-name: "ubuntu/focal"
- release: ubuntu-2104
extension: ".deb"
OS-name: "ubuntu/hirsute"
- release: centos-8
- release: oraclelinux-8
extension: ".rpm"
OS-name: "el/8"
- release: fedora-34
Expand All @@ -33,9 +30,6 @@ jobs:
with:
fetch-depth: 0

- name: Packagecloud CLI
run: sudo apt-get -y install ruby-full && sudo gem install package_cloud

- name: Build Container
run: docker build . -f ./.github/images/${{ matrix.release }}/Dockerfile -t package_builder

Expand All @@ -59,11 +53,6 @@ jobs:
name: ${{ steps.extract_pkg.outputs.artifact_name }}
path: build/${{ steps.extract_pkg.outputs.artifact_name }}

- name: Packaging
run: |-
cd build &&
PACKAGECLOUD_TOKEN=${{ secrets.PACKAGECLOUD_TOKEN }} package_cloud push souffle-lang/souffle/${{ matrix.OS-name }} ${{ steps.extract_pkg.outputs.pkg_name }}
Arch-Package-Build:
runs-on: ubuntu-latest
steps:
Expand All @@ -83,7 +72,8 @@ jobs:
- name: Packaging
run: >
docker run
-e RELEASE_TAG=${{ steps.prepare.outputs.release_tag }}
-e RELEASE_TAG=${{ steps.prepare.outputs.release_tag }}
-e REPO_OWNER=${{ github.repository_owner }}
--name container
-t package_builder
Expand Down Expand Up @@ -114,6 +104,7 @@ jobs:
Upload-Release-Assests:
needs: CPack-Package-Build
if: ${{ always() }}

runs-on: ubuntu-latest
steps:
Expand All @@ -134,3 +125,32 @@ jobs:
with:
files: |
result/*
Upload-Repo-Files:
needs: CPack-Package-Build
if: ${{ always() }}

runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
clean: false

- name: Download All Artifacts
uses: actions/download-artifact@v2
with:
path: ./downloads

- name: Configure GPG Key
run: |-
.github/scripts/config_gpg.sh
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}

- name: Upload Repo Files
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
run : |-
.github/scripts/updatePPA.sh
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/debian/changelog" "$
# CPack configuration
# --------------------------------------------------
if (CHECK_OS_RESULT EQUAL 0)
if (CHECK_OS_OUTPUT MATCHES "UBUNTU")
# Generate just DEB
if (CHECK_OS_OUTPUT MATCHES "DEBIAN")
# Generate DEB packages
SET(CPACK_GENERATOR "DEB")
# --------------------------------------------------
# Variables relevent to DEB packages
Expand All @@ -425,12 +425,13 @@ if (CHECK_OS_RESULT EQUAL 0)
INCLUDE(CPack)
endif()

if (CHECK_OS_OUTPUT MATCHES "FEDORA" OR CHECK_OS_OUTPUT MATCHES "CENTOS")
if (CHECK_OS_OUTPUT MATCHES "FEDORA")
SET(CPACK_RPM_PACKAGE_GROUP "Unspecified")
SET(CPACK_RPM_PACKAGE_LICENSE "UPL-1.0 License")
SET(CPACK_RPM_PACKAGE_VENDOR "Souffle-lang")
SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")

# Generate both DEB and RPM packages
# Generate RPM packages
SET(CPACK_GENERATOR "RPM")

# --------------------------------------------------
Expand Down
9 changes: 8 additions & 1 deletion sh/check_os.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ else
exit 1
fi

grep -G "^ID=" $file | tr a-z A-Z
ID=$(grep -G "^ID_LIKE=" $file | tr a-z A-Z)

#Fedora is special and has no ID_LIKE
if [ -z $ID ]; then
ID=$(grep -G "^ID=" $file | tr a-z A-Z)
fi

echo $ID

0 comments on commit 8fbd7c6

Please sign in to comment.