1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-11 03:54:59 -05:00

makepkg: split message functions into libmakepkg

This performs all the needed work for libmakepkg to be included in
tarballs, installed into the correct place, and read into makepkg.

Also change the install root for libmakepkg to an architecture independant
location.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2015-01-27 00:45:47 +10:00
parent 9917930ae1
commit 7885931c96
6 changed files with 125 additions and 30 deletions

View File

@ -28,7 +28,8 @@ EXTRA_DIST = \
pacman-optimize.sh.in \
pkgdelta.sh.in \
repo-add.sh.in \
$(LIBRARY)
$(LIBRARY) \
$(LIBMAKEPKG_DIST)
LIBRARY = \
library/output_format.sh \
@ -37,10 +38,23 @@ LIBRARY = \
library/size_to_human.sh \
library/term_colors.sh
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(bin_SCRIPTS)
libmakepkgdir = $(datarootdir)/makepkg
libmakepkgdir = $(libdir)/makepkg
LIBMAKEPKGDIRS = \
util
LIBMAKEPKG = \
libmakepkg/util/message.sh
LIBMAKEPKG_IN = \
libmakepkg/util.sh
LIBMAKEPKG_DIST = \
$(LIBMAKEPKG) \
$(addsuffix .in, $(LIBMAKEPKG_IN))
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(bin_SCRIPTS) $(LIBMAKEPKG_IN)
clean-local:
$(AM_V_at)$(RM) -r .lib
@ -87,10 +101,18 @@ $(OURSCRIPTS): Makefile
$(AM_V_at)chmod +x,a-w $@
@$(BASH_SHELL) -O extglob -n $@
$(LIBMAKEPKG_IN): %: %.in Makefile
$(AM_V_at)$(RM) $@
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)test -f $(srcdir)/$@.in && $(edit) $(srcdir)/$@.in >$@
$(AM_V_at)chmod a-w $@
@$(BASH_SHELL) -O extglob -n $@
makepkg: \
$(srcdir)/makepkg.sh.in \
$(srcdir)/makepkg-wrapper.sh.in \
$(srcdir)/library/parseopts.sh
$(srcdir)/library/parseopts.sh \
$(LIBMAKEPKG_IN)
makepkg-template: \
$(srcdir)/makepkg-template.pl.in \
@ -150,6 +172,15 @@ install-exec-hook:
cd $(DESTDIR)$(bindir) && \
$(RM) makepkg makepkg-wrapper
$(INSTALL) .lib/makepkg $(DESTDIR)$(bindir)/makepkg
for dir in $(LIBMAKEPKGDIRS); do \
$(MKDIR_P) $(DESTDIR)$(libmakepkgdir)/$$dir; \
done
for lib in $(LIBMAKEPKG); do \
$(INSTALL) $(srcdir)/$$lib $(DESTDIR)$(libmakepkgdir)/$${lib#libmakepkg}; \
done
for lib in $(LIBMAKEPKG_IN); do \
$(INSTALL) $$lib $(DESTDIR)$(libmakepkgdir)/$${lib#libmakepkg}; \
done
cd $(DESTDIR)$(bindir) && \
$(RM) repo-elephant && \
( $(LN_S) repo-add repo-elephant || \
@ -164,5 +195,11 @@ install-exec-hook:
uninstall-hook:
cd $(DESTDIR)$(bindir) && \
$(RM) repo-remove repo-elephant
for lib in $(LIBMAKEPKG) $(LIBMAKEPKG_IN); do \
$(RM) $(DESTDIR)$(libmakepkgdir)/$${lib#libmakepkg}; \
done
for dir in $(LIBMAKEPKGDIRS); do \
$(RM) -r $(DESTDIR)$(libmakepkgdir)/$$dir; \
done
# vim:set noet:

1
scripts/libmakepkg/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
util.sh

View File

@ -0,0 +1,28 @@
#!/bin/bash
#
# util.sh - utility functions for makepkg
#
# Copyright (c) 2015 Pacman Development Team <pacman-dev@archlinux.org>
#
# 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 2 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/>.
#
[ -n "$LIBMAKEPKG_UTIL_SH" ] && return
LIBMAKEPKG_UTIL_SH=1
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
for lib in "$LIBRARY/util/"*.sh; do
source "$lib"
done

View File

@ -0,0 +1,49 @@
#!/bin/bash
#
# message.sh - functions for outputting messages in makepkg
#
# Copyright (c) 2006-2015 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
#
# 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 2 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/>.
#
[ -n "$LIBMAKEPKG_UTIL_MESSAGE_SH" ] && return
LIBMAKEPKG_UTIL_MESSAGE_SH=1
plain() {
local mesg=$1; shift
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
msg() {
local mesg=$1; shift
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
msg2() {
local mesg=$1; shift
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
warning() {
local mesg=$1; shift
printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
error() {
local mesg=$1; shift
printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}

View File

@ -100,31 +100,10 @@ shopt -s extglob
### SUBROUTINES ###
plain() {
local mesg=$1; shift
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
msg() {
local mesg=$1; shift
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
msg2() {
local mesg=$1; shift
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
warning() {
local mesg=$1; shift
printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
error() {
local mesg=$1; shift
printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
# Import libmakepkg
for lib in "$LIBRARY"/*.sh; do
source "$lib"
done
##
# Special exit call for traps, Don't print any error messages when inside,

View File

@ -8,5 +8,6 @@ scripts/pacman-key.sh.in
scripts/pacman-optimize.sh.in
scripts/pkgdelta.sh.in
scripts/repo-add.sh.in
scripts/libmakepkg/util/message.sh
scripts/library/output_format.sh
scripts/library/parseopts.sh