mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 18:06:19 +02:00
Compare commits
18 Commits
20210202
...
github/for
Author | SHA1 | Date | |
---|---|---|---|
![]() |
82caeab9e2 | ||
![]() |
9028302ac7 | ||
![]() |
a9bf4789b3 | ||
![]() |
fd17f53cef | ||
![]() |
80e8c1fc70 | ||
![]() |
6535ac9b99 | ||
![]() |
c5c5dbc64f | ||
![]() |
0a0e66a784 | ||
![]() |
60e96c9d4b | ||
![]() |
30ed6920c7 | ||
![]() |
4602659068 | ||
![]() |
43d58212c5 | ||
![]() |
6a628af422 | ||
![]() |
0635f0c5ec | ||
![]() |
04af0374f3 | ||
![]() |
54e03641a3 | ||
![]() |
385b47e56e | ||
![]() |
9d39abbefe |
15
.github/workflows/test.yml
vendored
Normal file
15
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
on: push
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container: archlinux/archlinux:latest
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoc shellcheck
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run tests
|
||||
run: |
|
||||
make PREFIX=/usr
|
||||
make PREFIX=/usr DESTDIR="$(mktemp -d)" install
|
||||
make check || true
|
||||
SHELLCHECK_OPTS="-S error" make check
|
28
.travis.yml
28
.travis.yml
@@ -1,28 +0,0 @@
|
||||
language: shell
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
archlinux:
|
||||
packages:
|
||||
- openssh
|
||||
- subversion
|
||||
- rsync
|
||||
- arch-install-scripts
|
||||
- git
|
||||
- bzr
|
||||
- mercurial
|
||||
- diffutils
|
||||
- asciidoc
|
||||
- shellcheck
|
||||
script:
|
||||
- sudo pacman -Syu --noconfirm --needed "${CONFIG_PACKAGES[@]}"
|
||||
- make PREFIX=/usr
|
||||
- make PREFIX=/usr DESTDIR="$(mktemp -d)" install
|
||||
- make check || true
|
||||
- SHELLCHECK_OPTS="-S error" make check
|
||||
|
||||
script: 'curl -s https://raw.githubusercontent.com/mikkeloscar/arch-travis/master/arch-travis.sh | bash'
|
||||
|
||||
# vim: ft=yaml ts=2 sw=2 et:
|
13
Makefile
13
Makefile
@@ -35,6 +35,8 @@ CONFIGFILES = \
|
||||
pacman-kde-unstable.conf \
|
||||
pacman-gnome-unstable.conf
|
||||
|
||||
SETARCH_ALIASES = \
|
||||
|
||||
COMMITPKG_LINKS = \
|
||||
extrapkg \
|
||||
testingpkg \
|
||||
@@ -68,6 +70,9 @@ BASHCOMPLETION_LINKS = \
|
||||
|
||||
|
||||
MANS = \
|
||||
doc/archbuild.1 \
|
||||
doc/arch-nspawn.1 \
|
||||
doc/makechrootpkg.1 \
|
||||
doc/lddd.1 \
|
||||
doc/checkpkg.1 \
|
||||
doc/offload-build.1 \
|
||||
@@ -87,7 +92,7 @@ edit = sed -e "s|@pkgdatadir[@]|$(PREFIX)/share/devtools|g"
|
||||
%: %.in Makefile lib/common.sh
|
||||
@echo "GEN $@"
|
||||
@$(RM) "$@"
|
||||
@{ echo -n 'm4_changequote([[[,]]])'; cat $@.in; } | m4 -P | $(edit) >$@
|
||||
@{ echo -n 'm4_changequote([[[,]]])'; cat $@.in; } | m4 -P --define=m4_devtools_version=$V | $(edit) >$@
|
||||
@chmod a-w "$@"
|
||||
@chmod +x "$@"
|
||||
@bash -O extglob -n "$@"
|
||||
@@ -95,16 +100,17 @@ edit = sed -e "s|@pkgdatadir[@]|$(PREFIX)/share/devtools|g"
|
||||
$(MANS): doc/asciidoc.conf doc/footer.asciidoc
|
||||
|
||||
doc/%: doc/%.asciidoc
|
||||
a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage -D doc $<
|
||||
a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage -D doc -a pkgdatadir=$(PREFIX)/share/devtools $<
|
||||
|
||||
clean:
|
||||
rm -f $(IN_PROGS) bash_completion zsh_completion $(MANS)
|
||||
|
||||
install:
|
||||
install -dm0755 $(DESTDIR)$(PREFIX)/bin
|
||||
install -dm0755 $(DESTDIR)$(PREFIX)/share/devtools
|
||||
install -dm0755 $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d
|
||||
install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
|
||||
install -m0644 ${CONFIGFILES} $(DESTDIR)$(PREFIX)/share/devtools
|
||||
for a in ${SETARCH_ALIASES}; do install -m0644 setarch-aliases.d/$$a $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d; done
|
||||
for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done
|
||||
for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done
|
||||
for l in ${CROSSREPOMOVE_LINKS}; do ln -sf crossrepomove $(DESTDIR)$(PREFIX)/bin/$$l; done
|
||||
@@ -120,6 +126,7 @@ install:
|
||||
uninstall:
|
||||
for f in ${BINPROGS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
|
||||
for f in ${CONFIGFILES}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/$$f; done
|
||||
for f in ${SETARCH_ALIASES}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d/$$f; done
|
||||
for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
|
||||
for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
|
||||
for l in ${CROSSREPOMOVE_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
|
||||
|
@@ -57,14 +57,12 @@ shift 1
|
||||
|
||||
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
||||
|
||||
pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
|
||||
|
||||
if (( ${#cache_dirs[@]} == 0 )); then
|
||||
mapfile -t cache_dirs < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" CacheDir)
|
||||
mapfile -t cache_dirs < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" CacheDir)
|
||||
fi
|
||||
|
||||
# shellcheck disable=2016
|
||||
host_mirrors=($($pacconf_cmd --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#'))
|
||||
host_mirrors=($(pacman-conf --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#'))
|
||||
|
||||
for host_mirror in "${host_mirrors[@]}"; do
|
||||
if [[ $host_mirror == *file://* ]]; then
|
||||
@@ -76,7 +74,7 @@ for host_mirror in "${host_mirrors[@]}"; do
|
||||
done
|
||||
|
||||
while read -r line; do
|
||||
mapfile -t lines < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" \
|
||||
mapfile -t lines < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" \
|
||||
--repo $line Server | sed -r 's#(.*/)[^/]+/os/.+#\1#')
|
||||
for line in "${lines[@]}"; do
|
||||
if [[ $line = file://* ]]; then
|
||||
@@ -84,7 +82,7 @@ while read -r line; do
|
||||
in_array "$line" "${cache_dirs[@]}" || cache_dirs+=("$line")
|
||||
fi
|
||||
done
|
||||
done < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list)
|
||||
done < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list)
|
||||
|
||||
mount_args+=("--bind=${cache_dirs[0]//:/\\:}")
|
||||
|
||||
@@ -126,8 +124,13 @@ copy_hostconf
|
||||
eval "$(grep -a '^CARCH=' "$working_dir/etc/makepkg.conf")"
|
||||
|
||||
[[ -z $nosetarch ]] || unset CARCH
|
||||
if [[ -f "@pkgdatadir@/setarch-aliases.d/${CARCH}" ]]; then
|
||||
read -r set_arch < "@pkgdatadir@/setarch-aliases.d/${CARCH}"
|
||||
else
|
||||
set_arch="${CARCH}"
|
||||
fi
|
||||
|
||||
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \
|
||||
exec ${CARCH:+setarch "$set_arch"} systemd-nspawn -q \
|
||||
-D "$working_dir" \
|
||||
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
|
||||
--register=no --keep-unit --as-pid2 \
|
||||
|
@@ -17,6 +17,11 @@ else
|
||||
repo=${tag%-*}
|
||||
arch=${tag##*-}
|
||||
fi
|
||||
if [[ -f "@pkgdatadir@/setarch-aliases.d/${arch}" ]]; then
|
||||
read -r set_arch < "@pkgdatadir@/setarch-aliases.d/${arch}"
|
||||
else
|
||||
set_arch="${arch}"
|
||||
fi
|
||||
chroots='/var/lib/archbuild'
|
||||
clean_first=false
|
||||
|
||||
@@ -69,7 +74,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
||||
|
||||
rm -rf --one-file-system "${chroots}/${repo}-${arch}"
|
||||
(umask 0022; mkdir -p "${chroots}/${repo}-${arch}")
|
||||
setarch "${arch}" mkarchroot \
|
||||
setarch "${set_arch}" mkarchroot \
|
||||
-C "${pacman_config}" \
|
||||
-M "${makepkg_config}" \
|
||||
"${chroots}/${repo}-${arch}/root" \
|
||||
|
40
doc/arch-nspawn.1.asciidoc
Normal file
40
doc/arch-nspawn.1.asciidoc
Normal file
@@ -0,0 +1,40 @@
|
||||
arch-nspawn(1)
|
||||
==============
|
||||
|
||||
Name
|
||||
----
|
||||
arch-nspawn - Run a command or OS in a light-weight namespace container
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
arch-nspawn [options] working-dir [systemd-nspawn arguments]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
'arch-nspawn' is a wrapper around systemd-nspawn to run command or OS in a
|
||||
namespace container such as a directory including base utilities of a OS.
|
||||
It is used to build package(s) in given clean and defined environment.
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
*-C* <file>::
|
||||
Location of a pacman config file
|
||||
|
||||
*-M* <file>::
|
||||
Location of a makepkg config file
|
||||
|
||||
*-c* <dir>::
|
||||
Set pacman cache, if no directory is specified the passed pacman.conf's cachedir is used with a fallback to '/etc/pacman.conf'
|
||||
|
||||
*-f* <file>::
|
||||
Copy file from the host to the chroot
|
||||
|
||||
*-s*::
|
||||
Do not run setarch
|
||||
|
||||
*-h*::
|
||||
Show this usage message
|
||||
|
||||
include::footer.asciidoc[]
|
47
doc/archbuild.1.asciidoc
Normal file
47
doc/archbuild.1.asciidoc
Normal file
@@ -0,0 +1,47 @@
|
||||
archbuild(1)
|
||||
============
|
||||
|
||||
Name
|
||||
----
|
||||
archbuild - a script to build an Arch Linux package inside a clean chroot.
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
archbuild [options] -- [makechrootpkg args]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
'archbuild' is a script to build an Arch Linux package. archbuild is part of devtools but should only be used via one of the included symlinks:
|
||||
|
||||
* extra-x86_64-build
|
||||
* gnome-unstable-x86_64-build
|
||||
* kde-unstable-x86_64-build
|
||||
* multilib-build
|
||||
* multilib-staging-build
|
||||
* multilib-testing-build
|
||||
* staging-x86_64-build
|
||||
* testing-x86_64-build
|
||||
|
||||
The symlink used to run it will be inspected by archbuild, to determine which target you want it to use. It will load the available pacman configuration from 'pacman-reponame-arch.conf' with a fallback to 'pacman-reponame.conf' from {pkgdatadir}. The makepkg configuration is loaded from 'makepkg-repo-arch.conf' with a fallback to 'makepkg-reponame.conf' from {pkgdatadir}.
|
||||
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
*-h*::
|
||||
Output command line options.
|
||||
|
||||
*-c*::
|
||||
Recreate the chroot before building.
|
||||
|
||||
*-r* <dir>::
|
||||
Create chroots in this directory.
|
||||
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
linkman:devtools[7]
|
||||
|
||||
include::footer.asciidoc[]
|
@@ -18,6 +18,12 @@ Programs
|
||||
The list below gives a short overview; see the respective documentation
|
||||
for details.
|
||||
|
||||
linkman:archbuild[1]
|
||||
Build an Arch Linux package inside a clean chroot
|
||||
|
||||
linkman:arch-nspawn[1]
|
||||
Run a command or OS in a light-weight namespace container
|
||||
|
||||
linkman:checkpkg[1]
|
||||
Compare the current build pakcage with the repository version
|
||||
|
||||
@@ -30,13 +36,16 @@ linkman:find-libprovides[1]
|
||||
linkman:lddd[1]
|
||||
Find broken library links on your system
|
||||
|
||||
linkman:makerepropkg[1]
|
||||
Rebuild a package to see if it is reproducible
|
||||
|
||||
linkman:mkarchroot[1]
|
||||
Creates an arch chroot in a specified location with a specified set of
|
||||
packages
|
||||
|
||||
linkman:makechrootpkg[1]
|
||||
Build a PKGBUILD in a given chroot environment
|
||||
|
||||
linkman:makerepropkg[1]
|
||||
Rebuild a package to see if it is reproducible
|
||||
|
||||
linkman:offload-build[1]
|
||||
Build a PKGBUILD on a remote server using makechrootpkg
|
||||
|
||||
|
76
doc/makechrootpkg.1.asciidoc
Normal file
76
doc/makechrootpkg.1.asciidoc
Normal file
@@ -0,0 +1,76 @@
|
||||
makechrootpkg(1)
|
||||
================
|
||||
|
||||
Name
|
||||
----
|
||||
makechrootpkg - Build a PKGBUILD in a given chroot environment
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
makechrootpkg [OPTIONS] -r <chrootdir> [--] [makepkg args]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
Run this script in a directory containing a PKGBUILD to build a package
|
||||
inside a clean chroot. Arguments passed to this script after the
|
||||
end-of-options marker (--) will be passed to makepkg.
|
||||
|
||||
The chroot dir consists of the following directories:
|
||||
<chrootdir>/{root, copy} but only "root" is required
|
||||
by default. The working copy will be created as needed
|
||||
|
||||
The chroot "root" directory must be created via the following
|
||||
command:
|
||||
mkarchroot <chrootdir>/root base-devel
|
||||
|
||||
This script reads {SRC,SRCPKG,PKG,LOG}DEST, MAKEFLAGS and PACKAGER
|
||||
from makepkg.conf(5), if those variables are not part of the
|
||||
environment.
|
||||
|
||||
Default makepkg args: --syncdeps --noconfirm --log --holdver --skipinteg
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
*-h*::
|
||||
Show this usage message
|
||||
|
||||
*-c*::
|
||||
Clean the chroot before building
|
||||
|
||||
*-d* <dir>::
|
||||
Bind directory into build chroot as read-write
|
||||
|
||||
*-D* <dir>::
|
||||
Bind directory into build chroot as read-only
|
||||
|
||||
*-u*::
|
||||
Update the working copy of the chroot before building
|
||||
This is useful for rebuilds without dirtying the pristine
|
||||
chroot
|
||||
|
||||
*-r* <dir>::
|
||||
The chroot dir to use
|
||||
|
||||
*-I* <pkg>::
|
||||
Install a package into the working copy of the chroot
|
||||
|
||||
*-l* <copy>::
|
||||
The directory to use as the working copy of the chroot
|
||||
Useful for maintaining multiple copies
|
||||
Default: $USER
|
||||
|
||||
*-n*::
|
||||
Run namcap on the build package
|
||||
|
||||
*-C*::
|
||||
Run checkpkg on the build package
|
||||
|
||||
*-T*::
|
||||
Build in a temporary directory
|
||||
|
||||
*-U*::
|
||||
Run makepkg as a specified user
|
||||
|
||||
include::footer.asciidoc[]
|
@@ -14,6 +14,10 @@ $_INCLUDE_COMMON_SH
|
||||
# Avoid any encoding problems
|
||||
export LANG=C
|
||||
|
||||
# Set buildtool properties
|
||||
export BUILDTOOL=devtools
|
||||
export BUILDTOOLVER=m4_devtools_version
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
# check if messages are to be printed using color
|
||||
|
@@ -190,6 +190,8 @@ EOF
|
||||
printf '#!/bin/bash\n'
|
||||
declare -f _chrootbuild
|
||||
declare -p SOURCE_DATE_EPOCH 2>/dev/null || true
|
||||
declare -p BUILDTOOL 2>/dev/null
|
||||
declare -p BUILDTOOLVER 2>/dev/null
|
||||
printf '_chrootbuild "$@" || exit\n'
|
||||
|
||||
if (( run_namcap )); then
|
||||
@@ -213,7 +215,10 @@ _chrootbuild() {
|
||||
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
||||
# ${1} is OK, but $foo or $1 isn't.
|
||||
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
||||
sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
||||
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||
--preserve-env=BUILDTOOL \
|
||||
--preserve-env=BUILDTOOLVER \
|
||||
-u builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
||||
ret=$?
|
||||
case $ret in
|
||||
0|14)
|
||||
@@ -298,7 +303,7 @@ done
|
||||
[[ -n $makepkg_user && -z $(id -u "$makepkg_user") ]] && die 'Invalid makepkg user.'
|
||||
makepkg_user=${makepkg_user:-${SUDO_USER:-$USER}}
|
||||
|
||||
check_root SOURCE_DATE_EPOCH,GNUPGHOME,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER
|
||||
check_root SOURCE_DATE_EPOCH,BUILDTOOL,BUILDTOOLVER,GNUPGHOME,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER
|
||||
|
||||
# Canonicalize chrootdir, getting rid of trailing /
|
||||
chrootdir=$(readlink -e "$passeddir")
|
||||
|
@@ -15,7 +15,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
|
||||
'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
|
||||
'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||
'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||
'rsync::/usr/bin/rsync --no-motd -zz %u %o'
|
||||
'rsync::/usr/bin/rsync --no-motd -z %u %o'
|
||||
'scp::/usr/bin/scp -C %u %o')
|
||||
|
||||
# Other common tools:
|
||||
@@ -26,6 +26,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
|
||||
#-- The package required by makepkg to download VCS sources
|
||||
# Format: 'protocol::package'
|
||||
VCSCLIENTS=('bzr::bzr'
|
||||
'fossil::fossil'
|
||||
'git::git'
|
||||
'hg::mercurial'
|
||||
'svn::subversion')
|
||||
@@ -38,21 +39,25 @@ CARCH="x86_64"
|
||||
CHOST="x86_64-pc-linux-gnu"
|
||||
|
||||
#-- Compiler and Linker Flags
|
||||
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
||||
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
|
||||
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
|
||||
#CPPFLAGS=""
|
||||
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
|
||||
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
|
||||
-fstack-clash-protection -fcf-protection"
|
||||
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
|
||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
|
||||
#RUSTFLAGS="-C opt-level=2"
|
||||
#-- Make Flags: change this for DistCC/SMP systems
|
||||
#MAKEFLAGS="-j2"
|
||||
#-- Debugging flags
|
||||
DEBUG_CFLAGS="-g -fvar-tracking-assignments"
|
||||
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
|
||||
#DEBUG_RUSTFLAGS="-C debuginfo=2"
|
||||
|
||||
#########################################################################
|
||||
# BUILD ENVIRONMENT
|
||||
#########################################################################
|
||||
#
|
||||
# Defaults: BUILDENV=(!distcc !color !ccache check !sign)
|
||||
# Makepkg defaults: BUILDENV=(!distcc !color !ccache check !sign)
|
||||
# A negated environment option will do the opposite of the comments below.
|
||||
#
|
||||
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
||||
@@ -75,7 +80,7 @@ BUILDENV=(!distcc color !ccache check !sign)
|
||||
# These are default values for the options=() settings
|
||||
#########################################################################
|
||||
#
|
||||
# Default: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug)
|
||||
# Makepkg defaults: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto)
|
||||
# A negated option will do the opposite of the comments below.
|
||||
#
|
||||
#-- strip: Strip symbols from binaries/libraries
|
||||
@@ -86,11 +91,12 @@ BUILDENV=(!distcc color !ccache check !sign)
|
||||
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
||||
#-- purge: Remove files specified by PURGE_TARGETS
|
||||
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
||||
#-- lto: Add compile flags for building with link time optimization
|
||||
#
|
||||
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug)
|
||||
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug !lto)
|
||||
|
||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||
INTEGRITY_CHECK=(md5)
|
||||
#-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512, b2
|
||||
INTEGRITY_CHECK=(sha256)
|
||||
#-- Options to be used when stripping binaries. See `man strip' for details.
|
||||
STRIP_BINARIES="--strip-all"
|
||||
#-- Options to be used when stripping shared libraries. See `man strip' for details.
|
||||
@@ -146,4 +152,10 @@ COMPRESSLZ=(lzip -c -f)
|
||||
PKGEXT='.pkg.tar.zst'
|
||||
SRCEXT='.src.tar.gz'
|
||||
|
||||
#########################################################################
|
||||
# OTHER
|
||||
#########################################################################
|
||||
#
|
||||
#-- Command used to run pacman as root, instead of trying sudo and su
|
||||
#PACMAN_AUTH=()
|
||||
# vim: set ft=sh ts=2 sw=2 et:
|
||||
|
@@ -178,6 +178,8 @@ parse_buildinfo < <(bsdtar -xOqf "${splitpkgs[0]}" .BUILDINFO)
|
||||
export SOURCE_DATE_EPOCH="${buildinfo[builddate]}"
|
||||
PACKAGER="${buildinfo[packager]}"
|
||||
BUILDDIR="${buildinfo[builddir]}"
|
||||
BUILDTOOL="${buildinfo[buildtool]}"
|
||||
BUILDTOOLVER="${buildinfo[buildtoolver]}"
|
||||
PKGEXT=${splitpkgs[0]#${splitpkgs[0]%.pkg.tar*}}
|
||||
|
||||
# nuke and restore reproducible testenv
|
||||
@@ -201,12 +203,12 @@ makechrootpkg -r "${buildroot}" -l "${chroot}" -- --packagelist || exit 1
|
||||
|
||||
# set detected makepkg.conf options
|
||||
{
|
||||
for var in PACKAGER BUILDDIR PKGEXT; do
|
||||
for var in PACKAGER BUILDDIR BUILDTOOL BUILDTOOLVER PKGEXT; do
|
||||
printf '%s=%s\n' "${var}" "${!var@Q}"
|
||||
done
|
||||
printf 'OPTIONS=(%s)\n' "${buildopts[*]@Q}"
|
||||
printf 'BUILDENV=(%s)\n' "${buildenv[*]@Q}"
|
||||
} >> "${buildroot}/${chroot}"/etc/makepkg.conf >> "${buildroot}/${chroot}"/etc/makepkg.conf
|
||||
} >> "${buildroot}/${chroot}"/etc/makepkg.conf
|
||||
install -d -o "${SUDO_UID:-$UID}" -g "$(id -g "${SUDO_UID:-$UID}")" "${buildroot}/${chroot}/${BUILDDIR}"
|
||||
|
||||
# kick off the build
|
||||
|
@@ -63,10 +63,9 @@ shift 1
|
||||
|
||||
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
||||
|
||||
pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
|
||||
|
||||
if (( ${#cache_dirs[@]} == 0 )); then
|
||||
mapfile -t cache_dirs < <($pacconf_cmd CacheDir)
|
||||
mapfile -t cache_dirs < <(pacman-conf CacheDir)
|
||||
fi
|
||||
|
||||
umask 0022
|
||||
|
@@ -31,10 +31,11 @@ Architecture = auto
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
NoProgressBar
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
#VerbosePkgLists
|
||||
VerbosePkgLists
|
||||
ParallelDownloads = 5
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
|
@@ -31,10 +31,11 @@ Architecture = auto
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
NoProgressBar
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
#VerbosePkgLists
|
||||
VerbosePkgLists
|
||||
ParallelDownloads = 5
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
|
@@ -31,10 +31,11 @@ Architecture = auto
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
NoProgressBar
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
#VerbosePkgLists
|
||||
VerbosePkgLists
|
||||
ParallelDownloads = 5
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
|
@@ -31,10 +31,11 @@ Architecture = auto
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
NoProgressBar
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
#VerbosePkgLists
|
||||
VerbosePkgLists
|
||||
ParallelDownloads = 5
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
|
@@ -31,10 +31,11 @@ Architecture = auto
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
NoProgressBar
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
#VerbosePkgLists
|
||||
VerbosePkgLists
|
||||
ParallelDownloads = 5
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
|
@@ -31,10 +31,11 @@ Architecture = auto
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
NoProgressBar
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
#VerbosePkgLists
|
||||
VerbosePkgLists
|
||||
ParallelDownloads = 5
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
|
@@ -31,10 +31,11 @@ Architecture = auto
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
NoProgressBar
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
#VerbosePkgLists
|
||||
VerbosePkgLists
|
||||
ParallelDownloads = 5
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
|
@@ -31,10 +31,11 @@ Architecture = auto
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
NoProgressBar
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
#VerbosePkgLists
|
||||
VerbosePkgLists
|
||||
ParallelDownloads = 5
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
|
46
sogrep.in
46
sogrep.in
@@ -18,6 +18,8 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
m4_include(lib/common.sh)
|
||||
|
||||
# globals
|
||||
: ${SOLINKS_MIRROR:="https://mirror.pkgbuild.com"}
|
||||
: ${SOCACHE_DIR:="${XDG_CACHE_HOME:-${HOME}/.cache}/sogrep"}
|
||||
@@ -39,13 +41,37 @@ recache() {
|
||||
|
||||
for repo in "${_repos[@]}"; do
|
||||
for arch in "${arches[@]}"; do
|
||||
# delete extracted tarballs from previous sogrep versions
|
||||
rm -rf "${SOCACHE_DIR}/${arch}/${repo}"
|
||||
mkdir -p "${SOCACHE_DIR}/${arch}/${repo}"
|
||||
curl -L "$verbosity" "${SOLINKS_MIRROR}/${repo}/os/${arch}/${repo}.links.tar.gz" | bsdtar -xf - -C "${SOCACHE_DIR}/${arch}/${repo}"
|
||||
|
||||
# fetch repo links database if newer than our cached copy
|
||||
local dbpath=${SOCACHE_DIR}/${arch}/${repo}.links.tar.gz
|
||||
mkdir -p "${dbpath%/*}"
|
||||
(( VERBOSE )) && echo "Fetching ${repo}.links.tar.gz..."
|
||||
curl -LR "${verbosity}" -o "${dbpath}" -z "${dbpath}" \
|
||||
"${SOLINKS_MIRROR}/${repo}/os/${arch}/${repo}.links.tar.gz"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
is_outdated_cache() {
|
||||
local repo arch
|
||||
|
||||
# links databases are generated at about the same time every day; we should
|
||||
# attempt to check for new database files if any of them are over a day old
|
||||
|
||||
for repo in "${_repos[@]}"; do
|
||||
for arch in "${arches[@]}"; do
|
||||
local dbpath=${SOCACHE_DIR}/${arch}/${repo}.links.tar.gz
|
||||
if [[ ! -f ${dbpath} ]] || [[ $(find "${dbpath}" -mtime +0) ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
search() {
|
||||
local repo=$1 arch lib=$2 srepos=("${_repos[@]}")
|
||||
|
||||
@@ -58,15 +84,20 @@ search() {
|
||||
srepos=("${repo}")
|
||||
fi
|
||||
|
||||
setup_workdir
|
||||
|
||||
for arch in "${arches[@]}"; do
|
||||
for repo in "${srepos[@]}"; do
|
||||
local prefix=
|
||||
(( VERBOSE && ${#srepos[@]} > 1 )) && prefix=${repo}/
|
||||
db=${SOCACHE_DIR}/${arch}/${repo}/
|
||||
if [[ -d ${db} ]]; then
|
||||
local db=${SOCACHE_DIR}/${arch}/${repo}.links.tar.gz
|
||||
if [[ -f ${db} ]]; then
|
||||
local extracted=${WORKDIR}/${arch}/${repo}
|
||||
mkdir -p "${extracted}"
|
||||
bsdtar -C "${extracted}" -xf "${db}"
|
||||
while read -rd '' pkg; do
|
||||
read -r match
|
||||
pkg=${pkg#${db}}
|
||||
pkg=${pkg#${extracted}/}
|
||||
pkg="${prefix}${pkg%-*-*/links}"
|
||||
|
||||
if (( VERBOSE )); then
|
||||
@@ -74,7 +105,7 @@ search() {
|
||||
else
|
||||
printf '%s\n' "${pkg}"
|
||||
fi
|
||||
done < <(grep -rZ "${lib}" "${db}") | sort -u
|
||||
done < <(grep -rZ "${lib}" "${extracted}") | sort -u
|
||||
fi
|
||||
done
|
||||
done | resort
|
||||
@@ -139,7 +170,8 @@ if ! (( ( REFRESH && $# == 0 ) || $# == 2 )); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( REFRESH )) || [[ ! -d ${SOCACHE_DIR} ]]; then
|
||||
# trigger a refresh if requested explicitly or the cached dbs might be outdated
|
||||
if (( REFRESH )) || [[ ! -d ${SOCACHE_DIR} ]] || is_outdated_cache; then
|
||||
recache
|
||||
(( $# == 2 )) || exit 0
|
||||
fi
|
||||
|
@@ -10,6 +10,7 @@ _archbuild_args=(
|
||||
'-c[Recreate the chroot before building]'
|
||||
'-r[Create chroots in this directory]:base_dir:_files -/'
|
||||
'-h[Display usage]'
|
||||
'--[Introduce makechrootpkg options]:*::makechrootpkg options:= _dispatch makechrootpkg makechrootpkg'
|
||||
)
|
||||
|
||||
_archco_args=(
|
||||
|
Reference in New Issue
Block a user