···
7
+
[--git commit..commit | --git commit]
8
+
[--svn rev:rev | --svn rev]
9
+
[--path path[:path]*]
12
+
This program is used to investigate how any changes inside your nixpkgs
13
+
repository may hurt. With these kind of information you may choose wisely
14
+
where you should commit your changes.
16
+
This program adapts it-self to your versionning system to avoid too much
17
+
effort on your Internet bandwidth. If you need to check more than one
18
+
commits / revisions, you may use the following commands:
20
+
--git remotes/trunk..master
23
+
Check the differences between each commit separating the first and the
26
+
--path /etc/nixos/nixpkgs:/tmp/nixpkgs_1:/tmp/nixpkgs_2
28
+
Check the differences between multiple directories containing different
29
+
versions of nixpkgs.
31
+
All these options exist with one commit / revision argument. Such options
32
+
are used to compare your \$NIXPKGS path with the specified version.
34
+
If you omit to mention any other commit / revision, then your \$NIXPKGS path
35
+
is compared with its last update. This command is useful to test code from
43
+
#####################
44
+
# Process Arguments #
45
+
#####################
47
+
: ${NIXPKGS=/etc/nixos/nixpkgs/}
57
+
if test -z "$argfun"; then
59
+
--git) vcs="git"; argfun="set_gitCommits";;
60
+
--svn) vcs="svn"; argfun="set_svnRevisions";;
61
+
--path) vcs="path"; argfun="set_pathLocations";;
62
+
--verbose) verbose=true;;
69
+
var=$(echo $argfun | sed 's,^set_,,')
83
+
############################
84
+
# Find the repository type #
85
+
############################
87
+
if test -z "$vcs"; then
88
+
if test -x "$NIXPKGS/.git"; then
89
+
if git --git-dir="$NIXPKGS/.git" branch > /dev/null 2>&1; then
91
+
gitCommits=$(git --git-dir="$NIXPKGS/.git" log -n 1 --pretty=format:%H 2> /dev/null)
93
+
elif test -x "$NIXPKGS/.svn"; then
95
+
if svn info > /dev/null 2>&1; then
97
+
svnRevisions=$(svn info | sed -n 's,Revision: ,,p')
105
+
###############################
106
+
# Define a storage directory. #
107
+
###############################
112
+
test -e "$pkgListDir" && rm -rf "$pkgListDir"
116
+
trap cleanup EXIT SIGINT SIGQUIT ERR
118
+
pkgListDir=$(mktemp --tmpdir -d rebuild-amount-XXXXXXXX)
119
+
vcsDir="$pkgListDir/.vcs"
121
+
###########################
122
+
# Versionning for Dummies #
123
+
###########################
126
+
if test "${pathLocations#*:}" = "$pathLocations"; then
127
+
pathLocations="$NIXPKGS:$pathLocations"
129
+
pathLocations="${pathLocations}:"
133
+
pathLoc="${pathLocations%%:*}"
134
+
pathLocations="${pathLocations#*:}"
142
+
name=$(echo "$pathLoc" | tr '/' '_')
150
+
git clone "$NIXPKGS/.git" "$vcsDir" > /dev/null 2>&1
151
+
if echo "gitCommits" | grep -c "\.\." > /dev/null 2>&1; then
152
+
gitCommits=$(git --git-dir="$vcsDir/.git" log --reverse --pretty=format:%H $gitCommits 2> /dev/null)
154
+
pathLocations="$vcsDir:$NIXPKGS"
161
+
git --git-dir="$vcsDir/.git" checkout $(echo "$gitCommits" | head -n 1) > /dev/null 2>&1
162
+
gitCommits=$(echo "$gitCommits" | sed '1 d')
170
+
name=$(git --git-dir="$vcsDir/.git" log -n 1 --pretty=format:%H 2> /dev/null)
173
+
#######################
174
+
# Subversion Commands #
175
+
#######################
178
+
cp -r "$NIXPKGS" "$vcsDir" > /dev/null 2>&1
179
+
if echo "svnRevisions" | grep -c ":" > /dev/null 2>&1; then
180
+
svnRevisions=$(seq ${svnRevisions%:*} ${svnRevisions#*:})
182
+
pathLocations="$vcsDir:$NIXPKGS"
190
+
svn checkout $(echo "$svnRevisions" | head -n 1) > /dev/null 2>&1
192
+
svnRevisions=$(echo "$svnRevisions" | sed '1 d')
200
+
name=$(svn info 2> /dev/null | sed -n 's,Revision: ,,p')
203
+
####################
204
+
# Logical Commands #
205
+
####################
207
+
init () { ${vcs}_init; }
208
+
getNext () { ${vcs}_getNext; }
209
+
setPath () { ${vcs}_setPath; }
210
+
setName () { ${vcs}_setName; }
213
+
#####################
214
+
# Check for Rebuild #
215
+
#####################
217
+
# Generate the list of all derivations that could be build from a nixpkgs
218
+
# respository. This list of derivation hashes is compared with previous
219
+
# lists and a brief summary is produced on the output.
222
+
nb=$(diff -y --suppress-common-lines --speed-large-files "$pkgListDir/$1.drvs" "$pkgListDir/$2.drvs" 2> /dev/null | wc -l)
223
+
echo "$1 -> $2: $nb"
226
+
echo "Please wait, this may take some minutes ..."
237
+
setPath # set path=...
238
+
setName # set name=...
241
+
test -z "$curr" && break || true
243
+
nix-instantiate "$path" > "$pkgListDir/$curr.drvs" > /dev/null 2>&1 || true
245
+
if test -n "$prev"; then
246
+
compareNames "$prev" "$curr"
248
+
echo "Number of package to rebuild:"
255
+
if test "$first" != "$oldPrev"; then
256
+
echo "Number of package to rebuild (first -> last):"
257
+
compareNames "$first" "$curr"