[Build]: support to collect version when purging debian package (#10287)
Why I did it support to collect version when purging debian package Support to collect version multiple times How I did it Add the collection action before purging.
This commit is contained in:
parent
b93080d246
commit
b1105af83c
@ -20,6 +20,11 @@ if [ "$INSTALL" == y ]; then
|
||||
[ "$lock_result" == y ] && release_apt_installation_lock
|
||||
exit $command_result
|
||||
else
|
||||
if [[ "$1" == "purge" || "$@" == *" purge "* ]]; then
|
||||
# When running the purge command, collect the debian versions
|
||||
dpkg-query -W -f '${Package}==${Version}\n' >> $POST_VERSION_PATH/purge-versions-deb
|
||||
chmod a+wr $POST_VERSION_PATH/purge-versions-deb
|
||||
fi
|
||||
$REAL_COMMAND "$@"
|
||||
fi
|
||||
|
||||
|
@ -1,14 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/local/share/buildinfo/scripts/buildinfo_base.sh
|
||||
|
||||
TARGET_PATH=$1
|
||||
[ -z "$TARGET_PATH" ] && TARGET_PATH=$POST_VERSION_PATH
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
DIST=$(grep VERSION_CODENAME /etc/os-release | cut -d= -f2)
|
||||
([ -z "$DIST" ] && grep -q jessie /etc/os-release) && DIST=jessie
|
||||
|
||||
mkdir -p $TARGET_PATH
|
||||
chmod a+rw $TARGET_PATH
|
||||
dpkg-query -W -f '${Package}==${Version}\n' > "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}"
|
||||
([ -x "/usr/local/bin/pip2" ] || [ -x "/usr/bin/pip2" ]) && pip2 freeze > "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}"
|
||||
([ -x "/usr/local/bin/pip3" ] || [ -x "/usr/bin/pip3" ]) && pip3 freeze > "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}"
|
||||
|
||||
dpkg-query -W -f '${Package}==${Version}\n' >> "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}"
|
||||
([ -x "/usr/local/bin/pip2" ] || [ -x "/usr/bin/pip2" ]) && pip2 freeze >> "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}"
|
||||
([ -x "/usr/local/bin/pip3" ] || [ -x "/usr/bin/pip3" ]) && pip3 freeze >> "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}"
|
||||
|
||||
## Add the the packages purged
|
||||
[ -f $POST_VERSION_PATH/purge-versions-deb ] && cat $POST_VERSION_PATH/purge-versions-deb >> "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}"
|
||||
|
||||
## Print the unique and sorted result
|
||||
sort -u "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}"
|
||||
sort -u "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}"
|
||||
sort -u "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}"
|
||||
|
||||
exit 0
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
. /usr/local/share/buildinfo/scripts/buildinfo_base.sh
|
||||
|
||||
[ -d $POST_VERSION_PATH ] && rm -rf $POST_VERSION_PATH
|
||||
|
||||
# Collect the version files
|
||||
collect_version_files $POST_VERSION_PATH
|
||||
|
||||
|
@ -8,6 +8,8 @@ mkdir -p $BUILD_VERSION_PATH
|
||||
mkdir -p $LOG_PATH
|
||||
|
||||
[ -d $PRE_VERSION_PATH ] && rm -rf $PRE_VERSION_PATH
|
||||
[ -d $POST_VERSION_PATH ] && rm -rf $POST_VERSION_PATH
|
||||
mkdir -p $POST_VERSION_PATH
|
||||
collect_version_files $PRE_VERSION_PATH
|
||||
symlink_build_hooks
|
||||
set_reproducible_mirrors
|
||||
|
Loading…
Reference in New Issue
Block a user