index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile | 148 | ||||
-rw-r--r-- | config/pacman/build-support-staging-with-build-support.conf | 102 | ||||
-rw-r--r-- | config/pacman/core-staging-with-build-support.conf | 102 | ||||
-rw-r--r-- | config/pacman/extra-staging-with-build-support.conf | 102 | ||||
-rw-r--r-- | config/setarch-aliases.d/pentium4 | 1 | ||||
-rw-r--r-- | src/arch-nspawn.in | 6 | ||||
-rw-r--r-- | src/archbuild.in | 16 | ||||
-rw-r--r-- | src/lib/repo/arch32.sh | 74 | ||||
-rw-r--r-- | src/lib/repo/clone.sh | 12 | ||||
-rw-r--r-- | src/lib/valid-tags.sh | 7 | ||||
-rw-r--r-- | src/makechrootpkg.in | 16 | ||||
-rw-r--r-- | src/mkarchroot.in | 5 |
@@ -1,3 +1,3 @@ *~ -devtools-*.tar.gz* -/build/ +devtools32-*.tar.gz* +build/ @@ -1,8 +1,10 @@ +V=$(shell git describe) SHELL=/bin/bash -o pipefail - -V=1.1.1 BUILDTOOLVER ?= $(V) +# builds with relf-referencing wildcards are not deterministic, switch of parallel builds +.NOTPARALLEL: + PREFIX = /usr/local MANDIR = $(PREFIX)/share/man DATADIR = $(PREFIX)/share/devtools @@ -20,6 +22,44 @@ GIT_CONFIGS = $(wildcard config/git/*) SETARCH_ALIASES = $(wildcard config/setarch-aliases.d/*) MANS = $(addprefix $(BUILDDIR)/,$(patsubst %.asciidoc,%,$(wildcard doc/man/*.asciidoc))) +GENERATED_PACMAN_CONFIGS = \ + core-testing-i486.conf \ + core-testing-i686.conf \ + core-testing-pentium4.conf \ + core-staging-i486.conf \ + core-staging-i686.conf \ + core-staging-pentium4.conf \ + core-staging-with-build-support-i486.conf \ + core-staging-with-build-support-i686.conf \ + core-staging-with-build-support-pentium4.conf \ + extra-i486.conf \ + extra-i686.conf \ + extra-pentium4.conf \ + extra-testing-i486.conf \ + extra-testing-i686.conf \ + extra-testing-pentium4.conf \ + extra-staging-i486.conf \ + extra-staging-i686.conf \ + extra-staging-pentium4.conf \ + extra-staging-with-build-support-i486.conf \ + extra-staging-with-build-support-i686.conf \ + extra-staging-with-build-support-pentium4.conf \ + build-support-staging-with-build-support-i486.conf \ + build-support-staging-with-build-support-i686.conf \ + build-support-staging-with-build-support-pentium4.conf \ + kde-unstable-i486.conf \ + kde-unstable-i686.conf \ + kde-unstable-pentium4.conf \ + gnome-unstable-i486.conf \ + gnome-unstable-i686.conf \ + gnome-unstable-pentium4.conf +GENERATED_MAKEPKG_CONFIGS = \ + i486.conf \ + i686.conf \ + pentium4.conf +GENERATED_PACMAN_CONFIGS := $(addprefix $(BUILDDIR)/pacman.conf.d/,$(GENERATED_PACMAN_CONFIGS)) +GENERATED_MAKEPKG_CONFIGS := $(addprefix $(BUILDDIR)/makepkg.conf.d/,$(GENERATED_MAKEPKG_CONFIGS)) + COMMITPKG_LINKS = \ core-testingpkg \ core-stagingpkg \ @@ -33,20 +73,51 @@ COMMITPKG_LINKS = \ gnome-unstablepkg ARCHBUILD_LINKS = \ + core-testing-i486-build \ + core-testing-i686-build \ + core-testing-pentium4-build \ core-testing-x86_64-build \ core-testing-x86_64_v3-build \ + core-staging-i486-build \ + core-staging-i686-build \ + core-staging-pentium4-build \ core-staging-x86_64-build \ core-staging-x86_64_v3-build \ + core-staging-x86_64-build \ + core-staging-with-build-support-i486-build \ + core-staging-with-build-support-i686-build \ + core-staging-with-build-support-pentium4-build \ + extra-i486-build \ + extra-i686-build \ + extra-pentium4-build \ extra-x86_64-build \ extra-x86_64_v3-build \ + extra-testing-i486-build \ + extra-testing-i686-build \ + extra-testing-pentium4-build \ extra-testing-x86_64-build \ extra-testing-x86_64_v3-build \ + extra-staging-i486-build \ + extra-staging-i686-build \ + extra-staging-pentium4-build \ extra-staging-x86_64-build \ extra-staging-x86_64_v3-build \ + extra-staging-with-build-support-i486-build \ + extra-staging-with-build-support-i686-build \ + extra-staging-with-build-support-pentium4-build \ + build-support-staging-with-build-support-i486-build \ + build-support-staging-with-build-support-i686-build \ + build-support-staging-with-build-support-pentium4-build \ multilib-build \ multilib-testing-build \ multilib-staging-build \ + kde-unstable-i486-build \ + kde-unstable-i686-build \ + kde-unstable-pentium4-build \ kde-unstable-x86_64-build \ + gnome-unstable-i486-build \ + gnome-unstable-i686-build \ + gnome-unstable-pentium4-build \ gnome-unstable-x86_64-build COMPLETIONS = $(addprefix $(BUILDDIR)/,$(patsubst %.in,%,$(wildcard contrib/completion/*/*))) @@ -59,10 +130,11 @@ BATS_ARGS ?= --jobs $(JOBS) $(BATS_EXTRA_ARGS) --verbose-run COVERAGE_DIR ?= $(BUILDDIR)/coverage -all: binprogs library conf completion man +all: binprogs library conf completion man configfiles binprogs: $(BINPROGS) library: $(LIBRARY) completion: $(COMPLETIONS) +configfiles: $(GENERATED_MAKEPKG_CONFIGS) $(GENERATED_PACMAN_CONFIGS) man: $(MANS) @@ -85,6 +157,65 @@ edit = sed \ -e "s|@buildtoolver[@]|$(BUILDTOOLVER)|g" GEN_MSG = @echo "GEN $(patsubst $(BUILDDIR)/%,%,$@)" +$(BUILDDIR)/makepkg.conf.d/i486.conf: config/makepkg/x86_64.conf + @echo "GEN $(notdir $@)" + @mkdir -p $(dir $@) + @sed " \ + s,\(["'"'"=]\)x86[-_]64\([-"'"'" ]\),\1i486\2,g; \ + s,-fcf-protection,,g; \ + s,LTOFLAGS=".*",LTOFLAGS=\"-fno-lto\",g; \ + /OPTIONS=/s/ lto/ !lto/; \ + " "$<" > "$@" + @sed -i 's/--ultra -20/--ultra -19/' "$@" + +$(BUILDDIR)/makepkg.conf.d/i686.conf: config/makepkg/x86_64.conf + @echo "GEN $(notdir $@)" + @mkdir -p $(dir $@) + @sed " \ + s,\(["'"'"=]\)x86[-_]64\([-"'"'" ]\),\1i686\2,g; \ + s,-fcf-protection,,g; \ + " "$<" > "$@" + @sed -i 's/--ultra -20/--ultra -19/' "$@" + +$(BUILDDIR)/makepkg.conf.d/pentium4.conf: $(BUILDDIR)/makepkg.conf.d/i686.conf + @echo "GEN $(notdir $@)" + @mkdir -p $(dir $@) + @sed '/^CHOST=/ ! s,\(["=]\)i686\([-" ]\),\1pentium4\2,g' "$<" > "$@" + @sed -i 's/--ultra -20/--ultra -19/' "$@" + +$(BUILDDIR)/pacman.conf.d/%-i486.conf: config/pacman/%.conf + @echo "GEN $(notdir $@)" + @mkdir -p $(dir $@) + @sed " \ + s,/mirrorlist\$$,\032,; \ + /^Architecture = / s/^.*\$$/Architecture = i486/; \ + " "$<" > /tmp/$$.tmp + @sed -i '/^\[core-staging\]/ i \[staging\]\nInclude = \/etc\/pacman.d\/mirrorlist32\n' /tmp/$$.tmp + @sed -i '/^\[core-testing\]/ i \[testing\]\nInclude = \/etc\/pacman.d\/mirrorlist32\n' /tmp/$$.tmp + @cat /tmp/$$.tmp > "$@" + +$(BUILDDIR)/pacman.conf.d/%-i686.conf: config/pacman/%.conf + @echo "GEN $(notdir $@)" + @mkdir -p $(dir $@) + @sed " \ + s,/mirrorlist\$$,\032,; \ + /^Architecture = / s/^.*$$/Architecture = i686/ \ + " "$<" > /tmp/$$.tmp + @sed -i '/^\[core-staging\]/ i \[staging\]\nInclude = \/etc\/pacman.d\/mirrorlist32\n' /tmp/$$.tmp + @sed -i '/^\[core-testing\]/ i \[testing\]\nInclude = \/etc\/pacman.d\/mirrorlist32\n' /tmp/$$.tmp + @cat /tmp/$$.tmp > "$@" + +$(BUILDDIR)/pacman.conf.d/%-pentium4.conf: config/pacman/%.conf + @echo "GEN $(notdir $@)" + @mkdir -p $(dir $@) + @sed " \ + s,/mirrorlist\$$,\032,; \ + /^Architecture = / s/^.*$$/Architecture = pentium4/ \ + " "$<" > /tmp/$$.tmp + @sed -i '/^\[core-staging\]/ i \[staging\]\nInclude = \/etc\/pacman.d\/mirrorlist32\n' /tmp/$$.tmp + @sed -i '/^\[core-testing\]/ i \[testing\]\nInclude = \/etc\/pacman.d\/mirrorlist32\n' /tmp/$$.tmp + @cat /tmp/$$.tmp > "$@" + define buildInScript $(1)/%: $(2)%$(3) $$(GEN_MSG) @@ -125,7 +256,9 @@ install: all cp -ra $(BUILDDIR)/lib/* $(DESTDIR)$(DATADIR)/lib cp -a $(BUILDDIR)/git.conf.d -t $(DESTDIR)$(DATADIR) for conf in $(notdir $(MAKEPKG_CONFIGS)); do install -Dm0644 $(BUILDDIR)/makepkg.conf.d/$$conf $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done + for conf in $(notdir $(GENERATED_MAKEPKG_CONFIGS)); do install -Dm0644 $(BUILDDIR)/makepkg.conf.d/$$conf $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done for conf in $(notdir $(PACMAN_CONFIGS)); do install -Dm0644 $(BUILDDIR)/pacman.conf.d/$$conf $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done + for conf in $(notdir $(GENERATED_PACMAN_CONFIGS)); do install -Dm0644 $(BUILDDIR)/pacman.conf.d/$$conf $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done for a in ${SETARCH_ALIASES}; do install -m0644 $$a -t $(DESTDIR)$(DATADIR)/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 @@ -143,7 +276,9 @@ uninstall: rm -rf $(DESTDIR)$(DATADIR)/lib rm -rf $(DESTDIR)$(DATADIR)/git.conf.d for conf in $(notdir $(MAKEPKG_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done + for conf in $(notdir $(GENERATED_MAKEPKG_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done for conf in $(notdir $(PACMAN_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done + for conf in $(notdir $(GENERATED_PACMAN_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done for f in $(notdir $(SETARCH_ALIASES)); do rm -f $(DESTDIR)$(DATADIR)/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 @@ -172,8 +307,11 @@ release: dist GITLAB_HOST=gitlab.archlinux.org glab release create v$(V) devtools-$(V).tar.gz* --milestone v$(V) --notes-file <(git cliff --strip=all --latest) dist: - git archive --format=tar --prefix=devtools-$(V)/ v$(V) | gzip > devtools-$(V).tar.gz - gpg --detach-sign --use-agent devtools-$(V).tar.gz + git archive --format=tar --prefix=devtools32-$(V)/ v$(V) | gzip > devtools32-$(V).tar.gz + gpg --detach-sign --use-agent devtools32-$(V).tar.gz + +upload: + scp devtools32-$(V).tar.gz devtools32-$(V).tar.gz.sig sources.archlinux32.org:httpdocs/sources/ test: binprogs library conf completion man @mkdir -p $(COVERAGE_DIR) diff --git a/config/pacman/build-support-staging-with-build-support.conf b/config/pacman/build-support-staging-with-build-support.conf new file mode 100644 index 0000000..450bf16 --- /dev/null +++ b/config/pacman/build-support-staging-with-build-support.conf @@ -0,0 +1,102 @@ +# +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives + +# +# GENERAL OPTIONS +# +[options] +# The following paths are commented out with their default values listed. +# If you wish to use different paths, uncomment and update the paths. +#RootDir = / +#DBPath = /var/lib/pacman/ +#CacheDir = /var/cache/pacman/pkg/ +#LogFile = /var/log/pacman.log +#GPGDir = /etc/pacman.d/gnupg/ +#HookDir = /etc/pacman.d/hooks/ +HoldPkg = pacman glibc +#XferCommand = /usr/bin/curl -C - -f %u > %o +#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u +#CleanMethod = KeepInstalled +#UseDelta = 0.7 +Architecture = auto + +# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup +#IgnorePkg = +#IgnoreGroup = + +#NoUpgrade = +#NoExtract = + +# Misc options +#UseSyslog +#Color +#TotalDownload +# We cannot check disk space from within a chroot environment +#CheckSpace +#VerbosePkgLists + +# 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. +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional +#RemoteFileSigLevel = Required + +# NOTE: You must run `pacman-key --init` before first using pacman; the local +# keyring can then be populated with the keys of all official Arch Linux +# packagers with `pacman-key --populate archlinux`. + +# +# REPOSITORIES +# - can be defined here or included from another file +# - pacman will search repositories in the order defined here +# - local/custom mirrors can be added here or in separate files +# - repositories listed first will take precedence when packages +# have identical names, regardless of version number +# - URLs will have $repo replaced by the name of the current repo +# - URLs will have $arch replaced by the name of the architecture +# +# Repository entries are of the format: +# [repo-name] +# Server = ServerName +# Include = IncludePath +# +# The header [repo-name] is crucial - it must be present and +# uncommented to enable the repo. +# + +# The testing repositories are disabled by default. To enable, uncomment the +# repo name header and Include lines. You can add preferred servers immediately +# after the header, and they will be used before the default mirrors. + +[build-support-manual] +Include = /etc/pacman.d/mirrorlist + +[build-support] +Include = /etc/pacman.d/mirrorlist + +[core-staging] +Include = /etc/pacman.d/mirrorlist + +[extra-staging] +Include = /etc/pacman.d/mirrorlist + +[core-testing] +Include = /etc/pacman.d/mirrorlist + +[core] +Include = /etc/pacman.d/mirrorlist + +[extra-testing] +Include = /etc/pacman.d/mirrorlist + +[extra] +Include = /etc/pacman.d/mirrorlist + +# An example of a custom package repository. See the pacman manpage for +# tips on creating your own repositories. +#[custom] +#SigLevel = Optional TrustAll +#Server = file:///home/custompkgs + diff --git a/config/pacman/core-staging-with-build-support.conf b/config/pacman/core-staging-with-build-support.conf new file mode 100644 index 0000000..450bf16 --- /dev/null +++ b/config/pacman/core-staging-with-build-support.conf @@ -0,0 +1,102 @@ +# +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives + +# +# GENERAL OPTIONS +# +[options] +# The following paths are commented out with their default values listed. +# If you wish to use different paths, uncomment and update the paths. +#RootDir = / +#DBPath = /var/lib/pacman/ +#CacheDir = /var/cache/pacman/pkg/ +#LogFile = /var/log/pacman.log +#GPGDir = /etc/pacman.d/gnupg/ +#HookDir = /etc/pacman.d/hooks/ +HoldPkg = pacman glibc +#XferCommand = /usr/bin/curl -C - -f %u > %o +#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u +#CleanMethod = KeepInstalled +#UseDelta = 0.7 +Architecture = auto + +# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup +#IgnorePkg = +#IgnoreGroup = + +#NoUpgrade = +#NoExtract = + +# Misc options +#UseSyslog +#Color +#TotalDownload +# We cannot check disk space from within a chroot environment +#CheckSpace +#VerbosePkgLists + +# 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. +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional +#RemoteFileSigLevel = Required + +# NOTE: You must run `pacman-key --init` before first using pacman; the local +# keyring can then be populated with the keys of all official Arch Linux +# packagers with `pacman-key --populate archlinux`. + +# +# REPOSITORIES +# - can be defined here or included from another file +# - pacman will search repositories in the order defined here +# - local/custom mirrors can be added here or in separate files +# - repositories listed first will take precedence when packages +# have identical names, regardless of version number +# - URLs will have $repo replaced by the name of the current repo +# - URLs will have $arch replaced by the name of the architecture +# +# Repository entries are of the format: +# [repo-name] +# Server = ServerName +# Include = IncludePath +# +# The header [repo-name] is crucial - it must be present and +# uncommented to enable the repo. +# + +# The testing repositories are disabled by default. To enable, uncomment the +# repo name header and Include lines. You can add preferred servers immediately +# after the header, and they will be used before the default mirrors. + +[build-support-manual] +Include = /etc/pacman.d/mirrorlist + +[build-support] +Include = /etc/pacman.d/mirrorlist + +[core-staging] +Include = /etc/pacman.d/mirrorlist + +[extra-staging] +Include = /etc/pacman.d/mirrorlist + +[core-testing] +Include = /etc/pacman.d/mirrorlist + +[core] +Include = /etc/pacman.d/mirrorlist + +[extra-testing] +Include = /etc/pacman.d/mirrorlist + +[extra] +Include = /etc/pacman.d/mirrorlist + +# An example of a custom package repository. See the pacman manpage for +# tips on creating your own repositories. +#[custom] +#SigLevel = Optional TrustAll +#Server = file:///home/custompkgs + diff --git a/config/pacman/extra-staging-with-build-support.conf b/config/pacman/extra-staging-with-build-support.conf new file mode 100644 index 0000000..450bf16 --- /dev/null +++ b/config/pacman/extra-staging-with-build-support.conf @@ -0,0 +1,102 @@ +# +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives + +# +# GENERAL OPTIONS +# +[options] +# The following paths are commented out with their default values listed. +# If you wish to use different paths, uncomment and update the paths. +#RootDir = / +#DBPath = /var/lib/pacman/ +#CacheDir = /var/cache/pacman/pkg/ +#LogFile = /var/log/pacman.log +#GPGDir = /etc/pacman.d/gnupg/ +#HookDir = /etc/pacman.d/hooks/ +HoldPkg = pacman glibc +#XferCommand = /usr/bin/curl -C - -f %u > %o +#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u +#CleanMethod = KeepInstalled +#UseDelta = 0.7 +Architecture = auto + +# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup +#IgnorePkg = +#IgnoreGroup = + +#NoUpgrade = +#NoExtract = + +# Misc options +#UseSyslog +#Color +#TotalDownload +# We cannot check disk space from within a chroot environment +#CheckSpace +#VerbosePkgLists + +# 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. +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional +#RemoteFileSigLevel = Required + +# NOTE: You must run `pacman-key --init` before first using pacman; the local +# keyring can then be populated with the keys of all official Arch Linux +# packagers with `pacman-key --populate archlinux`. + +# +# REPOSITORIES +# - can be defined here or included from another file +# - pacman will search repositories in the order defined here +# - local/custom mirrors can be added here or in separate files +# - repositories listed first will take precedence when packages +# have identical names, regardless of version number +# - URLs will have $repo replaced by the name of the current repo +# - URLs will have $arch replaced by the name of the architecture +# +# Repository entries are of the format: +# [repo-name] +# Server = ServerName +# Include = IncludePath +# +# The header [repo-name] is crucial - it must be present and +# uncommented to enable the repo. +# + +# The testing repositories are disabled by default. To enable, uncomment the +# repo name header and Include lines. You can add preferred servers immediately +# after the header, and they will be used before the default mirrors. + +[build-support-manual] +Include = /etc/pacman.d/mirrorlist + +[build-support] +Include = /etc/pacman.d/mirrorlist + +[core-staging] +Include = /etc/pacman.d/mirrorlist + +[extra-staging] +Include = /etc/pacman.d/mirrorlist + +[core-testing] +Include = /etc/pacman.d/mirrorlist + +[core] +Include = /etc/pacman.d/mirrorlist + +[extra-testing] +Include = /etc/pacman.d/mirrorlist + +[extra] +Include = /etc/pacman.d/mirrorlist + +# An example of a custom package repository. See the pacman manpage for +# tips on creating your own repositories. +#[custom] +#SigLevel = Optional TrustAll +#Server = file:///home/custompkgs + diff --git a/config/setarch-aliases.d/pentium4 b/config/setarch-aliases.d/pentium4 new file mode 100644 index 0000000..193dd70 --- /dev/null +++ b/config/setarch-aliases.d/pentium4 @@ -0,0 +1 @@ +i686 diff --git a/src/arch-nspawn.in b/src/arch-nspawn.in index 1eba0a6..8fcdead 100644 --- a/src/arch-nspawn.in +++ b/src/arch-nspawn.in @@ -70,7 +70,7 @@ if (( ${#cache_dirs[@]} == 0 )); then fi # shellcheck disable=2016 -host_mirrors=($(pacman-conf --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')) +host_mirrors=($(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#;t;s#(.*/)[^/]+/extra(/?)$#\1$arch/$repo\2#')) for host_mirror in "${host_mirrors[@]}"; do if [[ $host_mirror == *file://* ]]; then @@ -103,7 +103,9 @@ copy_hostconf () { unshare --fork --pid gpg --homedir "$working_dir"/etc/pacman.d/gnupg/ --no-permission-warning --quiet --batch --import --import-options import-local-sigs "$(pacman-conf GpgDir)"/pubring.gpg >/dev/null 2>&1 pacman-key --gpgdir "$working_dir"/etc/pacman.d/gnupg/ --import-trustdb "$(pacman-conf GpgDir)" >/dev/null 2>&1 - printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist" + printf 'Server = %s\n' "${host_mirrors[@]}" | \ + tee "$working_dir/etc/pacman.d/mirrorlist" > \ + "$working_dir/etc/pacman.d/mirrorlist32" [[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf" [[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf" diff --git a/src/archbuild.in b/src/archbuild.in index 2f3faf9..d023e0d 100644 --- a/src/archbuild.in +++ b/src/archbuild.in @@ -76,6 +76,14 @@ done check_root SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER,GNUPGHOME "${BASH_SOURCE[0]}" "$@" +if [ "${arch}" = "x86_64" ]; then + cache_dir='' +else + mkdir -p '/var/cache/archbuild32' + cache_dir='-c/var/cache/archbuild32' + makechrootpkg_args+=('-d/var/cache/archbuild32:/var/cache/pacman/pkg') +fi + # Pass all arguments after -- right to makepkg makechrootpkg_args+=("${@:$OPTIND}") @@ -89,6 +97,12 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then lock 9 "$copy.lock" "Locking chroot copy '%s'" "$copy" subvolume_delete_recursive "${copy}" + find "${copy}" \ + -mindepth 1 \ + -type d \ + -exec mountpoint -q {} \; \ + -prune \ + -exec umount -l {} \; rm -rf --one-file-system "${copy}" done lock_close 9 @@ -98,6 +112,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then setarch "${set_arch}" mkarchroot \ -C "${pacman_config}" \ -M "${makepkg_config}" \ + ${cache_dir} \ "${chroots}/${repo}-${arch}/root" \ "${base_packages[@]}" || abort else @@ -105,6 +120,7 @@ else arch-nspawn \ -C "${pacman_config}" \ -M "${makepkg_config}" \ + ${cache_dir} \ "${chroots}/${repo}-${arch}/root" \ pacman -Syuu --noconfirm || abort fi diff --git a/src/lib/repo/arch32.sh b/src/lib/repo/arch32.sh new file mode 100644 index 0000000..7bdf628 --- /dev/null +++ b/src/lib/repo/arch32.sh @@ -0,0 +1,74 @@ +# does local adaptions needed to build for Archlinux32 +# (this should be held in sync with builder/lib/common-functions mangle_pkgbuild) +# +# mangle_pkgbuild $PKGBUILD [$sub_pkgrel] +# +# append $sub_pkgrel to the pkgrel +# remove $pkgrel from {make,check,opt,}depends +pkgctl_repo_patch_arch32() { + local pkgname="$1" + + #~ local PKGBUILD="$1" + #~ local sub_pkgrel="$2" + + # add the remote branch with our patches + git -C "${pkgname}" remote add -m master archlinux32 git://git.archlinux32.org/packages + git -C "${pkgname}" fetch --depth 1 archlinux32 + + #~ if [ -n "${sub_pkgrel}" ]; then + #~ sub_pkgrel=".${sub_pkgrel}" + #~ fi + + # extend architecture with our architecture + awk -i inplace '!/^arch=[^#]*any/ {gsub(/^arch=\(/,"arch=(i486 i686 pentium4 ")}; {print}' \ + "${pkgname}/PKGBUILD" + + #~ if grep -q '^\s*pkgname=["'"'"']\?lib32-' "${pkgname}/${PKGBUILD}"; then + #~ sed -i ' + #~ s/^\(\s*pkgrel=\)['"'"'"]\?\([0-9]\+\)\.[0-9]*['"'"'"]\?\s*\(#.*\)\?$/\1"\2"/ + #~ ' "${pkgname}/PKGBUILD" + #~ fi + + #~ sed -i ' + #~ s/^\(\s*pkgrel=\)['"'"'"]\?\([0-9]\+\)\(\.[0-9.]*\)\?['"'"'"]\?\s*\(#.*\)\?$/\1"\2'"${sub_pkgrel:-\\3}"'"/ + #~ ' "${pkgname}/PKGBUILD" + + # remove "lib32-" and "gcc-multilib" from {make,check,opt,}depends + # shellcheck disable=SC2016 + sed -i ' + /^\s*\(make\|check\|opt\|\)depends\(_[^=[:space:]]\+\)\?=(/ { + :a + /^\s*\(\S[^=]*\)=(\(\([^()"'"'"']\|"[^"]*"\|['"'"'][^'"'"']*['"'"']\s*\)*\(#[^\n]*\n\)\?\)*)/! { + $b + N + ba + } + :b + s/\(=.*["'"'"'([:space:]]\)lib32-/\1/g + s/\(=.*["'"'"'([:space:]]\)gcc-multilib\(["'"'"')[:space:]]\)/\1gcc\2/g + s/\(=.*["'"'"'([:space:]][^[:space:]$]\+[<=>]\S\+\)-[^:"'"'"')[:space:]]\+\([:"'"'"')[:space:]]\)/\1\2/g + tb + } + ' "${pkgname}/PKGBUILD" + + # iterate the arch32 diffs in the archlinux32/master branch (we don't know + # the destination repo, so we just scan both 'core' and 'extra' as well as + # 'build-support') + listfile=$(mktemp --tmpdir="${WORKDIR}" pkgctl-arch32.XXXXXXXXXX) + >"${listfile}" + for repo in core extra build-support; do + git -C "${pkgname}" ls-tree -r --name-only archlinux32/master "${repo}/${pkgname}" >>"${listfile}" + done + for file in $(cat "${listfile}"); do + if [[ "${file##*/}" = "PKGBUILD" ]]; then + if [ -f "${pkgname}/PKGBUILD" ]; then + printf "\n\n# -- Arch32 specific --\n\n" >> "${pkgname}/PKGBUILD" + git -C "${pkgname}" show archlinux32/master:"${file}" >> "${pkgname}/PKGBUILD" + else + git -C "${pkgname}" show archlinux32/master:"${file}" > "${pkgname}/PKGBUILD" + fi + else + git -C "${pkgname}" show archlinux32/master:"${file}" > "${pkgname}/${file##*/}" + fi + done +} diff --git a/src/lib/repo/clone.sh b/src/lib/repo/clone.sh index ef6a0e2..33a333f 100644 --- a/src/lib/repo/clone.sh +++ b/src/lib/repo/clone.sh @@ -16,6 +16,8 @@ source "${_DEVTOOLS_LIBRARY_DIR}"/lib/api/gitlab.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/configure.sh # shellcheck source=src/lib/util/git.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh +# shellcheck source=src/lib/repo/arch32.sh +source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/arch32.sh source /usr/share/makepkg/util/message.sh @@ -40,6 +42,7 @@ pkgctl_repo_clone_usage() { --protocol https Clone the repository over https --switch VERSION Switch the current working tree to a specified version --universe Clone all existing packages, useful for cache warming + --arch32 Make all required modifications to build on Archlinux32 -j, --jobs N Run up to N jobs in parallel (default: $(nproc)) -h, --help Show this help text @@ -63,6 +66,7 @@ pkgctl_repo_clone() { local MAINTAINER= local VERSION= local CONFIGURE_OPTIONS=() + local ARCH32=0 local jobs= jobs=$(nproc) @@ -124,6 +128,10 @@ pkgctl_repo_clone() { jobs=$2 shift 2 ;; + --arch32) + ARCH32=1 + shift + ;; --) shift break @@ -194,5 +202,9 @@ pkgctl_repo_clone() { if [[ -n "${VERSION}" ]]; then pkgctl_repo_switch "${VERSION}" "${pkgbase}" fi + + if (( ARCH32 )); then + pkgctl_repo_patch_arch32 "${pkgbase}" + fi done } diff --git a/src/lib/valid-tags.sh b/src/lib/valid-tags.sh index cef0cc6..abca7ef 100644 --- a/src/lib/valid-tags.sh +++ b/src/lib/valid-tags.sh @@ -4,13 +4,16 @@ : # shellcheck disable=2034 -DEVTOOLS_VALID_ARCHES=( +_arch=( + pentium4 + i686 + i486 x86_64 any ) # shellcheck disable=2034 -DEVTOOLS_VALID_TAGS=( +_tags=( core-x86_64 core-any core-staging-x86_64 core-staging-any core-testing-x86_64 core-testing-any diff --git a/src/makechrootpkg.in b/src/makechrootpkg.in index 14b8f11..44b991b 100644 --- a/src/makechrootpkg.in +++ b/src/makechrootpkg.in @@ -182,6 +182,9 @@ prepare_chroot() { grep -q "^$x" "$copydir/etc/makepkg.conf" && continue echo "$x" >>"$copydir/etc/makepkg.conf" done + if [ -n "${PKGEXT}" ]; then + sed -i 's/^PKGEXT=.*/PKGEXT='"'${PKGEXT}'"'/' "$copydir/etc/makepkg.conf" + fi cat > "$copydir/etc/sudoers.d/builduser-pacman" <<EOF builduser ALL = NOPASSWD: /usr/bin/pacman @@ -215,6 +218,9 @@ _chrootbuild() { # shellcheck source=/dev/null . /etc/profile + # otherwise we might have missing keys + pacman-key --populate + # Beware, there are some stupid arbitrary rules on how you can # use "$" in arguments to commands with "sudo -i". ${foo} or # ${1} is OK, but $foo or $1 isn't. @@ -222,7 +228,7 @@ _chrootbuild() { sudo --preserve-env=SOURCE_DATE_EPOCH \ --preserve-env=BUILDTOOL \ --preserve-env=BUILDTOOLVER \ - -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@" + -iu builduser bash -c 'cd /startdir; GIT_TERMINAL_PROMPT=0 CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse makepkg "$@"' -bash "$@" ret=$? case $ret in 0|14) @@ -234,7 +240,10 @@ _chrootbuild() { _chrootnamcap() { pacman -S --needed --noconfirm namcap - for pkgfile in /startdir/PKGBUILD /pkgdest/*; do + for pkgfile in /startdir/PKGBUILD /startdir/*.pkg.tar.xz /pkgdest/*; do + if [ ! -f "${pkgfile}" ]; then + continue + fi echo "Checking ${pkgfile##*/}" sudo -u builduser namcap "$pkgfile" 2>&1 | tee "/logdest/${pkgfile##*/}-namcap.log" done @@ -247,7 +256,7 @@ download_sources() { # Ensure sources are downloaded sudo -u "$makepkg_user" --preserve-env=GNUPGHOME,SSH_AUTH_SOCK \ env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \ - makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" || + GIT_TERMINAL_PROMPT=0 makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" || die "Could not download sources." } @@ -342,6 +351,7 @@ done umask 0022 ORIG_HOME=$HOME +PKGEXT=$PKGEXT IFS=: read -r _ _ _ _ _ HOME _ < <(getent passwd "${SUDO_USER:-$USER}") load_makepkg_config HOME=$ORIG_HOME diff --git a/src/mkarchroot.in b/src/mkarchroot.in index fc60b4e..2abe001 100644 --- a/src/mkarchroot.in +++ b/src/mkarchroot.in @@ -91,12 +91,15 @@ done unshare --mount pacstrap -${umode}Mc ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' -printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen" +printf '%s.UTF-8 UTF-8\n' C en_US de_DE > "$working_dir/etc/locale.gen" +cat '/etc/hosts' > "$working_dir/etc/hosts" echo 'LANG=C.UTF-8' > "$working_dir/etc/locale.conf" echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot" systemd-machine-id-setup --root="$working_dir" +pacman-key --gpgdir "$working_dir"/etc/pacman.d/gnupg --init + exec arch-nspawn \ "${nspawn_args[@]}" \ "$working_dir" locale-gen |