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.8.ronn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/librefetch/librefetch.8.ronn') 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 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/librefetch/librefetch.8.ronn') 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 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/librefetch/librefetch.8.ronn') 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 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/librefetch/librefetch.8.ronn') 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