Skip to content

Commit

Permalink
Keep .spec in git
Browse files Browse the repository at this point in the history
Give up on .spec.in and directly keep the .spec in git. This aligns a
lot better with what packit wants to do, and avoids having explicit
`post-upstream-clone:` actions.

We still want to build tarballs with a correct .spec (for using with
`rpmbuild -bb` and VM image preparation), so make sure that they get the
patched file.
  • Loading branch information
martinpitt committed Jun 14, 2022
1 parent 46b2487 commit 1d09d80
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ endif
export TEST_OS
TARFILE=cockpit-$(PACKAGE_NAME)-$(VERSION).tar.xz
NODE_CACHE=cockpit-$(PACKAGE_NAME)-node-$(VERSION).tar.xz
SPEC=$(RPM_NAME).spec
APPSTREAMFILE=org.cockpit-project.$(PACKAGE_NAME).metainfo.xml
VM_IMAGE=$(CURDIR)/test/images/$(TEST_OS)
# one example file in dist/ from webpack to check if that already ran
Expand Down Expand Up @@ -75,8 +74,8 @@ po/LINGUAS:
# Build/Install/dist
#

%.spec: packaging/%.spec.in
sed -e 's/%{VERSION}/$(VERSION)/g' $< > $@
%.spec: packaging/%.spec
sed -e '/^Version:/ s/0/$(VERSION)/g' $< > $@

packaging/arch/PKGBUILD: packaging/arch/PKGBUILD.in
sed 's/VERSION/$(VERSION)/; s/SOURCE/$(TARFILE)/' $< > $@
Expand All @@ -92,7 +91,7 @@ watch:

clean:
rm -rf dist/
rm -f $(SPEC) packaging/arch/PKGBUILD packaging/debian/changelog
rm -f packaging/arch/PKGBUILD packaging/debian/changelog
rm -f po/LINGUAS

install: $(WEBPACK_TEST) po/LINGUAS
Expand All @@ -116,13 +115,16 @@ dist: $(TARFILE)
# pre-built dist/ (so it's not necessary) and ship packge-lock.json (so that
# node_modules/ can be reconstructed if necessary)
$(TARFILE): export NODE_ENV=production
$(TARFILE): $(WEBPACK_TEST) $(SPEC) packaging/arch/PKGBUILD packaging/debian/changelog
$(TARFILE): $(WEBPACK_TEST) packaging/arch/PKGBUILD packaging/debian/changelog
sed -e '/^Version:/ s/0/$(VERSION)/g' packaging/cockpit-podman.spec > cockpit-podman.spec
tar --xz -cf $(TARFILE) --transform 's,^,cockpit-$(PACKAGE_NAME)/,' \
--exclude '*.in' --exclude test/reference --exclude node_modules \
$$(git ls-files) $(COCKPIT_REPO_FILES) package-lock.json $(SPEC) packaging/arch/PKGBUILD packaging/debian/changelog dist/
--transform 's,cockpit-podman.spec,packaging/cockpit-podman.spec,' \
--exclude '*.in' --exclude test/reference --exclude node_modules --exclude packaging/cockpit-podman.spec \
$$(git ls-files) $(COCKPIT_REPO_FILES) package-lock.json cockpit-podman.spec packaging/arch/PKGBUILD packaging/debian/changelog dist/
rm cockpit-podman.spec

# convenience target for developers
rpm: $(TARFILE) $(SPEC)
rpm: $(TARFILE)
mkdir -p "`pwd`/output"
mkdir -p "`pwd`/rpmbuild"
rpmbuild -bb \
Expand All @@ -132,7 +134,7 @@ rpm: $(TARFILE) $(SPEC)
--define "_srcrpmdir `pwd`" \
--define "_rpmdir `pwd`/output" \
--define "_buildrootdir `pwd`/build" \
$(SPEC)
packaging/cockpit-podman.spec
find `pwd`/output -name '*.rpm' -printf '%f\n' -exec mv {} . \;
rm -r "`pwd`/rpmbuild"
rm -r "`pwd`/output" "`pwd`/build"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: cockpit-podman
Version: %{VERSION}
Version: 0
Release: 1%{?dist}
Summary: Cockpit component for Podman containers
License: LGPLv2+
Expand Down
3 changes: 0 additions & 3 deletions packit.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
upstream_project_url: https://github.com/cockpit-project/cockpit-podman
# enable notification of failed downstream jobs as issues
issue_repository: https://github.com/cockpit-project/cockpit-podman
specfile_path: cockpit-podman.spec
upstream_package_name: cockpit-podman
downstream_package_name: cockpit-podman
# use the nicely formatted release description from our upstream release, instead of git shortlog
copy_upstream_release_description: true

actions:
post-upstream-clone: make cockpit-podman.spec
create-archive: make dist

srpm_build_deps:
Expand Down Expand Up @@ -38,7 +36,6 @@ jobs:
- centos-stream-8-x86_64
- centos-stream-9-x86_64
actions:
post-upstream-clone: make cockpit-podman.spec
# HACK: tarball for releases (copr_build, koji, etc.), copying spec's Source0; this
# really should be the default, see https://github.com/packit/packit-service/issues/1505
create-archive:
Expand Down

0 comments on commit 1d09d80

Please sign in to comment.