Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also support file:/// url types #228

Merged
merged 4 commits into from
Apr 5, 2024
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
2 changes: 1 addition & 1 deletion apt_offline_core/AptOfflineCoreLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ def buildChangelog(self, pkgPath, installedVersion):
try:
(ItemURL, ItemFile, ItemSize, ItemChecksum) = stripper(item)

if not ItemURL.startswith(('http', 'https', 'ftp')):
if not ItemURL.startswith(('http', 'https', 'ftp', 'file')):
log.err("This is a broken url: %s\n" % (ItemURL))
continue
elif ItemURL.endswith("InRelease"):
Expand Down
111 changes: 48 additions & 63 deletions tests/apt-offline-tests-github.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

DISLIKED_PACKAGES="lxde icewm gnome-terminal"
DISLIKED_PACKAGES="gcc golang gnome-terminal"
DISLIKED_SRC_PACKAGES="glibc gcc golang gnome-terminal"
RELEASE=`lsb_release -c -s`
DIR="$(mktemp --tmpdir --directory apt-offline-tests-XXXXXXXX)"
#cleanup () { rm --recursive --force "$DIR"; }
Expand All @@ -12,6 +13,12 @@ BUNDLE_FILE="$DIR/bundle-file.zip"
THREADS=5
APT_OFFLINE="./apt-offline "

run()
{
echo "Executing command: $1"
$1
}

