File: scansources

package info (click to toggle)
debian-cd 2.2.13
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,480 kB
  • ctags: 120
  • sloc: sh: 1,666; perl: 1,078; makefile: 832
file content (151 lines) | stat: -rwxr-xr-x 4,522 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh

# Copyright 1999 Raphal Hertzog <hertzog@debian.org>
# See the README file for the license

# This script will create the Sources.gz files
# First arg = directory of the CD

set -e

SDIR=$TDIR/$CODENAME-src
PREFIX=`echo $1 | sed "s?$SDIR/CD?$SDIR/?"`

if [ -n "$NONFREE" -o -n "$EXTRANONFREE" ]; then
  SECTIONS="main contrib non-free"
else
  SECTIONS="main contrib"
fi

cd $1

# We have to scan all possible dists where sources can be
DISTS=""
DISTSNONUS=""
for i in `cd dists; echo *; cd ..`; do
    if [ ! -L "dists/$i" -a -d "dists/$i" ]; then
        if [ -d "dists/$i/main/source" -o \
	     -d "dists/$i/non-free/source" -o \
	     -d "dists/$i/contrib/source" ]; then
            DISTS="$DISTS $i"
        fi
        if [ -d "dists/$i/non-US/main/source" -o \
	     -d "dists/$i/non-US/non-free/source" -o \
	     -d "dists/$i/non-US/contrib/source" ]; then
            DISTSNONUS="$DISTSNONUS $i"
        fi
    fi
done

if [ -e "$MIRROR/dists/$CODENAME/Release" ]; then
    # Strip the MD5Sum and SHA1 field
    perl -ne 'if (/^(MD5Sum|SHA1):/) { $f=1; next; }
    if ($f) { 
	unless (/^ /) { print; $f=0 } 
    } else { print }' \
    $MIRROR/dists/$CODENAME/Release > dists/$CODENAME/Release
fi
if [ -n "$NONUS" -a -e "$NONUS/dists/$CODENAME/non-US/Release" ]; then
    # Strip the MD5Sum and SHA1 field
    perl -ne 'if (/^(MD5Sum|SHA1):/) { $f=1; next; }
    if ($f) { 
	unless (/^ /) { print; $f=0 } 
    } else { print }' \
    $NONUS/dists/$CODENAME/non-US/Release \
    > dists/$CODENAME/non-US/Release
fi


# Creating the file lists
for SECT in $SECTIONS; do
    touch $PREFIX.sourcefilelist_$SECT
    if [ -d "pool/$SECT" ]; then
        find pool/$SECT >>$PREFIX.sourcefilelist_$SECT
    fi
    for DIST in $DISTS; do
        if [ -d "dists/$DIST/$SECT/binary-$ARCH" ]; then
            find dists/$DIST/$SECT/binary-$ARCH >>$PREFIX.sourcefilelist_$SECT
        fi
    done
    if [ -n "$NONUS" ]; then
        touch $PREFIX.sourcefilelist_non-US_$SECT
        if [ -d "pool/non-US/$SECT" ]; then
            find pool/non-US/$SECT >>$PREFIX.sourcefilelist_non-US_$SECT
        fi
        for DIST in $DISTSNONUS; do
            if [ -d "dists/$DIST/non-US/$SECT/binary-$ARCH" ]; then
                find dists/$DIST/non-US/$SECT/binary-$ARCH \
                    >>$PREFIX.sourcefilelist_non-US_$SECT
            fi
        done 
    fi
done

# Creating the config files
cat >$PREFIX.generate-source <<EOF
Dir::ArchiveDir "$1";
Dir::OverrideDir "$SDIR/indices";
Dir::CacheDir "$APTTMP/$CODENAME-$ARCH/apt-ftparchive-db";

TreeDefault::Contents " ";

Tree "dists/$CODENAME" {
    SourceFileList "$PREFIX.sourcefilelist_\$(SECTION)";
    Sections "$SECTIONS";
    Architectures "source";
    
    BinOverride "override.$CODENAME.\$(SECTION)";
    ExtraOverride "override.$CODENAME.extra.\$(SECTION)";
    SrcOverride "override.$CODENAME.\$(SECTION).src";
}
EOF
cat >$PREFIX.generate-source-non-US <<EOF
Dir::ArchiveDir "$1";
Dir::OverrideDir "$SDIR/indices-non-US";
Dir::CacheDir "$APTTMP/$CODENAME-$ARCH/apt-ftparchive-db";

TreeDefault::Contents " ";

Tree "dists/$CODENAME/non-US" {
    SourceFileList "$PREFIX.sourcefilelist_non-US_\$(SECTION)";
    Sections "`echo $SECTIONS | sed -e 's# local##'`";
    Architectures "source";
    
    BinOverride "override.$CODENAME.\$(SECTION)";
    ExtraOverride "override.$CODENAME.extra.\$(SECTION)";
    SrcOverride "override.$CODENAME.\$(SECTION).src";
}
EOF

# Creating the indices directory
if [ ! -d "$SDIR/indices" ]; then
    mkdir $SDIR/indices
    cp $MIRROR/indices/* $SDIR/indices/
    if [ -n "$LOCALDEBS" -a -d $LOCALDEBS/indices ]; then
         cp $LOCALDEBS/indices/* $SDIR/indices/
    fi
    gunzip -f $SDIR/indices/*.gz
    for SECT in $SECTIONS; do
        touch $SDIR/indices/override.$CODENAME.$SECT
        touch $SDIR/indices/override.$CODENAME.extra.$SECT
        touch $SDIR/indices/override.$CODENAME.$SECT.src
    done
fi
if [ -n "$NONUS" -a ! -d "$SDIR/indices-non-US" ]; then
    mkdir $SDIR/indices-non-US
    cp $NONUS/indices-non-US/* $SDIR/indices-non-US/
    gunzip -f $SDIR/indices-non-US/*.gz
    for SECT in `echo $SECTIONSNONUS | sed -e 's#non-US/##g'`; do
        touch $SDIR/indices-non-US/override.$CODENAME.$SECT
        touch $SDIR/indices-non-US/override.$CODENAME.extra.$SECT
        touch $SDIR/indices-non-US/override.$CODENAME.$SECT.src
    done
fi

apt-ftparchive generate $PREFIX.generate-source
if [ -n "$NONUS" ]; then
    apt-ftparchive generate $PREFIX.generate-source-non-US
fi


exit 0