diff options
Diffstat (limited to 'src/tests')
64 files changed, 0 insertions, 3673 deletions
diff --git a/src/tests/.svn/all-wcprops b/src/tests/.svn/all-wcprops deleted file mode 100644 index cf285ed..0000000 --- a/src/tests/.svn/all-wcprops +++ /dev/null @@ -1,35 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 29 -/svn/!svn/ver/634/trunk/tests -END -opkg_hash_test.c -K 25 -svn:wc:ra_dav:version-url -V 46 -/svn/!svn/ver/552/trunk/tests/opkg_hash_test.c -END -opkg_active_list_test.c -K 25 -svn:wc:ra_dav:version-url -V 53 -/svn/!svn/ver/552/trunk/tests/opkg_active_list_test.c -END -libopkg_test.c -K 25 -svn:wc:ra_dav:version-url -V 44 -/svn/!svn/ver/622/trunk/tests/libopkg_test.c -END -Makefile.am -K 25 -svn:wc:ra_dav:version-url -V 41 -/svn/!svn/ver/474/trunk/tests/Makefile.am -END -opkg_extract_test.c -K 25 -svn:wc:ra_dav:version-url -V 49 -/svn/!svn/ver/552/trunk/tests/opkg_extract_test.c -END diff --git a/src/tests/.svn/entries b/src/tests/.svn/entries deleted file mode 100644 index 930a7e8..0000000 --- a/src/tests/.svn/entries +++ /dev/null @@ -1,201 +0,0 @@ -10 - -dir -635 -http://opkg.googlecode.com/svn/trunk/tests -http://opkg.googlecode.com/svn - - - -2012-01-19T13:51:59.790020Z -634 -pixdamix@gmail.com - - - - - - - - - - - - - - -e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 - -opkg_hash_test.c -file - - - - -2012-02-03T08:11:57.359042Z -42ded85fe3c9d5d5427ee6f07b629828 -2010-08-18T03:39:02.973664Z -552 -graham.gower - - - - - - - - - - - - - - - - - - - - - -2134 - -opkg_active_list_test.c -file - - - - -2012-02-03T08:11:57.359042Z -3a5506764a10f969300fefc107066e3b -2010-08-18T03:39:02.973664Z -552 -graham.gower - - - - - - - - - - - - - - - - - - - - - -4626 - -libopkg_test.c -file - - - - -2012-02-03T08:11:57.359042Z -e37fec6637c1992e52ec2d4bad07776d -2011-05-26T00:51:50.330823Z -622 -graham.gower@gmail.com - - - - - - - - - - - - - - - - - - - - - -6385 - -Makefile.am -file - - - - -2012-02-03T08:11:57.359042Z -4f0297e9e0f54993a1809827d77b12ae -2009-12-09T06:05:08.329580Z -474 -graham.gower - - - - - - - - - - - - - - - - - - - - - -907 - -regress -dir - -opkg_extract_test.c -file - - - - -2012-02-03T08:11:57.359042Z -ab5ec2fffab9a3b9ab566b56c9ee8d11 -2010-08-18T03:39:02.973664Z -552 -graham.gower - - - - - - - - - - - - - - - - - - - - - -1152 - diff --git a/src/tests/.svn/text-base/Makefile.am.svn-base b/src/tests/.svn/text-base/Makefile.am.svn-base deleted file mode 100644 index 1a6f565..0000000 --- a/src/tests/.svn/text-base/Makefile.am.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -AM_CFLAGS = $(ALL_CFLAGS) -Wall -g -O3 -I${top_srcdir}/libopkg - -#noinst_PROGRAMS = opkg_hash_test opkg_extract_test -#noinst_PROGRAMS = libopkg_test opkg_active_list_test -noinst_PROGRAMS = libopkg_test - -#opkg_hash_test_LDADD = $(top_builddir)/libbb/libbb.la $(top_builddir)/libopkg/libopkg.la -#opkg_hash_test_SOURCES = opkg_hash_test.c -#opkg_hash_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir) - -#opkg_extract_test_LDADD = $(top_builddir)/libbb/libbb.la $(top_builddir)/libopkg/libopkg.la -#opkg_extract_test_SOURCES = opkg_extract_test.c -#opkg_extract_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir) - -#opkg_active_list_test_LDADD = $(top_builddir)/libopkg/active_list.o -#opkg_active_list_test_SOURCES = opkg_active_list_test.c -#opkg_active_list_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir) - -libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.la -libopkg_test_SOURCE = libopkg_test.c -libopkg_test_LDFLAGS = -static - - diff --git a/src/tests/.svn/text-base/libopkg_test.c.svn-base b/src/tests/.svn/text-base/libopkg_test.c.svn-base deleted file mode 100644 index 21f100e..0000000 --- a/src/tests/.svn/text-base/libopkg_test.c.svn-base +++ /dev/null @@ -1,261 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <libgen.h> - -#include <opkg.h> - -int opkg_state_changed; -pkg_t *find_pkg = NULL; - - -#define TEST_PACKAGE "aspell" - -void -progress_callback (const opkg_progress_data_t *progress, void *data) -{ - printf ("\r%s %3d%%\n", (char*) data, progress->percentage); - fflush (stdout); -} - -static void list_pkg(pkg_t *pkg) -{ - char *v = pkg_version_str_alloc(pkg); - printf ("%s - %s\n", pkg->name, v); - free(v); -} - -void -package_list_installed_callback (pkg_t *pkg, void *data) -{ - if (pkg->state_status == SS_INSTALLED) - list_pkg(pkg); -} - -void -package_list_callback (pkg_t *pkg, void *data) -{ - static int install_count = 0; - static int total_count = 0; - - if (pkg->state_status == SS_INSTALLED) - install_count++; - - total_count++; - - printf ("\rPackage count: %d Installed, %d Total Available", install_count, total_count); - fflush (stdout); - - if (!find_pkg) - { - /* store the first package to print out later */ - find_pkg = pkg; - } -} - -void -package_list_upgradable_callback (pkg_t *pkg, void *data) -{ - list_pkg(pkg); -} - -void -print_package (pkg_t *pkg) -{ - char *v = pkg_version_str_alloc(pkg); - printf ( - "Name: %s\n" - "Version: %s\n" - "Repository: %s\n" - "Architecture: %s\n" - "Description: %s\n" - "Tags: %s\n" - "Size: %ld\n" - "Status: %d\n", - pkg->name, - v, - pkg->src->name, - pkg->architecture, - pkg->description, - pkg->tags? pkg->tags : "", - pkg->size, - pkg->state_status); - free(v); -} - - -void -opkg_test (void) -{ - int err; - pkg_t *pkg; - - err = opkg_update_package_lists (progress_callback, "Updating..."); - printf ("\nopkg_update_package_lists returned %d\n", err); - - opkg_list_packages (package_list_callback, NULL); - printf ("\n"); - - if (find_pkg) - { - printf ("Finding package \"%s\"\n", find_pkg->name); - pkg = opkg_find_package (find_pkg->name, find_pkg->version, find_pkg->architecture, find_pkg->src->name); - if (pkg) - { - print_package (pkg); - } - else - printf ("Package \"%s\" not found!\n", find_pkg->name); - } - else - printf ("No package available to test find_package.\n"); - - err = opkg_install_package (TEST_PACKAGE, progress_callback, "Installing..."); - printf ("\nopkg_install_package returned %d\n", err); - - err = opkg_upgrade_package (TEST_PACKAGE, progress_callback, "Upgrading..."); - printf ("\nopkg_upgrade_package returned %d\n", err); - - err = opkg_remove_package (TEST_PACKAGE, progress_callback, "Removing..."); - printf ("\nopkg_remove_package returned %d\n", err); - - printf ("Listing upgradable packages...\n"); - opkg_list_upgradable_packages (package_list_upgradable_callback, NULL); - - err = opkg_upgrade_all (progress_callback, "Upgrading all..."); - printf ("\nopkg_upgrade_all returned %d\n", err); - -} - -int -main (int argc, char **argv) -{ - pkg_t *pkg; - int err; - - if (argc < 2) - { - printf ("Usage: %s command\n" - "\nCommands:\n" - "\tupdate - Update package lists\n" - "\tfind [package] - Print details of the specified package\n" - "\tinstall [package] - Install the specified package\n" - "\tupgrade [package] - Upgrade the specified package\n" - "\tlist upgrades - List the available upgrades\n" - "\tlist all - List all available packages\n" - "\tlist installed - List all the installed packages\n" - "\tremove [package] - Remove the specified package\n" - "\trping - Reposiroties ping, check the accessibility of repositories\n" - "\ttest - Run test script\n" - , basename (argv[0])); - exit (0); - } - - setenv("OFFLINE_ROOT", "/tmp", 0); - - if (opkg_new ()) { - printf("opkg_new() failed. This sucks.\n"); - print_error_list(); - return 1; - } - - char *cache; - opkg_set_option("cache", "|asdf|"); - if (opkg_get_option("cache", &cache) != -1) { - printf("cache=``%s''\n", cache); - } - - int verb; - opkg_set_option("verbosity", (void *)3); - if (opkg_get_option("verbosity", &verb) != -1) { - printf("verbosity=%d\n", verb); - } - - switch (argv[1][0]) - { - case 'f': - pkg = opkg_find_package (argv[2], NULL, NULL, NULL); - if (pkg) - { - print_package (pkg); - } - else - printf ("Package \"%s\" not found!\n", find_pkg->name); - break; - case 'i': - err = opkg_install_package (argv[2], progress_callback, "Installing..."); - printf ("\nopkg_install_package returned %d\n", err); - break; - - case 'u': - if (argv[1][2] == 'd') - { - err = opkg_update_package_lists (progress_callback, "Updating..."); - printf ("\nopkg_update_package_lists returned %d\n", err); - break; - } - else - { - if (argc < 3) - { - err = opkg_upgrade_all (progress_callback, "Upgrading all..."); - printf ("\nopkg_upgrade_all returned %d\n", err); - } - else - { - err = opkg_upgrade_package (argv[2], progress_callback, "Upgrading..."); - printf ("\nopkg_upgrade_package returned %d\n", err); - } - } - break; - - case 'l': - if (argc < 3) - { - printf ("Please specify one either all, installed or upgrades\n"); - } - else - { - switch (argv[2][0]) - { - case 'u': - printf ("Listing upgradable packages...\n"); - opkg_list_upgradable_packages (package_list_upgradable_callback, NULL); - break; - case 'a': - printf ("Listing all packages...\n"); - opkg_list_packages (package_list_callback, NULL); - printf ("\n"); - break; - case 'i': - printf ("Listing installed packages...\n"); - opkg_list_packages (package_list_installed_callback, NULL); - break; - default: - printf ("Unknown list option \"%s\"\n", argv[2]); - } - } - break; - - case 'r': - if (argv[1][1] == 'e') - { - err = opkg_remove_package (argv[2], progress_callback, "Removing..."); - printf ("\nopkg_remove_package returned %d\n", err); - break; - }else if (argv[1][1] == 'p') - { - err = opkg_repository_accessibility_check(); - printf("\nopkg_repository_accessibility_check returned (%d)\n", err); - break; - } - - default: - printf ("Unknown command \"%s\"\n", argv[1]); - } - - - opkg_free (); - - return 0; -} diff --git a/src/tests/.svn/text-base/opkg_active_list_test.c.svn-base b/src/tests/.svn/text-base/opkg_active_list_test.c.svn-base deleted file mode 100644 index b6af3b3..0000000 --- a/src/tests/.svn/text-base/opkg_active_list_test.c.svn-base +++ /dev/null @@ -1,145 +0,0 @@ -/* opkg_active_list.c - the opkg package management system - - Tick Chen <tick@openmoko.com> - - Copyright (C) 2008 Openmoko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. -*/ - - -#include <stdlib.h> -#include <libopkg/active_list.h> -#include <active_list.h> -#include <stdio.h> - -struct active_test { - char *str; - struct active_list list; -}; - -struct active_test *active_test_new(char *str) { - struct active_test *ans = (struct active_test *)calloc(1, sizeof(struct active_test)); - ans->str = str; - active_list_init(&ans->list); - return ans; -} -void active_test_add(struct active_list *head, struct active_test *node) { - active_list_add(head, &node->list); -} - -void active_test_add_depend(struct active_test *A, struct active_test *B) { - active_list_add_depend(&A->list, &B->list); -} - -/* -.--A---B----C----D-----E----F - | |__k---L - | |_ N - |__ G ---H ---I---J - |_M |_O - -Then the sequence will be -+: G M H I O J A B K N L C D E F --: F E D C L N K B A J O I H M G -*/ -void make_list(struct active_list *head) { - struct active_test *A = active_test_new("A"); - struct active_test *B = active_test_new("B"); - struct active_test *C = active_test_new("C"); - struct active_test *D = active_test_new("D"); - struct active_test *E = active_test_new("E"); - struct active_test *F = active_test_new("F"); - struct active_test *G = active_test_new("G"); - struct active_test *H = active_test_new("H"); - struct active_test *I = active_test_new("I"); - struct active_test *J = active_test_new("J"); - struct active_test *K = active_test_new("K"); - struct active_test *L = active_test_new("L"); - struct active_test *M = active_test_new("M"); - struct active_test *N = active_test_new("N"); - struct active_test *O = active_test_new("O"); - - active_test_add(head, A); - active_test_add(head, B); - active_test_add(head, C); - active_test_add(head, D); - active_test_add(head, E); - active_test_add(head, F); - active_test_add(head, G); - active_test_add(head, H); - active_test_add(head, I); - active_test_add(head, J); - active_test_add(head, K); - active_test_add(head, L); - active_test_add(head, M); - active_test_add(head, N); - active_test_add(head, O); - active_test_add_depend(H, M); - active_test_add_depend(A, G); - active_test_add_depend(A, H); - active_test_add_depend(A, I); - active_test_add_depend(A, J); - active_test_add_depend(J, O); - active_test_add_depend(C, K); - active_test_add_depend(C, L); - active_test_add_depend(L, N); -} - -int active_test_compare(const void *a, const void *b) { - struct active_list *first = (struct active_list *)a; - struct active_list *second = (struct active_list *)b; - return strcmp(list_entry(first, struct active_test, list), - list_entry(second, struct active_test, list)); -} - -void show_list(struct active_list *head) { - struct active_list *ptr; - struct active_test *test; - for(ptr = active_list_next(head, NULL); ptr ;ptr = active_list_next(head, ptr)) { - test = list_entry(ptr, struct active_test, list); - printf ("%s ",test->str); - } - printf("\n"); -} - -int main (void) { - struct active_list head; - struct active_list *ptr; - struct active_test *test; - active_list_init(&head); - make_list(&head); - - printf("pos order: "); - show_list(&head); -/* for(ptr = active_list_next(&head, &head); ptr ;ptr = active_list_next(&head, ptr)) { - test = list_entry(ptr, struct active_test, list); - printf ("%s ",test->str); - }*/ - printf("neg order: "); - for(ptr = active_list_prev(&head, &head); ptr ;ptr = active_list_prev(&head, ptr)) { - test = list_entry(ptr, struct active_test, list); - printf ("%s ",test->str); - } - printf("\npos order after sort: "); - active_list_sort(&head, &active_test_compare); - show_list(&head); - - printf("after clear: "); - active_list_clear(&head); - for(ptr = active_list_next(&head, NULL); ptr ;ptr = active_list_next(&head, ptr)) { - test = list_entry(ptr, struct active_test, list); - printf ("%s ",test->str); - } - printf("\n"); - - -} diff --git a/src/tests/.svn/text-base/opkg_extract_test.c.svn-base b/src/tests/.svn/text-base/opkg_extract_test.c.svn-base deleted file mode 100644 index 9754691..0000000 --- a/src/tests/.svn/text-base/opkg_extract_test.c.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <libbb/libbb.h> - -/* - * build thus: - - * gcc -o opkg_extract_test opkg_extract_test.c -I./busybox-0.60.2/libbb -L./busybox-0.60.2 -lbb - * - */ -const char * applet_name; - -int main(int argc, char * argv[]) -{ - /* - * see libbb.h and let your imagination run wild - * or, set the last item below to extract_one_to_buffer, and you get the control file in - * "returned" - * or, set the last one to extract_all_to_fs, and, well, guess what happens - */ - - /* enum extract_functions_e dowhat = extract_control_tar_gz | extract_unconditional | extract_one_to_buffer; */ - enum extract_functions_e dowhat = extract_control_tar_gz | extract_all_to_fs | extract_preserve_date; - char * returned; - char * filename; - - if(argc < 2){ - fprintf(stderr, "syntax: %s <opkg file> [<file_to_extract>]\n", argv[0]); - exit(0); - } - - if (argc < 3){ - filename=NULL; - } else { - filename = argv[2]; - } - - returned = deb_extract(argv[1], stdout, dowhat, NULL, filename); - - if(returned) - fprintf(stderr, "returned %s\n", returned); - else - fprintf(stderr, "extract returned nuthin'\n"); - - return 0; -} diff --git a/src/tests/.svn/text-base/opkg_hash_test.c.svn-base b/src/tests/.svn/text-base/opkg_hash_test.c.svn-base deleted file mode 100644 index de1d82c..0000000 --- a/src/tests/.svn/text-base/opkg_hash_test.c.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -/* opkg_hash_test.c - the itsy package management system - - Carl D. Worth - - Copyright (C) 2001 University of Southern California - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. -*/ - -#include <libopkg/opkg.h> - -#include <libopkg/hash_table.h> -#include <libopkg/opkg_utils.h> -#include <libopkg/pkg_hash.h> - -int main(int argc, char *argv[]) -{ - opkg_conf_t conf; - hash_table_t *hash = &conf.pkg_hash; - pkg_vec_t * pkg_vec; - - if (argc < 3) { - fprintf(stderr, "Usage: %s <pkgs_file1> <pkgs_file2> [pkg_name...]\n", argv[0]); - exit(1); - } - pkg_hash_init("test", hash, 1024); - - pkg_hash_add_from_file(&conf, argv[1], NULL, NULL, 0); - pkg_hash_add_from_file(&conf, argv[2], NULL, NULL, 0); - - if (argc < 4) { - pkg_print_info( pkg_hash_fetch_by_name_version(hash, "libc6", "2.2.3-2"), stdout); - /* for(i = 0; i < pkg_vec->len; i++) - pkg_print(pkg_vec->pkgs[i], stdout); - */ - } else { - int i, j, k; - char **unresolved; - - pkg_vec_t * dep_vec; - for (i = 3; i < argc; i++) { - pkg_vec = pkg_vec_fetch_by_name(hash, argv[i]); - if (pkg_vec == NULL) { - fprintf(stderr, "*** WARNING: Unknown package: %s\n\n", argv[i]); - continue; - } - - for(j = 0; j < pkg_vec->len; j++){ - pkg_print_info(pkg_vec->pkgs[j], stdout); - dep_vec = pkg_vec_alloc(); - pkg_hash_fetch_unsatisfied_dependencies(&conf, - pkg_vec->pkgs[j], - dep_vec, - &unresolved); - if(dep_vec){ - fprintf(stderr, "and the unsatisfied dependencies are:\n"); - for(k = 0; k < dep_vec->len; k++){ - fprintf(stderr, "%s version %s\n", dep_vec->pkgs[k]->name, dep_vec->pkgs[k]->version); - } - } - - fputs("", stdout); - - } - } - } - - pkg_hash_deinit(hash); - - return 0; -} diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am deleted file mode 100644 index 1a6f565..0000000 --- a/src/tests/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -AM_CFLAGS = $(ALL_CFLAGS) -Wall -g -O3 -I${top_srcdir}/libopkg - -#noinst_PROGRAMS = opkg_hash_test opkg_extract_test -#noinst_PROGRAMS = libopkg_test opkg_active_list_test -noinst_PROGRAMS = libopkg_test - -#opkg_hash_test_LDADD = $(top_builddir)/libbb/libbb.la $(top_builddir)/libopkg/libopkg.la -#opkg_hash_test_SOURCES = opkg_hash_test.c -#opkg_hash_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir) - -#opkg_extract_test_LDADD = $(top_builddir)/libbb/libbb.la $(top_builddir)/libopkg/libopkg.la -#opkg_extract_test_SOURCES = opkg_extract_test.c -#opkg_extract_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir) - -#opkg_active_list_test_LDADD = $(top_builddir)/libopkg/active_list.o -#opkg_active_list_test_SOURCES = opkg_active_list_test.c -#opkg_active_list_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir) - -libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.la -libopkg_test_SOURCE = libopkg_test.c -libopkg_test_LDFLAGS = -static - - diff --git a/src/tests/libopkg_test.c b/src/tests/libopkg_test.c deleted file mode 100644 index 21f100e..0000000 --- a/src/tests/libopkg_test.c +++ /dev/null @@ -1,261 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <libgen.h> - -#include <opkg.h> - -int opkg_state_changed; -pkg_t *find_pkg = NULL; - - -#define TEST_PACKAGE "aspell" - -void -progress_callback (const opkg_progress_data_t *progress, void *data) -{ - printf ("\r%s %3d%%\n", (char*) data, progress->percentage); - fflush (stdout); -} - -static void list_pkg(pkg_t *pkg) -{ - char *v = pkg_version_str_alloc(pkg); - printf ("%s - %s\n", pkg->name, v); - free(v); -} - -void -package_list_installed_callback (pkg_t *pkg, void *data) -{ - if (pkg->state_status == SS_INSTALLED) - list_pkg(pkg); -} - -void -package_list_callback (pkg_t *pkg, void *data) -{ - static int install_count = 0; - static int total_count = 0; - - if (pkg->state_status == SS_INSTALLED) - install_count++; - - total_count++; - - printf ("\rPackage count: %d Installed, %d Total Available", install_count, total_count); - fflush (stdout); - - if (!find_pkg) - { - /* store the first package to print out later */ - find_pkg = pkg; - } -} - -void -package_list_upgradable_callback (pkg_t *pkg, void *data) -{ - list_pkg(pkg); -} - -void -print_package (pkg_t *pkg) -{ - char *v = pkg_version_str_alloc(pkg); - printf ( - "Name: %s\n" - "Version: %s\n" - "Repository: %s\n" - "Architecture: %s\n" - "Description: %s\n" - "Tags: %s\n" - "Size: %ld\n" - "Status: %d\n", - pkg->name, - v, - pkg->src->name, - pkg->architecture, - pkg->description, - pkg->tags? pkg->tags : "", - pkg->size, - pkg->state_status); - free(v); -} - - -void -opkg_test (void) -{ - int err; - pkg_t *pkg; - - err = opkg_update_package_lists (progress_callback, "Updating..."); - printf ("\nopkg_update_package_lists returned %d\n", err); - - opkg_list_packages (package_list_callback, NULL); - printf ("\n"); - - if (find_pkg) - { - printf ("Finding package \"%s\"\n", find_pkg->name); - pkg = opkg_find_package (find_pkg->name, find_pkg->version, find_pkg->architecture, find_pkg->src->name); - if (pkg) - { - print_package (pkg); - } - else - printf ("Package \"%s\" not found!\n", find_pkg->name); - } - else - printf ("No package available to test find_package.\n"); - - err = opkg_install_package (TEST_PACKAGE, progress_callback, "Installing..."); - printf ("\nopkg_install_package returned %d\n", err); - - err = opkg_upgrade_package (TEST_PACKAGE, progress_callback, "Upgrading..."); - printf ("\nopkg_upgrade_package returned %d\n", err); - - err = opkg_remove_package (TEST_PACKAGE, progress_callback, "Removing..."); - printf ("\nopkg_remove_package returned %d\n", err); - - printf ("Listing upgradable packages...\n"); - opkg_list_upgradable_packages (package_list_upgradable_callback, NULL); - - err = opkg_upgrade_all (progress_callback, "Upgrading all..."); - printf ("\nopkg_upgrade_all returned %d\n", err); - -} - -int -main (int argc, char **argv) -{ - pkg_t *pkg; - int err; - - if (argc < 2) - { - printf ("Usage: %s command\n" - "\nCommands:\n" - "\tupdate - Update package lists\n" - "\tfind [package] - Print details of the specified package\n" - "\tinstall [package] - Install the specified package\n" - "\tupgrade [package] - Upgrade the specified package\n" - "\tlist upgrades - List the available upgrades\n" - "\tlist all - List all available packages\n" - "\tlist installed - List all the installed packages\n" - "\tremove [package] - Remove the specified package\n" - "\trping - Reposiroties ping, check the accessibility of repositories\n" - "\ttest - Run test script\n" - , basename (argv[0])); - exit (0); - } - - setenv("OFFLINE_ROOT", "/tmp", 0); - - if (opkg_new ()) { - printf("opkg_new() failed. This sucks.\n"); - print_error_list(); - return 1; - } - - char *cache; - opkg_set_option("cache", "|asdf|"); - if (opkg_get_option("cache", &cache) != -1) { - printf("cache=``%s''\n", cache); - } - - int verb; - opkg_set_option("verbosity", (void *)3); - if (opkg_get_option("verbosity", &verb) != -1) { - printf("verbosity=%d\n", verb); - } - - switch (argv[1][0]) - { - case 'f': - pkg = opkg_find_package (argv[2], NULL, NULL, NULL); - if (pkg) - { - print_package (pkg); - } - else - printf ("Package \"%s\" not found!\n", find_pkg->name); - break; - case 'i': - err = opkg_install_package (argv[2], progress_callback, "Installing..."); - printf ("\nopkg_install_package returned %d\n", err); - break; - - case 'u': - if (argv[1][2] == 'd') - { - err = opkg_update_package_lists (progress_callback, "Updating..."); - printf ("\nopkg_update_package_lists returned %d\n", err); - break; - } - else - { - if (argc < 3) - { - err = opkg_upgrade_all (progress_callback, "Upgrading all..."); - printf ("\nopkg_upgrade_all returned %d\n", err); - } - else - { - err = opkg_upgrade_package (argv[2], progress_callback, "Upgrading..."); - printf ("\nopkg_upgrade_package returned %d\n", err); - } - } - break; - - case 'l': - if (argc < 3) - { - printf ("Please specify one either all, installed or upgrades\n"); - } - else - { - switch (argv[2][0]) - { - case 'u': - printf ("Listing upgradable packages...\n"); - opkg_list_upgradable_packages (package_list_upgradable_callback, NULL); - break; - case 'a': - printf ("Listing all packages...\n"); - opkg_list_packages (package_list_callback, NULL); - printf ("\n"); - break; - case 'i': - printf ("Listing installed packages...\n"); - opkg_list_packages (package_list_installed_callback, NULL); - break; - default: - printf ("Unknown list option \"%s\"\n", argv[2]); - } - } - break; - - case 'r': - if (argv[1][1] == 'e') - { - err = opkg_remove_package (argv[2], progress_callback, "Removing..."); - printf ("\nopkg_remove_package returned %d\n", err); - break; - }else if (argv[1][1] == 'p') - { - err = opkg_repository_accessibility_check(); - printf("\nopkg_repository_accessibility_check returned (%d)\n", err); - break; - } - - default: - printf ("Unknown command \"%s\"\n", argv[1]); - } - - - opkg_free (); - - return 0; -} diff --git a/src/tests/opkg_active_list_test.c b/src/tests/opkg_active_list_test.c deleted file mode 100644 index b6af3b3..0000000 --- a/src/tests/opkg_active_list_test.c +++ /dev/null @@ -1,145 +0,0 @@ -/* opkg_active_list.c - the opkg package management system - - Tick Chen <tick@openmoko.com> - - Copyright (C) 2008 Openmoko - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. -*/ - - -#include <stdlib.h> -#include <libopkg/active_list.h> -#include <active_list.h> -#include <stdio.h> - -struct active_test { - char *str; - struct active_list list; -}; - -struct active_test *active_test_new(char *str) { - struct active_test *ans = (struct active_test *)calloc(1, sizeof(struct active_test)); - ans->str = str; - active_list_init(&ans->list); - return ans; -} -void active_test_add(struct active_list *head, struct active_test *node) { - active_list_add(head, &node->list); -} - -void active_test_add_depend(struct active_test *A, struct active_test *B) { - active_list_add_depend(&A->list, &B->list); -} - -/* -.--A---B----C----D-----E----F - | |__k---L - | |_ N - |__ G ---H ---I---J - |_M |_O - -Then the sequence will be -+: G M H I O J A B K N L C D E F --: F E D C L N K B A J O I H M G -*/ -void make_list(struct active_list *head) { - struct active_test *A = active_test_new("A"); - struct active_test *B = active_test_new("B"); - struct active_test *C = active_test_new("C"); - struct active_test *D = active_test_new("D"); - struct active_test *E = active_test_new("E"); - struct active_test *F = active_test_new("F"); - struct active_test *G = active_test_new("G"); - struct active_test *H = active_test_new("H"); - struct active_test *I = active_test_new("I"); - struct active_test *J = active_test_new("J"); - struct active_test *K = active_test_new("K"); - struct active_test *L = active_test_new("L"); - struct active_test *M = active_test_new("M"); - struct active_test *N = active_test_new("N"); - struct active_test *O = active_test_new("O"); - - active_test_add(head, A); - active_test_add(head, B); - active_test_add(head, C); - active_test_add(head, D); - active_test_add(head, E); - active_test_add(head, F); - active_test_add(head, G); - active_test_add(head, H); - active_test_add(head, I); - active_test_add(head, J); - active_test_add(head, K); - active_test_add(head, L); - active_test_add(head, M); - active_test_add(head, N); - active_test_add(head, O); - active_test_add_depend(H, M); - active_test_add_depend(A, G); - active_test_add_depend(A, H); - active_test_add_depend(A, I); - active_test_add_depend(A, J); - active_test_add_depend(J, O); - active_test_add_depend(C, K); - active_test_add_depend(C, L); - active_test_add_depend(L, N); -} - -int active_test_compare(const void *a, const void *b) { - struct active_list *first = (struct active_list *)a; - struct active_list *second = (struct active_list *)b; - return strcmp(list_entry(first, struct active_test, list), - list_entry(second, struct active_test, list)); -} - -void show_list(struct active_list *head) { - struct active_list *ptr; - struct active_test *test; - for(ptr = active_list_next(head, NULL); ptr ;ptr = active_list_next(head, ptr)) { - test = list_entry(ptr, struct active_test, list); - printf ("%s ",test->str); - } - printf("\n"); -} - -int main (void) { - struct active_list head; - struct active_list *ptr; - struct active_test *test; - active_list_init(&head); - make_list(&head); - - printf("pos order: "); - show_list(&head); -/* for(ptr = active_list_next(&head, &head); ptr ;ptr = active_list_next(&head, ptr)) { - test = list_entry(ptr, struct active_test, list); - printf ("%s ",test->str); - }*/ - printf("neg order: "); - for(ptr = active_list_prev(&head, &head); ptr ;ptr = active_list_prev(&head, ptr)) { - test = list_entry(ptr, struct active_test, list); - printf ("%s ",test->str); - } - printf("\npos order after sort: "); - active_list_sort(&head, &active_test_compare); - show_list(&head); - - printf("after clear: "); - active_list_clear(&head); - for(ptr = active_list_next(&head, NULL); ptr ;ptr = active_list_next(&head, ptr)) { - test = list_entry(ptr, struct active_test, list); - printf ("%s ",test->str); - } - printf("\n"); - - -} diff --git a/src/tests/opkg_extract_test.c b/src/tests/opkg_extract_test.c deleted file mode 100644 index 9754691..0000000 --- a/src/tests/opkg_extract_test.c +++ /dev/null @@ -1,46 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <libbb/libbb.h> - -/* - * build thus: - - * gcc -o opkg_extract_test opkg_extract_test.c -I./busybox-0.60.2/libbb -L./busybox-0.60.2 -lbb - * - */ -const char * applet_name; - -int main(int argc, char * argv[]) -{ - /* - * see libbb.h and let your imagination run wild - * or, set the last item below to extract_one_to_buffer, and you get the control file in - * "returned" - * or, set the last one to extract_all_to_fs, and, well, guess what happens - */ - - /* enum extract_functions_e dowhat = extract_control_tar_gz | extract_unconditional | extract_one_to_buffer; */ - enum extract_functions_e dowhat = extract_control_tar_gz | extract_all_to_fs | extract_preserve_date; - char * returned; - char * filename; - - if(argc < 2){ - fprintf(stderr, "syntax: %s <opkg file> [<file_to_extract>]\n", argv[0]); - exit(0); - } - - if (argc < 3){ - filename=NULL; - } else { - filename = argv[2]; - } - - returned = deb_extract(argv[1], stdout, dowhat, NULL, filename); - - if(returned) - fprintf(stderr, "returned %s\n", returned); - else - fprintf(stderr, "extract returned nuthin'\n"); - - return 0; -} diff --git a/src/tests/opkg_hash_test.c b/src/tests/opkg_hash_test.c deleted file mode 100644 index de1d82c..0000000 --- a/src/tests/opkg_hash_test.c +++ /dev/null @@ -1,79 +0,0 @@ -/* opkg_hash_test.c - the itsy package management system - - Carl D. Worth - - Copyright (C) 2001 University of Southern California - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. -*/ - -#include <libopkg/opkg.h> - -#include <libopkg/hash_table.h> -#include <libopkg/opkg_utils.h> -#include <libopkg/pkg_hash.h> - -int main(int argc, char *argv[]) -{ - opkg_conf_t conf; - hash_table_t *hash = &conf.pkg_hash; - pkg_vec_t * pkg_vec; - - if (argc < 3) { - fprintf(stderr, "Usage: %s <pkgs_file1> <pkgs_file2> [pkg_name...]\n", argv[0]); - exit(1); - } - pkg_hash_init("test", hash, 1024); - - pkg_hash_add_from_file(&conf, argv[1], NULL, NULL, 0); - pkg_hash_add_from_file(&conf, argv[2], NULL, NULL, 0); - - if (argc < 4) { - pkg_print_info( pkg_hash_fetch_by_name_version(hash, "libc6", "2.2.3-2"), stdout); - /* for(i = 0; i < pkg_vec->len; i++) - pkg_print(pkg_vec->pkgs[i], stdout); - */ - } else { - int i, j, k; - char **unresolved; - - pkg_vec_t * dep_vec; - for (i = 3; i < argc; i++) { - pkg_vec = pkg_vec_fetch_by_name(hash, argv[i]); - if (pkg_vec == NULL) { - fprintf(stderr, "*** WARNING: Unknown package: %s\n\n", argv[i]); - continue; - } - - for(j = 0; j < pkg_vec->len; j++){ - pkg_print_info(pkg_vec->pkgs[j], stdout); - dep_vec = pkg_vec_alloc(); - pkg_hash_fetch_unsatisfied_dependencies(&conf, - pkg_vec->pkgs[j], - dep_vec, - &unresolved); - if(dep_vec){ - fprintf(stderr, "and the unsatisfied dependencies are:\n"); - for(k = 0; k < dep_vec->len; k++){ - fprintf(stderr, "%s version %s\n", dep_vec->pkgs[k]->name, dep_vec->pkgs[k]->version); - } - } - - fputs("", stdout); - - } - } - } - - pkg_hash_deinit(hash); - - return 0; -} diff --git a/src/tests/regress/.svn/all-wcprops b/src/tests/regress/.svn/all-wcprops deleted file mode 100644 index d83bc2c..0000000 --- a/src/tests/regress/.svn/all-wcprops +++ /dev/null @@ -1,113 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 37 -/svn/!svn/ver/634/trunk/tests/regress -END -opk.py -K 25 -svn:wc:ra_dav:version-url -V 44 -/svn/!svn/ver/634/trunk/tests/regress/opk.py -END -issue31.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue31.py -END -issue50.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue50.py -END -issue51.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue51.py -END -cfg.py -K 25 -svn:wc:ra_dav:version-url -V 44 -/svn/!svn/ver/625/trunk/tests/regress/cfg.py -END -issue26.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue26.py -END -issue72.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue72.py -END -issue45.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue45.py -END -issue55.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue55.py -END -issue46.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue46.py -END -issue84.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/633/trunk/tests/regress/issue84.py -END -issue85.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/633/trunk/tests/regress/issue85.py -END -issue58.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue58.py -END -update_loses_autoinstalled_flag.py -K 25 -svn:wc:ra_dav:version-url -V 72 -/svn/!svn/ver/634/trunk/tests/regress/update_loses_autoinstalled_flag.py -END -issue79.py -K 25 -svn:wc:ra_dav:version-url -V 48 -/svn/!svn/ver/632/trunk/tests/regress/issue79.py -END -opkgcl.py -K 25 -svn:wc:ra_dav:version-url -V 47 -/svn/!svn/ver/634/trunk/tests/regress/opkgcl.py -END -filehash.py -K 25 -svn:wc:ra_dav:version-url -V 49 -/svn/!svn/ver/607/trunk/tests/regress/filehash.py -END -Makefile -K 25 -svn:wc:ra_dav:version-url -V 46 -/svn/!svn/ver/634/trunk/tests/regress/Makefile -END diff --git a/src/tests/regress/.svn/entries b/src/tests/regress/.svn/entries deleted file mode 100644 index 511df3a..0000000 --- a/src/tests/regress/.svn/entries +++ /dev/null @@ -1,640 +0,0 @@ -10 - -dir -635 -http://opkg.googlecode.com/svn/trunk/tests/regress -http://opkg.googlecode.com/svn - - - -2012-01-19T13:51:59.790020Z -634 -pixdamix@gmail.com - - - - - - - - - - - - - - -e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 - -opk.py -file - - - - -2012-02-03T08:11:57.351042Z -5042d77e53c77cee8b411296d50f963f -2012-01-19T13:51:59.790020Z -634 -pixdamix@gmail.com - - - - - - - - - - - - - - - - - - - - - -2877 - -issue31.py -file - - - - -2012-02-03T08:11:57.351042Z -5d1ac3bfa7788b1cf80301c1a3a92d04 -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -508 - -issue50.py -file - - - - -2012-02-03T08:11:57.355042Z -21fe4bed9f068d6c70d64e85a710d2e4 -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -886 - -issue51.py -file - - - - -2012-02-03T08:11:57.355042Z -825ba593541ddfbdb22dafb0264d35c4 -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -1519 - -cfg.py -file - - - - -2012-02-03T08:11:57.355042Z -ef3d9028e718a965848082841b791e59 -2011-07-13T11:53:28.244081Z -625 -pixdamix@gmail.com - - - - - - - - - - - - - - - - - - - - - -105 - -issue26.py -file - - - - -2012-02-03T08:11:57.355042Z -7eac6e442e578cf77ef822d00eddd20d -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -769 - -issue72.py -file - - - - -2012-02-03T08:11:57.355042Z -18838b761e8fd311f2a1d0d4b15c843d -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -1495 - -issue45.py -file - - - - -2012-02-03T08:11:57.355042Z -c2a7947d78fad363733248d288d7e88d -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -649 - -issue55.py -file - - - - -2012-02-03T08:11:57.355042Z -efceef4be0907165367b198c6450ea8b -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -530 - -issue46.py -file - - - - -2012-02-03T08:11:57.355042Z -ebe87bdc7e69abcc75efa60b5d633311 -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -906 - -issue84.py -file - - - - -2012-02-03T08:11:57.355042Z -4c43bb8c7aa602242eca9a82690d5f19 -2011-10-27T04:53:01.363575Z -633 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -882 - -issue85.py -file - - - - -2012-02-03T08:11:57.355042Z -b2c52019fae7259e1b544b9e483cc05d -2011-10-27T04:53:01.363575Z -633 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -502 - -issue58.py -file - - - - -2012-02-03T08:11:57.355042Z -4e7dab61a69f31a519f5d343d1e612c0 -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -588 - -update_loses_autoinstalled_flag.py -file - - - - -2012-02-03T08:11:57.355042Z -3f8e7328cd8cdb9b6edaac81c0c190fe -2012-01-19T13:51:59.790020Z -634 -pixdamix@gmail.com - - - - - - - - - - - - - - - - - - - - - -1101 - -issue79.py -file - - - - -2012-02-03T08:11:57.355042Z -af632f0199342dc3c0362631aafe884d -2011-10-23T23:42:50.670289Z -632 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -663 - -opkgcl.py -file - - - - -2012-02-03T08:11:57.355042Z -624d2252b119c9b07de516629e6d546b -2012-01-19T13:51:59.790020Z -634 -pixdamix@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -1762 - -filehash.py -file - - - - -2012-02-03T08:11:57.355042Z -09c39129cb0ccb6491bcaa104124a25d -2011-02-21T04:45:33.007731Z -607 -graham.gower@gmail.com -has-props - - - - - - - - - - - - - - - - - - - - -886 - -Makefile -file - - - - -2012-02-03T08:11:57.355042Z -9a157e2971d52870d9bb49c61ad74603 -2012-01-19T13:51:59.790020Z -634 -pixdamix@gmail.com - - - - - - - - - - - - - - - - - - - - - -356 - diff --git a/src/tests/regress/.svn/prop-base/filehash.py.svn-base b/src/tests/regress/.svn/prop-base/filehash.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/filehash.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue26.py.svn-base b/src/tests/regress/.svn/prop-base/issue26.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue26.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue31.py.svn-base b/src/tests/regress/.svn/prop-base/issue31.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue31.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue45.py.svn-base b/src/tests/regress/.svn/prop-base/issue45.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue45.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue46.py.svn-base b/src/tests/regress/.svn/prop-base/issue46.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue46.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue50.py.svn-base b/src/tests/regress/.svn/prop-base/issue50.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue50.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue51.py.svn-base b/src/tests/regress/.svn/prop-base/issue51.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue51.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue55.py.svn-base b/src/tests/regress/.svn/prop-base/issue55.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue55.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue58.py.svn-base b/src/tests/regress/.svn/prop-base/issue58.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue58.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue72.py.svn-base b/src/tests/regress/.svn/prop-base/issue72.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue72.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue79.py.svn-base b/src/tests/regress/.svn/prop-base/issue79.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue79.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue84.py.svn-base b/src/tests/regress/.svn/prop-base/issue84.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue84.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/issue85.py.svn-base b/src/tests/regress/.svn/prop-base/issue85.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/issue85.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/prop-base/opkgcl.py.svn-base b/src/tests/regress/.svn/prop-base/opkgcl.py.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/src/tests/regress/.svn/prop-base/opkgcl.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/src/tests/regress/.svn/text-base/Makefile.svn-base b/src/tests/regress/.svn/text-base/Makefile.svn-base deleted file mode 100644 index 0accb31..0000000 --- a/src/tests/regress/.svn/text-base/Makefile.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -PYTHON=/usr/bin/python3 -REGRESSION_TESTS=issue26.py issue31.py issue45.py issue46.py \ - issue50.py issue51.py issue55.py issue58.py \ - issue72.py issue79.py issue84.py issue85.py \ - filehash.py \ - update_loses_autoinstalled_flag.py - -regress: - @for test in $(REGRESSION_TESTS); do \ - echo $$test; \ - $(PYTHON) $$test; \ - done - -clean: - rm -f *.pyc diff --git a/src/tests/regress/.svn/text-base/cfg.py.svn-base b/src/tests/regress/.svn/text-base/cfg.py.svn-base deleted file mode 100644 index 6f78996..0000000 --- a/src/tests/regress/.svn/text-base/cfg.py.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -import os - -opkdir = "/tmp/opk" -offline_root = "/tmp/opkg" -opkgcl = os.path.realpath("../../src/opkg-cl") diff --git a/src/tests/regress/.svn/text-base/filehash.py.svn-base b/src/tests/regress/.svn/text-base/filehash.py.svn-base deleted file mode 100644 index e6cbe62..0000000 --- a/src/tests/regress/.svn/text-base/filehash.py.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -open("asdf", "w").close() -a = opk.Opk(Package="a", Version="1.0", Architecture="all") -a.write(data_files=["asdf"]) -b = opk.Opk(Package="b", Version="1.0", Architecture="all") -b.write(data_files=["asdf"]) -os.unlink("asdf") -opkgcl.install("a_1.0_all.opk") - -if not opkgcl.is_installed("a"): - print(__file__, ": Package 'a' not installed.") - exit(False) - -if not os.path.exists("{}/asdf".format(cfg.offline_root)): - print(__file__, ": asdf not created.") - exit(False) - -opkgcl.install("b_1.0_all.opk", "--force-overwrite") - -if "{}/asdf".format(cfg.offline_root) not in opkgcl.files("b"): - print(__file__, ": asdf not claimed by ``b''.") - exit(False) - -if "{}/asdf".format(cfg.offline_root) in opkgcl.files("a"): - print(__file__, ": asdf is still claimed by ``a''.") - exit(False) - -opkgcl.remove("b") -opkgcl.remove("a") diff --git a/src/tests/regress/.svn/text-base/issue26.py.svn-base b/src/tests/regress/.svn/text-base/issue26.py.svn-base deleted file mode 100644 index dd4ef92..0000000 --- a/src/tests/regress/.svn/text-base/issue26.py.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Version="2.0") -o.write_opk() -o.write_list() - -# older version, not in Packages list -a1 = opk.Opk(Package="a", Version="1.0") -a1.write() - -opkgcl.update() - -# install v2 from repository -opkgcl.install("a") -if not opkgcl.is_installed("a", "2.0"): - print(__file__, ": Package 'a_2.0' not installed.") - exit(False) - -opkgcl.install("a_1.0_all.opk", "--force-downgrade") -if not opkgcl.is_installed("a", "1.0"): - print(__file__, ": Package 'a_1.0' not installed (1).") - exit(False) - -opkgcl.install("a_1.0_all.opk", "--force-downgrade") -if not opkgcl.is_installed("a", "1.0"): - print(__file__, ": Package 'a_1.0' not installed (2).") - exit(False) - -opkgcl.remove("a") diff --git a/src/tests/regress/.svn/text-base/issue31.py.svn-base b/src/tests/regress/.svn/text-base/issue31.py.svn-base deleted file mode 100644 index 42e51e3..0000000 --- a/src/tests/regress/.svn/text-base/issue31.py.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Depends="b") -o.add(Package="b", Depends="c") -o.write_opk() -o.write_list() - -opkgcl.update() - -opkgcl.install("a") -if opkgcl.is_installed("a"): - print(__file__, ": Package 'a' installed, despite dependency " - "upon a package with an unresolved dependency.") - exit(False) - -if opkgcl.is_installed("b"): - print(__file__, ": Package 'b' installed, " - "despite unresolved dependency.") - exit(False) diff --git a/src/tests/regress/.svn/text-base/issue45.py.svn-base b/src/tests/regress/.svn/text-base/issue45.py.svn-base deleted file mode 100644 index 30735f9..0000000 --- a/src/tests/regress/.svn/text-base/issue45.py.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Depends="b") -o.add(Package="b") -o.write_opk() -o.write_list() - -opkgcl.update() - -(status, output) = opkgcl.opkgcl("install --force-postinstall a") -ln_a = output.find("Configuring a") -ln_b = output.find("Configuring b") - -if ln_a == -1: - print(__file__, ": Didn't see package 'a' get configured.") - exit(False) - -if ln_b == -1: - print(__file__, ": Didn't see package 'b' get configured.") - exit(False) - -if ln_a < ln_b: - print(__file__, ": Packages 'a' and 'b' configured in wrong order.") - exit(False) - -opkgcl.remove("a") -opkgcl.remove("b") diff --git a/src/tests/regress/.svn/text-base/issue46.py.svn-base b/src/tests/regress/.svn/text-base/issue46.py.svn-base deleted file mode 100644 index ec56941..0000000 --- a/src/tests/regress/.svn/text-base/issue46.py.svn-base +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Recommends="b") -o.add(Package="b", Version="2.0") -o.write_opk() -o.write_list() - -# prime the status file so 'b' is not installed as a recommendation -status_filename = "{}/usr/lib/opkg/status".format(cfg.offline_root) -f = open(status_filename, "w") -f.write("Package: b\n") -f.write("Version: 1.0\n") -f.write("Architecture: all\n") -f.write("Status: deinstall hold not-installed\n") -f.close() - -opkgcl.update() - -opkgcl.install("a") -if opkgcl.is_installed("b"): - print(__file__, ": Package 'b' installed despite " - "deinstall/hold status.") - exit(False) - -opkgcl.remove("a") -opkgcl.install("a") -if opkgcl.is_installed("b"): - print(__file__, ": Package 'b' installed - deinstall/hold status " - "not retained.") - exit(False) - -opkgcl.remove("a") -open(status_filename, "w").close() diff --git a/src/tests/regress/.svn/text-base/issue50.py.svn-base b/src/tests/regress/.svn/text-base/issue50.py.svn-base deleted file mode 100644 index 19897b4..0000000 --- a/src/tests/regress/.svn/text-base/issue50.py.svn-base +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -open("foo", "w").close() -a1 = opk.Opk(Package="a", Version="1.0") -a1.write(data_files=["foo"]) - -opkgcl.install("a_1.0_all.opk") - -o = opk.OpkGroup() -a2 = opk.Opk(Package="a", Version="2.0", Depends="b") -a2.write() -b1 = opk.Opk(Package="b", Version="1.0") -b1.write(data_files=["foo"]) -o.opk_list.append(a2) -o.opk_list.append(b1) -o.write_list() - -os.unlink("foo") - -opkgcl.update() -opkgcl.upgrade() - -if not opkgcl.is_installed("a", "2.0"): - print(__file__, ": Package 'a_2.0' not installed.") - exit(False) - -foo_fullpath = "{}/foo".format(cfg.offline_root) - -if not os.path.exists(foo_fullpath): - print(__file__, ": File 'foo' incorrectly orphaned.") - exit(False) - -if not foo_fullpath in opkgcl.files("b"): - print(__file__, ": Package 'b' does not own file 'foo'.") - exit(False) - -opkgcl.remove("a") -opkgcl.remove("b") diff --git a/src/tests/regress/.svn/text-base/issue51.py.svn-base b/src/tests/regress/.svn/text-base/issue51.py.svn-base deleted file mode 100644 index 9849dbc..0000000 --- a/src/tests/regress/.svn/text-base/issue51.py.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -open("foo", "w").close() -a1 = opk.Opk(Package="a") -a1.write(data_files=["foo"]) -os.rename("a_1.0_all.opk", "a_with_foo.opk") - -opkgcl.install("a_with_foo.opk") - -# ---- -opkgcl.install("a_with_foo.opk") - -open("bar", "w").close() -o = opk.OpkGroup() -a2 = opk.Opk(Package="a") -a2.write(data_files=["foo", "bar"]) -o.opk_list.append(a2) -o.write_list() - -os.unlink("foo") -os.unlink("bar") - -opkgcl.update() -opkgcl.install("a", "--force-reinstall") - -foo_fullpath = "{}/foo".format(cfg.offline_root) -bar_fullpath = "{}/bar".format(cfg.offline_root) - -if not os.path.exists(foo_fullpath) or not os.path.exists(bar_fullpath): - print(__file__, ": Files foo and/or bar are missing.") - exit(False) - -a_files = opkgcl.files("a") -if not foo_fullpath in a_files or not bar_fullpath in a_files: - print(__file__, ": Package 'a' does not own foo and/or bar.") - exit(False) - -opkgcl.remove("a") - -if os.path.exists(foo_fullpath) or os.path.exists(bar_fullpath): - print(__file__, ": Files foo and/or bar still exist " - "after removal of package 'a'.") - exit(False) - -# ---- -o = opk.OpkGroup() -a2 = opk.Opk(Package="a") -a2.write() -o.opk_list.append(a2) -o.write_list() - - -opkgcl.update() - -opkgcl.install("a", "--force-reinstall") - -if os.path.exists(foo_fullpath): - print(__file__, ": File 'foo' not orphaned as it should be.") - exit(False) - -if foo_fullpath in opkgcl.files("a"): - print(__file__, ": Package 'a' incorrectly owns file 'foo'.") - exit(False) - -opkgcl.remove("a") diff --git a/src/tests/regress/.svn/text-base/issue55.py.svn-base b/src/tests/regress/.svn/text-base/issue55.py.svn-base deleted file mode 100644 index 8628306..0000000 --- a/src/tests/regress/.svn/text-base/issue55.py.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -long_filename = 110*"a" - -os.symlink(long_filename, "linky") -a = opk.Opk(Package="a") -a.write(data_files=["linky"]) -os.unlink("linky") -opkgcl.install("a_1.0_all.opk") - -if not opkgcl.is_installed("a"): - print(__file__, ": Package 'a' not installed.") - exit(False) - -if not os.path.lexists("{}/linky".format(cfg.offline_root)): - print(__file__, ": symlink to file with a name longer than 100 " - "characters not created.") - exit(False) - -opkgcl.remove("a") diff --git a/src/tests/regress/.svn/text-base/issue58.py.svn-base b/src/tests/regress/.svn/text-base/issue58.py.svn-base deleted file mode 100644 index 72a1854..0000000 --- a/src/tests/regress/.svn/text-base/issue58.py.svn-base +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Recommends="b") -o.add(Package="b") -o.add(Package="c", Recommends="b") -o.write_opk() -o.write_list() - -opkgcl.update() - -opkgcl.install("a") -opkgcl.install("c") - -opkgcl.remove("a", "--autoremove") -if not opkgcl.is_installed("b"): - print(__file__, ": Pacakge 'b' orphaned despite remaining " - "recommending package 'c'.") - exit(False) - -opkgcl.remove("c", "--autoremove") -if opkgcl.is_installed("b"): - print(__file__, ": Recommended package 'b' not autoremoved.") - exit(False) - - diff --git a/src/tests/regress/.svn/text-base/issue72.py.svn-base b/src/tests/regress/.svn/text-base/issue72.py.svn-base deleted file mode 100644 index d0c511b..0000000 --- a/src/tests/regress/.svn/text-base/issue72.py.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -long_dir = 110*"a" -long_b = 110*"b" -long_filename = long_dir + "/"+ long_b -long_filename2 = long_dir + "/" + 110*"c" - -os.mkdir(long_dir) -open(long_filename, "w").close() -os.symlink(long_b, long_filename2) -a = opk.Opk(Package="a") -a.write(data_files=[long_dir, long_filename, long_filename2]) -os.unlink(long_filename) -os.unlink(long_filename2) -os.rmdir(long_dir) -opkgcl.install("a_1.0_all.opk") - -if not opkgcl.is_installed("a"): - print(__file__, ": Package 'a' not installed.") - exit(False) - -if not os.path.exists("{}/{}".format(cfg.offline_root, long_dir)): - print(__file__, ": dir with name longer than 100 " - "characters not created.") - exit(False) - -if not os.path.exists("{}/{}".format(cfg.offline_root, long_filename)): - print(__file__, ": file with a name longer than 100 characters, " - "in dir with name longer than 100 characters, " - "not created.") - exit(False) - -if not os.path.lexists("{}/{}".format(cfg.offline_root, long_filename2)): - print(__file__, ": symlink with a name longer than 100 characters, " - "pointing at a file with a name longer than " - "100 characters," - "in dir with name longer than 100 characters, " - "not created.") - exit(False) - -linky = os.path.realpath("{}/{}".format(cfg.offline_root, long_filename2)) -linky_dst = "{}/{}".format(cfg.offline_root, long_filename) -if linky != linky_dst: - print(__file__, ": symlink path truncated.") - exit(False) - -opkgcl.remove("a") diff --git a/src/tests/regress/.svn/text-base/issue79.py.svn-base b/src/tests/regress/.svn/text-base/issue79.py.svn-base deleted file mode 100644 index 30ba201..0000000 --- a/src/tests/regress/.svn/text-base/issue79.py.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Depends="b") -o.add(Package="b", Version="1.0") -o.add(Package="c", Version="1.0", Depends="b") -o.write_opk() -o.write_list() - -opkgcl.update() -opkgcl.install("a") -opkgcl.install("c") - -opkgcl.flag_unpacked("a") - -o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Depends="b") -o.add(Package="b", Version="1.0") -o.add(Package="c", Version="2.0") -o.write_opk() -o.write_list() - -opkgcl.update() -opkgcl.upgrade("--autoremove") - -if not opkgcl.is_installed("b", "1.0"): - print("b has been removed even though a still depends on it") - exit(False) diff --git a/src/tests/regress/.svn/text-base/issue84.py.svn-base b/src/tests/regress/.svn/text-base/issue84.py.svn-base deleted file mode 100644 index 1f5d43e..0000000 --- a/src/tests/regress/.svn/text-base/issue84.py.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/python3 - -import opk, cfg, opkgcl - -def cleanup(): - opkgcl.remove("a1") - opkgcl.remove("b1") - opkgcl.remove("a") - opkgcl.remove("b") - opkgcl.remove('c') - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Provides="v", Depends="a1") -o.add(Package="b", Provides="v", Depends="b1") -o.add(Package="c", Depends="v") -o.add(Package="a1") -o.add(Package="b1") - -o.write_opk() -o.write_list() - -opkgcl.update() - -# install ``a1`` directly -opkgcl.install("a1_1.0_all.opk") -if not opkgcl.is_installed("a1"): - print(__file__, ": package ``a1'' not installed.") - cleanup() - exit(False) - -# install ``c'' from repository -opkgcl.install("c") -if not opkgcl.is_installed("c"): - print(__file__, ": package ``c'' not installed.") - cleanup() - exit(False) - -if opkgcl.is_installed("b1"): - print(__file__, ": package ``b1'' is installed, but should not be.") - cleanup() - exit(False) - -cleanup() diff --git a/src/tests/regress/.svn/text-base/issue85.py.svn-base b/src/tests/regress/.svn/text-base/issue85.py.svn-base deleted file mode 100644 index 3250075..0000000 --- a/src/tests/regress/.svn/text-base/issue85.py.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/python3 - -import opk, cfg, opkgcl - -def cleanup(): - opkgcl.remove("a") - opkgcl.remove("b") - opkgcl.remove('c') - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Provides="v") -o.add(Package="b", Provides="v", Depends="b_nonexistant") -o.add(Package="c", Depends="v") - -o.write_opk() -o.write_list() - -opkgcl.update() - -# install ``c'' from repository -opkgcl.install("c") -if not opkgcl.is_installed("c"): - print(__file__, ": package ``c'' not installed.") - cleanup() - exit(False) - -cleanup() diff --git a/src/tests/regress/.svn/text-base/opk.py.svn-base b/src/tests/regress/.svn/text-base/opk.py.svn-base deleted file mode 100644 index f96037e..0000000 --- a/src/tests/regress/.svn/text-base/opk.py.svn-base +++ /dev/null @@ -1,111 +0,0 @@ -import tarfile, os -import cfg - -class Opk: - valid_control_fields = ["Package", "Version", "Depends", "Provides",\ - "Replaces", "Conflicts", "Suggests", "Recommends",\ - "Section", "Architecture", "Maintainer", "MD5Sum",\ - "Size", "InstalledSize", "Filename", "Source",\ - "Description", "OE", "Homepage", "Priority",\ - "Conffiles"] - - def __init__(self, **control): - for k in control.keys(): - if k not in self.valid_control_fields: - raise Exception("Invalid control field: " - "{}".format(k)) - if "Package" not in control.keys(): - print("Cannot create opk without Package name.\n") - return None - if "Architecture" not in control.keys(): - control["Architecture"] = "all" - if "Version" not in control.keys(): - control["Version"] = "1.0" - self.control = control - - def write(self, tar_not_ar=False, data_files=None): - filename = "{Package}_{Version}_{Architecture}.opk"\ - .format(**self.control) - if os.path.exists(filename): - os.unlink(filename) - if os.path.exists("control"): - os.unlink("control") - if os.path.exists("control.tar.gz"): - os.unlink("control.tar.gz") - if os.path.exists("data.tar.gz"): - os.unlink("data.tar.gz") - - f = open("control", "w") - for k in self.control.keys(): - f.write("{}: {}\n".format(k, self.control[k])) - f.close() - - tar = tarfile.open("control.tar.gz", "w:gz") - tar.add("control") - tar.close() - - tar = tarfile.open("data.tar.gz", "w:gz") - if data_files: - for df in data_files: - tar.add(df) - tar.close() - - - if tar_not_ar: - tar = tarfile.open(filename, "w:gz") - tar.add("control.tar.gz") - tar.add("data.tar.gz") - tar.close() - else: - os.system("ar q {} control.tar.gz data.tar.gz \ - 2>/dev/null".format(filename)) - - os.unlink("control") - os.unlink("control.tar.gz") - os.unlink("data.tar.gz") - -class OpkGroup: - def __init__(self): - self.opk_list = [] - - def add(self, **control): - self.opk_list.append(Opk(**control)) - - def addOpk(self, opk): - self.opk_list.append(opk) - - def write_opk(self, tar_not_ar=False): - for o in self.opk_list: - o.write(tar_not_ar) - - def write_list(self, filename="Packages"): - f = open(filename, "w") - for opk in self.opk_list: - for k in opk.control.keys(): - f.write("{}: {}\n".format(k, opk.control[k])) - f.write("Filename: {Package}_{Version}_{Architecture}" - ".opk\n".format(**opk.control)) - f.write("\n") - f.close() - - -def regress_init(): - """ - Initialisation and sanity checking. - """ - - if not os.access(cfg.opkgcl, os.X_OK): - print("Cannot exec {}".format(cfg.opkgcl)) - exit(False) - - os.chdir(cfg.opkdir) - - os.system("rm -fr {}".format(cfg.offline_root)) - - os.makedirs("{}/usr/lib/opkg".format(cfg.offline_root)) - os.makedirs("{}/etc/opkg".format(cfg.offline_root)) - - f = open("{}/etc/opkg/opkg.conf".format(cfg.offline_root), "w") - f.write("arch all 1\n") - f.write("src test file:{}\n".format(cfg.opkdir)) - f.close() diff --git a/src/tests/regress/.svn/text-base/opkgcl.py.svn-base b/src/tests/regress/.svn/text-base/opkgcl.py.svn-base deleted file mode 100644 index 47e7dd3..0000000 --- a/src/tests/regress/.svn/text-base/opkgcl.py.svn-base +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python3 - -import os, subprocess -import cfg - -def opkgcl(opkg_args): - cmd = "{} -o {} {}".format(cfg.opkgcl, cfg.offline_root, opkg_args) - #print(cmd) - return subprocess.getstatusoutput(cmd) - -def install(pkg_name, flags=""): - return opkgcl("{} install {}".format(flags, pkg_name))[0] - -def remove(pkg_name, flags=""): - return opkgcl("{} remove {}".format(flags, pkg_name))[0] - -def update(): - return opkgcl("update")[0] - -def upgrade(params=None): - if params: - opkgcl("upgrade {}".format(params))[0] - else: - return opkgcl("upgrade")[0] - -def files(pkg_name): - output = opkgcl("files {}".format(pkg_name))[1] - return output.split("\n")[1:] - - -def flag_unpacked(pkg_name): - out = opkgcl("flag unpacked {}".format(pkg_name)) - return out == "Setting flags for package {} to unpacked.".format(pkg_name) - -def is_installed(pkg_name, version=None): - out = opkgcl("list_installed {}".format(pkg_name))[1] - if len(out) == 0 or out.split()[0] != pkg_name: - return False - if version and out.split()[2] != version: - return False - if not os.path.exists("{}/usr/lib/opkg/info/{}.control"\ - .format(cfg.offline_root, pkg_name)): - return False - return True - -def is_autoinstalled(pkg_name): - status_path = "{}/usr/lib/opkg/status".format(cfg.offline_root) - if not os.path.exists(status_path): - return False - status_file = open(status_path, "r") - status = status_file.read() - status_file.close() - index_start = status.find("Package: {}".format(pkg_name)) - if index_start < 0: - return False - index_end = status.find("\n\n", index_start) - return status.find("Auto-Installed: yes", index_start, index_end) >= 0 - - -if __name__ == '__main__': - import sys - (status, output) = opkgcl(" ".join(sys.argv[1:])) - print(output) - exit(status) diff --git a/src/tests/regress/.svn/text-base/update_loses_autoinstalled_flag.py.svn-base b/src/tests/regress/.svn/text-base/update_loses_autoinstalled_flag.py.svn-base deleted file mode 100644 index 5ae030c..0000000 --- a/src/tests/regress/.svn/text-base/update_loses_autoinstalled_flag.py.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -bug = True - -opk.regress_init() - -open("asdf", "w").close() -a = opk.Opk(Package="a", Version="1.0", Depends="b") -a.write() -b = opk.Opk(Package="b", Version="1.0") -b.write(data_files=["asdf"]) - -o = opk.OpkGroup() -o.addOpk(a) -o.addOpk(b) -o.write_list() - -opkgcl.update() -opkgcl.install("a") - -if not opkgcl.is_autoinstalled("b"): - print("b is not autoinstalled") - exit(False) - -if (bug): - a = opk.Opk(Package="a", Version="2.0", Depends="b") - a.write() - b = opk.Opk(Package="b", Version="2.0") - b.write(data_files=["asdf"]) - - o = opk.OpkGroup() - o.addOpk(a) - o.addOpk(b) - o.write_list() - - opkgcl.update() - opkgcl.upgrade(); - - if not opkgcl.is_autoinstalled("b"): - print("b is not autoinstalled anymore") - exit(False) - -a = opk.Opk(Package="a", Version="3.0") -a.write(data_files=["asdf"]) -os.unlink("asdf") - -o = opk.OpkGroup() -o.addOpk(a) -o.write_list() - -opkgcl.update() -opkgcl.upgrade(); - -if opkgcl.is_installed("b", "2.0"): - print("b is still installed") - exit(False) - -if not opkgcl.is_installed("a", "3.0"): - print("a is not installed") - exit(False) diff --git a/src/tests/regress/Makefile b/src/tests/regress/Makefile deleted file mode 100644 index 0accb31..0000000 --- a/src/tests/regress/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -PYTHON=/usr/bin/python3 -REGRESSION_TESTS=issue26.py issue31.py issue45.py issue46.py \ - issue50.py issue51.py issue55.py issue58.py \ - issue72.py issue79.py issue84.py issue85.py \ - filehash.py \ - update_loses_autoinstalled_flag.py - -regress: - @for test in $(REGRESSION_TESTS); do \ - echo $$test; \ - $(PYTHON) $$test; \ - done - -clean: - rm -f *.pyc diff --git a/src/tests/regress/cfg.py b/src/tests/regress/cfg.py deleted file mode 100644 index 6f78996..0000000 --- a/src/tests/regress/cfg.py +++ /dev/null @@ -1,5 +0,0 @@ -import os - -opkdir = "/tmp/opk" -offline_root = "/tmp/opkg" -opkgcl = os.path.realpath("../../src/opkg-cl") diff --git a/src/tests/regress/filehash.py b/src/tests/regress/filehash.py deleted file mode 100755 index e6cbe62..0000000 --- a/src/tests/regress/filehash.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -open("asdf", "w").close() -a = opk.Opk(Package="a", Version="1.0", Architecture="all") -a.write(data_files=["asdf"]) -b = opk.Opk(Package="b", Version="1.0", Architecture="all") -b.write(data_files=["asdf"]) -os.unlink("asdf") -opkgcl.install("a_1.0_all.opk") - -if not opkgcl.is_installed("a"): - print(__file__, ": Package 'a' not installed.") - exit(False) - -if not os.path.exists("{}/asdf".format(cfg.offline_root)): - print(__file__, ": asdf not created.") - exit(False) - -opkgcl.install("b_1.0_all.opk", "--force-overwrite") - -if "{}/asdf".format(cfg.offline_root) not in opkgcl.files("b"): - print(__file__, ": asdf not claimed by ``b''.") - exit(False) - -if "{}/asdf".format(cfg.offline_root) in opkgcl.files("a"): - print(__file__, ": asdf is still claimed by ``a''.") - exit(False) - -opkgcl.remove("b") -opkgcl.remove("a") diff --git a/src/tests/regress/issue26.py b/src/tests/regress/issue26.py deleted file mode 100755 index dd4ef92..0000000 --- a/src/tests/regress/issue26.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Version="2.0") -o.write_opk() -o.write_list() - -# older version, not in Packages list -a1 = opk.Opk(Package="a", Version="1.0") -a1.write() - -opkgcl.update() - -# install v2 from repository -opkgcl.install("a") -if not opkgcl.is_installed("a", "2.0"): - print(__file__, ": Package 'a_2.0' not installed.") - exit(False) - -opkgcl.install("a_1.0_all.opk", "--force-downgrade") -if not opkgcl.is_installed("a", "1.0"): - print(__file__, ": Package 'a_1.0' not installed (1).") - exit(False) - -opkgcl.install("a_1.0_all.opk", "--force-downgrade") -if not opkgcl.is_installed("a", "1.0"): - print(__file__, ": Package 'a_1.0' not installed (2).") - exit(False) - -opkgcl.remove("a") diff --git a/src/tests/regress/issue31.py b/src/tests/regress/issue31.py deleted file mode 100755 index 42e51e3..0000000 --- a/src/tests/regress/issue31.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Depends="b") -o.add(Package="b", Depends="c") -o.write_opk() -o.write_list() - -opkgcl.update() - -opkgcl.install("a") -if opkgcl.is_installed("a"): - print(__file__, ": Package 'a' installed, despite dependency " - "upon a package with an unresolved dependency.") - exit(False) - -if opkgcl.is_installed("b"): - print(__file__, ": Package 'b' installed, " - "despite unresolved dependency.") - exit(False) diff --git a/src/tests/regress/issue45.py b/src/tests/regress/issue45.py deleted file mode 100755 index 30735f9..0000000 --- a/src/tests/regress/issue45.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Depends="b") -o.add(Package="b") -o.write_opk() -o.write_list() - -opkgcl.update() - -(status, output) = opkgcl.opkgcl("install --force-postinstall a") -ln_a = output.find("Configuring a") -ln_b = output.find("Configuring b") - -if ln_a == -1: - print(__file__, ": Didn't see package 'a' get configured.") - exit(False) - -if ln_b == -1: - print(__file__, ": Didn't see package 'b' get configured.") - exit(False) - -if ln_a < ln_b: - print(__file__, ": Packages 'a' and 'b' configured in wrong order.") - exit(False) - -opkgcl.remove("a") -opkgcl.remove("b") diff --git a/src/tests/regress/issue46.py b/src/tests/regress/issue46.py deleted file mode 100755 index ec56941..0000000 --- a/src/tests/regress/issue46.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Recommends="b") -o.add(Package="b", Version="2.0") -o.write_opk() -o.write_list() - -# prime the status file so 'b' is not installed as a recommendation -status_filename = "{}/usr/lib/opkg/status".format(cfg.offline_root) -f = open(status_filename, "w") -f.write("Package: b\n") -f.write("Version: 1.0\n") -f.write("Architecture: all\n") -f.write("Status: deinstall hold not-installed\n") -f.close() - -opkgcl.update() - -opkgcl.install("a") -if opkgcl.is_installed("b"): - print(__file__, ": Package 'b' installed despite " - "deinstall/hold status.") - exit(False) - -opkgcl.remove("a") -opkgcl.install("a") -if opkgcl.is_installed("b"): - print(__file__, ": Package 'b' installed - deinstall/hold status " - "not retained.") - exit(False) - -opkgcl.remove("a") -open(status_filename, "w").close() diff --git a/src/tests/regress/issue50.py b/src/tests/regress/issue50.py deleted file mode 100755 index 19897b4..0000000 --- a/src/tests/regress/issue50.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -open("foo", "w").close() -a1 = opk.Opk(Package="a", Version="1.0") -a1.write(data_files=["foo"]) - -opkgcl.install("a_1.0_all.opk") - -o = opk.OpkGroup() -a2 = opk.Opk(Package="a", Version="2.0", Depends="b") -a2.write() -b1 = opk.Opk(Package="b", Version="1.0") -b1.write(data_files=["foo"]) -o.opk_list.append(a2) -o.opk_list.append(b1) -o.write_list() - -os.unlink("foo") - -opkgcl.update() -opkgcl.upgrade() - -if not opkgcl.is_installed("a", "2.0"): - print(__file__, ": Package 'a_2.0' not installed.") - exit(False) - -foo_fullpath = "{}/foo".format(cfg.offline_root) - -if not os.path.exists(foo_fullpath): - print(__file__, ": File 'foo' incorrectly orphaned.") - exit(False) - -if not foo_fullpath in opkgcl.files("b"): - print(__file__, ": Package 'b' does not own file 'foo'.") - exit(False) - -opkgcl.remove("a") -opkgcl.remove("b") diff --git a/src/tests/regress/issue51.py b/src/tests/regress/issue51.py deleted file mode 100755 index 9849dbc..0000000 --- a/src/tests/regress/issue51.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -open("foo", "w").close() -a1 = opk.Opk(Package="a") -a1.write(data_files=["foo"]) -os.rename("a_1.0_all.opk", "a_with_foo.opk") - -opkgcl.install("a_with_foo.opk") - -# ---- -opkgcl.install("a_with_foo.opk") - -open("bar", "w").close() -o = opk.OpkGroup() -a2 = opk.Opk(Package="a") -a2.write(data_files=["foo", "bar"]) -o.opk_list.append(a2) -o.write_list() - -os.unlink("foo") -os.unlink("bar") - -opkgcl.update() -opkgcl.install("a", "--force-reinstall") - -foo_fullpath = "{}/foo".format(cfg.offline_root) -bar_fullpath = "{}/bar".format(cfg.offline_root) - -if not os.path.exists(foo_fullpath) or not os.path.exists(bar_fullpath): - print(__file__, ": Files foo and/or bar are missing.") - exit(False) - -a_files = opkgcl.files("a") -if not foo_fullpath in a_files or not bar_fullpath in a_files: - print(__file__, ": Package 'a' does not own foo and/or bar.") - exit(False) - -opkgcl.remove("a") - -if os.path.exists(foo_fullpath) or os.path.exists(bar_fullpath): - print(__file__, ": Files foo and/or bar still exist " - "after removal of package 'a'.") - exit(False) - -# ---- -o = opk.OpkGroup() -a2 = opk.Opk(Package="a") -a2.write() -o.opk_list.append(a2) -o.write_list() - - -opkgcl.update() - -opkgcl.install("a", "--force-reinstall") - -if os.path.exists(foo_fullpath): - print(__file__, ": File 'foo' not orphaned as it should be.") - exit(False) - -if foo_fullpath in opkgcl.files("a"): - print(__file__, ": Package 'a' incorrectly owns file 'foo'.") - exit(False) - -opkgcl.remove("a") diff --git a/src/tests/regress/issue55.py b/src/tests/regress/issue55.py deleted file mode 100755 index 8628306..0000000 --- a/src/tests/regress/issue55.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -long_filename = 110*"a" - -os.symlink(long_filename, "linky") -a = opk.Opk(Package="a") -a.write(data_files=["linky"]) -os.unlink("linky") -opkgcl.install("a_1.0_all.opk") - -if not opkgcl.is_installed("a"): - print(__file__, ": Package 'a' not installed.") - exit(False) - -if not os.path.lexists("{}/linky".format(cfg.offline_root)): - print(__file__, ": symlink to file with a name longer than 100 " - "characters not created.") - exit(False) - -opkgcl.remove("a") diff --git a/src/tests/regress/issue58.py b/src/tests/regress/issue58.py deleted file mode 100755 index 72a1854..0000000 --- a/src/tests/regress/issue58.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Recommends="b") -o.add(Package="b") -o.add(Package="c", Recommends="b") -o.write_opk() -o.write_list() - -opkgcl.update() - -opkgcl.install("a") -opkgcl.install("c") - -opkgcl.remove("a", "--autoremove") -if not opkgcl.is_installed("b"): - print(__file__, ": Pacakge 'b' orphaned despite remaining " - "recommending package 'c'.") - exit(False) - -opkgcl.remove("c", "--autoremove") -if opkgcl.is_installed("b"): - print(__file__, ": Recommended package 'b' not autoremoved.") - exit(False) - - diff --git a/src/tests/regress/issue72.py b/src/tests/regress/issue72.py deleted file mode 100755 index d0c511b..0000000 --- a/src/tests/regress/issue72.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -long_dir = 110*"a" -long_b = 110*"b" -long_filename = long_dir + "/"+ long_b -long_filename2 = long_dir + "/" + 110*"c" - -os.mkdir(long_dir) -open(long_filename, "w").close() -os.symlink(long_b, long_filename2) -a = opk.Opk(Package="a") -a.write(data_files=[long_dir, long_filename, long_filename2]) -os.unlink(long_filename) -os.unlink(long_filename2) -os.rmdir(long_dir) -opkgcl.install("a_1.0_all.opk") - -if not opkgcl.is_installed("a"): - print(__file__, ": Package 'a' not installed.") - exit(False) - -if not os.path.exists("{}/{}".format(cfg.offline_root, long_dir)): - print(__file__, ": dir with name longer than 100 " - "characters not created.") - exit(False) - -if not os.path.exists("{}/{}".format(cfg.offline_root, long_filename)): - print(__file__, ": file with a name longer than 100 characters, " - "in dir with name longer than 100 characters, " - "not created.") - exit(False) - -if not os.path.lexists("{}/{}".format(cfg.offline_root, long_filename2)): - print(__file__, ": symlink with a name longer than 100 characters, " - "pointing at a file with a name longer than " - "100 characters," - "in dir with name longer than 100 characters, " - "not created.") - exit(False) - -linky = os.path.realpath("{}/{}".format(cfg.offline_root, long_filename2)) -linky_dst = "{}/{}".format(cfg.offline_root, long_filename) -if linky != linky_dst: - print(__file__, ": symlink path truncated.") - exit(False) - -opkgcl.remove("a") diff --git a/src/tests/regress/issue79.py b/src/tests/regress/issue79.py deleted file mode 100755 index 30ba201..0000000 --- a/src/tests/regress/issue79.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python - -import os -import opk, cfg, opkgcl - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Depends="b") -o.add(Package="b", Version="1.0") -o.add(Package="c", Version="1.0", Depends="b") -o.write_opk() -o.write_list() - -opkgcl.update() -opkgcl.install("a") -opkgcl.install("c") - -opkgcl.flag_unpacked("a") - -o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Depends="b") -o.add(Package="b", Version="1.0") -o.add(Package="c", Version="2.0") -o.write_opk() -o.write_list() - -opkgcl.update() -opkgcl.upgrade("--autoremove") - -if not opkgcl.is_installed("b", "1.0"): - print("b has been removed even though a still depends on it") - exit(False) diff --git a/src/tests/regress/issue84.py b/src/tests/regress/issue84.py deleted file mode 100755 index 1f5d43e..0000000 --- a/src/tests/regress/issue84.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/python3 - -import opk, cfg, opkgcl - -def cleanup(): - opkgcl.remove("a1") - opkgcl.remove("b1") - opkgcl.remove("a") - opkgcl.remove("b") - opkgcl.remove('c') - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Provides="v", Depends="a1") -o.add(Package="b", Provides="v", Depends="b1") -o.add(Package="c", Depends="v") -o.add(Package="a1") -o.add(Package="b1") - -o.write_opk() -o.write_list() - -opkgcl.update() - -# install ``a1`` directly -opkgcl.install("a1_1.0_all.opk") -if not opkgcl.is_installed("a1"): - print(__file__, ": package ``a1'' not installed.") - cleanup() - exit(False) - -# install ``c'' from repository -opkgcl.install("c") -if not opkgcl.is_installed("c"): - print(__file__, ": package ``c'' not installed.") - cleanup() - exit(False) - -if opkgcl.is_installed("b1"): - print(__file__, ": package ``b1'' is installed, but should not be.") - cleanup() - exit(False) - -cleanup() diff --git a/src/tests/regress/issue85.py b/src/tests/regress/issue85.py deleted file mode 100755 index 3250075..0000000 --- a/src/tests/regress/issue85.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/python3 - -import opk, cfg, opkgcl - -def cleanup(): - opkgcl.remove("a") - opkgcl.remove("b") - opkgcl.remove('c') - -opk.regress_init() - -o = opk.OpkGroup() -o.add(Package="a", Provides="v") -o.add(Package="b", Provides="v", Depends="b_nonexistant") -o.add(Package="c", Depends="v") - -o.write_opk() -o.write_list() - -opkgcl.update() - -# install ``c'' from repository -opkgcl.install("c") -if not opkgcl.is_installed("c"): - print(__file__, ": package ``c'' not installed.") - cleanup() - exit(False) - -cleanup() diff --git a/src/tests/regress/opk.py b/src/tests/regress/opk.py deleted file mode 100644 index f96037e..0000000 --- a/src/tests/regress/opk.py +++ /dev/null @@ -1,111 +0,0 @@ -import tarfile, os -import cfg - -class Opk: - valid_control_fields = ["Package", "Version", "Depends", "Provides",\ - "Replaces", "Conflicts", "Suggests", "Recommends",\ - "Section", "Architecture", "Maintainer", "MD5Sum",\ - "Size", "InstalledSize", "Filename", "Source",\ - "Description", "OE", "Homepage", "Priority",\ - "Conffiles"] - - def __init__(self, **control): - for k in control.keys(): - if k not in self.valid_control_fields: - raise Exception("Invalid control field: " - "{}".format(k)) - if "Package" not in control.keys(): - print("Cannot create opk without Package name.\n") - return None - if "Architecture" not in control.keys(): - control["Architecture"] = "all" - if "Version" not in control.keys(): - control["Version"] = "1.0" - self.control = control - - def write(self, tar_not_ar=False, data_files=None): - filename = "{Package}_{Version}_{Architecture}.opk"\ - .format(**self.control) - if os.path.exists(filename): - os.unlink(filename) - if os.path.exists("control"): - os.unlink("control") - if os.path.exists("control.tar.gz"): - os.unlink("control.tar.gz") - if os.path.exists("data.tar.gz"): - os.unlink("data.tar.gz") - - f = open("control", "w") - for k in self.control.keys(): - f.write("{}: {}\n".format(k, self.control[k])) - f.close() - - tar = tarfile.open("control.tar.gz", "w:gz") - tar.add("control") - tar.close() - - tar = tarfile.open("data.tar.gz", "w:gz") - if data_files: - for df in data_files: - tar.add(df) - tar.close() - - - if tar_not_ar: - tar = tarfile.open(filename, "w:gz") - tar.add("control.tar.gz") - tar.add("data.tar.gz") - tar.close() - else: - os.system("ar q {} control.tar.gz data.tar.gz \ - 2>/dev/null".format(filename)) - - os.unlink("control") - os.unlink("control.tar.gz") - os.unlink("data.tar.gz") - -class OpkGroup: - def __init__(self): - self.opk_list = [] - - def add(self, **control): - self.opk_list.append(Opk(**control)) - - def addOpk(self, opk): - self.opk_list.append(opk) - - def write_opk(self, tar_not_ar=False): - for o in self.opk_list: - o.write(tar_not_ar) - - def write_list(self, filename="Packages"): - f = open(filename, "w") - for opk in self.opk_list: - for k in opk.control.keys(): - f.write("{}: {}\n".format(k, opk.control[k])) - f.write("Filename: {Package}_{Version}_{Architecture}" - ".opk\n".format(**opk.control)) - f.write("\n") - f.close() - - -def regress_init(): - """ - Initialisation and sanity checking. - """ - - if not os.access(cfg.opkgcl, os.X_OK): - print("Cannot exec {}".format(cfg.opkgcl)) - exit(False) - - os.chdir(cfg.opkdir) - - os.system("rm -fr {}".format(cfg.offline_root)) - - os.makedirs("{}/usr/lib/opkg".format(cfg.offline_root)) - os.makedirs("{}/etc/opkg".format(cfg.offline_root)) - - f = open("{}/etc/opkg/opkg.conf".format(cfg.offline_root), "w") - f.write("arch all 1\n") - f.write("src test file:{}\n".format(cfg.opkdir)) - f.close() diff --git a/src/tests/regress/opkgcl.py b/src/tests/regress/opkgcl.py deleted file mode 100755 index 47e7dd3..0000000 --- a/src/tests/regress/opkgcl.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python3 - -import os, subprocess -import cfg - -def opkgcl(opkg_args): - cmd = "{} -o {} {}".format(cfg.opkgcl, cfg.offline_root, opkg_args) - #print(cmd) - return subprocess.getstatusoutput(cmd) - -def install(pkg_name, flags=""): - return opkgcl("{} install {}".format(flags, pkg_name))[0] - -def remove(pkg_name, flags=""): - return opkgcl("{} remove {}".format(flags, pkg_name))[0] - -def update(): - return opkgcl("update")[0] - -def upgrade(params=None): - if params: - opkgcl("upgrade {}".format(params))[0] - else: - return opkgcl("upgrade")[0] - -def files(pkg_name): - output = opkgcl("files {}".format(pkg_name))[1] - return output.split("\n")[1:] - - -def flag_unpacked(pkg_name): - out = opkgcl("flag unpacked {}".format(pkg_name)) - return out == "Setting flags for package {} to unpacked.".format(pkg_name) - -def is_installed(pkg_name, version=None): - out = opkgcl("list_installed {}".format(pkg_name))[1] - if len(out) == 0 or out.split()[0] != pkg_name: - return False - if version and out.split()[2] != version: - return False - if not os.path.exists("{}/usr/lib/opkg/info/{}.control"\ - .format(cfg.offline_root, pkg_name)): - return False - return True - -def is_autoinstalled(pkg_name): - status_path = "{}/usr/lib/opkg/status".format(cfg.offline_root) - if not os.path.exists(status_path): - return False - status_file = open(status_path, "r") - status = status_file.read() - status_file.close() - index_start = status.find("Package: {}".format(pkg_name)) - if index_start < 0: - return False - index_end = status.find("\n\n", index_start) - return status.find("Auto-Installed: yes", index_start, index_end) >= 0 - - -if __name__ == '__main__': - import sys - (status, output) = opkgcl(" ".join(sys.argv[1:])) - print(output) - exit(status) diff --git a/src/tests/regress/update_loses_autoinstalled_flag.py b/src/tests/regress/update_loses_autoinstalled_flag.py deleted file mode 100644 index 5ae030c..0000000 --- a/src/tests/regress/update_loses_autoinstalled_flag.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python3 - -import os -import opk, cfg, opkgcl - -bug = True - -opk.regress_init() - -open("asdf", "w").close() -a = opk.Opk(Package="a", Version="1.0", Depends="b") -a.write() -b = opk.Opk(Package="b", Version="1.0") -b.write(data_files=["asdf"]) - -o = opk.OpkGroup() -o.addOpk(a) -o.addOpk(b) -o.write_list() - -opkgcl.update() -opkgcl.install("a") - -if not opkgcl.is_autoinstalled("b"): - print("b is not autoinstalled") - exit(False) - -if (bug): - a = opk.Opk(Package="a", Version="2.0", Depends="b") - a.write() - b = opk.Opk(Package="b", Version="2.0") - b.write(data_files=["asdf"]) - - o = opk.OpkGroup() - o.addOpk(a) - o.addOpk(b) - o.write_list() - - opkgcl.update() - opkgcl.upgrade(); - - if not opkgcl.is_autoinstalled("b"): - print("b is not autoinstalled anymore") - exit(False) - -a = opk.Opk(Package="a", Version="3.0") -a.write(data_files=["asdf"]) -os.unlink("asdf") - -o = opk.OpkGroup() -o.addOpk(a) -o.write_list() - -opkgcl.update() -opkgcl.upgrade(); - -if opkgcl.is_installed("b", "2.0"): - print("b is still installed") - exit(False) - -if not opkgcl.is_installed("a", "3.0"): - print("a is not installed") - exit(False) |