<commit_before># ipkg-lib.pl
# Functions for synology IPKG package management

use POSIX;
chop($system_arch = `uname -m`);
$package_dir = "/var/db/pkg";
$has_update_system = 1;
$no_package_install = 1;
$no_package_filesearch =1;

sub list_package_system_commands
{
return ("ipkg");
}

# list_packages([package]*)
# Fills the array %packages with a list of all packages
# e.g. man - 1.6g-1 - unix manual page reader
sub list_packages
{
local $i = 0;
local $arg = @_ ? join(" ", map { quotemeta($_) } @_) : "-a";
%packages = ( );
&open_execute_command(PKGINFO, "ipkg list $arg", 1, 1);
while(<PKGINFO>) {
	if (/^(\S+) - (\S+) - (.*)/) {
		$packages{$i,'name'} = $1;
		$packages{$i,'version'} = "$2";
		$packages{$i,'class'} = "";
		$packages{$i,'desc'} = $3;
		$i++;
		}
	}
close(PKGINFO);
return $i;
}

# package_info(package)
# Returns an array of package information in the order
#  name, class, description, arch, version, vendor, installtime
sub package_info
{
local $qm = quotemeta($_[0]);
local $out = &backquote_command("ipkg info $_[0] 2>&1", 1);
return () if ($?);
local @rv = ( $_[0] );
push(@rv, "");
push(@rv, $out =~ /Description:\n([\0-\177]*\S)/i ? $1 : $text{'bsd_unknown'});
push(@rv, $system_arch);
push(@rv, $_[0] =~ /-([^\-]+)$/ ? $1 : $text{'bsd_unknown'});
push(@rv, "OpenBSD");
local @st = stat(&translate_filename("$package_dir/$_[0]"));
push(@rv, @st ? ctime($st[9]) : $text{'bsd_unknown'});
return @rv;<commit_msg>first working version of ipkg package mananger<commit_after># ipkg-lib.pl
# Functions for synology IPKG package management

use POSIX;
chop($system_arch = `uname -m`);
$package_dir = "/var/db/pkg";
$has_update_system = 1;
$no_package_install = 1;
$no_package_filesearch =1;

sub list_package_system_commands
{
return ("ipkg");
}

# list_packages([package]*)
# Fills the array %packages with a list of all packages
# e.g. man - 1.6g-1 - unix manual page reader
sub list_packages
{
local $i = 0;
local $arg = join(" ", map { quotemeta($_) } @_);
%packages = ( );
&open_execute_command(PKGINFO, "ipkg list $arg", 1, 1);
while(<PKGINFO>) {
	if (/^(.+?) - (.+?) - (.*)/) {
		local $desc = $3;
		$packages{$i,'name'} = $1;
		$packages{$i,'version'} = "$2";
		$packages{$i,'desc'} = $desc;

		# generate categories from names, lib and x
		$1 =~ m/^([^-0-9]*)/;
		local $cat= $1;
		if ($cat =~ m/^(lib)/i) {
			$cat=$1;
		} elsif ($cat =~ /^x/ && $desc =~ /X |Xorg|X11|XDMCP|Xinerama|Athena/) {
			$cat = "x11";
		}
		$packages{$i,'class'} = $cat; 
		$i++;
		}
	}
close(PKGINFO);
return $i;
}

# package_info(package)
# Returns an array of package information in the order
#  name, class, description, arch, version, vendor, installtime
sub package_info
{
local $qm = quotemeta($_[0]);
local $out = &backquote_command("ipkg info $_[0] 2>&1", 1);
return () if ($?);
local @rv = ( $_[0] );
push(@rv, $out =~ /Section: (.+)/i);
push(@rv, $out =~ /Description: (.+)/i ? $1 : $text{'bsd_unknown'});
push(@rv, $out =~ /Architecture: (.+)/i );
push(@rv, $out =~ /Version: (.+)/i );
push(@rv, $out =~ /Maintainer: (.+)/i);
push(@rv, $out =~ /Installed-Time: (.+)/i ? ctime($out =~ /Installed-Time: (.+)/i) : "not installed");
push(@rv, $out =~ /Installed-Time: (.+)/i ? "" : false);
push(@rv, false);
return @rv;
{'fraction_non_alphanumeric': 0.23678516228748067, 'fraction_numerical': 0.017001545595054096, 'mean_word_length': 4.411371237458194, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '878802', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1285, 'n_words': 313}