From 9aa40b5189c5324e3d83cf78c78dca92dfda842d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 10 May 2014 21:56:03 -0400 Subject: fix whitespace (one line had 8 spaces instead of a tab) --- src/librefetch/librefetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index fdc7e00..49159f5 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -264,7 +264,7 @@ makepkg_modify=' } /tidy_install\(\) \{/,/^\}$/ { - /for .*PURGE_TARGETS/itidy_install_purge + /for .*PURGE_TARGETS/itidy_install_purge /for .*PURGE_TARGETS/,/done/d /^\}$/ifind . -exec touch --no-dereference --date="1990-01-01 0:0:0 +0" -- {} + } -- cgit v1.2.3-54-g00ecf From b0b4a603d24d905d757df39ec2e90f46403cdd32 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 10 May 2014 21:57:34 -0400 Subject: librefetch: Make the order of files in a tarball deterministic --- src/librefetch/librefetch | 6 +++++- src/librefetch/librefetch.8.ronn | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 49159f5..d0bbf1b 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -259,7 +259,11 @@ makepkg_modify=' /create_package\(\) \{/,/^\}$/ { /pkg_file=/d # allow us to set pkg_file s/"?\$\{comp_files\[@\]\}"?// # do not include .{PKGINFO,INSTALL,CHANGELOG} - s/bsdtar /&--format=ustar / # ustar, not pax + # This is long/gross. What it does: + # - pass --format=ustar to bsdtar, to inhibit it using the pax format + # - take the files that would be included in the tarball, and use + # find/sort/xargs to order them before passing them to bsdtar + s/bsdtar(.*) - ([^|]*) \|/find \2 -print0 | LC_ALL=C sort --zero-terminated | xargs -0 bsdtar --format=ustar --no-recursion \1 - |/ s/create_signature .*/&; return $?/ # do not procede to create symlinks } diff --git a/src/librefetch/librefetch.8.ronn b/src/librefetch/librefetch.8.ronn index 7d2dfb3..3b51fb4 100644 --- a/src/librefetch/librefetch.8.ronn +++ b/src/librefetch/librefetch.8.ronn @@ -173,6 +173,9 @@ The following modifications are made to makepkg: * Timestamps in `$pkgdir` are reset to "1990-01-01 0:0:0 +0", so that the resulting tarball will be the same, regardless of when it was created. + * Sort the files included in the tarball; normally the order of files + in a tarball is essentially random (even if it tends to be the same + when re-created on the same machine). * append `-libre` to `$srcdir` * append `-libre` to `$pkgbasedir` (which becomes `$pkgdir`) * Don't check if the package has already been built. -- cgit v1.2.3-54-g00ecf From 7233318d44860fb3e2e4596a3352b4c9d783a1da Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 10 May 2014 22:13:03 -0400 Subject: Update to new devtools. --- src/chroot-tools/makechrootpkg.sh.patch | 41 ++++++++++++++++++--------------- src/chroot-tools/mkarchroot.patch | 8 +++---- 2 files changed, 26 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch index 5cea39a..8180d89 100644 --- a/src/chroot-tools/makechrootpkg.sh.patch +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -1,5 +1,5 @@ ---- makechrootpkg.sh.in 2014-03-21 13:59:31.239683366 -0400 -+++ makechrootpkg.sh.ugly 2014-03-21 14:19:20.747789508 -0400 +--- makechrootpkg.sh.in 2014-05-10 22:03:27.956692573 -0400 ++++ makechrootpkg.sh.ugly 2014-05-10 22:09:15.376594518 -0400 @@ -1,4 +1,6 @@ #!/bin/bash +# License: GNU GPLv2 @@ -12,8 +12,8 @@ shopt -s nullglob +init_variables() { - _makepkg_args=(-s --noconfirm -L --holdver) - makepkg_args=("${_makepkg_args[@]}") + default_makepkg_args=(-s --noconfirm -L --holdver) + makepkg_args=("${default_makepkg_args[@]}") repack=false @@ -29,9 +32,10 @@ bindmounts_rw=() @@ -35,7 +35,7 @@ while getopts 'hcur:I:l:nTD:d:' arg; do case "$arg" in h) usage ;; -@@ -93,9 +98,6 @@ +@@ -91,9 +96,6 @@ [[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir" [[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir" @@ -45,7 +45,7 @@ if [[ ${copy:0:1} = / ]]; then copydir=$copy else -@@ -115,30 +117,48 @@ +@@ -113,30 +115,48 @@ esac done @@ -100,11 +100,14 @@ # Get a read lock on the root chroot to make # sure we don't clone a half-updated chroot slock 8 "$chrootdir/root.lock" "Locking clean chroot" -@@ -159,11 +179,16 @@ +@@ -157,14 +177,19 @@ # Drop the read lock again lock_close 8 - fi + + # Update mtime + touch "$copydir" } -clean_temporary() { @@ -120,7 +123,7 @@ if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then btrfs subvolume delete "$copydir" >/dev/null || die "Unable to delete subvolume %s" "$copydir" -@@ -178,9 +203,14 @@ +@@ -179,9 +204,14 @@ stat_done } @@ -135,7 +138,7 @@ for install_pkg in "${install_pkgs[@]}"; do pkgname="${install_pkg##*/}" cp "$install_pkg" "$copydir/$pkgname" -@@ -193,11 +223,19 @@ +@@ -194,11 +224,19 @@ rm "$copydir/$pkgname" done @@ -157,7 +160,7 @@ $repack || rm -rf "$copydir/build" mkdir -p "$copydir/build" -@@ -236,12 +274,12 @@ +@@ -237,12 +275,12 @@ chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir} @@ -172,7 +175,7 @@ sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf" echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf" fi -@@ -254,20 +292,38 @@ +@@ -255,20 +293,38 @@ chmod 440 "$copydir/etc/sudoers.d/nobody-pacman" fi @@ -213,7 +216,7 @@ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o else ( export SRCDEST BUILDDIR="$builddir" -@@ -277,10 +333,10 @@ +@@ -278,10 +334,10 @@ (( $? != 0 )) && die "Could not download sources." # Clean up garbage from verifysource @@ -226,7 +229,7 @@ # This function isn't run in makechrootpkg, # so no global variables local run_namcap="$1"; shift -@@ -291,6 +347,7 @@ +@@ -292,6 +348,7 @@ shopt -s nullglob # XXX: Workaround makepkg disliking read-only dirs @@ -234,7 +237,7 @@ ln -sft /srcdest /srcdest_host/* ln -sft /startdir /startdir_host/* -@@ -316,11 +373,29 @@ +@@ -317,11 +374,29 @@ # Safety check if [[ ! -w PKGBUILD ]]; then @@ -265,7 +268,7 @@ if $run_namcap; then pacman -S --needed --noconfirm namcap -@@ -333,12 +408,24 @@ +@@ -334,12 +409,24 @@ exit 0 } @@ -290,7 +293,7 @@ for l in "$copydir"/logdest/*; do [[ $l == */logpipe.* ]] && continue chown "$src_owner" "$l" -@@ -352,6 +439,10 @@ +@@ -353,6 +440,10 @@ } # }}} @@ -300,8 +303,8 @@ + umask 0022 - load_vars /etc/makepkg.conf -@@ -363,30 +454,45 @@ + load_vars "$USER_HOME/.makepkg.conf" +@@ -364,30 +455,45 @@ [[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD [[ -d $LOGDEST ]] || LOGDEST=$PWD @@ -353,7 +356,7 @@ if (( ret != 0 )); then if $temp_chroot; then -@@ -397,3 +503,4 @@ +@@ -398,3 +504,4 @@ else true fi diff --git a/src/chroot-tools/mkarchroot.patch b/src/chroot-tools/mkarchroot.patch index 171b38a..d6f83f1 100644 --- a/src/chroot-tools/mkarchroot.patch +++ b/src/chroot-tools/mkarchroot.patch @@ -1,5 +1,5 @@ ---- mkarchroot.in 2014-03-21 13:59:31.593002027 -0400 -+++ mkarchroot.ugly 2014-03-21 14:23:12.027238102 -0400 +--- mkarchroot.in 2014-05-10 22:10:54.871326879 -0400 ++++ mkarchroot.ugly 2014-05-10 22:10:54.887993222 -0400 @@ -1,4 +1,6 @@ #!/bin/bash +# License: GNU GPLv2 @@ -7,7 +7,7 @@ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. -@@ -65,6 +67,11 @@ +@@ -66,6 +68,11 @@ chmod 0755 "$working_dir" fi @@ -19,7 +19,7 @@ pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' -@@ -72,7 +79,7 @@ +@@ -73,7 +80,7 @@ echo 'LANG=C' > "$working_dir/etc/locale.conf" echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot" -- cgit v1.2.3-54-g00ecf From 7d74f7ccef61ccb120e920287f6929c12c48d895 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 10 May 2014 22:40:16 -0400 Subject: mkarchroot: creating chroots wasn't working. I later noticed that alfplayer filed a bug report about it: https://labs.parabola.nu/issues/518 --- src/chroot-tools/mkarchroot.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/chroot-tools/mkarchroot.patch b/src/chroot-tools/mkarchroot.patch index d6f83f1..9366d92 100644 --- a/src/chroot-tools/mkarchroot.patch +++ b/src/chroot-tools/mkarchroot.patch @@ -14,7 +14,7 @@ +_env=() +while read -r varname; do + _env+=("$varname=${!varname}") -+done < { declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$'; } ++done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$') +env -i "${_env[@]}" \ pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' -- cgit v1.2.3-54-g00ecf From f3dd569efc04b1fb315d2233fda043e15bb7430b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 11 May 2014 01:41:20 -0400 Subject: librefetch: enhance debugging options (flags change) --- src/librefetch/librefetch | 24 ++++++++++++++++++------ src/librefetch/librefetch.8.ronn | 8 ++++++-- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index d0bbf1b..c1c3494 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -70,7 +70,8 @@ usage() { directory, it is used instead" print " Alternate modes:" flag "-g, --geninteg" "Generage integrity checks for source files" - flag "-P, --print" "Print the effective build script (SRCBUILD)" + flag "-S, --srcbuild" "Print the effective build script (SRCBUILD)" + flag "-M, --makepkg" "Print the effective makepkg script" flag "-h, --help" "Show this message" } @@ -90,6 +91,17 @@ main() { ######################################################################## + makepkg="$(modified_makepkg "$(which makepkg)")" + + # Mode: makepkg ######################################################## + + if [[ $mode =~ makepkg ]]; then + cat "$makepkg" + return 0 + fi + + ######################################################################## + local BUILDFILEDIR="${BUILDFILE%/*}" if [[ -f "${BUILDFILEDIR}/SRCBUILD" ]]; then BUILDFILE="${BUILDFILEDIR}/SRCBUILD" @@ -102,7 +114,6 @@ main() { */SRCBUILD) srcbuild="$(modified_srcbuild "$BUILDFILE")";; *) srcbuild="$(modified_pkgbuild "$BUILDFILE")";; esac - makepkg="$(modified_makepkg "$(which makepkg)")" # Mode: checksums ###################################################### @@ -115,9 +126,9 @@ main() { return 0 fi - # Mode: print ########################################################## + # Mode: srcbuild ####################################################### - if [[ $mode =~ print ]]; then + if [[ $mode =~ srcbuild ]]; then cat "$srcbuild" return 0 fi @@ -212,7 +223,8 @@ parse_options() { -C) mode=create;; -D) mode=download;; -g|--geninteg) mode=checksums;; - -P|--print) mode=print;; + -S|--srcbuild) mode=srcbuild;; + -M|--makepkg) mode=makepkg;; -p) BUILDFILE="$(readlink -m -- "$opt")";; -h|--help) mode=help;; --) shift; break;; @@ -235,7 +247,7 @@ parse_options() { case "$mode" in help) # don't worry about it :;; - checksums|print) # don't take any extra arguments + checksums|srcbuild|makepkg) # don't take any extra arguments if [[ ${#extra_opts[@]} != 0 ]]; then print "%s: found extra non-flag arguments: %s" "$cmd" "${extra_opts[*]}" >&2 usage >&2 diff --git a/src/librefetch/librefetch.8.ronn b/src/librefetch/librefetch.8.ronn index 3b51fb4..4c9c1c4 100644 --- a/src/librefetch/librefetch.8.ronn +++ b/src/librefetch/librefetch.8.ronn @@ -31,7 +31,8 @@ There are 5 modes: * `download`: Download the tarball from the configured mirror. * `create`: Create the tarball from a `PKGBUILD`/`SRCBUILD`. * `checksums`: Generate integrity checks for source files. - * `print`: Print the effective build script. + * `srcbuild`: Print the effective build script. + * `makepkg`: Print the effective makepkg script. * `help`: Print `librefetch` usage information. The normal mode of operation is `download` mode. If `download` mode @@ -46,7 +47,10 @@ fails, it may choose to try `create` mode. directory, it is used instead. * `-g` | `--geninteg`: Use `checksums` mode: Generate integrity checks for source files. - * `-P` | `--print`: Use `print` mode: print the effective build script. + * `-S` | `--srcbuild`: Use `srcbuild` mode: print the effective build + script. + * `-M` | `--makepkg`: Use `makepkg` mode: print the effective makepkg + script. * `-h` | `--help`: Use `help` mode: Show useage information. ## DOWNLOAD MODE -- cgit v1.2.3-54-g00ecf From b31425edf4c1b292280e5d14016611f238372a18 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 11 May 2014 22:45:42 -0400 Subject: Create CHROOTARCH in chroot.conf for when $CARCH != $(uname -m) This is the case on mips, where CARCH is misp64el, but uname -m is mips64. --- src/chroot-tools/arch-nspawn.patch | 14 ++++++++++++-- src/chroot-tools/librechroot | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/chroot-tools/arch-nspawn.patch b/src/chroot-tools/arch-nspawn.patch index afdf51a..5e0f10b 100644 --- a/src/chroot-tools/arch-nspawn.patch +++ b/src/chroot-tools/arch-nspawn.patch @@ -1,5 +1,5 @@ ---- arch-nspawn.in 2014-03-21 13:59:31.812992892 -0400 -+++ arch-nspawn 2014-03-21 14:24:23.520619552 -0400 +--- arch-nspawn.in 2014-05-11 00:58:42.030932904 -0400 ++++ arch-nspawn.ugly 2014-05-11 22:33:47.186717386 -0400 @@ -1,4 +1,6 @@ #!/bin/bash +# License: GNU GPLv2 @@ -7,3 +7,13 @@ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. +@@ -103,7 +105,8 @@ + machine_name="${machine_name#-}" + fi + +-exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \ ++CHROOTARCH="$(. $(librelib conf); get_var chroot CHROOTARCH "$CARCH")" ++exec ${CHROOTARCH:+setarch "$CHROOTARCH"} systemd-nspawn -q \ + -D "$working_dir" \ + --machine "$machine_name" \ + "${mount_args[@]}" \ diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index d8e76ac..9e74a62 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -336,6 +336,8 @@ main() { printf '%q ' "${CHROOTEXTRAPKG[@]}" printf ')\n' fi + # TODO: only set CHROOTARCH if $CARCH != $(uname -m) + printf 'CHROOTARCH=%q\n' "$(uname -m)" } > "$copydir"/etc/libretools.d/chroot.conf if [[ $mode != delete ]]; then -- cgit v1.2.3-54-g00ecf From 9f1ef0bbdf1bc246c0c035a2dd6a4bcfa41664ef Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 11 May 2014 23:31:58 -0400 Subject: update the libremessages man page with changes from devtools --- src/lib/libremessages.1.ronn | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/lib/libremessages.1.ronn b/src/lib/libremessages.1.ronn index d39dad0..2bf73a1 100644 --- a/src/lib/libremessages.1.ronn +++ b/src/lib/libremessages.1.ronn @@ -156,15 +156,16 @@ these, you could end up deleting a lot of someone's work. * `cleanup` []: *If* `setup_workdir` has been run, `rm -rf "$WORKDIR"`. If given - a numeric argument, it will then call `exit`(1) with that argument. + a numeric argument, it will then call `exit`(1) with that + argument, otherwise it calls `exit`(1) with a status of 0. * `abort`: Calls `msg` with the message "Aborting...", then calls - `cleanup 0`. + `cleanup 255`. * `die` [...]: Exactly like `error`, but calls `cleanup` and calls `exit`(1) - with a status of 1. + with a status of 255. ### LOCKFILE ROUTINES @@ -212,9 +213,6 @@ pull it into a separate program. xterm and rxvt (and their various values; "rxvt-unicode-256color" is still rxvt). -Also, I think `abort` calling `cleanup 1` would make more sense than -`cleanup 0`. - ## SEE ALSO librelib(7), gettext(1), common.sh(3) -- cgit v1.2.3-54-g00ecf From 0c5516fe647de69e92517b99794792b99754044e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 15 May 2014 22:03:04 -0400 Subject: librefetch: Update 'Usage:' line. --- src/librefetch/librefetch | 2 +- src/librefetch/librefetch.8.ronn | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index c1c3494..65f5de9 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -30,7 +30,7 @@ trap "rm -rf -- $(printf '%q' "$tempdir")" EXIT cmd=${0##*/} usage() { print "Usage: %s [OPTIONS] SOURCE_URL [OUTPUT_FILE]" "$cmd" - print "Usage: %s -[g|P|h]" "$cmd" + print "Usage: %s -[g|S|M|h]" "$cmd" print "Downloads or creates a liberated source tarball." echo prose "The default mode is to create OUTPUT_FILE, first by trying diff --git a/src/librefetch/librefetch.8.ronn b/src/librefetch/librefetch.8.ronn index 4c9c1c4..d7b8edc 100644 --- a/src/librefetch/librefetch.8.ronn +++ b/src/librefetch/librefetch.8.ronn @@ -4,7 +4,7 @@ librefetch(8) -- downloads or creates a liberated source tarball ## SYNOPSIS `librefetch` [] []
-`librefetch` `-`[`g`|`P`|`h`] +`librefetch` `-`[`g`|`S`|`M`|`h`] ## DESCRIPTION -- cgit v1.2.3-54-g00ecf From 56472f6c28e278fb937e3456f91b52cc5ec0b143 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 15 May 2014 22:03:58 -0400 Subject: librefetch: fix a call to `printf` that should have been to `print` --- src/librefetch/librefetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 65f5de9..98d85a2 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -233,7 +233,7 @@ parse_options() { makepkg_opts+=("$arg") $have_opt && makepkg_opts+=("$opt") else - printf '%s: invalid flag: %s' "$cmd" "$arg" + print '%s: invalid flag: %s' "$cmd" "$arg" return 1 fi ;; -- cgit v1.2.3-54-g00ecf From 3771f34a54bca198921d60a1bce83068b7bd4f49 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 15 May 2014 22:05:37 -0400 Subject: librefetch: The ERR trap is greedy; use exit instead of return from main(). --- src/librefetch/librefetch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 98d85a2..8fd8c1d 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -86,7 +86,7 @@ main() { if [[ $mode =~ help ]]; then usage - return 0 + exit 0 fi ######################################################################## @@ -97,7 +97,7 @@ main() { if [[ $mode =~ makepkg ]]; then cat "$makepkg" - return 0 + exit 0 fi ######################################################################## @@ -123,14 +123,14 @@ main() { PKGBUILD) sed -e 's/^[a-z]/mk&/' -e 's/^\s/ &/';; SRCBUILD) cat;; esac - return 0 + exit 0 fi # Mode: srcbuild ####################################################### if [[ $mode =~ srcbuild ]]; then cat "$srcbuild" - return 0 + exit 0 fi ######################################################################## @@ -148,7 +148,7 @@ main() { if [[ $mode =~ download ]]; then load_files librefetch - check_vars librefetch MIRRORS DOWNLOADER || return 1 + check_vars librefetch MIRRORS DOWNLOADER || exit 1 # Canonicalize $src if [[ "$src" == libre://* ]]; then @@ -174,7 +174,7 @@ main() { dlcmd="${dlcmd//\%o/\"\$dst\"}" dlcmd="${dlcmd//\%u/\"\$src\"}" - { eval "$dlcmd"; } >&2 && return 0 + { eval "$dlcmd"; } >&2 && exit 0 fi # Mode: create ######################################################### @@ -186,7 +186,7 @@ main() { export pkg_file=$dst cd "$BUILDFILEDIR" - "$makepkg" "${makepkg_opts[@]}" -p "$srcbuild" >&2 || return $? + "$makepkg" "${makepkg_opts[@]}" -p "$srcbuild" >&2 || exit $? fi } -- cgit v1.2.3-54-g00ecf From 79588f1bcc6f8052964717cdb8fe4eb82dceb0df Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 15 May 2014 22:06:13 -0400 Subject: librefetch: replace some makepkg messages with messages that make sense --- src/librefetch/librefetch | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 8fd8c1d..f41615f 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -289,6 +289,9 @@ makepkg_modify=' arm -rf "$srcdir"\nmkdir "$srcdir" } +s|Making package:|Making source:| +s:Checking (run|build)time dependencies\.\.\.:Checking source dependencies...: + s|srcdir=.*|&-libre| s|pkgdirbase=.*|&-libre| s|check_build_status$|:| -- cgit v1.2.3-54-g00ecf From 7cdbee3ef93c1bef4b79310e4ef46cbde18c534f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 15 May 2014 22:06:45 -0400 Subject: librefetch: call usage() consistently --- src/librefetch/librefetch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index f41615f..b29598d 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -80,7 +80,10 @@ main() { makepkg_opts=() extra_opts=() mode=download-create - parse_options "$@" + if ! parse_options "$@"; then + usage >&2 + exit 1 + fi # Mode: help ########################################################### @@ -250,14 +253,12 @@ parse_options() { checksums|srcbuild|makepkg) # don't take any extra arguments if [[ ${#extra_opts[@]} != 0 ]]; then print "%s: found extra non-flag arguments: %s" "$cmd" "${extra_opts[*]}" >&2 - usage >&2 return 1 fi ;; *download*|*create*) # take 1 or 2 extra arguments if [[ ${#extra_opts[@]} != 1 ]] && [[ ${#extra_opts[@]} != 2 ]]; then print "%s: %d non-flag arguments found, expected 1 or 2: %s" "$cmd" ${#extra_opts[@]} >&2 - usage >&2 return 1 fi ;; -- cgit v1.2.3-54-g00ecf From 9bb1ddbaf5f0585f5854ee2c25204bda56b32974 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 15 May 2014 22:08:17 -0400 Subject: librefetch: Fix bug with xargs calling tar too many times (cut xargs out) --- src/librefetch/librefetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index b29598d..11cf380 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -276,7 +276,7 @@ makepkg_modify=' # - pass --format=ustar to bsdtar, to inhibit it using the pax format # - take the files that would be included in the tarball, and use # find/sort/xargs to order them before passing them to bsdtar - s/bsdtar(.*) - ([^|]*) \|/find \2 -print0 | LC_ALL=C sort --zero-terminated | xargs -0 bsdtar --format=ustar --no-recursion \1 - |/ + s/bsdtar(.*) - ([^|]*) \|/find \2 -print0 | LC_ALL=C sort --zero-terminated | bsdtar --null --files-from - --format=ustar --no-recursion \1 - |/ s/create_signature .*/&; return $?/ # do not procede to create symlinks } -- cgit v1.2.3-54-g00ecf From 22bb572086ff1c1667d553ac8233fc053a1556f2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 15 May 2014 22:25:43 -0400 Subject: librefetch: clean up documentation --- src/librefetch/librefetch | 3 ++- src/librefetch/librefetch.8.ronn | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 11cf380..8b02205 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -53,7 +53,8 @@ usage() { prose "The default build script is 'PKGBUILD', or 'SRCBUILD' if it exists." echo - prose "Unrecognized options are passed straight to makepkg." + prose "Other options, if they are valid \`makepkg\` options, are passed + straight to makepkg." echo prose "%s does NOT support getopt-style flag combining. You must use '-a -b', not '-ab'." "$cmd" diff --git a/src/librefetch/librefetch.8.ronn b/src/librefetch/librefetch.8.ronn index d7b8edc..bb2e561 100644 --- a/src/librefetch/librefetch.8.ronn +++ b/src/librefetch/librefetch.8.ronn @@ -12,9 +12,9 @@ librefetch(8) -- downloads or creates a liberated source tarball tarballs for `PKGBUILD(5)` files. If a URL mentioned in the `source` array in a `PKGUILD` is in a -location that Parabola uploads "custom" source tarballs (or configured -locations), and no file is at that URL, librefetch will automatically -create it for you. +location that Parabola uploads "custom" source tarballs to (or +configured locations), and no file is at that URL, librefetch will +automatically create it for you. This works because a post-install script for the package configures `librefetch` as the download agent for `https://` URLs in @@ -53,6 +53,9 @@ fails, it may choose to try `create` mode. script. * `-h` | `--help`: Use `help` mode: Show useage information. +Other options, if they are documented in `makepkg -h`, are passed to +the modified copy of makepkg created during `create` mode. + ## DOWNLOAD MODE If begins with the string `libre://`, it is replaced with @@ -97,7 +100,7 @@ remain intact. As explained in the `CREATE MODE` section, in `create` mode, this program generates an `SRCBUILD` file. For debugging purposes, this -file can be printed instead of executed with `print` mode. +file can be printed instead of executed with `srcbuild` mode. ### PRE-EXISTING SRCBUILD @@ -184,6 +187,10 @@ The following modifications are made to makepkg: * append `-libre` to `$pkgbasedir` (which becomes `$pkgdir`) * Don't check if the package has already been built. +For debugging purposes, this modified makepkg can be printed instead +of executed with `makepkg` mode. Before it is run in create mode, +`PKGEXT`, `PKGDEST`, and `pkg_file` are set as environment variables. + ## CONFIGURATION See `librefetch.conf(5)` for details on configuring librefetch using -- cgit v1.2.3-54-g00ecf From de12756765f573b03821b252a47e68a088090eb0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 25 May 2014 19:46:35 -0400 Subject: Well... libregit was broken --- src/gitget/libregit | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gitget/libregit b/src/gitget/libregit index 25550e5..f3bcfd7 100755 --- a/src/gitget/libregit +++ b/src/gitget/libregit @@ -40,3 +40,5 @@ main() { gitget checkout "${repo}#ref=${ref}" "${dir}" } + +main "$@" -- cgit v1.2.3-54-g00ecf From b247261b96339a59e74c9d705fe06ab38bd9e634 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 25 May 2014 20:12:34 -0400 Subject: touch up usage() text in src/gitget --- src/gitget/gitget | 3 +-- src/gitget/libregit | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gitget/gitget b/src/gitget/gitget index bcc528c..a748943 100755 --- a/src/gitget/gitget +++ b/src/gitget/gitget @@ -145,8 +145,7 @@ download_git_bare() { } usage() { - print 'Usage: %s [OPTIONS] bare URL DIRECTORY' "${0##*/}" - print 'Usage: %s [OPTIONS] checkout URL DIRECTORY' "${0##*/}" + print 'Usage: %s [OPTIONS] [bare|checkout] URL DIRECTORY' "${0##*/}" print 'A URL-handler for git urls. Capable of updating or cloning.' echo prose "Clones or pulls from the git URL, to a local DIRECTORY. If diff --git a/src/gitget/libregit b/src/gitget/libregit index f3bcfd7..41aefc3 100755 --- a/src/gitget/libregit +++ b/src/gitget/libregit @@ -20,18 +20,17 @@ . libremessages usage() { - print 'Usage: %s repo ref dir' "${0##*/}" + print 'Usage: %s REPO REF DIR' "${0##*/}" print 'A compatability wrapper around `gitget checkout`' echo prose "This exists because gitget used to be called libregit, and took the arguments in this format, and I'm sure there are a few scripts floating around that use it." echo - prose "Clones or pulls from the git URL 'repo', and checks out the git - ref 'ref' to the directory 'dir'." + prose "Clones or pulls from the git URL '', and checks out the git + ref '' to the directory ''." } - main() { [[ $# == 3 ]] || { usage >&2; return 1; } repo=$1 -- cgit v1.2.3-54-g00ecf From 5051daebf722a9020b015feabc4c39e6bdb187f1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 28 May 2014 01:25:51 -0400 Subject: gitget checkout: behave correctly when $ref is a tag --- src/gitget/gitget | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gitget/gitget b/src/gitget/gitget index a748943..fe5d46b 100755 --- a/src/gitget/gitget +++ b/src/gitget/gitget @@ -87,7 +87,7 @@ download_git_checkout() { fi fi msg2 "Updating %s %s repo..." "${name}" "git" - if ! git pull origin "$ref"; then + if ! { git fetch --all -p && git checkout "$ref" && git pull origin "$ref"; } ; then # only warn on failure to allow offline builds warning "Failure while updating %s %s repo" "${repo}" "git" fi -- cgit v1.2.3-54-g00ecf