From 06d910496239639e0fb25e81584df75e43d44478 Mon Sep 17 00:00:00 2001 From: fr4nk2 Date: Tue, 11 Apr 2023 17:48:31 +0800 Subject: [PATCH] optimise spec file --- sg3_utils.spec | 152 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 113 insertions(+), 39 deletions(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index e6f1fea..bc3cac8 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -1,31 +1,24 @@ -%define anolis_release 2 -%global rescan_script rescan-scsi-bus.sh +%define anolis_release 3 -Summary: Utilities for devices that use SCSI command sets -Name: sg3_utils -Version: 1.47 -Release: %{anolis_release}%{?dist} -License: GPLv2+ and BSD -Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz -Source2: scsi-rescan.8 +Name: sg3_utils +Version: 1.47 +Release: %{anolis_release}%{?dist} +Summary: Utilities for devices that use SCSI command sets +License: GPLv2+ and BSD +URL: http://sg.danny.cz/sg/sg3_utils.html +Source0: http://sg.danny.cz/sg/p/%{name}-%{version}.tar.xz +Source2: scsi-rescan.8 -URL: http://sg.danny.cz/sg/sg3_utils.html -Requires: %{name}-libs%{?_isa} = %{version}-%{release} -BuildRequires: make -BuildRequires: gcc -BuildRequires: systemd +BuildRequires: systemd make gcc +Requires: %{name}-libs = %{version}-%{release} %description -Collection of Linux utilities for devices that use the SCSI command set. -Includes utilities to copy data based on "dd" syntax and semantics (called -sg_dd, sgp_dd and sgm_dd); check INQUIRY data and VPD pages (sg_inq); check -mode and log pages (sginfo, sg_modes and sg_logs); spin up and down -disks (sg_start); do self tests (sg_senddiag); and various other functions. -See the README, CHANGELOG and COVERAGE files. Requires the linux kernel 2.4 -series or later. In the 2.4 series SCSI generic device names (e.g. /dev/sg0) -must be used. In the 2.6 series other device names may be used as -well (e.g. /dev/sda). +The sg3_utils package contains utilities that send SCSI commands to devices. As well as +devices on transports traditionally associated with SCSI (e.g. Fibre Channel (FCP), +Serial Attached SCSI (SAS) and the SCSI Parallel Interface(SPI)) many other devices use +SCSI command sets. ATAPI cd/dvd drives and SATA disks that connect via a translation +layer or a bridge device are examples of devices that use SCSI command sets. Warning: Some of these tools access the internals of your system and the incorrect usage of them may render your system inoperable. @@ -38,7 +31,7 @@ This package contains the shared library for %{name}. %package devel Summary: Development library and header files for the sg3_utils library -Requires: %{name}-libs%{?_isa} = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} %description devel This package contains the %{name} library and its header files for @@ -53,43 +46,120 @@ BuildArch: noarch The %{name}-doc package contains documentation files for %{name}. %prep -%autosetup -p 1 +%autosetup -p1 -n %{name}-%{version} %build %configure --disable-static -# Don't use rpath! sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool %make_build - %install %make_install rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la -install -p -m 755 scripts/%{rescan_script} $RPM_BUILD_ROOT%{_bindir} -( cd $RPM_BUILD_ROOT%{_bindir}; ln -sf %{rescan_script} scsi-rescan ) +install -m 0755 -p scripts/rescan-scsi-bus.sh $RPM_BUILD_ROOT%{_bindir} +( cd $RPM_BUILD_ROOT%{_bindir}; ln -sf rescan-scsi-bus.sh scsi-rescan ) -install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 +install -m 0644 -p %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 # install all extra udev rules mkdir -p $RPM_BUILD_ROOT%{_udevrulesdir} mkdir -p $RPM_BUILD_ROOT/usr/lib/udev -install -p -m 644 scripts/40-usb-blacklist.rules $RPM_BUILD_ROOT%{_udevrulesdir} +install -m 0644 -p scripts/40-usb-blacklist.rules $RPM_BUILD_ROOT%{_udevrulesdir} # need to run after 60-persistent-storage.rules -install -p -m 644 scripts/55-scsi-sg3_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/61-scsi-sg3_id.rules +install -m 0644 -p scripts/55-scsi-sg3_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/61-scsi-sg3_id.rules # need to run after 62-multipath.rules -install -p -m 644 scripts/58-scsi-sg3_symlink.rules $RPM_BUILD_ROOT%{_udevrulesdir}/63-scsi-sg3_symlink.rules -install -p -m 644 scripts/59-scsi-cciss_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/65-scsi-cciss_id.rules -install -p -m 644 scripts/59-fc-wwpn-id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/63-fc-wwpn-id.rules -install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev +install -m 0644 -p scripts/58-scsi-sg3_symlink.rules $RPM_BUILD_ROOT%{_udevrulesdir}/63-scsi-sg3_symlink.rules +install -m 0644 -p scripts/59-scsi-cciss_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/65-scsi-cciss_id.rules +install -m 0644 -p scripts/59-fc-wwpn-id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/63-fc-wwpn-id.rules +install -m 0755 -p scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %generate_compatibility_deps %files -%{_bindir}/* +%{_bindir}/rescan-scsi-bus.sh +%{_bindir}/scsi-rescan +%{_bindir}/scsi_logging_level +%{_bindir}/scsi_mandat +%{_bindir}/scsi_readcap +%{_bindir}/scsi_ready +%{_bindir}/scsi_satl +%{_bindir}/scsi_start +%{_bindir}/scsi_stop +%{_bindir}/scsi_temperature +%{_bindir}/sg_bg_ctl +%{_bindir}/sg_compare_and_write +%{_bindir}/sg_copy_results +%{_bindir}/sg_dd +%{_bindir}/sg_decode_sense +%{_bindir}/sg_emc_trespass +%{_bindir}/sg_format +%{_bindir}/sg_get_config +%{_bindir}/sg_get_elem_status +%{_bindir}/sg_get_lba_status +%{_bindir}/sg_ident +%{_bindir}/sg_inq +%{_bindir}/sg_logs +%{_bindir}/sg_luns +%{_bindir}/sg_map +%{_bindir}/sg_map26 +%{_bindir}/sg_modes +%{_bindir}/sg_opcodes +%{_bindir}/sg_persist +%{_bindir}/sg_prevent +%{_bindir}/sg_raw +%{_bindir}/sg_rbuf +%{_bindir}/sg_rdac +%{_bindir}/sg_read +%{_bindir}/sg_read_attr +%{_bindir}/sg_read_block_limits +%{_bindir}/sg_read_buffer +%{_bindir}/sg_read_long +%{_bindir}/sg_readcap +%{_bindir}/sg_reassign +%{_bindir}/sg_referrals +%{_bindir}/sg_rep_pip +%{_bindir}/sg_rep_zones +%{_bindir}/sg_requests +%{_bindir}/sg_reset +%{_bindir}/sg_reset_wp +%{_bindir}/sg_rmsn +%{_bindir}/sg_rtpg +%{_bindir}/sg_safte +%{_bindir}/sg_sanitize +%{_bindir}/sg_sat_identify +%{_bindir}/sg_sat_phy_event +%{_bindir}/sg_sat_read_gplog +%{_bindir}/sg_sat_set_features +%{_bindir}/sg_scan +%{_bindir}/sg_seek +%{_bindir}/sg_senddiag +%{_bindir}/sg_ses +%{_bindir}/sg_ses_microcode +%{_bindir}/sg_start +%{_bindir}/sg_stpg +%{_bindir}/sg_stream_ctl +%{_bindir}/sg_sync +%{_bindir}/sg_test_rwbuf +%{_bindir}/sg_timestamp +%{_bindir}/sg_turs +%{_bindir}/sg_unmap +%{_bindir}/sg_verify +%{_bindir}/sg_vpd +%{_bindir}/sg_wr_mode +%{_bindir}/sg_write_buffer +%{_bindir}/sg_write_long +%{_bindir}/sg_write_same +%{_bindir}/sg_write_verify +%{_bindir}/sg_write_x +%{_bindir}/sg_xcopy +%{_bindir}/sg_zone +%{_bindir}/sginfo +%{_bindir}/sgm_dd +%{_bindir}/sgp_dd %{abidir}/*-option.list %{_mandir}/man8/* %{_udevrulesdir}/61-scsi-sg3_id.rules @@ -102,17 +172,21 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %files libs %license BSD_LICENSE COPYING %dir %{abidir} -%{_libdir}/*.so.* +%{_libdir}/libsgutils2-1.47.so.2 +%{_libdir}/libsgutils2-1.47.so.2.0.0 %{abidir}/*.dump %files devel %{_includedir}/scsi/*.h -%{_libdir}/*.so +%{_libdir}/libsgutils2.so %files doc %doc AUTHORS COVERAGE CREDITS ChangeLog README README.sg_start %changelog +* Tue Apr 11 2023 Guyu Wang - 1.47-3 +- optimise spec file + * Sun Feb 26 2023 Shawn Wang - 1.47-2 - optimize the spec file -- Gitee