mirror of
https://github.com/gwebu-team/profile.d.git
synced 2025-12-07 11:55:48 +00:00
General rework of the build process (distribution source and rpm).
This commit is contained in:
parent
e68638230a
commit
5b8a75b75c
6 changed files with 55 additions and 21 deletions
7
.gitattributes
vendored
Normal file
7
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
.gitattributes export-ignore
|
||||||
|
.github export-ignore
|
||||||
|
.gitignore export-ignore
|
||||||
|
.pre-commit-config.yaml export-ignore
|
||||||
|
changelog.sh export-ignore
|
||||||
|
gwebu-profile.spec.in export-ignore
|
||||||
|
Makefile export-ignore
|
||||||
12
.github/workflows/makefile.yml
vendored
12
.github/workflows/makefile.yml
vendored
|
|
@ -26,18 +26,6 @@ jobs:
|
||||||
- name: Setup RPM build environment
|
- name: Setup RPM build environment
|
||||||
run: rpmdev-setuptree
|
run: rpmdev-setuptree
|
||||||
|
|
||||||
- name: List all files here
|
|
||||||
run: ls -al
|
|
||||||
|
|
||||||
- name: Show GITHUB_WORKSPACE
|
|
||||||
run: echo "$GITHUB_WORKSPACE"
|
|
||||||
|
|
||||||
- name: List GITHUB_WORKSPACE
|
|
||||||
run: ls -al "$GITHUB_WORKSPACE"
|
|
||||||
|
|
||||||
- name: List all files here
|
|
||||||
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
||||||
|
|
||||||
- name: Show the Makefile help screen
|
- name: Show the Makefile help screen
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
|
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
||||||
/dist
|
|
||||||
/.idea
|
/.idea
|
||||||
|
/dist
|
||||||
|
/gwebu-profile.spec
|
||||||
|
|
|
||||||
24
Makefile
24
Makefile
|
|
@ -1,5 +1,8 @@
|
||||||
SHELL:=/bin/bash # Use bash syntax, mitigates dash's printf on Debian
|
SHELL:=/bin/bash # Use bash syntax, mitigates dash's printf on Debian
|
||||||
ver:=$(shell git describe --tags --always --match='v[0-9]*.[0-9]*' | cut -c 2- | cut -d - -f 1)
|
ver:=$(shell git describe --dirty --long --match='v[0-9]*.[0-9]*' | cut -c 2- | cut -d - -f 1,2,4)
|
||||||
|
rpm_ver:=$(firstword $(subst -, ,$(ver)))
|
||||||
|
rpm_rev:=$(subst $(rpm_ver)-,,$(ver))
|
||||||
|
rpm_rev:=$(subst -,_,$(rpm_rev))
|
||||||
|
|
||||||
|
|
||||||
help:
|
help:
|
||||||
|
|
@ -10,17 +13,25 @@ help:
|
||||||
@echo "Available targets:"
|
@echo "Available targets:"
|
||||||
@echo " dist: create source distribution package in dist/"
|
@echo " dist: create source distribution package in dist/"
|
||||||
@echo " rpm: create an RPM package"
|
@echo " rpm: create an RPM package"
|
||||||
|
@echo " changelog: Add a changelog entry to gwebu-profile.spec.in"
|
||||||
@echo
|
@echo
|
||||||
@echo " clean: clean all generated files"
|
@echo " clean: clean all generated files"
|
||||||
@echo
|
@echo
|
||||||
@echo "Version $(ver)."
|
@echo "Version $(ver), rpm_ver=$(rpm_ver), rpm_rev=$(rpm_rev)."
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
|
|
||||||
|
|
||||||
.PHONY: dist
|
.PHONY: dist
|
||||||
dist:
|
dist: dist/profile.d-$(ver).tar.xz
|
||||||
|
|
||||||
|
|
||||||
|
dist/profile.d-$(ver).tar.xz:
|
||||||
test -d dist || mkdir dist
|
test -d dist || mkdir dist
|
||||||
git archive --prefix="profile.d-$(ver)/" HEAD | xz -9v > "dist/profile.d-$(ver).tar.xz"
|
sed 's/^Version: .*/Version: $(rpm_ver)/' < gwebu-profile.spec.in \
|
||||||
|
| sed 's/^Release: .*/Release: $(rpm_rev)/' \
|
||||||
|
> gwebu-profile.spec
|
||||||
|
git archive --prefix="profile.d-$(ver)/" --add-file=gwebu-profile.spec HEAD | xz -9 > "$@"
|
||||||
|
rm gwebu-profile.spec
|
||||||
|
|
||||||
|
|
||||||
.PHONY: rpm
|
.PHONY: rpm
|
||||||
|
|
@ -28,6 +39,11 @@ rpm: dist
|
||||||
rpmbuild -ta "dist/profile.d-$(ver).tar.xz"
|
rpmbuild -ta "dist/profile.d-$(ver).tar.xz"
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: changelog
|
||||||
|
changelog:
|
||||||
|
./changelog.sh
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
|
|
|
||||||
13
changelog.sh
Executable file
13
changelog.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ver=$(git describe --dirty --long --match='v[0-9]*.[0-9]*' | cut -c 2- | cut -d - -f 1,2,4)
|
||||||
|
rpm_ver="${ver%%-*}"
|
||||||
|
rpm_rev="${ver#*-}"
|
||||||
|
rpm_numeric_rev="${rpm_rev%%-*}"
|
||||||
|
|
||||||
|
change="* $(date +'%a %b %d %Y') $(git log -1 --format='%aN <%aE>') - ${rpm_ver}-${rpm_numeric_rev}
|
||||||
|
- $(git log -1 --format=%s)
|
||||||
|
"
|
||||||
|
|
||||||
|
awk -v change="${change}" '/^%changelog/ {print; print change; next} 1' gwebu-profile.spec.in \
|
||||||
|
> gwebu-profile.spec.tmp && mv gwebu-profile.spec.tmp gwebu-profile.spec.in
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
Summary: Gwebu profile.d - cool date, prompt with history, aliases
|
Summary: Gwebu profile.d - cool date, prompt with history, aliases
|
||||||
Name: gwebu-profile
|
Name: gwebu-profile
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 3
|
Release: 5
|
||||||
License: GPLv2
|
|
||||||
Source0: profile.d-%{version}.tar.xz
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
License: GPLv2
|
||||||
|
Source0: profile.d-%{version}-%{release}.tar.xz
|
||||||
Requires: bash >= 4
|
Requires: bash >= 4
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
This package contains:
|
This package contains:
|
||||||
- z-aliases.sh:
|
- z-aliases.sh:
|
||||||
|
|
@ -20,21 +21,29 @@ This package contains:
|
||||||
|
|
||||||
All these reside in /etc/profile.d/.
|
All these reside in /etc/profile.d/.
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q # -n profile.d-%{version}
|
%setup -q -n profile.d-%{version}-%{release}
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# No build actions needed for Bash scripts
|
# No build actions needed for Bash scripts
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
|
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
|
||||||
install -m 0644 etc/profile.d/*.sh %{buildroot}%{_sysconfdir}/profile.d/
|
install -m 0644 etc/profile.d/*.sh %{buildroot}%{_sysconfdir}/profile.d/
|
||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%{_sysconfdir}/profile.d/*.sh
|
%{_sysconfdir}/profile.d/*.sh
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 22 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.0-4
|
||||||
|
- General rework of the build process (distribution source and rpm).
|
||||||
|
|
||||||
* Wed Feb 21 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.0-3
|
* Wed Feb 21 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.0-3
|
||||||
- Minor updates.
|
- Minor updates.
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue