Skip to content

Commit

Permalink
Merge branch 'content'
Browse files Browse the repository at this point in the history
* content:
  bee-query: Add support for new CONTENT file
  bee-check: Add support for new CONTENT file
  hooks: Add support for new CONTENT file
  bee-install: Add support for new CONTENT file
  compatibility: New FILES -> CONTENT converter
  • Loading branch information
mariux committed May 22, 2012
2 parents 8ff498a + 8a73300 commit c399152
Show file tree
Hide file tree
Showing 17 changed files with 172 additions and 48 deletions.
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ PROGRAMS_PERL=beefind.pl
HELPER_BEE_SHELL=bee-init bee-check bee-remove bee-install bee-list bee-query bee-download bee-update
HELPER_BEE_C=bee-dep

HELPER_SHELL=compat-filesfile2contentfile

LIBRARY_SHELL=beelib.config.sh

BUILDTYPES=configure cmake autogen perl-module perl-module-makemaker make python-module
Expand Down Expand Up @@ -88,7 +90,7 @@ compat: compat-bashlt4
compat-bashlt4: ${COMPAT_BASHLT4}
$(call quiet-command, sed ${sed-compat-bashlt4} -i ${COMPAT_BASHLT4}, "COMPAT $^" )

SHELLSCRIPTS=$(PROGRAMS_SHELL) $(HELPER_BEE_SHELL)
SHELLSCRIPTS=$(PROGRAMS_SHELL) $(HELPER_BEE_SHELL) $(HELPER_SHELL)

BEEVERSION_OBJECTS=beeversion.o bee_version_parse.o bee_version_compare.o bee_version_output.o
BEESEP_OBJECTS=beesep.o
Expand Down Expand Up @@ -144,7 +146,7 @@ beegetopt: $(addprefix src/, ${BEEGETOPT_OBJECTS})
$(call quiet-command,sed ${sed-rules} $< >$@,"SED $@")

clean:
$(call quiet-command,rm -f $(addsuffix .sh,${SHELLSCRIPTS}) $(LIBRARY_SHELL),"CLEAN <various>.sh")
$(call quiet-command,rm -f $(addsuffix .sh,${SHELLSCRIPTS}) $(LIBRARY_SHELL) $(HELPER_SHELL),"CLEAN <various>.sh")
$(call quiet-command,rm -f ${PROGRAMS_PERL},"CLEAN ${PROGRAMS_PERL}")
$(call quiet-command,rm -f ${PROGRAMS_C},"CLEAN ${PROGRAMS_C}")
$(call quiet-command,rm -f ${HELPER_BEE_C},"CLEAN ${HELPER_BEE_C}")
Expand All @@ -154,7 +156,7 @@ clean:

install: install-core install-config

install-core: build install-man install-hooks install-buildtypes install-beeshlib install-tools install-bin
install-core: build install-man install-hooks install-buildtypes install-beeshlib install-tools install-helper install-bin

install-bin: $(addprefix ${DESTDIR}${BINDIR}/,${PROGRAMS_PERL} ${PROGRAMS_C} ${PROGRAMS_SHELL})

Expand All @@ -178,6 +180,14 @@ ${DESTDIR}${LIBEXECDIR}/bee/bee.d/%: %.sh install-dir-tools
${DESTDIR}${LIBEXECDIR}/bee/bee.d/%: % install-dir-tools
$(call quiet-install,0755,$<,$@)

install-helper: $(addprefix ${DESTDIR}${LIBEXECDIR}/bee/,${HELPER_SHELL})

install-dir-helper:
$(call quiet-installdir,0755,${DESTDIR}${LIBEXECDIR}/bee)

${DESTDIR}${LIBEXECDIR}/bee/%: %.sh install-dir-helper
$(call quiet-install,0755,$<,$@)

install-beeshlib: $(addprefix ${DESTDIR}${LIBEXECDIR}/bee/,${LIBRARY_SHELL})

install-dir-beeshlib:
Expand Down
2 changes: 1 addition & 1 deletion hooks/gconf-install-schemas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fi

case "${action}" in
"post-install")
for s in $(grep -o "/.*gconf.*\.schemas" ${BEE_METADIR}/${pkg}/FILES 2>/dev/null) ; do
for s in $(grep -o "/.*gconf.*\.schemas" ${BEE_METADIR}/${pkg}/CONTENT 2>/dev/null) ; do
echo "installing schema '${s##*/}'"
${GCONFTOOL} --install-schema-file ${s} >/dev/null
done
Expand Down
2 changes: 1 addition & 1 deletion hooks/gdk-pixbuf-query-loaders.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if [ -z "${gdk_pixbuf_moduledir}" -o -z "${gdk_pixbuf_cache_file}" ]; then
exit 0
fi

if grep -q "file=${gdk_pixbuf_moduledir}" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${gdk_pixbuf_moduledir}" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
rm -f ${gdk_pixbuf_cache_file}
Expand Down
2 changes: 1 addition & 1 deletion hooks/glib-compile-schemas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

for dir in ${XDG_DATA_DIRS//:/ } ; do
schema_dir=${dir}/glib-2.0/schemas
if grep -q "file=${schema_dir}" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${schema_dir}" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
rm -f ${schema_dir}/gschemas.compiled
Expand Down
2 changes: 1 addition & 1 deletion hooks/gtk-update-icon-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

for dir in ${XDG_DATA_DIRS//:/ } ; do
icon_base_dir=${dir}/icons
for line in $(grep -h "file=${icon_base_dir}/.*/index.theme" ${BEE_METADIR}/${pkg}/FILES) ; do
for line in $(grep -h "file=${icon_base_dir}/.*/index.theme" ${BEE_METADIR}/${pkg}/CONTENT) ; do
eval $(beesep ${line})
icon_dir=${file%%/index.theme}
case "${action}" in
Expand Down
4 changes: 2 additions & 2 deletions hooks/info-dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ fi

case "${action}" in
"post-install")
for i in $(grep -o "${PKG_INFODIR}.*\.info.*" ${BEE_METADIR}/${pkg}/FILES 2>/dev/null) ; do
for i in $(grep -o "${PKG_INFODIR}.*\.info.*" ${BEE_METADIR}/${pkg}/CONTENT 2>/dev/null) ; do
echo "adding ${i##*/} to ${DIRFILE}"
${INSTALLINFO} ${i} ${DIRFILE} >/dev/null
done
;;
"pre-remove")
for i in $(grep -o "${PKG_INFODIR}.*\.info.*" ${BEE_METADIR}/${pkg}/FILES 2>/dev/null) ; do
for i in $(grep -o "${PKG_INFODIR}.*\.info.*" ${BEE_METADIR}/${pkg}/CONTENT 2>/dev/null) ; do
echo "removing ${i##*/} from ${DIRFILE}"
${INSTALLINFO} --delete ${i} ${DIRFILE} >/dev/null
done
Expand Down
2 changes: 1 addition & 1 deletion hooks/ldconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if ! which ldconfig >/dev/null 2>&1 ; then
exit 0
fi

if grep -q "/lib/" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "/lib/" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
ldconfig
Expand Down
4 changes: 2 additions & 2 deletions hooks/mandb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fi
for man_dir in $(beeuniq ${man_dirs//:/ }) ; do
case "${action}" in
"post-install")
for line in $(grep "file=${man_dir}" ${BEE_METADIR}/${pkg}/FILES) ; do
for line in $(grep "file=${man_dir}" ${BEE_METADIR}/${pkg}/CONTENT) ; do
eval $(beesep ${line})
if [ -f "${file}" -o -L "${file}" ] ; then
if [ -f "/var/cache/man/index.db" ] ; then
Expand All @@ -58,7 +58,7 @@ for man_dir in $(beeuniq ${man_dirs//:/ }) ; do
done
;;
"post-remove")
if grep -q "file=${man_dir}" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${man_dir}" ${BEE_METADIR}/${pkg}/CONTENT ; then
echo "updating manual index cache for ${man_dir} .."
mandb -q ${man_dir}
fi
Expand Down
2 changes: 1 addition & 1 deletion hooks/mkfontdir-mkfontscale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function update_fonts() {

for dir in ${XDG_DATA_DIRS//:/ } ; do
font_base_dir=${dir}/fonts
if grep -q "file=${font_base_dir}" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${font_base_dir}" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
clean_font_dirs ${font_base_dir}
Expand Down
2 changes: 1 addition & 1 deletion hooks/systemd-tmpfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fi

case "${action}" in
"post-install")
if egrep --max-count=1 "file=(/etc|/lib|/usr/lib)/tmpfiles.d" ${BEE_METADIR}/${pkg}/FILES >/dev/null 2>&1 ; then
if egrep --max-count=1 "file=(/etc|/lib|/usr/lib)/tmpfiles.d" ${BEE_METADIR}/${pkg}/CONTENT >/dev/null 2>&1 ; then
systemd-tmpfiles --create
fi
;;
Expand Down
2 changes: 1 addition & 1 deletion hooks/update-desktop-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

for dir in ${XDG_DATA_DIRS//:/ } ; do
desktop_dir=${dir}/applications
if grep -q "file=${desktop_dir}/.*\.desktop" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${desktop_dir}/.*\.desktop" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
rm -f ${desktop_dir}/mimeinfo.cache
Expand Down
2 changes: 1 addition & 1 deletion hooks/update-mime-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

for dir in ${XDG_DATA_DIRS//:/ } ; do
mime_dir=${dir}/mime
if grep -q "file=${mime_dir}/packages" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${mime_dir}/packages" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
update-mime-database ${mime_dir}
Expand Down
31 changes: 21 additions & 10 deletions src/bee-check.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@ pkg_check_deps() {
fi

if [ "${installed}" ] ; then
for i in ${installed} ; do
do_check_deps "${i}"
for pkg in ${installed} ; do
if [ ! -e "${BEE_METADIR}/${pkg}/CONTENT" ] ; then
${BEE_LIBEXECDIR}/bee/compat-filesfile2contentfile \
${BEE_METADIR}/${pkg}/FILES \
>${BEE_METADIR}/${pkg}/CONTENT
fi

do_check_deps "${pkg}"
done
fi
exit 0
Expand All @@ -83,8 +89,13 @@ pkg_check() {
fi

if [ "${installed}" ] ; then
for i in ${installed} ; do
do_check "${i}"
for pkg in ${installed} ; do
if [ ! -e "${BEE_METADIR}/${pkg}/CONTENT" ] ; then
${BEE_LIBEXECDIR}/bee/compat-filesfile2contentfile \
${BEE_METADIR}/${pkg}/FILES \
>${BEE_METADIR}/${pkg}/CONTENT
fi
do_check "${pkg}"
done
return 0
fi
Expand Down Expand Up @@ -177,7 +188,7 @@ do_check_deps_of_file() {
##
do_check_deps() {
local pkg=${1}
local filesfile=${BEE_METADIR}/${pkg}/FILES
local filesfile=${BEE_METADIR}/${pkg}/CONTENT

echo -e "[${pkg}]"

Expand Down Expand Up @@ -208,9 +219,9 @@ do_check_deps() {
echo " size = ${size}"
echo " mtime = ${mtime}"

if [ "${md5}" = "link" ] ; then
if [ "${type}" = "symlink" ] ; then
echo " symlink = ${symlink}"
elif [ "${md5}" != "directory" ] ; then
elif [ "${type}" = "regular" -o "${type}" = "hardlink" ] ; then
echo " md5 = ${md5}"
fi

Expand All @@ -225,7 +236,7 @@ do_check_deps() {
do_check() {
local pkg=${1}

local filesfile=${BEE_METADIR}/${pkg}/FILES
local filesfile=${BEE_METADIR}/${pkg}/CONTENT

echo "checking ${pkg} .."

Expand All @@ -241,7 +252,7 @@ do_check() {
continue
fi

if [ "${md5}" = "link" ] ; then
if [ "${type}" = "symlink" ] ; then
if [ ! -h "${file}" ] ; then
echo " [changed] <was symlink to ${symlink}> ${file}"
else
Expand All @@ -254,7 +265,7 @@ do_check() {
continue
fi

if [ "${md5}" = "directory" ] ; then
if [ "${type}" = "directory" ] ; then
if [ ! -d "${file}" ] ; then
echo " [changed] <was directory> ${file}"
fi
Expand Down
7 changes: 7 additions & 0 deletions src/bee-install.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,19 @@ function do_install_file() {
start_cmd tar -x --dereference -${vv}Pf ${file} \
${changedir} \
--transform="s,^FILES$,${BEE_METADIR}/${pkg}/FILES," \
--transform="s,^CONTENT$,${BEE_METADIR}/${pkg}/CONTENT," \
--transform="s,^BUILD$,${BEE_METADIR}/${pkg}/${beefile}," \
--transform="s,^META$,${BEE_METADIR}/${pkg}/META," \
--transform="s,^PATCHES,${BEE_METADIR}/${pkg}/PATCHES," \
--transform="s,^DEPENDENCIES$,${BEE_METADIR}/${pkg}/DEPENDENCIES," \
--show-transformed-names

if [ ! -e "${BEE_METADIR}/${pkg}/CONTENT" ] ; then
${BEE_LIBEXECDIR}/bee/compat-filesfile2contentfile \
${BEE_METADIR}/${pkg}/FILES \
>${BEE_METADIR}/${pkg}/CONTENT
fi

run_hooks post-install ${pkg}
${BEE_LIBEXECDIR}/bee/bee.d/bee-check -d ${pkg} > ${BEE_METADIR}/${pkg}/DEPENDENCIES
${BEE_LIBEXECDIR}/bee/bee.d/bee-dep update ${pkg}
Expand Down
22 changes: 17 additions & 5 deletions src/bee-query.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@ query() {
get_files() {
pkg=${1}

if [ ! -e "${BEE_METADIR}/${pkg}/CONTENT" ] ; then
${BEE_LIBEXECDIR}/bee/compat-filesfile2contentfile \
${BEE_METADIR}/${pkg}/FILES \
>${BEE_METADIR}/${pkg}/CONTENT
fi

for s in "" "${BEE_METADIR}" ; do
ff="${s}/${pkg}/FILES"
ff="${s}/${pkg}/CONTENT"
if [ -e "${ff}" ] ; then
for line in $(cat ${ff}) ; do
eval $(${BEESEP} ${line})
Expand All @@ -79,10 +85,16 @@ get_files() {
get_pkgs() {
f=$1

for i in $(${BEE_LIBEXECDIR}/bee/bee.d/bee-list --installed) ; do
if egrep -q "file=.*${f}" ${BEE_METADIR}/${i}/FILES ; then
echo ${i}
for line in $(egrep "file=.*${f}" ${BEE_METADIR}/${i}/FILES) ; do
for pkg in $(${BEE_LIBEXECDIR}/bee/bee.d/bee-list --installed) ; do
if [ ! -e "${BEE_METADIR}/${pkg}/CONTENT" ] ; then
${BEE_LIBEXECDIR}/bee/compat-filesfile2contentfile \
${BEE_METADIR}/${pkg}/FILES \
>${BEE_METADIR}/${pkg}/CONTENT
fi

if egrep -q "file=.*${f}" ${BEE_METADIR}/${pkg}/CONTENT ; then
echo ${pkg}
for line in $(egrep "file=.*${f}" ${BEE_METADIR}/${pkg}/CONTENT) ; do
eval $(${BEESEP} ${line})
echo " ${file}"
done
Expand Down
33 changes: 16 additions & 17 deletions src/bee-remove.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,9 @@ pkg_remove_all() {
pkg_remove() {
search=$1

# pattern is absolute path to pkg
if [ -d "${search}" ] ; then
do_remove "${search}"
return
fi

# pattern is a pkg in BEE_METADIR
if [ -d "${BEE_METADIR}/${search}" ] ; then
do_remove ${BEE_METADIR}/${search}
do_remove ${search}
return
fi

Expand All @@ -62,15 +56,21 @@ pkg_remove() {
do_remove() {
pkg=${1}

FILES=$(${BEE_LIBEXECDIR}/bee/bee.d/bee-dep remove --print ${pkg##*/})
if [ ! -e "${BEE_METADIR}/${pkg}/CONTENT" ] ; then
${BEE_LIBEXECDIR}/bee/compat-filesfile2contentfile \
${BEE_METADIR}/${pkg}/FILES \
>${BEE_METADIR}/${pkg}/CONTENT
fi

FILES=$(${BEE_LIBEXECDIR}/bee/bee.d/bee-dep remove --print ${pkg})
if [ $? -ne 0 ] ; then
echo "removal of ${pkg##*/} failed"
echo "removal of ${pkg} failed"
exit 1
fi

[ "${NOOP}" != "yes" ] && run_hooks pre-remove ${pkg}

echo "removing package '${pkg##*/}'"
echo "removing package '${pkg}'"

# removing files
for f in $FILES ; do
Expand All @@ -83,8 +83,8 @@ do_remove() {

[ "${NOOP}" != "yes" ] && run_hooks post-remove ${pkg}

if [ -r "${pkg}/META" ] ; then
. ${pkg}/META
if [ -r "${BEE_METADIR}/${pkg}/META" ] ; then
. "${BEE_METADIR}/${pkg}/META"
fi

# removing empty basedirs
Expand All @@ -97,15 +97,13 @@ do_remove() {
done
fi

#cleaning up meta directory
if [ -d "${pkg}" ] ; then
${NOOP:+echo} rm -fr ${OPT_VERBOSE:+-v} ${pkg}
fi
#cleanup meta directory
${NOOP:+echo} rm -fr ${OPT_VERBOSE:+-v} ${BEE_METADIR}/${pkg}
}

function run_hooks() {
local action=${1}
local pkg=${2##*/}
local pkg=${2}

for t in ${BEE_LIBEXECDIR}/bee/hooks.d/* ; do
${t} ${action} ${pkg}
Expand Down Expand Up @@ -133,6 +131,7 @@ options=$(${BEE_BINDIR}/beegetopt --name bee-remove \
--option verbose/v \
--option help/h \
-- "$@")

if [ $? != 0 ] ; then
usage
exit 1
Expand Down
Loading

0 comments on commit c399152

Please sign in to comment.