Commit Graph

106 Commits

Author SHA1 Message Date
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
Mike Crowe
a1ff6a8488 opkg-build: Add support for explicit pigz
oe-core has stopped[1] installing pigz as gzip. This means that in order to
persuade opkg-build to use pigz it must be specified explicitly. Let's
teach opkg-build to deal with being passed pigz as a compressor. We can't
combine the check for whether -T is required because opkg-build calls both
$compressor and gzip explicitly.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-10-05 15:31:20 -05:00
Michael Hansen
306d704d55 opkg-build: Use local time for build_date, since opkg extracts files assuming local time rather than UTC.
Also increase resolution of build date down to the second, rather than
clamping to midnight of the current date.

Signed-off-by: Michael Hansen <michael.j.hansen@hp.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-02-28 13:37:00 -06:00
Michael Hansen
ef5db062b7 Only use --sort=name on versions of tar which support it. This fixes compatibility with bsdtar and old versions of GNU tar (e.g. RHEL6).
Signed-off-by: Michael Hansen <michael.j.hansen@hp.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-02-28 10:21:05 -06:00
Gardon Lukasz
a05bfd0a03 opkg-build: improve ipk package reproducibility
Implement timestamp recommendation from reproducible-build.org [1]

- Enable deterministic archieve by setting zero timestamp and
  uids/guds with using 'D' in GNU ar tool

[1] https://reproducible-builds.org/docs/archives/

Signed-off-by: Gardon Lukasz <garjack555@gmail.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-02-22 14:16:01 -06:00
Juro Bystricky
20278a7f90 opkg-build: differentiate between compressorargs and zipargs
control.tar.gz is always compressed with gzip.
If data.tar is compressed by a compressor other than gzip, control.tar.gz
may end up compressed with timestamp in the compressed image header.
This would result in packages that are not binary reproducible.

