Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package createrepo_c for openSUSE:Factory checked in at 2025-04-20 09:34:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/createrepo_c (Old) and /work/SRC/openSUSE:Factory/.createrepo_c.new.30101 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "createrepo_c" Sun Apr 20 09:34:40 2025 rev:24 rq:1270949 version:1.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/createrepo_c/createrepo_c.changes 2024-08-27 19:38:18.669879324 +0200 +++ /work/SRC/openSUSE:Factory/.createrepo_c.new.30101/createrepo_c.changes 2025-04-20 19:50:56.146295011 +0200 @@ -1,0 +2,8 @@ +Sat Apr 19 07:41:03 UTC 2025 - Andreas Stieger <andreas.stie...@gmx.de> + +- update to 1.2.1: + * Fix a file descriptor and memory leak in an error path of cr_detect_compression() + * Allow incremental parsing without filelists or other xml +- fix build with cmake 4 boo#1239788 createrepo_c-1.2.1-cmake4.patch + +------------------------------------------------------------------- Old: ---- createrepo_c-1.1.0.tar.gz New: ---- createrepo_c-1.2.1-cmake4.patch createrepo_c-1.2.1.tar.gz BETA DEBUG BEGIN: New: * Allow incremental parsing without filelists or other xml - fix build with cmake 4 boo#1239788 createrepo_c-1.2.1-cmake4.patch BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ createrepo_c.spec ++++++ --- /var/tmp/diff_new_pack.htewY0/_old 2025-04-20 19:50:57.910368426 +0200 +++ /var/tmp/diff_new_pack.htewY0/_new 2025-04-20 19:50:57.922368925 +0200 @@ -3,6 +3,7 @@ # # Copyright (c) 2024 SUSE LLC # Copyright (c) 2022 Neal Gompa <ngomp...@gmail.com>. +# Copyright (c) 2025 Andreas Stieger <andreas.stie...@gmx.de> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +18,6 @@ # -%{!?make_build: %global make_build make %{?_smp_mflags}} %define major 1 %define libname lib%{name}%{major} %define devname lib%{name}-devel @@ -45,15 +45,18 @@ %bcond_without as_createrepo %endif Name: createrepo_c -Version: 1.1.0 +Version: 1.2.1 Release: 0 Summary: RPM repository metadata generation utility License: GPL-2.0-or-later Group: System/Packages URL: https://github.com/rpm-software-management/createrepo_c Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +# part of https://github.com/rpm-software-management/createrepo_c/pull/438 +# accidentally also fixes boo#1239788 +Patch0: createrepo_c-1.2.1-cmake4.patch BuildRequires: bash-completion -BuildRequires: cmake +BuildRequires: cmake >= 3.7.0 BuildRequires: doxygen BuildRequires: fdupes BuildRequires: git-core @@ -214,8 +217,7 @@ fi %endif -%post -n %{libname} -p /sbin/ldconfig -%postun -n %{libname} -p /sbin/ldconfig +%ldconfig_scriptlets -n %{libname} %files %doc README.md ++++++ createrepo_c-1.2.1-cmake4.patch ++++++ From: Andreas Stieger <andreas.stie...@gmx.de> Date: Sat, 19 Apr 2025 07:40:16 +0000 Subject: [PATCH] fix build with cmake 4 References: https://bugzilla.opensuse.org/show_bug.cgi?id=1239788 This is part of an upstream change that fixed the build with cmake 4 as a side-effect. https://github.com/rpm-software-management/createrepo_c/pull/438 https://github.com/rpm-software-management/createrepo_c/commit/89fa02828cdaf1c710c38bde5fcbcf59538a9cce diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a18393f..c4bf5252 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12) +CMAKE_MINIMUM_REQUIRED (VERSION 3.7) PROJECT (createrepo_c C) include(GNUInstallDirs) ++++++ createrepo_c-1.1.0.tar.gz -> createrepo_c-1.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/.github/workflows/release-python.yml new/createrepo_c-1.2.1/.github/workflows/release-python.yml --- old/createrepo_c-1.1.0/.github/workflows/release-python.yml 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/.github/workflows/release-python.yml 2025-03-17 08:14:47.000000000 +0100 @@ -29,7 +29,7 @@ pip install dist/*.tar.gz pytest --verbose --color=yes tests/python/tests/ - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: dist/*.tar.gz @@ -40,10 +40,8 @@ matrix: include: - arch: auto64 # native 64-bit - skip: "pp* *-musllinux_* cp36* cp37* cp38*" # no PyPy or musl builds, no older Python versions - arch: aarch64 - skip: "pp* *-musllinux_* cp36* cp37* cp38* cp310* cp312*" # qemu builds are incredibly slow, so only do 3.9 and 3.11 - # TODO: when github actions gets native aarch64 runners, we can ditch qemu and not worry about the emulation performance + # TODO: when github actions gets native aarch64 runners, ditch qemu, it will be much faster steps: - uses: actions/checkout@v4 @@ -61,10 +59,10 @@ platforms: arm64 - name: Build wheels for CPython - uses: pypa/cibuildwheel@v2.16.5 + uses: pypa/cibuildwheel@v2.22.0 env: CIBW_ARCHS: ${{ matrix.arch }} - CIBW_SKIP: ${{ matrix.skip }} + CIBW_SKIP: "pp* *-musllinux_* cp36* cp37* cp38*" # no PyPy or musl builds, no older Python versions CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 # alma 8 CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 CIBW_BEFORE_ALL_LINUX: dnf -y install epel-release && yes | dnf -y builddep createrepo_c.spec @@ -73,7 +71,7 @@ CIBW_TEST_COMMAND: | pytest --verbose --color=yes {project}/tests/python/tests/ - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl @@ -84,12 +82,12 @@ needs: [build_bdist, build_sdist] runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: artifact path: dist - - uses: pypa/gh-action-pypi-publish@v1.8.11 + - uses: pypa/gh-action-pypi-publish@v1.12.3 with: user: __token__ password: ${{secrets.PYPI_API_TOKEN}} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/.gitignore new/createrepo_c-1.2.1/.gitignore --- old/createrepo_c-1.1.0/.gitignore 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/.gitignore 2025-03-17 08:14:47.000000000 +0100 @@ -8,6 +8,7 @@ # Packages and tarball createrepo*.rpm python-createrepo*.rpm +python3-createrepo*.rpm createrepo_c-*.tar.xz # Makefile generated files diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/.packit.yaml new/createrepo_c-1.2.1/.packit.yaml --- old/createrepo_c-1.1.0/.packit.yaml 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/.packit.yaml 2025-03-17 08:14:47.000000000 +0100 @@ -8,3 +8,12 @@ trigger: pull_request targets: - fedora-all + - job: tests + trigger: pull_request + identifier: "createrepo_c-tests" + targets: + - fedora-all + fmf_url: https://github.com/rpm-software-management/ci-dnf-stack.git + fmf_ref: enable-tmt-dnf-4-stack + tmt_plan: "^/plans/integration/behave-createrepo_c$" + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/VERSION.cmake new/createrepo_c-1.2.1/VERSION.cmake --- old/createrepo_c-1.1.0/VERSION.cmake 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/VERSION.cmake 2025-03-17 08:14:47.000000000 +0100 @@ -1,3 +1,3 @@ SET(CR_MAJOR "1") -SET(CR_MINOR "1") -SET(CR_PATCH "0") +SET(CR_MINOR "2") +SET(CR_PATCH "1") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/createrepo_c.spec new/createrepo_c-1.2.1/createrepo_c.spec --- old/createrepo_c-1.1.0/createrepo_c.spec 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/createrepo_c.spec 2025-03-17 08:14:47.000000000 +0100 @@ -32,9 +32,15 @@ %bcond_with sanitizers +%if %{defined gitrev} +%define package_version %{?gitrev} +%else +%define package_version 1.2.1 +%endif + Summary: Creates a common metadata repository Name: createrepo_c -Version: 1.1.0 +Version: %{package_version} Release: 1%{?dist} License: GPL-2.0-or-later URL: https://github.com/rpm-software-management/createrepo_c @@ -127,7 +133,7 @@ %prep %autosetup -p1 - +%py3_shebang_fix examples/python mkdir build-py3 %build @@ -202,7 +208,8 @@ %{_includedir}/%{name}/ %files -n python3-%{name} +%doc examples/python/* %{python3_sitearch}/%{name}/ -%{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info +%{python3_sitearch}/%{name}-*-py%{python3_version}.egg-info %changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/doc/createrepo_c.8 new/createrepo_c-1.2.1/doc/createrepo_c.8 --- old/createrepo_c-1.1.0/doc/createrepo_c.8 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/doc/createrepo_c.8 2025-03-17 08:14:47.000000000 +0100 @@ -90,7 +90,7 @@ Minify the generated xml content. On average this reduces compressed size by 2%. .SS \-d \-\-database .sp -Generate sqlite databases for use with yum. +DEPRECATED: Generate sqlite databases for use with yum. .SS \-\-no\-database .sp Do not generate sqlite databases in the repository. @@ -182,7 +182,7 @@ Discard all additional metadata (not primary, filelists and other xml or sqlite files, nor their compressed variants) from source repository during update. .SS \-\-compatibility .sp -Enforce maximal compatibility with classical createrepo (Changes \-\-retain\-old\-md behavior, uses Gzip for compression). +Enforce maximal compatibility with classical createrepo (Changes \-\-retain\-old\-md behavior, defaults to Gzip for compression). .SS \-\-retain\-old\-md\-by\-age AGE .sp During \-\-update, remove all files in repodata/ which are older then the specified period of time. (e.g. \(aq2h\(aq, \(aq30d\(aq, ...). Available units (m \- minutes, h \- hours, d \- days) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/setup.py new/createrepo_c-1.2.1/setup.py --- old/createrepo_c-1.1.0/setup.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/setup.py 2025-03-17 08:14:47.000000000 +0100 @@ -46,7 +46,6 @@ '-DENABLE_BASHCOMP:BOOL=OFF', '-DENABLE_DRPM:BOOL=OFF', '-DWITH_ZCHUNK:BOOL=OFF', - '-DWITH_LEGACY_HASHES:BOOL=ON', ], cmake_languages=['C'], entry_points={ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/src/cmd_parser.c new/createrepo_c-1.2.1/src/cmd_parser.c --- old/createrepo_c-1.1.0/src/cmd_parser.c 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/src/cmd_parser.c 2025-03-17 08:14:47.000000000 +0100 @@ -119,7 +119,7 @@ { "no-pretty", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &(_cmd_options.pretty), "No extra indentation in generated xml", NULL }, { "database", 'd', 0, G_OPTION_ARG_NONE, &(_cmd_options.database), - "Generate sqlite databases for use with yum.", NULL }, + "DEPRECATED: Generate sqlite databases for use with yum.", NULL }, { "no-database", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.no_database), "Do not generate sqlite databases in the repository (default).", NULL }, { "filelists-ext", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.filelists_ext), @@ -204,7 +204,7 @@ "Discard all additional metadata (not primary, filelists and other xml or sqlite files, " "nor their compressed variants) from source repository during update.", NULL }, { "compatibility", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.compatibility), - "Enforce maximal compatibility with classical createrepo and yum (Changes --retain-old-md behavior, uses Gzip for compression, produces sqlite metadata by default, leaves group metadata uncompressed).", NULL }, + "Enforce maximal compatibility with classical createrepo and yum (Changes --retain-old-md behavior, defaults to Gzip for compression, produces sqlite metadata by default, leaves group metadata uncompressed).", NULL }, { "retain-old-md-by-age", 0, 0, G_OPTION_ARG_STRING, &(_cmd_options.retain_old_md_by_age), "During --update, remove all files in repodata/ which are older " "then the specified period of time. (e.g. '2h', '30d', ...). " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/src/compression_wrapper.c new/createrepo_c-1.2.1/src/compression_wrapper.c --- old/createrepo_c-1.1.0/src/compression_wrapper.c 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/src/compression_wrapper.c 2025-03-17 08:14:47.000000000 +0100 @@ -190,13 +190,13 @@ } size_t bytesRead = fread(magic, 1, sizeof(magic), file); + fclose(file); if (bytesRead != sizeof(magic)) { // Assume that if there's less than 5 bytes in the file, it's uncompressed g_debug("%s: Unable to read bytes from file for magic number detection, assuming uncompressed (%s)", __func__, filename); return CR_CW_NO_COMPRESSION; } - fclose(file); if (!memcmp(magic, "\x1F\x8B", 2)) { return CR_CW_GZ_COMPRESSION; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/src/parsehdr.c new/createrepo_c-1.2.1/src/parsehdr.c --- old/createrepo_c-1.1.0/src/parsehdr.c 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/src/parsehdr.c 2025-03-17 08:14:47.000000000 +0100 @@ -425,6 +425,8 @@ // Calculate pre value if (num_flags & (RPMSENSE_PREREQ | RPMSENSE_SCRIPT_PRE | + RPMSENSE_POSTTRANS | + RPMSENSE_PRETRANS | RPMSENSE_SCRIPT_POST)) { pre = 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/src/python/createrepo_c/__init__.py new/createrepo_c-1.2.1/src/python/createrepo_c/__init__.py --- old/createrepo_c-1.1.0/src/python/createrepo_c/__init__.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/src/python/createrepo_c/__init__.py 2025-03-17 08:14:47.000000000 +0100 @@ -416,8 +416,8 @@ metadata_files = {record.type: record for record in repomd.records} parser = RepositoryReader() parser._primary_xml_path = os.path.join(path, metadata_files["primary"].location_href) - parser._filelists_xml_path = os.path.join(path, metadata_files["filelists"].location_href) - parser._other_xml_path = os.path.join(path, metadata_files["other"].location_href) + parser._filelists_xml_path = os.path.join(path, metadata_files["filelists"].location_href) if metadata_files.get("filelists") else None + parser._other_xml_path = os.path.join(path, metadata_files["other"].location_href) if metadata_files.get("other") else None if metadata_files.get("updateinfo"): parser._updateinfo_path = os.path.join(path, metadata_files["updateinfo"].location_href) @@ -680,7 +680,10 @@ compress_file(path, str(dst), self._compression) self.additional_metadata_files[name] = dst else: - path = shutil.copy2(path, self.repodata_dir) + try: + path = shutil.copy2(path, self.repodata_dir) + except shutil.SameFileError: + pass self.additional_metadata_files[name] = path def add_update_record(self, rec): @@ -711,10 +714,8 @@ if self._updaterecords: upd_xml_path = self.repodata_dir / ("updateinfo.xml" + self._compression_suffix) writer = UpdateInfoXmlFile(str(upd_xml_path), compressiontype=self._compression) - updateinfo = UpdateInfo() for rec in self._updaterecords: - updateinfo.append(rec) - writer.add_chunk(updateinfo.xml_dump()) + writer.add_chunk(_createrepo_c.xml_dump_updaterecord(rec)) self.working_metadata_files["updateinfo"] = MetadataInfoHolder(upd_xml_path, writer) # Create all the repomdrecords for the standard metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/src/python/xml_parser-py.c new/createrepo_c-1.2.1/src/python/xml_parser-py.c --- old/createrepo_c-1.1.0/src/python/xml_parser-py.c 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/src/python/xml_parser-py.c 2025-03-17 08:14:47.000000000 +0100 @@ -780,14 +780,14 @@ static char *kwlist[] = {"primary", "filelists", "other", "newpkgcb", "warningcb", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sssOO:pkg_iterator_init", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "szzOO:pkg_iterator_init", kwlist, &primary_path, &filelists_path, &other_path, &py_newpkgcb, &py_warningcb)) { return -1; } - if (!primary_path || !filelists_path || !other_path) { - PyErr_SetString(PyExc_TypeError, "file paths must be provided"); + if (!primary_path) { + PyErr_SetString(PyExc_TypeError, "primary file path must be provided"); return -1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/src/xml_parser_main_metadata_together.c new/createrepo_c-1.2.1/src/xml_parser_main_metadata_together.c --- old/createrepo_c-1.1.0/src/xml_parser_main_metadata_together.c 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/src/xml_parser_main_metadata_together.c 2025-03-17 08:14:47.000000000 +0100 @@ -31,15 +31,16 @@ #define ERR_DOMAIN CREATEREPO_C_ERROR typedef struct { - GSList *in_progress_pkgs_list; - int in_progress_count_primary; - int in_progress_count_filelists; - int in_progress_count_other; - GQueue *finished_pkgs_queue; - cr_XmlParserNewPkgCb newpkgcb; // newpkgcb passed in from user - void *newpkgcb_data;// newpkgcb data passed in from user - cr_XmlParserPkgCb pkgcb; // pkgcb passed in from user - void *pkgcb_data; // pkgcb data passed in from user + GSList *in_progress_pkgs_list; + int in_progress_count_primary; + int in_progress_count_filelists; + int in_progress_count_other; + GQueue *finished_pkgs_queue; + cr_XmlParserNewPkgCb newpkgcb; // newpkgcb passed in from user + void *newpkgcb_data;// newpkgcb data passed in from user + cr_XmlParserPkgCb pkgcb; // pkgcb passed in from user + void *pkgcb_data; // pkgcb data passed in from user + cr_PackageLoadingFlags loadingflags; // which callbacks need to be called before the package is considered "finished" loading } cr_CbData; struct _cr_PkgIterator { @@ -67,17 +68,19 @@ static int queue_package_if_finished(cr_Package *pkg, cr_CbData *cb_data) { - if (pkg && (pkg->loadingflags & CR_PACKAGE_LOADED_PRI) && (pkg->loadingflags & CR_PACKAGE_LOADED_OTH) && - (pkg->loadingflags & CR_PACKAGE_LOADED_FIL)) + if (pkg && ((pkg->loadingflags & cb_data->loadingflags) == cb_data->loadingflags)) { //remove first element in the list cb_data->in_progress_pkgs_list = g_slist_delete_link(cb_data->in_progress_pkgs_list, cb_data->in_progress_pkgs_list); // One package was fully finished cb_data->in_progress_count_primary--; - cb_data->in_progress_count_filelists--; - cb_data->in_progress_count_other--; - + if (cb_data->loadingflags & CR_PACKAGE_LOADED_FIL) { + cb_data->in_progress_count_filelists--; + } + if (cb_data->loadingflags & CR_PACKAGE_LOADED_OTH) { + cb_data->in_progress_count_other--; + } g_queue_push_tail(cb_data->finished_pkgs_queue, pkg); } return CR_CB_RET_OK; @@ -319,8 +322,6 @@ //TODO(amatej): there is quite some overlap with this and cr_load_xml_files, // consider using this api to implement cr_load_xml_files? -// TODO: maybe whether or not individual files are parsed could be controlled by NULL paths? I think cr_load_xml_files -// already works that way. cr_PkgIterator * cr_PkgIterator_new(const char *primary_path, const char *filelists_path, @@ -332,8 +333,6 @@ GError **err) { assert(primary_path); - assert(filelists_path); - assert(other_path); assert(!err || *err == NULL); cr_PkgIterator* new_iter = g_new0(cr_PkgIterator, 1); @@ -370,30 +369,41 @@ cbdata->newpkgcb_data = newpkgcb_data; new_iter->tmp_err = NULL; + int parse_files_in_primary = 0; GError* tmp_err = new_iter->tmp_err; new_iter->primary_f = cr_open(primary_path, CR_CW_MODE_READ, CR_CW_AUTO_DETECT_COMPRESSION, &tmp_err); + cbdata->loadingflags |= CR_PACKAGE_LOADED_PRI; if (tmp_err) { g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", primary_path); cr_PkgIterator_free(new_iter, err); return NULL; } - new_iter->filelists_f = cr_open(filelists_path, CR_CW_MODE_READ, CR_CW_AUTO_DETECT_COMPRESSION, &tmp_err); - if (tmp_err) { - g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", filelists_path); - cr_PkgIterator_free(new_iter, err); - return NULL; + if (new_iter->filelists_path) { + new_iter->filelists_f = cr_open(filelists_path, CR_CW_MODE_READ, CR_CW_AUTO_DETECT_COMPRESSION, &tmp_err); + cbdata->loadingflags |= CR_PACKAGE_LOADED_FIL; + if (tmp_err) { + g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", filelists_path); + cr_PkgIterator_free(new_iter, err); + return NULL; + } + } else { + new_iter->filelists_is_done = 1; + parse_files_in_primary = 1; } - new_iter->other_f = cr_open(other_path, CR_CW_MODE_READ, CR_CW_AUTO_DETECT_COMPRESSION, &tmp_err); - if (tmp_err) { - g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", other_path); - cr_PkgIterator_free(new_iter, err); - return NULL; + if (new_iter->other_path) { + new_iter->other_f = cr_open(other_path, CR_CW_MODE_READ, CR_CW_AUTO_DETECT_COMPRESSION, &tmp_err); + cbdata->loadingflags |= CR_PACKAGE_LOADED_OTH; + if (tmp_err) { + g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", other_path); + cr_PkgIterator_free(new_iter, err); + return NULL; + } + } else { + new_iter->other_is_done = 1; } - //TODO(amatej): In the future we could make filelists/other optional if there is a need for it. That would mean we - // should replace the last 0 in primary_parser_data_new depending on whether we have filelists or not. - new_iter->primary_pd = primary_parser_data_new(newpkgcb_primary, cbdata, pkgcb_primary, cbdata, warningcb, warningcb_data, 0); + new_iter->primary_pd = primary_parser_data_new(newpkgcb_primary, cbdata, pkgcb_primary, cbdata, warningcb, warningcb_data, parse_files_in_primary); new_iter->filelists_pd = filelists_parser_data_new(newpkgcb_filelists, cbdata, pkgcb_filelists, cbdata, warningcb, warningcb_data); new_iter->other_pd = other_parser_data_new(newpkgcb_other, cbdata, pkgcb_other, cbdata, warningcb, warningcb_data); return new_iter; @@ -404,9 +414,7 @@ cr_CbData *cbdata = (cr_CbData*) iter->cbdata; while (!cr_PkgIterator_is_finished(iter) && g_queue_is_empty(cbdata->finished_pkgs_queue)) { - while ((cbdata->in_progress_count_primary <= cbdata->in_progress_count_filelists || - cbdata->in_progress_count_primary <= cbdata->in_progress_count_other) && - !iter->primary_is_done) + if (!iter->primary_is_done) { iter->primary_is_done = parse_next_section(iter->primary_f, iter->primary_path, iter->primary_pd, err); if (*err) { @@ -414,9 +422,7 @@ } } - while ((cbdata->in_progress_count_filelists <= cbdata->in_progress_count_primary || - cbdata->in_progress_count_filelists <= cbdata->in_progress_count_other) && - !iter->filelists_is_done) + while (cbdata->in_progress_count_filelists <= cbdata->in_progress_count_primary && !iter->filelists_is_done) { iter->filelists_is_done = parse_next_section(iter->filelists_f, iter->filelists_path, iter->filelists_pd, err); if (*err) { @@ -424,9 +430,7 @@ } } - while ((cbdata->in_progress_count_other <= cbdata->in_progress_count_filelists || - cbdata->in_progress_count_other <= cbdata->in_progress_count_primary) && - !iter->other_is_done) + while (cbdata->in_progress_count_other <= cbdata->in_progress_count_primary && !iter->other_is_done) { iter->other_is_done = parse_next_section(iter->other_f, iter->other_path, iter->other_pd, err); if (*err) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/python/tests/test_contentstat.py new/createrepo_c-1.2.1/tests/python/tests/test_contentstat.py --- old/createrepo_c-1.1.0/tests/python/tests/test_contentstat.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/python/tests/test_contentstat.py 2025-03-17 08:14:47.000000000 +0100 @@ -38,10 +38,10 @@ self.assertTrue(os.path.isfile(path)) - self.assertEqual(cs.size, 2668) + self.assertEqual(cs.size, 2805) self.assertEqual(cs.checksum_type, cr.SHA256) - self.assertEqual(cs.checksum, "67bc6282915fad80dc11f3d7c3210977a0bde"\ - "05a762256d86083c2447d425776") + self.assertEqual(cs.checksum, "d447983b39363a6519067ce477a7fc64409b4"\ + "900e0160da68d66b25207a0408d") def test_contentstat_ref_in_xmlfile(self): """Test if reference is saved properly""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/python/tests/test_misc.py new/createrepo_c-1.2.1/tests/python/tests/test_misc.py --- old/createrepo_c-1.1.0/tests/python/tests/test_misc.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/python/tests/test_misc.py 2025-03-17 08:14:47.000000000 +0100 @@ -21,8 +21,7 @@ def test_compress_file(self): # Non exist file - self.assertRaises(IOError, cr.compress_file, - self.nofile, None, cr.BZ2) + self.assertRaises(IOError, cr.compress_file, self.nofile, None, cr.BZ2) # Compression - use the same name+suffix cr.compress_file(self.tmpfile, None, cr.BZ2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/python/tests/test_package.py new/createrepo_c-1.2.1/tests/python/tests/test_package.py --- old/createrepo_c-1.1.0/tests/python/tests/test_package.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/python/tests/test_package.py 2025-03-17 08:14:47.000000000 +0100 @@ -53,7 +53,7 @@ def test_package_archer(self): pkg = cr.package_from_rpm(PKG_ARCHER_PATH) self.assertTrue(pkg) - self.assertEqual(pkg.pkgId, "4e0b775220c67f0f2c1fd2177e626b9c863a098130224ff09778ede25cea9a9e") + self.assertEqual(pkg.pkgId, "65dd4d39b7539cb0b6b150db20a314402845e006cc0456d910bce87741f81b82") self.assertEqual(pkg.name, "Archer") self.assertEqual(pkg.arch, "x86_64") self.assertEqual(pkg.version, "3.4.5") @@ -63,16 +63,16 @@ self.assertEqual(pkg.description, "Archer package") self.assertEqual(pkg.url, "http://soo_complex_package.eu/") #self.assertEqual(pkg.time_file, 1365416502) - self.assertEqual(pkg.time_build, 1365416480) + self.assertEqual(pkg.time_build, 1710742930) self.assertEqual(pkg.rpm_license, "GPL") self.assertEqual(pkg.rpm_vendor, "ISIS") self.assertEqual(pkg.rpm_group, "Development/Tools") self.assertEqual(pkg.rpm_buildhost, "localhost.localdomain") self.assertEqual(pkg.rpm_sourcerpm, "Archer-3.4.5-6.src.rpm") - self.assertEqual(pkg.rpm_header_start, 280) - self.assertEqual(pkg.rpm_header_end, 2865) + self.assertEqual(pkg.rpm_header_start, 4504) + self.assertEqual(pkg.rpm_header_end, 7517) self.assertEqual(pkg.rpm_packager, "Sterling Archer") - self.assertEqual(pkg.size_package, 3101) + self.assertEqual(pkg.size_package, 7737) self.assertEqual(pkg.size_installed, 0) self.assertEqual(pkg.size_archive, 544) self.assertEqual(pkg.location_href, None) @@ -85,16 +85,18 @@ ('fooc', 'EQ', '0', '3', None, False), ('food', 'LT', '0', '4', None, False), ('fooe', 'GT', '0', '5', None, False), - ('foof', 'EQ', '0', '6', None, True) + ('foof', 'EQ', '0', '6', None, True), + ('foog', 'EQ', '0', '7', None, True), + ('fooh', 'EQ', '0', '8', None, True) ]) self.assertEqual(pkg.provides, [ + ('Archer', 'EQ', '2', '3.4.5', '6', False), + ('Archer(x86-64)', 'EQ', '2', '3.4.5', '6', False), ('bara', 'LE', '0', '22', None, False), ('barb', 'GE', '0', '11.22.33', '44', False), ('barc', 'EQ', '0', '33', None, False), ('bard', 'LT', '0', '44', None, False), - ('bare', 'GT', '0', '55', None, False), - ('Archer', 'EQ', '2', '3.4.5', '6', False), - ('Archer(x86-64)', 'EQ', '2', '3.4.5', '6', False) + ('bare', 'GT', '0', '55', None, False) ]) self.assertEqual(pkg.conflicts, [ ('bba', 'LE', '0', '2222', None, False), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/python/tests/test_parsepkg.py new/createrepo_c-1.2.1/tests/python/tests/test_parsepkg.py --- old/createrepo_c-1.1.0/tests/python/tests/test_parsepkg.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/python/tests/test_parsepkg.py 2025-03-17 08:14:47.000000000 +0100 @@ -53,8 +53,8 @@ self.assertTrue(xml) self.assertTrue(len(xml) == 3) self.assertTrue("<name>Archer</name>" in xml[0]) - self.assertTrue('<package pkgid="4e0b775220c67f0f2c1fd2177e626b9c863a098130224ff09778ede25cea9a9e" name="Archer" arch="x86_64">' in xml[1]) - self.assertTrue('<package pkgid="4e0b775220c67f0f2c1fd2177e626b9c863a098130224ff09778ede25cea9a9e" name="Archer" arch="x86_64">' in xml[2]) + self.assertTrue('<package pkgid="65dd4d39b7539cb0b6b150db20a314402845e006cc0456d910bce87741f81b82" name="Archer" arch="x86_64">' in xml[1]) + self.assertTrue('<package pkgid="65dd4d39b7539cb0b6b150db20a314402845e006cc0456d910bce87741f81b82" name="Archer" arch="x86_64">' in xml[2]) # Test error cases diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/python/tests/test_repository.py new/createrepo_c-1.2.1/tests/python/tests/test_repository.py --- old/createrepo_c-1.1.0/tests/python/tests/test_repository.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/python/tests/test_repository.py 2025-03-17 08:14:47.000000000 +0100 @@ -42,6 +42,7 @@ assert reader.package_count() == 1 + class TestCaseRepositoryWriter(unittest.TestCase): def setUp(self): @@ -99,13 +100,18 @@ record_path = os.path.join(self.tmpdir, record.location_href) assert os.path.exists(record_path) - reader = cr.RepositoryReader.from_path(self.tmpdir) - for pkg in reader.iter_packages(): - # test that the package files are present where expected - pkg_path = os.path.join(self.tmpdir, pkg.location_href) - assert os.path.exists(pkg_path) - # test that the package checksum type is correct - assert pkg.checksum_type == "sha256" + reader = cr.RepositoryReader.from_path(self.tmpdir) + for pkg in reader.iter_packages(): + # test that the package files are present where expected + pkg_path = os.path.join(self.tmpdir, pkg.location_href) + assert os.path.exists(pkg_path) + # test that the package checksum type is correct + assert pkg.checksum_type == "sha256" + + expected_updaterecords = [TEST_UPDATERECORD_UPDATE1] + for expected, actual in zip(expected_updaterecords, reader.advisories()): + assert_updaterecord_equal(expected, actual) + def test_options(self): """Test that overriding default options works as intended""" @@ -142,18 +148,25 @@ record_path = os.path.join(self.tmpdir, record.location_href) assert os.path.exists(record_path) - reader = cr.RepositoryReader.from_path(self.tmpdir) - for pkg in reader.iter_packages(): - # test that the package files are present where expected - pkg_path = os.path.join(self.tmpdir, pkg.location_href) - assert os.path.exists(pkg_path) - # test that changelog_limit works - assert len(pkg.changelogs) <= 1 - # test that the package checksum type is correct - assert pkg.checksum_type == "sha512" + reader = cr.RepositoryReader.from_path(self.tmpdir) + for pkg in reader.iter_packages(): + # test that the package files are present where expected + pkg_path = os.path.join(self.tmpdir, pkg.location_href) + assert os.path.exists(pkg_path) + # test that changelog_limit works + assert len(pkg.changelogs) <= 1 + # test that the package checksum type is correct + assert pkg.checksum_type == "sha512" + + expected_updaterecords = [TEST_UPDATERECORD_UPDATE1] + for expected, actual in zip(expected_updaterecords, reader.advisories()): + assert_updaterecord_equal(expected, actual) + def test_add_repo_metadata(self): """Test adding an additional repo metadata file to the repository.""" + basename = os.path.basename(TEST_COMPS_00) + with cr.RepositoryWriter(self.tmpdir) as writer: writer.add_repomd_metadata("group", TEST_COMPS_00, use_compression=False) @@ -162,7 +175,6 @@ # test that the metadata file was added to repomd record = [record for record in writer.repomd.records if record.type == "group"][0] - basename = os.path.basename(TEST_COMPS_00) md_path_relative = f"repodata/{record.checksum}-{basename}" assert record.location_href == md_path_relative @@ -179,7 +191,6 @@ # test that the metadata file was added to repomd record = [record for record in writer.repomd.records if record.type == "group"][0] - basename = os.path.basename(TEST_COMPS_00) md_path_relative = f"repodata/{record.checksum}-{basename}.zst" assert record.location_href == md_path_relative @@ -196,13 +207,21 @@ # test that adding a file already in the repodata/ directory works (outside of repository already tested) with cr.RepositoryWriter(self.tmpdir) as writer: md_path = shutil.copy2(TEST_COMPS_00, writer.repodata_dir) - writer.add_repomd_metadata("group", md_path) + writer.add_repomd_metadata("group", md_path, use_compression=True) record = [record for record in writer.repomd.records if record.type == "group"][0] - basename = os.path.basename(TEST_COMPS_00) md_path_relative = f"repodata/{record.checksum}-{basename}.zst" assert record.location_href == md_path_relative + # same as the above test, but without compression enabled + with cr.RepositoryWriter(self.tmpdir) as writer: + md_path = shutil.copy2(TEST_COMPS_00, writer.repodata_dir) + writer.add_repomd_metadata("group", md_path, use_compression=False) + + record = [record for record in writer.repomd.records if record.type == "group"][0] + md_path_relative = f"repodata/{record.checksum}-{basename}" + assert record.location_href == md_path_relative + def test_add_package(self): """Test adding a package to the repository.""" # test that adding a package file already in the repository works (outside of repository already tested) @@ -231,4 +250,25 @@ assert pkg.location_href.startswith("Packages/") # test that the package files are present where expected pkg_path = os.path.join(self.tmpdir, pkg.location_href) - assert os.path.exists(pkg_path) \ No newline at end of file + assert os.path.exists(pkg_path) + + +def assert_updaterecord_equal(expected, actual): + assert expected.fromstr == actual.fromstr + assert expected.status == actual.status + assert expected.type == actual.type + assert expected.version == actual.version + assert expected.id == actual.id + assert expected.title == actual.title + assert expected.issued_date == actual.issued_date + assert expected.updated_date == actual.updated_date + assert expected.rights == actual.rights + assert expected.release == actual.release + assert expected.pushcount == actual.pushcount + assert expected.severity == actual.severity + assert expected.summary == actual.summary + assert expected.reboot_suggested == actual.reboot_suggested + assert expected.description == actual.description + assert expected.solution == actual.solution + assert len(expected.references) == len(actual.references) + assert len(expected.collections) == len(actual.collections) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/python/tests/test_sqlite.py new/createrepo_c-1.2.1/tests/python/tests/test_sqlite.py --- old/createrepo_c-1.1.0/tests/python/tests/test_sqlite.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/python/tests/test_sqlite.py 2025-03-17 08:14:47.000000000 +0100 @@ -155,22 +155,23 @@ # Check packages table res = con.execute("select * from packages").fetchall() self.assertEqual(res, - [(1, u'4e0b775220c67f0f2c1fd2177e626b9c863a098130224ff09778ede25cea9a9e', + [(1, u'65dd4d39b7539cb0b6b150db20a314402845e006cc0456d910bce87741f81b82', u'Archer', u'x86_64', u'3.4.5', u'2', u'6', u'Complex package.', u'Archer package', u'http://soo_complex_package.eu/', - res[0][10], 1365416480, u'GPL', u'ISIS', u'Development/Tools', - u'localhost.localdomain', u'Archer-3.4.5-6.src.rpm', 280, 2865, - u'Sterling Archer', 3101, 0, 544, None, None, u'sha256')]) + res[0][10], 1710742930, u'GPL', u'ISIS', u'Development/Tools', + u'localhost.localdomain', u'Archer-3.4.5-6.src.rpm', 4504, 7517, + u'Sterling Archer', 7737, 0, 544, None, None, u'sha256')]) # Check provides table self.assertEqual(con.execute("select * from provides").fetchall(), - [(u'bara', u'LE', u'0', u'22', None, 1), + [(u'Archer', u'EQ', u'2', u'3.4.5', u'6', 1), + (u'Archer(x86-64)', u'EQ', u'2', u'3.4.5', u'6', 1), + (u'bara', u'LE', u'0', u'22', None, 1), (u'barb', u'GE', u'0', u'11.22.33', u'44', 1), (u'barc', u'EQ', u'0', u'33', None, 1), (u'bard', u'LT', u'0', u'44', None, 1), - (u'bare', u'GT', u'0', u'55', None, 1), - (u'Archer', u'EQ', u'2', u'3.4.5', u'6', 1), - (u'Archer(x86-64)', u'EQ', u'2', u'3.4.5', u'6', 1)]) + (u'bare', u'GT', u'0', u'55', None, 1)]) + # Check conflicts table self.assertEqual(con.execute("select * from conflicts").fetchall(), @@ -195,7 +196,9 @@ (u'fooc', u'EQ', u'0', u'3', None, 1, u'FALSE'), (u'food', u'LT', u'0', u'4', None, 1, u'FALSE'), (u'fooe', u'GT', u'0', u'5', None, 1, u'FALSE'), - (u'foof', u'EQ', u'0', u'6', None, 1, u'TRUE')]) + (u'foof', u'EQ', u'0', u'6', None, 1, u'TRUE'), + (u'foog', u'EQ', u'0', u'7', None, 1, u'TRUE'), + (u'fooh', u'EQ', u'0', u'8', None, 1, u'TRUE')]) # Check files table self.assertEqual(con.execute("select * from files").fetchall(), @@ -219,7 +222,7 @@ # Check packages table self.assertEqual(con.execute("select * from packages").fetchall(), - [(1, u'4e0b775220c67f0f2c1fd2177e626b9c863a098130224ff09778ede25cea9a9e')]) + [(1, u'65dd4d39b7539cb0b6b150db20a314402845e006cc0456d910bce87741f81b82')]) # Check files table self.assertEqual(set(con.execute("select * from filelist").fetchall()), @@ -245,7 +248,7 @@ # Check packages table self.assertEqual(con.execute("select * from packages").fetchall(), - [(1, u'4e0b775220c67f0f2c1fd2177e626b9c863a098130224ff09778ede25cea9a9e')]) + [(1, u'65dd4d39b7539cb0b6b150db20a314402845e006cc0456d910bce87741f81b82')]) # Check filelist table self.assertEqual(set(con.execute("select * from filelist").fetchall()), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/python/tests/test_xml_file.py new/createrepo_c-1.2.1/tests/python/tests/test_xml_file.py --- old/createrepo_c-1.1.0/tests/python/tests/test_xml_file.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/python/tests/test_xml_file.py 2025-03-17 08:14:47.000000000 +0100 @@ -196,13 +196,13 @@ <name>Archer</name> <arch>x86_64</arch> <version epoch="2" ver="3.4.5" rel="6"/> - <checksum type="sha256" pkgid="YES">4e0b775220c67f0f2c1fd2177e626b9c863a098130224ff09778ede25cea9a9e</checksum> + <checksum type="sha256" pkgid="YES">65dd4d39b7539cb0b6b150db20a314402845e006cc0456d910bce87741f81b82</checksum> <summary>Complex package.</summary> <description>Archer package</description> <packager>Sterling Archer</packager> <url>http://soo_complex_package.eu/</url> - <time file="111" build="1365416480"/> - <size package="3101" installed="0" archive="544"/> + <time file="111" build="1710742930"/> + <size package="7737" installed="0" archive="544"/> <location href=""/> <format> <rpm:license>GPL</rpm:license> @@ -210,15 +210,15 @@ <rpm:group>Development/Tools</rpm:group> <rpm:buildhost>localhost.localdomain</rpm:buildhost> <rpm:sourcerpm>Archer-3.4.5-6.src.rpm</rpm:sourcerpm> - <rpm:header-range start="280" end="2865"/> + <rpm:header-range start="4504" end="7517"/> <rpm:provides> + <rpm:entry name="Archer" flags="EQ" epoch="2" ver="3.4.5" rel="6"/> + <rpm:entry name="Archer(x86-64)" flags="EQ" epoch="2" ver="3.4.5" rel="6"/> <rpm:entry name="bara" flags="LE" epoch="0" ver="22"/> <rpm:entry name="barb" flags="GE" epoch="0" ver="11.22.33" rel="44"/> <rpm:entry name="barc" flags="EQ" epoch="0" ver="33"/> <rpm:entry name="bard" flags="LT" epoch="0" ver="44"/> <rpm:entry name="bare" flags="GT" epoch="0" ver="55"/> - <rpm:entry name="Archer" flags="EQ" epoch="2" ver="3.4.5" rel="6"/> - <rpm:entry name="Archer(x86-64)" flags="EQ" epoch="2" ver="3.4.5" rel="6"/> </rpm:provides> <rpm:requires> <rpm:entry name="fooa" flags="LE" epoch="0" ver="2"/> @@ -227,6 +227,8 @@ <rpm:entry name="food" flags="LT" epoch="0" ver="4"/> <rpm:entry name="fooe" flags="GT" epoch="0" ver="5"/> <rpm:entry name="foof" flags="EQ" epoch="0" ver="6" pre="1"/> + <rpm:entry name="foog" flags="EQ" epoch="0" ver="7" pre="1"/> + <rpm:entry name="fooh" flags="EQ" epoch="0" ver="8" pre="1"/> </rpm:requires> <rpm:conflicts> <rpm:entry name="bba" flags="LE" epoch="0" ver="2222"/> @@ -264,7 +266,7 @@ self.assertEqual(filelists.read(), """<?xml version="1.0" encoding="UTF-8"?> <filelists xmlns="http://linux.duke.edu/metadata/filelists" packages="0"> -<package pkgid="4e0b775220c67f0f2c1fd2177e626b9c863a098130224ff09778ede25cea9a9e" name="Archer" arch="x86_64"> +<package pkgid="65dd4d39b7539cb0b6b150db20a314402845e006cc0456d910bce87741f81b82" name="Archer" arch="x86_64"> <version epoch="2" ver="3.4.5" rel="6"/> <file>/usr/bin/complex_a</file> <file type="dir">/usr/share/doc/Archer-3.4.5</file> @@ -289,7 +291,7 @@ self.assertEqual(other.read(), """<?xml version="1.0" encoding="UTF-8"?> <otherdata xmlns="http://linux.duke.edu/metadata/other" packages="0"> -<package pkgid="4e0b775220c67f0f2c1fd2177e626b9c863a098130224ff09778ede25cea9a9e" name="Archer" arch="x86_64"> +<package pkgid="65dd4d39b7539cb0b6b150db20a314402845e006cc0456d910bce87741f81b82" name="Archer" arch="x86_64"> <version epoch="2" ver="3.4.5" rel="6"/> <changelog author="Tomas Mlcoch <tmlc...@redhat.com> - 1.1.1-1" date="1334664000">- First changelog.</changelog> <changelog author="Tomas Mlcoch <tmlc...@redhat.com> - 2.2.2-2" date="1334750400">- That was totally ninja!</changelog> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/python/tests/test_xml_parser.py new/createrepo_c-1.2.1/tests/python/tests/test_xml_parser.py --- old/createrepo_c-1.1.0/tests/python/tests/test_xml_parser.py 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/python/tests/test_xml_parser.py 2025-03-17 08:14:47.000000000 +0100 @@ -1245,6 +1245,74 @@ self.assertRaises(StopIteration, next, package_iterator) self.assertTrue(package_iterator.is_finished()) + def test_xml_parser_pkg_iterator_repo02_only_primary(self): + warnings = [] + def warningcb(warn_type, msg): + warnings.append((warn_type, msg)) + + package_iterator = cr.PackageIterator( + primary_path=REPO_02_PRIXML, filelists_path=None, other_path=None, + warningcb=warningcb, + ) + packages = list(package_iterator) + + self.assertEqual(len(packages), 2) + self.assertEqual(packages[0].name, "fake_bash") + self.assertEqual(packages[0].files, [(None, '/usr/bin/', 'fake_bash')]) # the files still get parsed - only from primary.xml + self.assertEqual(packages[0].changelogs, []) + self.assertListEqual(warnings, []) + self.assertRaises(StopIteration, next, package_iterator) + self.assertTrue(package_iterator.is_finished()) + + + def test_xml_parser_pkg_iterator_repo02_no_primary(self): + def test(): + cr.PackageIterator( + primary_path=None, filelists_path=REPO_02_FILXML, other_path=REPO_02_OTHXML, + ) + + self.assertRaises(TypeError, test) + + def test_xml_parser_pkg_iterator_repo02_no_filelists(self): + warnings = [] + def warningcb(warn_type, msg): + warnings.append((warn_type, msg)) + + package_iterator = cr.PackageIterator( + primary_path=REPO_02_PRIXML, filelists_path=None, other_path=REPO_02_OTHXML, + warningcb=warningcb, + ) + packages = list(package_iterator) + + self.assertEqual(len(packages), 2) + self.assertEqual(packages[0].name, "fake_bash") + self.assertEqual(packages[0].changelogs, [ + ('Tomas Mlcoch <tmlc...@redhat.com> - 1.1.1-1', 1334664000, '- First release'), + ]) + self.assertEqual(packages[0].files, [(None, '/usr/bin/', 'fake_bash')]) # the files still get parsed - only from primary.xml + self.assertListEqual(warnings, []) + self.assertRaises(StopIteration, next, package_iterator) + self.assertTrue(package_iterator.is_finished()) + + def test_xml_parser_pkg_iterator_repo02_no_other(self): + warnings = [] + def warningcb(warn_type, msg): + warnings.append((warn_type, msg)) + + package_iterator = cr.PackageIterator( + primary_path=REPO_02_PRIXML, filelists_path=REPO_02_FILXML, other_path=None, + warningcb=warningcb, + ) + packages = list(package_iterator) + + self.assertEqual(len(packages), 2) + self.assertEqual(packages[0].name, "fake_bash") + self.assertEqual(packages[0].changelogs, []) + self.assertEqual(packages[0].files, [(None, '/usr/bin/', 'fake_bash')]) + self.assertListEqual(warnings, []) + self.assertRaises(StopIteration, next, package_iterator) + self.assertTrue(package_iterator.is_finished()) + def test_xml_parser_pkg_iterator_repo02_newpkgcb_as_filter(self): def newpkgcb(pkgId, name, arch): if name in {"fake_bash"}: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/test_xml_parser_main_metadata_together.c new/createrepo_c-1.2.1/tests/test_xml_parser_main_metadata_together.c --- old/createrepo_c-1.1.0/tests/test_xml_parser_main_metadata_together.c 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/test_xml_parser_main_metadata_together.c 2025-03-17 08:14:47.000000000 +0100 @@ -121,6 +121,50 @@ } static void +test_cr_xml_package_iterator_00_no_filelists(void) +{ + int parsed = 0; + GError *tmp_err = NULL; + cr_Package *package = NULL; + + cr_PkgIterator *pkg_iterator = cr_PkgIterator_new( + TEST_REPO_02_PRIMARY, NULL, TEST_REPO_02_OTHER, NULL, NULL, NULL, NULL, &tmp_err); + + while ((package = cr_PkgIterator_parse_next(pkg_iterator, &tmp_err))) { + parsed++; + cr_package_free(package); + } + + g_assert(cr_PkgIterator_is_finished(pkg_iterator)); + cr_PkgIterator_free(pkg_iterator, &tmp_err); + + g_assert(tmp_err == NULL); + g_assert_cmpint(parsed, ==, 2); +} + +static void +test_cr_xml_package_iterator_00_no_other(void) +{ + int parsed = 0; + GError *tmp_err = NULL; + cr_Package *package = NULL; + + cr_PkgIterator *pkg_iterator = cr_PkgIterator_new( + TEST_REPO_02_PRIMARY, TEST_REPO_02_FILELISTS, NULL, NULL, NULL, NULL, NULL, &tmp_err); + + while ((package = cr_PkgIterator_parse_next(pkg_iterator, &tmp_err))) { + parsed++; + cr_package_free(package); + } + + g_assert(cr_PkgIterator_is_finished(pkg_iterator)); + cr_PkgIterator_free(pkg_iterator, &tmp_err); + + g_assert(tmp_err == NULL); + g_assert_cmpint(parsed, ==, 2); +} + +static void test_cr_xml_package_iterator_filelists_ext_00(void) { int parsed = 0; @@ -320,6 +364,12 @@ g_test_add_func("/xml_parser_main_metadata/test_cr_xml_package_iterator_00", test_cr_xml_package_iterator_00); + g_test_add_func("/xml_parser_main_metadata/test_cr_xml_package_iterator_00_no_filelists", + test_cr_xml_package_iterator_00_no_filelists); + + g_test_add_func("/xml_parser_main_metadata/test_cr_xml_package_iterator_00_no_other", + test_cr_xml_package_iterator_00_no_other); + g_test_add_func("/xml_parser_main_metadata/test_cr_xml_package_iterator_filelists_ext_00", test_cr_xml_package_iterator_filelists_ext_00); Binary files old/createrepo_c-1.1.0/tests/testdata/packages/Archer-3.4.5-6.x86_64.rpm and new/createrepo_c-1.2.1/tests/testdata/packages/Archer-3.4.5-6.x86_64.rpm differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/tests/testdata/specs/fake-Archer.spec new/createrepo_c-1.2.1/tests/testdata/specs/fake-Archer.spec --- old/createrepo_c-1.1.0/tests/testdata/specs/fake-Archer.spec 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/tests/testdata/specs/fake-Archer.spec 2025-03-17 08:14:47.000000000 +0100 @@ -16,6 +16,8 @@ Requires: food < 4 Requires: fooe > 5 Requires(pre): foof = 6 +Requires(pretrans): foog = 7 +Requires(posttrans): fooh = 8 Provides: bara <= 22 Provides: barb >= 11.22.33-44 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/utils/make_rpm.sh new/createrepo_c-1.2.1/utils/make_rpm.sh --- old/createrepo_c-1.1.0/utils/make_rpm.sh 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/utils/make_rpm.sh 2025-03-17 08:14:47.000000000 +0100 @@ -3,7 +3,6 @@ PACKAGE="createrepo_c" RPMBUILD_DIR="${HOME}/rpmbuild/" BUILD_DIR="$RPMBUILD_DIR/BUILD" -GITREV=`git rev-parse --short HEAD` PREFIX="" # Root project dir MY_DIR=`dirname "$0"` @@ -22,6 +21,13 @@ exit 1 fi +if [ $# -gt "1" ] +then + GITREV=$2 +else + GITREV=`git rev-parse --short HEAD` +fi + echo "Generating rpm for $GITREV" echo "Cleaning $BUILD_DIR" @@ -38,23 +44,22 @@ echo "Tarball done" echo "> Copying tarball and .spec file into the $RPMBUILD_DIR .." -cp "$PREFIX/$PACKAGE-$GITREV.tar.xz" "$RPMBUILD_DIR/SOURCES/" +cp "$PREFIX/$PACKAGE-$GITREV.tar.gz" "$RPMBUILD_DIR/SOURCES/" if [ ! $? == "0" ]; then - echo "Error while: cp $PREFIX/$PACKAGE-$GITREV.tar.xz $RPMBUILD_DIR/SOURCES/" + echo "Error while: cp $PREFIX/$PACKAGE-$GITREV.tar.gz $RPMBUILD_DIR/SOURCES/" exit 1 fi -# Copy via sed -sed -i "s/%global gitrev .*/%global gitrev $GITREV/g" "$PREFIX/$PACKAGE.spec" -sed "s/%global gitrev .*/%global gitrev $GITREV/g" "$PREFIX/$PACKAGE.spec" > "$RPMBUILD_DIR/SPECS/$PACKAGE.spec" +cp "$PREFIX/$PACKAGE.spec" "$RPMBUILD_DIR/SPECS/" if [ ! $? == "0" ]; then echo "Error while: cp $PREFIX/$PACKAGE.spec $RPMBUILD_DIR/SPECS/" exit 1 fi + echo "Copying done" echo "> Starting rpmbuild $PACKAGE.." -rpmbuild -ba "$RPMBUILD_DIR/SPECS/$PACKAGE.spec" +rpmbuild -ba --define "gitrev $GITREV" "$RPMBUILD_DIR/SPECS/$PACKAGE.spec" if [ ! $? == "0" ]; then echo "Error while: rpmbuild -ba $RPMBUILD_DIR/SPECS/$PACKAGE.spec" exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/createrepo_c-1.1.0/utils/make_tarball.sh new/createrepo_c-1.2.1/utils/make_tarball.sh --- old/createrepo_c-1.1.0/utils/make_tarball.sh 2024-03-11 08:14:00.000000000 +0100 +++ new/createrepo_c-1.2.1/utils/make_tarball.sh 2025-03-17 08:14:47.000000000 +0100 @@ -9,4 +9,4 @@ echo "Generate tarball for revision: $GITREV" -git archive "${GITREV}" --prefix="$PACKAGE"/ | xz > "$TARGET_DIR"/"$PACKAGE"-"${GITREV}".tar.xz +git archive "${GITREV}" --prefix="${PACKAGE}-${GITREV}"/ | gzip > "$TARGET_DIR"/"$PACKAGE"-"${GITREV}".tar.gz