Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package build for openSUSE:Factory checked in at 2022-06-23 10:22:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/build (Old) and /work/SRC/openSUSE:Factory/.build.new.1548 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "build" Thu Jun 23 10:22:03 2022 rev:144 rq:983980 version:20220613 Changes: -------- --- /work/SRC/openSUSE:Factory/build/build.changes 2022-05-05 23:04:24.561408704 +0200 +++ /work/SRC/openSUSE:Factory/.build.new.1548/build.changes 2022-06-23 10:22:07.455600068 +0200 @@ -1,0 +2,13 @@ +Mon Jun 13 12:39:58 UTC 2022 - Adrian Schr??ter <adr...@suse.de> + +- regression fix for Debian Source format 3.0 (quilt), also adding + changelog modification now + +------------------------------------------------------------------- +Tue May 31 09:10:07 UTC 2022 - Adrian Schr??ter <adr...@suse.de> + +- Revert "avod aio=io_uring for now on SLE15-SP4 workers" +- deb: defer dpkg triggers until all packages are installed, and disable man-db altogether +- Add support of Debian Source format 3.0 (quilt) + +------------------------------------------------------------------- Old: ---- obs-build-20220429.tar.gz New: ---- obs-build-20220613.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ build.spec ++++++ --- /var/tmp/diff_new_pack.FdpeiF/_old 2022-06-23 10:22:08.515601220 +0200 +++ /var/tmp/diff_new_pack.FdpeiF/_new 2022-06-23 10:22:08.519601225 +0200 @@ -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: 20220429 +Version: 20220613 Release: 0 Source: obs-build-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ PKGBUILD ++++++ --- /var/tmp/diff_new_pack.FdpeiF/_old 2022-06-23 10:22:08.555601264 +0200 +++ /var/tmp/diff_new_pack.FdpeiF/_new 2022-06-23 10:22:08.559601268 +0200 @@ -1,5 +1,5 @@ pkgname=build -pkgver=20220429 +pkgver=20220613 pkgrel=0 pkgdesc="Build packages in sandbox" arch=('i686' 'x86_64') ++++++ _service ++++++ --- /var/tmp/diff_new_pack.FdpeiF/_old 2022-06-23 10:22:08.579601290 +0200 +++ /var/tmp/diff_new_pack.FdpeiF/_new 2022-06-23 10:22:08.579601290 +0200 @@ -1,7 +1,7 @@ <services> <service name="tar_scm" mode="manual"> - <param name="revision">20220429</param> - <param name="version">20220429</param> + <param name="revision">20220613</param> + <param name="version">20220613</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.FdpeiF/_old 2022-06-23 10:22:08.599601311 +0200 +++ /var/tmp/diff_new_pack.FdpeiF/_new 2022-06-23 10:22:08.603601316 +0200 @@ -1,6 +1,6 @@ Format: 1.0 Source: build -Version: 20220429 +Version: 20220613 Binary: build Maintainer: Adrian Schroeter <adr...@suse.de> Architecture: all ++++++ debian.changelog ++++++ --- /var/tmp/diff_new_pack.FdpeiF/_old 2022-06-23 10:22:08.623601338 +0200 +++ /var/tmp/diff_new_pack.FdpeiF/_new 2022-06-23 10:22:08.627601342 +0200 @@ -1,4 +1,4 @@ -build (20220429) unstable; urgency=low +build (20220613) unstable; urgency=low * Update to current git trunk - add sles11sp2 build config and adapt autodetection ++++++ obs-build-20220429.tar.gz -> obs-build-20220613.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/.github/workflows/linux.yaml new/obs-build-20220613/.github/workflows/linux.yaml --- old/obs-build-20220429/.github/workflows/linux.yaml 2022-04-29 15:09:09.000000000 +0200 +++ new/obs-build-20220613/.github/workflows/linux.yaml 2022-06-13 14:40:42.000000000 +0200 @@ -16,6 +16,10 @@ with: fetch-depth: 0 + - name: Update packages repository + run: | + sudo apt-get update + - name: Install libyaml-libyaml-perl run: | sudo apt-get install libyaml-libyaml-perl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/Makefile new/obs-build-20220613/Makefile --- old/obs-build-20220429/Makefile 2022-04-29 15:09:09.000000000 +0200 +++ new/obs-build-20220613/Makefile 2022-06-13 14:40:42.000000000 +0200 @@ -89,6 +89,7 @@ writemodulemd \ download_assets \ export_debian_orig_from_git \ + unpack_slsa_provenance \ $(DESTDIR)$(pkglibdir) install -m644 \ qemu-reg \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/build new/obs-build-20220613/build --- old/obs-build-20220429/build 2022-04-29 15:09:09.000000000 +0200 +++ new/obs-build-20220613/build 2022-06-13 14:40:42.000000000 +0200 @@ -1542,6 +1542,29 @@ RECIPEFILE="${RECIPEPATH##*/}" fi + if test "$RECIPEFILE" != "${RECIPEFILE%.slsa_provenance.json}" ; then + MYSRCDIR="$BUILD_ROOT/.build-srcdir" + rm -rf "$MYSRCDIR" + mkdir -p "$MYSRCDIR" + cd "$MYSRCDIR" || cleanup_and_exit 1 + $BUILD_DIR/unpack_slsa_provenance "$RECIPEPATH" "$MYSRCDIR" || cleanup_and_exit 1 "Could not unpack slsa provenance file" + SRCDIR="$MYSRCDIR" + RECIPEFILE= + while read k ; do + case $k in + recipe=*) RECIPEFILE="${k#*=}" ;; + release=*) test -z "$RELEASE" && RELEASE="${k#*=}" ;; + debuginfo=*) BUILD_DEBUG=1 ;; + esac + done < .build.params + test -z "$RECIPEFILE" && cleanup_and_exit 1 "recipe not set in build parameters" + RECIPEPATH="$SRCDIR/$RECIPEFILE" + RPMLIST="--rpmlist $MYSRCDIR/.build.rpmlist" + BUILD_RPMS= + BUILD_DIST="$SRCDIR/.build.config" + repos=() + fi + recipe_set_buildtype if test -z "$RUNNING_IN_VM" ; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/build-pkg-deb new/obs-build-20220613/build-pkg-deb --- old/obs-build-20220429/build-pkg-deb 2022-04-29 15:09:09.000000000 +0200 +++ new/obs-build-20220613/build-pkg-deb 2022-06-13 14:40:42.000000000 +0200 @@ -22,6 +22,7 @@ ################################################################ DEB_UNSAFE_IO= +DEB_NO_TRIGGERS= # # A wrapper around chroot to set the environment correctly for dpkg and @@ -60,6 +61,17 @@ exit 101 EOF chmod 755 $BUILD_ROOT/usr/sbin/policy-rc.d + + # Manpages database trigger takes a lot of time and is not useful in a build chroot + mkdir -p $BUILD_ROOT/var/cache/debconf/ + cat >> $BUILD_ROOT/var/cache/debconf/config.dat <<EOF +Name: man-db/auto-update +Template: man-db/auto-update +Value: false +Owners: man-db +Flags: seen + +EOF } pkg_initdb_deb() { @@ -74,13 +86,15 @@ } pkg_prepare_deb() { - # test if dpkg knows --force-unsafe-io + # test if dpkg knows --force-unsafe-io and --no-triggers DEB_UNSAFE_IO= + DEB_NO_TRIGGERS= chroot $BUILD_ROOT dpkg --force-unsafe-io --version >/dev/null 2>&1 && DEB_UNSAFE_IO="--force-unsafe-io" + chroot $BUILD_ROOT dpkg --no-triggers --version >/dev/null 2>&1 && DEB_NO_TRIGGERS="--no-triggers" } pkg_install_deb() { - ( deb_chroot $BUILD_ROOT dpkg --install $DEB_UNSAFE_IO --force-depends .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \ + ( deb_chroot $BUILD_ROOT dpkg --install $DEB_UNSAFE_IO $DEB_NO_TRIGGERS --force-depends .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \ perl -ne '$|=1;/^(Configuration file|Installing new config file|Selecting previously deselected|Selecting previously unselected|\(Reading database|Unpacking |Setting up|Creating config file|Preparing to replace dpkg|Preparing to unpack )/||/^$/||print' # ugly workaround for upstart system. some packages (procps) try # to start a service in their configure phase. As we don't have @@ -198,7 +212,7 @@ return fi - ( deb_chroot $BUILD_ROOT dpkg --install $DEB_UNSAFE_IO --force-depends .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \ + ( deb_chroot $BUILD_ROOT dpkg --install $DEB_UNSAFE_IO $DEB_NO_TRIGGERS --force-depends .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \ perl -ne '$|=1;/^(Configuration file|Installing new config file|Selecting previously deselected|Selecting previously unselected|\(Reading database|Unpacking |Setting up|Creating config file|Preparing to replace dpkg|Preparing to unpack )/||/^$/||print' } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/build-recipe-dsc new/obs-build-20220613/build-recipe-dsc --- old/obs-build-20220429/build-recipe-dsc 2022-04-29 15:09:09.000000000 +0200 +++ new/obs-build-20220613/build-recipe-dsc 2022-06-13 14:40:42.000000000 +0200 @@ -108,11 +108,6 @@ *) # No debver, add the first such token OBS_DCH_RELEASE="-$DEB_RELEASE" ;; esac - # "OBS_DCH_RELEASE" char offset aligned with "VERSION" in previous echo - echo "OBS-DCH-RELEASE: Suffixing DSC file with OBS respin number, to ${VERSION}${OBS_DCH_RELEASE}" - sed -e 's,^\(OBS-DCH-RELEASE:.*\)$,# \1,' \ - -e 's,^\(Version:\).*$,\1'" ${VERSION}${OBS_DCH_RELEASE}"',' \ - -i $BUILD_ROOT$TOPDIR/SOURCES/$RECIPEFILE fi fi if ! debtransform $CHANGELOGARGS $RELEASEARGS $BUILD_ROOT$TOPDIR/SOURCES $BUILD_ROOT$TOPDIR/SOURCES/$RECIPEFILE $BUILD_ROOT$TOPDIR/SOURCES.DEB ; then @@ -153,6 +148,20 @@ # and alternate build commands can be used DSC_BUILD_CMD="$(queryconfig --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" substitute dsc:build_cmd)" test -z "$DSC_BUILD_CMD" && DSC_BUILD_CMD="dpkg-buildpackage -us -uc" + + if grep -Eq '^Format: 3\.0 \(quilt\)$' $BUILD_ROOT$TOPDIR/SOURCES/$RECIPEFILE ; then + printf "Recipe file '$RECIPEFILE' is being checked for 'DEBTRANSFORM-FILES'... " + if grep -Eq '^DEBTRANSFORM-FILES:' $BUILD_ROOT$TOPDIR/SOURCES/$RECIPEFILE ; then + echo "found" + echo "$(sed -n '/DEBTRANSFORM-FILES:/,/!(^\s)/p' $BUILD_ROOT$TOPDIR/SOURCES/$RECIPEFILE)" + + echo "'--include-binaries' will use with dpkg-source" + DSC_BUILD_CMD="$DSC_BUILD_CMD --source-option=--include-binaries" + else + echo "not found" + fi + fi + if test -e $buildroot/$TOPDIR/SOURCES/build.script ; then echo "Sourcing build.script to build - it should normally run 'dpkg-buildpackage -us -uc'" DSC_BUILD_CMD="source $TOPDIR/SOURCES/build.script" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/build-vm-kvm new/obs-build-20220613/build-vm-kvm --- old/obs-build-20220429/build-vm-kvm 2022-04-29 15:09:09.000000000 +0200 +++ new/obs-build-20220613/build-vm-kvm 2022-06-13 14:40:42.000000000 +0200 @@ -390,18 +390,22 @@ kvm_console=hvc0 fi fi + # move IO into separate I/O thread for some architectures - case `uname -m` in - armv8l|aarch64|i586|i686|x86_64) - if test "${kvm_device%%-*}" = "virtio" ; then - kvm_options="$kvm_options -object iothread,id=io0" - kvm_device_opts=",iothread=io0" - # avoid SLE15-SP4 kernel as it is broken (bsc#1199011) - if ldd $kvm_bin | grep -E -q 'liburing.so.[2-9]' && test "$(uname -r | cut -d. -f1-2)" != "5.14" ; then + if test "${kvm_device%%-*}" = "virtio" ; then + kvm_options="$kvm_options -object iothread,id=io0" + kvm_device_opts=",iothread=io0" + case $(uname -m) in + ppc64le) + # PowerPC currently not reliably working + ;; + *) + if ldd $kvm_bin | grep -E -q 'liburing.so.[2-9]' ; then kvm_drive_opts="$kvm_drive_opts,aio=io_uring" fi - fi - esac + ;; + esac + fi } vm_attach_root_kvm() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/debtransform new/obs-build-20220613/debtransform --- old/obs-build-20220429/debtransform 2022-04-29 15:09:09.000000000 +0200 +++ new/obs-build-20220613/debtransform 2022-06-13 14:40:42.000000000 +0200 @@ -119,6 +119,27 @@ return @c; } +sub dopatch_changelog { + my ($version_new, @content) = @_; + my $firstline = $content[0]; + my $version = $firstline; + $version =~ s/.*\((.*)\).*/$1/g; + if ($version ne $version_new) { + print "Found changelog with the last entry version not equal to build package version ($version).\n"; + $firstline =~ s/\(.*\)/($version_new)/g; + my $date = `date -R`; + if (defined($ENV{SOURCE_DATE_EPOCH})) { + $date = strftime("%a, %d %b %Y %T +0000", gmtime($ENV{SOURCE_DATE_EPOCH})); + } + chomp($date); + my @newcontent = ($firstline, "", " * version number update by debtransform", "", " -- debtransform <build\@opensuse.org> ".$date, ""); + push(@newcontent, @content); + print "New entry with updated version number added ($version_new).\n"; + @content = @newcontent; + } + return @content; +} + sub extracttar { my ($tar, $filename, $s) = @_; local *F; @@ -145,20 +166,7 @@ } } if ($newname eq $origtarfile->{'tardir'}."/debian/changelog") { - my $firstline = $content[0]; - my $version = $firstline; - $version =~ s/.*\((.*)\).*/$1/g; - if ($version ne $origtarfile->{'version'}) { - $firstline =~ s/\(.*\)/($origtarfile->{'version'})/g; - my $date = `date -R`; - if (defined($ENV{SOURCE_DATE_EPOCH})) { - $date = strftime("%a, %d %b %Y %T +0000", gmtime($ENV{SOURCE_DATE_EPOCH})); - } - chomp($date); - my @newcontent = ($firstline, "", " * version number update by debtransform", "", " -- debtransform <build\@opensuse.org> ".$date, ""); - push(@newcontent, @content); - @content = @newcontent; - } + @content = dopatch_changelog($origtarfile->{'version'}, @content); } return unless @content; print DIFF "--- $oldname\n"; @@ -172,6 +180,17 @@ print DIFF "+$_\n" for @content; } +sub dorelativepath { + use Cwd qw(cwd); + use File::Spec; + my $dir = cwd; + + my ($path_a, $path_b) = @_; + + my $relative_path = File::Spec->abs2rel ($path_a, $path_b); + return $relative_path +} + sub dotar { my ($tar, $tardir, $origin, $origtarfile, @c) = @_; local *F; @@ -191,6 +210,78 @@ close(F); } +sub dotar_quilt { + use File::Temp qw(tempdir); + use File::Basename; + + my $tmpdir = File::Temp->newdir(); + my $tempdirname = $tmpdir->dirname; + + my ($input_file_path, $output_file_path, $origtarfile) = @_; + + my $input_file_path_relative = dorelativepath($input_file_path); + my $output_file_path_relative = dorelativepath($output_file_path); + + print "Add tar file contents '$input_file_path_relative'\n"; + print " to debian quilt tar file '$output_file_path_relative'\n"; + + my @list = $input_file_path =~ /(.*)((\.tgz$)|(\.tar(?:\.gz|\.bz2|\.xz)?$))/g; + my $input_file_path_without_ext = $list[0]; + my $ext = $list[1]; + + my $decompress_src = "$input_file_path"; + my $input_file_name = basename($input_file_path_without_ext); + my $decompress_dst = "${tempdirname}/${input_file_name}.tar"; + + # print "Decompress '$decompress_src' to '$decompress_dst' for concatenation\n"; + + if (($ext eq ".tgz") or ($ext eq ".tar.gz")) { + system("gzip -dck \"$decompress_src\" > \"$decompress_dst\"") == 0 || die("Can not unpack gzip archive '$decompress_src': $!\n"); + } elsif (($ext eq ".tar.xz")) { + system("xz -dck \"$decompress_src\" > \"$decompress_dst\"") == 0 || die("Can not unpack xz archive '$decompress_src': $!\n"); + } elsif (($ext eq ".tar.bz2")) { + system("bzip2 -dck \"$decompress_src\" > \"$decompress_dst\"") == 0 || die("Can not unpack bzip2 archive '$decompress_src': $!\n"); + } + + my $tar_for_concatination_path = $decompress_dst; + + # Looking for changelog in tar + my $changelog_path_in_tar = 'debian/changelog'; + my $is_changelog_in_tar = (system("tar -tf \"${tar_for_concatination_path}\" $changelog_path_in_tar > /dev/null 2>&1") == 0); + + if ($is_changelog_in_tar){ + print "Found '$changelog_path_in_tar' in '${tar_for_concatination_path}', extract to '$tempdirname'.\n"; + system("tar xf \"$input_file_path\" --directory $tempdirname $changelog_path_in_tar") == 0 + || die("Can not extract file '$changelog_path_in_tar' from tar '$input_file_path': $!\n"); + + # Patch changelog + my $changelog_file_path = "$tempdirname/$changelog_path_in_tar"; + my $changelog_file_path_patched = "${changelog_file_path}.patched"; + open my $in, '<', $changelog_file_path or die "Can't read original changelog file: $!\n"; + open my $out, '>', $changelog_file_path_patched or die "Can't write patched changelog file: $!\n"; + + chomp(my @lines = <$in>); + my @new_lines = dopatch_changelog($origtarfile->{'version'}, @lines); + + print $out "$_\n" for @new_lines; + close $out; + + # Replace original changelog with patched + unlink($changelog_file_path); + rename($changelog_file_path_patched, $changelog_file_path); + + print "Update tar '$tar_for_concatination_path' due to changelog '$changelog_file_path' patched.\n"; + # Add changelog file to tar relative to tempdirname + system("tar -C \"$tempdirname\" -uf \"$tar_for_concatination_path\" \"$changelog_path_in_tar\"") == 0 + || die("Can not update tar '$tar_for_concatination_path' with file '$changelog_file_path': $!\n"); + + unlink($changelog_file_path); + } + + system("tar --concatenate -f \"$output_file_path\" \"${tar_for_concatination_path}\""); + unlink("${tar_for_concatination_path}"); +} + sub dofile { my ($file, $tardir, $dfile, $origtarfile) = @_; local *F; @@ -202,6 +293,49 @@ dodiff("$tardir.orig/$dfile", "$tardir/$dfile", $origtarfile, @file); } +sub dofile_quilt { + use Cwd qw(cwd); + use File::Spec; + use File::Basename; + use File::Temp qw(tempdir); + + my $tmpdir = File::Temp->newdir(); + my $tempdirname = $tmpdir->dirname; + + my $dir = cwd; + + my ($input_file_path, $output_file_path, $rename_file_path, $origtarfile) = @_; + + my $input_file_path_relative = dorelativepath($input_file_path); + my $output_file_path_relative = dorelativepath($output_file_path); + + my $path_for_logging = $input_file_path_relative; + + # Catch and patch changelog + if (basename($input_file_path_relative) eq 'debian.changelog') { + my $input_file_path_patched = "${tempdirname}/debian.changelog.patched"; + + open my $in, '<', $input_file_path or die "Can't read original changelog file: $!\n"; + open my $out, '>', $input_file_path_patched or die "Can't write patched changelog file: $!\n"; + + chomp(my @lines = <$in>); + my @new_lines = dopatch_changelog($origtarfile->{'version'}, @lines); + + print $out "$_\n" for @new_lines; + close $out; + + $input_file_path = $input_file_path_patched; + $input_file_path_relative = dorelativepath($input_file_path); + $path_for_logging = $input_file_path; + } + + print "Add file '$path_for_logging'\n"; + print " to debian quilt tar file '$output_file_path_relative'\n"; + print " with internal path '$rename_file_path'\n"; + + system("tar --transform='flags=r;s|$input_file_path|$rename_file_path|' -Prf $output_file_path $input_file_path"); +} + sub doseries { my ($series, $tardir) = @_; my $dir = $series; @@ -245,6 +379,44 @@ } } +sub doseries_quilt { + use File::Basename; + use File::Temp qw(tempfile); + + my ($series, $tardir, $quilt_debian_file, $origtarfile) = @_; + my $dir = $series; + $dir =~ s/[^\/]+$//; + $dir =~ s/\/+$//; + $dir = '.' if $dir eq ''; + local *F; + open(F, '<', $series) || die("$series: $!\n"); + my @series = <F>; + close F; + chomp(@series); + + my $series_relative = dorelativepath($series); + + my $tmp_patches = new File::Temp( UNLINK => 1 ); + open(tmp_patches,'>',$tmp_patches) or die $!; + + print "Processing series file \"$series_relative\"...\n"; + for my $patch (@series) { + $patch =~ s/(^|\s+)#.*//; + next if $patch =~ /^\s*$/; + my $level = 1; + $level = $1 if $patch =~ /\s.*-p\s*(\d+)/; + $patch =~ s/\s.*//; + my $patch_relative = dorelativepath($patch); + print "Processing patch $patch_relative...\n"; + my $patch_name = basename($patch); + dofile_quilt("$dir/$patch", $quilt_debian_file, "debian/patches/$patch_name", $origtarfile); + print tmp_patches "$patch_name\n"; + } + + close($tmp_patches); + dofile_quilt($tmp_patches, $quilt_debian_file, "debian/patches/series", $origtarfile); +} + sub addfile { my ($file, $algorithm) = @_; my $base = $file; @@ -266,6 +438,11 @@ return "$md5 $size $base"; } +sub is_quilt { + my ($format) = @_; + return $format =~ /3\.0 \(quilt\)/; +} + print "** Started: debtransform @ARGV\n"; my $debug = 0; @@ -341,10 +518,17 @@ die("dsc file contains no Source: line\n") unless defined($name); my $version = $tags->{'VERSION'}; die("dsc file contains no Version: line\n") unless defined($version); +my $format = $tags->{"FORMAT"}; +die("dsc file contains no Format: line\n") unless defined($format); - -# debtransform generates source package in 1.0 (non-native) format -print "Transforming into source package 1.0 (non-native) format\n"; +if (is_quilt($format)) { + # debtransform generates source package in 3.0 (non-native) format + print "Transforming into source package '$format' format\n"; +} +else { + # debtransform generates source package in 1.0 (non-native) format + print "Transforming into source package 1.0 (non-native) format\n"; +} # non-native sources should always contain Debian revision if ($version !~ /-/) { @@ -384,7 +568,7 @@ system ( ("mv", "$dir/$old", "$tmptar" ) ) == 0 || die("cannot rename .tgz to .tar.gz"); } -if ($tags->{'DEBTRANSFORM-RELEASE'} && $release) { +if (($tags->{'DEBTRANSFORM-RELEASE'} || $tags->{'OBS-DCH-RELEASE'}) && $release) { # the tag DEBTRANSFORM-RELEASE in .dsc file instructs # to append OBS build number to package version. The # number is passed in "release" command line parameter. @@ -402,6 +586,9 @@ print "Stripped epoch from $version for filenames.\n"; } +my $quilt_debian_file = "$out/${name}_${version}.debian.tar"; +unlink($quilt_debian_file) if -e $quilt_debian_file; + my @files; my @checksums_sha1; my @checksums_sha256; @@ -430,10 +617,15 @@ my @tarfilecontent = listtar($tarpath, 0); my $origtarfile = {'name' => $tarpath, 'content' => \@tarfilecontent, 'version' => $tags->{'VERSION'}, 'tardir' => $tardir}; -print "Generating $out/${name}_$version.diff\n"; # Since we are generating a unitary diff, we must re-set Format:. -$tags->{"FORMAT"} = "1.0"; -open(DIFF, '>', "$out/${name}_$version.diff") || die("Cannot open $out/${name}_$version.diff for write: $!\n"); +if (not is_quilt($format)){ + print "Generating $out/${name}_$version.diff\n"; + $tags->{"FORMAT"} = "1.0"; +} + +if (not is_quilt($format)) { + open(DIFF, '>', "$out/${name}_$version.diff") || die("Cannot open $out/${name}_$version.diff for write: $!\n"); +} undef $changelog if $dir{'debian.changelog'}; @@ -449,50 +641,97 @@ } } -dofile($changelog, $tardir, 'debian/changelog', $origtarfile) if defined $changelog; +if (not is_quilt($format)){ + dofile($changelog, $tardir, 'debian/changelog', $origtarfile) if defined $changelog; +} else { + dofile_quilt($changelog, $quilt_debian_file, 'debian/changelog', $origtarfile) if defined $changelog +} if ($tags->{'DEBTRANSFORM-FILES'}) { for my $file (split(' ', $tags->{'DEBTRANSFORM-FILES'})) { - dofile("$dir/$file", $tardir, $file, $origtarfile); + if (not is_quilt($format)){ + dofile("$dir/$file", $tardir, $file, $origtarfile); + } else { + dofile_quilt("$dir/$file", $quilt_debian_file, $file, $origtarfile); + } } } for my $debtarfile (@debtarfiles) { - dotar("$dir/$debtarfile", $tardir, \%debtarorigin, $origtarfile, @{$debtarcontent{$debtarfile} }); + if (not is_quilt($format)) { + dotar("$dir/$debtarfile", $tardir, \%debtarorigin, $origtarfile, @{$debtarcontent{$debtarfile} }); + } else { + dotar_quilt("$dir/$debtarfile", $quilt_debian_file, $origtarfile) + } } for my $file (grep {/^debian\./} @dir) { next if $file eq 'debian.series'; next if $file =~ /\.tar$/; next if $file =~ /\.tar\./; - dofile("$dir/$file", $tardir, 'debian/'.substr($file, 7), $origtarfile); + if (not is_quilt($format)){ + dofile("$dir/$file", $tardir, 'debian/'.substr($file, 7), $origtarfile); + } else { + my $in_tar_path = 'debian/'.substr($file, 7); + dofile_quilt("$dir/$file", $quilt_debian_file, $in_tar_path, $origtarfile); + } +} + +if (not is_quilt($format)){ + if ($tags->{'DEBTRANSFORM-SERIES'}) { + doseries("$dir/$tags->{'DEBTRANSFORM-SERIES'}", $tardir); + } elsif ($dir{"debian.series"}) { + doseries("$dir/debian.series", $tardir); + } elsif ($dir{"patches.series"}) { + doseries("$dir/patches.series", $tardir); + } +} else { + if ($tags->{'DEBTRANSFORM-SERIES'}) { + doseries_quilt("$dir/$tags->{'DEBTRANSFORM-SERIES'}", $tardir, $quilt_debian_file, $origtarfile); + } elsif ($dir{"debian.series"}) { + doseries_quilt("$dir/debian.series", $tardir, $quilt_debian_file, $origtarfile); + } elsif ($dir{"patches.series"}) { + doseries_quilt("$dir/patches.series", $tardir, $quilt_debian_file, $origtarfile); + } + } -if ($tags->{'DEBTRANSFORM-SERIES'}) { - doseries("$dir/$tags->{'DEBTRANSFORM-SERIES'}", $tardir); -} elsif ($dir{"debian.series"}) { - doseries("$dir/debian.series", $tardir); -} elsif ($dir{"patches.series"}) { - doseries("$dir/patches.series", $tardir); +if (not is_quilt($format)) { + close(DIFF); } -close(DIFF); +# Add file which indicate dpkg-source 3.0 (quilt) format +if (is_quilt($format)) { + open my $fh, '>', "$dir/debian_source_format"; + print {$fh} $format . "\n"; + close $fh; + dofile_quilt("$dir/debian_source_format", $quilt_debian_file, 'debian/source/format', $origtarfile); + unlink "$dir/debian_source_format"; +} -if (! -s "$out/${name}_$version.diff") { - unlink("$out/${name}_$version.diff"); -} else { - system('gzip', '-n9', "$out/${name}_$version.diff"); - if (-f "$out/${name}_$version.diff.gz") { - push @files, addfile("$out/${name}_$version.diff.gz", "MD5"); - push @checksums_sha1, addfile("$out/${name}_$version.diff.gz", "SHA1"); - push @checksums_sha256, addfile("$out/${name}_$version.diff.gz", "SHA256"); +if (not is_quilt($format)){ + if (! -s "$out/${name}_$version.diff") { + unlink("$out/${name}_$version.diff"); } else { - push @files, addfile("$out/${name}_$version.diff", "MD5"); - push @checksums_sha1, addfile("$out/${name}_$version.diff", "SHA1"); - push @checksums_sha256, addfile("$out/${name}_$version.diff", "SHA256"); + system('gzip', '-n9', "$out/${name}_$version.diff"); + if (-f "$out/${name}_$version.diff.gz") { + push @files, addfile("$out/${name}_$version.diff.gz", "MD5"); + push @checksums_sha1, addfile("$out/${name}_$version.diff.gz", "SHA1"); + push @checksums_sha256, addfile("$out/${name}_$version.diff.gz", "SHA256"); + } else { + push @files, addfile("$out/${name}_$version.diff", "MD5"); + push @checksums_sha1, addfile("$out/${name}_$version.diff", "SHA1"); + push @checksums_sha256, addfile("$out/${name}_$version.diff", "SHA256"); + } } +} else { + system('gzip', '-n9', $quilt_debian_file); + push @files, addfile("${quilt_debian_file}.gz", "MD5"); + push @checksums_sha1, addfile("${quilt_debian_file}.gz", "SHA1"); + push @checksums_sha256, addfile("${quilt_debian_file}.gz", "SHA256"); } + $tags->{'CHECKSUMS-SHA1'} = "\n".join("\n", @checksums_sha1); $tags->{'CHECKSUMS-SHA256'} = "\n".join("\n", @checksums_sha256); $tags->{'FILES'} = "\n".join("\n", @files); @@ -501,6 +740,7 @@ delete $tags->{'DEBTRANSFORM-FILES-TAR'}; delete $tags->{'DEBTRANSFORM-FILES'}; delete $tags->{'DEBTRANSFORM-RELEASE'}; +delete $tags->{'OBS-DCH-RELEASE'}; writedsc("$out/${name}_$version.dsc", $tags); if( $debug ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/dist/build.changes new/obs-build-20220613/dist/build.changes --- old/obs-build-20220429/dist/build.changes 2022-04-29 15:09:09.000000000 +0200 +++ new/obs-build-20220613/dist/build.changes 2022-06-13 14:40:42.000000000 +0200 @@ -1,4 +1,17 @@ ------------------------------------------------------------------- +Mon Jun 13 12:39:58 UTC 2022 - Adrian Schr??ter <adr...@suse.de> + +- regression fix for Debian Source format 3.0 (quilt), also adding + changelog modification now + +------------------------------------------------------------------- +Tue May 31 09:10:07 UTC 2022 - Adrian Schr??ter <adr...@suse.de> + +- Revert "avod aio=io_uring for now on SLE15-SP4 workers" +- deb: defer dpkg triggers until all packages are installed, and disable man-db altogether +- Add support of Debian Source format 3.0 (quilt) + +------------------------------------------------------------------- Fri Apr 29 11:53:59 UTC 2022 - Adrian Schr??ter <adr...@suse.de> - Stop building aarch64_ilp32 baselibs for aarch64 Binary files old/obs-build-20220429/test-debtransform/4/binary_file.tar and new/obs-build-20220613/test-debtransform/4/binary_file.tar differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/4/debian.changelog new/obs-build-20220613/test-debtransform/4/debian.changelog --- old/obs-build-20220429/test-debtransform/4/debian.changelog 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/4/debian.changelog 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1,24 @@ +grandorgue (0.3.0.6.10) unstable; urgency=low + + * OBS build + + -- Martin Koegler <mkoeg...@auto.tuwien.ac.at> Sat, 16 Jun 2012 13:08:51 +0200 + +grandorgue (0.3.0.6.11) unstable; urgency=low + + * OBS build + + -- Martin Koegler <mkoeg...@auto.tuwien.ac.at> Sat, 16 Jun 2012 13:08:35 +0200 + +grandorgue (0.3.0.6.10-1) unstable; urgency=low + + * Non-maintainer upload. + * OBS build + + -- Martin Koegler <mkoeg...@auto.tuwien.ac.at> Sat, 16 Jun 2012 11:27:19 +0200 + +grandorgue (0.3.0.6) unstable; urgency=low + + * Initial version + + -- Martin Koegler <martin.koeg...@chello.at> Sun, 06 Nov 2011 19:44:04 +0100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/4/debian.obs-version new/obs-build-20220613/test-debtransform/4/debian.obs-version --- old/obs-build-20220429/test-debtransform/4/debian.obs-version 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/4/debian.obs-version 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1 @@ +Version: 0.3.0.6.1026 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/4/debian.rules new/obs-build-20220613/test-debtransform/4/debian.rules --- old/obs-build-20220429/test-debtransform/4/debian.rules 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/4/debian.rules 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1,2 @@ +%: + dh $@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/4/debian.series new/obs-build-20220613/test-debtransform/4/debian.series --- old/obs-build-20220429/test-debtransform/4/debian.series 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/4/debian.series 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1 @@ +patches/test_change_variable.patch Binary files old/obs-build-20220429/test-debtransform/4/debian.tar.gz and new/obs-build-20220613/test-debtransform/4/debian.tar.gz differ Binary files old/obs-build-20220429/test-debtransform/4/debian1.tar.gz and new/obs-build-20220613/test-debtransform/4/debian1.tar.gz differ Binary files old/obs-build-20220429/test-debtransform/4/go.tar.gz and new/obs-build-20220613/test-debtransform/4/go.tar.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/4/grandorgue.dsc new/obs-build-20220613/test-debtransform/4/grandorgue.dsc --- old/obs-build-20220429/test-debtransform/4/grandorgue.dsc 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/4/grandorgue.dsc 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1,17 @@ +Format: 3.0 (quilt) +Source: grandorgue +Binary: grandorgue +Architecture: any +Version: 0.3.0.6.1026 +Maintainer: Martin Koegler <martin.koeg...@chello.at> +Standards-Version: 3.9.1 +Build-Depends: debhelper (>= 7), cdbs, cmake, gettext, po4a, libjack-jackd2-dev, libasound2-dev, libwxgtk2.8-dev, docbook-xsl, xsltproc, zip, devscripts +DEBTRANSFORM-TAR: go.tar.gz +DEBTRANSFORM-FILES-TAR: + debian.tar.gz + debian1.tar.gz + test_bzip2_archive.tar.bz2 + test_gzip_archive.tar.gz + test_xz_archive.tar.xz +DEBTRANSFORM-FILES: + binary_file.tar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/4/patches/test_change_variable.patch new/obs-build-20220613/test-debtransform/4/patches/test_change_variable.patch --- old/obs-build-20220429/test-debtransform/4/patches/test_change_variable.patch 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/4/patches/test_change_variable.patch 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1,11 @@ +--- grandorgue-0.3.0.6.1026/GrandOrgue.desktop 2012-06-16 15:13:25.000000000 +0400 ++++ "grandorgue-0.3.0.6.1026/GrandOrgue.desktop" 2022-01-12 00:43:43.363190982 +0300 +@@ -4,7 +4,7 @@ + Comment=GrandOrgue - virtual pipe organ sample player + Exec=GrandOrgue %f + Icon=GrandOrgue +-Terminal=false ++Terminal=true + Type=Application + Categories=Audio;AudioVideo;Music;Education; + MimeType=application/x-grandorgue-odf; Binary files old/obs-build-20220429/test-debtransform/4/test_bzip2_archive.tar.bz2 and new/obs-build-20220613/test-debtransform/4/test_bzip2_archive.tar.bz2 differ Binary files old/obs-build-20220429/test-debtransform/4/test_gzip_archive.tar.gz and new/obs-build-20220613/test-debtransform/4/test_gzip_archive.tar.gz differ Binary files old/obs-build-20220429/test-debtransform/4/test_xz_archive.tar.xz and new/obs-build-20220613/test-debtransform/4/test_xz_archive.tar.xz differ Binary files old/obs-build-20220429/test-debtransform/4-out/grandorgue_0.3.0.6.1026-1.debian.tar.gz and new/obs-build-20220613/test-debtransform/4-out/grandorgue_0.3.0.6.1026-1.debian.tar.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/4-out/grandorgue_0.3.0.6.1026-1.dsc new/obs-build-20220613/test-debtransform/4-out/grandorgue_0.3.0.6.1026-1.dsc --- old/obs-build-20220429/test-debtransform/4-out/grandorgue_0.3.0.6.1026-1.dsc 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/4-out/grandorgue_0.3.0.6.1026-1.dsc 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1,18 @@ +Format: 3.0 (quilt) +Source: grandorgue +Binary: grandorgue +Architecture: any +Version: 0.3.0.6.1026-1 +Maintainer: Martin Koegler <martin.koeg...@chello.at> +Standards-Version: 3.9.1 +Build-Depends: debhelper (>= 7), cdbs, cmake, gettext, po4a, libjack-jackd2-dev, libasound2-dev, libwxgtk2.8-dev, docbook-xsl, xsltproc, zip, devscripts +Checksums-Sha1: + 4e0ac2fc3e87538ddb8bed79185ebedd31f1bb60 655 grandorgue_0.3.0.6.1026.orig.tar.gz + 203b502127a9e24bbb8149e04c91c9ab9f4f4403 1458 grandorgue_0.3.0.6.1026-1.debian.tar.gz +Checksums-Sha256: + c8f0ac9ada429e83acdd442ebca7cd00e3c9c913553349e164eb91c2283efd27 655 grandorgue_0.3.0.6.1026.orig.tar.gz + 7a008b85a9c77439afec795ba8883f26d9937ed7199a91cf8bbc7f1a9e270b92 1458 grandorgue_0.3.0.6.1026-1.debian.tar.gz +Files: + 7e72e6c31c2af52c227ce4c4c6ee3952 655 grandorgue_0.3.0.6.1026.orig.tar.gz + c8efc81f1ef37d816651b643dbfae678 1458 grandorgue_0.3.0.6.1026-1.debian.tar.gz + Binary files old/obs-build-20220429/test-debtransform/4-out/grandorgue_0.3.0.6.1026.orig.tar.gz and new/obs-build-20220613/test-debtransform/4-out/grandorgue_0.3.0.6.1026.orig.tar.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/5/debian.obs-version new/obs-build-20220613/test-debtransform/5/debian.obs-version --- old/obs-build-20220429/test-debtransform/5/debian.obs-version 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/5/debian.obs-version 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1 @@ +Version: 0.3.0.6.1026 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/5/debian.rules new/obs-build-20220613/test-debtransform/5/debian.rules --- old/obs-build-20220429/test-debtransform/5/debian.rules 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/5/debian.rules 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1,2 @@ +%: + dh $@ Binary files old/obs-build-20220429/test-debtransform/5/debian.tar.gz and new/obs-build-20220613/test-debtransform/5/debian.tar.gz differ Binary files old/obs-build-20220429/test-debtransform/5/go.tar.gz and new/obs-build-20220613/test-debtransform/5/go.tar.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/5/grandorgue.dsc new/obs-build-20220613/test-debtransform/5/grandorgue.dsc --- old/obs-build-20220429/test-debtransform/5/grandorgue.dsc 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/5/grandorgue.dsc 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1,9 @@ +Format: 3.0 (quilt) +Source: grandorgue +Binary: grandorgue +Architecture: any +Version: 0.3.0.6.1026-1 +Maintainer: Martin Koegler <martin.koeg...@chello.at> +Standards-Version: 3.9.1 +Build-Depends: debhelper (>= 7), cdbs, cmake, gettext, po4a, libjack-jackd2-dev, libasound2-dev, libwxgtk2.8-dev, docbook-xsl, xsltproc, zip, devscripts +DEBTRANSFORM-TAR: go.tar.gz Binary files old/obs-build-20220429/test-debtransform/5-out/grandorgue_0.3.0.6.1026-1.debian.tar.gz and new/obs-build-20220613/test-debtransform/5-out/grandorgue_0.3.0.6.1026-1.debian.tar.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/5-out/grandorgue_0.3.0.6.1026-1.dsc new/obs-build-20220613/test-debtransform/5-out/grandorgue_0.3.0.6.1026-1.dsc --- old/obs-build-20220429/test-debtransform/5-out/grandorgue_0.3.0.6.1026-1.dsc 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/test-debtransform/5-out/grandorgue_0.3.0.6.1026-1.dsc 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1,17 @@ +Format: 3.0 (quilt) +Source: grandorgue +Binary: grandorgue +Architecture: any +Version: 0.3.0.6.1026-1 +Maintainer: Martin Koegler <martin.koeg...@chello.at> +Standards-Version: 3.9.1 +Build-Depends: debhelper (>= 7), cdbs, cmake, gettext, po4a, libjack-jackd2-dev, libasound2-dev, libwxgtk2.8-dev, docbook-xsl, xsltproc, zip, devscripts +Checksums-Sha1: + 4e0ac2fc3e87538ddb8bed79185ebedd31f1bb60 655 grandorgue_0.3.0.6.1026.orig.tar.gz + ad1f0c0f42f7f9b6e2158fcc40a2166288fa443e 579 grandorgue_0.3.0.6.1026-1.debian.tar.gz +Checksums-Sha256: + c8f0ac9ada429e83acdd442ebca7cd00e3c9c913553349e164eb91c2283efd27 655 grandorgue_0.3.0.6.1026.orig.tar.gz + 09d1d6787ee6c142221753e83e5ce4d61964384a161034bf0d04a1816cbb9380 579 grandorgue_0.3.0.6.1026-1.debian.tar.gz +Files: + 7e72e6c31c2af52c227ce4c4c6ee3952 655 grandorgue_0.3.0.6.1026.orig.tar.gz + a2186cb4b34d1f0aaddd32b4fc7954aa 579 grandorgue_0.3.0.6.1026-1.debian.tar.gz Binary files old/obs-build-20220429/test-debtransform/5-out/grandorgue_0.3.0.6.1026.orig.tar.gz and new/obs-build-20220613/test-debtransform/5-out/grandorgue_0.3.0.6.1026.orig.tar.gz differ Binary files old/obs-build-20220429/test-debtransform/out/grandorgue_0.3.0.6.1026-1.debian.tar.gz and new/obs-build-20220613/test-debtransform/out/grandorgue_0.3.0.6.1026-1.debian.tar.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/test-debtransform/run.sh new/obs-build-20220613/test-debtransform/run.sh --- old/obs-build-20220429/test-debtransform/run.sh 2022-04-29 15:09:09.000000000 +0200 +++ new/obs-build-20220613/test-debtransform/run.sh 2022-06-13 14:40:42.000000000 +0200 @@ -21,6 +21,7 @@ NAME="`basename "$a"`" case $NAME in *.dsc) + echo "Checking by debdiff that generated 'out/$NAME' is equaling to expected '$4/$NAME'" debdiff $4/$NAME out/$NAME RES=$? if [ $RES != 0 ]; then @@ -37,3 +38,9 @@ run 1 grandorgue.dsc 0 1-out run 2 grandorgue.dsc 0 2-out run 3 grandorgue.dsc 0 3-out +run 4 grandorgue.dsc 0 4-out +run 5 grandorgue.dsc 0 5-out + +# check with absolute paths too +run "$(realpath 4)" grandorgue.dsc 0 "$(realpath 4-out)" +run "$(realpath 5)" grandorgue.dsc 0 "$(realpath 5-out)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-build-20220429/unpack_slsa_provenance new/obs-build-20220613/unpack_slsa_provenance --- old/obs-build-20220429/unpack_slsa_provenance 1970-01-01 01:00:00.000000000 +0100 +++ new/obs-build-20220613/unpack_slsa_provenance 2022-06-13 14:40:42.000000000 +0200 @@ -0,0 +1,173 @@ +#!/usr/bin/perl + +BEGIN { + unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build'); +} + +use JSON::XS (); +use MIME::Base64 (); +use Data::Dumper; + +use Build; +use Build::Download; + +use strict; + +sub readstr { + my ($fn) = @_; + my $f; + open($f, '<', $fn) || die("$fn: $!\n"); + my $d = ''; + 1 while sysread($f, $d, 8192, length($d)); + close $f; + return $d; +} + +sub writestr { + my ($fn, $fnf, $d) = @_; + my $f; + open($f, '>', $fn) || die("$fn: $!\n"); + if (length($d)) { + (syswrite($f, $d) || 0) == length($d) || die("$fn write: $!\n"); + } + close($f) || die("$fn close: $!\n"); + return unless defined $fnf; + rename($fn, $fnf) || die("rename $fn $fnf: $!\n"); +} + + +sub material2digest { + my ($material) = @_; + my $digests = $material->{'digest'}; + return undef unless ref($digests) eq 'HASH'; + my $digest; + my $digest_t; + for my $t (sort keys %$digests) { + my $v = $digests->{$t}; + next if $digest && length($v) < length($digest); + $digest = $v; + $digest_t = $t; + } + return undef unless $digest; + return lc($digest_t).":$digest"; +} + +sub check_existing { + my ($fn, $digest) = @_; + if (-l $fn || -e _) { + if ($digest) { + eval { Build::Download::checkfiledigest($fn, $digest) }; + return 1 unless $@; + } + unlink($fn) || die("unlink $fn: $!\n"); + } + return 0; +} + +die("usage: unpack_slsa_provenance <provenance.json> <dir>\n") unless @ARGV == 2; +my ($provenance_file, $dir) = @ARGV; + +die("$provenance_file: $!\n") unless -e $provenance_file; +die("$dir: $!\n") unless -e $dir; +die("$dir: Not a directory\n") unless -d $dir; + +my $provenance = readstr($provenance_file); +$provenance = JSON::XS::decode_json($provenance); +if ($provenance->{'payload'}) { + $provenance = MIME::Base64::decode_base64($provenance->{'payload'}); + $provenance = JSON::XS::decode_json($provenance); +} +my $predicate = $provenance->{'predicate'}; +die("no predicate in provenance?\n") unless ref($predicate) eq 'HASH'; + +my $materials = $predicate->{'materials'}; +die("no materials in predicate?\n") unless ref($materials) eq 'ARRAY'; + +my $invocation = $predicate->{'invocation'}; +die("no invocation in predicate?\n") unless ref($invocation) eq 'HASH'; + +my $configsource = $invocation->{'configSource'}; +die("no configSource in invocation?\n") unless ref($configsource) eq 'HASH'; + +my $recipefile = $configsource->{'entryPoint'}; +die("no entryPoint in configSource?\n") unless defined($recipefile) && ref($recipefile) eq ''; + +my @rpmlist; + +$| = 1; + +print "fetching sources\n"; +my $recipe_found; +for my $material (@$materials) { + my $uri = $material->{'uri'}; + next if $uri =~ /\/_slsa\//; + my $digest = material2digest($material); + my $fn = $uri; + $fn =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/sge; + $fn =~ s/.*\///; + die("bad file name $fn\n") if $fn eq '.' || $fn eq '..' || $fn eq ''; + die("bad file name $fn\n") if $fn =~ /^\.build\./; + $recipe_found = 1 if $fn eq $recipefile; + next if check_existing("$dir/$fn", $digest); + Build::Download::download($uri, "$dir/$fn", undef, 'digest' => $digest); +} +die("recipefile $recipefile is missing from source\n") unless $recipe_found; + +print "fetching build environment\n"; +mkdir("$dir/.build.binaries") || die("mkdir $dir/.build.binaries: $!\n") unless -d "$dir/.build.binaries"; +for my $material (@$materials) { + my $uri = $material->{'uri'}; + next unless $uri =~ /\/_slsa\//; + next if $uri =~ /\/_config\/[^\/]+$/; + my $digest = material2digest($material); + my $fn = $uri; + $fn =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/sge; + $fn =~ s/\/[^\/]+$//; + $fn =~ s/.*\///; + die("bad file name $fn\n") if $fn eq '.' || $fn eq '..' || $fn eq ''; + if ($fn =~ /^(.*)\.rpm$/) { + push @rpmlist, "$1 $dir/.build.binaries/$fn"; + } + next if check_existing("$dir/.build.binaries/$fn", $digest); + Build::Download::download($uri, "$dir/.build.binaries/$fn", undef, 'digest' => $digest); +} + +print "fetching build config\n"; +for my $material (@$materials) { + my $uri = $material->{'uri'}; + next unless $uri =~ /\/_slsa\//; + next unless $uri =~ /\/_config\/[^\/]+$/; + my $digest = material2digest($material); + next if check_existing("$dir/.build.config", $digest); + Build::Download::download($uri, "$dir/.build.config", undef, 'digest' => $digest); +} + +# parse the config to get preinstall/vminstall/runscripts information +my $bconf = Build::read_config('noarch', "$dir/.build.config"); +die("cannot expand preinstalls\n") if $bconf->{'expandflags:preinstallexpand'}; +my @preinstalls = Build::get_preinstalls($bconf); +my @vminstalls = Build::get_vminstalls($bconf); +my @runscripts = Build::get_runscripts($bconf); +push @rpmlist, "preinstall: @preinstalls"; +push @rpmlist, "vminstall: @vminstalls"; +push @rpmlist, "runscripts: @runscripts"; + +writestr("$dir/.build.rpmlist", undef, join("\n", @rpmlist)."\n"); + +my @params; +if (ref($invocation->{'parameters'}) eq 'HASH') { + my $parameters = $invocation->{'parameters'}; + for my $k (sort keys %$parameters) { + next unless defined $parameters->{$k} && !ref($parameters->{$k}); + push @params, 'release', $parameters->{$k} if $k eq 'release'; + push @params, 'debuginfo', 1 if $k eq 'debuginfo' && $parameters->{$k}; + } +} +push @params, 'recipe', $recipefile; +my $params = ''; +while (@params) { + my ($k, $v) = splice(@params, 0, 2); + $v =~ s/[\r\n].*\z//s; + $params .= "$k=$v\n"; +} +writestr("$dir/.build.params", undef, $params);