From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=altlinux.org; s=dkim; h=Subject:Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PNXLQLSnEd26rT1osZ7aY/Cdm+rc+klh9HrAuhcyRX8=; b=kwwQscu6KHcHsviHjbI2Txw8dd GAqNdbEP5/IN1NJF3bJvzOxMcWfL6vNxGO/okvbrq8fRAELJcN2VViMtoMTI4zJx/MZjDGZQSBBNO smspKhM/A6frmJVj6R3NJX70UZ/pRdmVvVqvxQrdw+xOXcroWSTZPgikFQNENv2+PHGSfvgngUL8o D8BDpzNLc+M3DP7eoX3PvmYRVdC1l3mn94XbeK3zmRb2PE3oUfa/0VqiCBhipYnJPDRt7TznxwzYh 0nDxMUQoy1hToXU/xT7BpT/AUN/QaXLpca9yxpedKjDB2WtyFHfxxhvX7HPzt+dvkTsexrTSregnP ABCmg/6A==; From: "Vladimir D. Seleznev" To: devel@lists.altlinux.org Date: Thu, 26 Nov 2020 19:26:47 +0300 Message-Id: <20201126162648.3136095-1-vseleznv@altlinux.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 46.39.229.3 X-SA-Exim-Mail-From: vseleznv@altlinux.org X-SA-Exim-Version: 4.2.1 X-SA-Exim-Scanned: Yes (on mail.cs.msu.ru) Cc: legion@altlinux.org, "Vladimir D. Seleznev" Subject: [devel] [PATCH 1/2] Add diff exclude option for gear-rules X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2020 16:27:15 -0000 Archived-At: List-Archive: List-Post: The option specifies a glob pattern that define files that should be excluded from diff generation. Signed-off-by: Vladimir D. Seleznev --- gear | 18 +++++++++++++----- gear-rules.5.in | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/gear b/gear index 6282c92..4c15069 100755 --- a/gear +++ b/gear @@ -337,7 +337,7 @@ make_archive() write_git_archive "$format" "$optional" "$cmd" "$tar_tree" "$dir_name" "$tar_name" "$tar_base" "$tar_suffix" } -get_diff_name() +get_diff_opts() { local old_d="$1" && shift local new_d="$1" && shift @@ -367,7 +367,7 @@ get_diff_name() diff_name='@new_dir@-@version@-@release@.patch' fi - local opt spec= + local opt pattern spec= for opt; do case "$opt" in @@ -376,6 +376,12 @@ get_diff_name() ;; name=*) diff_name="${opt#name=}" ;; + exclude=*) + pattern="${opt#exclude=}" + [ -z "$(printf %s "$pattern" |tr -d '[:alnum:]_.?*-/![]')" ] || + rules_error "Invalid diff exclude pattern specified: $pattern" + diff_exclude="$diff_exclude $(printf ':^%s' $pattern)" + ;; *) rules_error "Unrecognized option: $opt" ;; esac @@ -402,6 +408,7 @@ write_git_diff() { local optional="$1" && shift local cmd="$1" && shift + local diff_exclude="$1" && shift local old_tree="$1" && shift local old_dir="$1" && shift local new_tree="$1" && shift @@ -423,7 +430,7 @@ write_git_diff() } git diff-tree --patch-with-stat --text --no-renames --no-ext-diff \ - "$old_id" "$new_id" >"$outdir/$name" + "$old_id" "$new_id" -- $diff_exclude >"$outdir/$name" verbose "Extracted diff: $name" compress_file "$cmd" "$name" '' @@ -449,14 +456,15 @@ make_difference() diff_new_tree="${new_dir%%:*}" new_dir="${new_dir#*:}" - get_diff_name "$old_dir" "$new_dir" "$@" + diff_exclude= + get_diff_opts "$old_dir" "$new_dir" "$@" diff_old_tree="$(resolve_tree_base_name "$diff_old_tree")" || rules_error "Invalid old tree: $diff_old_tree" diff_new_tree="$(resolve_tree_base_name "$diff_new_tree")" || rules_error "Invalid new tree: $diff_new_tree" - write_git_diff "$optional" "$cmd" "$diff_old_tree" "$old_dir" "$diff_new_tree" "$new_dir" "$diff_name" + write_git_diff "$optional" "$cmd" "$diff_exclude" "$diff_old_tree" "$old_dir" "$diff_new_tree" "$new_dir" "$diff_name" } extract_pattern() diff --git a/gear-rules.5.in b/gear-rules.5.in index 5469199..ae79a35 100644 --- a/gear-rules.5.in +++ b/gear-rules.5.in @@ -380,6 +380,12 @@ unless the path part of .I new_tree_path is \*(lq.\*(rq, in which case the default is .BR @name@\-@version@\-@release@.patch . +.TP +.BI exclude= glob_pattern +All the files that match the +.B glob_pattern +are excluded from the patch generation. This option can be specified multiple +times. .RE .IP Value of the @@ -541,6 +547,19 @@ However, if a prerelease version is packaged, parts like \*(lqpreN\*(rq or \*(lqrcN\*(rq should not be included in the package version, therefore the rule file will need some modifications for such versions. +.PP +You can also want to exclude +.BR .gear +subdirectory and spec file from diff generation: +.RS 4 +.PP +.ft CW +.nf +tar: v@version@:. +diff: v@version@:. . exclude=.gear/** exclude=*.spec +.fi +.RE +.PP . .SS "Archive with unmodified sources and separate patch files" If you prefer to maintain patch files for local modifications instead -- 2.29.2