set_features () {
if [ ! -z $1 ]; then
URI=$1
Expand All @@ -20,73 +27,59 @@ set_features () {
# Needs root
APT_OFFLINE="sudo $APT_OFFLINE"

echo "Executing command 'set $URI --simulate '"
$APT_OFFLINE set $URI --simulate --update --upgrade
run "sudo apt update"

echo "Executing command 'set $URI --update'"
$APT_OFFLINE set $URI --update
run "$APT_OFFLINE set $URI --simulate --update --upgrade"

echo "Executing command 'set $URI --upgrade'"
$APT_OFFLINE set $URI --upgrade
run "$APT_OFFLINE set $URI --update"

echo "Executing command 'set $URI --update --upgrade'"
$APT_OFFLINE set $URI --update --upgrade
run "$APT_OFFLINE set $URI --upgrade"

echo "Executing command 'set $URI --update --upgrade --upgrade-type upgrade'"
$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade
run "$APT_OFFLINE set $URI --update --upgrade"

echo "Executing command 'set $URI --update --upgrade --upgrade-type upgrade --release $RELEASE'"
$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade --release $RELEASE
run "$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade"

echo "Executing command 'set $URI --install-packages $DISLIKED_PACKAGES'"
$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES
run "$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade --release $RELEASE"

echo "Executing command 'set $URI --install-packages $DISLIKED_PACKAGES --release $RELEASE'"
$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES --release $RELEASE
run "$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES"

echo "Executing command 'set $URI --install-src-packages $DISLIKED_PACKAGES'"
$APT_OFFLINE set $URI --install-src-packages $DISLIKED_PACKAGES
run "$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES --release $RELEASE"

echo "Executing command 'set $URI --install-src-packages $DISLIKED_PACKAGES --release $RELEASE'"
$APT_OFFLINE set $URI --install-src-packages $DISLIKED_PACKAGES --release $RELEASE
run "$APT_OFFLINE set $URI --install-src-packages $DISLIKED_SRC_PACKAGES"

echo "Executing command 'set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES'"
$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES
run "$APT_OFFLINE set $URI --install-src-packages $DISLIKED_SRC_PACKAGES --release $RELEASE"

echo "Executing command 'set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES --release $RELEASE'"
$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES --release $RELEASE
run "$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_SRC_PACKAGES"

run "$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_SRC_PACKAGES --release $RELEASE"

}

get_features () {
if [ ! -z $1 ]; then
URI=$1
fi
echo "Executing command 'get $URI '"
$APT_OFFLINE get $URI --quiet --bundle $BUNDLE_FILE

run "sudo apt update"

run "$APT_OFFLINE get $URI --quiet --bundle $BUNDLE_FILE"
rm -f $BUNDLE_FILE

echo "Executing command 'get $URI --threads $THREADS'"
$APT_OFFLINE get $URI --quiet --threads $THREADS --bundle $BUNDLE_FILE
run "$APT_OFFLINE get $URI --quiet --threads $THREADS --bundle $BUNDLE_FILE"
rm -f $BUNDLE_FILE

echo "Executing command 'get $URI --threads $THREADS --socket-timeout 30'"
$APT_OFFLINE get $URI --quiet --threads $THREADS --socket-timeout 30 --bundle $BUNDLE_FILE --bug-reports
run "$APT_OFFLINE get $URI --quiet --threads $THREADS --socket-timeout 30 --bundle $BUNDLE_FILE --bug-reports"

echo "Executing command 'get $URI --threads $THREADS -d $DOWNLOAD_DIR'"
$APT_OFFLINE get $URI --quiet --threads $THREADS -d $DOWNLOAD_DIR
run "$APT_OFFLINE get $URI --quiet --threads $THREADS -d $DOWNLOAD_DIR"
rm -rf $DOWNLOAD_DIR

echo "Executing command 'get $URI --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
$APT_OFFLINE get $URI --quiet --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR
run "$APT_OFFLINE get $URI --quiet --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR"
rm -rf $DOWNLOAD_DIR

echo "Executing command 'get $URI --no-checksum -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
$APT_OFFLINE get $URI --quiet --no-checksum -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR
run "$APT_OFFLINE get $URI --quiet --no-checksum -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR"
rm -rf $DOWNLOAD_DIR

echo "Executing command 'get $URI --bug-reports --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
$APT_OFFLINE get $URI --quiet --threads $THREADS --bug-reports -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR
run "$APT_OFFLINE get $URI --quiet --threads $THREADS --bug-reports -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR"

}

Expand All @@ -99,17 +92,15 @@ install_features () {
# Needs root
APT_OFFLINE="sudo $APT_OFFLINE"

echo "Executing command 'install $DOWNLOAD_DIR --skip-bug-reports'"
$APT_OFFLINE install $DOWNLOAD_DIR --skip-bug-reports
run "sudo apt update"

run "$APT_OFFLINE install $DOWNLOAD_DIR --skip-bug-reports"

echo "Executing command 'install $DOWNLOAD_DIR --skip-bug-reports --allow-unauthenticated'"
$APT_OFFLINE install $DOWNLOAD_DIR --skip-bug-reports --allow-unauthenticated
run "$APT_OFFLINE install $DOWNLOAD_DIR --skip-bug-reports --allow-unauthenticated"

echo "Executing command 'install $BUNDLE_FILE --skip-bug-reports'"
$APT_OFFLINE install $BUNDLE_FILE --skip-bug-reports
run "$APT_OFFLINE install $BUNDLE_FILE --skip-bug-reports"

echo "Executing command 'install $BUNDLE_FILE --skip-bug-reports --allow-unauthenticated'"
$APT_OFFLINE install $BUNDLE_FILE --skip-bug-reports --allow-unauthenticated
run "$APT_OFFLINE install $BUNDLE_FILE --skip-bug-reports --allow-unauthenticated"
}

install_features_prompt () {
Expand All @@ -121,29 +112,23 @@ install_features_prompt () {
# Needs root
APT_OFFLINE="sudo $APT_OFFLINE"

echo "Executing command 'install $DOWNLOAD_DIR '"
$APT_OFFLINE install $DOWNLOAD_DIR
run "sudo apt update"

run "$APT_OFFLINE install $DOWNLOAD_DIR"

echo "Executing command 'install $DOWNLOAD_DIR --simulate'"
$APT_OFFLINE install $DOWNLOAD_DIR --simulate
run "$APT_OFFLINE install $DOWNLOAD_DIR --simulate"

echo "Executing command 'install $DOWNLOAD_DIR'"
$APT_OFFLINE install $DOWNLOAD_DIR --simulate
run "$APT_OFFLINE install $DOWNLOAD_DIR --simulate"

echo "Executing command 'install $DOWNLOAD_DIR --allow-unauthenticated'"
$APT_OFFLINE install $DOWNLOAD_DIR --simulate --allow-unauthenticated
run "$APT_OFFLINE install $DOWNLOAD_DIR --simulate --allow-unauthenticated"

echo "Executing command 'install $BUNDLE_FILE '"
$APT_OFFLINE install $BUNDLE_FILE
run "$APT_OFFLINE install $BUNDLE_FILE"

echo "Executing command 'install $BUNDLE_FILE --simulate'"
$APT_OFFLINE install $BUNDLE_FILE --simulate
run "$APT_OFFLINE install $BUNDLE_FILE --simulate"

echo "Executing command 'install $BUNDLE_FILE'"
$APT_OFFLINE install $BUNDLE_FILE --simulate
run "$APT_OFFLINE install $BUNDLE_FILE --simulate"

echo "Executing command 'install $BUNDLE_FILE --allow-unauthenticated'"
$APT_OFFLINE install $BUNDLE_FILE --simulate --allow-unauthenticated
run "$APT_OFFLINE install $BUNDLE_FILE --simulate --allow-unauthenticated"
}

all_features () {
Expand Down
121 changes: 47 additions & 74 deletions tests/apt-offline-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,65 @@ BUNDLE_FILE="$DIR/bundle-file.zip"
THREADS=5
APT_OFFLINE="./apt-offline "

run()
{
echo "Executing command: $1"
$1
}

set_features () {
if [ ! -z $1 ]; then
URI=$1
fi
echo "Executing command 'set $URI'"
$APT_OFFLINE set $URI

echo "Executing command 'set $URI --simulate '"
$APT_OFFLINE set $URI --simulate
run "$APT_OFFLINE set $URI"

run "$APT_OFFLINE set $URI --simulate"

echo "Executing command 'set $URI --update'"
$APT_OFFLINE set $URI --update
run "$APT_OFFLINE set $URI --update"

echo "Executing command 'set $URI --upgrade'"
$APT_OFFLINE set $URI --upgrade
run "$APT_OFFLINE set $URI --upgrade"

echo "Executing command 'set $URI --update --upgrade'"
$APT_OFFLINE set $URI --update --upgrade
run "$APT_OFFLINE set $URI --update --upgrade"

echo "Executing command 'set $URI --update --upgrade --upgrade-type upgrade'"
$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade
run "$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade"

echo "Executing command 'set $URI --update --upgrade --upgrade-type upgrade --release $RELEASE'"
$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade --release $RELEASE
run "$APT_OFFLINE set $URI --update --upgrade --upgrade-type upgrade --release $RELEASE"

echo "Executing command 'set $URI --install-packages $DISLIKED_PACKAGES'"
$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES
run "$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES"

echo "Executing command 'set $URI --install-packages $DISLIKED_PACKAGES --release $RELEASE'"
$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES --release $RELEASE
run "$APT_OFFLINE set $URI --install-packages $DISLIKED_PACKAGES --release $RELEASE"

echo "Executing command 'set $URI --install-src-packages $DISLIKED_PACKAGES'"
$APT_OFFLINE set $URI --install-src-packages $DISLIKED_PACKAGES
run "$APT_OFFLINE set $URI --install-src-packages $DISLIKED_PACKAGES"

echo "Executing command 'set $URI --install-src-packages $DISLIKED_PACKAGES --release $RELEASE'"
$APT_OFFLINE set $URI --install-src-packages $DISLIKED_PACKAGES --release $RELEASE
run "$APT_OFFLINE set $URI --install-src-packages $DISLIKED_PACKAGES --release $RELEASE"

echo "Executing command 'set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES'"
$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES
run "$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES"

echo "Executing command 'set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES --release $RELEASE'"
$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES --release $RELEASE
run "$APT_OFFLINE set $URI --src-build-dep --install-src-packages $DISLIKED_PACKAGES --release $RELEASE"

}

get_features () {
if [ ! -z $1 ]; then
URI=$1
fi
echo "Executing command 'get $URI '"
$APT_OFFLINE get $URI

echo "Executing command 'get $URI --threads $THREADS'"
$APT_OFFLINE get $URI --threads $THREADS
run "$APT_OFFLINE get $URI"

echo "Executing command 'get $URI --threads $THREADS --socket-timeout 30'"
$APT_OFFLINE get $URI --threads $THREADS --socket-timeout 30
run "$APT_OFFLINE get $URI --threads $THREADS"

echo "Executing command 'get $URI --threads $THREADS -d $DOWNLOAD_DIR'"
$APT_OFFLINE get $URI --threads $THREADS -d $DOWNLOAD_DIR
run "$APT_OFFLINE get $URI --threads $THREADS --socket-timeout 30"

echo "Executing command 'get $URI --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
$APT_OFFLINE get $URI --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR
run "$APT_OFFLINE get $URI --threads $THREADS -d $DOWNLOAD_DIR"

echo "Executing command 'get $URI --no-checksum -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
$APT_OFFLINE get $URI --no-checksum -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR
run "$APT_OFFLINE get $URI --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR"

echo "Executing command 'get $URI --bug-reports --threads $THREADS -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
$APT_OFFLINE get $URI --threads $THREADS --bug-reports -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR
run "$APT_OFFLINE get $URI --no-checksum -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR"

echo "Executing command 'get $URI --bug-reports --threads $THREADS --bundle $BUNDLE_FILE -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR'"
$APT_OFFLINE get $URI --threads $THREADS --bug-reports -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR --bundle $BUNDLE_FILE
run "$APT_OFFLINE get $URI --threads $THREADS --bug-reports -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR"

run "$APT_OFFLINE get $URI --threads $THREADS --bug-reports -d $DOWNLOAD_DIR --cache-dir $CACHE_DIR --bundle $BUNDLE_FILE"

}

Expand All @@ -92,59 +79,45 @@ install_features () {
DOWNLOAD_DIR=$1
BUNDLE_FILE=$1
fi
echo "Executing command 'install $DOWNLOAD_DIR --skip-bug-reports'"
$APT_OFFLINE install $DOWNLOAD_DIR --skip-bug-reports

echo "Executing command 'install $DOWNLOAD_DIR --simulate --skip-bug-reports'"
$APT_OFFLINE install $DOWNLOAD_DIR --simulate --skip-bug-reports
run "$APT_OFFLINE install $DOWNLOAD_DIR --skip-bug-reports"

run "$APT_OFFLINE install $DOWNLOAD_DIR --simulate --skip-bug-reports"

echo "Executing command 'install $DOWNLOAD_DIR --skip-bug-reports'"
$APT_OFFLINE install $DOWNLOAD_DIR --simulate --skip-bug-reports
run "$APT_OFFLINE install $DOWNLOAD_DIR --simulate --skip-bug-reports"

echo "Executing command 'install $DOWNLOAD_DIR --skip-bug-reports --allow-unauthenticated'"
$APT_OFFLINE install $DOWNLOAD_DIR --simulate --skip-bug-reports --allow-unauthenticated
run "$APT_OFFLINE install $DOWNLOAD_DIR --simulate --skip-bug-reports --allow-unauthenticated"

echo "Executing command 'install $BUNDLE_FILE --skip-bug-reports'"
$APT_OFFLINE install $BUNDLE_FILE --skip-bug-reports
run "$APT_OFFLINE install $BUNDLE_FILE --skip-bug-reports"

echo "Executing command 'install $BUNDLE_FILE --simulate --skip-bug-reports'"
$APT_OFFLINE install $BUNDLE_FILE --simulate --skip-bug-reports
run "$APT_OFFLINE install $BUNDLE_FILE --simulate --skip-bug-reports"

echo "Executing command 'install $BUNDLE_FILE --skip-bug-reports'"
$APT_OFFLINE install $BUNDLE_FILE --simulate --skip-bug-reports
run "$APT_OFFLINE install $BUNDLE_FILE --simulate --skip-bug-reports"

echo "Executing command 'install $BUNDLE_FILE --skip-bug-reports --allow-unauthenticated'"
$APT_OFFLINE install $BUNDLE_FILE --simulate --skip-bug-reports --allow-unauthenticated
run "$APT_OFFLINE install $BUNDLE_FILE --simulate --skip-bug-reports --allow-unauthenticated"
}

install_features_prompt () {
if [ ! -z $1 ]; then
DOWNLOAD_DIR=$1
BUNDLE_FILE=$1
fi
echo "Executing command 'install $DOWNLOAD_DIR '"
$APT_OFFLINE install $DOWNLOAD_DIR

echo "Executing command 'install $DOWNLOAD_DIR --simulate'"
$APT_OFFLINE install $DOWNLOAD_DIR --simulate
run "$APT_OFFLINE install $DOWNLOAD_DIR"

run "$APT_OFFLINE install $DOWNLOAD_DIR --simulate"

echo "Executing command 'install $DOWNLOAD_DIR'"
$APT_OFFLINE install $DOWNLOAD_DIR --simulate
run "$APT_OFFLINE install $DOWNLOAD_DIR --simulate"

echo "Executing command 'install $DOWNLOAD_DIR --allow-unauthenticated'"
$APT_OFFLINE install $DOWNLOAD_DIR --simulate --allow-unauthenticated
run "$APT_OFFLINE install $DOWNLOAD_DIR --simulate --allow-unauthenticated"

echo "Executing command 'install $BUNDLE_FILE '"
$APT_OFFLINE install $BUNDLE_FILE
run "$APT_OFFLINE install $BUNDLE_FILE"

echo "Executing command 'install $BUNDLE_FILE --simulate'"
$APT_OFFLINE install $BUNDLE_FILE --simulate
run "$APT_OFFLINE install $BUNDLE_FILE --simulate"

echo "Executing command 'install $BUNDLE_FILE'"
$APT_OFFLINE install $BUNDLE_FILE --simulate
run "$APT_OFFLINE install $BUNDLE_FILE --simulate"

echo "Executing command 'install $BUNDLE_FILE --allow-unauthenticated'"
$APT_OFFLINE install $BUNDLE_FILE --simulate --allow-unauthenticated
run "$APT_OFFLINE install $BUNDLE_FILE --simulate --allow-unauthenticated"
}

all_features () {
Expand Down
Loading