Skip to content

Commit

Permalink
FreeBSD package: Fix missing leading / in archive
Browse files Browse the repository at this point in the history
This is a simple workaround, which transforms the filenames inside the
tar archive so that they start with `/`. This happens only in case
the filename doesn't begin with `+`, which is expected (or at least is
very likely) to be a metadata file.

```
$ tar --list -f test-package-0.0.1.txz
+COMPACT_MANIFEST
+MANIFEST
/etc/config
/usr/bin/script

$ pkg install -y test-package-0.0.1.txz && echo OK
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	test-package: 0.0.1

Number of packages to be installed: 1
[1/1] Installing test-package-0.0.1...
Extracting test-package-0.0.1: 100%
OK
```

Fixes #1811

Signed-off-by: Vlastimil Holer <vholer@opennebula.io>
  • Loading branch information
Vlastimil Holer authored and jordansissel committed Aug 16, 2021
1 parent 0a8bccc commit 63fdb94
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/fpm/package/freebsd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def output(output_path)
# We use --files-from here to keep the tar entries from having `./` as the prefix.
# This is done as a best effor to mimic what FreeBSD packages do, having everything at the top-level as
# file names, like "+MANIFEST" instead of "./+MANIFEST"
# Note: This will include top-level files like "/usr/bin/foo" listed in the tar as "usr/bin/fo" without
# a leading slash. I don't know if this has any negative impact on freebsd packages.
safesystem("tar", "-Jcf", output_path, "-C", staging_path, "--files-from", build_path("file_list"))
safesystem("tar", "-Jcf", output_path, "-C", staging_path, "--files-from", build_path("file_list"), "--transform", 's|^\([^+]\)|/\1|')
end # def output

# Handle architecture naming conversion:
Expand Down

0 comments on commit 63fdb94

Please sign in to comment.