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

Make curl honor the ~/.netrc file #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions add-molior-repo
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ add_molior_project()
PROJECT="$1"
VERSION="$2"

APT_SOURCES="$(curl -s --retry 10 $MOLIOR_URL/api/projectsources/$PROJECT/$VERSION)"
APT_SOURCES="$(curl -n -s --retry 10 $MOLIOR_URL/api/projectsources/$PROJECT/$VERSION)"
if [ -z "$APT_SOURCES" ]
then
echo "Error downloading apt sources from '$MOLIOR_URL'"
Expand All @@ -48,7 +48,7 @@ add_molior_project()
# add the repository key
# get the apt url from the molior api
APT_URL=$(echo $MIRROR | cut -d' ' -f 2 | cut -d/ -f 1-3)
curl -s --retry 10 $APT_URL/$PUBKEY_FILE | apt-key add - > /dev/null
curl -n -s --retry 10 $APT_URL/$PUBKEY_FILE | apt-key add - > /dev/null

# remove the mirror from the apt sources
APT_SOURCES=$(echo "${APT_SOURCES}" | tail -n +2)
Expand Down
2 changes: 1 addition & 1 deletion molior-archive-sources
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ COOKIE_FILE=`mktemp`
molior_session_call()
{
URL_PATH="$1" && shift
curl $MOLIOR_URL$URL_PATH -s --retry 10 \
curl $MOLIOR_URL$URL_PATH -n -s --retry 10 \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should add the -n here, because a few lines further down we explicitly pass the $MOLIOR_USERNAME and $MOLIOR_PASSWORD to curl (matching .netrc credentials will likely override these)

--cookie "$COOKIE_FILE" \
--cookie-jar "$COOKIE_FILE" $@
}
Expand Down
2 changes: 1 addition & 1 deletion molior-build-upload
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ cat ~/.molior-token >> $tmptoken
umask $old_umask
errmsg=`mktemp`

httpret=`echo $args | xargs curl -w "%{http_code}" -o $errmsg -H @$tmptoken $MOLIOR_SERVER/api2/project/$PROJECT/$VERSION/extbuild 2>/dev/null`
httpret=`echo $args | xargs curl -n -w "%{http_code}" -o $errmsg -H @$tmptoken $MOLIOR_SERVER/api2/project/$PROJECT/$VERSION/extbuild 2>/dev/null`
ret=$?
rm -f $tmptoken
if [ $ret -eq 0 -a $httpret != "201" ]; then
Expand Down
14 changes: 7 additions & 7 deletions molior-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,10 @@ setup_deployment()
fi
log_info "Getting deployment information ..."
SOURCESURL=$MOLIOR_SERVER/api2/project/$PROJECT/$VERSION/aptsources
APT_SOURCES_ORIG=`curl -f -s --retry 10 $SOURCESURL$param`
APT_SOURCES_ORIG=`curl -n -f -s --retry 10 $SOURCESURL$param`
if [ -z "$APT_SOURCES_ORIG" ]; then
SOURCESURL=$MOLIOR_SERVER/api/projectsources/$PROJECT/$VERSION
APT_SOURCES_ORIG=`curl -f -s --retry 10 $SOURCESURL`
APT_SOURCES_ORIG=`curl -n -f -s --retry 10 $SOURCESURL`
if [ -z "$APT_SOURCES_ORIG" ]; then
log_error "Error downloading $SOURCESURL"
fi
Expand Down Expand Up @@ -696,7 +696,7 @@ setup_deployment()
do
SOURCES_VERSION=`basename $baseurl`
log "trying to download package source from $SOURCES_VERSION"
curl -f -s --retry 10 -o $WORK_DIR/Sources $SOURCEMIRROR/repos/$PROJECT/$SOURCES_VERSION/dists/$dist/main/source/Sources
curl -n -f -s --retry 10 -o $WORK_DIR/Sources $SOURCEMIRROR/repos/$PROJECT/$SOURCES_VERSION/dists/$dist/main/source/Sources
if [ `wc -l $WORK_DIR/Sources 2>/dev/null | cut -d' ' -f1` -eq 0 ]; then
# try next baseurl
continue
Expand All @@ -718,7 +718,7 @@ setup_deployment()
fi
log "using package source: $SOURCES_VERSION"
else
curl -f -s --retry 10 -o $WORK_DIR/Sources $SOURCEMIRROR/repos/$PROJECT/$SOURCES_VERSION/dists/$dist/main/source/Sources
curl -n -f -s --retry 10 -o $WORK_DIR/Sources $SOURCEMIRROR/repos/$PROJECT/$SOURCES_VERSION/dists/$dist/main/source/Sources
# FIXME: check if exists...
if [ `wc -l $WORK_DIR/Sources 2>/dev/null | cut -d' ' -f1` -eq 0 ]; then
log_error "Could not download $SOURCEMIRROR/repos/$PROJECT/$SOURCES_VERSION/dists/$dist/main/source/Sources"
Expand All @@ -735,7 +735,7 @@ setup_deployment()

log "downloading source: $SOURCEMIRROR/repos/$PROJECT/$SOURCES_VERSION/$FILENAME"
cd $WORK_DIR
curl -f -s --retry 10 -O -J $SOURCEMIRROR/repos/$PROJECT/$SOURCES_VERSION/$FILENAME
curl -n -f -s --retry 10 -O -J $SOURCEMIRROR/repos/$PROJECT/$SOURCES_VERSION/$FILENAME
exit_on_error "Error downloading $SOURCEMIRROR/repos/$PROJECT/$SOURCES_VERSION/$FILENAME"

