Skip to content

Commit

Permalink
feat: cleanup + taskfile for local building
Browse files Browse the repository at this point in the history
  • Loading branch information
tulilirockz committed May 12, 2024
1 parent ca5bdea commit e791271
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 170 deletions.
13 changes: 0 additions & 13 deletions .gitattributes

This file was deleted.

11 changes: 0 additions & 11 deletions .github/dependabot.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/semantic.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/apk-package.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/flake-check.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/issue_management.yml

This file was deleted.

35 changes: 0 additions & 35 deletions Earthfile

This file was deleted.

15 changes: 15 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"

tasks:
build:rpm:
desc: Generate RPM specs, definitions and files from the Studio-CLI containerfile.
generates:
- output/*
cmds:
- mkdir -p {{.OUT}}
- "{{.CONTAINER_MANAGER}} build -v $(realpath {{.OUT}}):/output:Z -f {{.TARGET}} . {{.CLI_ARGS}}"
vars:
CONTAINER_MANAGER: podman
TARGET: rpm.Containerfile
OUT: output
build:
4 changes: 2 additions & 2 deletions rpkg.macros
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function studio-cli_version {
function git_ref {
if [ "$GITHUB_REF_NAME" = "" ]; then
echo "0.1.0+$(git rev-parse --short HEAD)"
echo "$(git rev-parse --short HEAD)"
else
echo "$GITHUB_REF_NAME"
fi
Expand Down
37 changes: 11 additions & 26 deletions rpm.Containerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-latest}"

FROM registry.fedoraproject.org/fedora:${FEDORA_MAJOR_VERSION} AS builder

ENV OUTPUT_ROOT=/app/output

WORKDIR /app
ARG REGISTRY=registry.fedoraproject.org/fedora
FROM ${REGISTRY}:${FEDORA_MAJOR_VERSION} AS builder

ADD . /app

RUN dnf install \
--disablerepo='*' \
--enablerepo='fedora,updates' \
--setopt install_weak_deps=0 \
--nodocs \
--assumeyes \
'dnf-command(builddep)' \
rpkg \
rpm-build && \
mkdir -p $OUTPUT_ROOT/{,output,atomic-studio/rpms} && \
rpkg spec --outdir "$OUTPUT_ROOT" && \
dnf builddep -y output/studio-cli.spec && \
rpkg local --outdir "$OUTPUT_ROOT/output" && \
mv ${OUTPUT_ROOT}/output/noarch/* "${OUTPUT_ROOT}/atomic-studio/rpms"

FROM scratch

ENV OUTPUT_ROOT=/app/output
COPY --from=builder ${OUTPUT_ROOT}/atomic-studio/rpms /rpms
WORKDIR /app
VOLUME ["/output"]

RUN dnf install --disablerepo='*' --enablerepo='fedora,updates' --setopt install_weak_deps=0 --nodocs --assumeyes 'dnf-command(builddep)' rpkg rpm-build

RUN mkdir -p /output/{,atomic-studio/rpms} && \
rpkg spec --outdir /output && \
dnf builddep -y /output/studio-cli.spec && \
rpkg local --outdir /output
14 changes: 5 additions & 9 deletions studio-cli.spec
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
Name: studio-cli
Vendor: atomic-studio-org
Version: {{{ studio-cli_version }}}
Version: 0.1.0+{{{ git_ref }}}
Release: 0%{?dist}
Summary: Manager for Atomic Studio
License: Apache-2.0
License: 3.0-BSD
URL: https://github.com/%{vendor}/%{name}
# Detailed information about the source Git repository and the source commit
# for the created rpm package
VCS: {{{ git_dir_vcs }}}

# git_dir_pack macro places the repository content (the source files) into a tarball
# and returns its filename. The tarball will be used to build the rpm.
Source: {{{ git_dir_pack }}}

BuildArch: noarch
Supplements: podman
Supplements: podman docker
Requires: nu

%description
Expand All @@ -30,7 +25,8 @@ Manages Atomic Studio installations

%install
mkdir -p %{buildroot}%{_libexecdir}/studio-cli %{buildroot}/%{_bindir}
sed -i 's~\.\/libexec~\/usr\/libexec/~' src/%{pname}
sed -i 's~\.\/libexec~\/usr\/libexec/%{name}~' src/%{pname}
cat src/%{pname}
install -D -m 0755 src/%{pname} %{buildroot}%{_bindir}/%{pname}
cp -r src/libexec/* %{buildroot}%{_libexecdir}/%{name}

Expand Down

0 comments on commit e791271

Please sign in to comment.