openeuler-riscv / oerv-team

OERV 实习生工作中心
7 stars 35 forks source link

升级并修复 system-config-printer #281

Open Jingwiw opened 3 months ago

Jingwiw commented 3 months ago

软件包信息

软件包名称: system-config-printer

openEuler 仓库地址: src-openeuler/system-config-printer

构建仓库地址: https://build.tarsier-infra.isrc.ac.cn/package/show/openEuler:24.03:Epol/system-config-printer

说明

问题背景: 依据fedora的spec 修复 system-config-printer,略微调整最后的打包列表就行,并且升级到最新版本 https://src.fedoraproject.org/rpms/system-config-printer/blob/rawhide/f/system-config-printer.spec

所需技能:

其它:

Hajduk137 commented 3 months ago

修复尝试记录

tarsieropenEuler:24.03:Epol拉取system-config-printer

调整spec中的%file,并将版本更新到了1.15.18,获取了github仓库中的最新源码

Name:           system-config-printer
Summary:        a graphical tool for CUPS administration
Version:        1.5.18
Release:        24
License:        GPLv2+
URL:            https://github.com/OpenPrinting/system-config-printer
Source0:        %{url}/releases/download/v%{version}/%{name}-%{version}.tar.gz

尝试构建

osc build mainline_riscv64 riscv64 --vm-type=nspawn

出现以下报错:

[   76s] checking pkg-config is at least version 0.9.0... yes  
[   76s] checking for CUPS SERVERBIN dir... configure: error: No CUPS pkgconfig file present and no CUPS SERVERBIN dir defined in configure options.  
[   76s] error: Bad exit status from /var/tmp/rpm-tmp.7rHJIu (%build)

检查system-config-printer 1.15.18 源码,发现原因是没有cups相关的pkgconfig文件:

AS_IF([test "x$PKG_CONFIG" != x], [
      AS_IF([$PKG_CONFIG --exists cups], [
          cupsserverbindir=$($PKG_CONFIG --variable=cups_serverbin cups)
          AC_MSG_RESULT([$cupsserverbindir])
        ], [
          AC_MSG_ERROR([No CUPS pkgconfig file present and no CUPS SERVERBIN dir defined in configure options.])
        ])
    ], [

openEuler 24:03fedora rawhide 分支中的cups软件包都为版本2.4.7,所以我检查了各自的cups软件包spec文件,发现cups-devel依赖缺少pkgconf-pkg-config%build 乃至最后的打包列表都有关于pkgconfig文件路径的差异:

fedora rawhide cup-devel

%package devel
Summary: CUPS printing system - development environment
License: LGPLv2
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires: gnutls-devel
Requires: krb5-devel
Requires: pkgconf-pkg-config
Requires: zlib-devel

fedora%configure中有--with-pkgconfpath

%files devel
%{_bindir}/cups-config
%{_includedir}/cups
%{_libdir}/*.so
%{_libdir}/pkgconfig/cups.pc
%{_mandir}/man1/cups-config.1.gz
%{_rpmconfigdir}/macros.d/macros.cups

openEuler 24.03 cup-devel

%package devel
Summary: CUPS printing system - development environment
License: Apache-2.0
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires: gnutls-devel krb5-devel zlib-devel

%build
export DSOFLAGS="$DSOFLAGS -L../cgi-bin -L../filter -L../ppdc -L../scheduler -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld -Wl,-z,relro,-z,now -fPIE -pie" 
export CFLAGS="$RPM_OPT_FLAGS -fstack-protector-all -DLDAP_DEPRECATED=1"
# --enable-debug to avoid stripping binaries
%configure --with-docdir=%{_datadir}/%{name}/www --enable-debug \
    --enable-lspp \
    --with-exe-file-perm=0755 \
    --with-cupsd-file-perm=0755 \
    --with-log-file-perm=0600 \
    --enable-relro \
    --with-dbusdir=%{_sysconfdir}/dbus-1 \
    --enable-avahi \
    --enable-threads \
    --enable-gnutls \
    --enable-webif \
    --with-xinetd=no \
    --with-access-log-level=actions \
    --enable-page-logging \
    --with-rundir=%{_rundir}/cups \
    --enable-sync-on-close \
    localedir=%{_datadir}/locale
%files devel
%{_bindir}/cups-config
%{_includedir}/cups
%{_libdir}/*.so
%{_rpmconfigdir}/macros.d/macros.cups
%{_prefix}/lib/pkgconfig/cups.pc

尝试在system-config-printer specrequires 中添加 pkgconf-pkg-config,再次构建,仍出现和原来相同的no cups pkgconfig file错误

检查openEuler pkgconf

Name:           pkgconf
Version:        1.9.5
Release:        1
Summary:        Package compiler and linker metadata toolkit

检查fedora pkgconf

Name:           pkgconf
Version:        2.1.0
Release:        1%{?dist}
Summary:        Package compiler and linker metadata toolkit

发现pkgconf包也可能需要更新

问题总结

system-config-printer 依赖的 cups-devel 缺少pkgconf-pkg-config依赖 cupsspec 文件中%configure 中未设置--with-pkgconfpath cups打包列表中%dir设置也存在差异 pkgconf软件包可能需要更新

Hajduk137 commented 3 months ago

已经确定问题所在了,autoconf宏检测不到定位cups server binpkg config文件,通过--with-cups-serverbin-dir手动指定cups server bin只有在旧版本的cups中可行,而openEuler 24:03cups软件包已经升级到了最新版本。所以不解决cups软件包的pkg config文件生成的问题就无法修复system-config-printer。生成cups软件包的pkg config文件又需要修改它的spec以便在%configure后添加参数,同时创建包含cups.pcpkg config文件夹。

autoconf生成的相关configure.ac文件

AC_ARG_WITH([cups_serverbin_dir],
  AS_HELP_STRING([--with-cups-serverbin-dir], [set CUPS SERVERBIN dir, default=value from pkg-config]), [
    cupsserverbindir="$withval"
    AC_MSG_RESULT([$withval])
  ], [
    AS_IF([test "x$PKG_CONFIG" != x], [
      AS_IF([$PKG_CONFIG --exists cups], [
          cupsserverbindir=$($PKG_CONFIG --variable=cups_serverbin cups)
          AC_MSG_RESULT([$cupsserverbindir])
        ], [
          AC_MSG_ERROR([No CUPS pkgconfig file present and no CUPS SERVERBIN dir defined in configure options.])
        ])
    ], [
      AC_MSG_ERROR([No pkg-config present and no CUPS SERVERBIN dir defined in configure options.])
    ])
])

手动指定cups server bin的结果

[  538s] configure: error: invalid variable name: `–-with-cups-serverbin-dir'

以下是system-config-printer开发者在相关issue下的回复 image

Hajduk137 commented 3 months ago

手动创建符合规范的cups.pc文件后,system-config-printer构建成功,这下百分百可以确定是cups软件包生成cups.pc文件的原因

system-config-printer构建结果: image

Hajduk137 commented 3 months ago

已经提交两个软件包相关的PR https://gitee.com/src-openeuler/cups/pulls/136 https://gitee.com/src-openeuler/system-config-printer/pulls/66