aboutsummaryrefslogtreecommitdiffstats
path: root/libopkg/pkg.c
AgeCommit message (Collapse)Author
2014-12-18pkg: Improve logic in pkg_get_installed_filesPaul Barker
We can now use str_starts_with instead of reimplementing the same functionality here. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-12-15libopkg: Minor tidyupsPaul Barker
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-12-15libopkg: Unconditionally call freePaul Barker
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>
2014-12-15libopkg: Avoid assingment in if statementsPaul Barker
Assignment in if statements is just confusing. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-12-15libopkg: Avoid functions with side effects in if statementsPaul Barker
Functions which have significant side effects are moved outside of if statements. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-12-15libopkg: Tidy up reformatted C filesPaul Barker
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-12-15Initial reformat with 'indent'Paul Barker
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>
2014-10-28Merge branch 'opkg-0.2.x'Paul Barker
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-10-28abstract_pkg_t: Make depended_upon_by a pkg_vecPaul Barker
This change is required to simplify code paths and enable the next couple of changes. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-10-11opkg_conf: Add and implement check_pkg_signature optionPaul Barker
If the check_pkg_signature option is set, a signature file will be downloaded for each package file and this signature will be validated before the package is installed. This adds an additional layer of security to the use of opkg. This patch fixes issue 132. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-06-05Cleanup trailing whitespaceEmmanuel Deloget
The whitespaces has been removed automatically using the following command line: grep --exclude-dir .git -rHn '[[:space:]]$' | \ awk -F: '{ print $1 }' | sort | uniq | \ grep -v COPYING | \ while read f; do sed -i 's/[[:space:]]*$//g' $f; done The COPYING file has been spared because (a) it's a GNU file, not an opkg file and (b) the ^L control chars are in the [[:space:]] character list (and we don't want them to disapear). Changes to ChangeLog.ipkg were dropped as they are unnecessary for such a legacy file. Signed-off-by: Emmanuel Deloget <logout@free.fr> Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-05-30Add vim modelines to all .c and .h filesPaul Barker
This also corrects the existing vim modelines to match the desired format. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-05-08pkg: Add verify functionPaul Barker
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-05-08pkg: Don't check HAVE_SHA256Paul Barker
The member variable pkg->sha256sum can be initialised/freed even if sha256 support is disabled. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-02-23Merge branch 'opkg-0.2.x'Paul Barker
New references to the 'conf' variable are changed to 'opkg_config' as was previously changed on master. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-02-23pkg: Add per-package force_reinstall flagPaul Barker
This flag allows two package object to share the same version information but be distinguishable from each other. It is never stored on disk or reported to the user but is used when comparing package versions. A new function, pkg_compare_versions_no_reinstall(), is added to compare versions without caring about this force_reinstall flag. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-02-05xfuncs.c: Move to libopkg and remove empty libbbPaul Barker
This involves a lot of header and build system tidyup to remove libbb. We still need to do another pass of header tidyup. Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2014-02-05libopkg: Fixup header inclusionPaul Barker
Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
2013-09-02Fix -Wsign-comparepaul.betafive@gmail.com
Signed-off-by: Paul Barker <paul@paulbarker.me.uk> git-svn-id: http://opkg.googlecode.com/svn/trunk@702 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2013-09-02pkg.c: Replace order macro with functionpaul.betafive@gmail.com
The macro is difficult to read, replace it with a clean function. The compiler will be able to inline this anyway. Signed-off-by: Paul Barker <paul@paulbarker.me.uk> git-svn-id: http://opkg.googlecode.com/svn/trunk@699 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2013-09-02Renamed conf to opkg_configpaul.betafive@gmail.com
This prevents the libopkg from polluting the global namespace. From: Christian Ege <k4230r6@gmail.com> Signed-off-by: Paul Barker <paul@paulbarker.me.uk> git-svn-id: http://opkg.googlecode.com/svn/trunk@689 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2013-08-27Tidy up const usage around str_to_constraint functionpaul.betafive@gmail.com
The prototype of str_to_constraint is changed to reflect the fact that it doesn't modify the strings it's given. The prototype of parseDepends is changed to reflect the fact that it doesn't modify the string it's given. This is needed to match the new prototype of str_to_constraint Usage of str_to_constraint in pkg_version_satisfied no longer needs to lose the const qualifier. Signed-off-by: Paul Barker <paul@paulbarker.me.uk> git-svn-id: http://opkg.googlecode.com/svn/trunk@682 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2012-11-22Don't print provides if nothing is providedpixdamix@gmail.com
Every package provides itself. While printing package information all fields are printed only if there is any relevant info for them. For example: a package with no "Replaces" won't get this printed at all. Packages which provide only themselves, were printing this field but with no values. This patch skips this field if the package provides only itself. Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> git-svn-id: http://opkg.googlecode.com/svn/trunk@647 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2012-11-22pkg_depends: fix version constraintspixdamix@gmail.com
* factor parsing version constraint to str_to_constraint and use that from pkg (pkg_version_satisfied) and also pkg_depends (parseDepends) * fix constraint_to_str(), for EARLIER and LATER it was using '<' and '>' which is parsed later as EARLIER_EQUAL and LATER_EQUAL * show notice when deprecated '<' or '>' is used Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> git-svn-id: http://opkg.googlecode.com/svn/trunk@644 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2012-11-22merge newpkg->provides even when oldpkg->provides existedpixdamix@gmail.com
* introduced in http://code.google.com/p/opkg/source/diff?spec=svn277&r=277&format=side&path=/trunk/libopkg/pkg.c * the problem happens when oldpkg provide 1 and newpkg provide 2 provides_count is merged to 2, but oldpkg->provides has only 1 entry causing SIGSEGV: pkg_formatted_field (fp=fp@entry=0x1444ce0, pkg=pkg@entry=0x120c620, field=<optimized out>, field@entry=0x7ffff7bd2abe "Provides") at pkg.c:739 739 fprintf(fp, "%s %s", i == 1 ? "" : ",", (gdb) bt #0 pkg_formatted_field (fp=fp@entry=0x1444ce0, pkg=pkg@entry=0x120c620, field=<optimized out>, field@entry=0x7ffff7bd2abe "Provides") at pkg.c:739 #1 0x00007ffff7bc32fc in pkg_print_status (pkg=0x120c620, file=0x1444ce0) at pkg.c:887 #2 0x00007ffff7bbff59 in opkg_conf_write_status_files () at opkg_conf.c:400 #3 0x00007ffff7bbad8a in write_status_files_if_changed () at opkg_cmd.c:65 #4 0x00007ffff7bbb73e in opkg_upgrade_cmd (argc=<optimized out>, argv=<optimized out>) at opkg_cmd.c:577 #5 0x00007ffff7bbbcc2 in opkg_cmd_exec (cmd=cmd@entry=0x7ffff7dda080, argc=argc@entry=1, argv=argv@entry=0x7fffffffe768) at opkg_cmd.c:1319 #6 0x000000000040165f in main (argc=3, argv=0x7fffffffe758) at opkg-cl.c:377 Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> git-svn-id: http://opkg.googlecode.com/svn/trunk@642 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2012-11-22detect circular dependenciespixdamix@gmail.com
Add logic to detect circular dependencies. If we see any dependency from any given parent twice, ignore it the second time and print a notice message that we did so. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> git-svn-id: http://opkg.googlecode.com/svn/trunk@641 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2012-11-22Failed postinst script is not fatal with conf->offline_rootpixdamix@gmail.com
When we have an offline root and have specified force-postinstall, attempt to run the postinstall but if it fails, just leave it in the status file as needing to run. We can issue a NOTICE this is happened but supress errors. This means the OE class doesn't have to do any further post processing of the postinstalls itself. Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> git-svn-id: http://opkg.googlecode.com/svn/trunk@639 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2011-10-13Remove comment for a proposed feature that will never be implemented.graham.gower@gmail.com
Maintainer scripts cannot be run in a chroot unless the host system can run target system binaries. Given this, the feature would be of limited use. git-svn-id: http://opkg.googlecode.com/svn/trunk@628 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2010-11-22Print the package name corresponding to a failed script.graham.gower@gmail.com
From Sergey 'Jin' Bostandzhyan. git-svn-id: http://opkg.googlecode.com/svn/trunk@586 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2010-11-19Fix formatting issues found with the last commit.graham.gower@gmail.com
git-svn-id: http://opkg.googlecode.com/svn/trunk@585 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2010-09-15Use uppercase M for printing maintainer field, to be consistent.graham.gower
From Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>. git-svn-id: http://opkg.googlecode.com/svn/trunk@565 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2010-09-13fix compile issues on OS X and FreeBSDgoogle@wwsnet.net
git-svn-id: http://opkg.googlecode.com/svn/trunk@560 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2010-09-13implement --force-postinstall option, this allows forcing the execution of ↵google@wwsnet.net
postinstall scripts in offline root mode git-svn-id: http://opkg.googlecode.com/svn/trunk@559 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2010-08-18Remove trailing whitespace. Sorry if this breaks your patches.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@552 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2010-06-21Minor cleanup/simplification.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@537 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2010-01-12Print an error in the case of a broken control.tar.gz file within the archive.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@516 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-12-21Set the arch_priority when parsing the Architecture.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@507 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-12-21Initial stab at untangling the #include maze. Probably needs a second pass.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@504 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-12-14Don't need \n for perrors.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@491 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-12-09Merge commit 'grg' into HEADgraham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@471 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-27Provide error checking for users of pkg_extract_* functions.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@391 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-27Add __FUNCTION__ to the error mesage.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@389 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-26Remove str_util.{c,h}graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@383 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-26file_util.c cleanups. Remove redundant str_chomp from str_util.c.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@382 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-25Propagate errors upwards.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@379 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-25Various cleanups for pkg.{c,h}.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@372 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-25Make a couple of functions static, and return void since they cannot fail.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@368 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-24Remove remaining uses of pkg->*_str arrays and free() them after parsing.graham.gower
Saves about 800kb in peak memory usage for my package list (6000 packages). git-svn-id: http://opkg.googlecode.com/svn/trunk@356 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-24There should be a space before the bracket.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@354 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
2009-11-24Fix pkg_depend_str() to not use pkg->depends_str.graham.gower
git-svn-id: http://opkg.googlecode.com/svn/trunk@353 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358