diff options
-rw-r--r-- | FEATURES-BY-VERSION | 65 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | NEWS | 24 | ||||
-rw-r--r-- | TODO | 46 | ||||
-rw-r--r-- | lib/control.sh | 6 | ||||
-rw-r--r-- | lib/metadata.sh | 19 | ||||
-rw-r--r-- | lib/metadata/proteanos.sh | 11 | ||||
-rw-r--r-- | lib/output.sh | 6 | ||||
-rw-r--r-- | lib/package.sh | 26 | ||||
-rw-r--r-- | locale/C/libopkbuild_2.sh | 1 | ||||
-rw-r--r-- | src/ob-gencontrol.sh | 31 | ||||
-rw-r--r-- | src/opkbuild.sh | 4 | ||||
-rw-r--r-- | tests/aux/common.sh | 4 | ||||
-rw-r--r-- | tests/data/pkg/bar.pkg/control | 2 | ||||
-rw-r--r-- | tests/data/pkg/baz+qux.pkg/control | 8 | ||||
-rwxr-xr-x | tests/data/pkg/build | 1 | ||||
-rwxr-xr-x | tests/exe/ob-buildopk.sh | 6 | ||||
-rwxr-xr-x | tests/exe/ob-genchanges.sh | 9 | ||||
-rwxr-xr-x | tests/exe/ob-gencontrol.sh | 39 | ||||
-rwxr-xr-x | tests/exe/opkbuild.sh | 6 | ||||
-rwxr-xr-x | tests/lib/ob_get_binary_parameter.sh | 8 | ||||
-rwxr-xr-x | tests/lib/ob_reduce_deps.sh | 20 | ||||
-rw-r--r-- | tests/local.mk | 1 |
23 files changed, 289 insertions, 59 deletions
diff --git a/FEATURES-BY-VERSION b/FEATURES-BY-VERSION new file mode 100644 index 0000000..567910d --- /dev/null +++ b/FEATURES-BY-VERSION @@ -0,0 +1,65 @@ +This document helps package maintainers write `Build-Depends` fields +that ensure that the installed version of opkbuild supports features +needed by a source package. Read this document from top to bottom, and +as soon as you find a criterion that applies to your source package, you +can add the specified versioned build dependency and stop reading. + +Add `opkbuild (>= 4.2.2+dev)` to your `Build-Depends` if... + + * Your binary packages don't list in their `Depends` fields the binary + package that provides source package documentation. + * Your ProteanOS source package version contains an epoch, e.g. + `1:2.0-1`. + * Any two or more of your binary packages would have the same name if + all characters except letters and numbers were removed, e.g. + `libc-1` and `libc++.1`. + +Add `opkbuild (>= 4.2.2)` to your `Build-Depends` if... + + * Any of your substitution variables are used in binary package + dependency fields and contain dependency restrictions or newline + characters. This is common for example in platform configuration + source packages that use `platconf-pkg-tools` which generates binary + package control files that get `Depends` field values from + substitution variables. + +Add `opkbuild (>= 4.2.1)` to your `Build-Depends` if... + + * Your `Build-Depends` field contains newline characters. + +Add `opkbuild (>= 4.2.0)` to your `Build-Depends` if... + + * Any of your binary packages has a `Section` field. + +Add `opkbuild (>= 4.1.4)` to your `Build-Depends` if... + + * Your ProteanOS source package version indicates an upload of a new + upstream version to a non-trunk distribution (e.g. version + `2019a-0+rs1~1`) or an upload of a backport to a non-trunk + distribution (e.g. version `3.0-2+bpu1+1`). + +Add `opkbuild (>= 4.0.2)` to your `Build-Depends` if... + + * Your ProteanOS source package upstream version contains a plus sign, + e.g. `1.4+git20141115.146bff1-1`. + +Add `opkbuild (>= 4.0.1)` to your `Build-Depends` if... + + * You use binary package substitution variables files in the build + work area, e.g. with opkhelper's oh-shlibdeps utility. If you use + oh-shlibdeps on ProteanOS, you should also add + `opkhelper-3.0 (>= 3.1.4)` to your `Build-Depends`. + +Add `opkbuild (>= 4.0.0)` to your `Build-Depends` if... + + * Your upstream source archive is compressed using xz. + +Copyright Information +--------------------- + +Copyright (C) 2023 Patrick McDermott + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without any warranty. diff --git a/Makefile.am b/Makefile.am index 3cbf383..f8219e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,6 +35,10 @@ endif # * Our release target PACKAGE_STRING = $(PACKAGE_NAME) $(PACKAGE_VERSION_GIT) +# Automake lib/am/check.am since version 1.16.3 defines this with single quotes, +# which breaks PACKAGE_VERSION_GIT above. +AM_TESTSUITE_SUMMARY_HEADER = " for $(PACKAGE_STRING)" + SUFFIXES = .sh .sho SHOBJEXT = sho @@ -63,6 +67,7 @@ helperdir = $(pkgdatadir)/helpers CLEANFILES = extra_sources = EXTRA_DIST = \ + FEATURES-BY-VERSION \ NEWS.opkhelper \ TODO \ autogen.sh \ @@ -3,6 +3,28 @@ opkbuild version 4.2.2+dev Released: ????-??-?? +Utilities: + + * ob-gencontrol now automatically lists the binary package that + provides source package documentation as a dependency (with version + restrictions) of all other binary packages built from the same + source package. + +libopkbuild: + + * ProteanOS source package versions may now contain epochs. This + complies with the latest draft of SPF 2.0. + * A new ob_clean_name() function has been added. + ob_get_binary_packages() no longer complains about duplicate "clean" + binary package names such as "libc-1" and "libc++.1". This will + allow SPF 2.0 to remove the restriction on "binary package clean + names". + +Build system: + + * The test suite summary is fixed, after being broken by GNU Automake + since version 1.16.3. + opkbuild version 4.2.2 ---------------------- @@ -592,7 +614,7 @@ before opkbuild was split into its own package. Copyright Information --------------------- -Copyright (C) 2012-2014, 2018-2020 Patrick McDermott +Copyright (C) 2012-2014, 2018-2021, 2023 Patrick McDermott Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -4,6 +4,50 @@ Future Tasks Functional Changes ------------------ + * Support a field for annotating transitional packages, to help notify + maintainers when their source packages depend on development packages for + old library SONAME versions. + - Add optional `Deprecated: yes[ <replacement-pkg>]` binary package field to + SPF 2.0. Note that this does not replace package relationship fields like + `Depends`. + - (Debian uses `Section: oldlibs` for this, but ProteanOS uses `Section` to + separate packages into smaller indices that not all systems use, so we + shouldn't just dump all transitional packages into one big section. Also, + ProteanOS uses `Section` to determine whether to architecture-qualify + names of multiarch coinstallable packages.) + - Add `Deprecated` to `lib/package/2.sh` `_OB_BINARY_FIELDS_OPTIONAL_2`. + - Add an option to opkbuild to disable build dependency deprecation + failures. Maybe replace `-D`. Set an environment variable for + ob-checkbuilddeps. + - Run `opkg info` instead of `opkg status` in ob-checkbuilddeps + `check_dep()`. If a `Deprecated` field exists, call `ob_error()` with the + name of the replacement package (if any). If build dependency deprecation + failures are enabled, exit with an error status. + * Make binary package `Description` fields architecture- and platform- + independent (so a packages index Web site can show one description for a + binary package for all its architectures and platforms). + - Specify in SPF 2.0 #substvars-defined that `Host-Arch` and `Host-Plat` + substitution variables shall not be set for `Description` fields. + - `ob_set_source_substvar()` needs a third optional (for API compatibility) + `archplat_dep` parameter (default `false`) that, if `true`, causes + variable to be stored in a separate array. + - `ob_set_package_substvars()` needs a second optional (for API + compatibility) `archplat_indep` parameter (default `false`) that, if + `false`, enables checking for variables in the aforementioned separate + array. + - In `_ob_set_package_substvars_2()`, replace: + ob_set_source_substvar 'Host-Arch' "${OPK_HOST_ARCH}" + ob_set_source_substvar 'Host-Plat' "${OPK_HOST_PLAT}" + with: + ob_set_source_substvar 'Host-Arch' "${OPK_HOST_ARCH}" true + ob_set_source_substvar 'Host-Plat' "${OPK_HOST_PLAT}" true + - In ob-gencontrol, replace: + desc="$(ob_substvars "${desc}" "${pkg}")" + with: + desc="$(ob_substvars "${desc}" "${pkg}" true)" + - Add `${Host-Arch}` (which should be copied verbatim to output control + file) to `Description` in tests **BEFORE** above changes to verify correct + behavior. * Split distribution packaging from upstream sources in source packages. - Non-native package: * `src:foo` is the distribution packaging, and it depends on @@ -21,7 +65,7 @@ Functional Changes Copyright ========= -Copyright (C) 2018, 2019 Patrick McDermott +Copyright (C) 2018, 2019, 2023 Patrick McDermott Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright diff --git a/lib/control.sh b/lib/control.sh index 35913aa..76ba516 100644 --- a/lib/control.sh +++ b/lib/control.sh @@ -245,8 +245,7 @@ ob_set_binary_substvar() value="$(printf '%s' "${value}" | sed -n "${_OB_SUBSTVAR_TRIM_SED}")" # Convert package name to clean form. - package="$(printf '%s' "${package}" | tr 'A-Z' 'a-z' | \ - tr -C 'a-z0-9' '_')" + package="$(ob_clean_name "${package}")" # TODO: Maybe disallow variable names beginning with hyphens, and/or # otherwise make this safer. @@ -326,8 +325,7 @@ ob_substvars() # Perform the substitution. name_tr="$(printf '%s' "${name}" | tr 'A-Z-' 'a-z_')" - package="$(printf '%s' "${package}" | tr 'A-Z' 'a-z' | \ - tr -C 'a-z0-9' '_')" + package="$(ob_clean_name "${package}")" if eval "[ x\"\${_ob_substvar_src_${name_tr}:+set}\" = x'set' ]" then name_tr="_ob_substvar_src_${name_tr}" diff --git a/lib/metadata.sh b/lib/metadata.sh index da0c893..bc7e717 100644 --- a/lib/metadata.sh +++ b/lib/metadata.sh @@ -61,6 +61,25 @@ ob_validate_binary_name() return 0 } +## @brief Convert a source or binary package name to a "clean" identifier name +## @details \fBob_clean_name\fP() encodes characters in a source or binary +## package name that would be invalid in a shell variable or function +## name. This conversion is performed by the metadata plugin selected +## at libopkbuild's build time. +## @operand name req The source or binary package name to convert. +## @return Returns 0 on success. +## @stdout Prints the converted name. +## @pure yes This function has no side effects. +ob_clean_name() +{ + local name="${1}" + shift 1 || _ob_abort + + _ob_metadata_do 'clean_name' "${name}" || return ${?} + + return 0 +} + ## @brief Parse a source package version ## @details \fBob_parse_version\fP() validates and parses a source package ## version identifier using the metadata plugin selected at diff --git a/lib/metadata/proteanos.sh b/lib/metadata/proteanos.sh index 7b235e5..6d68ccb 100644 --- a/lib/metadata/proteanos.sh +++ b/lib/metadata/proteanos.sh @@ -19,6 +19,7 @@ _OB_NAME_RE_PROTEANOS='^[a-z0-9][a-z0-9+.-]+$' _OB_VERSION_RE_PROTEANOS='^' +_OB_VERSION_RE_PROTEANOS=${_OB_VERSION_RE_PROTEANOS}'([1-9][0-9]*:)?' _OB_VERSION_RE_PROTEANOS=${_OB_VERSION_RE_PROTEANOS}'[0-9a-z.~+]+' _OB_VERSION_RE_PROTEANOS=${_OB_VERSION_RE_PROTEANOS}'(\+sip[1-9][0-9]*)?' _OB_VERSION_RE_PROTEANOS=${_OB_VERSION_RE_PROTEANOS}'(-[0-9]+)?' @@ -69,6 +70,16 @@ _ob_validate_binary_name() return 0 } +_ob_clean_name() +{ + local name="${1}" + shift 1 || _ob_abort + + printf '%s' "${name}" | sed 's/-/_h_/g; s/+/_p_/g; s/[.]/_d_/g;' + + return 0 +} + _ob_validate_version() { local version="${1}" diff --git a/lib/output.sh b/lib/output.sh index 056c929..defadee 100644 --- a/lib/output.sh +++ b/lib/output.sh @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with opkbuild. If not, see <http://www.gnu.org/licenses/>. -## @brief Print an error message and exit +## @brief Print an error message ## @details \fBob_error\fP() prints \fIarguments\fP according to \fIformat\fP. ## @operand format req The format string. See \fBprintf\fP(1) for the syntax ## of \fIformat\fP. @@ -25,7 +25,7 @@ ## \fIformat\fP. ## @return Returns 0. ## @stderr Prints the formatted message, preceded by the program name and -## "Error:". +## "Error:" (or a translation thereof). ## @pure yes This function has no side effects. ob_error() { @@ -46,7 +46,7 @@ ob_error() ## \fIformat\fP. ## @return Returns 0. ## @stderr Prints the formatted message, preceded by the program name and -## "Warning:". +## "Warning:" (or a translation thereof). ## @pure yes This function has no side effects. ob_warn() { diff --git a/lib/package.sh b/lib/package.sh index 138609c..dbf6b67 100644 --- a/lib/package.sh +++ b/lib/package.sh @@ -36,11 +36,8 @@ _ob_package_do() _ob_find_binary_packages() { - local pkgs_clean= local pkg= - local pkg_clean= - pkgs_clean=' ' _ob_binary_packages='' for pkg in $(_ob_package_do 'get_binary_packages'); do @@ -50,16 +47,6 @@ _ob_find_binary_packages() continue fi - # Make sure the "clean" name is unique. - pkg_clean="$(printf '%s' "${pkg}" | tr 'a-z' 'A-Z' | \ - tr -C 'A-Z0-9' '_')" - case "${pkgs_clean}" in *" ${pkg_clean} "*) - _ob_warn_msg 'duplicate_clean_binary_name' \ - "${pkg_clean}" - continue - esac - pkgs_clean="${pkgs_clean}${pkg_clean} " - _ob_binary_packages="${_ob_binary_packages} ${pkg}" done @@ -111,8 +98,7 @@ ob_init_package() ## @option -a host_plat The platform by which to filter binary packages. ## @return Returns 0 on success. ## @stdout Prints the resulting list of binary packages. -## @stderr Prints warning messages on invalid binary package names and duplicate -## "clean" binary package names. +## @stderr Prints warning messages on invalid binary package names. ## @pure yes This function has no side effects. ob_get_binary_packages() { @@ -208,9 +194,8 @@ ob_get_binary_parameter() return 1 fi - # Convert package name to its uppercase "clean" form. - package="$(printf '%s' "${package}" | tr 'a-z' 'A-Z' | \ - tr -C 'A-Z0-9' '_')" + # Convert package name to clean form. + package="$(ob_clean_name "${package}")" # Convert field name to uppercase and validate. case "${name}" in *[!A-Za-z0-9-]* | '') @@ -308,9 +293,8 @@ _ob_set_binary_parameter() return 1 fi - # Convert package name to its uppercase "clean" form. - package="$(printf '%s' "${package}" | tr 'a-z' 'A-Z' | \ - tr -C 'A-Z0-9' '_')" + # Convert package name to clean form. + package="$(ob_clean_name "${package}")" # Convert field name to uppercase and validate. case "${name}" in *[!A-Za-z0-9-]* | '') diff --git a/locale/C/libopkbuild_2.sh b/locale/C/libopkbuild_2.sh index 3cd4b25..0dd836c 100644 --- a/locale/C/libopkbuild_2.sh +++ b/locale/C/libopkbuild_2.sh @@ -25,7 +25,6 @@ msg_libopkbuild_2_output_info_format='%s: %s' # lib/package.sh msg_libopkbuild_2_unable_to_detect_package_format='Unable to detect package format' msg_libopkbuild_2_bad_binary_name='Bad binary package name: "%s"' -msg_libopkbuild_2_duplicate_clean_binary_name='Duplicate clean binary package name: "%s"' # lib/package/*.sh msg_libopkbuild_2_bad_section='Binary package "%s" has invalid section name "%s"' diff --git a/src/ob-gencontrol.sh b/src/ob-gencontrol.sh index 5a103a0..f88508c 100644 --- a/src/ob-gencontrol.sh +++ b/src/ob-gencontrol.sh @@ -1,6 +1,6 @@ # Generate a control directory with a control file and scripts # -# Copyright (C) 2012, 2019 Patrick McDermott +# Copyright (C) 2012, 2019, 2023-2024 Patrick McDermott # # This file is part of opkbuild. # @@ -128,16 +128,21 @@ gen_control_bin() local plat="${4}" local desc="${5}" shift 5 + local binary_qual= local value= + local doc_pkg= + local doc_pkg_q= + local doc_dep= local name= local homepage= mkdir -p -- "${binary}.control" exec 3>"${binary}.control/control" + binary_qual="$(ob_qualify_package_name "${binary}" "${OPK_HOST_ARCH}")" + cat >&3 <<-EOF - Package: $(ob_qualify_package_name "${binary}" \ - "${OPK_HOST_ARCH}") + Package: ${binary_qual} Source: ${OPK_SOURCE} Version: ${version} Architecture: ${arch} @@ -154,9 +159,29 @@ gen_control_bin() tr '\n' ' ') EOF + if ! doc_pkg="$(ob_get_doc_package)"; then + ob_error "$(ob_get_msg 'cant_get_doc_pkg')" + return 1 + fi + doc_pkg_q="$(ob_qualify_package_name "${doc_pkg}" "${OPK_HOST_ARCH}")" + if [ x"$(ob_get_binary_parameter "${doc_pkg}" 'Architecture')" \ + = x'all' ]; then + doc_dep="${doc_pkg_q} (= ${OPK_SOURCE_VERSION})" + elif [ x"$(ob_get_binary_parameter "${binary}" 'Architecture')" \ + = x'all' ]; then + doc_dep="${doc_pkg_q} (>= ${OPK_SOURCE_VERSION}), $(: \ + )${doc_pkg_q} (<< ${OPK_SOURCE_VERSION}.~)" + else + doc_dep="${doc_pkg_q} (= ${OPK_BINARY_VERSION})" + fi + for name in Essential Depends Recommends Suggests Pre-Depends \ Conflicts Provides Replaces; do value="$(ob_get_binary_parameter "${binary}" "${name}")" + if [ x"${name}" = x'Depends' ] && + [ x"${binary_qual}" != x"${doc_pkg_q}" ]; then + value="${doc_dep}, ${value}" + fi if [ -z "${value}" ]; then continue fi diff --git a/src/opkbuild.sh b/src/opkbuild.sh index 2bd9c48..5b368fc 100644 --- a/src/opkbuild.sh +++ b/src/opkbuild.sh @@ -424,8 +424,8 @@ main() if [ x"${opt_build}" != x'source' ]; then print_arch_stats - if "${opt_check_build_deps}"; then - if ! "${bindir}/ob-checkbuilddeps"; then + if ! "${bindir}/ob-checkbuilddeps"; then + if "${opt_check_build_deps}"; then return 1 fi fi diff --git a/tests/aux/common.sh b/tests/aux/common.sh index 3ea3740..effc208 100644 --- a/tests/aux/common.sh +++ b/tests/aux/common.sh @@ -86,8 +86,8 @@ export OPK_SOURCE='foo' export OPK_SOURCE_VERSION='1.0-1' export OPK_SOURCE_VERSION_UPSTREAM='1.0' export OPK_BINARY_VERSION='1.0-1' -export OPK_PACKAGES='foo baz-qux bar' -export OPK_PACKAGES_REDUCED='foo baz-qux bar' +export OPK_PACKAGES='foo baz+qux baz-qux bar' +export OPK_PACKAGES_REDUCED='foo baz+qux baz-qux bar' # Section 7.3.2 Build and Host System Variables # OPK_BUILD_ARCH_GNU and OPK_HOST_ARCH_GNU aren't set or used by opkbuild # utilities. These should be removed from the SPF. diff --git a/tests/data/pkg/bar.pkg/control b/tests/data/pkg/bar.pkg/control index fff5663..93c1198 100644 --- a/tests/data/pkg/bar.pkg/control +++ b/tests/data/pkg/bar.pkg/control @@ -1,4 +1,4 @@ -Architecture: all +Architecture: any Platform: all Section: util Description: Bit-bang All Registers diff --git a/tests/data/pkg/baz+qux.pkg/control b/tests/data/pkg/baz+qux.pkg/control new file mode 100644 index 0000000..1ecae47 --- /dev/null +++ b/tests/data/pkg/baz+qux.pkg/control @@ -0,0 +1,8 @@ +Architecture: all +Platform: all +Depends: ${Generated-Depends} +Description: Add all the things + ${Common-Description} + . + This package's name contains a plus sign, not to be confused with the one that + instead contains a hyphen. diff --git a/tests/data/pkg/build b/tests/data/pkg/build index dbc550a..abbfe8f 100755 --- a/tests/data/pkg/build +++ b/tests/data/pkg/build @@ -5,4 +5,5 @@ build: install: build install -p -m 755 -D src/src/foo.sh foo.data/usr/bin/foo.sh printf 'Generated-Depends: bar\n' >foo.substvars + printf 'Generated-Depends: bar\n' >baz+qux.substvars printf 'Generated-Depends: bar\n' >baz-qux.substvars diff --git a/tests/exe/ob-buildopk.sh b/tests/exe/ob-buildopk.sh index 1f59124..ca0c7ee 100755 --- a/tests/exe/ob-buildopk.sh +++ b/tests/exe/ob-buildopk.sh @@ -43,14 +43,14 @@ plan_ 9 rm -Rf *'.data/' *'.control/' mkdir -p 'foo.data/usr/bin/' 'bar.data/' 'foo.control/' 'bar.control/' \ - 'baz-qux.data/' 'baz-qux.control/' + 'baz+qux.data/' 'baz+qux.control/' 'baz-qux.data/' 'baz-qux.control/' cp -p '../../src/src/foo.sh' 'foo.data/usr/bin/' touch 'foo.control/control' 'foo.control/md5sums' \ 'bar.control/control' 'bar.control/md5sums' command_ok_ 'ob-buildopk exit status' -- "${FAKEROOT}" ob-buildopk for opk in '../../foo:i686-linux-glibc_1.0-1_i686-linux-glibc_all.opk' \ - '../../bar_1.0-1_all_all.opk'; do + '../../bar_1.0-1_i686-linux-glibc_all.opk'; do command_ok_ 'opk exists' -- [ -f "${opk}" ] cmd_is 'outer archive contents' ls_outer "${opk}" <<-EOF debian-binary @@ -72,6 +72,6 @@ cmd_is 'data.tar.gz contents' \ ./usr/bin/foo.sh EOF cmd_is 'data.tar.gz contents' \ - ls_inner '../../bar_1.0-1_all_all.opk' data.tar.gz <<-EOF + ls_inner '../../bar_1.0-1_i686-linux-glibc_all.opk' data.tar.gz <<-EOF ./ EOF diff --git a/tests/exe/ob-genchanges.sh b/tests/exe/ob-genchanges.sh index d0bc6a0..7fc8ec8 100755 --- a/tests/exe/ob-genchanges.sh +++ b/tests/exe/ob-genchanges.sh @@ -25,14 +25,15 @@ set -eu plan_ 2 >'../../foo:i686-linux-glibc_1.0-1_i686-linux-glibc_all.opk' ->'../../bar_1.0-1_all_all.opk' +>'../../bar_1.0-1_i686-linux-glibc_all.opk' +>'../../baz+qux_1.0-1_all_all.opk' >'../../baz-qux_1.0-1_all_all.opk' command_ok_ 'ob-genchanges exit status' -- ob-genchanges cmd_is 'changes file' cat '../../foo_1.0-1_i686-linux-glibc_x60.changes' <<-EOF Format: 1.0 Source: foo - Binary: bar baz-qux foo + Binary: bar baz+qux baz-qux foo Version: 1.0-1 Architecture: i686-linux-glibc Platform: x60 @@ -42,6 +43,7 @@ cmd_is 'changes file' cat '../../foo_1.0-1_i686-linux-glibc_x60.changes' <<-EOF Date: Thu, 01 Jan 1970 01:00:00 +0000 Description: bar - Bit-bang All Registers + baz+qux - Add all the things baz-qux - Hyphenate all the things foo - Frobnicator of Objects Changes: @@ -49,6 +51,7 @@ cmd_is 'changes file' cat '../../foo_1.0-1_i686-linux-glibc_x60.changes' <<-EOF * Initial release. Files: 0 lib foo:i686-linux-glibc_1.0-1_i686-linux-glibc_all.opk + 0 base baz+qux_1.0-1_all_all.opk 0 base baz-qux_1.0-1_all_all.opk - 0 util bar_1.0-1_all_all.opk + 0 util bar_1.0-1_i686-linux-glibc_all.opk EOF diff --git a/tests/exe/ob-gencontrol.sh b/tests/exe/ob-gencontrol.sh index fd58dc9..309e28a 100755 --- a/tests/exe/ob-gencontrol.sh +++ b/tests/exe/ob-gencontrol.sh @@ -22,14 +22,14 @@ set -eu . "${TOP_SRCDIR}/tests/aux/tap-functions.sh" . "${TOP_SRCDIR}/tests/aux/common.sh" -plan_ 12 +plan_ 14 OB_DO_SOURCE='true' command_ok_ 'ob-gencontrol source package exit status' -- \ ob-gencontrol cmd_is 'source package control file' cat 'src:foo.control/control' <<-EOF Package: src:foo Source: foo - Binary: bar baz-qux foo + Binary: bar baz+qux baz-qux foo Version: 1.0-1 Architecture: src Platform: all @@ -47,7 +47,7 @@ cp -Rp '../../src/' 'src/' for run in 'first' 'second'; do command_ok_ "ob-gencontrol ${run} run exit status" -- ob-gencontrol - cmd_is 'control file' cat 'foo.control/control' <<-EOF + cmd_is "${run} run foo control file" cat 'foo.control/control' <<-EOF Package: foo:i686-linux-glibc Source: foo Version: 1.0-1 @@ -64,17 +64,18 @@ for run in 'first' 'second'; do . This package provides a frobnicator of objects. EOF - cmd_is 'md5sums file' cat 'foo.control/md5sums' <<-EOF + cmd_is "${run} run foo md5sums file" cat 'foo.control/md5sums' <<-EOF 582b7bd410b9e196dfb0a706ac95bf23 /usr/bin/foo.sh EOF - cmd_is 'control file' cat 'bar.control/control' <<-EOF + cmd_is "${run} run bar control file" cat 'bar.control/control' <<-EOF Package: bar Source: foo Version: 1.0-1 - Architecture: all + Architecture: i686-linux-glibc Platform: all Section: util Maintainer: "J. Random Hacker" <jrandom@example.com> + Depends: foo:i686-linux-glibc (= 1.0-1) Installed-Size: 0 Description: Bit-bang All Registers This is a frobnicator of objects. Conveniently, it also $(: \ @@ -83,14 +84,36 @@ for run in 'first' 'second'; do . This package assists in bit-banging all yer registers. EOF - cmd_is 'control file' cat 'baz-qux.control/control' <<-EOF + cmd_is "${run} run baz+qux control file" cat 'baz+qux.control/control' \ + <<-EOF + Package: baz+qux + Source: foo + Version: 1.0-1 + Architecture: all + Platform: all + Maintainer: "J. Random Hacker" <jrandom@example.com> + Depends: foo:i686-linux-glibc (>= 1.0-1), $(: \ + )foo:i686-linux-glibc (<< 1.0-1.~), bar + Installed-Size: 0 + Description: Add all the things + This is a frobnicator of objects. Conveniently, it also $(: \ + )bit-bangs all + registers. + . + This package's name contains a plus sign, not to be $(: \ + )confused with the one that + instead contains a hyphen. + EOF + cmd_is "${run} baz-qux foo control file" cat 'baz-qux.control/control' \ + <<-EOF Package: baz-qux Source: foo Version: 1.0-1 Architecture: all Platform: all Maintainer: "J. Random Hacker" <jrandom@example.com> - Depends: bar + Depends: foo:i686-linux-glibc (>= 1.0-1), $(: \ + )foo:i686-linux-glibc (<< 1.0-1.~), bar Installed-Size: 0 Description: Hyphenate all the things This is a frobnicator of objects. Conveniently, it also $(: \ diff --git a/tests/exe/opkbuild.sh b/tests/exe/opkbuild.sh index e9f0808..d113e5b 100755 --- a/tests/exe/opkbuild.sh +++ b/tests/exe/opkbuild.sh @@ -51,7 +51,7 @@ cp -Rp '../src/' 'src/' command_ok_ 'opkbuild exit status' -- opkbuild -a i686-linux-glibc -p x60 -dc for opk in '../src:foo_1.0-1_src_all.opk' \ '../foo:i686-linux-glibc_1.0-1_i686-linux-glibc_all.opk' \ - '../bar_1.0-1_all_all.opk'; do + '../bar_1.0-1_i686-linux-glibc_all.opk'; do command_ok_ 'opk exists' -- [ -f "${opk}" ] cmd_is 'outer archive contents' ls_outer "${opk}" <<-EOF debian-binary @@ -73,7 +73,7 @@ cmd_is 'control.tar.gz contents' \ ./md5sums EOF cmd_is 'control.tar.gz contents' \ - ls_inner '../bar_1.0-1_all_all.opk' control.tar.gz <<-EOF + ls_inner '../bar_1.0-1_i686-linux-glibc_all.opk' control.tar.gz <<-EOF ./ ./control EOF @@ -93,7 +93,7 @@ cmd_is 'data.tar.gz contents' \ ./usr/share/doc/foo:i686-linux-glibc/copyright EOF cmd_is 'data.tar.gz contents' \ - ls_inner '../bar_1.0-1_all_all.opk' data.tar.gz <<-EOF + ls_inner '../bar_1.0-1_i686-linux-glibc_all.opk' data.tar.gz <<-EOF ./ ./usr/ ./usr/share/ diff --git a/tests/lib/ob_get_binary_parameter.sh b/tests/lib/ob_get_binary_parameter.sh index 1ad8a32..c85c3ec 100755 --- a/tests/lib/ob_get_binary_parameter.sh +++ b/tests/lib/ob_get_binary_parameter.sh @@ -23,7 +23,7 @@ set -eu . "${TOP_SRCDIR}/tests/aux/common.sh" . "${TOP_BUILDDIR}/lib/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" -plan_ 5 +plan_ 7 command_ok_ 'ob_init_package()' -- ob_init_package '..' @@ -32,6 +32,10 @@ is 'foo Architecture' \ is 'foo Platform' \ "$(ob_get_binary_parameter 'foo' 'Platform')" 'all' is 'bar Architecture' \ - "$(ob_get_binary_parameter 'bar' 'Architecture')" 'all' + "$(ob_get_binary_parameter 'bar' 'Architecture')" 'any' is 'bar Platform' \ "$(ob_get_binary_parameter 'bar' 'Platform')" 'all' +is 'baz-qux Architecture' \ + "$(ob_get_binary_parameter 'baz-qux' 'Architecture')" 'all' +is 'baz-qux Platform' \ + "$(ob_get_binary_parameter 'baz-qux' 'Platform')" 'all' diff --git a/tests/lib/ob_reduce_deps.sh b/tests/lib/ob_reduce_deps.sh index b1e8609..72f32dd 100755 --- a/tests/lib/ob_reduce_deps.sh +++ b/tests/lib/ob_reduce_deps.sh @@ -22,7 +22,7 @@ set -eu . "${TOP_SRCDIR}/tests/aux/tap-functions.sh" . "${TOP_BUILDDIR}/lib/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}" -plan_ 11 +plan_ 13 # Normal and union AND-lists. @@ -83,6 +83,15 @@ command_ok_ \ x'foo, bar' \ ] +command_ok_ \ + 'NORMAL LIST "foo, bar,"' -- \ + [ x"$(ob_reduce_deps \ + -a 'amd64-linux-glibc' \ + 'foo, bar,' \ + )" = \ + x'foo, bar' \ + ] + # Normal OR-lists. command_ok_ \ @@ -112,6 +121,15 @@ command_ok_ \ x'foo | bar' \ ] +command_ok_ \ + 'NORMAL LIST "foo | bar |"' -- \ + [ x"$(ob_reduce_deps \ + -a 'amd64-linux-glibc' \ + 'foo | bar |' \ + )" = \ + x'foo | bar' \ + ] + # Normal and union AND-lists with arch specs. command_ok_ \ diff --git a/tests/local.mk b/tests/local.mk index d2770f4..b986d2d 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -42,6 +42,7 @@ EXTRA_DIST += \ tests/aux/common.sh \ tests/data/pkg/README \ tests/data/pkg/bar.pkg/control \ + tests/data/pkg/baz+qux.pkg/control \ tests/data/pkg/baz-qux.pkg/control \ tests/data/pkg/build \ tests/data/pkg/changelog \ |