Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package build for openSUSE:Factory checked in at 2025-03-05 13:38:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/build (Old) and /work/SRC/openSUSE:Factory/.build.new.19136 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "build" Wed Mar 5 13:38:46 2025 rev:170 rq:1250015 version:20250304 Changes: -------- --- /work/SRC/openSUSE:Factory/build/build.changes 2025-02-09 20:00:24.583873057 +0100 +++ /work/SRC/openSUSE:Factory/.build.new.19136/build.changes 2025-03-05 13:39:05.044935350 +0100 @@ -1,0 +2,12 @@ +Tue Mar 4 10:15:35 UTC 2025 - Adrian Schröter <[email protected]> + +- fixes for POSIX compatibility for obs-docker-support adn + mkbaselibs +- Add support for apk in docker/podman builds +- Add support for 'wget' in Docker images +- Fix debian support for Dockerfile builds +- Fix preinstallimages in containers +- mkosi: add back system-packages used by build-recipe directly +- pbuild: parse the Release files for debian repos + +------------------------------------------------------------------- Old: ---- obs-build-20250206.tar.gz New: ---- obs-build-20250304.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ build.spec ++++++ --- /var/tmp/diff_new_pack.mwX1qt/_old 2025-03-05 13:39:07.585041906 +0100 +++ /var/tmp/diff_new_pack.mwX1qt/_new 2025-03-05 13:39:07.597042409 +0100 @@ -28,7 +28,7 @@ Summary: A Script to Build SUSE Linux RPMs License: GPL-2.0-only OR GPL-3.0-only Group: Development/Tools/Building -Version: 20250206 +Version: 20250304 Release: 0 Source: obs-build-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ PKGBUILD ++++++ --- /var/tmp/diff_new_pack.mwX1qt/_old 2025-03-05 13:39:07.945057008 +0100 +++ /var/tmp/diff_new_pack.mwX1qt/_new 2025-03-05 13:39:07.969058015 +0100 @@ -1,5 +1,5 @@ pkgname=build -pkgver=20250206 +pkgver=20250304 pkgrel=0 pkgdesc="Build packages in sandbox" arch=('i686' 'x86_64') ++++++ _service ++++++ --- /var/tmp/diff_new_pack.mwX1qt/_old 2025-03-05 13:39:08.097063385 +0100 +++ /var/tmp/diff_new_pack.mwX1qt/_new 2025-03-05 13:39:08.101063553 +0100 @@ -1,7 +1,7 @@ <services> <service name="tar_scm" mode="manual"> - <param name="revision">20250206</param> - <param name="version">20250206</param> + <param name="revision">20250304</param> + <param name="version">20250304</param> <param name="url">https://github.com/openSUSE/obs-build.git</param> <param name="scm">git</param> <param name="extract">dist/build.changes</param> ++++++ build.dsc ++++++ --- /var/tmp/diff_new_pack.mwX1qt/_old 2025-03-05 13:39:08.121064391 +0100 +++ /var/tmp/diff_new_pack.mwX1qt/_new 2025-03-05 13:39:08.129064727 +0100 @@ -1,6 +1,6 @@ Format: 1.0 Source: build -Version: 20250206 +Version: 20250304 Binary: build Maintainer: Adrian Schroeter <[email protected]> Architecture: all ++++++ debian.changelog ++++++ --- /var/tmp/diff_new_pack.mwX1qt/_old 2025-03-05 13:39:08.157065902 +0100 +++ /var/tmp/diff_new_pack.mwX1qt/_new 2025-03-05 13:39:08.161066070 +0100 @@ -1,4 +1,4 @@ -build (20250206) unstable; urgency=low +build (20250304) unstable; urgency=low * Update to current git trunk - add sles11sp2 build config and adapt autodetection ++++++ obs-build-20250206.tar.gz -> obs-build-20250304.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/Build/Apk.pm new/obs-build-20250304/Build/Apk.pm --- old/obs-build-20250206/Build/Apk.pm 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/Build/Apk.pm 2025-03-04 11:19:42.000000000 +0100 @@ -719,6 +719,30 @@ return $h . $data . ($size % 512 ? "\0" x (512 - $size % 512) : ''); } +sub getsignatures_cb { + my ($sigs, $entry) = @_; + die("end of sigs reached\n") unless $entry->is_file; + my $name = $entry->name; + die("end of sigs reached\n") unless $name =~ /^\.SIGN\./; + my $content = $entry->data; + return 1 unless $content; + push @$sigs, { 'signature' => $content, 'algo' => 'rsa', 'hash' => 'sha1', 'keyname' => $1 } if $name =~ /^\.SIGN\.RSA\.(.+)$/; + push @$sigs, { 'signature' => $content, 'algo' => 'rsa', 'hash' => 'sha256', 'keyname' => $1 } if $name =~ /^\.SIGN\.RSA256\.(.+)$/; + push @$sigs, { 'signature' => $content, 'algo' => 'rsa', 'hash' => 'sha512', 'keyname' => $1 } if $name =~ /^\.SIGN\.RSA512\.(.+)$/; + return 1; +} + +sub getsignatures { + my ($handle) = @_; + if (is_apkv3($handle)) { + die("getsignatures: apkv3 support is not implemented\n"); + } + my $tar = Archive::Tar->new; + my @sigs; + eval { $tar->read($handle, 1, { 'filter_cb' => sub {getsignatures_cb(\@sigs, @_)} }) }; + return @sigs; +} + sub replacesignature { my ($handle, $ohandle, $signature, $time, $algo, $hash, $keyname, $keyid) = @_; if (is_apkv3($handle)) { @@ -795,4 +819,19 @@ } } +sub canonname { + my ($handle) = @_; + my $qq; + if (is_apkv3($handle)) { + require Build::Apkv3 unless defined &Build::Apkv3::querypkginfo; + $qq = Build::Apkv3::querypkginfo($handle); + } else { + $qq = queryvars($handle); + } + die("bad apk package\n") unless $qq && defined($qq->{'pkgname'}) && defined($qq->{'pkgver'}); + my $cn = "$qq->{'pkgname'}-$qq->{'pkgver'}.apk"; + die("bad apk package\n") if $cn =~ /^\./ || $cn =~ /\// || $cn =~ /--/; + return $cn; +} + 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/Build/Debrepo.pm new/obs-build-20250304/Build/Debrepo.pm --- old/obs-build-20250206/Build/Debrepo.pm 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/Build/Debrepo.pm 2025-03-04 11:19:42.000000000 +0100 @@ -95,6 +95,8 @@ } else { if ($in =~ /\.gz$/) { open($fd, '-|', "gzip", "-dc", $in) || die("$in: $!\n"); + } elsif ($in =~ /\.xz$/) { + open($fd, '-|', "xz", "-dc", $in) || die("$in: $!\n"); } else { open($fd, '<', $in) || die("$in: $!\n"); } @@ -180,4 +182,19 @@ return $baseurl, $url, \@components; } +sub parserelease { + my ($release) = @_; + my %csums = ('md5sum' => 'md5', 'sha1' => 'sha1', 'sha256' => 'sha256', 'sha512' => 'sha512'); + my %files; + my $csum; + for (split("\n", $release)) { + $csum = $csums{lc($1)} if /^(\S+):/; + next unless $csum; + next unless /^ (\S+) +\d+ +(.*)$/s; + next if $files{$2} && length($files{$2}) > length("$csum:$1"); # bigger is better... + $files{$2} = "$csum:$1"; + } + return \%files; +} + 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/Build/Docker.pm new/obs-build-20250304/Build/Docker.pm --- old/obs-build-20250206/Build/Docker.pm 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/Build/Docker.pm 2025-03-04 11:19:42.000000000 +0100 @@ -181,6 +181,16 @@ } } +sub cmd_apk { + my ($ret, @args) = @_; + shift @args while @args && $args[0] =~ /^-/; + return unless @args; + if ($args[0] eq 'add') { + shift @args; + push @{$ret->{'deps'}}, grep {/^[a-zA-Z_0-9]/} @args; + } +} + sub cmd_curl { my ($ret, @args) = @_; my @urls; @@ -201,6 +211,23 @@ } } +sub cmd_wget { + my ($ret, @args) = @_; + my @urls; + while (@args) { + my $arg = shift @args; + if ($arg =~ /^-/) { + shift @args if $arg eq '-F' || $arg =~ /--post-data/ || $arg eq '-T' || $arg =~ /--timeout/ || $arg eq '-O' || $arg eq '--output-document' || $arg eq '-t' || $arg =~ /--tries/ || $arg eq '--user' || $arg eq '--password' || $arg eq '-U' || $arg eq '--user-agent' || $arg eq '--header'; + } else { + push @urls, $arg if $arg =~ /^https?:\/\//; + } + } + for my $url (@urls) { + my $asset = { 'url' => $url, 'type' => 'webcache' }; + push @{$ret->{'remoteassets'}}, $asset; + } +} + sub parse { my ($cf, $fn) = @_; @@ -376,8 +403,12 @@ cmd_dnf($ret, @args); } elsif ($rcmd eq 'apt-get') { cmd_apt_get($ret, @args); + } elsif ($rcmd eq 'apk') { + cmd_apk($ret, @args); } elsif ($rcmd eq 'curl') { cmd_curl($ret, @args); + } elsif ($rcmd eq 'wget') { + cmd_wget($ret, @args); } elsif ($rcmd eq 'obs_pkg_mgr') { cmd_obs_pkg_mgr($ret, @args); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/Build.pm new/obs-build-20250304/Build.pm --- old/obs-build-20250206/Build.pm 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/Build.pm 2025-03-04 11:19:42.000000000 +0100 @@ -159,13 +159,13 @@ 'apt-utils', 'cpio', 'dpkg-dev', 'live-build', 'lsb-release', 'tar', ], 'system-packages:mkosi:rpm' => [ - 'mkosi', + 'mkosi', 'createrepo', 'gzip', ], 'system-packages:mkosi:deb' => [ - 'mkosi', + 'mkosi', 'dpkg-dev', 'lsb-release', 'gzip', ], 'system-packages:mkosi:arch' => [ - 'mkosi', + 'mkosi', 'arch-install-scripts', 'gzip', ], 'system-packages:mock' => [ 'mock', 'system-packages:repo-creation', @@ -203,6 +203,9 @@ 'system-packages:repo-creation:arch' => [ 'pacman', ], + 'system-packages:repo-creation:apk' => [ + 'apk-tools', + ], ); sub unify { @@ -794,8 +797,8 @@ # be used instead. sub get_sysbuild { my ($config, $buildtype, $extradeps) = @_; - my $engine = $config->{'buildengine'} || ''; $buildtype ||= $config->{'type'} || ''; + my $engine = $config->{'buildengine'} || $config->{"buildflags:buildengine.$buildtype"} || ''; my @sysdeps; if ($engine eq 'mock' && $buildtype eq 'spec') { @sysdeps = @{$config->{'substitute'}->{'system-packages:mock'} || []}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/PBuild/Recipe.pm new/obs-build-20250304/PBuild/Recipe.pm --- old/obs-build-20250206/PBuild/Recipe.pm 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/PBuild/Recipe.pm 2025-03-04 11:19:42.000000000 +0100 @@ -42,8 +42,8 @@ return $files{'fissile.yml'} if $type eq 'fissile' && $files{'fissile.yml'}; return $files{'Chart.yaml'} if $type eq 'helm' && $files{'Chart.yaml'}; return (grep {/flatpak\.(?:ya?ml|json)$/} sort keys %files)[0] if $type eq 'flatpak'; - return $files{'PKGBUILD'} ? $files{'PKGBUILD'} : undef if $type eq 'arch'; - return $files{'APKBUILD'} ? $files{'APKBUILD'} : undef if $type eq 'apk'; + return $files{'PKGBUILD'} if $type eq 'arch' && $files{'PKGBUILD'}; + return $files{'APKBUILD'} if $type eq 'apk' && $files{'APKBUILD'}; my $pkg = $p->{'pkg'}; $pkg = $p->{'flavor'} if $p->{'flavor'}; return $files{"Dockerfile.$pkg"} if $type eq 'docker' && $files{"Dockerfile.$pkg"}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/PBuild/RemoteRepo.pm new/obs-build-20250304/PBuild/RemoteRepo.pm --- old/obs-build-20250206/PBuild/RemoteRepo.pm 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/PBuild/RemoteRepo.pm 2025-03-04 11:19:42.000000000 +0100 @@ -74,9 +74,14 @@ } sub download { - my ($url, $dest, $destfinal, $digest, $ua) = @_; + my ($url, $dest, $destfinal, $digest, %opts) = @_; return download_zypp($url, $destfinal || $dest, $digest) if $url =~ /^zypp:\/\//; - Build::Download::download($url, $dest, $destfinal, 'digest' => $digest, 'ua' => $ua, 'retry' => 3); + Build::Download::download($url, $dest, $destfinal, 'digest' => $digest, 'retry' => 3, %opts); +} + +sub fetch { + my ($url, $digest, %opts) = @_; + return Build::Download::fetch($url, 'digest' => $digest, 'retry' => 3, %opts); } sub addpkg { @@ -116,17 +121,25 @@ my ($baseurl, $disturl, $components) = Build::Debrepo::parserepourl($url); die("fetchrepo_debian needs an architecture\n") unless $opts{'arch'}; my $basearch = Build::Deb::basearch($opts{'arch'}); + my $files = {}; + if (grep {$_ ne '.'} @$components) { + my ($release) = fetch("${disturl}Release"); + $files = Build::Debrepo::parserelease($release); + } my @bins; for my $component (@$components) { + unlink("$tmpdir/Packages.xz"); unlink("$tmpdir/Packages.gz"); + my $pfile = 'Packages.gz'; if ($component eq '.') { - download("${disturl}Packages.gz", "$tmpdir/Packages.gz"); - die("Packages.gz missing\n") unless -s "$tmpdir/Packages.gz"; + download("${disturl}Packages.gz", "$tmpdir/$pfile"); + die("Packages.gz missing\n") unless -s "$tmpdir/$pfile"; } else { - download("$disturl$component/binary-$basearch/Packages.gz", "$tmpdir/Packages.gz"); - die("Packages.gz missing for basearch $basearch, component $component\n") unless -s "$tmpdir/Packages.gz"; + $pfile = 'Packages.xz' if $files->{"$component/binary-$basearch/Packages.xz"}; + download("$disturl$component/binary-$basearch/$pfile", "$tmpdir/$pfile", undef, $files->{"$component/binary-$basearch/$pfile"}); + die("$pfile missing for basearch $basearch, component $component\n") unless -s "$tmpdir/$pfile"; } - Build::Debrepo::parse("$tmpdir/Packages.gz", sub { addpkg(\@bins, $_[0], $baseurl) }, 'addselfprovides' => 1, 'withchecksum' => 1, 'normalizedeps' => 1); + Build::Debrepo::parse("$tmpdir/$pfile", sub { addpkg(\@bins, $_[0], $baseurl) }, 'addselfprovides' => 1, 'withchecksum' => 1, 'normalizedeps' => 1); } return \@bins; } @@ -537,12 +550,12 @@ if ($bin->{'name'} =~ /^container:/) { # we cannot query containers, just download and set the filename die("container has no hdrmd5\n") unless $bin->{'hdrmd5'}; - download($location, "$repodir/$tmpname", "$repodir/$binname", "md5:$bin->{'hdrmd5'}", $ua); + download($location, "$repodir/$tmpname", "$repodir/$binname", "md5:$bin->{'hdrmd5'}", 'ua' => $ua); delete $bin->{'id'}; $bin->{'filename'} = $binname; next; } - download($location, "$repodir/$tmpname", undef, undef, $ua); + download($location, "$repodir/$tmpname", undef, undef, 'ua' => $ua); fetchbinaries_replace($repodir, $tmpname, $binname, $bin); } # update _metadata @@ -590,7 +603,7 @@ PBuild::Verify::verify_filename($binname); my $tmpname = ".$$.$binname"; $ua ||= Build::Download::create_ua(); - download($location, "$repodir/$tmpname", undef, undef, $ua); + download($location, "$repodir/$tmpname", undef, undef, 'ua' => $ua); fetchproductbinaries_replace($repodir, $tmpname, $binname, $bin); } # copy filename into real gbininfo as we clone the bininfo in the Checker diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/build-recipe new/obs-build-20250304/build-recipe --- old/obs-build-20250206/build-recipe 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/build-recipe 2025-03-04 11:19:42.000000000 +0100 @@ -150,6 +150,10 @@ if test -n "$BUILD_DIST" ; then BUILDENGINE=`queryconfig buildengine --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"` test "$BUILDENGINE" = UNDEFINED && BUILDENGINE= + if test -z "$BUILDENGINE" ; then + BUILDENGINE=`queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" buildflags "buildengine.$BUILDTYPE"` + test "$BUILDENGINE" = UNDEFINED && BUILDENGINE= + fi fi fi # tweak buildtype according to engine diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/build-recipe-docker new/obs-build-20250304/build-recipe-docker --- old/obs-build-20250206/build-recipe-docker 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/build-recipe-docker 2025-03-04 11:19:42.000000000 +0100 @@ -129,8 +129,8 @@ base_image_tag=$(grep "^\s*FROM" "$RECIPEFILE" | head -n 1 | cut -d" " -f2) if test "$base_image_tag" != scratch ; then - base_image_path=$(find containers -regextype egrep -regex ".*\.(tgz|tar|tar\.xz|tar\.gz)$" -print -quit) - test -f "$base_image_path" || cleanup_and_exit 1 "base image not found" + base_image_path=$(find containers -name \*.tgz -print -quit -o -name \*.tar -print -quit -o -name \*.tar.\[gx\]z -print -quit) + test -n "$base_image_path" -a -f "$base_image_path" || cleanup_and_exit 1 "base image not found" fi mkdir -p "$BUILD_ROOT/$TOPDIR/SOURCES/repos" @@ -153,7 +153,7 @@ fi chmod 755 "$BUILD_ROOT/$TOPDIR/SOURCES/.obs-docker-support" - for base_image_path in $(find containers -regextype egrep -regex "containers/.*\.(tgz|tar|tar\.xz|tar\.gz)$" -print) ; do + for base_image_path in $(find containers -name \*.tgz -print -o -name \*.tar -print -o -name \*.tar.\[gx\]z -print) ; do echo "Loading base image ${base_image_path##*/}" if test -L "$base_image_path" ; then # copy into build root @@ -181,6 +181,16 @@ if chroot $BUILD_ROOT test -x /usr/bin/dpkg-scanpackages ; then chroot $BUILD_ROOT bash -c "cd $TOPDIR/SOURCES/repos && dpkg-scanpackages -m . | gzip > Packages.gz" fi + if chroot $BUILD_ROOT test -x /sbin/apk ; then + apk_arch=$(chroot $BUILD_ROOT apk --print-arch) + test -n "$apk_arch" || cleanup_and_exit 1 "could not determine apk arch" + mkdir -p "$BUILD_ROOT/$TOPDIR/SOURCES/repos/$apk_arch" + find "$BUILD_ROOT/$TOPDIR/SOURCES/repos" -name \*.apk -print | while read apk ; do + apk_cn=$(perl -I$BUILD_DIR -MBuild::Apk -e 'print Build::Apk::canonname($ARGV[0])' $apk) + test -n "$apk_cn" && ln -f $apk "$BUILD_ROOT/$TOPDIR/SOURCES/repos/$apk_arch/$apk_cn" + done + chroot $BUILD_ROOT bash -c "cd $TOPDIR/SOURCES/repos/$apk_arch && apk index --allow-untrusted --rewrite-arch $apk_arch *.apk" > "$BUILD_ROOT/$TOPDIR/SOURCES/repos/$apk_arch/APKINDEX.tar.gz" + fi mkdir -p "$BUILD_ROOT/$TOPDIR/SOURCES/repos/UPLOAD" # Prepare the webcache diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/build-recipe-mkosi new/obs-build-20250304/build-recipe-mkosi --- old/obs-build-20250206/build-recipe-mkosi 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/build-recipe-mkosi 2025-03-04 11:19:42.000000000 +0100 @@ -114,7 +114,7 @@ $image_version \ --nspawn-keep-unit \ --output-dir "$TOPDIR/OTHER" \ - --checksum \ + --checksum=yes \ --repository-key-check=no \ --with-network=never \ --local-mirror file:///.build.binaries/ \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/dist/build.changes new/obs-build-20250304/dist/build.changes --- old/obs-build-20250206/dist/build.changes 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/dist/build.changes 2025-03-04 11:19:42.000000000 +0100 @@ -1,4 +1,16 @@ ------------------------------------------------------------------- +Tue Mar 4 10:15:35 UTC 2025 - Adrian Schröter <[email protected]> + +- fixes for POSIX compatibility for obs-docker-support adn + mkbaselibs +- Add support for apk in docker/podman builds +- Add support for 'wget' in Docker images +- Fix debian support for Dockerfile builds +- Fix preinstallimages in containers +- mkosi: add back system-packages used by build-recipe directly +- pbuild: parse the Release files for debian repos + +------------------------------------------------------------------- Thu Feb 6 13:50:34 UTC 2025 - Adrian Schröter <[email protected]> - mkosi: drop most systemd/build-packages deps and use obs_scm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/init_buildsystem new/obs-build-20250304/init_buildsystem --- old/obs-build-20250206/init_buildsystem 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/init_buildsystem 2025-03-04 11:19:42.000000000 +0100 @@ -279,11 +279,19 @@ check_exit echo "unpacking preinstall image${2:+ $2}" preinstall_setup + + TAR_EXCLUDES="--exclude .build --exclude .init_b_cache" + + if [ -f "/run/.containerenv" ]; then + # we're running in a podman container and we probably don't have sufficient capabilities to create special files + TAR_EXCLUDES="$TAR_EXCLUDES --exclude dev/* --exclude proc/* --exclude run/* --exclude sys/*" + fi + if test -x /usr/bin/bsdtar ; then - TAR="/usr/bin/bsdtar --exclude .build --exclude .init_b_cache -P --chroot --numeric-owner -x" + TAR="/usr/bin/bsdtar $TAR_EXCLUDES -P --chroot --numeric-owner -x" else unsafe_preinstall_check - TAR="tar --exclude .build --exclude .init_b_cache -x" + TAR="tar $TAR_EXCLUDES -x" fi if ! $TAR -f "$BUILD_INIT_CACHE/rpms/$1" ; then echo "ERROR: unpack failed." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/mkbaselibs new/obs-build-20250304/mkbaselibs --- old/obs-build-20250206/mkbaselibs 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/mkbaselibs 2025-03-04 11:19:42.000000000 +0100 @@ -785,7 +785,7 @@ if (@cfl) { if ($prefix ne '') { print SPEC "mkdir -p \$RPM_BUILD_ROOT$prefix\n"; - print SPEC "pushd \$RPM_BUILD_ROOT$prefix\n"; + print SPEC "cd \$RPM_BUILD_ROOT$prefix\n"; } print SPEC "cat <<EOFL >.filelist\n"; print SPEC "$_\n" for map {$cpiopre.substr($_, 1)} @cfl; @@ -802,17 +802,17 @@ } } if ($prefix ne '') { - print SPEC "popd\n"; + print SPEC "cd -\n"; } } if (%cfiles || %moves) { print SPEC "mkdir -p .cfiles\n"; - print SPEC "pushd .cfiles\n"; + print SPEC "cd .cfiles\n"; print SPEC "cat <<EOFL >.filelist\n"; print SPEC "$_\n" for map {$cpiopre.substr($_, 1)} grep {$cfiles{$_} || $moves{$_}} sort keys %files; print SPEC "EOFL\n"; print SPEC "rpm2cpio $rpm | cpio -i -d -v -E .filelist\n"; - print SPEC "popd\n"; + print SPEC "cd -\n"; if (%cfiles) { print SPEC "mkdir -p \$RPM_BUILD_ROOT$configdir\n"; print SPEC "mv .cfiles$_ \$RPM_BUILD_ROOT$configdir\n" for sort keys %cfiles; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/obs-docker-support new/obs-build-20250304/obs-docker-support --- old/obs-build-20250206/obs-docker-support 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/obs-docker-support 2025-03-04 11:19:42.000000000 +0100 @@ -25,49 +25,120 @@ # ################################################################ + LOCAL_REPOS_D="/etc/repos_obs_dockersupport.d/" LOCAL_APTREPOS_D="/etc/aptrepos_obs_dockersupport.d/" +LOCAL_APKREPOS="/etc/apkrepos_obs_dockersupport" DATA_DIR= -zypper() { - local cmd - # try to find the command - local globalopts - typeset -a globalopts - while test -n "$1"; do - case $1 in +sentinel="oBs-d--s--" +testmode= + +setup_repos() { + local data_url="$1" + mkdir -p "$LOCAL_REPOS_D" + cat >$LOCAL_REPOS_D/obs_repository.repo <<EOF +[obs_repository] +name=obs_repository +enabled=1 +autorefresh=0 +baseurl=$data_url +type=rpm-md +gpgcheck=0 +EOF + test -x /usr/bin/zypper && /usr/bin/zypper -D $LOCAL_REPOS_D ref +} + +finish_repos() { + rm -rf "$LOCAL_REPOS_D" +} + +setup_aptrepos() { + mkdir -p "$LOCAL_APTREPOS_D" + local data_url="$1" + echo "deb [trusted=yes] $data_url ./" > $LOCAL_APTREPOS_D/obssource + test -e /var/lib/apt && mv /var/lib/apt /var/lib/apt.obssave + test -e /usr/bin/apt-get && /usr/bin/apt-get -o Dir::Etc::SourceList=$LOCAL_APTREPOS_D/obssource -o Dir::Etc::SourceParts=$LOCAL_APTREPOS_D update +} + +finish_aptrepos() { + rm -rf "$LOCAL_APTREPOS_D" + if test -e /var/lib/apt.obssave ; then + rm -rf /var/lib/apt + mv /var/lib/apt.obssave /var/lib/apt + fi +} + +setup_apkrepos() { + echo "$data_url" > "$LOCAL_APKREPOS" +} + +finish_apkrepos() { + rm -f "$LOCAL_APKREPOS" +} + +testdone() { + local i + test exec = "$1" && shift + echo -n $1 + shift + for i ; do echo -n ' "'"$i"'"' ; done + echo + exit 0 +} + + +# add a -C after the ar command and replace remove "/*.repo" from +# the args +zypper_ar() { + set -- "$@" "$sentinel" + local o + while test "$sentinel" != "$1" ; do + o="$1" ; shift ; set -- "$@" $o + test "$sentinel" = "$1" && break + case "$o" in -R|--root|--installroot) - globalopts[${#globalopts[@]}]="$1" - globalopts[${#globalopts[@]}]="$2" - shift 2 - ;; - -*) - globalopts[${#globalopts[@]}]="$1" - shift + o="$1" ; shift ; set -- "$@" $o ;; - *) - cmd=$1 - shift + ar|addrepo) + set -- "$@" -C break ;; esac done + while test "$sentinel" != "$1" ; do + o="$1" + shift + set -- "$@" "${o%/*.repo}" + done + shift + $testmode exec /usr/bin/zypper "$@" +} + +zypper() { + local cmd skip i + # try to find the command + for i ; do + case "$skip$i" in + -R|--root|--installroot) skip='-x' ;; + -*) skip= ;; + *) cmd="$i" ; break ;; + esac + done case $cmd in in|install|rm|remove|up|update|if|info) - /usr/bin/zypper -D $LOCAL_REPOS_D "${globalopts[@]}" "$cmd" "$@" - s=$? - setup_links - exit $s + $testmode /usr/bin/zypper -D $LOCAL_REPOS_D "$@" + setup_links_and_exit $? ;; ar|addrepo) - exec /usr/bin/zypper "${globalopts[@]}" "$cmd" -C "${@%/*.repo}" + zypper_ar "$@" ;; ref|refresh) echo "skipping zypper refresh" exit 0 ;; *) - exec /usr/bin/zypper "${globalopts[@]}" "$cmd" "$@" + $testmode exec /usr/bin/zypper "$@" ;; esac } @@ -76,14 +147,12 @@ case "$1" in install|remove) shift - /usr/bin/zypper -D $LOCAL_REPOS_D --no-gpg-checks -n in "$@" - s=$? - setup_links - exit $s + $testmode /usr/bin/zypper -D $LOCAL_REPOS_D --no-gpg-checks -n in "$@" + setup_links_and_exit $? ;; add_repo) shift - exec /usr/bin/zypper ar -C "$@" + $testmode exec /usr/bin/zypper ar -C "$@" ;; *) echo "Usage: obs_pkg_mgr (install|add_repo) args" >&2 @@ -93,21 +162,12 @@ } apt_get() { - local cmd + local cmd i # try to find the command - local globalopts - typeset -a globalopts - while test -n "$1"; do - case $1 in - -*) - globalopts[${#globalopts[@]}]="$1" - shift - ;; - *) - cmd=$1 - shift - break - ;; + for i ; do + case "$i" in + -*) ;; + *) cmd="$i" ; break ;; esac done case $cmd in @@ -115,112 +175,138 @@ exit 0 ;; install|upgrade) - /usr/bin/apt-get -o Dir::Etc::SourceList=$LOCAL_APTREPOS_D/obssource -o Dir::Etc::SourceParts=$LOCAL_APTREPOS_D --allow-unauthenticated "${globalopts[@]}" "$cmd" "$@" - s=$? - setup_links - exit $s + $testmode /usr/bin/apt-get -o Dir::Etc::SourceList=$LOCAL_APTREPOS_D/obssource -o Dir::Etc::SourceParts=$LOCAL_APTREPOS_D --allow-unauthenticated "$@" + setup_links_and_exit $? ;; *) - exec /usr/bin/apt-get "${globalopts[@]}" "$cmd" "$@" + $testmode exec /usr/bin/apt-get "$@" ;; esac } dnf() { - # try to find command - local globalopts - typeset -a globalopts - while test -n "$1"; do - case $1 in - -*) - globalopts[${#globalopts[@]}]="$1" - shift - ;; - *) - cmd=$1 - shift - break - ;; + local cmd i + # try to find the command + for i ; do + case "$i" in + -*) ;; + *) cmd="$i" ; break ;; esac done case $cmd in in|install|up|update) - /usr/bin/dnf --setopt=reposdir=$LOCAL_REPOS_D "${globalopts[@]}" "$cmd" "$@" - s=$? - setup_links - exit $s + $testmode /usr/bin/dnf --setopt=reposdir=$LOCAL_REPOS_D "$@" + setup_links_and_exit $? ;; *) - exec /usr/bin/dnf "${globalopts[@]}" "$cmd" "$@" + $testmode exec /usr/bin/dnf "$@" ;; esac } yum() { - # try to find command - global globalopts - typeset -a globalopts - while test -n "$1"; do - case $1 in - -*) - globalopts[${#globalopts[@]}]="$1" - shift - ;; - *) - cmd=$1 - shift - break - ;; + local cmd i + # try to find the command + for i ; do + case "$i" in + -*) ;; + *) cmd="$i" ; break ;; esac done case $cmd in in|install|up|update) - /usr/bin/yum --setopt=reposdir=$LOCAL_REPOS_D "${globalopts[@]}" "$cmd" "$@" - s=$? - setup_links - exit $s + $testmode /usr/bin/yum --setopt=reposdir=$LOCAL_REPOS_D "$@" + setup_links_and_exit $? ;; *) - exec /usr/bin/yum "${globalopts[@]}" "$cmd" "$@" + $testmode exec /usr/bin/yum "$@" + ;; + esac +} + +apk() { + local cmd i + # try to find the command + for i ; do + case "$i" in + -*) ;; + *) cmd="$i" ; break ;; + esac + done + case $cmd in + add|del) + $testmode /sbin/apk --repositories-file ../../../../$LOCAL_APKREPOS --allow-untrusted "$@" + setup_links_and_exit $? + ;; + *) + $testmode exec /sbin/apk "$@" ;; esac } curl() { - local cmd - typeset -a cmd - local oopt - local oname - while test -n "$1" ; do - case "$1" in + local o + local coopt fname + set -- "$@" "$sentinel" + while test "$sentinel" != "$1" ; do + o="$1" ; shift + case "$o" in http://* | https://*) - url=$1 - urlsha256=$(echo -n $url | sha256sum -) + fname="${o%%\?*}" + fname="${o##*/}" + urlsha256=$(echo -n "$o" | sha256sum -) urlsha256="${urlsha256%% *}" if test -n "$DATA_DIR" ; then - cmd[${#cmd[@]}]="file:$DATA_DIR/build-webcache/$urlsha256" + o="file:$DATA_DIR/build-webcache/$urlsha256" else - cmd[${#cmd[@]}]="localhost:80/build-webcache/$urlsha256" + o="localhost:80/build-webcache/$urlsha256" fi - oname="${url%%\?*}" - oname="${url##*/}" - shift + set -- "$@" "$o" ;; -O) - oopt=true - shift + coopt=true ;; - *) - cmd[${#cmd[@]}]="$1" - shift + *) set -- "$@" "$o" ;; + esac + done + shift + if test -n "$coopt" -a -n "$fname" ; then + set "$@" "-o" "$fname" + fi + $testmode exec /usr/bin/curl "$@" +} + +wget() { + local o + local oopt fname + set -- "$@" "$sentinel" + while test "$sentinel" != "$1" ; do + o="$1" ; shift + case "$o" in + http://* | https://*) + fname="${o%%\?*}" + fname="${o##*/}" + urlsha256=$(echo -n "$o" | sha256sum -) + urlsha256="${urlsha256%% *}" + if test -n "$DATA_DIR" ; then + o="file:$DATA_DIR/build-webcache/$urlsha256" + else + o="localhost:80/build-webcache/$urlsha256" + fi + set -- "$@" "$o" + ;; + -O|--output-document) + oopt=true + set -- "$@" "$o" ;; + *) set -- "$@" "$o" ;; esac done - if test -n "$oopt" -a -n "$oname" ; then - cmd[${#cmd[@]}]="-o" - cmd[${#cmd[@]}]="$oname" + shift + if test -z "$oopt" -a -n "$fname" ; then + set "$@" "-O" "$fname" fi - exec /usr/bin/curl "${cmd[@]}" + $testmode exec /usr/bin/wget "$@" } upload_with_perl=' @@ -263,7 +349,14 @@ test -e /usr/bin/yum -a ! -e /usr/local/sbin/yum && ln -s obs-docker-support /usr/local/sbin/yum test -e /usr/bin/dnf -a ! -e /usr/local/sbin/dnf && ln -s obs-docker-support /usr/local/sbin/dnf test -e /usr/bin/apt-get -a ! -e /usr/local/sbin/apt-get && ln -s obs-docker-support /usr/local/sbin/apt-get + test -e /sbin/apk -a ! -e /usr/local/sbin/apk && ln -s obs-docker-support /usr/local/sbin/apk test -e /usr/bin/curl -a ! -e /usr/local/sbin/curl && ln -s obs-docker-support /usr/local/sbin/curl + test -e /usr/bin/wget -a ! -e /usr/local/sbin/wget && ln -s obs-docker-support /usr/local/sbin/wget +} + +setup_links_and_exit() { + setup_links + exit $1 } remove_links() { @@ -271,12 +364,14 @@ rm -f /usr/local/sbin/yum rm -f /usr/local/sbin/dnf rm -f /usr/local/sbin/apt-get + rm -f /usr/local/sbin/apk rm -f /usr/local/sbin/curl + rm -f /usr/local/sbin/wget } obs_docker_support() { local do_upload_packages - if test "x$1" == x--upload-packages ; then + if test "x$1" = x--upload-packages ; then do_upload_packages=true shift fi @@ -287,37 +382,24 @@ setup_links ln -s obs-docker-support /usr/local/sbin/obs_pkg_mgr if test -e /usr/bin/zypper -o -e /usr/bin/yum -o -e /usr/bin/dnf ; then - mkdir -p "$LOCAL_REPOS_D" - cat >$LOCAL_REPOS_D/obs_repository.repo <<EOF -[obs_repository] -name=obs_repository -enabled=1 -autorefresh=0 -baseurl=$data_url -type=rpm-md -gpgcheck=0 -EOF - test -x /usr/bin/zypper && /usr/bin/zypper -D $LOCAL_REPOS_D ref + setup_repos "$data_url" fi if test -e /usr/bin/apt-get ; then - mkdir -p "$LOCAL_APTREPOS_D" - echo "deb $data_url ./" > $LOCAL_APTREPOS_D/obssource - test -e /var/lib/apt && mv /var/lib/apt /var/lib/apt.obssave - /usr/bin/apt-get -o Dir::Etc::SourceList=$LOCAL_APTREPOS_D/obssource -o Dir::Etc::SourceParts=$LOCAL_APTREPOS_D update + setup_aptrepos "$data_url" + fi + if test -e /sbin/apk ; then + setup_apkrepos "$data_url" fi if test -n "$do_upload_packages" ; then upload_packages basepackages fi ;; --uninstall|-u) - rm -rf "$LOCAL_REPOS_D" - rm -rf "$LOCAL_APTREPOS_D" remove_links rm -f /usr/local/sbin/obs_pkg_mgr - if test -e /var/lib/apt.obssave ; then - rm -rf /var/lib/apt - mv /var/lib/apt.obssave /var/lib/apt - fi + finish_repos + finish_aptrepos + finish_apkrepos if test -n "$do_upload_packages" ; then upload_packages packages upload_packages pkgsummaries @@ -327,8 +409,15 @@ esac } -if test `id -u` != "0"; then - echo <<EOF +prg=${0##*/} +if test "$prg" = obs-docker-support -a "x$1" = x--testmode ; then + testmode=testdone + prg="$2" + shift 2 +fi + +if test `id -u` != 0 && test -z "$testmode" ; then + cat <<EOF obs-docker-support: not executed as root user! This can happen if your base container (see FROM line) is setting USER already, then builds in dependent container run as that user/group. @@ -336,7 +425,7 @@ exit 1 fi -case ${0##*/} in +case "$prg" in obs-docker-support) obs_docker_support "$@" ;; @@ -352,12 +441,18 @@ curl) curl "$@" ;; +wget) + wget "$@" + ;; dnf) dnf "$@" ;; yum) yum "$@" ;; +apk) + apk "$@" + ;; *) echo "obs-docker-support: unsupported mode ${0##*/}" >&2 exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/t/obs_docker_support.t new/obs-build-20250304/t/obs_docker_support.t --- old/obs-build-20250206/t/obs_docker_support.t 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20250304/t/obs_docker_support.t 2025-03-04 11:19:42.000000000 +0100 @@ -0,0 +1,53 @@ +#!/usr/bin/perl -w + +use strict; +use Test::More tests => 17; + +my @t = ( + [ 'zypper', 'rm', 'zypper' ] + => '/usr/bin/zypper "-D" "/etc/repos_obs_dockersupport.d/" "rm" "zypper"', + [ 'zypper', 'in', 'foo', 'bar' ] + => '/usr/bin/zypper "-D" "/etc/repos_obs_dockersupport.d/" "in" "foo" "bar"', + [ 'zypper', '--root', '/tmp/root', 'ar', 'https://xx.foo/zz.repo', 'zz' ] + => '/usr/bin/zypper "--root" "/tmp/root" "ar" "-C" "https://xx.foo" "zz"', + [ 'zypper', 'ref' ] + => 'skipping zypper refresh', + [ 'zypper', 'al', 'xx' ] + => '/usr/bin/zypper "al" "xx"', + + [ 'apt-get', 'install', 'screen' ] + => '/usr/bin/apt-get "-o" "Dir::Etc::SourceList=/etc/aptrepos_obs_dockersupport.d//obssource" "-o" "Dir::Etc::SourceParts=/etc/aptrepos_obs_dockersupport.d/" "--allow-unauthenticated" "install" "screen"', + [ 'apt-get', 'remove', 'bash' ] + => '/usr/bin/apt-get "remove" "bash"', + + [ 'dnf', 'install', 'xterm' ] + => '/usr/bin/dnf "--setopt=reposdir=/etc/repos_obs_dockersupport.d/" "install" "xterm"', + [ 'dnf', 'remove', 'systemd' ] + => '/usr/bin/dnf "remove" "systemd"', + + [ 'apk', 'add', 'bash' ] + => '/sbin/apk "--repositories-file" "../../../..//etc/apkrepos_obs_dockersupport" "--allow-untrusted" "add" "bash"', + [ 'apk', 'del', 'busybox' ] + => '/sbin/apk "--repositories-file" "../../../..//etc/apkrepos_obs_dockersupport" "--allow-untrusted" "del" "busybox"', + [ 'apk', 'update' ] + => '/sbin/apk "update"', + + [ 'curl', 'https://localhost/etc/passwd' ] + => '/usr/bin/curl "localhost:80/build-webcache/7278874b7b1d5162d96b7ad842122d26c50d05924a3e6efa6634c28578fe4dfd"', + [ 'curl', '-O', 'https://localhost/etc/passwd' ] + => '/usr/bin/curl "localhost:80/build-webcache/7278874b7b1d5162d96b7ad842122d26c50d05924a3e6efa6634c28578fe4dfd" "-o" "passwd"', + [ 'curl', '-o', 'pw', 'https://localhost/etc/passwd' ] + => '/usr/bin/curl "-o" "pw" "localhost:80/build-webcache/7278874b7b1d5162d96b7ad842122d26c50d05924a3e6efa6634c28578fe4dfd"', + + [ 'wget', 'https://localhost/etc/passwd' ] + => '/usr/bin/wget "localhost:80/build-webcache/7278874b7b1d5162d96b7ad842122d26c50d05924a3e6efa6634c28578fe4dfd" "-O" "passwd"', + [ 'wget', '-O', 'pw', 'https://localhost/etc/passwd' ] + => '/usr/bin/wget "-O" "pw" "localhost:80/build-webcache/7278874b7b1d5162d96b7ad842122d26c50d05924a3e6efa6634c28578fe4dfd"', +); + +while (@t) { + my ($t, $expected) = splice(@t, 0, 2); + my $result = `./obs-docker-support --testmode @$t`; + chomp($result); + is($result, $expected, "@$t"); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20250206/t/parse_docker.t new/obs-build-20250304/t/parse_docker.t --- old/obs-build-20250206/t/parse_docker.t 2025-02-06 14:51:38.000000000 +0100 +++ new/obs-build-20250304/t/parse_docker.t 2025-03-04 11:19:42.000000000 +0100 @@ -18,15 +18,35 @@ # debug RUN cat /etc/os-release +RUN zypper install wget curl + +RUN curl -sL --output /usr/bin/example-curl --retry 3 -u "foo:bar" https://localhost:8080/example-curl +RUN wget -O /usr/bin/example-wget -t 3 --user foo --password bar https://localhost:8080/example-wget + FROM opensuse/leap:15.2 }; $expected = { 'name' => 'docker', - 'deps' => ['container:opensuse/tumbleweed:latest', 'container:opensuse/leap:15.2'], + 'deps' => [ + 'container:opensuse/tumbleweed:latest', + 'wget', + 'curl', + 'container:opensuse/leap:15.2', + ], 'path' => [], 'imagerepos' => [], 'basecontainer' => 'opensuse/leap:15.2', + 'remoteassets' => [ + { + 'type' => 'webcache', + 'url' => 'https://localhost:8080/example-curl' + }, +{ + 'type' => 'webcache', + 'url' => 'https://localhost:8080/example-wget' + } + ], }; $result = Build::Docker::parse($conf, \$dockerfile);
