140 Commits

Author SHA1 Message Date
Robert Lehmann
d179a334f7 opkg: Fix common linter warnings
This patch fixes common linter warnings

Signed-off-by: Robert Lehmann <robert.lehmann@sitec-systems.de>
Signed-off-by: Alex Stewart <astewart.49c6@gmail.com>
2024-07-24 08:31:14 -04:00
Robert Lehmann
858312ba2c opkg-update-index: Fix common linter warnings
This patch fixes common linter warnings.

Signed-off-by: Robert Lehmann <robert.lehmann@sitec-systems.de>
Signed-off-by: Alex Stewart <astewart.49c6@gmail.com>
2024-07-24 08:31:14 -04:00
Robert Lehmann
ab8afa8395 opkg-show-deps: Fix common linter warnings
This patch fixes common linter warnings.

Signed-off-by: Robert Lehmann <robert.lehmann@sitec-systems.de>
Signed-off-by: Alex Stewart <astewart.49c6@gmail.com>
2024-07-24 08:31:14 -04:00
Robert Lehmann
c5b4ba0c42 opkg-make-index: Fix common linter warnings
This patch fixes common linter warnings.

Signed-off-by: Robert Lehmann <robert.lehmann@sitec-systems.de>
Signed-off-by: Alex Stewart <astewart.49c6@gmail.com>
2024-07-24 08:31:14 -04:00
Robert Lehmann
a075a43a9d opkg-list-fields: Fix common linter warnings
This patch fixes common linter warnings.

Signed-off-by: Robert Lehmann <robert.lehmann@sitec-systems.de>
Signed-off-by: Alex Stewart <astewart.49c6@gmail.com>
2024-07-24 08:31:14 -04:00
Robert Lehmann
3e3a74d900 opkg-graph-deps: Fix common linter warnings
This patch fixes common linter warnings.

Signed-off-by: Robert Lehmann <robert.lehmann@sitec-systems.de>
Signed-off-by: Alex Stewart <astewart.49c6@gmail.com>
2024-07-24 08:31:14 -04:00
Robert Lehmann
1a93e7fc61 opkg-compare-indexes: Fix common linter warnings
This patch fixes common linter warnings.

Signed-off-by: Robert Lehmann <robert.lehmann@sitec-systems.de>
Signed-off-by: Alex Stewart <astewart.49c6@gmail.com>
2024-07-24 08:31:14 -04:00
Robert Lehmann
7a1d428a57 arfile: Fix common linter warnings
This patch fixes common linter warnings.

Signed-off-by: Robert Lehmann <robert.lehmann@sitec-systems.de>
Signed-off-by: Alex Stewart <astewart.49c6@gmail.com>
2024-07-24 08:31:14 -04:00
Piotr Łobacz
68a969f0e8 opkg-build: remove --numeric-owner parameter overzealously added
In some corner cases this parameter has been added overzealously.
All discussion on this topic can be read in here:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15334

Signed-off-by: Alex Stewart <alex.stewart@ni.com>
0.7.0
2024-01-09 10:59:13 -05:00
Alex Stewart
589880d019 CONTRIBUTING: refresh document
Refresh the CONTRIBUTING document with a more modern style and use it as
the single source of truth for how to contribute to the project.

Remove the AUTHORS file, as that file isn't contemporarily used and
its information is redundant.

Signed-off-by: Alex Stewart <alex.stewart@ni.com>
0.6.3
2023-12-01 14:18:39 -05:00
Alex Stewart
527c9763dc add SECURITY.md
Add a short document directing contributors on how to report security
issues against the project.

Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2023-12-01 14:18:39 -05:00
Alex Stewart
e5290560a5 CONTRIBUTING: update opkg mailing list
The opkg mailing list has moved to opkg@lists.yoctoproject.org. The old
Google Code/Group is being deprecated. Update the contributing document
to reflect this change.

Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2023-08-18 17:07:49 -04:00
Alex Stewart
0d6b7f44db CONTRIBUTING: update markdown styling
Update the CONTRIBUTING document markdown styling to something more
modern and fixup a spelling mistake in the text.

No substantial content changes in this commit.

Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2023-08-18 17:04:34 -04:00
Alex Stewart
3b6b9ff223 opkg-build: whitespace and styling
Cleanup the inconsistent use of tabs and spaces in the opkg-build script
for cleanliness, and homogenize the style of case and if-then
statements.

No functional changes intended in this commit.

Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2023-08-16 11:29:04 -04:00
Piotr Łobacz
8d9953dd8d opkg-build: Add acls and xattrs support
Add support for tar archives created with --acls and/or --xattrs options,
PAX header format.

