ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Vladimir D. Seleznev" <vseleznv@altlinux.org>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] [PATCH 1/2] gb/gb-sh-functions: introduce pkg_identity()
Date: Mon, 13 Apr 2020 22:32:22 +0300
Message-ID: <20200413193222.GB15437@portlab> (raw)
In-Reply-To: <20200413180143.GB21630@altlinux.org>

On Mon, Apr 13, 2020 at 09:01:43PM +0300, Dmitry V. Levin wrote:
> On Sat, Apr 11, 2020 at 02:10:43AM +0300, Vladimir D. Seleznev wrote:
> > ---
> >  gb/gb-sh-functions | 112 +++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 112 insertions(+)
> > 
> > diff --git a/gb/gb-sh-functions b/gb/gb-sh-functions
> > index cd9039a..d7b1980 100644
> > --- a/gb/gb-sh-functions
> > +++ b/gb/gb-sh-functions
> > @@ -283,4 +283,115 @@ rpm_changes_since()
> >  
> >  	gb-x-changelog-complement ${tmpdir}/changelog_old ${tmpdir}/changelog_new
> >  }
> > +
> > +pkg_identity()
> > +{
> > +	local keep_branch= pkg=
> > +	pkg="${1-}"; shift
> > +	if [ "$pkg" = "--with-branch" ]; then
> > +		pkg="${1-}"; shift
> > +		keep_branch=1
> > +	fi
> > +
> > +	# List of rpm tags that should be filtered
> > +	#
> > +	# RPM tags that contain insufficient information about package
> > +	# contents and relationship, and do not affect package functionality
> > +	# should be filtered.
> > +	#
> > +	# The main criterias for tags to be filtered:
> > +	#
> > +	# - Tag contains random or not reproducible value that is assigning
> > +	#   during the build, and this value does not affect package
> > +	#   functionality;
> > +	# - Tag contains metadata about build host properties;
> > +	# - Tag contains metadata of package headers, including its signatures;
> > +	# - Tag is only related to package database;
> > +	# - Other reasons that are considered worthy.
> > +	cat >"$tmpdir"/filtertags <<EOF
> > +ARCH
> > +ARCHIVESIZE
> > +AUTOINSTALLED
> > +BUILDARCHS
> > +BUILDHOST
> > +BUILDTIME
> > +COOKIE
> > +DBINSTANCE
> > +DISTRIBUTION
> > +DISTTAG
> > +DISTURL
> > +DSAHEADER
> > +FILESTATES
> > +HDRID
> > +HEADERCOLOR
> > +HEADERI18NTABLE
> > +HEADERIMAGE
> > +HEADERIMMUTABLE
> > +HEADERREGIONS
> > +HEADERSIGNATURES
> > +IDENTITY
> > +INSTALLCOLOR
> > +INSTALLTID
> > +INSTALLTIME
> > +INSTFILENAMES
> > +INSTPREFIXES
> > +LONGARCHIVESIZE
> > +LONGSIGSIZE
> > +LONGSIZE
> > +PKGID
> > +RPMVERSION
> > +RSAHEADER
> > +SHA1HEADER
> > +SIGGPG
> > +SIGLEMD5_1
> > +SIGMD5
> > +SIGPGP
> > +SIGSIZE
> > +SIZE
> > +SOURCEPKGID
> > +EOF
> 
> First of all, I don't think this tools belongs to girar.

Ok, it will be a separate tool. Should it be implemented as some
functionality of rpm, or as a side project?

> > +	local rpm_version="$(rpm --version)"
> > +	# tag extensions do not exists in the rpm 4.0.4
> > +	if [ "$rpm_version" != "RPM version 4.0.4" ]; then
> > +	    rpm --verbose --querytags |
> > +	    while read tagname tagval tagtype ext; do
> > +		    if [ "$ext" = "ext" ]; then
> > +			    # filter all tag extensions too
> > +			    echo "$tagname" >> "$tmpdir"/filtertags
> > +		    fi
> > +	    done
> > +	fi
> 
> Second, I don't see why do you need this rpm version check.
> Can't you just do this regardless of rpm version?

A new version of rpm can brings new tag extensions, so I can maintain
list of tag extensions by myself, or I can get the list from rpm
output. The second option is way more convenient.

> > +	sort -o "$tmpdir"/filtertags{,}
> > +	rpmquery --querytags |sort >"$tmpdir"/querytags

Ok.

> We don't assume that pipefail is enabled, so we prefer
> 	rpmquery --querytags "$tmpdir"/querytags
> 	sort -u -o "$tmpdir"/querytags{,}
> 
> > +	join -v1 "$tmpdir/querytags" "$tmpdir/filtertags" >"$tmpdir"/tags
> > +
> > +	# erase extra apt indices tags
> > +	sed -i '/APTINDEX/d' "$tmpdir"/tags
> 
> Have you ever seen a package with these tags in its header?

I haven't, but just for sure... But if actually they would appear in
package header we shouldn't just ignore them. I'll wipe these lines out.

> > +
> > +	# construct query format string in form "[tag:%{tag:shescape}\n]"
> > +	local qf="$(sed -E 's/^(.+)$/[\1:%{\1:shescape}\\n]/' "$tmpdir"/tags)"
> 
> This construction ignores sed exit status.

Is

    local qf="$(sed -E 's/^(.+)$/[\1:%{\1:shescape}\\n]/' "$tmpdir"/tags |touch $tmpdir/FAIL)"

    if [ -f"$tmpdir/FAIL" ]; then
    ...

OK?

-- 
   WBR,
   Vladimir D. Seleznev


  reply	other threads:[~2020-04-13 19:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10 23:10 [devel] RFC: girar: optimize rebuild Vladimir D. Seleznev
2020-04-10 23:10 ` [devel] [PATCH 1/2] gb/gb-sh-functions: introduce pkg_identity() Vladimir D. Seleznev
2020-04-13 18:01   ` Dmitry V. Levin
2020-04-13 19:32     ` Vladimir D. Seleznev [this message]
2020-04-10 23:10 ` [devel] [PATCH 2/2] gb: optimize rebuilt srpm if its identity is equal to identity of srpm in the repo Vladimir D. Seleznev
2020-04-11 11:29   ` Alexey Tourbin
2020-04-14 16:42     ` Vladimir D. Seleznev
2020-04-16 21:51       ` Alexey Tourbin
2020-04-17 13:54         ` Dmitry V. Levin
2020-04-20  9:05           ` [devel] stopping a cascade of rebuilds Alexey Tourbin
2020-04-23 19:21             ` Vladimir D. Seleznev
2020-04-23 20:54               ` Dmitry V. Levin
2020-04-27  5:38               ` Alexey Tourbin
2020-04-20  8:36         ` [devel] [PATCH 2/2] gb: optimize rebuilt srpm if its identity is equal to identity of srpm in the repo Alexey Tourbin
2020-04-11 10:36 ` [devel] RFC: girar: optimize rebuild Andrey Savchenko
2020-04-11 15:33   ` Vladimir D. Seleznev
2020-04-11 23:31   ` Alexey V. Vissarionov
2020-04-14 14:57     ` Andrey Savchenko
2020-04-14 16:20       ` Vladimir D. Seleznev
2020-04-11 11:04 ` Gleb Fotengauer-Malinovskiy
2020-04-11 15:21   ` Vladimir D. Seleznev
2020-04-11 16:41     ` Gleb Fotengauer-Malinovskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200413193222.GB15437@portlab \
    --to=vseleznv@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git