Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rpg-solve-fast is now rpg-solve; rpg-solve.sh goes away

  • Loading branch information...
commit 5e038e5d0d0b0a03d12e58ee9dd72b8a68f87b5d 1 parent df219b2
@rtomayko authored
View
16 Makefile
@@ -20,10 +20,10 @@ SOURCES = \
rpg-sh-setup.sh rpg.sh rpg-config.sh rpg-fetch.sh rpg-install.sh \
rpg-uninstall.sh rpg-build.sh rpg-env.sh rpg-sync.sh \
rpg-resolve.sh rpg-upgrade.sh rpg-steal.sh rpg-fsck.sh rpg-outdated.sh \
- rpg-package-register.sh rpg-package-install.sh rpg-solve.sh rpg-unpack.sh \
+ rpg-package-register.sh rpg-package-install.sh rpg-unpack.sh \
rpg-package-spec.rb rpg-parse-index.rb rpg-shit-list.sh rpg-prepare.sh \
rpg-help.sh rpg-package-index.sh rpg-list.sh rpg-dependencies.sh \
- rpg-leaves.sh rpg-solve-fast.c
+ rpg-leaves.sh rpg-solve.c
DOCHTML = \
rpg-sh-setup.html rpg.html rpg-fetch.html \
@@ -35,15 +35,15 @@ PROGRAMPROGRAMS = \
rpg-config rpg-fetch rpg-install rpg-uninstall rpg-build \
rpg-env rpg-sync rpg-resolve rpg-upgrade rpg-steal rpg-fsck rpg-list \
rpg-outdated rpg-package-list rpg-package-register rpg-package-install \
- rpg-solve rpg-unpack rpg-package-spec rpg-parse-index rpg-shit-list \
+ rpg-unpack rpg-package-spec rpg-parse-index rpg-shit-list \
rpg-prepare rpg-complete rpg-help rpg-package-index rpg-dependencies \
- rpg-leaves rpg-solve-fast
+ rpg-leaves rpg-solve
DEADPROGRAMS = \
rpg-update rpg-status rpg-parse-package-list rpg-version-test
OBJECTS = \
- strnatcmp.o rpg-solve-fast.o
+ strnatcmp.o rpg-solve.o
USERPROGRAMS = rpg rpg-sh-setup
PROGRAMS = $(USERPROGRAMS) $(PROGRAMPROGRAMS)
@@ -85,12 +85,12 @@ PROGRAMS = $(USERPROGRAMS) $(PROGRAMPROGRAMS)
rpg-sh-setup: config.sh munge.rb
rpg: config.sh munge.rb
-rpg-solve-fast: rpg-solve-fast.o strnatcmp.o
+rpg-solve: rpg-solve.o strnatcmp.o
printf "%13s %-30s" "[LINK]" "$@"
- $(CC) $(CFLAGS) $(LDFLAGS) rpg-solve-fast.o strnatcmp.o -o $@
+ $(CC) $(CFLAGS) $(LDFLAGS) rpg-solve.o strnatcmp.o -o $@
printf " OK\n"
-rpg-solve-fast.o: rpg-solve-fast.c strnatcmp.h
+rpg-solve-fast.o: rpg-solve.c strnatcmp.h
strnatcmp.o: strnatcmp.c strnatcmp.h
build: $(PROGRAMS)
View
36 rpg-prepare.sh
@@ -41,6 +41,7 @@ packlist="$sessiondir/package-list"
solved="$sessiondir/solved"
existing="$sessiondir/existing"
delta="$sessiondir/delta"
+release="$RPGINDEX/release"
# Get rid of any crusty session directory and then create a new one. It might be
# cool to add an `-e` option so that sessions could be edited to add or
@@ -114,27 +115,28 @@ do
# dependencies list that cannot be paired with the master package list to be
# included in the output.
alldeps=$(
- echo "$alldeps" |sort |
- join -1 1 -2 2 -v 1 \
- -o 1.1,1.2,1.3,1.4 \
- - "$packlist" |
- sort -b -k2,4
+ echo "$alldeps" |sort |
+ join -1 1 -2 2 -v 1 \
+ -o 1.1,1.2,1.3,1.4 \
+ - "$packlist" |
+ sort -b -k 2,4
)
# Now take all dependencies for all existing packages that *aren't* being
# installed here and add them to the master package list, retaining the
# proper sort order.
- echo "$alldeps" |
- join -1 2 -2 2 -o 1.1,1.2,1.3,1.4 \
- - "$packlist" |
- sort -mbu -k 2,4 -k 1,1 "$packlist" - >"$packlist+"
+ echo "$alldeps" |
+ join -1 2 -2 2 -o 1.1,1.2,1.3,1.4 \
+ - "$packlist" |
+ sort -mbu -k 2,4 -k 1,1 "$packlist" - >"$packlist+"
# Solve all packages in the master package list and write the resulting
# package index to the newly solved file (`solved+`). The solved file is
# a sorted package index in `<name> <version>` format.
- cut -d ' ' -f 2- "$packlist+" |
- uniq |
- rpg-solve -u "$solved" "$existing" >"$solved+"
+ cut -d ' ' -f 2- "$packlist+" |
+ uniq |
+ rpg-solve "$solved" "$existing" "$release" |
+ sort -u -k 1,1 >"$solved+"
# Use `comm(1)` to select only those lines in the newly solved file that
# were not present on the previous iteration, exclude packages that could
@@ -142,9 +144,9 @@ do
# package/version combos into `rpg-package-register` to fetch and enter
# the package into the database. Using `xargs -P 8` allows as many as eight
# concurrent fetch/register operations to run in parallel.
- comm -13 "$solved" "$solved+" |
- grep -v ' -$' |
- xargs -P 8 -n 2 rpg-package-register >/dev/null
+ comm -13 "$solved" "$solved+" |
+ grep -v ' -$' |
+ xargs -P 8 -n 2 rpg-package-register >/dev/null
# Rebuild the master package list by concatenating the original user-
# specified packages with all dependencies of all packages solved so far.
@@ -152,9 +154,9 @@ do
# the `uniq` in the `rpg-solve` pipeline above relies on this.
{
grep '^@user' "$packlist"
- grep -v ' -$' "$solved+" |
+ grep -v ' -$' "$solved+" |
xargs -P 4 -n 2 rpg-dependencies -p
- } |sort -b -k 2,4 >"$packlist+"
+ } |sort -b -k 2,4 >"$packlist+"
# Check whether the package list has changed at all. If so, new rules were
# added to the package list by dependencies. If not, we're done and can
View
2  rpg-resolve.sh
@@ -40,7 +40,7 @@ fi
versions=$(
rpg-package-list "$package" "$@" |
- rpg-solve-fast "$index" |
+ rpg-solve "$index" |
head -$max
) || true
View
0  rpg-solve-fast.c → rpg-solve.c
File renamed without changes
View
28 rpg-solve.sh
@@ -1,28 +0,0 @@
-#!/bin/sh
-set -e
-. rpg-sh-setup
-
-ARGV="$@"
-USAGE '${PROGNAME} [-u] [<index>]...
-Reads a package list on standard input and resolves to a list of concrete
-versions using the <index>(es) specified. Multiple <index> arguments are
-allowed. The main release index is used by default.
-
-Options
- -u Write only the best match for each package instead
- of all matching versions.'
-
-filter=cat
-[ "$1" = '-u' ] && {
- shift
- filter='sort -u -k 1,1'
-}
-
-# Add the main release index at the end of the list of indexes to resolve
-# against. We always fall back to release index currently. It might be nice
-# to provide an option that disables this.
-set -- "$@" "$RPGINDEX/release"
-
-rpg-solve-fast "$@" | $filter
-
-:
Please sign in to comment.
Something went wrong with that request. Please try again.