GNU tar and libarchive already supports ACLs and extended attributes.
We can now add this support as well to opkg-build script in order to use
fsetattr or setcap inside do_install command and end up with a file in
an image with the relevant ACLs and xattrs.

Signed-off-by: Piotr Łobacz <p.lobacz@welotec.com>
Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2023-08-16 11:13:42 -04:00
Alex Stewart
41f83f83f2 Revert "opkg-build: Add acls and xattrs support"
This reverts commit dc50e85ff1.
2023-08-15 17:52:20 -04:00
Piotr Łobacz
dc50e85ff1 opkg-build: Add acls and xattrs support
Add support for tar archives created with --acls and/or --xattrs options,
PAX header format.

GNU tar and libarchive already supports ACLs and extended attributes.
We can now add this support as well to opkg-build script in order to use
fsetattr or setcap inside do_install command and end up with a file in
an image with the relevant ACLS and xattrs.

Signed-off-by: Piotr Łobacz <p.lobacz@welotec.com>
Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2023-07-12 15:45:37 -04:00
Petar Koynov
67994e62dc opkg-feed: Fix adding feeds with same name as architecture
Attempting to add feeds with some special names that match
        architecture names was returning an error:
        "5   The named feed already exists"
        Make sourceTypePattern in createFeedLineRegex only match
        feed configuration lines src or dist

Signed-off-by: Petar Koynov <petar.koynov@ni.com>
Signed-off-by: Alex Stewart <alex.stewart@ni.com>
0.6.2
2023-05-24 10:59:18 -05:00
Henry Kleynhans
9239541f14 opkg-build: Add zstandard compressor support
Add ztsd compressor option to support using zstandard for packages.

Zstandard compression offers a significant speed increase at
decompression time over the current default (xz). This is amplified on
less capable hardware as used in embedded devices.  Further more, it
offers a slightly faster compression speed at the highest compression
levels with a slightly lower compression ratio and the ability to
choose your own compromise between fast compression speed with less
compression and slower compression speed with more compression.

Zstandard would therefore be a good solution for package compression when:
* install time matters, especially if you are installing on less capable
  hardware
* disk space is not a concern: lower compression can speed up developer
  builds, especially incremental builds
* disk space is a concern: release builds can make use of the highest
  compression setting to reduce package sizes

Signed-off-by: Henry Kleynhans <hkleynhans@fb.com>
Signed-off-by: Alex Stewart <alex.stewart@ni.com>
0.5.0
2021-09-22 13:14:10 -05:00
Christian Hermann
18f7bfca3a CONTRIBUTING: fix yocto ML link
Signed-off-by: Christian Hermann <mail@hermannch.dev>
Signed-off-by: Alex Stewart <alex.stewart@ni.com>
0.4.5
2021-03-01 10:48:24 -06:00
Christian Hermann
53ab66853e opkg-build: make sure destination dir exists
Signed-off-by: Christian Hermann <mail@hermannch.dev>
Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2021-03-01 10:48:24 -06:00
Ryan Barnett
74ccbee0f7 Makefile: separate manpages and utils install
The installation of opkg-build man page introduces a host dependency
on perl for the pod2man package to generate the man page.

To allow the opkg-utils scripts to be installed separately from the
manpages, break apart the install step into two install steps:
install-utils and install-docs

CC: Christian Hermann <mail@hermannch.dev>
Signed-off-by: Ryan Barnett <ryanbarnett3@gmail.com>
Signed-off-by: Alex Stewart <alex.stewart@ni.com>
2021-02-23 16:13:01 -06:00
Maarten van Megen
4527cd8e9b Opkg.py : Support for tilde in version compare
Add support for the special tilde character. The current opkg version
allows specifying a version appended with a tilde e.g.
1.2.2~releasecandidate which is lower in version than 1.2.2 itself. With
this commit, this is now also supported by the opkg.py script.

Signed-off-by: Maarten <maarten.vanmegen@nedap.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
0.4.3
2020-03-31 15:57:58 -05:00
Alex Stewart
5e733dff52 Makefile: add opkg-feed to UTILS
* Add the opkg-feed script to UTILS so that it is installed with a `make
  install`.

* Clean up the UTILS variable declaration to be a little more diffable.

Signed-off-by: Alex Stewart <alex.stewart@ni.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-02-18 15:46:06 -06:00
Richard Purdie
1cf7cc5e6b Fix reproducibility issues in opkg-build
There is a sorting problem with opkg-build where the ipk generated is depending
upon the order of files on disk. The reason is the --sort option to tar only
influences the orders of files tar reads, not those passed by the -T option.

