Re-indent for sanity

This commit is contained in:
Steve McIntyre 2013-01-23 02:21:07 +00:00
parent 6406136673
commit e9ad5c11a4
1 changed files with 85 additions and 87 deletions

View File

@ -58,103 +58,103 @@ done
echo "# Starting merge at "`date` >> $BDIR/list.mid
if [ $source = "yes" ] ; then
echo "DONEDONE" > $BDIR/DONE
awk -v max_size=$MAX_PKG_SIZE '
echo "DONEDONE" > $BDIR/DONE
awk -v max_size=$MAX_PKG_SIZE '
# First parse the Sources files
/^Package:/ {
srcname=$2
srcs_done++
}
/^Binary:/ {
bins=$0
gsub("^Binary:","",bins)
gsub(",","",bins)
nb=split(bins, binarray)
for (i=1; i <= nb; i++) {
bin2src[binarray[i]] = srcname
bins_done++
}
}
# First parse the Sources files
/^Package:/ {
srcname=$2
srcs_done++
}
/^Binary:/ {
bins=$0
gsub("^Binary:","",bins)
gsub(",","",bins)
nb=split(bins, binarray)
for (i=1; i <= nb; i++) {
bin2src[binarray[i]] = srcname
bins_done++
}
}
/^Files:/ {
in_files = 1
next
}
in_files = 1
next
}
/^ / {
if (in_files) {
size[srcname]+=$2
next
}
}
if (in_files) {
size[srcname]+=$2
next
}
}
# Done reading the Sources
/^DONEDONE/ {
parsed=1
printf("# Parsed Sources files: %d sources producing %d binaries\n", srcs_done, bins_done)
next
}
/^DONEDONE/ {
parsed=1
printf("# Parsed Sources files: %d sources producing %d binaries\n", srcs_done, bins_done)
next
}
# Now start placing source packages, depending on the order of the binary packages
/.*/ {
in_files = 0
if (parsed) {
split($0,fields,":")
arch=fields[1]
component=fields[2]
pkg=fields[3]
pkgsize=fields[4]
source=bin2src[pkg]
if ("" == source) {
if ("main-installer" == component) {
printf("# Ignoring source for udeb %s\n", pkg)
} else {
printf("# Source for pkg %s is UNKNOWN!\n", pkg)
}
} else {
if (!included[source]) {
printf("# Adding source %s at %d because of %s:%s\n",
source, FNR, arch, pkg)
included[source] = pkg
incarch[source] = arch
indexnr[source] = FNR
sourcecomp[source] = component
} else {
if (FNR < indexnr[source]) {
printf("# Updating source %s: was due to %d:%s:%s, now moved earlier because of %d:%s:%s\n",
source, indexnr[source],
incarch[source], included[source],
FNR, arch, pkg)
included[source] = pkg
incarch[source] = arch
indexnr[source] = FNR
} else {
printf("# Not adding pkg %s source (%d:%s:%s), already added due to %d:%s:%s\n",
pkg, FNR, arch, source,
indexnr[source], incarch[source],
included[source])
}
}
}
if (size[source] <= max_size) {
printf("%d:%s\n", FNR, $0)
# Now start placing source packages, depending on the order of the binary packages
/.*/ {
in_files = 0
if (parsed) {
split($0,fields,":")
arch=fields[1]
component=fields[2]
pkg=fields[3]
pkgsize=fields[4]
source=bin2src[pkg]
if ("" == source) {
if ("main-installer" == component) {
printf("# Ignoring source for udeb %s\n", pkg)
} else {
printf("# Source for pkg %s is UNKNOWN!\n", pkg)
}
} else {
if (!included[source]) {
printf("# Adding source %s at %d because of %s:%s\n",
source, FNR, arch, pkg)
included[source] = pkg
incarch[source] = arch
indexnr[source] = FNR
sourcecomp[source] = component
} else {
if (FNR < indexnr[source]) {
printf("# Updating source %s: was due to %d:%s:%s, now moved earlier because of %d:%s:%s\n",
source, indexnr[source],
incarch[source], included[source],
FNR, arch, pkg)
included[source] = pkg
incarch[source] = arch
indexnr[source] = FNR
} else {
printf("%d:%s-DEPTOOBIG\n", FNR, $0)
printf("# Not adding pkg %s source (%d:%s:%s), already added due to %d:%s:%s\n",
pkg, FNR, arch, source,
indexnr[source], incarch[source],
included[source])
}
}
}
}
}
if (size[source] <= max_size) {
printf("%d:%s\n", FNR, $0)
} else {
printf("%d:%s-DEPTOOBIG\n", FNR, $0)
}
}
}
END {
for (source in included) {
END {
for (source in included) {
if (size[source] > max_size) {
printf("%d:aaaaaaaaaaaaaaaaaa:%s:%s-SRCTOOBIG\n", indexnr[source], sourcecomp[source], source, size[source])
} else {
printf("%d:aaaaaaaaaaaaaaaaaa:%s:%s\n", indexnr[source], sourcecomp[source], source, size[source])
}
}
}' $ADIR/$CODENAME-source/apt-state/lists/*Sources $BDIR/DONE $list | sort -nk 1 -t : >> $BDIR/list.mid
}
}' $ADIR/$CODENAME-source/apt-state/lists/*Sources $BDIR/DONE $list | sort -nk 1 -t : >> $BDIR/list.mid
else
awk '{printf("%d:%s\n", FNR, $0)}' $list | sort -nk 1 -t : >> $BDIR/list.mid
awk '{printf("%d:%s\n", FNR, $0)}' $list | sort -nk 1 -t : >> $BDIR/list.mid
fi
echo "# Ending merge pass 1 at "`date` >> $BDIR/list.mid
@ -164,17 +164,15 @@ echo "# Ending merge pass 1 at "`date` >> $BDIR/list.mid
# again
grep -v -e ^# -e TOOBIG $BDIR/list.mid | awk -F : '
{
if (!($4 in add))
{
if (!($4 in add)) {
pkgname[number_packages++] = $4
}
gsub("aaaaaaaaaaaaaaaaaa", "source", $2) # Undo the source sorting hack
gsub("main-installer", "main", $3)
gsub("aaaaaaaaaaaaaaaaaa", "source", $2) # Undo the source sorting hack
gsub("main-installer", "main", $3)
add[$4] = add[$4] $2 ":" $3 ":" $4 ":" $5 " "
}
END {
for (i = 0; i < number_packages; i++)
{
for (i = 0; i < number_packages; i++) {
gsub(" $", "", add[pkgname[i]])
gsub(" ", "\n", add[pkgname[i]])
print add[pkgname[i]]