if [ $src_pkg_only -eq 1 ]; then
Expand Down Expand Up @@ -908,13 +908,13 @@ bootstrap_deployment()
postfix=""
fi
i=$((i + 1))
curl -f -s --retry 10 -o $WORK_DIR/repo.asc$postfix $url
curl -n -f -s --retry 10 -o $WORK_DIR/repo.asc$postfix $url
exit_on_error "Error downloading $url"
done
gpg -q --import --no-default-keyring --keyring=trustedkeys.gpg $WORK_DIR/repo.asc

log "downloading debootstrap for $SUITE $BASEMIRROR/$BASEVERSION $ARCH"
curl -f -s --retry 10 -o $WORK_DIR/root.tar.xz $MOLIOR_SERVER/debootstrap/${BASEMIRROR}_${BASEVERSION}_$ARCH.tar.xz
curl -n -f -s --retry 10 -o $WORK_DIR/root.tar.xz $MOLIOR_SERVER/debootstrap/${BASEMIRROR}_${BASEVERSION}_$ARCH.tar.xz
if [ $? -eq 0 ]; then
log "extracting debootstrap"
mkdir -p $target
Expand Down
2 changes: 1 addition & 1 deletion molior-project-manager
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ COOKIE_FILE="$(mktemp)"
molior_session_call()
{
URL_PATH="$1" && shift
curl $MOLIOR_URL$URL_PATH -s --retry 10 \
curl $MOLIOR_URL$URL_PATH -n -s --retry 10 \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should add the -n here, because a few lines further down we explicitly pass the $MOLIOR_USERNAME and $MOLIOR_PASSWORD to curl (matching .netrc credentials will likely override these)

--cookie "$COOKIE_FILE" \
--cookie-jar "$COOKIE_FILE" $@
}
Expand Down
4 changes: 2 additions & 2 deletions molior-sbuild
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ PLATFORM=$(platform $ARCH)
HOST_PLATFORM=$(platform $HOSTARCH)

SOURCESURL=$MOLIOR_SERVER/api/projectsources/$PROJECT/$VERSION
APT_SOURCES=`curl -s --retry 10 $SOURCESURL | grep -v '^#' | grep -v '^$'`
APT_SOURCES=`curl -n -s --retry 10 $SOURCESURL | grep -v '^#' | grep -v '^$'`
if [ $? -ne 0 ]; then
log_error "Error downloading $SOURCESURL"
fi
Expand All @@ -161,7 +161,7 @@ if ! schroot -i -c $SUITE-$ARCH-$VERSION >/dev/null 2>&1; then
log_notice "Downloading schroot build environment"

sudo mkdir -p /var/lib/schroot/chroots
sudo curl -s --retry 10 -o $SCHROOT $MOLIOR_SERVER/schroots/$SUITE-$VERSION-$ARCH.tar.xz
sudo curl -n -s --retry 10 -o $SCHROOT $MOLIOR_SERVER/schroots/$SUITE-$VERSION-$ARCH.tar.xz
if [ $? -ne 0 ]; then
log_error "Error downloading $MOLIOR_SERVER/schroots/$SUITE-$VERSION-$ARCH.tar.xz"
fi
Expand Down
4 changes: 2 additions & 2 deletions molior-trigger
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ COOKIE_FILE=`mktemp`

molior_session_call()
{
curl -s --retry 10 --cookie "$COOKIE_FILE" --cookie-jar "$COOKIE_FILE" "$@"
curl -n -s --retry 10 --cookie "$COOKIE_FILE" --cookie-jar "$COOKIE_FILE" "$@"
}

# login to the molior session
Expand All @@ -55,5 +55,5 @@ fi
echo "Build triggered: $ID"
echo
echo "Query build state with: "
echo "curl -s --retry 10 $MOLIOR_URL/api/build/$ID | json_pp"
echo "curl -n -s --retry 10 $MOLIOR_URL/api/build/$ID | json_pp"
echo
6 changes: 3 additions & 3 deletions plugins/upgrade.plugin
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ init_deployment_upgrade()
fi
log_info "Getting deployment information ..."
SOURCESURL=$MOLIOR_SERVER/api2/project/$PROJECT/$VERSION/aptsources
APT_SOURCES_ORIG=`curl -f -s --retry 10 $SOURCESURL$param`
APT_SOURCES_ORIG=`curl -n -f -s --retry 10 $SOURCESURL$param`
if [ -z "$APT_SOURCES_ORIG" ]; then
log_error "Error downloading $SOURCESURL"
fi
Expand Down Expand Up @@ -94,7 +94,7 @@ postinst_deployment_upgrade()
fi
log_info "Getting deployment information ..."
SOURCESURL=$MOLIOR_SERVER/api2/project/$PROJECT/$VERSION/aptsources
APT_SOURCES_ORIG=`curl -f -s --retry 10 $SOURCESURL$param`
APT_SOURCES_ORIG=`curl -n -f -s --retry 10 $SOURCESURL$param`
if [ -z "$APT_SOURCES_ORIG" ]; then
log_error "Error downloading $SOURCESURL"
fi
Expand Down Expand Up @@ -123,7 +123,7 @@ postinst_deployment_upgrade()
postfix=""
fi
i=$((i + 1))
curl -s --retry 10 -o $WORK_DIR/repo.asc$postfix $url
curl -n -s --retry 10 -o $WORK_DIR/repo.asc$postfix $url
exit_on_error "Error downloading $url"
done

Expand Down