Add in a sort call to resolve this issue. To ensure consistent sorting we
also need to force to a specific locale (C) else the results are still not
deterministic.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-02-05 16:04:55 -06:00
Christian Hermann
9fc39db84c opkg-unbuild: convert to shell
The previous implementation relied on python, it shelled out anyway
(using bashisms) to call ar/tar and couldn't handle paths != cwd.

This rewrite
* can handle packages elsewhere than cwd
* prints a summary like opkg-build does ("Unbuilt <IPK> into <DEST>")
* is written in valid POSIX shell syntax
* is compatible with opkg-build's non-esoteric options
* is linted with shellcheck.

Tested with
* different tar
    * gnu tar 1.32
    * bsdtar 3.4.1
    * busybox-tar 1.31.1
    * toybox-tar 0.8.2 (but prints a warning: tar: './' not under '/tmp/dest/foo')
* some opkg-build arguments, as of `opkg-build -o root -g root $args`, with
    * args=
    * args="-Z xz"
    * args="-c"
    * args="-c -Z xz"

Signed-off-by: Christian Hermann <mail@hermannch.dev>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-01-17 09:52:20 -06:00
Rex Keen
658d780c08 Make grep and sed arguments in opkg-feed Busybox compliant
Signed-off-by: Rex Keen <rex.keen@ni.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-01-13 17:26:47 -06:00
Alejandro del Castillo
e0c547c645 testOpkgFeedManagement.sh: fix mangled test urls
Email protection program incorrectly mangled the URLs used to test
opkg-feeds. Correct the URLs to make the test pass.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2020-01-03 15:48:17 -06:00
Alejandro del Castillo
f64b761628 makePackage: switch to python3
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
0.4.2
2019-12-16 16:02:56 -06:00
Haris Okanovic
224443ff84 opkg-utils: Switch to python3
Switch all py script shebangs to `#!/usr/bin/env python3`.

Testing: Successfully ran the following on an IPK feed in $PWD:
 * opkg-make-index --checksum md5 --checksum sha256 -p Packages -m -l Packages.filelist .
 * opkg-graph-deps ./Packages
 * opkg-compare-indexes ./ ./
 * opkg-list-fields font-alias_1.0.3-r2.3.204_all.ipk
 * opkg-show-deps -p Packages font-alias

I'm not sure how to correctly run opkg-update-index and opkg-unbuild.
I attempted to run both with `-h`, no parse errors.

My motivation for this change is to add xz support to opkg filelists,
which requires python3's version of tarfile. See previous commits in
this series for details. However, this is probably a good change in
general since python2 support is starting to dwindle.

Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-12-02 09:41:07 -06:00
Haris Okanovic
9b2e2b989b opkg.py/get_file_list(): Add xz support
Open data.tar.xz if gz payload is not present. This change allows xz
payloads to be archived in filelist.

However, only python3's tarfile has xz support. This therefore only
works if opkg-make-index's shebang is overridden to run in python3.

Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-12-02 09:39:31 -06:00
Haris Okanovic
03a7c66c6d opkg.py/get_file_list_dir(): Decode subprocess string, python3 support
String split fails on newline (\n) chars in python3 unless subprocess
output string is decoded as text. This results in fn containing a bad
filename with trailing newline (\n) char, which subsequently breaks
open() in get_file_list().

Tested `opkg-make-index -l Packages.filelist ...` in python 2 and 3.

Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-12-02 09:38:50 -06:00
Alejandro del Castillo
6a9816826d opkg-build: do not include current directory
Current directory entry is not needed.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-11-25 14:48:53 -06:00
Richard Purdie
d65c84020d Fix opkg-build to handle errors correctly
We need opkg-build to fail if for example the tar command is passed invalid
options. Without this, we see silently created empty packaged where data.tar
is zero bytes in size. This creates hard to debug problems.

An example is when reproducible builds are enabled and run on old hosts like
centos7 which has tar < 1.28:

Subprocess output:tar: unrecognized option '--clamp-mtime'
Try `tar --help' or `tar --usage' for more information.

This change does make the script bash specific but that shouldn't an issue
for systems capable of building ipks.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-11-25 13:44:55 -06:00
Rex Keen
a53d53bb7e Add a utility script for listing and manipulating feeds
Signed-off-by: Rex Keen <rex.keen@ni.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-11-07 09:56:06 -06:00
Yann CARDAILLAC
104e32b042 add SPDX license identifiers
Signed-off-by: Yann CARDAILLAC <ycnakajsph@gmail.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-10-18 13:00:45 -05:00
Alejandro del Castillo
c3cc956930 opkg-build: clamp mtimes to SOURCE_DATE_EPOCH
For reproducible builds, clamp mtimes bigger than SOURCE_DATE_EPOCH to
SOURCE_DATE_EPOCH (build generated files, usually).

