Age | Commit message (Collapse) | Author |
|
During an upgrade, if A is upgraded, and A depends on B, B is upgraded
automatically. Then the upgrade procedures moves to B, where it fails,
as B was already updated (issue 154).
Skip package if the version to be installed and the version on the
system match AND it's an upgrade operation.
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
The omission of xfuncs.h from the headers list in libopkg/Makefile.am caused the
file not to be included in the release archive. This meant that -rc1 was not
buildable from the release archive.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
If a package is reinstalled with force_reinstall set, the 'new' version of the
package used for the reinstall will be initialised by reading the package file
itself. Therefore, this pkg object will not have a valid pkg->src. Calling
pkg_src_verify(NULL) results in a segfault.
This issue is solved by checking that the package has a valid pkg->src before
trying to verify it. This should also ensure that the installation of packages
directly from a local package file will succeed.
For reinstallations this does not present a security risk as the original
package feed and file will be verified during opkg_prepare_url_for_install
before this file is used to construct the new pkg object.
This fixes issue 153.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
When improving the logic in opkg_validate_cached_file in commit
fdc453c508ed3e38393039fa51348ed252c2b481, a segfault was introduced. We should
ensure that etag is non-NULL before calling create_file_stamp.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
We can now use str_starts_with instead of reimplementing the same functionality
here.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
str_starts_with was defined as a static function in both opkg_download.c and
opkg_download_curl.c. We now define this function once publically in
opkg_utils.c and call this implementation where needed.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
One if statement slipped through the previous cleanups.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
By moving a DEBUG message slightly earlier in the function we can simplify the
logic.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
We don't need a separate variable in which to store pkg->parent.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
If opkg_config->force_depends is set, the old code would never set 'conflicts',
therefore 'if (conflicts)' would be false and the bulk of the code in this
function would not be executed. This meant that the code to set 'level' based on
the value of opkg_config->force_depends was nonsensical.
This situation is improved by simply returning 0 early of
opkg_config->force_depends is set.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
The existing logic repeatedly checked etag and has been slightly improved.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
We can use 'diff = x' instead of the equivalent of
'if (x) diff = 1; else diff = 0;'.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
We can avoid an unnecessary comparison where the destination path does not
exist.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Explain why we're discarding 'dependencies' which aren't DEPENDS, RECOMMENDS or
PREDEPENDS.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Even though this change results in a few long lines, it keeps the source code
clear to read.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
We can just use 'return x' instead of 'if (x) return 1; else return 0;' where x
is a boolean expression.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
The return value of strcmp or strncmp is always compared to zero using either
'==', '!=', '<', '<=', '>' or '>='. Using a regular format like this should make
the logic easy to understand at first glance.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Passing a NULL pointer to free() is a no-op therefore there is no need to test
whether a pointer is NULL or not before calling free().
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Assignment in if statements is just confusing.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Functions which have significant side effects are moved outside of if
statements.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Use an intermediate variable to move multi-line expressions outside of if
statements.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Most calls to curl_easy_setopt in the initialisation function should be checked
for success or failure and a debugging message should be printed if they fail.
For these calls, a setopt macro is introduced which wraps curl_easy_setopt with
error checking and printing of the debug message as needed. This macro is now
used for all calls to curl_easy_setopt other than those which need to print an
error message and cause the initialisation function to abort if they fail.
This change adds error checking to all curl_easy_setopt calls in the
initialisation function which were previously missing error checking.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
During the tidy up, includes have been moved outside of the 'extern "C" {}'
construct where necessary.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
For each file, the command executed was:
indent -linux -i4 -nut -sc -bbo -nhnl $f
This is the first step in improving the code formatting and further work is
still required. 'indent' is confused by the 'extern "c" {}' wrapping in the
header files and gets the indentation wrong. It also produces sub-optimal
formatting for some long lines.
Each file will be reviewed by hand after this commit.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
In pkg_hash_fetch_best_installation_candidate, we should not error out if
multiple providers of a given abstract package are present but there is nothing
to differentiate between them (neither is held, preferred, matches the abstract
package name or is already installed). Instead we should just select any valid
provider and get on with the install.
This fixes issue 152.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Add a way to exclude specific packages from the install.
When an excluded package is required by another package an error
will be generated. If the excluded package is only recommended,
no error will be generated.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Add the ability to not install ANY recommended packages.
This option is matched by the command line argument '--no-install-recommends'.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
The status line for a package for which installation had failed was the cryptic
"install prefer,user not-installed". This is very unclear and doesn't represent
the broken state of the package clearly. Instead we set flags so that we get
"install reinst-required half-installed". This is better but still not perfect
as 'install' could be misinterpreted. Further cleanup of the state formatting
will improve this.
We also give some advice on how to remove package debris or reattempt the
install.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
In the case of upgrading many packages (most likely common case is upgrade
all installed packages), packages may become orphan. Those orphans should
not be upgraded and must be removed.
Use case:
* A1 depends on B1
* A2 does not depend anymore on B
* A1 and B1 are outdated
* A2 and B2 are available.
$ opkg-cl upgrade A
Is fine:
A1 is upgraded to A2
B1 is removed
$ opkg-cl upgrade
Will upgrade A2 and install B2 (remove orphan B1 and install B2).
This patch will halt upgrade of B2 when opkg tries to upgrade a package
marked as "replace".
Signed-off-by: Gaël PORTAY <g.portay@overkiz.com>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Upgrade has to copy the flags of the old package.
Signed-off-by: Gaël PORTAY <g.portay@overkiz.com>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
If we're downloading a non-gzipped "Packages" file it is written straight to
list_file_name and nothing is written to tmp_file_name. So it is list_file_name
that should be verified not tmp_file_name.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
parseDepends sets conflicts->type to DEPEND so we move the setting to CONFLICTS
after the call to parseDepends so that it is not overwritten.
- Fixes 'whatconflicts' sub-command.
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Duplicate entries in the depended_upon_by list may cause a package to not be
considered an orphan when it should be, or cause removals to be attempted twice
when removing all dependent packages. Now that depended_upon_by is a pkg_vec, it
is easy to ensure that duplicates do not enter the list.
This change should fix issue 140.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
In pkg_remove_orphan_dependent(), we look for DEPENDS or RECOMMENDS which
existed for old_pkg but don't exist for pkg. Previously this was done by
comparing 'struct depend_t' addresses to see if the exact same dependency
existed in both packages. However, each 'struct depend_t' addressed in the
possibilites list is allocated separately during parseDepends(), so two parses
of the exact same dependency string will result in different pointers. Thus we
should not be directly comparing 'struct depend_t' addresses.
Instead, we can compare the addresses of the abstract packages which each
'struct depend_t' references. These addresses are set via a call to
ensure_abstract_pkg_by_name() which will return the same pointer if it sees the
same pkg name several times as the abstract_pkg_t objects are stored in a hash
table.
This change also ensures that if the constraint within a dependency changes
between old_pkg and pkg, it is not considered an orphan. The constraints of the
dependencies of the new package will already have been checked prior to
installing the new package so we know that such changes will have already been
handled.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
'Recommends'
Signed-off-by: Andreas Monzner <andreas.monzner@dream-property.net>
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
This change is required to simplify code paths and enable the next couple of
changes.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
If a package is upgraded from an old version to a new version and the old
version RECOMMENDS a package which the new version does not, the recommended
package should be removed if it was auto installed and nothing else requires it.
This fixes issue 144.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
state_flag is set by or-ing together the flags which are set. Therefore, '=='
and '!=' should not be used to check whether a particular flag is set or not.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
This helper function checks if a given string is present in a given string list.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
The comments regarding dpkg incompatibility with prerm and postrm scripts during
package upgrades are tidied up.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
When upgrading a package from v1 to v2, run "v1-prerm upgrade v2" and
"v1-postrm upgrade v2", similarly to what dpkg does.
This patch fixes issue 104.
Signed-off-by: Peter Urbanec <openembedded-devel@urbanec.net>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
The from_upgrade argument was never set to a non-zero value when opkg_remove_pkg
was called. Additionally, the argument was called 'message' in the header
instead of 'from_upgrade'.
This confusing mess can just be removed, removal of an old package during an
upgrade is handled by opkg_install_pkg without calling opkg_remove_pkg.
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|
|
--force-removal-of-dependent-packages
While remove pkg with '--force-removal-of-dependent-packages',
pkg may be added to pkgs remove list multiple times, add status
check to make sure pkg only be removed once.
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
|