flutter_distributor icon indicating copy to clipboard operation
flutter_distributor copied to clipboard

Fixed RPM SPEC file Changelog not being read issue

Open jyo64 opened this issue 1 year ago • 6 comments

The Date from build was not getting recorded properly in the SPEC file for RPM packaging due to the change log not being read and formatted properly. I have now fixed it. This solves #235.

jyo64 avatar Nov 27 '24 00:11 jyo64

Well done for spotting the cause of the error, it had been throwing warnings for a while; now that I upgraded to F41 it's a solid error.

One question please, how to modify the behavior of flutter_distributor while waiting for the PR to merge? I tried

$ dart pub global deactivate flutter_distributor
$ dart pub global activate --source path </path/to/modified/git/clone/of/flutter_distributor>
$ flutter_distributor release --name=dev --jobs=release-dev-linux-rpm

(config at linux/packaging/rpm/make_config.yaml all as working before) as well as adding a

changelog: SomeEntryHere

to the make_config.yaml, yet no difference? Even putting some debugging print() statements into the packages/flutter_app_packager/lib/src/makers/rpm/make_rpm_config.dart file it looks as though the modified code is not being called / run? Is there some more config, is dart automatically retrieving the unmodified github or pub.dev code or package?

MarkieMark avatar Dec 08 '24 09:12 MarkieMark

Hi @MarkieMark

Thanks for reviewing the code. I have now removed the duplicate variable you mentioned. Unfortunately my env is not currently setup and I'm busy with some academic stuff. Maybe you could test it and let me know if some changes are needed?

The way I tested is with the following steps:

First run

dart pub global activate flutter_distributor

This will pull the flutter_distributor from the Original Git Repo

Then I copy and paste the required modification in the global flutter packages directory

And activate it again. Unfortunately I forgot the exact comment. One of those pulls the code from Github main again and overwrites and other reactivates the flutter package with the current modifications.

I think its

dart pub global activate flutter_distributor

But I'm not sure.

Sorry my answer is vague.

jyo64 avatar Dec 08 '24 12:12 jyo64

Unfortunately this still did not work for me due to some other issue with the copy command in the rpm packaging and I had to end up building the RPM manually.

jyo64 avatar Dec 08 '24 12:12 jyo64

The dart pub global activate flutter_distributor seems to download ready-compiled snapshots, that aren't easily edited; I've mostly got it now though,

$ dart run /path/to/github/clone/flutter_distributor/packages/flutter_distributor/bin/main.dart release --name=dev --jobs=release-dev-linux-rpm

while adding a relative path in packages/flutter_distributor/pubspec.yaml to

flutter_app_packager:
    path: ../flutter_app_packager

basically works (may need pub get in the various directories of the modified github clone) as far as seeming to parse / use changelog properly; however then it errors at the stage of copying files similarly to what you're seeing; it must be a breaking change in rpmbuild or similar

+ cp -r '<projectname>/*' /path/to/projectname/dist/<versionBuild>/<projectname>-<versionBuild>-linux_rpm/rpmbuild/BUILD/<projectname>-<versionBuild>-build/BUILDROOT/usr/share/<projectname>
cp: cannot stat '<projectname>/*': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.AU90fQ (%install)
    Bad exit status from /var/tmp/rpm-tmp.AU90fQ (%install)

MarkieMark avatar Dec 08 '24 13:12 MarkieMark

alright that particular error I added a cd command to the .spec file that was left behind in the incomplete build, so now from

cp -r %{name}/* %{buildroot}%{_datadir}/%{name}
ln -s %{_datadir}/%{name}/%{name} %{buildroot}%{_bindir}/%{name}
cp -r %{name}.desktop %{buildroot}%{_datadir}/applications
cp -r %{name}.png %{buildroot}%{_datadir}/pixmaps
cp -r %{name}*.xml %{buildroot}%{_datadir}/metainfo || :
update-mime-database %{_datadir}/mime &> /dev/null || :

it's

cd /path/to/flutter/project/dist/<versionBuild>/<appname>-<versionBuild>-linux_rpm/rpmbuild/BUILD
cp -r %{name}/* %{buildroot}%{_datadir}/%{name}
ln -s %{_datadir}/%{name}/%{name} %{buildroot}%{_bindir}/%{name}
cp -r %{name}.desktop %{buildroot}%{_datadir}/applications
cp -r %{name}.png %{buildroot}%{_datadir}/pixmaps
cp -r %{name}*.xml %{buildroot}%{_datadir}/metainfo || :
update-mime-database %{_datadir}/mime &> /dev/null || :
cd %{_builddir}
%undefine __brp_add_determinism

the %undefine to address the fact that it would hang at

+ update-mime-database /usr/share/mime
+ :
+ cd /tmp/electron-28616dLglJpPSbHl4/scratch-desktop_1.2.1_x86_64/BUILD/<appname>-<versionBuild>-build
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip /usr/bin/strip
+ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/redhat/brp-strip-lto /usr/bin/strip
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/check-rpaths
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
+ /usr/lib/rpm/brp-remove-la-files
+ env /usr/lib/rpm/redhat/brp-python-bytecompile '' 1 0 -j8
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/bin/add-determinism --brp -j8 /tmp/electron-28616dLglJpPSbHl4/scratch-desktop_1.2.1_x86_64/BUILD/<appname>-<versionBuild>-build/BUILDROOT

it then leaves the .rpm in a temp folder such as /tmp/electron-28616dLglJpPSbHl4/scratch-desktop_1.2.1_x86_64/RPMS/x86_64/<appname>-<buildVersion>-<build>.fc41.x86_64.rpm

MarkieMark avatar Dec 08 '24 15:12 MarkieMark

@MarkieMark

Happy to know you got it working 😀

jyo64 avatar Dec 09 '24 11:12 jyo64

@lijy91

This PR is approved but not yet merged

We encounter the rpm build issue, please consider merge this PR and publish a new version

wafer-li avatar Aug 18 '25 03:08 wafer-li

Hi @lijy91 :), Please consider merging this PR and publishing a new version. :+1:

rekredhead avatar Sep 07 '25 13:09 rekredhead

@MarkieMark It does not work for me.

kjxbyz avatar Oct 12 '25 01:10 kjxbyz

I think you said in a different thread that you're running F40? Then I'd say quite possibly you need to A update your Fedora or B checkout then run an older (pre-bugfix) commit of the distributor tool

MarkBenjamin avatar Oct 22 '25 00:10 MarkBenjamin

There is more than one problem with the rpm package built on Ubuntu.

kjxbyz avatar Oct 22 '25 05:10 kjxbyz