@@ -22,6 +22,8 @@ Usage: build-packages-for-obs.sh [PACKAGE]..
2222Build package for submission to OBS from the current HEAD. Without argument
2323all packages mentioned in .tito/packages or rel-eng/packages are processed.
2424Package directories will be created in \$ WORKSPACE/SRPMS/<package> ($WORKSPACE ).
25+
26+ To build tar archives instead of CPIO, set "NOCPIO" environment variable.
2527EOF
2628 exit 0
2729}
@@ -149,32 +151,37 @@ while read PKG_NAME PKG_VER PKG_DIR; do
149151 continue 2
150152 fi
151153
152- # Convert to obscpio
153- SPEC_VER=$( sed -n -e ' s/^Version:\s*\(.*\)/\1/p' ${T_DIR} /${PKG_NAME} .spec)
154- SOURCE=$( sed -n -e ' s/^\(Source\|Source0\):\s*.*[[:space:]\/]\(.*\)/\2/p' ${T_DIR} /${PKG_NAME} .spec| sed -e " s/%{name}/${PKG_NAME} /" | sed -e " s/%{version}/${SPEC_VER} /" )
155- SPEC_REL=$( sed -n -e ' s/^Release: \+\([0-9]\).*/\1/p' ${T_DIR} /${PKG_NAME} .spec)
156- # If the package does not have sources, we don't need to repackage them
157- if [ " ${SOURCE} " != " " ]; then
158- FOLDER=$( tar -tf ${T_DIR} /${SOURCE} | head -1| sed -e ' s/\///' )
159- (cd ${T_DIR} ; tar -xf ${SOURCE} ; rm ${SOURCE} ; mv ${FOLDER} ${PKG_NAME} ; find ${PKG_NAME} | cpio --create --format=newc --reproducible > ${FOLDER} .obscpio; rm -rf ${PKG_NAME} )
160- fi
161- # Move to destination
162- mv " $T_DIR " " $SRPM_DIR /$PKG_NAME "
163- # If the package does not have sources, we don't need service or .obsinfo file
164- if [ " ${SOURCE} " != " " ]; then
165- # Copy service
166- if [ -e " ${BASE_DIR} /../_service" ]; then
167- cp ${BASE_DIR} /../_service " ${SRPM_DIR} /${PKG_NAME} "
168- else
169- cp ${SHARE_DIR} /_service " ${SRPM_DIR} /${PKG_NAME} "
154+ if [ -n " $NOCPIO " ]; then
155+ # Move to destination
156+ mv " $T_DIR " " $SRPM_DIR /$PKG_NAME "
157+ else
158+ # Convert to obscpio
159+ SPEC_VER=$( sed -n -e ' s/^Version:\s*\(.*\)/\1/p' ${T_DIR} /${PKG_NAME} .spec)
160+ SOURCE=$( sed -n -e ' s/^\(Source\|Source0\):\s*.*[[:space:]\/]\(.*\)/\2/p' ${T_DIR} /${PKG_NAME} .spec| sed -e " s/%{name}/${PKG_NAME} /" | sed -e " s/%{version}/${SPEC_VER} /" )
161+ SPEC_REL=$( sed -n -e ' s/^Release: \+\([0-9]\).*/\1/p' ${T_DIR} /${PKG_NAME} .spec)
162+ # If the package does not have sources, we don't need to repackage them
163+ if [ " ${SOURCE} " != " " ]; then
164+ FOLDER=$( tar -tf ${T_DIR} /${SOURCE} | head -1| sed -e ' s/\///' )
165+ (cd ${T_DIR} ; tar -xf ${SOURCE} ; rm ${SOURCE} ; mv ${FOLDER} ${PKG_NAME} ; find ${PKG_NAME} | cpio --create --format=newc --reproducible > ${FOLDER} .obscpio; rm -rf ${PKG_NAME} )
170166 fi
171- # Create .obsinfo file
172- cat > " ${SRPM_DIR} /${PKG_NAME} /${PKG_NAME} .obsinfo" << EOF
167+ # Move to destination
168+ mv " $T_DIR " " $SRPM_DIR /$PKG_NAME "
169+ # If the package does not have sources, we don't need service or .obsinfo file
170+ if [ " ${SOURCE} " != " " ]; then
171+ # Copy service
172+ if [ -e " ${BASE_DIR} /../_service" ]; then
173+ cp ${BASE_DIR} /../_service " ${SRPM_DIR} /${PKG_NAME} "
174+ else
175+ cp ${SHARE_DIR} /_service " ${SRPM_DIR} /${PKG_NAME} "
176+ fi
177+ # Create .obsinfo file
178+ cat > " ${SRPM_DIR} /${PKG_NAME} /${PKG_NAME} .obsinfo" << EOF
173179name: ${PKG_NAME}
174180version: $( echo ${FOLDER} | sed -e " s/${PKG_NAME} -//" )
175181mtime: $( date +%s)
176182commit: $( git rev-parse --verify HEAD)
177183EOF
184+ fi
178185 fi
179186 # Release is handled by the Buildservice
180187 # With untagged changes we can only build using --test with tito build.
0 commit comments