Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 36 additions & 19 deletions 20-files-present-and-referenced
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,24 @@ HELPERS_DIR="$BASE_DIR/helpers"
$HELPERS_DIR/check_input_filename "$DIR_TO_CHECK" || exit 1
. $HELPERS_DIR/functions
test -z "$DESTINATIONDIR" -a -d "$DIR_TO_CHECK/.osc" && {
OSCLIBVER="$(<.osc/_osclib_version)"
case "$OSCLIBVER" in
1.0)
DESTINATIONDIR="$DIR_TO_CHECK/.osc"
DOTOSCDIR="$DIR_TO_CHECK/.osc"
;;
2.0)
DESTINATIONDIR="$DIR_TO_CHECK/.osc/sources"
DOTOSCDIR="$DIR_TO_CHECK/.osc"
;;
*)
echo "osclib version $OSCLIBVER not yet supported by source_validator" && exit 2
;;
esac
if [ -d "$DIR_TO_CHECK/.git" ]; then
DESTINATIONDIR="$DIR_TO_CHECK"
else
OSCLIBVER="$(<.osc/_osclib_version)"
case "$OSCLIBVER" in
1.0)
DESTINATIONDIR="$DIR_TO_CHECK/.osc"
DOTOSCDIR="$DIR_TO_CHECK/.osc"
;;
2.0)
DESTINATIONDIR="$DIR_TO_CHECK/.osc/sources"
DOTOSCDIR="$DIR_TO_CHECK/.osc"
;;
*)
echo "osclib version $OSCLIBVER not yet supported by source_validator" && exit 2
;;
esac
fi
OSC_MODE="true"
}

Expand Down Expand Up @@ -80,6 +84,10 @@ while read recipe flavor; do
cat "$TMPDIR/sources.err"
cleanup_and_exit 1
fi
$HELPERS_DIR/spec_query --specfile "${DIR_TO_CHECK}/${recipe}" --print-moveassets --buildflavor "$flavor" \
--no-conditionals --keep-name-conditionals --disambiguate-sources \
| sed 's,^.*/,,' \
>> "$TMPDIR/moveassettargets" 2>"$TMPDIR/sources.err"
done < <(spec_build_flavors "$DIR_TO_CHECK")
for i in "$DIR_TO_CHECK"/*.dsc ; do
test -f "$i" || continue
Expand Down Expand Up @@ -132,22 +140,30 @@ fi

obscpio_file_list()
{
if ! [ -e "$TMPDIR/obcspio_sources" ]; then
touch "$TMPDIR/obcspio_sources"
if ! [ -e "$TMPDIR/obscpio_sources" ]; then
touch "$TMPDIR/obscpio_sources"
for i in "$DIR_TO_CHECK/"*.obscpio; do
if [ -e "$i" ]; then
cpio --list --quiet < "$i" >> "$TMPDIR/obcspio_sources"
cpio --list --quiet < "$i" >> "$TMPDIR/obscpio_sources"
fi
done
for i in "$DIR_TO_CHECK/"*; do
if [ -d "$i" ]; then
echo "${i##*/}" >> "$TMPDIR/obscpio_sources"
fi
done
fi

cat "$TMPDIR/obcspio_sources"
cat "$TMPDIR/obscpio_sources"
}

check_tracked()
{
local file=${1##*/}

if grep -q "^$file" "$TMPDIR/moveassettargets"; then
# it will generated at build time
return 0
fi
if test "$OSC_MODE" = "true" ; then
if test -x "$(type -p git)" && test -d "$DIR_TO_CHECK/.git"; then
if git --git-dir="$DIR_TO_CHECK/.git" ls-files --error-unmatch "$file" > /dev/null; then
Expand Down Expand Up @@ -346,6 +362,7 @@ find "$DIR_TO_CHECK" -mindepth 1 -maxdepth 1 | while read -s -r i; do
*~ | \
.git | \
.gitattributes | \
.gitmodules | \
.gitignore | \
.emacs.backup | \
PKGBUILD | \
Expand Down
10 changes: 10 additions & 0 deletions helpers/spec_query
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ sub parse {
return $descr;
}

sub print_moveassets {
my ($descr) = @_;
print "@{$descr->{'moveassets'} || []} ";
print "\n";
}

sub print_subpacks {
my ($descr) = @_;
print "@{$descr->{'subpacks'} || []} ";
Expand Down Expand Up @@ -173,6 +179,7 @@ EOF

my $specfile;
my $arch = 'noarch';
my $print_moveassets;
my $print_subpacks;
my $print_sources;
my $no_conditionals;
Expand All @@ -193,6 +200,8 @@ while (@ARGV) {
$buildflavor = shift @ARGV;
} elsif ($opt eq '--print-subpacks') {
$print_subpacks = 1;
} elsif ($opt eq '--print-moveassets') {
$print_moveassets = 1;
} elsif ($opt eq '--print-sources') {
$print_sources = 1;
} elsif ($opt eq '--no-conditionals') {
Expand All @@ -214,3 +223,4 @@ my $descr = parse($specfile, $arch, $no_conditionals, $keep_name_conditionals,
$unique_sources, $disambiguate_sources, $buildflavor);
print_subpacks($descr) if $print_subpacks;
print_sources($descr) if $print_sources;
print_moveassets($descr) if $print_moveassets;