Unable to build initscripts package

UnicsSol asked:

I have some patches that I added in spec files and after adding those patches I am unable to build the rpm package.

Obsoletes: hotplug <= 3:2004_09_23-10.1
Processing files: debugmode-9.03.61-1.0.3.el6_9.2prerel0.63189.x86_64
error: File must begin with "/": %patch11
error: File must begin with "/": -p1
error: File must begin with "/": %patch13
error: File must begin with "/": -p1
error: File must begin with "/": %patch14
error: File must begin with "/": -p1
error: File must begin with "/": %patch15
error: File must begin with "/": -p1
error: File must begin with "/": %patch16
error: File must begin with "/": -p1
error: File must begin with "/": %patch17
error: File must begin with "/": -p1
error: File must begin with "/": %patch18
error: File must begin with "/": -p1
error: File must begin with "/": %patch19
error: File must begin with "/": -p1
error: File must begin with "/": %patch20
error: File must begin with "/": -p1
error: File must begin with "/": %patch21
error: File must begin with "/": -p1


RPM build errors:
    File must begin with "/": %patch11
    File must begin with "/": -p1
    File must begin with "/": %patch13
    File must begin with "/": -p1
    File must begin with "/": %patch14
    File must begin with "/": -p1
    File must begin with "/": %patch15
    File must begin with "/": -p1
    File must begin with "/": %patch16
    File must begin with "/": -p1
    File must begin with "/": %patch17
    File must begin with "/": -p1
    File must begin with "/": %patch18
    File must begin with "/": -p1
    File must begin with "/": %patch19
    File must begin with "/": -p1
    File must begin with "/": %patch20
    File must begin with "/": -p1
    File must begin with "/": %patch21
    File must begin with "/": -p1
make[1]: *** [build_rpm] Error 1
make: *** [rpm] Error 2
ERROR: Make failed!
ERROR:       RC: 2
ERROR:      CMD: /usr/bin/make -s -f pkg-Linux.make rpm
ERROR: MAKEFILE: pkg-Linux.make

My spec file is as below for the rpm package:

