From: Alexey Tourbin <at@altlinux.ru> To: devel@lists.altlinux.org Subject: [devel] sisyphus_check: check-subdirs Date: Sun, 4 May 2008 22:03:45 +0400 Message-ID: <20080504180345.GC24150@solemn.turbinal> (raw) [-- Attachment #1.1: Type: text/plain, Size: 3060 bytes --] Я реализовал новую проверку на владение подкаталогами. Эта проверка требует, что если какой-то каталог /A запакован в пакет, то и все подкаталоги в иерархии /A/**/* тоже должны быть запакованы в этот пакет. Пример: %files %dir /A /A/B/C/D Ошибка -- также должны быть запакованы подкаталоги /A/B и /A/B/C, потому что они являются промежуточными компонентами пути /A/B/C/D. commit a139ba3bb19c1651b2c52bab8b237fe73b4e0b4f Author: Alexey Tourbin <at@altlinux.ru> Date: Sun May 4 20:46:17 2008 +0400 check-subdirs: new check for unpackaged directories diff --git a/sisyphus_check/sisyphus_check.d/170-check-subdirs b/sisyphus_check/sisyphus_check.d/170-check-subdirs new file mode 100644 index 0000000..522978b --- /dev/null +++ b/sisyphus_check/sisyphus_check.d/170-check-subdirs @@ -0,0 +1,72 @@ +#!/bin/sh -efu +# +# Check that directory packaging is hierarchically consistent. +# +# E.g. consider this %files section: +# %dir /A +# /A/B/C/D +# Now we require that directories "/A/B" and "/A/B/C" are also packaged. +# +# Copyright (C) 2008 Alexey Tourbin <at@altlinux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +find_unpackaged_subdirs() +{ + [ -n "${rpm_filelist?}" ] || return 0 + printf '%s\n' "$rpm_filelist" |awk ' + /^\// { + OWN[$0] = 1 + } + function check_path(path) { + # "/A/B/C/D" -> ["","A","B","C","D"] + n = split(path, comp, "/") + # find shortest prefix which is owned by the package, + # i.e. either "/A" or "/A/B" (or none - no need to check "/A/B/C"). + prefix = "" + for (i = 2; i < n-1; i++) { + prefix = prefix "/" comp[i] + if (prefix in OWN) + break + } + if (!prefix) + return + # check if every subdir under the prefix is also owned + subdir = prefix + for (j = i+1; j < n; j++) { + subdir = subdir "/" comp[j] + if (!(subdir in OWN)) + printf "%s\t%s\t%s\n", prefix, subdir, path + } + } + END { + for (path in OWN) + check_path(path) + }' +} + +check_subdirs() +{ + local f="$1"; shift || return + local subdirs="$(find_unpackaged_subdirs)" + [ -n "$subdirs" ] || return 0 + local tab="$(printf '\t')" + subdirs=$(printf '%s\n' "$subdirs" |sort -t "$tab" -u -k2,2) + local prefix subdir path + printf '%s\n' "$subdirs" | + while IFS="$tab" read -r prefix subdir path; do + FileError "unpackaged directory: $subdir" "$f" + done + return 1 +} + +run_check() +{ + if ! check_subdirs "$1"; then + Message 'ERROR: you have problems!' + return 1 + fi +} В сизиф эта проверка пойдёт, наверное, после окончания фриза. Если есть возражения, а именно, если есть случаи, когда условие "иерархической консистентности" владения каталогами выполняться не должно, я прошу эти возражения озвучить. Пока же попались следующие *.noarch.rpm пакеты. [-- Attachment #1.2: noarch-unpackaged-subdirs.txt.gz --] [-- Type: application/octet-stream, Size: 1928 bytes --] [-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next reply other threads:[~2008-05-04 18:03 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-05-04 18:03 Alexey Tourbin [this message] 2008-05-04 18:17 ` Michael Shigorin 2008-05-04 18:58 ` Alexey Tourbin
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=20080504180345.GC24150@solemn.turbinal \ --to=at@altlinux.ru \ --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