Fixes bugzilla 13450

Tested-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-09-16 10:00:58 -05:00
Martin Jansa
5163a74a59 opkg-list-fields: fix to print the fields again
* printing opkg.Package directly doesn't return anything useful now
  <opkg.Package object at 0x7fd49e9f2780>

* we need to call Package.print() function and specify which checksums
  to print, we can include both md5 and sha256 for opkg-list-fields

* it was changed in this commit:
  commit 601d691dd8
  Author: Alejandro del Castillo <alejandro.delcastillo@ni.com>
  Date:   Wed Dec 19 11:40:15 2018 -0600

    opkg-make-index: add sha256sum support

  which replaced the modified __str__ function with print(self, checksum)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
0.4.1
2019-05-31 11:35:53 -05:00
Alejandro del Castillo
3d481a9a45 Makefile: fixed for-loop in install receipe
The install receipe would have copied all the manpages to each of the
section folders. This change will do what I believe the original author
had intended.

Signed-off-by: Joshua DeWeese <jdeweese@hennypenny.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-05-30 11:30:28 -05:00
Alejandro del Castillo
8ace3fffb0 ArFile: add python3 compatibility
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-05-14 09:55:55 -05:00
Alejandro del Castillo
86b2dc4c9c opkg-build: do not set mtime on data.tar.X
Opkg should make sure the binaries it creates are created in a
repoducibe way, but it shouldn't modify the mtime of the binaries it
consumes. Doing so has side effects, for exmaple, Python pyc files are
invalidated.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2019-02-21 13:53:35 -06:00
Alejandro del Castillo
1b577d8d13 opkg-build: use filelists as tar input
OE parallelism means that the number of hard links may increase or
decrease while a tar file is being created, which makes tar fail with
error 1. To avoid this problem, use tar -T option, which uses filelists.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
0.4.0
2018-12-26 10:37:21 -06:00
Alejandro del Castillo
601d691dd8 opkg-make-index: add sha256sum support
Add a new --checksum option (default to md5).

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-12-26 10:36:43 -06:00
Alejandro del Castillo
48e72213f2 opkg-make-index: use argsparse instead of getopt
Argsparse is a newer library, it makes the code cleaner and easier to
expand. Only enabled short options, to leave the command line as it was
with getopt.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-12-26 10:35:45 -06:00
Alejandro del Castillo
39710d4ebd opkg-make-index: fix pylint errors and warnings
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-12-26 10:35:34 -06:00
Alejandro del Castillo
961432da1d opkg-build: add support for lz4 compressor
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-11-19 10:09:53 -06:00
Alejandro del Castillo
e911b82483 opkg-build: simplify date calculation
Avoid an integer to string conversion (and back) by directly supplying
the Unix time as an integer to -mtime.

Fixes bugzilla# 12580

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-11-16 16:16:55 -06:00
Alejandro del Castillo
49d32419ab opkg-build: add compressor arguments command line argument
If specified, overwrites the default compressor flags.

Fixes bugzilla #12611

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-11-13 09:18:09 -06:00
Niko Mauno
37f2ddb196 update-alternatives: Fix link relocation support
Commit fcb2633900 which added Debian-style
support for link relocation tries to relocate symbolic link on host OS,
resulting in following-like error when two alternative packages have
symbolic link source located in different directories (/bin/rev ->
/bin/busybox.nosuid and /usr/bin/rev -> /usr/bin/rev.util-linux):

  update-alternatives: renaming rev link from /bin/rev to /usr/bin/rev
  mv: cannot stat '/bin/rev': No such file or directory

Fix the issue by prefixing 'olink' and 'link' variable references with
path to targeted root filesystem's root directory.

Signed-off-by: Niko Mauno <niko.mauno@iki.fi>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-11-12 10:06:05 -06:00
Stefan Agner
0cd38bb1bd opkg-make-index: use ctime instead of mtime
When using sstate, two parallel builds can produce two packages
with the same mtime but different checksums. When later one of
those two builds fetches the others ipk, the package index does
not get udpated properly (since mtime matches). This ends up with
messages such as:
  Downloading file:/../tmp/work/../image/...ipk.
  Removing corrupt package file /../sysroot/../var/cache/opkg/volatile/...ipk

However, in that case, ctime is different. Use ctime instead of
mtime to prevent failures like this.

Suggested-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Acked-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-10-22 09:42:17 -05:00