diff --git a/Rakefile b/Rakefile index ec78d0e974..48cad8f7d0 100644 --- a/Rakefile +++ b/Rakefile @@ -63,6 +63,32 @@ def live_iso? mount_out.match?(/^\w+ on \/ type overlay/) || mount_out.match?(/^\/dev\/mapper\/live-rw on \/ /) end +def package_translations + # build the translations tarball + # + # NOTE: the following code was inspired by the + # packaging_rake_tasks/lib/tasks/tarball.rake file + # + # set the file time stamps according to the latest commit + mtime = `git show -s --format=%ci`.chomp + # For the reproducible output: + # - use the GNU format (the default POSIX format contains some time stamps) + # - sort the files (in a locale independent way) + # - set the owner and group to "root" + # - set the fixed modification time + sh("LC_ALL=C tar -c -j -f #{Shellwords.escape(package_dir)}/po.tar.bz2 --format=gnu --sort=name " \ + "--owner=root --group=root --mtime=#{Shellwords.escape(mtime)} po/*.po") +end + +def package_agama_yast_spec(gem_filename) + # "/foo/agama/service/agama-yast-10.devel201.gem" -> "10.devel201" + version = gem_filename.sub(/\.gem$/, "").sub(/.*-/, "") + + spec_text = File.read("agama-yast.spec.in") + spec_text.gsub!("@VERSION@", version) + File.write(File.join(package_dir, "agama-yast.spec"), spec_text) +end + Yast::Tasks.configuration do |conf| conf.obs_api = "https://api.opensuse.org" conf.obs_project = ENV["OBS_PROJECT"] || "systemsmanagement:Agama:Devel" @@ -99,7 +125,7 @@ if ENV["SKIP_OSC_BUILD"] == "1" end # TODO: redefine :tarball instead of :package -desc "Prepare sources for rpm build" +desc "Prepare sources for rpm build. Invoke from service/" task package: [] do Dir.chdir(Rake.original_dir) do |dir| old_gems = Dir.glob(File.join(package_dir, "*.gem")) @@ -111,20 +137,9 @@ task package: [] do sh "gem2rpm --local --config #{gem2rpm} --template opensuse #{gem} > package/#{package_name}.spec" FileUtils.mv(gem, package_dir) - # build the translations tarball - # - # NOTE: the following code was inspired by the - # packaging_rake_tasks/lib/tasks/tarball.rake file - # - # set the file time stamps according to the latest commit - mtime = `git show -s --format=%ci`.chomp - # For the reproducible output: - # - use the GNU format (the default POSIX format contains some time stamps) - # - sort the files (in a locale independent way) - # - set the owner and group to "root" - # - set the fixed modification time - sh("LC_ALL=C tar -c -j -f #{Shellwords.escape(package_dir)}/po.tar.bz2 --format=gnu --sort=name " \ - "--owner=root --group=root --mtime=#{Shellwords.escape(mtime)} po/*.po") + package_agama_yast_spec(gem) + + package_translations end end diff --git a/live/src/agama-installer.kiwi b/live/src/agama-installer.kiwi index 6862bc121f..7f19d26646 100644 --- a/live/src/agama-installer.kiwi +++ b/live/src/agama-installer.kiwi @@ -137,6 +137,7 @@ + diff --git a/service/.gitignore b/service/.gitignore index 3d17f348a7..4ba101d6b0 100644 --- a/service/.gitignore +++ b/service/.gitignore @@ -1,6 +1,6 @@ *.gem # the spec file is generated -/package/*.spec +/package/rubygem*.spec *.rbc /.config /coverage/ diff --git a/service/agama-yast.spec.in b/service/agama-yast.spec.in new file mode 100644 index 0000000000..55290c2b2c --- /dev/null +++ b/service/agama-yast.spec.in @@ -0,0 +1,85 @@ +# +# spec file for package agama-yast +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: agama-yast +Version: @VERSION@ +Release: 0 +%define mod_name agama-yast +%define mod_full_name %{mod_name}-%{version} +BuildRequires: dbus-1-common +# "msgfmt" tool +BuildRequires: gettext-runtime +Requires: dbus-1-common +Requires: rubygem(agama-yast) + +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: ruby-macros >= 5 + +URL: https://github.com/openSUSE/agama +Source: %{mod_full_name}.gem +Source1: po.tar.bz2 +Source2: install_translations.sh +Summary: YaST integration service for Agama - common files +License: GPL-2.0-only +Group: Development/Languages/Ruby + +%description +D-Bus service exposing some YaST features that are useful for Agama. + +%prep +%{gem_unpack} + +%build + +%install +install -D -m 0644 %{mod_full_name}/share/dbus.conf %{buildroot}%{_datadir}/dbus-1/agama.conf +install --directory %{buildroot}%{_datadir}/dbus-1/agama-services +install -m 0644 --target-directory=%{buildroot}%{_datadir}/dbus-1/agama-services %{mod_full_name}/share/org.opensuse.Agama*.service +install -D -m 0644 %{mod_full_name}/share/agama.service %{buildroot}%{_unitdir}/agama.service +install -D -m 0644 %{mod_full_name}/share/agama-proxy-setup.service %{buildroot}%{_unitdir}/agama-proxy-setup.service +install --directory %{buildroot}/usr/share/agama/conf.d +install -D -m 0644 %{mod_full_name}/conf.d/*.yaml %{buildroot}/usr/share/agama/conf.d/ + +# run a script for installing the translations +sh "%{SOURCE2}" "%{SOURCE1}" + +%pre +%service_add_pre agama.service + +%post +%service_add_post agama.service + +%preun +%service_del_preun agama.service + +%postun +%service_del_postun_with_restart agama.service + +%files +%{_datadir}/dbus-1/agama.conf +%dir %{_datadir}/dbus-1/agama-services +%{_datadir}/dbus-1/agama-services/org.opensuse.Agama*.service +%{_unitdir}/agama.service +%{_unitdir}/agama-proxy-setup.service +%dir %{_datadir}/agama +%dir %{_datadir}/agama/conf.d +%{_datadir}/agama/conf.d +%dir /usr/share/YaST2 +/usr/share/YaST2/locale + +%changelog diff --git a/service/package/gem2rpm.yml b/service/package/gem2rpm.yml index bdd561fc91..6c275cdbf1 100644 --- a/service/package/gem2rpm.yml +++ b/service/package/gem2rpm.yml @@ -1,29 +1,13 @@ --- :sourceurl: "%{mod_full_name}.gem" -:sources: - - po.tar.bz2 - - install_translations.sh :preamble: |- %global rb_build_versions %{rb_default_ruby} BuildRequires: dbus-1-common - # "msgfmt" tool - BuildRequires: gettext-runtime Requires: dbus-1-common -:post_install: |- - install -D -m 0644 %{buildroot}%{gem_base}/gems/%{mod_full_name}/share/dbus.conf %{buildroot}%{_datadir}/dbus-1/agama.conf - install --directory %{buildroot}%{_datadir}/dbus-1/agama-services - install -m 0644 --target-directory=%{buildroot}%{_datadir}/dbus-1/agama-services %{buildroot}%{gem_base}/gems/%{mod_full_name}/share/org.opensuse.Agama*.service - install -D -m 0644 %{buildroot}%{gem_base}/gems/%{mod_full_name}/share/agama.service %{buildroot}%{_unitdir}/agama.service - install -D -m 0644 %{buildroot}%{gem_base}/gems/%{mod_full_name}/share/agama-proxy-setup.service %{buildroot}%{_unitdir}/agama-proxy-setup.service - install --directory %{buildroot}/usr/share/agama/conf.d - install -D -m 0644 %{buildroot}%{gem_base}/gems/%{mod_full_name}/conf.d/*.yaml %{buildroot}/usr/share/agama/conf.d/ - # run a script for installing the translations - sh "%{SOURCE2}" "%{SOURCE1}" :main: :preamble: |- # Override build.rpm, see also https://github.com/openSUSE/obs-build/blob/master/configs/ %global rb_build_versions %{rb_default_ruby} - Provides: agama-yast BuildRequires: dbus-1-common Requires: dbus-1-common Requires: dbus-1-daemon @@ -75,18 +59,3 @@ Requires: yast2-schema # lsblk Requires: util-linux-systemd - :filelist: "%{_datadir}/dbus-1/agama.conf\n - %dir %{_datadir}/dbus-1/agama-services\n - %{_datadir}/dbus-1/agama-services/org.opensuse.Agama*.service\n - %{_unitdir}/agama.service\n - %{_unitdir}/agama-proxy-setup.service\n - %dir %{_datadir}/agama\n - %dir %{_datadir}/agama/conf.d\n - %{_datadir}/agama/conf.d\n - %dir /usr/share/YaST2\n - /usr/share/YaST2/locale\n" -:scripts: - :pre: "%service_add_pre agama.service" - :post: "%service_add_post agama.service" - :preun: "%service_del_preun agama.service" - :postun: "%service_del_postun_with_restart agama.service" diff --git a/service/package/rubygem-agama-yast.changes b/service/package/rubygem-agama-yast.changes index 10295b28f1..0579572f9a 100644 --- a/service/package/rubygem-agama-yast.changes +++ b/service/package/rubygem-agama-yast.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Nov 5 16:11:35 UTC 2024 - Martin Vidner + +- packaging: split out files independent of Ruby version + from rubygem-agama-yast (gh#agama-project/agama#1677). + ------------------------------------------------------------------- Wed Oct 30 11:33:54 UTC 2024 - José Iván López González