diff --git a/lib/rpm/extensions.ts b/lib/rpm/extensions.ts index 896dd0f..ac522b7 100644 --- a/lib/rpm/extensions.ts +++ b/lib/rpm/extensions.ts @@ -68,6 +68,16 @@ export async function getPackageInfo( packageInfo.version = extractString(entry.data); break; + case RpmTag.MODULARITYLABEL: + if (entry.info.type !== RpmType.STRING) { + throw new ParserError('Unexpected type for module tag', { + type: entry.info.type, + }); + } + + packageInfo.module = extractString(entry.data); + break; + default: break; } diff --git a/lib/rpm/types.ts b/lib/rpm/types.ts index ab5b3f6..86594f3 100644 --- a/lib/rpm/types.ts +++ b/lib/rpm/types.ts @@ -41,6 +41,7 @@ export interface PackageInfo { size: number; arch?: string; epoch?: number; + module?: string; } export enum RpmTag { @@ -50,6 +51,7 @@ export enum RpmTag { EPOCH = 1003, SIZE = 1009, ARCH = 1022, + MODULARITYLABEL = 5096, } export enum RpmType { diff --git a/test/README.md b/test/README.md index 33b9ab2..e0a9823 100644 --- a/test/README.md +++ b/test/README.md @@ -21,7 +21,9 @@ yum groupinstall -y "Development tools" # Use RPM to produce a list of expected outputs. # Put the output in a file under outputs/. -rpm -qa --queryformat "%{NAME}\t%{EPOCH}:%{VERSION}-%{RELEASE}\t%{SIZE}\n" | sed "s/(none)://g" | sed "s/0://g" +# The MODULARITYLABEL will include the module of the package, this will also +# need to be declared in the test. +rpm -qa --queryformat "%{MODULARITYLABEL}\t%{NAME}\t%{EPOCH}:%{VERSION}-%{RELEASE}\t%{SIZE}\n" | sed "s/(none)://g" | sed "s/0://g" # In a separate shell copy the RPM database file into fixtures/. # Make sure the file is named similarly to the one under outputs/. diff --git a/test/fixtures/modules b/test/fixtures/modules new file mode 100644 index 0000000..6522805 Binary files /dev/null and b/test/fixtures/modules differ diff --git a/test/index.test.ts b/test/index.test.ts index a53621c..93f328f 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -13,23 +13,24 @@ function fixturePath(path: string): string { } describe('Testing various RPM Berkeley databases', () => { - const fixturePaths = [ - 'amazonlinux2_plain', - 'centos6_dev_tools', - 'centos6_many', - 'centos6_plain', - 'centos7_dev_tools', - 'centos7_httpd24', - 'centos7_many', - 'centos7_plain', - 'centos7_python35', - 'fedora26_many', - 'rpm4_empty', - 'ubi7_plain', - 'ubi8_plain', + const fixtures: [string, boolean][] = [ + ['amazonlinux2_plain', false], + ['centos6_dev_tools', false], + ['centos6_many', false], + ['centos6_plain', false], + ['centos7_dev_tools', false], + ['centos7_httpd24', false], + ['centos7_many', false], + ['centos7_plain', false], + ['centos7_python35', false], + ['fedora26_many', false], + ['rpm4_empty', false], + ['ubi7_plain', false], + ['ubi8_plain', false], + ['modules', true], ]; - for (const path of fixturePaths) { + for (const [path, withModules] of fixtures) { // Create a test run for every fixture test(path, async () => { const fixture = fixturePath(`fixtures/${path}`); @@ -50,7 +51,10 @@ describe('Testing various RPM Berkeley databases', () => { expect(parserOutput.rpmMetadata!.packagesSkipped).toEqual(0); const expectedEntries = expectedOutput.trim().split('\n').sort(); - const parserEntries = formatRpmPackages(parserOutput.response).sort(); + const parserEntries = formatRpmPackages( + parserOutput.response, + withModules, + ).sort(); for (let j = 0; j < expectedEntries.length; j++) { const expectedEntry = expectedEntries[j]; @@ -78,10 +82,17 @@ describe('Testing various RPM sqlite databases', async () => { } }); -function formatRpmPackages(packages: PackageInfo[]): string[] { +function formatRpmPackages( + packages: PackageInfo[], + enableModules = false, +): string[] { return packages.map((packageInfo) => { - return `${packageInfo.name}\t${formatRpmPackageVersion(packageInfo)}\t${ - packageInfo.size - }`; + let prefix = ''; + if (enableModules) { + prefix = (packageInfo.module ? packageInfo.module : '(none)') + '\t'; + } + return `${prefix}${packageInfo.name}\t${formatRpmPackageVersion( + packageInfo, + )}\t${packageInfo.size}`; }); } diff --git a/test/outputs/modules b/test/outputs/modules new file mode 100644 index 0000000..13f162b --- /dev/null +++ b/test/outputs/modules @@ -0,0 +1,444 @@ +(none) jbig2dec-libs 0.16-1.el8 175643 +(none) python3-pip-wheel 9.0.3-19.el8 1109771 +(none) libXau 1.0.9-3.el8 114388 +(none) dnf-data 4.4.2-11.el8 38142 +(none) libdatrie 0.2.9-7.el8 98991 +(none) centos-gpg-keys 1:8-2.el8 3370 +(none) libijs 0.35-5.el8 105344 +(none) filesystem 3.8-3.el8 0 +(none) libwebp 1.0.0-5.el8 727216 +(none) bzip2 1.0.6-26.el8 178796 +(none) bash 4.4.19-14.el8 6946212 +(none) efivar-libs 37-4.el8 313304 +(none) bzip2-libs 1.0.6-26.el8 76773 +(none) libxslt 1.1.32-6.el8 833205 +(none) shared-mime-info 1.9-3.el8 2458483 +(none) libxml2 2.9.7-9.el8 1842138 +(none) which 2.21-16.el8 123918 +(none) libuuid 2.32.1-27.el8 71688 +(none) gettext 0.19.8.1-17.el8 6224833 +(none) gmp 1:6.1.2-10.el8 1561580 +(none) crypto-policies 20210617-1.gitc776d3e.el8 73128 +(none) coreutils-single 8.30-8.el8 1452865 +(none) nss-tools 3.67.0-7.el8_5 2948213 +(none) libcap-ng 0.7.9-5.el8 96030 +(none) lua 5.3.4-12.el8 663916 +(none) lz4-libs 1.8.3-2.el8 137255 +(none) git-core 2.27.0-1.el8 33884781 +(none) p11-kit 0.23.22-1.el8 1776089 +perl-libwww-perl:6.34:8030020200716155257:b967a9a2 perl-Mozilla-CA 20160104-7.module_el8.3.0+416+dee7bcef 5716 +(none) libunistring 0.9.9-3.el8 1836172 +(none) perl-Term-Cap 1.17-395.el8 29850 +(none) keyutils-libs 1.5.10-6.el8 96934 +(none) perl-podlators 4.11-1.el8 287639 +(none) p11-kit-trust 0.23.22-1.el8 544689 +(none) perl-MIME-Base64 3.15-396.el8 94459 +(none) systemd-libs 239-45.el8 4417998 +(none) perl-Socket 4:2.027-3.el8 148382 +(none) libusbx 1.0.23-4.el8 178579 +(none) perl-libs 4:5.26.3-420.el8 6005461 +(none) libdb 5.3.28-40.el8 1759432 +(none) perl-Text-Tabs+Wrap 2013.0523-395.el8 24825 +(none) libdb-utils 5.3.28-40.el8 1079511 +(none) perl-PathTools 3.74-1.el8 231741 +(none) xz 5.2.4-3.el8 537952 +(none) perl-interpreter 4:5.26.3-420.el8 15423396 +(none) libsemanage 2.9-6.el8 307808 +(none) git 2.27.0-1.el8 377031 +(none) libfdisk 2.32.1-27.el8 438394 +(none) perl-Data-Dumper 2.167-399.el8 134939 +(none) gnutls 3.6.14-7.el8_3 3000343 +(none) perl-Fedora-VSP 0.001-9.el8 40886 +(none) libmetalink 0.1.3-7.el8 76280 +(none) python3-six 1.11.0-8.el8 100282 +(none) ipcalc 0.2.4-4.el8 91945 +(none) pkgconf-m4 1.4.2-1.el8 14187 +(none) gawk 4.2.1-2.el8 3532070 +(none) elfutils-libelf-devel 0.185-1.el8 34378 +(none) libnsl2 1.2.0-2.20180605git4a062cf.el8 181962 +(none) xz-devel 5.2.4-3.el8 206470 +(none) libpwquality 1.4.4-3.el8 612520 +(none) libxcrypt-devel 4.1.1-6.el8 24771 +(none) curl 7.61.1-18.el8 733757 +(none) gcc-gdb-plugin 8.5.0-4.el8_5 406728 +(none) python3-libcomps 0.1.11-5.el8 158819 +(none) vim-filesystem 2:8.0.1763-16.el8 40 +(none) libyaml 0.1.7-5.el8 140270 +(none) qt5-srpm-macros 5.15.2-1.el8 0 +(none) gpgme 1.13.1-7.el8 1059660 +(none) libX11-common 1.6.8-5.el8 1339608 +(none) python3-hawkey 0.55.0-7.el8 381080 +(none) cairo 1.15.12-3.el8 1862364 +(none) rdma-core 32.0-4.el8 208470 +(none) libXpm 3.5.12-8.el8 112503 +(none) device-mapper 8:1.02.175-5.el8 445675 +(none) libXinerama 1.1.4-1.el8 72799 +(none) libXft 2.3.3-1.el8 173208 +(none) iputils 20180629-7.el8 562337 +(none) libXxf86vm 1.1.4-9.el8 71184 +(none) systemd-udev 239-45.el8 9155629 +(none) urw-base35-d050000l-fonts 20170801-10.el8 86572 +(none) urw-base35-nimbus-sans-fonts 20170801-10.el8 2469317 +(none) yum 4.4.2-11.el8 75707 +(none) urw-base35-fonts 20170801-10.el8 5478 +(none) vim-minimal 2:8.0.1763-15.el8 1267596 +(none) go-srpm-macros 2-17.el8 7342 +(none) rootfiles 8.1-22.el8 599 +(none) libgs 9.27-1.el8 18859659 +(none) urw-base35-fonts-common 20170801-10.el8 38217 +(none) jna 4.5.1-5.el8 467634 +(none) grub2-common 1:2.02-106.el8 5067200 +(none) gcc-c++ 8.5.0-4.el8_5 26519372 +(none) adobe-mappings-cmap-deprecated 20171205-3.el8 596942 +(none) patchutils 0.3.4-10.el8 349219 +(none) glibc 2.28-164.el8 28671676 +(none) flex 2.6.1-9.el8 934867 +(none) nspr 4.32.0-1.el8_4 431470 +(none) strace 5.7-3.el8 2357005 +(none) libxcrypt 4.1.1-6.el8 185684 +(none) lua-libs 5.3.4-12.el8 272152 +(none) rpm-libs 4.14.3-19.el8 755192 +(none) file 5.33-20.el8 137787 +(none) cups-libs 1:2.2.6-40.el8 1060532 +(none) zip 3.0-23.el8 1003933 +(none) atk 2.28.1-1.el8 1330466 +(none) cpp 8.5.0-4.el8_5 24070062 +(none) boost-thread 1.66.0-10.el8 203234 +(none) nss-softokn-freebl 3.67.0-7.el8_5 691254 +(none) boost-date-time 1.66.0-10.el8 137026 +(none) tbb 2018.2-9.el8 487454 +(none) libicu 60.3-2.el8_1 34109435 +(none) source-highlight 3.1.8-17.el8 3335995 +(none) isl 0.16.1-6.el8 3272961 +(none) python3-setuptools-wheel 39.2.0-6.el8 347720 +(none) jbigkit-libs 2.1-14.el8 186949 +(none) tzdata 2021a-1.el8 1911281 +(none) lcms2 2.9-2.el8 426665 +(none) libreport-filesystem 2.9.5-15.el8 0 +(none) libxcb 1.13.1-1.el8 2116824 +(none) hwdata 0.314-8.8.el8 8324320 +(none) gc 7.6.4-3.el8 357592 +(none) dbus-common 1:1.12.8-12.el8 11131 +(none) libthai 0.1.27-2.el8 802789 +(none) centos-linux-release 8.4-1.2105.el8 25326 +(none) libidn 1.34-5.el8 797635 +(none) setup 2.12.2-6.el8 724837 +(none) libmcpp 2.7.2-20.el8 149076 +(none) basesystem 11-5.el8 0 +(none) libpaper 1.1.24-22.el8 200915 +(none) libselinux 2.9-5.el8 206520 +(none) openjpeg2 2.4.0-4.el8 418576 +(none) zstd 1.4.4-1.el8 802863 +(none) dbus-glib 0.110-2.el8 402630 +(none) libsepol 2.9-2.el8 769328 +(none) diffutils 3.6-6.el8 1450250 +(none) xz-libs 5.2.4-3.el8 232879 +(none) libatomic 8.5.0-4.el8_5 70216 +(none) libcap 2.26-4.el8 443450 +(none) pkgconf 1.4.2-1.el8 95591 +(none) info 6.5-6.el8 434801 +(none) lksctp-tools 1.0.18-3.el8 530490 +(none) libzstd 1.4.4-1.el8 619901 +(none) os-prober 1.74-9.el8 195068 +(none) gdk-pixbuf2 2.36.12-5.el8 2803688 +(none) sqlite-libs 3.26.0-13.el8 1162161 +(none) gtk-update-icon-cache 3.22.30-8.el8 96574 +(none) ncurses-base 6.1-9.20180224.el8 290089 +(none) popt 1.18-1.el8 142778 +(none) gettext-libs 0.19.8.1-17.el8 1740088 +(none) readline 7.0-10.el8 521649 +(none) grub2-tools 1:2.02-106.el8 8513665 +(none) json-c 0.13.1-0.4.el8 73098 +(none) grubby 8.40-42.el8 115905 +(none) libacl 2.2.53-1.el8 89920 +(none) crypto-policies-scripts 20210617-1.gitc776d3e.el8 189107 +(none) libblkid 2.32.1-27.el8 405152 +(none) nss-sysinit 3.67.0-7.el8_5 71860 +(none) libmount 2.32.1-27.el8 430818 +(none) systemtap-runtime 4.5-3.el8 1697870 +(none) audit-libs 3.0-0.17.20191104git1c2f876.el8 299628 +(none) gdb-headless 8.2-16.el8 9787060 +(none) copy-jdk-configs 4.0-2.el8 19802 +(none) libgcrypt 1.8.5-4.el8 901798 +(none) openssh-clients 8.0p1-10.el8 2761444 +(none) libffi 3.1-22.el8 86100 +(none) git-core-doc 2.27.0-1.el8 12482794 +(none) gzip 1.9-12.el8 393579 +(none) perl-Pod-Escapes 1:1.07-395.el8 25763 +(none) cracklib-dicts 2.9.6-15.el8 9815016 +(none) perl-Time-Local 1:1.280-1.el8 59906 +(none) libidn2 2.2.0-1.el8 298810 +(none) perl-Term-ANSIColor 4.06-396.el8 89627 +(none) gdbm-libs 1:1.18-1.el8 190664 +(none) perl-File-Temp 0.230.600-1.el8 164723 +(none) libmnl 1.0.4-6.el8 98407 +(none) perl-HTTP-Tiny 0.074-1.el8 149162 +(none) libtasn1 4.13-3.el8 225509 +(none) perl-Pod-Perldoc 3.28-396.el8 169228 +(none) lzo 2.08-14.el8 192037 +(none) perl-Pod-Usage 4:1.69-395.el8 49721 +(none) grep 3.1-6.el8 861485 +(none) perl-Storable 1:3.11-3.el8 246142 +(none) dbus-libs 1:1.12.8-12.el8 433568 +(none) perl-Errno 1.28-420.el8 9508 +(none) dhcp-libs 12:4.3.6-44.0.1.el8 206040 +(none) perl-Encode 4:2.97-3.el8 10382023 +(none) procps-ng 3.3.15-6.el8 1717342 +(none) perl-Exporter 5.72-396.el8 55719 +(none) openssl-libs 1:1.1.1g-15.el8_3 3658800 +(none) perl-Scalar-List-Utils 3:1.49-2.el8 140768 +(none) kmod-libs 25-17.el8 163152 +(none) perl-macros 4:5.26.3-420.el8 5184 +(none) kmod 25-17.el8 284348 +(none) perl-Unicode-Normalize 1.25-396.el8 697037 +(none) libarchive 3.3.3-1.el8 797215 +(none) perl-IO 1.38-420.el8 188743 +(none) ima-evm-utils 1.3.2-12.el8 186009 +(none) perl-constant 1.33-396.el8 27104 +(none) squashfs-tools 4.3-20.el8 458989 +(none) perl-threads-shared 1.58-2.el8 106602 +(none) gdbm 1:1.18-1.el8 524977 +(none) perl-Error 1:0.17025-2.el8 71565 +(none) shadow-utils 2:4.6-12.el8 4661938 +(none) perl-Git 2.27.0-1.el8 64826 +(none) libutempter 1.1.6-14.el8 166749 +(none) perl-XML-Parser 2.44-11.el8 692343 +(none) acl 2.2.53-1.el8 335188 +(none) valgrind 1:3.17.0-5.el8 29684549 +(none) nettle 3.4.1-2.el8 604105 +(none) autoconf 2.69-29.el8 2323009 +(none) glib2 2.56.4-9.el8 12819392 +(none) automake 1.16.1-7.el8 1806113 +(none) libcomps 0.1.11-5.el8 224923 +(none) sgml-common 0.6.3-50.el8 172077 +(none) findutils 1:4.6.0-20.el8 1853177 +(none) docbook-style-xsl 1.79.2-9.el8 16312261 +(none) cpio 2.12-10.el8 1012197 +(none) python3-dateutil 1:2.6.1-6.el8 596677 +(none) libnghttp2 1.33.0-3.el8_2.1 212924 +(none) dnf-plugins-core 4.0.21-3.el8 19556 +(none) libsigsegv 2.11-5.el8 99890 +(none) pkgconf-pkg-config 1.4.2-1.el8 3095 +(none) libverto 0.3.0-5.el8 73036 +(none) zlib-devel 1.2.11-17.el8 141078 +(none) libtirpc 1.1.4-4.el8 449668 +(none) xorg-x11-fonts-ISO8859-1-100dpi 7.5-19.el8 1070824 +(none) platform-python-setuptools 39.2.0-6.el8 2930503 +(none) libzstd-devel 1.4.4-1.el8 152846 +(none) python3-libs 3.6.8-37.el8 34756350 +(none) elfutils-devel 0.185-1.el8 175369 +(none) pam 1.3.1-14.el8 5571542 +(none) glibc-headers 2.28-164.el8 1980924 +(none) libcurl-minimal 7.61.1-18.el8 539472 +(none) glibc-devel 2.28-164.el8 1291232 +(none) libsolv 0.7.16-2.el8 810523 +(none) bind-export-libs 32:9.11.26-3.el8 3069354 +(none) openldap 2.4.46-16.el8 1062660 +(none) libmodulemd 2.9.4-2.el8 590129 +(none) gnupg2 2.2.20-2.el8 10470491 +(none) librepo 1.12.0-3.el8 233224 +(none) python3-libdnf 0.55.0-7.el8 4160476 +(none) python3-gpg 1.13.1-7.el8 1440538 +(none) pciutils 3.7.0-1.el8 297302 +(none) libibverbs 32.0-4.el8 1267043 +(none) iptables-libs 1.8.4-17.el8 418416 +(none) device-mapper-libs 8:1.02.175-5.el8 456391 +(none) elfutils-default-yama-scope 0.182-3.el8 1810 +(none) systemd-pam 239-45.el8 880000 +(none) dbus 1:1.12.8-12.el8 0 +(none) dhcp-client 12:4.3.6-44.0.1.el8 546492 +(none) libkcapi-hmaccalc 1.2.0-2.el8 70765 +(none) dracut 049-135.git20210121.el8 1106345 +(none) dracut-squash 049-135.git20210121.el8 2934 +(none) dnf 4.4.2-11.el8 2085186 +(none) kexec-tools 2.0.20-46.el8 1318199 +(none) tar 2:1.30-5.el8 2900655 +(none) hostname 3.20-6.el8 92779 +(none) langpacks-en 1.0-12.el8 400 +(none) gpg-pubkey 8483c65d-5ccc5b19 0 +(none) fontpackages-filesystem 1.44-22.el8 0 +(none) emacs-filesystem 1:26.1-7.el8 0 +(none) xml-common 0.6.3-50.el8 80250 +(none) python-srpm-macros 3-41.el8 4318 +(none) adobe-mappings-cmap 20171205-3.el8 13746679 +(none) python-rpm-macros 3-41.el8 4325 +(none) glibc-common 2.28-164.el8 9476457 +(none) glibc-langpack-en 2.28-164.el8 6281419 +(none) elfutils-libelf 0.185-1.el8 1020850 +(none) nss-util 3.67.0-7.el8_5 220756 +(none) elfutils-debuginfod-client 0.185-1.el8 141309 +(none) libpng 2:1.6.34-5.el8 217912 +(none) fontconfig 2.13.1-4.el8 1251697 +(none) boost-system 1.66.0-10.el8 71178 +(none) rpm 4.14.3-19.el8 2348154 +(none) libICE 1.0.9-15.el8 239245 +(none) file-libs 5.33-20.el8 6427093 +(none) rpm-build-libs 4.14.3-19.el8 273568 +(none) avahi-libs 0.7-20.el8 233072 +(none) libcroco 0.6.12-4.el8_2.1 395827 +(none) unzip 6.0-45.el8_4 484677 +(none) libSM 1.2.3-1.el8 125723 +(none) binutils 2.30-108.el8_5.1 27524283 +(none) libtool-ltdl 2.4.6-25.el8 99570 +(none) boost-timer 1.66.0-10.el8 71114 +(none) efi-srpm-macros 3-3.el8 39223 +(none) boost-filesystem 1.66.0-10.el8 137426 +(none) openssh 8.0p1-10.el8 1967105 +(none) libbabeltrace 1.5.4-3.el8 723243 +(none) nss-softokn 3.67.0-7.el8_5 2136062 +(none) boost-atomic 1.66.0-10.el8 70122 +(none) graphite2 1.3.10-10.el8 329340 +(none) libstdc++-devel 8.5.0-4.el8_5 11558647 +(none) dyninst 11.0.0-3.el8 14197245 +(none) libasan 8.5.0-4.el8_5 1478640 +(none) boost-regex 1.66.0-10.el8 1188802 +(none) ctags 5.8-22.el8 414612 +(none) annobin 9.72-1.el8_5.2 157616 +(none) systemtap-devel 4.5-3.el8 8931000 +(none) gettext-devel 0.19.8.1-17.el8 1574221 +(none) tzdata-java 2021e-1.el8 370566 +(none) rust-srpm-macros 5-2.el8 1131 +(none) perl-srpm-macros 1-25.el8 794 +(none) ocaml-srpm-macros 5-4.el8 737 +(none) libX11 1.6.8-5.el8 1342168 +(none) libXrender 0.9.10-7.el8 76459 +(none) libXt 1.1.5-12.el8 665689 +(none) libXfixes 5.0.3-7.el8 73911 +(none) libXcursor 1.1.15-3.el8 72967 +(none) libXi 1.7.10-1.el8 74851 +(none) gd 2.2.5-7.el8 463595 +(none) libXdamage 1.1.4-14.el8 87552 +(none) pango 1.42.4-8.el8 971890 +(none) libXxf86misc 1.0.4-1.el8 84980 +(none) xorg-x11-server-utils 7.7-27.el8 1127314 +(none) urw-base35-c059-fonts 20170801-10.el8 1460348 +(none) urw-base35-gothic-fonts 20170801-10.el8 1216672 +(none) urw-base35-nimbus-roman-fonts 20170801-10.el8 1429675 +(none) urw-base35-p052-fonts 20170801-10.el8 1557171 +(none) urw-base35-z003-fonts 20170801-10.el8 400088 +(none) libXcomposite 0.4.4-14.el8 93072 +(none) gtk2 2.24.32-5.el8 13978518 +(none) ghc-srpm-macros 1.4.2-7.el8 414 +(none) adobe-mappings-pdf 20180407-1.el8 4398414 +(none) graphviz 2.40.1-43.el8 9440735 +(none) rpm-build 4.14.3-19.el8 575694 +(none) intltool 0.51.0-11.el8 173158 +(none) gdb 8.2-16.el8 363845 +(none) libtool 2.4.6-25.el8 2687364 +(none) perl-generators 1.10-9.el8 21852 +(none) perl-Sys-Syslog 0.35-397.el8 146579 +(none) bison 3.0.4-10.el8 2191470 +(none) rpm-sign 4.14.3-19.el8 71908 +(none) ltrace 0.7.91-28.el8 382506 +(none) byacc 1.9.20170709-4.el8 285798 +(none) glibc-minimal-langpack 2.28-164.el8 0 +(none) fribidi 1.0.4-8.el8 388981 +(none) libtiff 4.0.9-20.el8 607017 +(none) libatomic_ops 7.6.2-3.el8 190998 +(none) dhcp-common 12:4.3.6-44.0.1.el8 301814 +(none) libfontenc 1.1.3-8.el8 101525 +(none) centos-linux-repos 8-2.el8 26892 +(none) mcpp 2.7.2-20.el8 114906 +(none) pcre2 10.32-2.el8 701270 +(none) pixman 0.38.4-1.el8 404999 +(none) python3-dbus 1.2.4-15.el8 559701 +(none) zlib 1.2.11-17.el8 236567 +(none) libpkgconf 1.4.2-1.el8 75469 +(none) libgpg-error 1.31-1.el8 938298 +(none) make 1:4.2.1-10.el8 1468024 +(none) libcom_err 1.45.6-1.el8 114841 +(none) gdk-pixbuf2-modules 2.36.12-5.el8 947984 +(none) expat 2.2.5-4.el8 306732 +(none) ncurses-libs 6.1-9.20180224.el8 1241552 +(none) chkconfig 1.13-2.el8 867150 +(none) grub2-tools-minimal 1:2.02-106.el8 894758 +(none) libattr 2.4.48-3.el8 71978 +(none) nss 3.67.0-7.el8_5 1963839 +(none) sed 4.5-2.el8 785134 +(none) guile 5:2.0.14-7.el8 12172582 +(none) libsmartcols 2.32.1-27.el8 297322 +(none) libedit 3.1-23.20170329cvs.el8 295008 +(none) ncurses 6.1-9.20180224.el8 898572 +(none) cracklib 2.9.6-15.el8 438375 +(none) perl-IO-Socket-IP 0.39-5.el8 99525 +(none) libassuan 2.5.1-3.el8 254955 +(none) perl-Pod-Simple 1:3.35-395.el8 543719 +(none) libnl3 3.5.0-1.el8 1202560 +(none) perl-Text-ParseWords 3.30-395.el8 13101 +(none) pcre 8.42-4.el8 574195 +(none) perl-Getopt-Long 1:2.50-4.el8 139724 +(none) dbus-tools 1:1.12.8-12.el8 316479 +(none) perl-Carp 1.42-396.el8 41852 +(none) ca-certificates 2020.2.41-80.0.el8_2 949009 +(none) perl-parent 1:0.237-1.el8 9187 +(none) iproute 5.9.0-4.el8 2605407 +(none) perl-File-Path 2.15-2.el8 64920 +(none) tpm2-tss 2.3.2-3.el8 1469486 +(none) perl-threads 1:2.21-2.el8 137587 +(none) ethtool 2:5.8-5.el8 623990 +(none) perl-TermReadKey 2.37-7.el8 111030 +(none) dbus-daemon 1:1.12.8-12.el8 746544 +(none) systemtap-client 4.5-3.el8 11168231 +(none) mpfr 3.1.6-1.el8 658289 +(none) perl-Thread-Queue 3.13-1.el8 29787 +(none) snappy 1.1.8-3.el8 84711 +(none) docbook-dtds 1.0-69.el8 8665150 +(none) libksba 1.3.5-7.el8 374655 +(none) python3-dnf-plugins-core 4.0.21-3.el8 804801 +(none) libseccomp 2.5.1-1.el8 177196 +(none) xorg-x11-font-utils 1:7.5-41.el8 496450 +(none) krb5-libs 1.18.2-8.el8 2464379 +(none) elfutils-debuginfod-client-devel 0.185-1.el8 9103 +(none) platform-python 3.6.8-37.el8 98502 +(none) kernel-headers 4.18.0-348.7.1.el8_5 5210326 +(none) util-linux 2.32.1-27.el8 15193984 +(none) gcc 8.5.0-4.el8_5 49609182 +(none) gettext-common-devel 0.19.8.1-17.el8 397912 +(none) cyrus-sasl-lib 2.1.27-5.el8 929562 +(none) java-1.8.0-openjdk-headless 1:1.8.0.312.b07-2.el8_5 123790578 +(none) npth 1.5-4.el8 96773 +(none) openblas-srpm-macros 2-2.el8 104 +(none) libdnf 0.55.0-7.el8 2215315 +(none) libXext 1.3.4-1.el8 148958 +(none) pciutils-libs 3.7.0-1.el8 89155 +(none) libXmu 1.1.3-1.el8 254736 +(none) libpcap 14:1.9.1-5.el8 408890 +(none) libXrandr 1.5.2-1.el8 73826 +(none) cryptsetup-libs 2.3.3-4.el8 2107407 +(none) libXaw 1.0.13-10.el8 532333 +(none) systemd 239-45.el8 13522155 +(none) librsvg2 2.42.7-4.el8 1605615 +(none) libkcapi 1.2.0-2.el8 100763 +(none) urw-base35-bookman-fonts 20170801-10.el8 1428518 +(none) dracut-network 049-135.git20210121.el8 163228 +(none) urw-base35-nimbus-mono-ps-fonts 20170801-10.el8 1099749 +(none) python3-dnf 4.4.2-11.el8 1901285 +(none) urw-base35-standard-symbols-ps-fonts 20170801-10.el8 45184 +(none) hicolor-icon-theme 0.17-2.el8 73932 +(none) less 530-1.el8 489834 +(none) redhat-rpm-config 125-1.el8 147735 +(none) libgcc 8.5.0-4.el8_5 226496 +(none) asciidoc 8.6.10-0.5.20180627gitf7c2274.el8 808989 +(none) google-droid-sans-fonts 20120715-13.el8 6229278 +(none) systemtap 4.5-3.el8 0 +javapackages-runtime:201801:8000020190530193251:278695df javapackages-filesystem 5.3.0-1.module_el8.0.0+11+5b8c10bd 1935 +(none) valgrind-devel 1:3.17.0-5.el8 508446 +(none) python3-rpm-macros 3-41.el8 3622 +(none) pesign 0.112-25.el8 1292707 +(none) libstdc++ 8.5.0-4.el8_5 1850260 +(none) python3-rpm 4.14.3-19.el8 745725 +(none) elfutils-libs 0.185-1.el8 766479 +(none) diffstat 1.61-7.el8 90039 +(none) freetype 2.9.1-4.el8_3.1 767047 +(none) libjpeg-turbo 1.5.3-12.el8 361467 +(none) libgomp 8.5.0-4.el8_5 368423 +(none) libmpc 1.1.0-9.1.el8 151541 +(none) m4 1.4.18-7.el8 417536 +(none) boost-chrono 1.66.0-10.el8 71514 +(none) patch 2.7.6-11.el8 270217 +(none) jasper-libs 2.0.14-5.el8 419962 +(none) elfutils 0.185-1.el8 3419434 +(none) dwz 0.12-10.el8 262655 +(none) harfbuzz 1.7.5-3.el8 775298 +(none) groff-base 1.22.3-18.el8 4465306 +(none) libubsan 8.5.0-4.el8_5 352864 diff --git a/test/unit/rpm/extensions.test.ts b/test/unit/rpm/extensions.test.ts index df2aaad..981e4e6 100644 --- a/test/unit/rpm/extensions.test.ts +++ b/test/unit/rpm/extensions.test.ts @@ -7,6 +7,7 @@ describe('getPackageInfo()', () => { const name = 'package\0'; const release = 'rel\0'; const version = '1.2.3\0'; + const module = 'perl-libwww-perl:6.34:8030020200716155257:b967a9a2\0'; const size = [0x00, 0x00, 0x00, 0x01]; // 1 in Big Endian const nameEntry = { @@ -49,18 +50,30 @@ describe('getPackageInfo()', () => { data: Buffer.from(size), length: 0, }; + const moduleEntry = { + info: { + tag: RpmTag.MODULARITYLABEL, + type: RpmType.STRING, + count: 0, + offset: 0, + }, + data: Buffer.from(module), + length: 0, + }; const packageEntries: IndexEntry[] = [ nameEntry, releaseEntry, versionEntry, sizeEntry, + moduleEntry, ]; await expect(getPackageInfo(packageEntries)).resolves.toEqual({ name: 'package', release: 'rel', version: '1.2.3', + module: 'perl-libwww-perl:6.34:8030020200716155257:b967a9a2', size: 1, }); });