summaryrefslogtreecommitdiffstats
path: root/src/remove.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2017-07-22 18:06:12 (EDT)
committer P. J. McDermott <pj@pehjota.net>2017-07-22 18:06:12 (EDT)
commit9217f3869f76d6936e77cec0a1a4d5efd1e97727 (patch)
tree97255d75e43cebc41e7b779b109496e35b9c192e /src/remove.sh
parente0cc4b1883c98145d05a141e06a0392a3181e6e5 (diff)
parent98725484ac7bb96cd2ac6481c8460ceaa06dc4be (diff)
Merge branch 'feature/use-autoconf-automake-shpp-and-shld'
Diffstat (limited to 'src/remove.sh')
-rw-r--r--src/remove.sh85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/remove.sh b/src/remove.sh
new file mode 100644
index 0000000..b580b1b
--- /dev/null
+++ b/src/remove.sh
@@ -0,0 +1,85 @@
+# pro-archman
+# lib/remove.sh
+# Functions for removing packges
+#
+# Copyright (C) 2013 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+remove_source_from_suite()
+{
+ local chan="${1}"
+ local dist="${2}"
+ local source="${3}"
+ local arch=
+ local plat=
+
+ info "$(get_msg 'removing_from_suite')" \
+ "${source}" "${chan}" "${dist}"
+
+ while read -r arch plat; do
+ remove_packages_from_suite_archplat \
+ "${chan}" "${dist}" "${arch}" "${plat}" "${source}"
+ done <<-EOF
+ $(db_get_archplats "${chan}" "${dist}" "${source}")
+ EOF
+
+ db_del_srcver "${chan}" "${dist}" "${source}"
+
+ return 0
+}
+
+remove_packages_from_suite_archplat()
+{
+ local chan="${1}"
+ local dist="${2}"
+ local arch="${3}"
+ local plat="${4}"
+ local source="${5}"
+ local binver=
+ local refs=
+ local size=
+ local sect=
+ local pkg=
+ local file=
+
+ info_v "$(get_msg 'removing_from_suite_archplat')" \
+ "${source}" "${chan}" "${dist}" "${arch}" "${plat}"
+
+ binver="$(db_get_binver "${chan}" "${dist}" "${arch}" "${plat}" \
+ "${source}")"
+ if [ "x${binver}" = 'x' ]; then
+ return 0
+ fi
+ db_del_binver "${chan}" "${dist}" "${arch}" "${plat}" "${source}"
+ refs=$(db_dec_references "${arch}" "${plat}" "${source}" "${binver}")
+
+ while read -r size sect pkg; do
+ feed_remove_package "${chan}" "${dist}" "${arch}" "${plat}" \
+ "${sect}" "${pkg}"
+ if [ ${refs} -eq 0 ]; then
+ file="pool/$(hash_name "${source}")/${source}"
+ file="${file}/${pkg}_${binver}_${arch}_${plat}.opk"
+ mark_pool_garbage "${file}"
+ fi
+ done <<-EOF
+ $(db_get_packages "${arch}" "${plat}" "${source}" "${binver}")
+ EOF
+
+ if [ ${refs} -eq 0 ]; then
+ db_del_packages "${arch}" "${plat}" "${source}" "${binver}"
+ fi
+
+ return 0
+}