Skip to content

Commit

Permalink
Merge pull request #142 from hellcp/master
Browse files Browse the repository at this point in the history
Adjust to changes in desktop files
  • Loading branch information
lslezak committed Jun 3, 2019
2 parents 24f11ea + 94a389b commit 88b04b6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 30 deletions.
2 changes: 1 addition & 1 deletion build-tools/rpm/macros.yast
Expand Up @@ -107,7 +107,7 @@ fi \
\
mkdir -p %{buildroot}%{yast_metainfodir}/ \
for f in $(%{_bindir}/find %{buildroot}/%{yast_desktopdir}/ -name '*.desktop') ; do \
%{yast_ydatadir}/devtools/bin/y2metainfo -f ${f} -l "%{license}" -o %{buildroot}%{yast_metainfodir}/ \
%{yast_ydatadir}/devtools/bin/y2metainfo -f ${f} -l "%{license}" -o %{buildroot}/%{yast_metainfodir}/ -u "%{url}" -v "%{version}" \
done

%yast_desktop_files \
Expand Down
30 changes: 24 additions & 6 deletions build-tools/scripts/y2metainfo
Expand Up @@ -30,9 +30,15 @@ OptionParser.new do |parser|
parser.on("-o", "--output DIRECTORY", "The output directory") do |v|
options[:output] = v
end
parser.on("-u", "--url URL", "The project url") do |v|
options[:url] = v
end
parser.on("-v", "--version VERSION", "Current version of the component") do |v|
options[:version] = v
end
end.parse!

def metainfo_gen(desktop, license)
def metainfo_gen(desktop, license, url, version)
output = ""
xml = REXML::Document.new
xml << REXML::XMLDecl.new("1.0", "UTF-8")
Expand All @@ -43,12 +49,12 @@ def metainfo_gen(desktop, license)
base.add_element("id").add_text(File.basename(desktop, ".desktop"))
# Exectutes based on id of desktop file https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-launchable
base.add_element("launchable", "type" => "desktop-id").add_text(File.basename(desktop))
data.select{ |x| x.start_with?("Name") }.each do |key, value|
data.select{ |x| x.start_with?("GenericName") }.each do |key, value|
name = base.add_element("name").add_text(value)
lang = (/(?<=\[).*(?=\])/).match(key)
name.add_attribute("xml:lang", lang) if lang
end
data.select{ |x| x.start_with?("GenericName") }.each do |key, value|
data.select{ |x| x.start_with?("Comment") }.each do |key, value|
name = base.add_element("summary").add_text(value)
lang = (/(?<=\[).*(?=\])/).match(key)
name.add_attribute("xml:lang", lang) if lang
Expand All @@ -57,12 +63,24 @@ def metainfo_gen(desktop, license)
data["Categories"].split(";").each do |category|
cat.add_element("category").add_text(category)
end
rel = base.add_element("releases")
rel.add_element("release").add_attribute("version", version)
if data["Mimetype"]
mime = base.add_element("mimetypes")
data["Mimetype"].split(";").each do |mimetype|
mime.add_element("mimetype").add_text(mimetype)
end
end
if license
base.add_element("metadata_license").add_text(license)
base.add_element("project_license").add_text(license)
end
base.add_element("extends").add_text("org.openSUSE.YaST")
base.add_element("url", "type" => "homepage").add_text("https://yast.opensuse.org")
base.add_element("extends").add_text("org.opensuse.YaST")
if url
base.add_element("url", "type" => "homepage").add_text(url)
else
base.add_element("url", "type" => "homepage").add_text("https://yast.opensuse.org")
end
base.add_element("url", "type" => "bugtracker").add_text("https://bugzilla.opensuse.org")
base.add_element("update_contact").add_text("yast-devel@opensuse.org")

Expand All @@ -72,7 +90,7 @@ def metainfo_gen(desktop, license)
output
end

result = metainfo_gen(options[:file], options[:license])
result = metainfo_gen(options[:file], options[:license], options[:url], options[:version])
if options[:output] && options[:file]
filename = options[:output] + File.basename(options[:file], ".desktop") + ".metainfo.xml"
File.write(filename, result)
Expand Down
6 changes: 6 additions & 0 deletions package/yast2-devtools.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sat Jun 1 21:58:50 UTC 2019 - Stasiek Michalski <hellcp@mailbox.org>

