[SCM] libdvdcss-pkg/master: unwrap and unindent code (simplification)

onlyjob at users.alioth.debian.org onlyjob at users.alioth.debian.org
Sun May 19 13:00:17 UTC 2013


The following commit has been merged in the master branch:
commit 4447123d95253a2dedb44aafb524307518ac99fa
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date:   Sun May 19 20:19:02 2013 +1000

    unwrap and unindent code (simplification)

diff --git a/debian/b-i_libdvdcss.sh b/debian/b-i_libdvdcss.sh
index 25230c0..e9e0843 100755
--- a/debian/b-i_libdvdcss.sh
+++ b/debian/b-i_libdvdcss.sh
@@ -11,76 +11,74 @@ PKGG="libdvdcss2"
 PKGG_ALL="libdvdcss2 libdvdcss-dev"
 
 ## $RET contains "true" if build is allowed in debconf.
-if [ "$RET" = "true" ]; then
-    ## get installed installer-package version
-    VER="$(dpkg --status ${PKGI} 2>/dev/null | perl -0ne 'print $1 if m{Version:\s+([0-9.-]+)}sm;')"
+[ "$RET" = "true" ] || exit 0
 
-    ## get installed guest-package version
-    VERG="$(dpkg --status ${PKGG} 2>/dev/null | perl -0ne 'print $1 if m{^Status:\s+install\s+ok\s+installed}sm and m{^Version:\s+([0-9.-]+)}sm;')"
+## get installed installer-package version
+VER="$(dpkg --status ${PKGI} 2>/dev/null | perl -0ne 'print $1 if m{Version:\s+([0-9.-]+)}sm;')"
 
-    ## check if our version of guest package is installed.
-    ## installer and guest packages versions are expected to match so
-    ## installer-package version is mangled to append '~local' to debian revision number
-    dpkg --compare-versions "${VER}~local" gt "${VERG}"
-    if [ $? = 0 ]; then
+## get installed guest-package version
+VERG="$(dpkg --status ${PKGG} 2>/dev/null | perl -0ne 'print $1 if m{^Status:\s+install\s+ok\s+installed}sm and m{^Version:\s+([0-9.-]+)}sm;')"
 
-        ## we have newer package to build/install
+## check if our version of guest package is installed.
+## installer and guest packages versions are expected to match so
+## installer-package version is mangled to append '~local' to debian revision number
+dpkg --compare-versions "${VER}~local" gt "${VERG}"
+[ $? = 0 ] || exit 0
 
-        ## Check if this very version of guest package was previously installed.
-        ## self-disable in debconf settings, if user manually removed it.
-        if [ -f "${DIR}/${PKGG}-${VER}.is-installed" ]; then
-            rm "${DIR}/${PKGG}-${VER}.is-installed"
-            db_set ${PKGI}/build false
-            echo "${PKGI}: Package ${PKGG}-${VER} was removed, stop processing..."
-            exit 0
-        fi
+## we have newer package to build/install
 
-        ## check if DPKG database is locked
-        dpkg -i /dev/zero 2>/dev/null
-        if [ "$?" -eq 2 ]; then
-            echo "${PKGI}: dpkg database is locked. Package(s) will be built and installed by dpkg post-invoke handler."
-            echo "${PKGI}: post-invoke handler will take control after next apt-get operation i.e. install/remove/upgrade etc."
-            echo "${PKGI}: Alternatively you may use command \"sudo dpkg-reconfigure ${PKGI}\"."
-            exit 0
-        fi
+## Check if this very version of guest package was previously installed.
+## self-disable in debconf settings, if user manually removed it.
+if [ -f "${DIR}/${PKGG}-${VER}.is-installed" ]; then
+    rm "${DIR}/${PKGG}-${VER}.is-installed"
+    db_set ${PKGI}/build false
+    echo "${PKGI}: Package ${PKGG}-${VER} was removed, stop processing..."
+    exit 0
+fi
 
