Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit e6e1158

Browse files
committed
pm/dpkg/pack: add error handling for procedures
1 parent 2ba39e5 commit e6e1158

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

pm/dpkg/pack

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,23 @@ fi
7272

7373
instSIZE=$(du -s "$PKGDIR" | cut -f 1)
7474

75-
mkdir -p "$PKGDIR"/DEBIAN
76-
cp -rl "$SRCDIR"/abscripts/* "$PKGDIR"/DEBIAN
75+
mkdir -p "$PKGDIR"/DEBIAN \
76+
|| abdie "Failed to create DEBIAN directory for .deb metadata: $?."
77+
cp -rl "$SRCDIR"/abscripts/* "$PKGDIR"/DEBIAN \
78+
|| abdie "Failed to copy .deb scripts: $?."
7779
if [ -e "$SRCDIR/autobuild/$ARCH/conffiles" ]; then
78-
cp -l "$SRCDIR"/autobuild/"$ARCH"/conffiles "$PKGDIR"/DEBIAN 2>/dev/null
80+
cp -l "$SRCDIR"/autobuild/"$ARCH"/conffiles "$PKGDIR"/DEBIAN 2>/dev/null \
81+
|| abdie "Failed to copy conffiles: $?."
7982
elif [ -e "$SRCDIR/autobuild/conffiles" ]; then
80-
cp -l "$SRCDIR"/autobuild/conffiles "$PKGDIR"/DEBIAN 2>/dev/null
83+
cp -l "$SRCDIR"/autobuild/conffiles "$PKGDIR"/DEBIAN 2>/dev/null \
84+
|| abdie "Failed to copy conffiles: $?."
8185
fi
8286
if [ -e "$SRCDIR/autobuild/triggers" ]; then
83-
cp -l "$SRCDIR"/autobuild/triggers "$PKGDIR"/DEBIAN 2>/dev/null
87+
cp -l "$SRCDIR"/autobuild/triggers "$PKGDIR"/DEBIAN 2>/dev/null \
88+
|| abdie "Failed to copy triggers: $?."
8489
fi
85-
dpkgctrl > "$PKGDIR"/DEBIAN/control &&
90+
dpkgctrl > "$PKGDIR"/DEBIAN/control \
91+
|| abdie "Failed to generate .deb control metadata: $?."
8692
dpkg-deb $DPKGDEBCOMP -b "$PKGDIR" "${PKGNAME}_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb" \
8793
|| abdie "Failed to package .deb package: $?."
8894
mv "$PKGDIR"/DEBIAN "$SRCDIR"/ab-dpkg
@@ -91,10 +97,12 @@ if bool "$ABSPLITDBG"; then
9197
# Check whether there are any symbol files getting genereted
9298
if [[ -d "${SYMDIR}" ]] && [ "$(ls -A $SYMDIR)" ]; then
9399
# Actually pack them
94-
mkdir -p "$SYMDIR"/DEBIAN
95-
dpkgctrl_dbg_sym > "$SYMDIR"/DEBIAN/control &&
100+
mkdir -p "$SYMDIR"/DEBIAN \
101+
|| abdie "Failed to create DEBIAN directory for -dbg .deb metadata: $?."
102+
dpkgctrl_dbg_sym > "$SYMDIR"/DEBIAN/control \
103+
|| abdie "Failed to generate -dbg .deb control metadata: $?."
96104
dpkg-deb $DPKGDEBCOMP -b "$SYMDIR" "${PKGNAME}-dbg_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb" \
97-
|| echo "Failed to build debug .deb package: $?."
105+
|| abdie "Failed to build debug .deb package: $?."
98106
export ABPACKAGE+="${PKGNAME}-dbg_${PKGVER}-${PKGREL}_${ABHOST%%\/*}.deb "
99107
else
100108
abdie "ABSPLITDBG is set, but we can't find any symbol files."

0 commit comments

Comments
 (0)