- Adapt to desktop file changes (boo#1084864)
- 4.2.3

-------------------------------------------------------------------
Wed May 29 11:46:25 UTC 2019 - Stasiek Michalski <hellcp@mailbox.org>

Expand Down
37 changes: 14 additions & 23 deletions package/yast2-devtools.spec
Expand Up @@ -12,16 +12,18 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name: yast2-devtools
Version: 4.2.2
Version: 4.2.3
Release: 0
Url: http://github.com/yast/yast-devtools
Url: https://github.com/yast/yast-devtools
Summary: YaST2 - Development Tools
License: GPL-2.0-or-later
Group: System/YaST

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: %{name}-%{version}.tar.bz2

BuildRequires: automake
Expand All @@ -33,11 +35,8 @@ BuildRequires: libxslt
BuildRequires: perl-XML-Writer
BuildRequires: pkgconfig
BuildRequires: sgml-skel
Requires: yast2-buildtools

Summary: YaST2 - Development Tools
License: GPL-2.0-or-later
Group: System/YaST
Requires: yast2-buildtools

BuildArch: noarch

Expand Down Expand Up @@ -69,13 +68,12 @@ Recommends: libtool
# weak dependency, "make pot" is usually not needed
Suggests: rubygem(gettext)


%description -n yast2-buildtools
Scripts and templates required for rebuilding the existing YaST2
modules and components (both ruby and C++).

%prep
%setup -n yast2-devtools-%{version}
%setup -q

%build
make -f Makefile.cvs all
Expand All @@ -84,32 +82,31 @@ make -f Makefile.cvs all
make

%install
make install DESTDIR="$RPM_BUILD_ROOT"
[ -e "%{_prefix}/share/YaST2/data/devtools/NO_MAKE_CHECK" ] || Y2DIR="$RPM_BUILD_ROOT/%{_prefix}/share/YaST2" make check DESTDIR="$RPM_BUILD_ROOT"
for f in `find $RPM_BUILD_ROOT/%{_prefix}/share/applications/YaST2 -name "*.desktop"` ; do
make install DESTDIR="%{buildroot}"
[ -e "%{_datadir}/YaST2/data/devtools/NO_MAKE_CHECK" ] || Y2DIR="%{buildroot}%{_datadir}/YaST2" make check DESTDIR="%{buildroot}"
for f in `find %{buildroot}%{_datadir}/applications/YaST2 -name "*.desktop"` ; do
d=${f##*/}
%suse_update_desktop_file -d ycc_${d%.desktop} ${d%.desktop}
done

%if 0%{?qemu_user_space_build}
# disable testsuite on QEMU builds, will fail
cat > "$RPM_BUILD_ROOT/%{_prefix}/share/YaST2/data/devtools/NO_MAKE_CHECK" <<EOF
cat > "%{buildroot}%{_datadir}/YaST2/data/devtools/NO_MAKE_CHECK" <<EOF
Disabling testsuite on QEMU builds, as the userspace emulation
is not complete enough for yast2-core
EOF
%endif

# Change false to true in the following line when yast2 core is broken
false && cat > "$RPM_BUILD_ROOT/%{_prefix}/share/YaST2/data/devtools/NO_MAKE_CHECK" <<EOF
false && cat > "%{buildroot}%{_datadir}/YaST2/data/devtools/NO_MAKE_CHECK" <<EOF
When yast2 core is broken and the interpreter does not work,
submitting yast2-devtools with the flag file existing will
prevent ycp developers being flooded by testsuite failures.
EOF

%fdupes %buildroot/%_prefix
%fdupes %{buildroot}%{_prefix}

%files
%defattr(-,root,root)
%dir %{_datadir}/emacs
%dir %{_datadir}/emacs/site-lisp
%{_datadir}/emacs/site-lisp/*ycp-mode.el
Expand All @@ -121,7 +118,6 @@ EOF
%{_datadir}/vim/site/ftdetect/ycp_filetype.vim
%dir %{_prefix}/lib/YaST2
%{_datadir}/cmake

%dir %{_datadir}/YaST2
%doc %{_datadir}/doc/packages/%{name}
%dir %{_prefix}/lib/YaST2/bin
Expand All @@ -146,9 +142,7 @@ EOF
%dir %{_datadir}/YaST2/control/
%{_datadir}/YaST2/control/control_to_glade.xsl


%files -n yast2-buildtools
%defattr(-,root,root)
%{_sysconfdir}/rpm/macros.yast
%{_bindir}/y2tool
%{_datadir}/aclocal/*.m4
Expand All @@ -171,7 +165,4 @@ EOF
%{_datadir}/YaST2/data/devtools/bin/y2metainfo
%license COPYING




%changelog

0 comments on commit 88b04b6

Please sign in to comment.