diff --git a/Makefile b/Makefile index 20332e3..fabd93a 100644 --- a/Makefile +++ b/Makefile @@ -23,13 +23,18 @@ LIBS_BASE = \ SHARED_BASE = \ data/pacman-default.conf \ data/pacman-multilib.conf \ - data/pacman-mirrors-stable.conf \ - data/pacman-mirrors-testing.conf \ - data/pacman-mirrors-unstable.conf \ - data/pacman-arm.conf + data/pacman-mirrors.conf -SETS_PKG = \ - data/pkg.d/default.set +LIST_PKG = \ + data/pkg.list.d/default.list + +ARCH_CONF = \ + data/make.conf.d/i686.conf \ + data/make.conf.d/x86_64.conf \ + data/make.conf.d/multilib.conf +# data/make.conf.d/aarch64.conf \ +# data/make.conf.d/armv6h.conf \ +# data/make.conf.d/armv7h.conf BIN_PKG = \ bin/checkpkg \ @@ -46,17 +51,15 @@ LIBS_PKG = \ lib/util-pkgtree.sh SHARED_PKG = \ - data/makepkg-i686.conf \ - data/base-devel-udev \ - data/makepkg-x86_64.conf \ - data/makepkg-arm.conf + data/makepkg.conf \ + data/base-devel-udev -SETS_ISO = \ - data/iso.d/default.set \ - data/iso.d/official.set \ - data/iso.d/community.set \ - data/iso.d/minimal.set \ - data/iso.d/sonar.set +LIST_ISO = \ + data/iso.list.d/default.list \ + data/iso.list.d/official.list \ + data/iso.list.d/community.list \ + data/iso.list.d/minimal.list \ + data/iso.list.d/sonar.list BIN_ISO = \ bin/buildiso \ @@ -136,8 +139,11 @@ install_base: install -m0644 ${SHARED_BASE} $(DESTDIR)$(PREFIX)/share/manjaro-tools install_pkg: - install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/pkg.d - install -m0644 ${SETS_PKG} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/pkg.d + install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/pkg.list.d + install -m0644 ${LIST_PKG} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/pkg.list.d + + install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/make.conf.d + install -m0644 ${ARCH_CONF} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/make.conf.d install -dm0755 $(DESTDIR)$(PREFIX)/bin install -m0755 ${BIN_PKG} $(DESTDIR)$(PREFIX)/bin @@ -155,8 +161,8 @@ install_pkg: gzip -c man/buildtree.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildtree.1.gz install_iso: - install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/iso.d - install -m0644 ${SETS_ISO} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/iso.d + install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/iso.list.d + install -m0644 ${LIST_ISO} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/iso.list.d install -dm0755 $(DESTDIR)$(PREFIX)/bin install -m0755 ${BIN_ISO} $(DESTDIR)$(PREFIX)/bin @@ -188,7 +194,8 @@ uninstall_base: for f in ${LIBS_BASE}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done uninstall_pkg: - for f in ${SETS_PKG}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/pkg.d/$$f; done + for f in ${LIST_PKG}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/pkg.list.d/$$f; done + for f in ${ARCH_CONF}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/make.conf.d/$$f; done for f in ${BIN_PKG}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides for f in ${SHARED_PKG}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done @@ -197,7 +204,7 @@ uninstall_pkg: rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildtree.1.gz uninstall_iso: - for f in ${SETS_ISO}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/iso.d/$$f; done + for f in ${LIST_ISO}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/iso.list.d/$$f; done for f in ${BIN_ISO}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done for f in ${SHARED_ISO}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done for f in ${LIBS_ISO}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done diff --git a/README.md b/README.md index 907ea93..de1358b 100644 --- a/README.md +++ b/README.md @@ -33,16 +33,18 @@ By default it is commented and shows just initialization values done in code. Tools configuration is done in manjaro-tools.conf or by args. Specifying args will override manjaro-tools.conf settings. -User sets can be placed in +User build lists(eg 'my-super-build.list') can be placed in ~~~ -$HOME/.config/manjaro-tools/{pkg,iso}.d +$HOME/.config/manjaro-tools/pkg.list.d +$HOME/.config/manjaro-tools/iso.list.d ~~~ overriding ~~~ -/etc/manjaro-tools/{pkg,iso}.d +/etc/manjaro-tools/pkg.list.d +/etc/manjaro-tools/iso.list.d ~~~ @@ -81,15 +83,15 @@ overriding ################ buildpkg ################ -# default pkg buildset; name without .set extension -# buildset_pkg=default +# default pkg build list; name without .list extension +# build_list_pkg=default ################ buildiso ################ # profile_repo='manjaro-tools-iso-profiles' -# default iso buildset; name without .set extension -# buildset_iso=default +# default iso build list; name without .list extension +# build_list_iso=default # unset defaults to given value # dist_name="Manjaro" @@ -355,7 +357,7 @@ Usage: deployiso [options] -h This help ~~~ -######* upload official buildset, ie all built iso defined in a buildset +######* upload official build list, ie all built iso defined in a build list ~~~ deployiso -p official -c diff --git a/bin/buildiso.in b/bin/buildiso.in index 0b2f393..2492c16 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -21,6 +21,8 @@ import ${LIBDIR}/util.sh show_profile(){ prepare_profile "$1" + msg2 "pacman_conf: %s" "${pacman_conf}" +# msg2 "mirrors_conf: %s" "${mirrors_conf}" if ${verbose};then msg2 "work_dir: %s" "${work_dir}" msg2 "iso_dir: %s" "${iso_dir}" @@ -61,13 +63,11 @@ display_settings(){ show_config msg "PROFILE:" - msg2 "sets_dir_iso: %s" "${sets_dir_iso}" - msg2 "buildsets: %s" "$(list_sets ${sets_dir_iso})" - msg2 "buildset_iso: %s" "${buildset_iso}" - msg2 "is_buildset: %s" "${is_buildset}" - ${verbose} && msg2 "run_dir: %s" "${run_dir}" - ${verbose} && msg2 "log_dir: %s" "${log_dir}" - msg2 "pacman_conf: %s" "${pacman_conf}" + msg2 "list_dir_iso: %s" "${list_dir_iso}" + msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})" + msg2 "build_list_iso: %s" "${build_list_iso}" + msg2 "is_build_list: %s" "${is_build_list}" + msg2 "build_mirror: %s" "${build_mirror}/${target_branch}" msg "OPTIONS:" msg2 "arch: %s" "${target_arch}" @@ -82,6 +82,12 @@ display_settings(){ msg2 "iso_only: %s" "${iso_only}" msg2 "sign: %s" "${sign}" + if ${verbose}; then + msg "PATHS:" + msg2 "run_dir: %s" "${run_dir}" + msg2 "log_dir: %s" "${log_dir}" + fi + msg "DIST SETTINGS:" msg2 "dist_name: %s" "${dist_name}" msg2 "dist_release: %s" "${dist_release}" @@ -97,7 +103,7 @@ display_settings(){ ${verbose} && msg2 "iso_fs: %s" "${iso_fs}" msg "BUILD QUEUE:" - run show_profile "${buildset_iso}" + run show_profile "${build_list_iso}" } load_user_info @@ -117,11 +123,9 @@ iso_only=false verbose=false sign=false -pacman_conf_arch='default' - usage() { echo "Usage: ${0##*/} [options]" - echo " -p Buildset or profile [default: ${buildset_iso}]" + echo " -p Buildset or profile [default: ${build_list_iso}]" echo " -a Arch [default: ${target_arch}]" echo " -b Branch [default: ${target_branch}]" echo ' -r Chroots directory' @@ -151,7 +155,7 @@ opts='p:a:b:r:t:k:i:czxsvqh' while getopts "${opts}" arg; do case "${arg}" in - p) buildset_iso="$OPTARG" ;; + p) build_list_iso="$OPTARG" ;; a) target_arch="$OPTARG" ;; b) target_branch="$OPTARG" ;; r) chroots_iso="$OPTARG" ;; @@ -173,13 +177,9 @@ shift $(($OPTIND - 1)) timer_start=$(get_timer) -[[ "${target_arch}" == 'x86_64' ]] && pacman_conf_arch='multilib' - -mirrors_conf="${DATADIR}/pacman-mirrors-${target_branch}.conf" - check_root "$0" "${orig_argv[@]}" -eval_buildset "${sets_dir_iso}" "${buildset_iso}" +eval_build_list "${list_dir_iso}" "${build_list_iso}" import ${LIBDIR}/util-iso.sh @@ -187,4 +187,4 @@ check_requirements ${pretend} && display_settings && exit 1 -run build "${buildset_iso}" +run build "${build_list_iso}" diff --git a/bin/buildpkg.in b/bin/buildpkg.in index d35417a..a6a7c6e 100644 --- a/bin/buildpkg.in +++ b/bin/buildpkg.in @@ -23,6 +23,7 @@ import ${LIBDIR}/util.sh import ${LIBDIR}/util-pkg.sh show_pkg(){ + check_build "$1" cd $1 source PKGBUILD for n in ${pkgname[@]}; do @@ -36,16 +37,20 @@ display_settings(){ show_config msg "PROFILE:" - msg2 "sets_dir_pkg: %s" "${sets_dir_pkg}" - msg2 "buildsets: %s" "$(list_sets ${sets_dir_pkg})" - msg2 "buildset_pkg: %s" "${buildset_pkg}" - msg2 "is_buildset: %s" "${is_buildset}" + msg2 "list_dir_pkg: %s" "${list_dir_pkg}" + msg2 "build_lists: %s" "$(show_build_lists ${list_dir_pkg})" + msg2 "build_list_pkg: %s" "${build_list_pkg}" + msg2 "is_build_list: %s" "${is_build_list}" + msg2 "build_mirror: %s" "${build_mirror}/${target_branch}" +# msg2 "make_conf_dir: %s" "${make_conf_dir}" +# msg2 "build_profiles: %s" "$(show_build_profiles ${make_conf_dir})" msg "OPTIONS:" msg2 "arch: %s" "${target_arch}" msg2 "branch: %s" "${target_branch}" msg2 "chroots_pkg: %s" "${chroots_pkg}" + msg "ARGS:" msg2 "clean_first: %s" "${clean_first}" msg2 "wipe_clean: %s" "${wipe_clean}" @@ -57,9 +62,9 @@ display_settings(){ msg "PATHS:" msg2 "work_dir: %s" "${work_dir}" msg2 "pkg_dir: %s" "${pkg_dir}" - msg2 "build_mirror: %s" "${build_mirror}/${target_branch}" - msg2 "pacman_conf: %s" "${pacman_conf}" - msg2 "makepkg_conf: %s" "${makepkg_conf}" +# msg2 "mirrors_conf: %s" "${mirrors_conf}" +# msg2 "pacman_conf: %s" "${pacman_conf}" +# msg2 "makepkg_conf: %s" "${makepkg_conf}" if ${clean_first};then msg "PKG:" @@ -67,7 +72,7 @@ display_settings(){ fi msg "BUILD QUEUE:" - run show_pkg "${buildset_pkg}" + run show_pkg "${build_list_pkg}" } load_user_info @@ -84,13 +89,14 @@ clean_first=false wipe_clean=false namcap=false pretend=false -is_buildset=false +is_build_list=false sign=false udev_root=false +is_multilib=false usage() { echo "Usage: ${0##*/} [options]" - echo " -p Buildset or pkg [default: ${buildset_pkg}]" + echo " -p Build list or pkg [default: ${build_list_pkg}]" echo " -a Arch [default: ${target_arch}]" echo " -b Branch [default: ${target_branch}]" echo ' -r Chroots directory' @@ -114,12 +120,12 @@ opts='p:a:b:r:i:cwnsuqh' while getopts "${opts}" arg; do case "${arg}" in - p) buildset_pkg="$OPTARG" ;; + p) build_list_pkg="$OPTARG" ;; a) target_arch="$OPTARG" ;; b) target_branch="$OPTARG" ;; r) chroots_pkg="$OPTARG" ;; i) install_pkgs+="$OPTARG"; mkchrootpkg_args+=(-I ${install_pkgs[*]}) ;; - c) clean_first=true; mkchroot_args+=(-L) ;; + c) clean_first=true ;; w) wipe_clean=true ;; n) namcap=true; mkchrootpkg_args+=(-n) ;; s) sign=true ;; @@ -130,17 +136,19 @@ while getopts "${opts}" arg; do esac done -configure_chroot_arch "${target_arch}" +check_root "$0" "${orig_argv[@]}" + +prepare_conf "${target_arch}" + +mirrors_conf=$(get_pac_mirrors_conf "${target_branch}") mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}") mkchrootpkg_args+=(-r ${work_dir}) -check_root "$0" "${orig_argv[@]}" - timer_start=$(get_timer) -eval_buildset "${sets_dir_pkg}" "${buildset_pkg}" +eval_build_list "${list_dir_pkg}" "${build_list_pkg}" prepare_dir "${pkg_dir}" @@ -152,4 +160,4 @@ ${wipe_clean} && clean_up chroot_init -run make_pkg "${buildset_pkg}" +run make_pkg "${build_list_pkg}" diff --git a/bin/deployiso.in b/bin/deployiso.in index 53b6cf6..89182b6 100644 --- a/bin/deployiso.in +++ b/bin/deployiso.in @@ -31,10 +31,10 @@ display_settings(){ show_config msg "PROFILE:" - msg2 "sets_dir_iso: %s" "${sets_dir_iso}" - msg2 "buildsets: %s" "$(list_sets ${sets_dir_iso})" - msg2 "buildset_iso: %s" "${buildset_iso}" - msg2 "is_buildset: %s" "${is_buildset}" + msg2 "list_dir_iso: %s" "${list_dir_iso}" + msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})" + msg2 "build_list_iso: %s" "${build_list_iso}" + msg2 "is_build_list: %s" "${is_build_list}" msg "OPTIONS:" msg2 "arch: %s" "${target_arch}" @@ -62,7 +62,7 @@ display_settings(){ msg2 "piece_size: %s" "${piece_size}" fi msg "UPLOAD QUEUE:" - run show_profile "${buildset_iso}" + run show_profile "${build_list_iso}" } load_user_info @@ -83,7 +83,7 @@ mktorrent_args=(-v -p) usage() { echo "Usage: ${0##*/} [options]" - echo " -p Source folder to upload [default:${buildset_iso}]" + echo " -p Source folder to upload [default:${build_list_iso}]" echo " -a Arch to upload [default:${target_arch}]" echo " -i The iso's init system [default:${initsys}]" echo " -l Limit bandwidth in kB/s [default:${limit}]" @@ -102,7 +102,7 @@ opts='p:a:l:i:ctuvqh' while getopts "${opts}" arg; do case "${arg}" in - p) buildset_iso="$OPTARG" ;; + p) build_list_iso="$OPTARG" ;; a) target_arch="$OPTARG" ;; i) initsys="$OPTARG" ;; l) limit="$OPTARG" ;; @@ -120,7 +120,7 @@ shift $(($OPTIND - 1)) timer_start=$(get_timer) -eval_buildset "${sets_dir_iso}" "${buildset_iso}" +eval_build_list "${list_dir_iso}" "${build_list_iso}" rsync_args+=(--bwlimit=${limit}) mktorrent_args+=(-l ${piece_size} -a ${tracker_url}) @@ -130,4 +130,4 @@ shell_url=${remote_user},${remote_project}@shell.${remote_url} ${pretend} && display_settings && exit 1 -run sync_dir "${buildset_iso}" +run sync_dir "${build_list_iso}" diff --git a/bin/mkchrootpkg.in b/bin/mkchrootpkg.in index 4fa8b1b..a76e276 100644 --- a/bin/mkchrootpkg.in +++ b/bin/mkchrootpkg.in @@ -197,8 +197,6 @@ prepare_chroot() { printf >>"$copydir/etc/group" 'builduser:x:%d:\n' $builduser_gid printf >>"$copydir/etc/passwd" 'builduser:x:%d:%d:builduser:/build:/bin/bash\n' $builduser_uid $builduser_gid - info "copydir: %s" "$copydir" - $install -d "$copydir"/{build,build/.gnupg,startdir,{pkg,srcpkg,src,log}dest} for x in .gnupg/pubring.{kbx,gpg}; do diff --git a/bin/signfile.in b/bin/signfile.in index 977034d..72301f9 100644 --- a/bin/signfile.in +++ b/bin/signfile.in @@ -25,5 +25,5 @@ if [ ! -e "$1" ]; then exit 1 fi -msg2 "Signing %s with key %s" "$1" "${GPGKEY}..." +msg2 "Signing [%s] with key %s" "${1##*/}" "${GPGKEY}..." gpg --detach-sign --use-agent -u "${GPGKEY}" "$1" diff --git a/data/iso.d/community.set b/data/iso.list.d/community.list similarity index 100% rename from data/iso.d/community.set rename to data/iso.list.d/community.list diff --git a/data/iso.d/default.set b/data/iso.list.d/default.list similarity index 100% rename from data/iso.d/default.set rename to data/iso.list.d/default.list diff --git a/data/iso.d/minimal.set b/data/iso.list.d/minimal.list similarity index 100% rename from data/iso.d/minimal.set rename to data/iso.list.d/minimal.list diff --git a/data/iso.d/official.set b/data/iso.list.d/official.list similarity index 100% rename from data/iso.d/official.set rename to data/iso.list.d/official.list diff --git a/data/iso.d/sonar.set b/data/iso.list.d/sonar.list similarity index 100% rename from data/iso.d/sonar.set rename to data/iso.list.d/sonar.list diff --git a/data/make.conf.d/aarch64.conf b/data/make.conf.d/aarch64.conf new file mode 100644 index 0000000..7359599 --- /dev/null +++ b/data/make.conf.d/aarch64.conf @@ -0,0 +1,3 @@ +carch="aarch64" +chost="aarch64-unknown-linux-gnu" +cflags="-march=armv8-a -O2 -pipe -fstack-protector --param=ssp-buffer-size=4" diff --git a/data/make.conf.d/armv6h.conf b/data/make.conf.d/armv6h.conf new file mode 100644 index 0000000..b57662f --- /dev/null +++ b/data/make.conf.d/armv6h.conf @@ -0,0 +1,3 @@ +carch="armv6h" +chost="armv6l-unknown-linux-gnueabihf" +cflags="-march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector --param=ssp-buffer-size=4" diff --git a/data/make.conf.d/armv7h.conf b/data/make.conf.d/armv7h.conf new file mode 100644 index 0000000..ca0e1ea --- /dev/null +++ b/data/make.conf.d/armv7h.conf @@ -0,0 +1,3 @@ +carch="armv7h" +chost="armv7l-unknown-linux-gnueabihf" +cflags="-march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector --param=ssp-buffer-size=4" diff --git a/data/make.conf.d/i686.conf b/data/make.conf.d/i686.conf new file mode 100644 index 0000000..b66d84c --- /dev/null +++ b/data/make.conf.d/i686.conf @@ -0,0 +1,3 @@ +carch="i686" +chost="i686-pc-linux-gnu" +cflags="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong" diff --git a/data/make.conf.d/multilib.conf b/data/make.conf.d/multilib.conf new file mode 100644 index 0000000..631f6d1 --- /dev/null +++ b/data/make.conf.d/multilib.conf @@ -0,0 +1,3 @@ +carch="x86_64" +chost="x86_64-pc-linux-gnu" +cflags="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong" diff --git a/data/make.conf.d/x86_64.conf b/data/make.conf.d/x86_64.conf new file mode 100644 index 0000000..631f6d1 --- /dev/null +++ b/data/make.conf.d/x86_64.conf @@ -0,0 +1,3 @@ +carch="x86_64" +chost="x86_64-pc-linux-gnu" +cflags="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong" diff --git a/data/makepkg-i686.conf b/data/makepkg-i686.conf deleted file mode 100644 index 8917062..0000000 --- a/data/makepkg-i686.conf +++ /dev/null @@ -1,148 +0,0 @@ -# -# /etc/makepkg.conf -# - -######################################################################### -# SOURCE ACQUISITION -######################################################################### -# -#-- The download utilities that makepkg should use to acquire sources -# Format: 'protocol::agent' -DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u' - 'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u' - 'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u' - 'rsync::/usr/bin/rsync --no-motd -z %u %o' - 'scp::/usr/bin/scp -C %u %o') - -# Other common tools: -# /usr/bin/snarf -# /usr/bin/lftpget -c -# /usr/bin/wget - -#-- The package required by makepkg to download VCS sources -# Format: 'protocol::package' -VCSCLIENTS=('bzr::bzr' - 'git::git' - 'hg::mercurial' - 'svn::subversion') - - -######################################################################### -# ARCHITECTURE, COMPILE FLAGS -######################################################################### -# -CARCH="i686" -CHOST="i686-pc-linux-gnu" - -#-- Compiler and Linker Flags -# -march (or -mcpu) builds exclusively for an architecture -# -mtune optimizes for an architecture, but builds for whole processor family -CPPFLAGS="-D_FORTIFY_SOURCE=2" -CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong" -CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong" -LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro" -#-- Make Flags: change this for DistCC/SMP systems -#MAKEFLAGS="-j2" -#-- Debugging flags -DEBUG_CFLAGS="-g -fvar-tracking-assignments" -DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" - -######################################################################### -# BUILD ENVIRONMENT -######################################################################### -# -# Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign) -# A negated environment option will do the opposite of the comments below. -# -#-- fakeroot: Allow building packages as a non-root user -#-- distcc: Use the Distributed C/C++/ObjC compiler -#-- color: Colorize output messages -#-- ccache: Use ccache to cache compilation -#-- check: Run the check() function if present in the PKGBUILD -#-- sign: Generate PGP signature file -# -BUILDENV=(!distcc color !ccache check !sign) -# -#-- If using DistCC, your MAKEFLAGS will also need modification. In addition, -#-- specify a space-delimited list of hosts running in the DistCC cluster. -#DISTCC_HOSTS="" -# -#-- Specify a directory for package building. -#BUILDDIR=/tmp/makepkg - -######################################################################### -# GLOBAL PACKAGE OPTIONS -# These are default values for the options=() settings -######################################################################### -# -# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug) -# A negated option will do the opposite of the comments below. -# -#-- strip: Strip symbols from binaries/libraries -#-- docs: Save doc directories specified by DOC_DIRS -#-- libtool: Leave libtool (.la) files in packages -#-- staticlibs: Leave static library (.a) files in packages -#-- emptydirs: Leave empty directories in packages -#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip -#-- purge: Remove files specified by PURGE_TARGETS -#-- upx: Compress binary executable files using UPX -#-- debug: Add debugging flags as specified in DEBUG_* variables -# -OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug) - -#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 -INTEGRITY_CHECK=(md5) -#-- 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. -STRIP_SHARED="--strip-unneeded" -#-- Options to be used when stripping static libraries. See `man strip' for details. -STRIP_STATIC="--strip-debug" -#-- Manual (man and info) directories to compress (if zipman is specified) -MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info}) -#-- Doc directories to remove (if !docs is specified) -DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc}) -#-- Files to be removed from all packages (if purge is specified) -PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod) - -######################################################################### -# PACKAGE OUTPUT -######################################################################### -# -# Default: put built package and cached source in build directory -# -#-- Destination: specify a fixed directory where all packages will be placed -#PKGDEST=/home/packages -#-- Source cache: specify a fixed directory where source files will be cached -#SRCDEST=/home/sources -#-- Source packages: specify a fixed directory where all src packages will be placed -#SRCPKGDEST=/home/srcpackages -#-- Log files: specify a fixed directory where all log files will be placed -#LOGDEST=/home/makepkglogs -#-- Packager: name/email of the person or organization building packages -#PACKAGER="John Doe " -#-- Specify a key to use for package signing -#GPGKEY="" - -######################################################################### -# COMPRESSION DEFAULTS -######################################################################### -# -COMPRESSGZ=(gzip -c -f -n) -COMPRESSBZ2=(bzip2 -c -f) -COMPRESSXZ=(xz -c -z -) -COMPRESSLRZ=(lrzip -q) -COMPRESSLZO=(lzop -q) -COMPRESSZ=(compress -c -f) - -######################################################################### -# EXTENSION DEFAULTS -######################################################################### -# -# WARNING: Do NOT modify these variables unless you know what you are -# doing. -# -PKGEXT='.pkg.tar.xz' -SRCEXT='.src.tar.gz' - -# vim: set ft=sh ts=2 sw=2 et: diff --git a/data/makepkg-x86_64.conf b/data/makepkg-x86_64.conf deleted file mode 100644 index 938c78f..0000000 --- a/data/makepkg-x86_64.conf +++ /dev/null @@ -1,147 +0,0 @@ -# -# /etc/makepkg.conf -# - -######################################################################### -# SOURCE ACQUISITION -######################################################################### -# -#-- The download utilities that makepkg should use to acquire sources -# Format: 'protocol::agent' -DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u' - 'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u' - 'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u' - 'rsync::/usr/bin/rsync --no-motd -z %u %o' - 'scp::/usr/bin/scp -C %u %o') - -# Other common tools: -# /usr/bin/snarf -# /usr/bin/lftpget -c -# /usr/bin/wget - -#-- The package required by makepkg to download VCS sources -# Format: 'protocol::package' -VCSCLIENTS=('bzr::bzr' - 'git::git' - 'hg::mercurial' - 'svn::subversion') - -######################################################################### -# ARCHITECTURE, COMPILE FLAGS -######################################################################### -# -CARCH="x86_64" -CHOST="x86_64-unknown-linux-gnu" - -#-- Compiler and Linker Flags -# -march (or -mcpu) builds exclusively for an architecture -# -mtune optimizes for an architecture, but builds for whole processor family -CPPFLAGS="-D_FORTIFY_SOURCE=2" -CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong" -CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong" -LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro" -#-- Make Flags: change this for DistCC/SMP systems -#MAKEFLAGS="-j2" -#-- Debugging flags -DEBUG_CFLAGS="-g -fvar-tracking-assignments" -DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" - -######################################################################### -# BUILD ENVIRONMENT -######################################################################### -# -# Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign) -# A negated environment option will do the opposite of the comments below. -# -#-- fakeroot: Allow building packages as a non-root user -#-- distcc: Use the Distributed C/C++/ObjC compiler -#-- color: Colorize output messages -#-- ccache: Use ccache to cache compilation -#-- check: Run the check() function if present in the PKGBUILD -#-- sign: Generate PGP signature file -# -BUILDENV=(!distcc color !ccache check !sign) -# -#-- If using DistCC, your MAKEFLAGS will also need modification. In addition, -#-- specify a space-delimited list of hosts running in the DistCC cluster. -#DISTCC_HOSTS="" -# -#-- Specify a directory for package building. -#BUILDDIR=/tmp/makepkg - -######################################################################### -# GLOBAL PACKAGE OPTIONS -# These are default values for the options=() settings -######################################################################### -# -# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug) -# A negated option will do the opposite of the comments below. -# -#-- strip: Strip symbols from binaries/libraries -#-- docs: Save doc directories specified by DOC_DIRS -#-- libtool: Leave libtool (.la) files in packages -#-- staticlibs: Leave static library (.a) files in packages -#-- emptydirs: Leave empty directories in packages -#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip -#-- purge: Remove files specified by PURGE_TARGETS -#-- upx: Compress binary executable files using UPX -#-- debug: Add debugging flags as specified in DEBUG_* variables -# -OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug) - -#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 -INTEGRITY_CHECK=(md5) -#-- 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. -STRIP_SHARED="--strip-unneeded" -#-- Options to be used when stripping static libraries. See `man strip' for details. -STRIP_STATIC="--strip-debug" -#-- Manual (man and info) directories to compress (if zipman is specified) -MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info}) -#-- Doc directories to remove (if !docs is specified) -DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc}) -#-- Files to be removed from all packages (if purge is specified) -PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod) - -######################################################################### -# PACKAGE OUTPUT -######################################################################### -# -# Default: put built package and cached source in build directory -# -#-- Destination: specify a fixed directory where all packages will be placed -#PKGDEST=/home/packages -#-- Source cache: specify a fixed directory where source files will be cached -#SRCDEST=/home/sources -#-- Source packages: specify a fixed directory where all src packages will be placed -#SRCPKGDEST=/home/srcpackages -#-- Log files: specify a fixed directory where all log files will be placed -#LOGDEST=/home/makepkglogs -#-- Packager: name/email of the person or organization building packages -#PACKAGER="John Doe " -#-- Specify a key to use for package signing -#GPGKEY="" - -######################################################################### -# COMPRESSION DEFAULTS -######################################################################### -# -COMPRESSGZ=(gzip -c -f -n) -COMPRESSBZ2=(bzip2 -c -f) -COMPRESSXZ=(xz -c -z -) -COMPRESSLRZ=(lrzip -q) -COMPRESSLZO=(lzop -q) -COMPRESSZ=(compress -c -f) - -######################################################################### -# EXTENSION DEFAULTS -######################################################################### -# -# WARNING: Do NOT modify these variables unless you know what you are -# doing. -# -PKGEXT='.pkg.tar.xz' -SRCEXT='.src.tar.gz' - -# vim: set ft=sh ts=2 sw=2 et: diff --git a/data/makepkg-arm.conf b/data/makepkg.conf similarity index 97% rename from data/makepkg-arm.conf rename to data/makepkg.conf index 7a75cdd..a663b1a 100644 --- a/data/makepkg-arm.conf +++ b/data/makepkg.conf @@ -37,8 +37,8 @@ CHOST="@CHOST@" # -march (or -mcpu) builds exclusively for an architecture # -mtune optimizes for an architecture, but builds for whole processor family CPPFLAGS="-D_FORTIFY_SOURCE=2" -CFLAGS="@CARCHFLAGS@-O2 -pipe -fstack-protector --param=ssp-buffer-size=4" -CXXFLAGS="@CARCHFLAGS@-O2 -pipe -fstack-protector --param=ssp-buffer-size=4" +CFLAGS="@CFLAGS@" +CXXFLAGS="@CFLAGS@" LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro" #-- Make Flags: change this for DistCC/SMP systems #MAKEFLAGS="-j2" diff --git a/data/manjaro-tools.conf b/data/manjaro-tools.conf index 4cbe348..80615a9 100644 --- a/data/manjaro-tools.conf +++ b/data/manjaro-tools.conf @@ -32,16 +32,16 @@ ################ buildpkg ################ -# default pkg buildset; name without .set extension -# buildset_pkg=default +# default pkg build list; name without .list extension +# build_list_pkg=default ################ buildiso ################ # the name of the profiles directory # profile_repo='manjaro-tools-iso-profiles' -# default iso buildset; name without .set extension -# buildset_iso=default +# default iso build list; name without .list extension +# build_list_iso=default # the dist name; default: Manjaro # dist_name="Manjaro" diff --git a/data/pacman-arm.conf b/data/pacman-arm.conf deleted file mode 100644 index fbe49e8..0000000 --- a/data/pacman-arm.conf +++ /dev/null @@ -1,92 +0,0 @@ -# -# /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 -# If upgrades are available for these packages they will be asked for first -SyncFirst = manjaro-system archlinux-keyring manjaro-keyring -#XferCommand = /usr/bin/curl -C - -f %u > %o -#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u -#CleanMethod = KeepInstalled -#UseDelta = 0.7 -Architecture = @CARCH@ - -# 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 Manjaro Linux -# packagers with `pacman-key --populate archlinux manjaro`. - -# -# 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. - -[core] -SigLevel = PackageRequired -Include = /etc/pacman.d/mirrorlist - -[extra] -SigLevel = PackageRequired -Include = /etc/pacman.d/mirrorlist - -[community] -SigLevel = PackageRequired -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/data/pacman-mirrors-testing.conf b/data/pacman-mirrors-testing.conf deleted file mode 100644 index 80ed4df..0000000 --- a/data/pacman-mirrors-testing.conf +++ /dev/null @@ -1,28 +0,0 @@ -## -## /etc/pacman-mirrors.conf -## - -## Branch Pacman should use (stable, testing, unstable) -Branch = testing - -## Generation method -## 1) rank - rank mirrors depending on their access time -## 2) random - randomly generate the output mirrorlist -# Method = rank - -## Specify to use only mirrors from specific a country. -## Can add multiple countries separated by a comma (ex: Germany,France) -## Empty means all -# OnlyCountry = - -## Mirrors directory -# MirrorlistsDir = /etc/pacman.d/mirrors - -## Output file -# OutputMirrorlist = /etc/pacman.d/mirrorlist - -## When set to True prevents the regeneration of the mirrorlist if -## pacman-mirrors is invoked with the --no-update argument. -## Useful if you don't want the mirrorlist regenerated after a -## pacman-mirrors package upgrade. -# NoUpdate = False diff --git a/data/pacman-mirrors-unstable.conf b/data/pacman-mirrors-unstable.conf deleted file mode 100644 index d64509d..0000000 --- a/data/pacman-mirrors-unstable.conf +++ /dev/null @@ -1,28 +0,0 @@ -## -## /etc/pacman-mirrors.conf -## - -## Branch Pacman should use (stable, testing, unstable) -Branch = unstable - -## Generation method -## 1) rank - rank mirrors depending on their access time -## 2) random - randomly generate the output mirrorlist -# Method = rank - -## Specify to use only mirrors from specific a country. -## Can add multiple countries separated by a comma (ex: Germany,France) -## Empty means all -# OnlyCountry = - -## Mirrors directory -# MirrorlistsDir = /etc/pacman.d/mirrors - -## Output file -# OutputMirrorlist = /etc/pacman.d/mirrorlist - -## When set to True prevents the regeneration of the mirrorlist if -## pacman-mirrors is invoked with the --no-update argument. -## Useful if you don't want the mirrorlist regenerated after a -## pacman-mirrors package upgrade. -# NoUpdate = False diff --git a/data/pacman-mirrors-stable.conf b/data/pacman-mirrors.conf similarity index 100% rename from data/pacman-mirrors-stable.conf rename to data/pacman-mirrors.conf diff --git a/data/pkg.d/default.set b/data/pkg.list.d/default.list similarity index 100% rename from data/pkg.d/default.set rename to data/pkg.list.d/default.list diff --git a/docbook/buildiso.xml b/docbook/buildiso.xml index 29c9e64..76494c3 100644 --- a/docbook/buildiso.xml +++ b/docbook/buildiso.xml @@ -74,8 +74,8 @@ - Name of the buildset or name of the directory - you will build. It needs to cantains a existing buildset or a + Name of the build list or name of the directory + you will build. It needs to cantains a existing build list or a folder with a valid profile. diff --git a/docbook/buildpkg.xml b/docbook/buildpkg.xml index d64aef3..a5a5847 100644 --- a/docbook/buildpkg.xml +++ b/docbook/buildpkg.xml @@ -70,8 +70,8 @@ - Name of the buildset or name of the directory - you will build. It needs to cantain a existing buildset or a + Name of the build list or name of the directory + you will build. It needs to cantain a existing build list or a folder with a valid PKGBUILD. diff --git a/docbook/deployiso.xml b/docbook/deployiso.xml index 6962769..78e0101 100644 --- a/docbook/deployiso.xml +++ b/docbook/deployiso.xml @@ -73,7 +73,7 @@ - Name of the buildset or name of the directory + Name of the build list or name of the directory you will upload. diff --git a/docbook/manjaro-tools.conf.xml b/docbook/manjaro-tools.conf.xml index 3654977..431b5ec 100644 --- a/docbook/manjaro-tools.conf.xml +++ b/docbook/manjaro-tools.conf.xml @@ -160,9 +160,9 @@ - buildset_pkg= + build_list_pkg= - Default set for buildpkg without the .set + Default list for buildpkg without the .list extension. @@ -177,9 +177,9 @@ - buildset_iso= + build_list_iso= - Default set for buildiso without the .set + Default list for buildiso without the .list extension. diff --git a/lib/util-iso-boot.sh b/lib/util-iso-boot.sh index df66aa5..eb49c64 100644 --- a/lib/util-iso-boot.sh +++ b/lib/util-iso-boot.sh @@ -61,7 +61,11 @@ copy_efi_loaders(){ msg2 "Copying efi loaders ..." cp $1/usr/share/efitools/efi/PreLoader.efi $2/bootx64.efi cp $1/usr/share/efitools/efi/HashTool.efi $2/ - cp $1/usr/lib/systemd/boot/efi/systemd-bootx64.efi $2/loader.efi + if [[ -f $1/usr/lib/systemd/boot/efi/systemd-bootx64.efi ]] ; then + cp $1/usr/lib/systemd/boot/efi/systemd-bootx64.efi $2/loader.efi + else + cp $1/usr/share/efitools/efi/Loader.efi $2/loader.efi + fi } copy_boot_images(){ diff --git a/lib/util-iso-calamares.sh b/lib/util-iso-calamares.sh index d893dac..c117af2 100644 --- a/lib/util-iso-calamares.sh +++ b/lib/util-iso-calamares.sh @@ -38,12 +38,10 @@ write_calamares_branding_desc(){ } write_calamares_machineid_conf(){ - if [[ ${initsys} == 'openrc' ]];then - local conf="$1/etc/calamares/modules/machineid.conf" - echo "systemd: false" > $conf - echo "dbus: true" >> $conf - echo "symlink: true" >> $conf - fi + local conf="$1/etc/calamares/modules/machineid.conf" + echo "systemd: false" > $conf + echo "dbus: true" >> $conf + echo "symlink: true" >> $conf } write_calamares_finished_conf(){ @@ -117,7 +115,7 @@ write_calamares_displaymanager_conf(){ echo "displaymanagers:" > "$conf" echo " - ${displaymanager}" >> "$conf" echo '' >> "$conf" - if [[ ${default_desktop_executable} != "none" ]] && [[ ${default_desktop_file} != "none" ]]; then + if $(is_valid_de); then echo "defaultDesktopEnvironment:" >> "$conf" echo " executable: \"${default_desktop_executable}\"" >> "$conf" echo " desktopFile: \"${default_desktop_file}\"" >> "$conf" diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index b6fd1f6..dfc52ef 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -120,7 +120,6 @@ set_xdm(){ } is_valid_de(){ - local func=$1 if [[ ${default_desktop_executable} != "none" ]] && \ [[ ${default_desktop_file} != "none" ]]; then return 0 @@ -444,7 +443,7 @@ download_to_cache(){ # $1: image path # $2: packages chroot_create(){ - [[ "$1" == "${work_dir}/root-image" ]] && local flag="-L" + [[ "${1##*/}" == "root-image" ]] && local flag="-L" setarch "${target_arch}" \ mkchroot ${mkchroot_args[*]} ${flag} $@ } diff --git a/lib/util-iso.sh b/lib/util-iso.sh index 012cde0..7abecdd 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -199,7 +199,7 @@ make_image_root() { local path="${work_dir}/root-image" mkdir -p ${path} - chroot_create "${path}" "${packages}" + chroot_create "${path}" "${packages}" || die pacman -Qr "${path}" > "${path}/root-image-pkgs.txt" copy_overlay "${profile_dir}/root-overlay" "${path}" @@ -645,18 +645,19 @@ make_profile(){ show_elapsed_time "${FUNCNAME}" "${timer_start}" } -set_pacman_conf(){ - local user_conf=${profile_dir}/user-repos.conf +get_pacman_conf(){ + local user_conf=${profile_dir}/user-repos.conf pac_arch='default' conf + [[ "${target_arch}" == 'x86_64' ]] && pac_arch='multilib' if [[ -f ${user_conf} ]];then info "detected: %s" "user-repos.conf" check_user_repos_conf "${user_conf}" - local conf=/tmp/custom-pacman.conf - cat ${DATADIR}/pacman-${pacman_conf_arch}.conf > "$conf" + conf=/tmp/custom-pacman.conf + cat ${DATADIR}/pacman-$pac_arch.conf > "$conf" cat ${user_conf} >> "$conf" - pacman_conf="$conf" else - pacman_conf="${DATADIR}/pacman-${pacman_conf_arch}.conf" + conf="${DATADIR}/pacman-$pac_arch.conf" fi + echo "$conf" } load_profile(){ @@ -666,7 +667,9 @@ load_profile(){ load_profile_config "$conf" - set_pacman_conf + pacman_conf=$(get_pacman_conf) + + mirrors_conf=$(get_pac_mirrors_conf "${target_branch}") iso_file=$(gen_iso_fn).iso diff --git a/lib/util-pkg.sh b/lib/util-pkg.sh index 811d913..1c07b83 100644 --- a/lib/util-pkg.sh +++ b/lib/util-pkg.sh @@ -9,82 +9,55 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -preconf_arm(){ - local conf_dir=/tmp tarch="$1" desc="$2" flags="$3" - cp "${DATADIR}/pacman-arm.conf" "$conf_dir/pacman-$tarch.conf" - cp "${DATADIR}/makepkg-arm.conf" "$conf_dir/makepkg-$tarch.conf" - sed -i "$conf_dir/makepkg-$tarch.conf" \ - -e "s|@CARCH[@]|$tarch|g" \ - -e "s|@CHOST[@]|$desc|g" \ - -e "s|@CARCHFLAGS[@]|$flags|g" - sed -i "$conf_dir/pacman-$tarch.conf" -e "s|@CARCH[@]|$tarch|g" +load_compiler_settings(){ + local tarch="$1" conf + conf=${make_conf_dir}/$tarch.conf - work_dir="${chroots_pkg}/${target_branch}/$tarch" - pkg_dir="${cache_dir_pkg}/${target_branch}/$tarch" + [[ -f $conf ]] || return 1 - makepkg_conf="$conf_dir/makepkg-$tarch.conf" - pacman_conf="$conf_dir/pacman-$tarch.conf" + info "Loading compiler settings: %s" "$tarch" + source $conf + + return 0 } -preconf(){ - local arch="$1" - work_dir="${chroots_pkg}/${target_branch}/${target_arch}" - pkg_dir="${cache_dir_pkg}/${target_branch}/${target_arch}" - if [[ "$arch" == 'multilib' ]];then - target_arch='x86_64' - is_multilib=true - else - is_multilib=false - fi - makepkg_conf="${DATADIR}/makepkg-${target_arch}.conf" - pacman_conf="${DATADIR}/pacman-$arch.conf" +get_makepkg_conf(){ + local conf_dir=/tmp conf + conf="$conf_dir/makepkg-$1.conf" + + cp "${DATADIR}/makepkg.conf" "$conf" + + load_compiler_settings "$1" + + sed -i "$conf" \ + -e "s|@CARCH[@]|$carch|g" \ + -e "s|@CHOST[@]|$chost|g" \ + -e "s|@CFLAGS[@]|$cflags|g" + + echo "$conf" } # $1: target_arch -configure_chroot_arch(){ +prepare_conf(){ if ! is_valid_arch_pkg "$1";then die "%s is not a valid arch!" "$1" fi - if ! is_valid_branch "${target_branch}";then - die "%s is not a valid branch!" "${target_branch}" - fi - local conf_arch chost_desc cflags - case "$1" in - 'arm') - conf_arch="$1" - chost_desc="armv5tel-unknown-linux-gnueabi" - cflags="-march=armv5te " - preconf_arm "$conf_arch" "$chost_desc" "$cflags" - ;; - 'armv6h') - conf_arch="$1" - chost_desc="armv6l-unknown-linux-gnueabihf" - cflags="-march=armv6 -mfloat-abi=hard -mfpu=vfp " - preconf_arm "$conf_arch" "$chost_desc" "$cflags" - ;; - 'armv7h') - conf_arch="$1" - chost_desc="armv7l-unknown-linux-gnueabihf" - cflags="-march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 " - preconf_arm "$conf_arch" "$chost_desc" "$cflags" - ;; - 'aarch64') - conf_arch="$1" - chost_desc="aarch64-unknown-linux-gnu" - cflags="-march=armv8-a " - preconf_arm "$conf_arch" "$chost_desc" "$cflags" - ;; - 'multilib') - conf_arch='multilib' - preconf "$conf_arch" - ;; - *) - conf_arch='default' - preconf "$conf_arch" - ;; - esac - mirrors_conf="${DATADIR}/pacman-mirrors-${target_branch}.conf" + local pac_arch='default' + + if [[ "$1" == 'multilib' ]];then + pac_arch='multilib' + is_multilib=true + fi + + pacman_conf="${DATADIR}/pacman-$pac_arch.conf" + + work_dir="${chroots_pkg}/${target_branch}/$1" + pkg_dir="${cache_dir_pkg}/${target_branch}/$1" + + makepkg_conf=$(get_makepkg_conf "$1") + + [[ "$pac_arch" == 'multilib' ]] && target_arch='x86_64' } pkgver_equal() { @@ -182,7 +155,7 @@ check_build(){ find_pkg(){ local result=$(find . -type d -name "$1") - [[ -z $result ]] && die "%s is not a valid package or buildset!" "$1" + [[ -z $result ]] && die "%s is not a valid package or build list!" "$1" } load_group(){ @@ -193,7 +166,7 @@ load_group(){ devel_group='' \ file=${DATADIR}/base-devel-udev - info "Loading Group [%s] ..." "$file" + info "Loading custom group: %s" "$file" if ${is_multilib}; then _multi="s|>multilib||g" @@ -224,6 +197,7 @@ init_base_devel(){ chroot_create(){ msg "Creating chroot for [%s] (%s)..." "${target_branch}" "${target_arch}" mkdir -p "${work_dir}" + mkchroot_args+=(-L) setarch "${target_arch}" \ mkchroot ${mkchroot_args[*]} \ "${work_dir}/root" \ @@ -278,17 +252,20 @@ move_to_cache(){ } archive_logs(){ - local ext=log.tar.xz - msg2 "Archiving log files %s ..." "$1.$ext" - tar -cJf $1.$ext $2 + local archive name="$1" ext=log.tar.xz ver src=/tmp/archives.list + ver=$(get_full_version "$name") + archive="${name}-${ver}-${target_arch}" + find . -maxdepth 1 -name "$archive*.log" > $src + msg2 "Archiving log files [%s] ..." "$archive.$ext" + tar -cJf $PWD/$archive.$ext -T $src msg2 "Cleaning log files ..." find . -maxdepth 1 -name '*.log' -delete - chown "${OWNER}:users" "$1.$ext" + chown "${OWNER}:users" "$archive.$ext" } post_build(){ source PKGBUILD - local ext='pkg.tar.xz' tarch + local ext='pkg.tar.xz' tarch ver src for pkg in ${pkgname[@]};do case $arch in any) tarch='any' ;; @@ -303,21 +280,16 @@ post_build(){ fi done if [[ -z $LOGDEST ]];then - local name=${pkgbase:-$pkgname} ver logsrc archive - ver=$(get_full_version "$name") - archive=$name-$ver-${target_arch} - logsrc=$(find . -maxdepth 1 -name "$archive*.log") - archive_logs "$archive" "${logsrc[@]}" + local name=${pkgbase:-$pkgname} + archive_logs "$name" fi } chroot_init(){ local timer=$(get_timer) - if ${clean_first}; then + if ${clean_first} || [[ ! -d "${work_dir}" ]]; then chroot_clean chroot_create - elif [[ ! -d "${work_dir}" ]]; then - chroot_create else chroot_update fi diff --git a/lib/util.sh b/lib/util.sh index d28c433..eda34b3 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -62,38 +62,58 @@ check_user_repos_conf(){ done } -read_set(){ +get_pac_mirrors_conf(){ + local conf_dir=/tmp conf + conf="$conf_dir/pacman-mirrors-$1.conf" + cp "${DATADIR}/pacman-mirrors.conf" "$conf" + sed -i "$conf" \ + -e "s|Branch = stable|Branch = $1|" + + echo "$conf" +} + +read_build_list(){ local _space="s| ||g" \ _clean=':a;N;$!ba;s/\n/ /g' \ _com_rm="s|#.*||g" - stack=$(sed "$_com_rm" "$1.set" \ + build_list=$(sed "$_com_rm" "$1.list" \ | sed "$_space" \ | sed "$_clean") } -# $1: sets_dir -list_sets(){ - local prof temp - for item in $(ls $1/*.set); do +# $1: list_dir +show_build_lists(){ + local list temp + for item in $(ls $1/*.list); do temp=${item##*/} - prof=${prof:-}${prof:+|}${temp%.set} + list=${list:-}${list:+|}${temp%.list} done - echo $prof + echo $list } -# $1: sets_dir -# $2: buildset -eval_buildset(){ +# $1: make_conf_dir +show_build_profiles(){ + local arch temp + for item in $(ls $1/*.conf); do + temp=${item##*/} + arch=${arch:-}${arch:+|}${temp%.conf} + done + echo $arch +} + +# $1: list_dir +# $2: build list +eval_build_list(){ eval "case $2 in - $(list_sets $1)) is_buildset=true; read_set $1/$2 ;; - *) is_buildset=false ;; + $(show_build_lists $1)) is_build_list=true; read_build_list $1/$2 ;; + *) is_build_list=false ;; esac" } get_edition(){ local result=$(find ${run_dir} -maxdepth 2 -name "$1") path - [[ -z $result ]] && die "%s is not a valid profile or buildset!" "$1" + [[ -z $result ]] && die "%s is not a valid profile or build list!" "$1" path=${result%/*} echo ${path##*/} } @@ -229,11 +249,13 @@ init_buildtree(){ init_buildpkg(){ chroots_pkg="${chroots_dir}/buildpkg" - sets_dir_pkg="${SYSCONFDIR}/pkg.d" + list_dir_pkg="${SYSCONFDIR}/pkg.list.d" - [[ -d ${USERCONFDIR}/pkg.d ]] && sets_dir_pkg=${USERCONFDIR}/pkg.d + make_conf_dir="${SYSCONFDIR}/make.conf.d" - [[ -z ${buildset_pkg} ]] && buildset_pkg='default' + [[ -d ${USERCONFDIR}/pkg.list.d ]] && list_dir_pkg=${USERCONFDIR}/pkg.list.d + + [[ -z ${build_list_pkg} ]] && build_list_pkg='default' cache_dir_pkg=${cache_dir}/pkg } @@ -255,11 +277,11 @@ get_codename(){ init_buildiso(){ chroots_iso="${chroots_dir}/buildiso" - sets_dir_iso="${SYSCONFDIR}/iso.d" + list_dir_iso="${SYSCONFDIR}/iso.list.d" - [[ -d ${USERCONFDIR}/iso.d ]] && sets_dir_iso=${USERCONFDIR}/iso.d + [[ -d ${USERCONFDIR}/iso.list.d ]] && list_dir_iso=${USERCONFDIR}/iso.list.d - [[ -z ${buildset_iso} ]] && buildset_iso='default' + [[ -z ${build_list_iso} ]] && build_list_iso='default' cache_dir_iso="${cache_dir}/iso" @@ -535,10 +557,10 @@ is_valid_init(){ } is_valid_arch_pkg(){ - case $1 in - 'i686'|'x86_64'|'multilib'|'arm'|'armv6h'|'armv7h'|'aarch64') return 0 ;; + eval "case $1 in + $(show_build_profiles "${make_conf_dir}")) return 0 ;; *) return 1 ;; - esac + esac" } is_valid_arch_iso(){ @@ -556,8 +578,8 @@ is_valid_branch(){ } run(){ - if ${is_buildset};then - for item in ${stack[@]};do + if ${is_build_list};then + for item in ${build_list[@]};do $1 $item done else