[YOCTO #11242]

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
0.3.6
2018-02-07 15:14:29 -06:00
Alejandro del Castillo
682f8c5e35 opkg-build: improve package reproducibility
Implements some of the recommendations by reproducible-build.org [1]

- Set modification time to SOURCE_DATE_EPOCH env variable
- Enable deterministic sorting of directory entries
- Do not save timestamp on gzip compressed archive

bugzilla #11242

[1] https://reproducible-builds.org/docs/archives/

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-01-29 04:19:37 -06:00
Alejandro del Castillo
fcb2633900 update-alternatives: add support for link renames
During package upgrades, the link location might change. For example:

Package A: 'update-alternatives --install /bin/app app /some/real/path 100'
Package B: 'update-alternatives --install /sbin/app app /some/other/path 100'

Opkg disallows a link change and throws an error. Debian does allow the
operation, changing the link to the new location. Add support to follow
the debian update-alternatives behavior.

bugzilla #8344

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-01-23 12:00:22 -06:00
Jackie Huang
f2e63deda2 update-alternatives: fix the sed pattern in remove_alt
'\>' is to matches the end of a word, but the executable is
not always a 'word', e.g. /usr/lib64/busybox/usr/bin/[

then such alternatives can not be removed.

So change to use '\s' in the pattern since the following
character of the $path is whitespace.

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2018-01-21 05:52:31 -06:00
Jeffrey Pautler
13f6281d24 opkg.py/opkg-make-index: Add option to include all fields
If the -f option is enabled, opkg-make-index will include user-defined
fields in the package index rather than discarding them. This change is
motivated by the fact that opkg now has support for user-defined fields
in the package index.

Signed-off-by: Jeffrey Pautler <jeffrey.pautler@ni.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-10-06 16:46:06 -05:00
Jeffrey Pautler
6cd5925cf7 opkg.py: Remove reformatting of description field
The Debian Policy Manual describes the format of the description field.
This includes information about how lines might be wrapped by programs
displaying this information, how to mark lines to not be wrapped, how
to mark a line as blank, and how leading spaces on a multi-line
description might be deleted.

By reformatting the description field in opkg.py, we are breaking many
of these behaviors and taking control of formatting away from the
author of the control file. Instead, we should simply copy the
description field with no reformatting.

Signed-off-by: Jeffrey Pautler <jeffrey.pautler@ni.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-10-06 11:30:20 -05:00
Jeffrey Pautler
8c5201fe09 opkg.py: Fix run-time error in call to ArFile
Signed-off-by: Jeffrey Pautler <jeffrey.pautler@ni.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-10-03 08:51:23 -05:00
Adam Trhon
51badc589a opkg-build*: fix empty package name in error message
When opkg-build detects illegal character in package name it prints an error
message with this name. Due to a wrong variable name the package name in the
error message is empty. The same error occurs in opkg-buildpackage as well.
This patch fixes both.

Signed-off-by: Adam Trhon <adam.trhon@tbs-biometrics.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-09-11 12:29:24 -05:00
朱穆穆
9ac94576bb opkg.py/__init__: Compatible for ipk which outer is tar
Signed-off-by: Zhu Mumu <zhumumu@gmail.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-07-10 15:19:11 -05:00
Alejandro del Castillo
c75797c01f opkg-build: make Section, Priority and Source fields optional
This is consistent with Debian policy.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-06-27 15:38:12 -05:00
Rob Woolley
1a708fd73d Check for optional terminator in archives
Archive files have an optional '/' terminator in the member file name
field.  (See /usr/include/ar.h)

This change makes opkg-make-index more forgiving on packages created
manually with alternative tools like CPack.

Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
0.3.5
2017-01-30 13:52:45 -06:00
Alejandro del Castillo
b736b318fd Makefile: prefer defined bindir and mandir as installation dirs
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2017-01-18 17:01:32 -06:00
desmond
3a09dbde3a Added support to generate index file with multiple version per package
Using the -a option with opkg-make-index, you can now generate an index
file which will list multiple version of the same package. Added since
opkg now supports specifying version of package.

Signed-off-by: desmond <desmond.correia@prolucid.ca>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-12-30 13:52:42 -06:00
Chen Qi
c852b46bd6 update-alternatives: warn when multiple providers have the same priority
Warn users when multiple providers of a utility have the same priority.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-12-30 11:02:55 -06:00
Alejandro del Castillo
9228b38a81 opkg-make-index: print summary on it's own line
The Description field on the Packages file doesn't follow the same
format used on the Control file. It is incorrectly processing the
summary line (it treats it as part of the longer description). Add code
to print the summary line on it's own.

Fixes issue 9238

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
0.3.4
2016-10-07 11:29:53 -05:00
Andrew Shadura
9830ab38ea opkg-build: Add a manpage in POD format.
Add a manpage for opkg-build and a corresponding Makefile
snippet to build it using pod2man.

Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-10-05 13:33:37 -05:00
Andrew Shadura
1eddbee4b2 opkg-build: Add support for alternative compression schemes.
Add -Z with the same semantics as dpkg-deb -Z:

Specify which compression type to use for data.tar member when building
the package. Allowed values are gzip, bzip2 and xz.
The default value is gzip.

Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-10-05 13:33:24 -05:00
Andrew Shadura
4eaaf9f932 opkg-build: Unify tabulation in the option parser.
Align case/esac options assuming tabulation size 8.

Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-10-05 13:33:15 -05:00
Alejandro del Castillo
3916b0a566 opkg-utils: remove opkg-compare-versions implementations
Currently, there are three compare-versions implementations:

1) opkg-utils: opkg-compare-versions.c
2) opkg-utils: opkg-compare-versions.sh
3) opkg: internal

To avoid confusion and avoid maintaining three codebases, remove the
compare-versions functionality from opkg-utils and only keep the
implementation on the opkg binary.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-06-23 15:59:42 -05:00
Alejandro del Castillo
3ffece9bf1 arfile.py: remove dependency on python-future
Python-future provides a python2 compatible object class (provides next
method). Since method is not used, remove dependency.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
0.3.2
2016-06-03 16:39:52 -05:00
Alejandro del Castillo
ecd9a499d3 opkg.py/write_packages_file: call __str__ instead of __repr__
Commit b9eec00a67 correctly renamed
__repr__to __str__. A call site in write_packages_file was missed.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-06-01 17:18:59 -05:00
Alejandro del Castillo
9e2381d9c7 migrate to python 3
General fixes
* Add __future__ imports
* Use print function instead of print statement
* Use new style classes
* Iterate over list, instead of over object.keys()
* Use six.iteritems  instead of iteritems()

opkg.py:
* Add conditional to decode string if needed in Package:read_control

