From 59f809a2c74294922d37657426a5eaf3f7694dcd Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 18 Jan 2020 14:53:14 +0000 Subject: [PATCH] maintainer: Build Fedora package in copr. --- .gitignore | 2 ++ Goalfile.in | 33 +++++++++++++++++++++++++++------ Makefile.in | 5 +++-- configure.ac | 1 + goals.spec.in | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 goals.spec.in diff --git a/.gitignore b/.gitignore index 1a724bb..dcf5b7a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,8 @@ Makefile /config.h.in /config.log /config.status +/goals.spec +/goals-*.src.rpm /install-sh /run /src/config.ml diff --git a/Goalfile.in b/Goalfile.in index e8d6018..361dd07 100644 --- a/Goalfile.in +++ b/Goalfile.in @@ -176,10 +176,10 @@ goal install = { # exec_prefix die die die bindir="@prefix@/bin" datadir="@prefix@/share" - mkdir -p %DESTDIR/"$bindir" - mkdir -p %DESTDIR/"$datadir/goals" - install src/goals %DESTDIR/"$bindir" -m 0755 - install %stdlibfiles %DESTDIR/"$datadir"/goals -m 644 + mkdir -p %DESTDIR"$bindir" + mkdir -p %DESTDIR"$datadir/goals" + install src/goals %DESTDIR"$bindir" -m 0755 + install %stdlibfiles %DESTDIR"$datadir"/goals -m 644 } #---------------------------------------------------------------------- @@ -223,6 +223,7 @@ let distfiles = [ "configure", "configure.ac", wildcard ("docs/*.pod"), + "goals.spec.in", "install-sh", "m4/ocaml.m4", "run.in", @@ -290,12 +291,14 @@ goal maintainer-check-extra-dist = : dist @{ goal maintainer-release = : dist, maintainer-check-extra-dist, distcheck, - maintainer-upload + maintainer-upload, + maintainer-srpm, + maintainer-fedora-copr let websitedir = "%HOME/d/websites/people.redhat.com/goals" # XXX Should actually use the *url tactic here. -goal maintainer-upload = { +goal maintainer-upload = : distcheck { [ -d %websitedir ] cp %tarfile %websitedir/files cp README %websitedir/README @@ -306,3 +309,21 @@ goal maintainer-upload = { cd .. ./.rsync } + +pure function get-fedora-dist () returning string = @{ + rpm --eval '%%dist' +} +let fedora-dist = get-fedora-dist () +let srpm = "goals-@PACKAGE_VERSION@%fedora-dist.src.rpm" + +goal maintainer-srpm = +"%srpm" : tarfile, "goals.spec" { + rpmbuild -bs \ + --define "%%_sourcedir $PWD" \ + --define "%%_srcrpmdir $PWD" \ + goals.spec +} + +goal maintainer-fedora-copr = : maintainer-upload, srpm { + copr build rjones/goals %srpm +} \ No newline at end of file diff --git a/Makefile.in b/Makefile.in index 7b110fc..eeded2e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -19,8 +19,9 @@ # Pass through normal targets to Goalfile.in all clean depend install check maintainer-clean dist distcheck \ -maintainer-check-extra-dist maintainer-release: src/goals - @./run src/goals $@ +maintainer-check-extra-dist maintainer-release \ +maintainer-srpm maintainer-fedora-copr: src/goals + @./run src/goals $@ 'DESTDIR="$(DESTDIR)"' # If src/goals doesn't exist then brute-force build it. Once we have # src/goals we can rebuild it and other parts of the project using diff --git a/configure.ac b/configure.ac index 380a734..b9b89bc 100644 --- a/configure.ac +++ b/configure.ac @@ -70,6 +70,7 @@ AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) AC_CONFIG_FILES([run], [chmod +x,-w run]) AC_CONFIG_FILES([Goalfile Makefile + goals.spec src/config.ml]) AC_OUTPUT diff --git a/goals.spec.in b/goals.spec.in new file mode 100644 index 0000000..d77af16 --- /dev/null +++ b/goals.spec.in @@ -0,0 +1,56 @@ +Name: @PACKAGE_NAME@ +Version: @PACKAGE_VERSION@ +Release: 1%{?dist} +Summary: An experimental tool that generalizes "make" + +License: GPLv2+ +URL: https://people.redhat.com/~rjones/goals/ + +Source0: https://people.redhat.com/~rjones/goals/files/%{name}-%{version}.tar.gz + +BuildRequires: ocaml +BuildRequires: ocaml-findlib +BuildRequires: ocaml-menhir +BuildRequires: perl-podlators + + +%description +Make is a clever tool for expressing dependencies between files and it +is widely used for building software. But it has some limitations. +It only knows about files. It has limited ways to write rules. And +for a tool whose main job is running shell commands, there are several +gotchas when you actually write shell commands. + +Goals is an experimental tool which aims to generalize make beyond +these limitations. + + +%prep +%autosetup -p1 + + +%build +%configure +make %{?_smp_mflags} + + +%install +%make_install + + +%check +make %{?_smp_mflags} check + + +%files +%doc README TODO +%license COPYING +%{_bindir}/goals +%dir %{_datadir}/goals +%{_datadir}/goals/*.gl +%{_datadir}/goals/*.sh + + +%changelog +* Sat Jan 18 2020 Richard W.M. Jones - %{version}-1 +- Version %{version}. -- 1.8.3.1