-        set -e
-        mkdir -p ${DIR} || true
+## check if DPKG database is locked
+dpkg -i /dev/zero 2>/dev/null
+if [ "$?" -eq 2 ]; then
+    echo "${PKGI}: dpkg database is locked. Package(s) will be built and installed by dpkg post-invoke handler."
+    echo "${PKGI}: post-invoke handler will take control after next apt-get operation i.e. install/remove/upgrade etc."
+    echo "${PKGI}: Alternatively you may use command \"sudo dpkg-reconfigure ${PKGI}\"."
+    exit 0
+fi
 
-        ## download orig.tar
-        echo "${PKGI}: Downloading orig source..."
-        cd ${DIR} \
-        && /usr/share/${PKGI}/debian/rules get-orig-source
-        echo "${PKGI}: Checking integrity..."
-        md5sum --check --strict --quiet /usr/share/${PKGI}/*_${VER%%-*}.orig.tar.*.md5 \
-        || (
-            rm -fv ${DIR}/*_${VER%%-*}.orig.tar.*
-            echo "Source archive failed integrity check so it was deleted. Please try again."
-            false
-           )
+set -e
+mkdir -p ${DIR} || true
 
-        ## preparing to build
-        echo "${PKGI}: Unpacking and configuring..."
-        [ -d "${DIR}/build" ] && rm -rf ${DIR}/build
-        mkdir ${DIR}/build
-        cd ${DIR}/build
-        tar xf ../*_${VER%%-*}.orig.tar.* --strip-components 1
-        cp -r /usr/share/${PKGI}/debian .
-        ## append '~local' to debian revision
-        perl -pi -e "s{[\d.]+-\d+\K}{~local}" debian/changelog
-        ## inject ${PKGI} to guest package Depends to uninstall generated packages on installer remove.
-        perl -pi -e "s{^Depends:\K}{ ${PKGI}, }mg" debian/control
+## download orig.tar
+echo "${PKGI}: Downloading orig source..."
+cd ${DIR} \
+&& /usr/share/${PKGI}/debian/rules get-orig-source
+echo "${PKGI}: Checking integrity..."
+md5sum --check --strict --quiet /usr/share/${PKGI}/*_${VER%%-*}.orig.tar.*.md5 \
+|| (
+    rm -fv ${DIR}/*_${VER%%-*}.orig.tar.*
+    echo "Source archive failed integrity check so it was deleted. Please try again."
+    false
+    )
 
-        ## building package
-        echo "${PKGI}: Building the package..."
-        dpkg-buildpackage -b -uc
+## preparing to build
+echo "${PKGI}: Unpacking and configuring..."
+[ -d "${DIR}/build" ] && rm -rf ${DIR}/build
+mkdir ${DIR}/build
+cd ${DIR}/build
+tar xf ../*_${VER%%-*}.orig.tar.* --strip-components 1
+cp -r /usr/share/${PKGI}/debian .
+## append '~local' to debian revision
+perl -pi -e "s{[\d.]+-\d+\K}{~local}" debian/changelog
+## inject ${PKGI} to guest package Depends to uninstall generated packages on installer remove.
+perl -pi -e "s{^Depends:\K}{ ${PKGI}, }mg" debian/control
 
-        ## installing
-        echo "${PKGI}: Installing..."
-        dpkg --install /usr/src/${PKGI}/*_${VER}~local_*.deb \
-        && touch "${DIR}/${PKGG}-${VER}.is-installed" \
-        || echo "${PKGI}: dpkg database is probably locked. Installation will be performed later from dpkg post-invoke handler."
-    fi
-fi
+## building package
+echo "${PKGI}: Building the package..."
+dpkg-buildpackage -b -uc
 
+## installing
+echo "${PKGI}: Installing..."
+dpkg --install /usr/src/${PKGI}/*_${VER}~local_*.deb \
+&& touch "${DIR}/${PKGG}-${VER}.is-installed" \
+|| echo "${PKGI}: dpkg database is probably locked. Installation will be performed later from dpkg post-invoke handler."
 

-- 
libdvdcss-pkg packaging



More information about the pkg-multimedia-commits mailing list