summaryrefslogtreecommitdiff
path: root/src/librefetch/librefetch
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-02-07 18:00:44 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-02-07 18:00:44 -0500
commit00a6021aae396c140e786382007064f10ca254a1 (patch)
tree05bbb6435aa6e29432a77e18cfc2c9374b13ca91 /src/librefetch/librefetch
parentc7be40c324580c8bcda043c6904358640ea58b57 (diff)
Update librefetch to work with pacman 5.
Diffstat (limited to 'src/librefetch/librefetch')
-rwxr-xr-xsrc/librefetch/librefetch92
1 files changed, 19 insertions, 73 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch
index 2c8e456..2b8af61 100755
--- a/src/librefetch/librefetch
+++ b/src/librefetch/librefetch
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# librefetch
#
-# Copyright (C) 2013-2015 Luke Shumaker <lukeshu@sbcglobal.net>
+# Copyright (C) 2013-2016 Luke Shumaker <lukeshu@sbcglobal.net>
#
# For just the create_signature() function:
# Copyright (C) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
@@ -14,20 +14,20 @@
#
# License: GNU GPLv3+
#
-# This file is part of Parabola.
+# This file is part of LibreFetch.
#
-# Parabola is free software: you can redistribute it and/or modify
+# LibreFetch 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.
#
-# Parabola is distributed in the hope that it will be useful,
+# LibreFetch 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 Parabola. If not, see <http://www.gnu.org/licenses/>.
+# along with LibreFetch. If not, see <http://www.gnu.org/licenses/>.
# create_signature() is taken from pacman:makepkg, which is GPLv2+,
# so we take the '+' to combine it with our GPLv3+.
@@ -37,7 +37,8 @@
setup_traps
tmpfiles=()
-trap 'rm -f -- "${tmpfiles[@]}"' EXIT
+tmpdirs=()
+trap 'rm -f -- "${tmpfiles[@]}"; rm -rf -- "${tmpdirs[@]}"' EXIT
cmd=${0##*/}
usage() {
@@ -86,7 +87,8 @@ usage() {
'Alternate modes:' \
"-g, --geninteg" "Generate integrity checks for source files" \
"-S, --srcbuild" "Print the effective build script (SRCBUILD)" \
- "-M, --makepkg" "Print the effective makepkg script" \
+ "-M, --makepkg" "Generate and print the location of the
+ effective makepkg script" \
"-h, --help" "Show this message"
}
@@ -113,14 +115,15 @@ doit() {
########################################################################
- makepkg="$(modified_makepkg "$(which makepkg)")"
- tmpfiles+=("$makepkg")
+ makepkg="$(modified_makepkg)"
# Mode: makepkg ########################################################
if [[ $mode =~ makepkg ]]; then
- cat "$makepkg"
+ printf '%s\n' "$makepkg"
exit 0
+ else
+ tmpdirs+=("${makepkg%/*}")
fi
########################################################################
@@ -306,67 +309,10 @@ parse_options() {
# Modify makepkg ###############################################################
-# an ERE
-makepkg_modify='
-/create_package\(\) \{/,/^\}$/ {
- /pkg_file=/d # allow us to set pkg_file
- s/"?\$\{comp_files\[@\]\}"?// # do not include .{PKGINFO,INSTALL,CHANGELOG}
- # This is long/gross. What it does:
- # - pass --format=ustar to bsdtar, to inhibit it using the pax format
- # - take the files that would be included in the tarball, and use
- # find/sort/--files-from to order them for bsdtar
- s/bsdtar(.*) - ([^|]*) \|/find \2 -print0 | LC_ALL=C sort --zero-terminated | bsdtar --null --files-from - --format=ustar --no-recursion \1 - |/
- s/create_signature .*/&; return $?/ # do not procede to create symlinks
-}
-
-/tidy_install\(\) \{/,/^\}$/ {
- /for .*PURGE_TARGETS/itidy_install_purge
- /for .*PURGE_TARGETS/,/done/d
- /^\}$/ifind . -exec touch --no-dereference --date="1990-01-01 0:0:0 +0" -- {} +
-}
-
-/download_sources\(\) \{/ {
- arm -rf "$srcdir"\nmkdir "$srcdir"
-}
-
-s|Making package:|Making source:|
-s|Checking runtime dependencies\.\.\.|Checking source dependencies...|
- /Checking buildtime dependencies\.\.\./d
-
-s|srcdir=.*|&-libre|
-s|pkgdirbase=.*|&-libre|
-s|check_build_status$|:|
-'
-
-tidy_install_purge() {
- local pt
- for pt in "${PURGE_TARGETS[@]}"; do
- if [[ ${pt} = "${pt%/}" ]]; then
- if [[ ${pt} = "${pt//\/}" ]]; then
- find . ! -type d -name "${pt}" -exec rm -f -- '{}' +
- else
- rm -f "${pt}"
- fi
- else
- if [[ ${pt%/} = "${pt//\/}" ]]; then
- find . -type d -name "${pt%/}" -exec rm -rf -- '{}' +
- else
- rm -rf "${pt}"
- fi
- fi
- done
-}
-
modified_makepkg() {
- local makepkg_orig=$1
- local makepkg_mine="$(mktemp --tmpdir "${cmd}.XXXXXXXXXXX.makepkg")"
- {
- echo '#!/bin/bash'
- declare -f tidy_install_purge
- sed -r "$makepkg_modify" < "$makepkg_orig"
- } > "$makepkg_mine"
- chmod 755 "$makepkg_mine"
- realpath -es "$makepkg_mine"
+ local dir="$(mktemp --tmpdir --directory "${cmd}.XXXXXXXXXXX.makepkg")"
+ make -s -f "$(librelib librefetchdir/Makefile)" new="$dir"
+ realpath -es "$dir/makepkg"
}
# Modify PKGBUILD ##############################################################
@@ -397,7 +343,7 @@ checkdepends=() ; unset "checkdepends_${CARCH}"
makedepends=("${mkdepends[@]}") ; unset "makedepends_${CARCH}"
####
-options=(!strip docs libtool staticlibs emptydirs !zipman purge !upx)
+options=(!strip docs libtool staticlibs emptydirs !zipman purge !upx !optipng !debug)
PURGE_TARGETS=(.bzr/ .cvs/ .git/ .hg/ .svn/ .makepkg/)
####
@@ -439,8 +385,8 @@ create_signature() {
if [[ -n $GPGKEY ]]; then
SIGNWITHKEY=(-u "${GPGKEY}")
fi
- # The signature will be generated directly in ascii-friendly format
- gpg --detach-sign --use-agent "${SIGNWITHKEY[@]}" "$filename" || ret=$?
+
+ gpg --detach-sign --use-agent "${SIGNWITHKEY[@]}" --no-armor "$filename" &>/dev/null || ret=$?
if (( ! ret )); then