1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -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 \ pacman-optimize.sh.in \
pkgdelta.sh.in \ pkgdelta.sh.in \
repo-add.sh.in \ repo-add.sh.in \
$(LIBRARY) $(LIBRARY) \
$(LIBMAKEPKG_DIST)
LIBRARY = \ LIBRARY = \
library/output_format.sh \ library/output_format.sh \
@ -37,10 +38,23 @@ LIBRARY = \
library/size_to_human.sh \ library/size_to_human.sh \
library/term_colors.sh library/term_colors.sh
# Files that should be removed, but which Automake does not know. libmakepkgdir = $(datarootdir)/makepkg
MOSTLYCLEANFILES = $(bin_SCRIPTS)
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: clean-local:
$(AM_V_at)$(RM) -r .lib $(AM_V_at)$(RM) -r .lib
@ -87,10 +101,18 @@ $(OURSCRIPTS): Makefile
$(AM_V_at)chmod +x,a-w $@ $(AM_V_at)chmod +x,a-w $@
@$(BASH_SHELL) -O extglob -n $@ @$(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: \ makepkg: \
$(srcdir)/makepkg.sh.in \ $(srcdir)/makepkg.sh.in \
$(srcdir)/makepkg-wrapper.sh.in \ $(srcdir)/makepkg-wrapper.sh.in \
$(srcdir)/library/parseopts.sh $(srcdir)/library/parseopts.sh \
$(LIBMAKEPKG_IN)
makepkg-template: \ makepkg-template: \
$(srcdir)/makepkg-template.pl.in \ $(srcdir)/makepkg-template.pl.in \
@ -150,6 +172,15 @@ install-exec-hook:
cd $(DESTDIR)$(bindir) && \ cd $(DESTDIR)$(bindir) && \
$(RM) makepkg makepkg-wrapper $(RM) makepkg makepkg-wrapper
$(INSTALL) .lib/makepkg $(DESTDIR)$(bindir)/makepkg $(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) && \ cd $(DESTDIR)$(bindir) && \
$(RM) repo-elephant && \ $(RM) repo-elephant && \
( $(LN_S) repo-add repo-elephant || \ ( $(LN_S) repo-add repo-elephant || \
@ -164,5 +195,11 @@ install-exec-hook:
uninstall-hook: uninstall-hook:
cd $(DESTDIR)$(bindir) && \ cd $(DESTDIR)$(bindir) && \
$(RM) repo-remove repo-elephant $(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: # 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 ### ### SUBROUTINES ###
plain() { # Import libmakepkg
local mesg=$1; shift for lib in "$LIBRARY"/*.sh; do
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 source "$lib"
} done
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
}
## ##
# Special exit call for traps, Don't print any error messages when inside, # 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/pacman-optimize.sh.in
scripts/pkgdelta.sh.in scripts/pkgdelta.sh.in
scripts/repo-add.sh.in scripts/repo-add.sh.in
scripts/libmakepkg/util/message.sh
scripts/library/output_format.sh scripts/library/output_format.sh
scripts/library/parseopts.sh scripts/library/parseopts.sh