mirror of
https://github.com/cockpit-project/cockpit.git
synced 2026-11-03 21:49:50 -09:00
tools: Declare bundled NPM dependencies in spec file
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2180520 We need to get a bit creative for packit: It needs the spec as first thing, so build it manually. Share the code in a separate tools/fix-spec for that. Drop the obsolete hack for https://github.com/packit/packit/issues/1560 as that was fixed in packit a while ago.
This commit is contained in:
parent
4cccda9c59
commit
940cc5cd1d
4 changed files with 27 additions and 9 deletions
|
|
@ -26,7 +26,8 @@ $(srcdir)/package-lock.json: FORCE
|
|||
EXTRA_DIST = README.md
|
||||
CLEANFILES += cockpit-*.tar.xz
|
||||
|
||||
# We override distdir as we want to dist some git-tracked files and dist/ without explicitly listing
|
||||
# We override distdir as we want to dist some git-tracked files and dist/ without explicitly listing.
|
||||
# The spec also gets patched to declare bundled NPM dependencies.
|
||||
EXTRA_DIST += $(EXTRA_FILES)
|
||||
distdir: $(DISTFILES)
|
||||
@if [ -e '$(srcdir)/.git' ]; then \
|
||||
|
|
@ -34,7 +35,7 @@ distdir: $(DISTFILES)
|
|||
mv .extra_dist.tmp '$(srcdir)/.extra_dist'; fi
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am EXTRA_FILES="$$(tr '\n' ' ' < $(srcdir)/.extra_dist) .extra_dist"
|
||||
sed -i "s/[@]VERSION@/$(VERSION)/" "$(distdir)/src/client/org.cockpit_project.CockpitClient.metainfo.xml"
|
||||
sed -i "/^Version:/ s/0/$(VERSION)/" "$(distdir)/tools/cockpit.spec"
|
||||
$(srcdir)/tools/fix-spec $(distdir)/tools/cockpit.spec $(VERSION)
|
||||
sed -i "/^pkgver=/ s/0/$(VERSION)/" "$(distdir)/tools/arch/PKGBUILD"
|
||||
sed -i "1 s/0/$(VERSION)/" "$(distdir)/tools/debian/changelog"
|
||||
cp -r "$(srcdir)/dist" "$(distdir)"
|
||||
|
|
|
|||
12
packit.yaml
12
packit.yaml
|
|
@ -1,10 +1,12 @@
|
|||
upstream_project_url: https://github.com/cockpit-project/cockpit
|
||||
# HACK: spec must be next to the generated tarball; https://github.com/packit/packit/issues/1621
|
||||
specfile_path: cockpit.spec
|
||||
actions:
|
||||
post-upstream-clone:
|
||||
# HACK: spec must be next to the generated tarball; https://github.com/packit/packit/issues/1621
|
||||
# build patched spec
|
||||
- tools/node-modules make_package_lock_json
|
||||
- cp tools/cockpit.spec .
|
||||
# packit will compute and set the version by itself
|
||||
- tools/fix-spec ./cockpit.spec 0
|
||||
|
||||
create-archive:
|
||||
- tools/make-dist
|
||||
|
|
@ -16,6 +18,7 @@ srpm_build_deps:
|
|||
- glib2-devel
|
||||
- make
|
||||
- nodejs
|
||||
- npm
|
||||
- systemd-devel
|
||||
# use the nicely formatted release NEWS from our upstream release, instead of git shortlog
|
||||
copy_upstream_release_description: true
|
||||
|
|
@ -46,11 +49,6 @@ jobs:
|
|||
project: "cockpit-preview"
|
||||
preserve_project: True
|
||||
actions:
|
||||
post-upstream-clone:
|
||||
# HACK: spec must be next to the generated tarball; https://github.com/packit/packit/issues/1621
|
||||
- cp tools/cockpit.spec .
|
||||
# HACK: https://github.com/packit/packit/issues/1560
|
||||
- tools/node-modules checkout
|
||||
# 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:
|
||||
|
|
|
|||
|
|
@ -392,6 +392,8 @@ Provides: cockpit-sosreport = %{version}-%{release}
|
|||
Recommends: (reportd if abrt)
|
||||
%endif
|
||||
|
||||
#NPM_PROVIDES
|
||||
|
||||
%description system
|
||||
This package contains the Cockpit shell and system configuration interfaces.
|
||||
|
||||
|
|
|
|||
17
tools/fix-spec
Executable file
17
tools/fix-spec
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
# patch given spec file to have the correct version and declare bundled NPM dependencies
|
||||
# Usage: fix-spec <spec-file> <version>
|
||||
set -eu
|
||||
|
||||
spec="$1"
|
||||
version="$2"
|
||||
|
||||
PROVIDES=$(npm ls --omit dev --package-lock-only --depth=Infinity |
|
||||
grep -Eo '[^[:space:]]+@[^[:space:]]+' |
|
||||
sort -u |
|
||||
# only replace the *last* occurrence of @, not e.g. the one in @patternfly/..
|
||||
sed 's/^/Provides: bundled(npm(/; s/\(.*\)@/\1)) = /')
|
||||
|
||||
|
||||
awk -v p="$PROVIDES" '/Version/ { gsub(/0/, "'$version'") }; gsub(/#NPM_PROVIDES/, p) 1' "$spec" > "$spec".new
|
||||
mv "$spec".new "$spec"
|
||||
Loading…
Reference in a new issue