Skip to content
This repository was archived by the owner on Feb 16, 2025. It is now read-only.

Commit ee7d36c

Browse files
committed
fix(rpm): do git versioning properly
1 parent 8cf2dc9 commit ee7d36c

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

Diff for: .rpm/container-desktop-entries.spec

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
%global date ###
1212

1313
Name: container-desktop-entries
14-
Version: %{ver}~%{date}
14+
Version: %{ver}~git%{date}.%{sub %{commit} 1 7}
1515
Release: %autorelease
1616
Summary: A tool to add guest container desktop entries to the host system
1717

@@ -21,8 +21,8 @@ License: # FIXME
2121
# LICENSE.dependencies contains a full license breakdown
2222

2323
URL: https://github.com/ryanabx/container-desktop-entries
24-
Source: container-desktop-entries-%{ver}.tar.xz
25-
Source: container-desktop-entries-%{ver}-vendor.tar.xz
24+
Source: container-desktop-entries-%{commit}.tar.xz
25+
Source: container-desktop-entries-%{commit}-vendor.tar.xz
2626

2727
BuildRequires: cargo-rpm-macros >= 26
2828
BuildRequires: rustc
@@ -39,7 +39,7 @@ Requires: desktop-entry-daemon
3939
%description %{_description}
4040

4141
%prep
42-
%autosetup -n %{crate}-%{ver} -p1 -a1
42+
%autosetup -n %{name}-%{commit} -p1 -a1
4343
%cargo_prep -N
4444
cat .vendor/config.toml >> .cargo/config
4545

Diff for: .rpm/setup.sh

+6-8
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,36 @@ repo=$5
1414
LATEST="latest"
1515

1616
# Clone repo and cd into it
17-
mkdir $name-$version && cd $name-$version && git clone --recurse-submodules $repo .
17+
mkdir $name-$commit && cd $name-$commit && git clone --recurse-submodules $repo .
1818

1919
# Get latest commit hash if commit is set to latest
2020
if [[ "$commit" == "$LATEST" ]]
2121
then
2222
commit=$(git rev-parse HEAD)
23+
cd .. && mv $name-latest $name-$commit && cd $name-$commit
2324
fi
2425

25-
# Short commit, used for versioning
26-
short_commit=${commit:0:6}
27-
2826
# Reset to specified commit
2927
git reset --hard $commit
3028

3129
# Vendor dependencies and zip vendor
3230
mkdir .vendor
3331
cargo vendor > .vendor/config.toml
34-
tar -pcJf $name-$version-vendor.tar.xz vendor && mv $name-$version-vendor.tar.xz ../$name-$version-vendor.tar.xz
32+
tar -pcJf $name-$commit-vendor.tar.xz vendor && mv $name-$commit-vendor.tar.xz ../$name-$commit-vendor.tar.xz
3533
# Back into parent directory
3634
rm -rf vendor && cd ..
3735

3836
# Zip source
39-
tar -pcJf $name-$version.tar.xz $name-$version
40-
rm -rf $name-$version
37+
tar -pcJf $name-$commit.tar.xz $name-$commit
38+
rm -rf $name-$commit
4139

4240
# Get specfile
4341
cp $path_to_spec $name.spec 2>/dev/null || :
4442

4543
# Make replacements to specfile
4644
sed -i "/^%global ver / s/.*/%global ver $version/" $name.spec
4745
sed -i "/^%global commit / s/.*/%global commit $commit/" $name.spec
48-
current_date=$(date +'%Y%m%d.%H%M')
46+
current_date=$(date +'%Y%m%d.%H')
4947
sed -i "/^%global date / s/.*/%global date $current_date/" $name.spec
5048

5149

0 commit comments

Comments
 (0)