Commit 41dd1e79 authored by Ophélie Gagnard's avatar Ophélie Gagnard

[WORKS in OBS] Work with OBS.

- Remove the top-level Makefile of the archive.
- Rename directories.
- Send directly tarballs/$SOFTWARE.
- Build from tarballs/$SOFTWARE/Makefile.
- Rename variables for clarity.
- Add obs.sh and clean_obs.sh.
parent 0d52ffcd
all: build_tree template_stage bootstrap_buildout
clean: clean_build_tree clean_template_stage clean_bootstrap_buildout
all: build_tree template_stage bootstrap_buildout obs
clean: clean_build_tree clean_template_stage clean_bootstrap_buildout clean_obs
build_tree:
./build_tree.sh
......@@ -17,4 +17,9 @@ bootstrap_buildout:
clean_bootstrap_buildout:
./clean_bootstrap_buildout.sh
.PHONY: all clean build_tree clean_build_tree template_stage clean_template_stage bootstrap_buildout clean_bootstrap_buildout
obs:
./obs.sh
clean_obs:
./clean_obs.sh
.PHONY: all clean build_tree clean_build_tree template_stage clean_template_stage bootstrap_buildout clean_bootstrap_buildout obs clean_obs
......@@ -5,12 +5,12 @@ source configuration_information.sh
cd $INITIAL_DIR
# Download the bootstrap script
cd $PARTS_DIR
cd $RUN_BUILDOUT_DIR
wget https://bootstrap.pypa.io/bootstrap-buildout.py
cd $INITIAL_DIR
# Create a build/bin/buildout (bootstraping) and run it (actual compilation).
# Note: it creates a lot of things in build/eggs/ and uses software_release/ at some point
cd $PARTS_DIR
cd $RUN_BUILDOUT_DIR
cp $TEMPLATE_DIR/tmp/buildout_with_gcc.cfg buildout.cfg
(python2.7 -S bootstrap-buildout.py --buildout-version 2.7.1+slapos016 --setuptools-version 44.1.1 --setuptools-to-dir eggs -f http://www.nexedi.org/static/packages/source/slapos.buildout/ && ./bin/buildout -v)
......@@ -4,9 +4,9 @@ set -e
source configuration_information.sh
cd $INITIAL_DIR
mkdir -p tarball/$SOFTWARE/
mkdir -p tarballs/$SOFTWARE/
# Re-downloading the software release to pack
cd tarball/$SOFTWARE/
cd tarballs/$SOFTWARE/
git clone https://lab.nexedi.com/Francois/slapos
mv slapos software_release
cd software_release
......@@ -14,4 +14,4 @@ git checkout fluent-bit
cd $INITIAL_DIR
# Peparing the build directories
mkdir -p $PARTS_DIR/{eggs,extends-cache,download-cache/dist}
mkdir -p $RUN_BUILDOUT_DIR/{eggs,extends-cache,download-cache/dist}
......@@ -5,8 +5,8 @@ source configuration_information.sh
cd $INITIAL_DIR
# Remove the bootstrap script and associated files
if [[ -d $PARTS_DIR ]]; then
cd $PARTS_DIR
if [[ -d $RUN_BUILDOUT_DIR ]]; then
cd $RUN_BUILDOUT_DIR
rm -f bootstrap.py # LEGACY
rm -f bootstrap-buildout.py*
rm -f buildout.cfg
......@@ -14,8 +14,8 @@ fi
cd $INITIAL_DIR
# Clean the material created by the bootstrap script
if [[ -d $PARTS_DIR ]]; then
cd $PARTS_DIR
if [[ -d $RUN_BUILDOUT_DIR ]]; then
cd $RUN_BUILDOUT_DIR
rm -rf bin/
rm -rf eggs/
fi
......@@ -3,12 +3,18 @@ set -e
source configuration_information.sh
cd $INITIAL_DIR
rm -rf tarballs/$SOFTWARE/
exit # TODO: separate the tree building from the software release retrieving
cd $INITIAL_DIR
# Clean the software release to pack
cd tarball/$SOFTWARE/
rm -rf slapos slapos_repository # LEGACY
rm -rf software_release
if [[ -d tarballs/$SOFTWARE/ ]]; then
cd tarballs/$SOFTWARE/
rm -rf software_release
else echo tarballs/$SOFTWARE/ does not exist.
cd $INITIAL_DIR
# Clean the build tree
rm -rf $PARTS_DIR/{eggs,extends-cache,download-cache}
rm -rf $RUN_BUILDOUT_DIR/{eggs,extends-cache,download-cache}
#!/bin/bash
set -e
source configuration_information.sh
TMP_DIR=$INITIAL_DIR/tmp/
TMP_DIR=`realpath -m $TMP_DIR`
rm -rf $TMP_DIR
......@@ -15,12 +15,14 @@ SOFTWARE=lunzip
TARGET_DIR=/opt/${SOFTWARE}_software_release
# BUILD INFORMATION
TEMPLATE_DIR=$INITIAL_DIR/template
BUILD_DIR=$INITIAL_DIR/tarball/$SOFTWARE/build/ # former BUILD_ROOT_DIRECTORY
PARTS_DIR=$BUILD_DIR/$TARGET_DIR # former BUILD_DIRECTORY
TEMPLATE_DIR=$INITIAL_DIR/templates
BUILD_DIR=$INITIAL_DIR/tarballs/$SOFTWARE/build/ # former BUILD_ROOT_DIRECTORY
# this is where the parts/ directory will be
RUN_BUILDOUT_DIR=$BUILD_DIR/$TARGET_DIR # former BUILD_DIRECTORY
# OBS INFORMATION
# OBS AND DISTRIBUTIONS INFORMATION
OBS_DIR=$INITIAL_DIR/home:fg.nxd/$SOFTWARE/
DIST_DIR=$INITIAL_DIR/distribution-specifics/$SOFTWARE/
# Path normalization
......@@ -28,14 +30,16 @@ INITIAL_DIR=`realpath -m $INITIAL_DIR`
TARGET_DIR=`realpath -m $TARGET_DIR`
TEMPLATE_DIR=`realpath -m $TEMPLATE_DIR`
BUILD_DIR=`realpath -m $BUILD_DIR`
PARTS_DIR=`realpath -m $PARTS_DIR`
RUN_BUILDOUT_DIR=`realpath -m $RUN_BUILDOUT_DIR`
OBS_DIR=`realpath -m $OBS_DIR`
DIST_DIR=`realpath -m $DIST_DIR`
# Regular expressions for templates
VERSION_REGEX="s/\%RECIPE_VERSION\%/$RECIPE_VERSION/g;s/\%VERSION\%/$VERSION/g;s/\%RELEASE\%/$RELEASE/g"
# Note: %PATCHES_DIRECTORY% not supported yet
# supporting new macros
DIR_REGEX="s|\%TARGET_DIR\%|$TARGET_DIR|g;s|\%BUILD_DIR\%|$BUILD_DIR|g;s|\%PARTS_DIR\%|$PARTS_DIR|g"
DIR_REGEX="s|\%TARGET_DIR\%|$TARGET_DIR|g;s|\%BUILD_DIR\%|$BUILD_DIR|g;s|\%RUN_BUILDOUT_DIR\%|$RUN_BUILDOUT_DIR|g"
# supporting legacy macros
OLD_DIR_REGEX="s|\%TARGET_DIRECTORY\%|$TARGET_DIR|g;s|\%BUILD_ROOT_DIRECTORY\%|$BUILD_DIR|g;s|\%BUILD_DIRECTORY\%|$PARTS_DIR|g"
OLD_DIR_REGEX="s|\%TARGET_DIRECTORY\%|$TARGET_DIR|g;s|\%BUILD_ROOT_DIRECTORY\%|$BUILD_DIR|g;s|\%BUILD_DIRECTORY\%|$RUN_BUILDOUT_DIR|g"
# concatenate all regex using ; (quoted, not to end the command)
ALL_REGEX=$VERSION_REGEX";"$DIR_REGEX";"$OLD_DIR_REGEX
lunzip (1.0-1) UNRELEASED; urgency=medium
* Initial release. (Closes: #XXXXXX)
-- test <test@debian> Tue, 25 Jan 2022 18:27:17 +0100
Source: lunzip
Maintainer: Francois Gagnard <francois.gagnard@nexedi.com>
Section: net
Priority: optional
Build-Depends: debhelper,
chrpath,
python
Homepage: https://slapos.nexedi.com
Package: lunzip
Architecture: any
Depends: ${misc:Depends},
${shlibs:Depends},
ucf,
uml-utilities,
# slapgrid-sr needed by most recipes
libc6-dev | libc-dev,
gcc | c-compiler,
g++ | c++-compiler,
make,
patch,
# slapos node collect
lm-sensors,
# devperm manager plugin wants to use lsblk
util-linux
Conflicts:
Description: lunzip packaging test
/opt/slapos
/srv/slapgrid
/opt/slapgrid
/etc/opt/slapos
/etc/opt/slapos/ssl
/var/opt/slapos
/var/opt/slapos/lib
/var/opt/slapos/log
/var/opt/slapos/run
/usr/bin
/usr/share/
\ No newline at end of file
#!/usr/bin/make -f
#export DH_VERBOSE=1
PACKAGE = $(shell dh_listpackages)
TMP = $(CURDIR)/debian/$(PACKAGE)
%:
dh $@
override_dh_installdebconf:
override_dh_makeshlibs:
dh_makeshlibs -n
override_dh_shlibdeps:
dh_shlibdeps -- -x$(PACKAGE)
rm -f $(TMP)/DEBIAN/shlibs
Format: 3.0 (native)
Source: lunzip
Architecture: any
Version: 1
Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python (>= 2.7), python-dev, libssl-dev
#!/bin/bash
set -e
source configuration_information.sh
TMP_DIR=$INITIAL_DIR/tmp/
TMP_DIR=`realpath -m $TMP_DIR`
echo TMP_DIR = $TMP_DIR
mkdir -p $TMP_DIR
# clean the build directory for OBS
rm -rf $RUN_BUILDOUT_DIR/parts/
# prepare the files for OBS
# -C option allows to give tar an absolute path without archiving the directory from / (i.e. home/user/[...])
tar czf $TMP_DIR/$SOFTWARE.tar.gz -C tarballs/ $SOFTWARE/
tar czf $TMP_DIR/debian.tar.gz -C $DIST_DIR/ debian/
cp $DIST_DIR/*.dsc $TMP_DIR/
# move the files for OBS
cp $TMP_DIR/$SOFTWARE.tar.gz $OBS_DIR
cp $TMP_DIR/debian.tar.gz $OBS_DIR
cp $TMP_DIR/*.dsc $OBS_DIR
cd $OBS_DIR
osc commit
VERSION = 1
RECIPE_VERSION = 1
PY = $(PYTHON)
#INSTALL_DIRECTORY = $(DESTDIR)/opt/test
#TARGET_DIRECTORY = /opt/slapos
TARGET_DIRECTORY = /opt/test
BUILD_DIR := $(shell pwd)/build
RUN_BUILDOUT_DIR := $(BUILD_DIR)$(TARGET_DIRECTORY)
#PATCHES_DIRECTORY := $(shell pwd)/patches
# get the path of the BUILD_DIR of the first build (performed to prepare the cache for OBS)
OLD_BUILD_DIR := $(shell cat cache_creation_build_directory)
#Use to get path of buildout correct
#ORIGINAL_DIRECTORY := $(shell cat ./original_directory)
all: build
build: build-stamp
build-stamp:
@echo "Fixing buildout path to $(BUILD_DIR) rather than $(OLD_BUILD_DIR) for buildout"
################################################################################
# grep -rIl '$(OLD_DIRECTORY)' $(BUILD_DIR) 2> /dev/null | \
# xargs sed -i 's#$(OLD_DIRECTORY)#$(BUILD_DIR)#g' || \
# echo "No path to fix."
################################################################################
cd $(RUN_BUILDOUT_DIR); sed -i 's#$(OLD_BUILD_DIR)#$(BUILD_DIR)#g' buildout.cfg bin/* tmp-networkcached/buildout.cfg tmp-networkcached/bin/*
cd $(RUN_BUILDOUT_DIR); sed -i 's#$(OLD_BUILD_DIR)#$(BUILD_DIR)#g' tmp-networkcached/bin/*
echo RUN_BUILDOUT_DIR = $(RUN_BUILDOUT_DIR) \; PY = $(PY)
cd $(RUN_BUILDOUT_DIR) && \
$(PY) ./bin/buildout -v
@touch build-stamp
clean:
# TODO: implement a proper cleaning
#rm -rf $(BUILD_DIR)
rm -f *-stamp
install: all
#cd slapos; make install
mkdir -p $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)/usr/sbin/
mkdir -p $(DESTDIR)/usr/etc/
mkdir -p $(DESTDIR)/usr/lib/
mkdir -p $(DESTDIR)/usr/share/
mkdir -p $(DESTDIR)/opt
#cp `find $(RUN_BUILDOUT_DIR) | grep -e "^$(RUN_BUILDOUT_DIR)/[^/][^/]*/bin/*` $(DESTDIR)/usr/bin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/bin/* $(DESTDIR)/usr/bin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/sbin/* $(DESTDIR)/usr/sbin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/etc/* $(DESTDIR)/usr/etc/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/lib/* $(DESTDIR)/usr/lib/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/share/* $(DESTDIR)/usr/share/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/opt/* $(DESTDIR)/opt
.PHONY: build all clean install
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment