Compare commits

..

No commits in common. "b2b50b7a8401385c7aa9ee9ee218c6267253ea06" and "3d69c8edebc995c6c19e4883e34c8327383a7afa" have entirely different histories.

7 changed files with 5 additions and 418 deletions

View File

@ -54,7 +54,7 @@ build-test: $(BINS_TEST)
# For simplicity, we link every object file to each of the test files. This
# might be changed later if this starts to become too slow.
$(BINS_TEST): %: %.c.o $(OBJS)
$(CC) $^ -larchive -o $@
$(CC) $^ -o $@
# Each test includes the test directory, which contains the acutest header file
$(BUILD_DIR)/$(TEST_DIR)/%.c.o: $(TEST_DIR)/%.c

View File

@ -120,14 +120,6 @@ Pkg *package_read_archive(const char *pkg_path) {
return pkg;
}
void sha256sum(Pkg *pkg, char *res) {
char command[SMALL_BUFF_SIZE];
snprintf(command, SMALL_BUFF_SIZE, "sha256sum %s", pkg->path);
FILE *p = popen(command, "r");
fgets(res, 65, p);
pclose(p);
}
char *package_to_description(Pkg *pkg) {
PkgInfo *pkg_info = pkg->info;
@ -150,16 +142,7 @@ char *package_to_description(Pkg *pkg) {
ADD_ARRAY("\n\n%%GROUPS%%\n%s", groups);
ADD_STRING("\n\n%%CSIZE%%\n%ld", csize);
ADD_STRING("\n\n%%ISIZE%%\n%ld", size);
char checksum[65];
sha256sum(pkg, checksum);
snprintf(aux, SMALL_BUFF_SIZE, "\n\n%%SHA256SUM%%\n%s", checksum);
if (buff_size < strlen(description) + SMALL_BUFF_SIZE + 1) {
description = realloc(description, buff_size * 2);
buff_size *= 2;
}
strcat(description, aux);
//SHA256SUM
ADD_STRING("\n\n%%URL%%\n%s", url);
ADD_ARRAY("\n\n%%LICENSE%%\n%s", licenses);
ADD_STRING("\n\n%%ARCH%%\n%s", arch);

View File

@ -1,22 +0,0 @@
# Generated by makepkg 6.0.2
# using fakeroot version 1.30.1
pkgname = xcursor-dmz
pkgbase = xcursor-dmz
pkgver = 0.4.5-2
pkgdesc = Style neutral, scalable cursor theme
url = https://packages.debian.org/sid/dmz-cursor-theme
builddate = 1673751613
packager = Unknown Packager
size = 3469584
arch = any
license = MIT
replaces = test1
group = x11
conflict = test2
conflict = test3
provides = test4
depend = test5
depend = test6
optdepend = test7
makedepend = xorg-xcursorgen
checkdepend = test8

View File

@ -1,45 +0,0 @@
%FILENAME%
xcursor-dmz-0.4.5-2-any.pkg.tar.zst
%NAME%
xcursor-dmz
%BASE%
xcursor-dmz
%VERSION%
0.4.5-2
%DESC%
Style neutral, scalable cursor theme
%GROUPS%
x11
%CSIZE%
328282
%ISIZE%
3469584
%SHA256SUM%
4f4bce9e975334ed7775ff4ddf4d2e82e411d599802f6179a122f89149f53bfb
%URL%
https://packages.debian.org/sid/dmz-cursor-theme
%LICENSE%
MIT
%ARCH%
any
%BUILDDATE%
1673751613
%PACKAGER%
Unknown Packager
%MAKEDEPENDS%
xorg-xcursorgen

View File

@ -1,243 +0,0 @@
%FILES%
usr/
usr/share/
usr/share/icons/
usr/share/icons/DMZ-Black/
usr/share/icons/DMZ-Black/cursor.theme
usr/share/icons/DMZ-Black/cursors/
usr/share/icons/DMZ-Black/cursors/00008160000006810000408080010102
usr/share/icons/DMZ-Black/cursors/028006030e0e7ebffc7f7070c0600140
usr/share/icons/DMZ-Black/cursors/03b6e0fcb3499374a867c041f52298f0
usr/share/icons/DMZ-Black/cursors/08e8e1c95fe2fc01f976f1e063a24ccd
usr/share/icons/DMZ-Black/cursors/1081e37283d90000800003c07f3ef6bf
usr/share/icons/DMZ-Black/cursors/14fef782d02440884392942c11205230
usr/share/icons/DMZ-Black/cursors/2870a09082c103050810ffdffffe0204
usr/share/icons/DMZ-Black/cursors/3085a0e285430894940527032f8b26df
usr/share/icons/DMZ-Black/cursors/3ecb610c1bf2410f44200f48c40d3599
usr/share/icons/DMZ-Black/cursors/4498f0e0c1937ffe01fd06f973665830
usr/share/icons/DMZ-Black/cursors/5c6cd98b3f3ebcb1f9c7f1c204630408
usr/share/icons/DMZ-Black/cursors/6407b0e94181790501fd1e167b474872
usr/share/icons/DMZ-Black/cursors/640fb0e74195791501fd1ed57b41487f
usr/share/icons/DMZ-Black/cursors/9081237383d90e509aa00f00170e968f
usr/share/icons/DMZ-Black/cursors/9d800788f1b08800ae810202380a0822
usr/share/icons/DMZ-Black/cursors/X_cursor
usr/share/icons/DMZ-Black/cursors/alias
usr/share/icons/DMZ-Black/cursors/arrow
usr/share/icons/DMZ-Black/cursors/bd_double_arrow
usr/share/icons/DMZ-Black/cursors/bottom_left_corner
usr/share/icons/DMZ-Black/cursors/bottom_right_corner
usr/share/icons/DMZ-Black/cursors/bottom_side
usr/share/icons/DMZ-Black/cursors/bottom_tee
usr/share/icons/DMZ-Black/cursors/c7088f0f3e6c8088236ef8e1e3e70000
usr/share/icons/DMZ-Black/cursors/circle
usr/share/icons/DMZ-Black/cursors/col-resize
usr/share/icons/DMZ-Black/cursors/color-picker
usr/share/icons/DMZ-Black/cursors/copy
usr/share/icons/DMZ-Black/cursors/cross
usr/share/icons/DMZ-Black/cursors/cross_reverse
usr/share/icons/DMZ-Black/cursors/crossed_circle
usr/share/icons/DMZ-Black/cursors/crosshair
usr/share/icons/DMZ-Black/cursors/d9ce0ab605698f320427677b458ad60b
usr/share/icons/DMZ-Black/cursors/default
usr/share/icons/DMZ-Black/cursors/diamond_cross
usr/share/icons/DMZ-Black/cursors/dnd-ask
usr/share/icons/DMZ-Black/cursors/dnd-copy
usr/share/icons/DMZ-Black/cursors/dnd-link
usr/share/icons/DMZ-Black/cursors/dnd-move
usr/share/icons/DMZ-Black/cursors/dnd-none
usr/share/icons/DMZ-Black/cursors/dot_box_mask
usr/share/icons/DMZ-Black/cursors/dotbox
usr/share/icons/DMZ-Black/cursors/double_arrow
usr/share/icons/DMZ-Black/cursors/draft_large
usr/share/icons/DMZ-Black/cursors/draft_small
usr/share/icons/DMZ-Black/cursors/draped_box
usr/share/icons/DMZ-Black/cursors/e-resize
usr/share/icons/DMZ-Black/cursors/e29285e634086352946a0e7090d73106
usr/share/icons/DMZ-Black/cursors/ew-resize
usr/share/icons/DMZ-Black/cursors/fcf1c3c7cd4491d801f1e1c78f100000
usr/share/icons/DMZ-Black/cursors/fd_double_arrow
usr/share/icons/DMZ-Black/cursors/fleur
usr/share/icons/DMZ-Black/cursors/grab
usr/share/icons/DMZ-Black/cursors/grabbing
usr/share/icons/DMZ-Black/cursors/h_double_arrow
usr/share/icons/DMZ-Black/cursors/hand
usr/share/icons/DMZ-Black/cursors/hand1
usr/share/icons/DMZ-Black/cursors/hand2
usr/share/icons/DMZ-Black/cursors/help
usr/share/icons/DMZ-Black/cursors/icon
usr/share/icons/DMZ-Black/cursors/left_ptr
usr/share/icons/DMZ-Black/cursors/left_ptr_help
usr/share/icons/DMZ-Black/cursors/left_ptr_watch
usr/share/icons/DMZ-Black/cursors/left_side
usr/share/icons/DMZ-Black/cursors/left_tee
usr/share/icons/DMZ-Black/cursors/link
usr/share/icons/DMZ-Black/cursors/ll_angle
usr/share/icons/DMZ-Black/cursors/lr_angle
usr/share/icons/DMZ-Black/cursors/move
usr/share/icons/DMZ-Black/cursors/n-resize
usr/share/icons/DMZ-Black/cursors/ne-resize
usr/share/icons/DMZ-Black/cursors/nesw-resize
usr/share/icons/DMZ-Black/cursors/not-allowed
usr/share/icons/DMZ-Black/cursors/ns-resize
usr/share/icons/DMZ-Black/cursors/nw-resize
usr/share/icons/DMZ-Black/cursors/nwse-resize
usr/share/icons/DMZ-Black/cursors/openhand
usr/share/icons/DMZ-Black/cursors/pencil
usr/share/icons/DMZ-Black/cursors/pirate
usr/share/icons/DMZ-Black/cursors/plus
usr/share/icons/DMZ-Black/cursors/pointer
usr/share/icons/DMZ-Black/cursors/progress
usr/share/icons/DMZ-Black/cursors/question_arrow
usr/share/icons/DMZ-Black/cursors/right_ptr
usr/share/icons/DMZ-Black/cursors/right_side
usr/share/icons/DMZ-Black/cursors/right_tee
usr/share/icons/DMZ-Black/cursors/row-resize
usr/share/icons/DMZ-Black/cursors/s-resize
usr/share/icons/DMZ-Black/cursors/sb_down_arrow
usr/share/icons/DMZ-Black/cursors/sb_h_double_arrow
usr/share/icons/DMZ-Black/cursors/sb_left_arrow
usr/share/icons/DMZ-Black/cursors/sb_right_arrow
usr/share/icons/DMZ-Black/cursors/sb_up_arrow
usr/share/icons/DMZ-Black/cursors/sb_v_double_arrow
usr/share/icons/DMZ-Black/cursors/se-resize
usr/share/icons/DMZ-Black/cursors/size_bdiag
usr/share/icons/DMZ-Black/cursors/size_fdiag
usr/share/icons/DMZ-Black/cursors/size_hor
usr/share/icons/DMZ-Black/cursors/size_ver
usr/share/icons/DMZ-Black/cursors/sw-resize
usr/share/icons/DMZ-Black/cursors/target
usr/share/icons/DMZ-Black/cursors/tcross
usr/share/icons/DMZ-Black/cursors/text
usr/share/icons/DMZ-Black/cursors/top_left_arrow
usr/share/icons/DMZ-Black/cursors/top_left_corner
usr/share/icons/DMZ-Black/cursors/top_right_corner
usr/share/icons/DMZ-Black/cursors/top_side
usr/share/icons/DMZ-Black/cursors/top_tee
usr/share/icons/DMZ-Black/cursors/ul_angle
usr/share/icons/DMZ-Black/cursors/ur_angle
usr/share/icons/DMZ-Black/cursors/v_double_arrow
usr/share/icons/DMZ-Black/cursors/w-resize
usr/share/icons/DMZ-Black/cursors/wait
usr/share/icons/DMZ-Black/cursors/watch
usr/share/icons/DMZ-Black/cursors/xterm
usr/share/icons/DMZ-White/
usr/share/icons/DMZ-White/cursor.theme
usr/share/icons/DMZ-White/cursors/
usr/share/icons/DMZ-White/cursors/00008160000006810000408080010102
usr/share/icons/DMZ-White/cursors/028006030e0e7ebffc7f7070c0600140
usr/share/icons/DMZ-White/cursors/03b6e0fcb3499374a867c041f52298f0
usr/share/icons/DMZ-White/cursors/08e8e1c95fe2fc01f976f1e063a24ccd
usr/share/icons/DMZ-White/cursors/1081e37283d90000800003c07f3ef6bf
usr/share/icons/DMZ-White/cursors/14fef782d02440884392942c11205230
usr/share/icons/DMZ-White/cursors/2870a09082c103050810ffdffffe0204
usr/share/icons/DMZ-White/cursors/3085a0e285430894940527032f8b26df
usr/share/icons/DMZ-White/cursors/3ecb610c1bf2410f44200f48c40d3599
usr/share/icons/DMZ-White/cursors/4498f0e0c1937ffe01fd06f973665830
usr/share/icons/DMZ-White/cursors/5c6cd98b3f3ebcb1f9c7f1c204630408
usr/share/icons/DMZ-White/cursors/6407b0e94181790501fd1e167b474872
usr/share/icons/DMZ-White/cursors/640fb0e74195791501fd1ed57b41487f
usr/share/icons/DMZ-White/cursors/9081237383d90e509aa00f00170e968f
usr/share/icons/DMZ-White/cursors/9d800788f1b08800ae810202380a0822
usr/share/icons/DMZ-White/cursors/X_cursor
usr/share/icons/DMZ-White/cursors/alias
usr/share/icons/DMZ-White/cursors/arrow
usr/share/icons/DMZ-White/cursors/bd_double_arrow
usr/share/icons/DMZ-White/cursors/bottom_left_corner
usr/share/icons/DMZ-White/cursors/bottom_right_corner
usr/share/icons/DMZ-White/cursors/bottom_side
usr/share/icons/DMZ-White/cursors/bottom_tee
usr/share/icons/DMZ-White/cursors/c7088f0f3e6c8088236ef8e1e3e70000
usr/share/icons/DMZ-White/cursors/circle
usr/share/icons/DMZ-White/cursors/col-resize
usr/share/icons/DMZ-White/cursors/color-picker
usr/share/icons/DMZ-White/cursors/copy
usr/share/icons/DMZ-White/cursors/cross
usr/share/icons/DMZ-White/cursors/cross_reverse
usr/share/icons/DMZ-White/cursors/crossed_circle
usr/share/icons/DMZ-White/cursors/crosshair
usr/share/icons/DMZ-White/cursors/d9ce0ab605698f320427677b458ad60b
usr/share/icons/DMZ-White/cursors/default
usr/share/icons/DMZ-White/cursors/diamond_cross
usr/share/icons/DMZ-White/cursors/dnd-ask
usr/share/icons/DMZ-White/cursors/dnd-copy
usr/share/icons/DMZ-White/cursors/dnd-link
usr/share/icons/DMZ-White/cursors/dnd-move
usr/share/icons/DMZ-White/cursors/dnd-none
usr/share/icons/DMZ-White/cursors/dot_box_mask
usr/share/icons/DMZ-White/cursors/dotbox
usr/share/icons/DMZ-White/cursors/double_arrow
usr/share/icons/DMZ-White/cursors/draft_large
usr/share/icons/DMZ-White/cursors/draft_small
usr/share/icons/DMZ-White/cursors/draped_box
usr/share/icons/DMZ-White/cursors/e-resize
usr/share/icons/DMZ-White/cursors/e29285e634086352946a0e7090d73106
usr/share/icons/DMZ-White/cursors/ew-resize
usr/share/icons/DMZ-White/cursors/fcf1c3c7cd4491d801f1e1c78f100000
usr/share/icons/DMZ-White/cursors/fd_double_arrow
usr/share/icons/DMZ-White/cursors/fleur
usr/share/icons/DMZ-White/cursors/grab
usr/share/icons/DMZ-White/cursors/grabbing
usr/share/icons/DMZ-White/cursors/h_double_arrow
usr/share/icons/DMZ-White/cursors/hand
usr/share/icons/DMZ-White/cursors/hand1
usr/share/icons/DMZ-White/cursors/hand2
usr/share/icons/DMZ-White/cursors/help
usr/share/icons/DMZ-White/cursors/icon
usr/share/icons/DMZ-White/cursors/left_ptr
usr/share/icons/DMZ-White/cursors/left_ptr_help
usr/share/icons/DMZ-White/cursors/left_ptr_watch
usr/share/icons/DMZ-White/cursors/left_side
usr/share/icons/DMZ-White/cursors/left_tee
usr/share/icons/DMZ-White/cursors/link
usr/share/icons/DMZ-White/cursors/ll_angle
usr/share/icons/DMZ-White/cursors/lr_angle
usr/share/icons/DMZ-White/cursors/move
usr/share/icons/DMZ-White/cursors/n-resize
usr/share/icons/DMZ-White/cursors/ne-resize
usr/share/icons/DMZ-White/cursors/nesw-resize
usr/share/icons/DMZ-White/cursors/not-allowed
usr/share/icons/DMZ-White/cursors/ns-resize
usr/share/icons/DMZ-White/cursors/nw-resize
usr/share/icons/DMZ-White/cursors/nwse-resize
usr/share/icons/DMZ-White/cursors/openhand
usr/share/icons/DMZ-White/cursors/pencil
usr/share/icons/DMZ-White/cursors/pirate
usr/share/icons/DMZ-White/cursors/plus
usr/share/icons/DMZ-White/cursors/pointer
usr/share/icons/DMZ-White/cursors/progress
usr/share/icons/DMZ-White/cursors/question_arrow
usr/share/icons/DMZ-White/cursors/right_ptr
usr/share/icons/DMZ-White/cursors/right_side
usr/share/icons/DMZ-White/cursors/right_tee
usr/share/icons/DMZ-White/cursors/row-resize
usr/share/icons/DMZ-White/cursors/s-resize
usr/share/icons/DMZ-White/cursors/sb_down_arrow
usr/share/icons/DMZ-White/cursors/sb_h_double_arrow
usr/share/icons/DMZ-White/cursors/sb_left_arrow
usr/share/icons/DMZ-White/cursors/sb_right_arrow
usr/share/icons/DMZ-White/cursors/sb_up_arrow
usr/share/icons/DMZ-White/cursors/sb_v_double_arrow
usr/share/icons/DMZ-White/cursors/se-resize
usr/share/icons/DMZ-White/cursors/size_bdiag
usr/share/icons/DMZ-White/cursors/size_fdiag
usr/share/icons/DMZ-White/cursors/size_hor
usr/share/icons/DMZ-White/cursors/size_ver
usr/share/icons/DMZ-White/cursors/sw-resize
usr/share/icons/DMZ-White/cursors/target
usr/share/icons/DMZ-White/cursors/tcross
usr/share/icons/DMZ-White/cursors/text
usr/share/icons/DMZ-White/cursors/top_left_arrow
usr/share/icons/DMZ-White/cursors/top_left_corner
usr/share/icons/DMZ-White/cursors/top_right_corner
usr/share/icons/DMZ-White/cursors/top_side
usr/share/icons/DMZ-White/cursors/top_tee
usr/share/icons/DMZ-White/cursors/ul_angle
usr/share/icons/DMZ-White/cursors/ur_angle
usr/share/icons/DMZ-White/cursors/v_double_arrow
usr/share/icons/DMZ-White/cursors/w-resize
usr/share/icons/DMZ-White/cursors/wait
usr/share/icons/DMZ-White/cursors/watch
usr/share/icons/DMZ-White/cursors/xterm
usr/share/licenses/
usr/share/licenses/xcursor-dmz/
usr/share/licenses/xcursor-dmz/LICENSE

View File

@ -1,86 +0,0 @@
#include "acutest.h"
#include "package.h"
void test_pkg_info_parse() {
FILE *f = fopen("./test/package/.PKGINFO", "r");
TEST_ASSERT_(f != NULL, "could not find test .PKGINFO file in ./test/package ");
fseek(f, 0L, SEEK_END);
size_t size = ftell(f);
fflush(stdout);
rewind(f);
char *pkg_info_str = malloc(size);
fread(pkg_info_str, 1, size, f);
fclose(f);
PkgInfo *pkg_info = package_info_init();
package_info_parse(pkg_info, pkg_info_str);
TEST_CHECK(!strcmp(pkg_info->name, "xcursor-dmz"));
TEST_CHECK(!strcmp(pkg_info->base, "xcursor-dmz"));
TEST_CHECK(!strcmp(pkg_info->version, "0.4.5-2"));
TEST_CHECK(!strcmp(pkg_info->description, "Style neutral, scalable cursor theme"));
TEST_CHECK(!strcmp(pkg_info->url, "https://packages.debian.org/sid/dmz-cursor-theme"));
TEST_CHECK(pkg_info->build_date == 1673751613);
TEST_CHECK(!strcmp(pkg_info->packager, "Unknown Packager"));
TEST_CHECK(pkg_info->size == 3469584);
TEST_CHECK(!strcmp(pkg_info->arch, "any"));
TEST_CHECK(!strcmp(pkg_info->licenses->array[0], "MIT"));
TEST_CHECK(!strcmp(pkg_info->replaces->array[0], "test1"));
TEST_CHECK(!strcmp(pkg_info->groups->array[0], "x11"));
TEST_CHECK(!strcmp(pkg_info->conflicts->array[0], "test2"));
TEST_CHECK(!strcmp(pkg_info->conflicts->array[1], "test3"));
TEST_CHECK(!strcmp(pkg_info->provides->array[0], "test4"));
TEST_CHECK(!strcmp(pkg_info->depends->array[0], "test5"));
TEST_CHECK(!strcmp(pkg_info->depends->array[1], "test6"));
TEST_CHECK(!strcmp(pkg_info->optdepends->array[0], "test7"));
TEST_CHECK(!strcmp(pkg_info->makedepends->array[0], "xorg-xcursorgen"));
TEST_CHECK(!strcmp(pkg_info->checkdepends->array[0], "test8"));
}
void test_pkg_read_archive_files() {
Pkg *pkg = package_read_archive("./test/package/xcursor-dmz-0.4.5-2-any.pkg.tar.zst");
TEST_ASSERT_(pkg != NULL, "failure parsing pkg archive");
FILE *f = fopen("./test/package/files", "r");
TEST_ASSERT_(f != NULL, "could not find test files file in ./test/package");
char *buff = malloc(sizeof(char) * 128);
size_t i = 0;
while ((fgets(buff, 128, f)) != NULL || i < pkg->files->size) {
if (buff[strlen(buff) - 1] == '\n') {
buff[strlen(buff) - 1] = '\0';
}
TEST_CHECK_(!strcmp(pkg->files->array[i], buff), "%s != %s", pkg->files->array[i], buff);
i++;
}
TEST_CHECK(pkg->compression = 14);
}
void test_pkg_read_archive_desc() {
Pkg *pkg = package_read_archive("./test/package/xcursor-dmz-0.4.5-2-any.pkg.tar.zst");
TEST_ASSERT_(pkg != NULL, "failure parsing pkg archive");
char *description = package_to_description(pkg);
FILE *f = fopen("./test/package/desc", "r");
TEST_ASSERT_(f != NULL, "could not find test desc file in ./test/package");
fseek(f, 0, SEEK_END);
size_t size = ftell(f);
rewind(f);
char *desc = malloc(size);
fread(desc, 1, size, f);
fclose(f);
TEST_CHECK(!strcmp(description, desc));
}
TEST_LIST = {
{"pkg_info_valid_parse", test_pkg_info_parse},
{"pkg_read_archive_files", test_pkg_read_archive_files},
{"pkg_read_archive_desc", test_pkg_read_archive_desc},
{NULL, NULL}
};