arfile.py
* Add seekable method to FileSection class (needed by tarfile)

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-06-01 17:17:44 -05:00
Alejandro del Castillo
b6392d97e7 CONTRIBUTING: No longer need to Cc Paul Barker
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-05-10 10:33:49 -05:00
Alejandro del Castillo
69aa4345f3 opkg-build: return error if Version is missing
If Version is missing in a control file, opkg-build reports an error to
stdout, but returns 0. Fix condition on pkg_appears_sane to properly
return an error if Version is missing.

Suggested-by: Thomas de Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-05-10 10:33:36 -05:00
Denys Dmytriyenko
2be44e399f opkg-build: re-do find/ls code to not fail on filenames with spaces
Signed-off-by: Denys Dmytriyenko <denys@ti.com>
2016-04-26 16:38:38 -05:00
Aníbal Limón
cc0c6d9a7c opkg-build: Exit when fail to list files.
We have an issue when ls segfaults in some cases [1] so it's
better to detect the failure at this level instead of continue
the build process.

[YOCTO #8926]

[1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=8926#c0

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2016-04-11 11:05:25 -05:00
Haris Okanovic
fc6eb29137 opkg-utils: Add opkg-graph-deps
Usage: opkg-graph-deps [-h] [-d] [-o feed.dot] [-u <Base_feed_URL>]
<Paths_to_Packages_files>

Generates a dot formatted dependency graph of an IPK feed.

The feed is specified by a list of IPK index (Packages) files, which
are sourced in the order specified to build a dependency graph. Last
index to declare a package wins, but also generates a warning to stderr.
Only the flat index format is supported -- I.e. only Packages files,
not Packages.gz files.

Possible warnings:
 Duplicate package: package appears in more than one index.
 Broken dependency: no package satisfies a declared dependency.
 Self alias: package declares an alias on it's own name.
 Virtual-real alias: package attempts to provide a real package.
 Missing field: package is missing a required field.

If a base feed URL is specified (-u), each node will include an 'href'
to the associated IPK file. This is purely cosmetic. E.g. It can be used
to create clickable links on a rendered graph. Using it has no effect
on the set of packages or dependencies. It's assumed the specified
base feed URL hosts the current working directory, so the resulting
href's are generated by joining the base and a relative IPK path.

The resulting feed graph is written to './feed.dot' or an alternate
path specified by the caller. Nodes represent real packages (not
aliases)
and edges represent dependencies.

Node attributes:
 (node name): Package name from feed index (without version or arch)
 label: [Package name] [ipkArchitecture] [ipkVersion]
 ipkArchitecture: Architecture name from feed index
 ipkVersion: The full version number from feed index
 ipkMissing: Set to "1" when the ipk is not actually in feed, but has
  one or inbound dependencies.
 href: URL to the IPK file. Only if optional base URL is specified.

Edge attributes:
 (from) The package name declaring a dependency
 (to) The (de-aliased) package name (from) depends on
 ipkProvides: The alias of (to) which (from) depends on. Only set when
  the alias != (to).
 ipkBrokenDep: Set to "1" if (to) is missing from the feed.

Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Reviewed-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2016-01-29 11:54:06 -06:00
Haris Okanovic
e022fd082e opkg-utils: Fix crash on dependency error
Fix crash on exception in opkg-show-deps when generating an
'unsatisfied dependency' error. process_dep() function was
referencing a missing parameter `pkg`.

Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Acked-by: Brad Mouring <brad.mouring@ni.com>
Cc: Alejandro del Castillo <alejandro.delcastillo@ni.com>
Cc: Paul Barker <paul@paulbarker.me.uk>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
2015-09-29 10:48:18 -05:00
Chen Qi
53274f0875 update-alternatives: avoid double slash problem
The link path stored by update-alternatives should always be absolute and so we
do not need to add an additional slash when joining to $OPKG_OFFLINE_ROOT.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-11-24 11:41:57 +00:00
Paul Barker
127b371319 opkg-show-deps: Add comments to explain code
There was some confusion discussed on the mailing list about what the various
loops in this script were doing. Comments are added to explain the behaviour,
hopefully preventing any confusion in the future. Thanks to Pavel Zubarev for
bringing this up and helping me to clarify what the current code is doing.

Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-11-15 16:00:44 +00:00