%define with_upstart 1%{nil}
Summary: The inittab file and the /etc/init.d scripts
Name: initscripts
Version: 9.0.6
# ppp-watch is GPLv2+, everything else is GPLv2
License: GPLv2 and GPLv2+
Group: System Environment/Base
Release: ~RELEASE~
#Release: 1.0.6%{?dist}
URL: http://fedorahosted.org/releases/i/n/initscripts/
Source: http://fedorahosted.org/releases/i/n/initscripts/initscripts-%{version}.tar.bz2
# Custom patches
Patch11: custom-initscripts-9.0.6-bonding.patch
Patch13: custom-initscripts-9.0.6-tklc.patch
Patch14: custom-initscripts-9.0.6-defaultrl.patch
Patch15: custom-initscripts-9.0.6-ethtool-accel-opts.patch
Patch16: custom-initscripts-9.0.6-ipv6routes.patch
Patch17: custom-initscripts-9.0.6-ipv6rules.patch
Patch18: custom-initscripts-9.0.6-vlanroutes.patch
Patch19: custom-initscripts-9.0.6-udev-loop.patch
Patch20: custom-initscripts-9.0.6-alias-ipv6.patch
Patch21: custom-initscripts-ttyS0-on.patch
# End custom patches
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires: mingetty, /bin/awk, /bin/sed, mktemp
Requires: /sbin/sysctl
Requires: /sbin/fuser, /bin/grep
Requires: /sbin/pidof, /sbin/blkid
Requires: module-init-tools >= 3.9-25
Requires: util-linux-ng >= 2.16
Requires: bash >= 3.0
Requires: sysvinit-tools >= 2.87-6
%if with_upstart
Requires: upstart >= 0.6.5-11
%else
Requires: SysVinit >= 2.85-38
%endif
Requires: /sbin/ip, /sbin/arping, net-tools, /bin/find
Requires: /etc/system-release
Requires: /etc/oracle-release
Requires: oracle-logos
Requires: ethtool >= 1.8-2, /sbin/runuser
Requires: udev >= 125-1
Requires: cpio
Requires: plymouth
Conflicts: mkinitrd < 4.0, kernel < 2.6.18, mdadm < 3.1.2-9
Conflicts: ypbind < 1.6-12, psacct < 6.3.2-12, kbd < 1.06-19, lokkit < 0.50-14
Conflicts: dhclient < 12:4.1.0-6
Conflicts: tcsh < 6.13-5
Conflicts: xorg-x11, glib2 < 2.11.1-2
Conflicts: alsa-utils < 1.0.18
Conflicts: plymouth < 0.8.3-9
Conflicts: s390utils < 2:1.8.2-11
Conflicts: dmraid < 1.0.0.rc16-7, lvm2 < 2.02.100-5
Conflicts: e2fsprogs < 1.15
Conflicts: nut < 2.2.0
Conflicts: NetworkManager < 1:0.8.0-12.git20100504
Obsoletes: hotplug <= 3:2004_09_23-10.1
Requires(pre): /usr/sbin/groupadd
Requires(post): /sbin/chkconfig, coreutils
Requires(preun): /sbin/chkconfig
BuildRequires: glib2-devel popt-devel gettext pkgconfig
Patch100: initscripts-enterprise.patch
Patch101: do_not_do_rename_for_vlan_bond_bridge.patch
Patch102: set-rds-ib-active_bonding.patch
Patch103: set-rds-ib-trigger-active-bonding.patch
Patch104: add_check_before_calling_install_bonding_driver.patch
Patch105: initscripts-dont-stop-network-service-if-there-is-an-iscsi-connection.patch
Patch106: ifup.patch
Patch107: initscripts-ifup-fix-failed-to-bring-up-alias-interface.patch
Patch108: initscripts-revert-ifup_patch_bug25115763_bug25132856.patch
Patch109: initscripts-dont-mount-ocfs2-volume-from-etc-fstab.patch
Patch110: initscripts-autorelabel-post.patch
Patch111: initscripts-bug-fix-netfs-lazy-umount.patch
Patch112: 0001-initscripts-revert-add_check_before_calling_install_.patch
Patch113: 0002-initscripts-set-bond-master-up-when-slaves-come-up-l.patch
Patch114: initscripts-delay-ifup-upon-dev-rename
Patch115: initscripts-bug-fix-noisy-output-if-no-iscsid-check.patch
Patch116: 0001-initscripts-don-t-kill-iscisd-on-shutdown-reboot.patch
Patch117: 0001-Don-t-call-install_bonding_driver-when-bond-is-alrea.patch
Patch118: initscripts-LM-udev-rule.patch
%description
The initscripts package contains the basic system scripts used to boot
your Red Hat or Fedora system, change runlevels, and shut the system down
cleanly. Initscripts also contains the scripts that activate and
deactivate most network interfaces.
%package -n debugmode
Summary: Scripts for running in debugging mode
Requires: initscripts
Group: System Environment/Base
%description -n debugmode
The debugmode package contains some basic scripts that are used to run
the system in a debugging mode.
Currently, this consists of various memory checking code.
%prep
%setup -q
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch115 -p1
%patch116 -p1
%patch117 -p1
%patch118 -p1
%build
make
%install
rm -rf $RPM_BUILD_ROOT
make ROOT=$RPM_BUILD_ROOT SUPERUSER=`id -un` SUPERGROUP=`id -gn` mandir=%{_mandir} install
%find_lang %{name}
%if with_upstart
mv -f $RPM_BUILD_ROOT/etc/inittab.upstart $RPM_BUILD_ROOT/etc/inittab
%else
mv -f $RPM_BUILD_ROOT/etc/inittab.sysv $RPM_BUILD_ROOT/etc/inittab
rm -rf $RPM_BUILD_ROOT/etc/init
%endif
rm -f $RPM_BUILD_ROOT/etc/inittab.*
%ifnarch s390 s390x
rm -f \
$RPM_BUILD_ROOT/etc/sysconfig/network-scripts/ifup-ctc \
%else
rm -f \
$RPM_BUILD_ROOT/etc/rc.d/rc.sysinit.s390init \
$RPM_BUILD_ROOT/etc/sysconfig/init.s390
%endif
%pre
/usr/sbin/groupadd -g 22 -r -f utmp
%post
touch /var/log/wtmp /var/run/utmp /var/log/btmp
chown root:utmp /var/log/wtmp /var/run/utmp /var/log/btmp
chmod 664 /var/log/wtmp /var/run/utmp
chmod 600 /var/log/btmp
/sbin/chkconfig --add netfs
/sbin/chkconfig --add network
/sbin/chkconfig --add netconsole
if [ ! -f /var/lib/random-seed -a -e /dev/urandom ] ; then
dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=4096 2>/dev/null
chmod 600 /var/lib/random-seed
fi
%preun
if [ $1 = 0 ]; then
/sbin/chkconfig --del netfs
/sbin/chkconfig --del network
/sbin/chkconfig --del netconsole
fi
%triggerun -- initscripts < 7.62
/sbin/chkconfig --del random
/sbin/chkconfig --del rawdevices
exit 0
%clean
rm -rf $RPM_BUILD_ROOT
%files -f %{name}.lang
%defattr(-,root,root)
%dir /etc/sysconfig/network-scripts
%config(noreplace) %verify(not md5 mtime size) /etc/adjtime
%config(noreplace) /etc/sysconfig/init
%config(noreplace) /etc/sysconfig/netconsole
%config(noreplace) /etc/sysconfig/readonly-root
/etc/sysconfig/network-scripts/ifdown
/sbin/ifdown
/etc/sysconfig/network-scripts/ifdown-post
/etc/sysconfig/network-scripts/ifup
/sbin/ifup
%dir /etc/sysconfig/console
%dir /etc/sysconfig/modules
%dir /etc/sysconfig/networking
%dir /etc/sysconfig/networking/devices
%dir /etc/sysconfig/networking/profiles
%dir /etc/sysconfig/networking/profiles/default
/etc/sysconfig/network-scripts/network-functions
/etc/sysconfig/network-scripts/network-functions-ipv6
/etc/sysconfig/network-scripts/init.ipv6-global
%config(noreplace) /etc/sysconfig/network-scripts/ifcfg-lo
/etc/sysconfig/network-scripts/ifup-post
/etc/sysconfig/network-scripts/ifdown-ppp
/etc/sysconfig/network-scripts/ifup-ppp
/etc/sysconfig/network-scripts/ifup-routes
/etc/sysconfig/network-scripts/ifdown-routes
/etc/sysconfig/network-scripts/ifup-plip
/etc/sysconfig/network-scripts/ifup-plusb
/etc/sysconfig/network-scripts/ifup-bnep
/etc/sysconfig/network-scripts/ifdown-bnep
/etc/sysconfig/network-scripts/ifup-eth
/etc/sysconfig/network-scripts/ifdown-eth
/etc/sysconfig/network-scripts/ifup-ipv6
/etc/sysconfig/network-scripts/ifdown-ipv6
/etc/sysconfig/network-scripts/ifup-sit
/etc/sysconfig/network-scripts/ifdown-sit
/etc/sysconfig/network-scripts/ifup-tunnel
/etc/sysconfig/network-scripts/ifdown-tunnel
/etc/sysconfig/network-scripts/ifup-aliases
/etc/sysconfig/network-scripts/ifup-ippp
/etc/sysconfig/network-scripts/ifdown-ippp
/etc/sysconfig/network-scripts/ifup-wireless
/etc/sysconfig/network-scripts/ifup-isdn
/etc/sysconfig/network-scripts/ifdown-isdn
/etc/sysconfig/network-scripts/net.hotplug
%ifarch s390 s390x
/etc/sysconfig/network-scripts/ifup-ctc
%endif
%config(noreplace) /etc/networks
/etc/rwtab
%dir /etc/rwtab.d
/etc/statetab
%dir /etc/statetab.d
%if with_upstart
/etc/init/*
%endif
%config /etc/X11/prefdm
%config(noreplace) /etc/inittab
%dir /etc/rc.d
%dir /etc/rc.d/rc[0-9].d
%config(missingok) /etc/rc.d/rc[0-9].d/*
/etc/rc[0-9].d
/etc/rc
%dir /etc/rc.d/init.d
/etc/rc.local
/etc/rc.sysinit
/etc/rc.d/init.d/*
/etc/rc.d/rc
%config(noreplace) /etc/rc.d/rc.local
/etc/rc.d/rc.sysinit
%config(noreplace) /etc/sysctl.conf
%dir /etc/sysctl.d
%exclude /etc/profile.d/debug*
/etc/profile.d/*
/usr/sbin/sys-unconfig
/sbin/setsysfont
/bin/ipcalc
/bin/usleep
%attr(4755,root,root) /usr/sbin/usernetctl
/sbin/consoletype
/sbin/fstab-decode
/sbin/genhostid
/sbin/getkey
/sbin/securetty
/sbin/sushell
%attr(2755,root,root) /sbin/netreport
/lib/udev/rules.d/*
/lib/udev/detect_failover
/lib/udev/rename_device
/lib/udev/console_init
/lib/udev/console_check
/lib/udev/udev-kvm-check
/sbin/service
/sbin/ppp-watch
%{_mandir}/man*/*
%dir %attr(775,root,root) /var/run/netreport
%dir /etc/ppp
%dir /etc/ppp/peers
/etc/ppp/ip-up
/etc/ppp/ip-down
/etc/ppp/ip-up.ipv6to4
/etc/ppp/ip-down.ipv6to4
/etc/ppp/ipv6-up
/etc/ppp/ipv6-down
%dir /etc/NetworkManager
%dir /etc/NetworkManager/dispatcher.d
/etc/NetworkManager/dispatcher.d/00-netreport
/etc/NetworkManager/dispatcher.d/05-netfs
%doc sysconfig.txt sysvinitfiles static-routes-ipv6 ipv6-tunnel.howto ipv6-6to4.howto changes.ipv6 COPYING README-init
/var/lib/stateless
%ghost %attr(0600,root,utmp) /var/log/btmp
%ghost %attr(0664,root,utmp) /var/log/wtmp
%ghost %attr(0664,root,utmp) /var/run/utmp
%ghost %attr(0644,root,root) /etc/sysconfig/kvm
%files -n debugmode
%defattr(-,root,root)
%config(noreplace) /etc/sysconfig/debug
/etc/profile.d/debug*
# custom patches
%patch11 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1

Could someone help here?

My answer:


Look at the end of your spec file. It has several lines beginning with %patch. But because these appear in the %files section of the spec file, they are interpreted as file paths, and such paths do not exist.

Patches need to be specified above, in the section containing all the other patches, after %setup.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.